Index: /stable/HeuristicLab.ExtLibs.sln
===================================================================
--- /stable/HeuristicLab.ExtLibs.sln	(revision 12706)
+++ /stable/HeuristicLab.ExtLibs.sln	(revision 12707)
@@ -2,5 +2,5 @@
 Microsoft Visual Studio Solution File, Format Version 12.00
 # Visual Studio 2013
-VisualStudioVersion = 12.0.21005.1
+VisualStudioVersion = 12.0.31101.0
 MinimumVisualStudioVersion = 10.0.40219.1
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.DayView-1.0", "HeuristicLab.ExtLibs\HeuristicLab.DayView\1.0\HeuristicLab.DayView-1.0.csproj", "{02766ECC-D0F5-4115-9ECA-47409167B638}"
@@ -41,8 +41,4 @@
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.ALGLIB-3.7.0", "HeuristicLab.ExtLibs\HeuristicLab.ALGLIB\3.7.0\HeuristicLab.ALGLIB-3.7.0\HeuristicLab.ALGLIB-3.7.0.csproj", "{6F1D7847-D610-4E52-A184-405DAEFA41A9}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EPPlus-3.1.3", "HeuristicLab.ExtLibs\HeuristicLab.EPPlus\3.1.3\EPPlus-3.1.3\EPPlus-3.1.3.csproj", "{7B288026-5502-4A39-BF41-77E086F3E4A3}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.EPPlus-3.1.3", "HeuristicLab.ExtLibs\HeuristicLab.EPPlus\3.1.3\HeuristicLab.EPPlus-3.1.3\HeuristicLab.EPPlus-3.1.3.csproj", "{B8B9E73B-18DE-4781-8F31-D3472BA9DB66}"
-EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotNetScilab-1.0", "HeuristicLab.ExtLibs\HeuristicLab.DotNetScilab\1.0\DotNetScilab-1.0\DotNetScilab-1.0.csproj", "{C3F0C7DC-82AD-405B-990A-BF2C5B7F46FF}"
 EndProject
@@ -68,4 +64,8 @@
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.NRefactory.Xml-5.5.0", "HeuristicLab.ExtLibs\HeuristicLab.NRefactory\5.5.0\NRefactory.Xml-5.5.0\ICSharpCode.NRefactory.Xml-5.5.0.csproj", "{C5AE5D30-AE8C-4017-B741-99E084281000}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EPPlus-4.0.3", "HeuristicLab.ExtLibs\HeuristicLab.EPPlus\4.0.3\EPPlus-4.0.3\EPPlus-4.0.3.csproj", "{832EA4F3-20F7-42D7-B079-B588BA559E5F}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.EPPlus-4.0.3", "HeuristicLab.ExtLibs\HeuristicLab.EPPlus\4.0.3\HeuristicLab.EPPlus-4.0.3\HeuristicLab.EPPlus-4.0.3.csproj", "{675A6EE4-DE7C-413E-8BEF-EB21E0384C87}"
 EndProject
 Global
@@ -271,28 +271,4 @@
 		{6F1D7847-D610-4E52-A184-405DAEFA41A9}.Release|x86.ActiveCfg = Release|x86
 		{6F1D7847-D610-4E52-A184-405DAEFA41A9}.Release|x86.Build.0 = Release|x86
-		{7B288026-5502-4A39-BF41-77E086F3E4A3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{7B288026-5502-4A39-BF41-77E086F3E4A3}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{7B288026-5502-4A39-BF41-77E086F3E4A3}.Debug|x64.ActiveCfg = Debug|x64
-		{7B288026-5502-4A39-BF41-77E086F3E4A3}.Debug|x64.Build.0 = Debug|x64
-		{7B288026-5502-4A39-BF41-77E086F3E4A3}.Debug|x86.ActiveCfg = Debug|x86
-		{7B288026-5502-4A39-BF41-77E086F3E4A3}.Debug|x86.Build.0 = Debug|x86
-		{7B288026-5502-4A39-BF41-77E086F3E4A3}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{7B288026-5502-4A39-BF41-77E086F3E4A3}.Release|Any CPU.Build.0 = Release|Any CPU
-		{7B288026-5502-4A39-BF41-77E086F3E4A3}.Release|x64.ActiveCfg = Release|x64
-		{7B288026-5502-4A39-BF41-77E086F3E4A3}.Release|x64.Build.0 = Release|x64
-		{7B288026-5502-4A39-BF41-77E086F3E4A3}.Release|x86.ActiveCfg = Release|x86
-		{7B288026-5502-4A39-BF41-77E086F3E4A3}.Release|x86.Build.0 = Release|x86
-		{B8B9E73B-18DE-4781-8F31-D3472BA9DB66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{B8B9E73B-18DE-4781-8F31-D3472BA9DB66}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{B8B9E73B-18DE-4781-8F31-D3472BA9DB66}.Debug|x64.ActiveCfg = Debug|x64
-		{B8B9E73B-18DE-4781-8F31-D3472BA9DB66}.Debug|x64.Build.0 = Debug|x64
-		{B8B9E73B-18DE-4781-8F31-D3472BA9DB66}.Debug|x86.ActiveCfg = Debug|x86
-		{B8B9E73B-18DE-4781-8F31-D3472BA9DB66}.Debug|x86.Build.0 = Debug|x86
-		{B8B9E73B-18DE-4781-8F31-D3472BA9DB66}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{B8B9E73B-18DE-4781-8F31-D3472BA9DB66}.Release|Any CPU.Build.0 = Release|Any CPU
-		{B8B9E73B-18DE-4781-8F31-D3472BA9DB66}.Release|x64.ActiveCfg = Release|x64
-		{B8B9E73B-18DE-4781-8F31-D3472BA9DB66}.Release|x64.Build.0 = Release|x64
-		{B8B9E73B-18DE-4781-8F31-D3472BA9DB66}.Release|x86.ActiveCfg = Release|x86
-		{B8B9E73B-18DE-4781-8F31-D3472BA9DB66}.Release|x86.Build.0 = Release|x86
 		{C3F0C7DC-82AD-405B-990A-BF2C5B7F46FF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 		{C3F0C7DC-82AD-405B-990A-BF2C5B7F46FF}.Debug|Any CPU.Build.0 = Debug|Any CPU
@@ -439,4 +415,28 @@
 		{C5AE5D30-AE8C-4017-B741-99E084281000}.Release|x86.ActiveCfg = Release|x86
 		{C5AE5D30-AE8C-4017-B741-99E084281000}.Release|x86.Build.0 = Release|x86
+		{832EA4F3-20F7-42D7-B079-B588BA559E5F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{832EA4F3-20F7-42D7-B079-B588BA559E5F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{832EA4F3-20F7-42D7-B079-B588BA559E5F}.Debug|x64.ActiveCfg = Debug|x64
+		{832EA4F3-20F7-42D7-B079-B588BA559E5F}.Debug|x64.Build.0 = Debug|x64
+		{832EA4F3-20F7-42D7-B079-B588BA559E5F}.Debug|x86.ActiveCfg = Debug|x86
+		{832EA4F3-20F7-42D7-B079-B588BA559E5F}.Debug|x86.Build.0 = Debug|x86
+		{832EA4F3-20F7-42D7-B079-B588BA559E5F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{832EA4F3-20F7-42D7-B079-B588BA559E5F}.Release|Any CPU.Build.0 = Release|Any CPU
+		{832EA4F3-20F7-42D7-B079-B588BA559E5F}.Release|x64.ActiveCfg = Release|x64
+		{832EA4F3-20F7-42D7-B079-B588BA559E5F}.Release|x64.Build.0 = Release|x64
+		{832EA4F3-20F7-42D7-B079-B588BA559E5F}.Release|x86.ActiveCfg = Release|x86
+		{832EA4F3-20F7-42D7-B079-B588BA559E5F}.Release|x86.Build.0 = Release|x86
+		{675A6EE4-DE7C-413E-8BEF-EB21E0384C87}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{675A6EE4-DE7C-413E-8BEF-EB21E0384C87}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{675A6EE4-DE7C-413E-8BEF-EB21E0384C87}.Debug|x64.ActiveCfg = Debug|x64
+		{675A6EE4-DE7C-413E-8BEF-EB21E0384C87}.Debug|x64.Build.0 = Debug|x64
+		{675A6EE4-DE7C-413E-8BEF-EB21E0384C87}.Debug|x86.ActiveCfg = Debug|x86
+		{675A6EE4-DE7C-413E-8BEF-EB21E0384C87}.Debug|x86.Build.0 = Debug|x86
+		{675A6EE4-DE7C-413E-8BEF-EB21E0384C87}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{675A6EE4-DE7C-413E-8BEF-EB21E0384C87}.Release|Any CPU.Build.0 = Release|Any CPU
+		{675A6EE4-DE7C-413E-8BEF-EB21E0384C87}.Release|x64.ActiveCfg = Release|x64
+		{675A6EE4-DE7C-413E-8BEF-EB21E0384C87}.Release|x64.Build.0 = Release|x64
+		{675A6EE4-DE7C-413E-8BEF-EB21E0384C87}.Release|x86.ActiveCfg = Release|x86
+		{675A6EE4-DE7C-413E-8BEF-EB21E0384C87}.Release|x86.Build.0 = Release|x86
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/CellStore.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/CellStore.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/CellStore.cs	(revision 12707)
@@ -0,0 +1,1977 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		    Added       		        2012-11-25
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Collections;
+using OfficeOpenXml;
+    internal class IndexBase : IComparable<IndexBase>
+    {        
+        internal short Index;
+        public int CompareTo(IndexBase other)
+        {
+            return Index < other.Index ? -1 : Index > other.Index ? 1 : 0;
+        }
+    }
+    internal class IndexItem :  IndexBase
+    {
+        internal int IndexPointer 
+        {
+            get; 
+            set;
+        }
+    }        
+    internal class ColumnIndex : IndexBase, IDisposable
+    {
+        internal IndexBase _searchIx=new IndexBase();
+        public ColumnIndex ()
+	    {
+            _pages=new PageIndex[CellStore<int>.PagesPerColumnMin];
+            PageCount=0;
+	    }
+        ~ColumnIndex()
+	    {
+            _pages=null;            
+	    }
+        internal int GetPosition(int Row)
+        {
+            var page = (short)(Row >> CellStore<int>.pageBits);
+            _searchIx.Index = page;
+            var res = Array.BinarySearch(_pages, 0, PageCount, _searchIx);
+            if (res >= 0)
+            {
+                GetPage(Row, ref res);
+                return res;
+            }
+            else
+            {
+                var p = ~res;
+                
+                if (GetPage(Row, ref p))
+                {
+                    return p;
+                }
+                else
+                {
+                    return res;
+                }
+            }
+        }
+
+        private bool GetPage(int Row, ref int res)
+        {
+            if (res < PageCount && _pages[res].MinIndex <= Row && _pages[res].MaxIndex >= Row)
+            {
+                return true;
+            }
+            else
+            {
+                if (res + 1 < PageCount && _pages[res + 1].MinIndex <= Row)
+                {
+                    do
+                    {
+                        res++;
+                    }
+                    while (res + 1 < PageCount && _pages[res + 1].MinIndex <= Row);
+                    //if (res + 1 < PageCount && _pages[res + 1].MaxIndex >= Row)
+                    //{
+                        return true;
+                    //}
+                    //else
+                    //{
+                    //    return false;
+                    //}
+                }
+                else if (res - 1 >= 0 && _pages[res - 1].MaxIndex >= Row)
+                {
+                    do
+                    {
+                        res--;
+                    }
+                    while (res-1 > 0 && _pages[res-1].MaxIndex >= Row);
+                    //if (res > 0)
+                    //{
+                        return true;
+                    //}
+                    //else
+                    //{
+                    //    return false;
+                    //}
+                }
+                return false;
+            }
+        }
+        internal int GetNextRow(int row)
+        {
+            //var page = (int)((ulong)row >> CellStore<int>.pageBits);
+            var p = GetPosition(row);
+            if (p < 0)
+            {
+                p = ~p;
+                if (p >= PageCount)
+                {
+                    return -1;
+                }
+                else
+                {
+
+                    if (_pages[p].IndexOffset + _pages[p].Rows[0].Index < row)
+                    {
+                        if (p + 1 >= PageCount)
+                        {
+                            return -1;
+                        }
+                        else
+                        {
+                            return _pages[p + 1].IndexOffset + _pages[p].Rows[0].Index;
+                        }
+                    }
+                    else
+                    {
+                        return _pages[p].IndexOffset + _pages[p].Rows[0].Index;
+                    }
+                }
+            }
+            else
+            {
+                if (p < PageCount)
+                {
+                    var r = _pages[p].GetNextRow(row);
+                    if (r >= 0)
+                    {
+                        return _pages[p].IndexOffset + _pages[p].Rows[r].Index;
+                    }
+                    else
+                    {
+                        if (++p < PageCount)
+                        {
+                            return _pages[p].IndexOffset + _pages[p].Rows[0].Index;
+                        }
+                        else
+                        {
+                            return -1;
+                        }
+                    }
+                }
+                else
+                {
+                    return -1;
+                }
+            }
+        }
+        internal int FindNext(int Page)
+        {
+            var p = GetPosition(Page);
+            if (p < 0)
+            {
+                return ~p;
+            }
+            return p;
+        }
+        internal PageIndex[] _pages;
+        internal int PageCount;
+
+        public void Dispose()
+        {
+            for (int p = 0; p < PageCount; p++)
+            {
+                ((IDisposable)_pages[p]).Dispose();
+            }
+            _pages = null;
+        }
+
+    }
+    internal class PageIndex : IndexBase, IDisposable
+    {
+        internal IndexBase _searchIx = new IndexBase();
+        public PageIndex()
+	    {
+            Rows = new IndexItem[CellStore<int>.PageSizeMin];
+            RowCount = 0;
+	    }
+        public PageIndex(IndexItem[] rows, int count)
+        {
+            Rows = rows;
+            RowCount = count;
+        }
+        public PageIndex(PageIndex pageItem, int start, int size)
+            :this(pageItem, start, size, pageItem.Index, pageItem.Offset)
+        {
+
+        }
+        public PageIndex(PageIndex pageItem, int start, int size, short index, int offset)
+        {
+            Rows = new IndexItem[CellStore<int>.GetSize(size)];
+            Array.Copy(pageItem.Rows, start, Rows,0,size);
+            RowCount = size;
+            Index = index;
+            Offset = offset;
+        }
+        ~PageIndex()
+	    {
+            Rows=null;
+	    }
+        internal int Offset = 0;
+        internal int IndexOffset
+        {
+            get
+            {
+                return IndexExpanded + (int)Offset;
+            }
+        }
+        internal int IndexExpanded
+        {
+            get
+            {
+                return (Index << CellStore<int>.pageBits);
+            }
+        }
+        internal IndexItem[] Rows { get; set; }
+        internal int RowCount;
+
+        internal int GetPosition(int offset)
+        {
+            _searchIx.Index = (short)offset;
+            return Array.BinarySearch(Rows, 0, RowCount, _searchIx);
+        }
+        internal int GetNextRow(int row)
+        {
+            int offset = row - IndexOffset;
+            var o= GetPosition(offset);
+            if (o < 0)
+            {
+                o = ~o;
+                if (o < RowCount)
+                {
+                    return o;
+                }
+                else
+                {
+                    return -1;
+                }
+            }
+            return o;
+        }
+
+        public int MinIndex
+        {
+            get
+            {
+                if (Rows.Length > 0)
+                {
+                    return IndexOffset + Rows[0].Index;
+                }
+                else
+                {
+                    return -1;
+                }
+            }
+        }
+        public int MaxIndex
+        {
+            get
+            {
+                if (RowCount > 0)
+                {
+                    return IndexOffset + Rows[RowCount-1].Index;
+                }
+                else
+                {
+                    return -1;
+                }
+            }
+        }
+        public int GetIndex(int pos)
+        {
+            return IndexOffset + Rows[pos].Index;
+        }
+        public void Dispose()
+        {
+            Rows = null;
+        }
+    }
+    /// <summary>
+    /// This is the store for all Rows, Columns and Cells.
+    /// It is a Dictionary implementation that allows you to change the Key (the RowID, ColumnID or CellID )
+    /// </summary>
+    internal class CellStore<T> : IDisposable// : IEnumerable<ulong>, IEnumerator<ulong>
+    {
+        /**** Size constants ****/
+        internal const int pageBits = 10;   //13bits=8192  Note: Maximum is 13 bits since short is used (PageMax=16K)
+        internal const int PageSize = 1 << pageBits;
+        internal const int PageSizeMin = 1<<10;
+        internal const int PageSizeMax = PageSize << 1; //Double page size
+        internal const int ColSizeMin = 32;
+        internal const int PagesPerColumnMin = 32;
+
+        List<T> _values = new List<T>();
+        internal ColumnIndex[] _columnIndex;
+        internal IndexBase _searchIx = new IndexBase();
+        internal int ColumnCount;
+        public CellStore ()
+	    {
+            _columnIndex = new ColumnIndex[ColSizeMin];
+	    }
+        ~CellStore()
+	    {
+            if (_values != null)
+            {
+                _values.Clear();
+                _values = null;
+            }
+            _columnIndex=null;
+	    }
+        internal int GetPosition(int Column)
+        {
+            _searchIx.Index = (short)Column;
+            return Array.BinarySearch(_columnIndex, 0, ColumnCount, _searchIx);
+        }
+        internal CellStore<T> Clone()
+        {
+            int row,col;
+            var ret=new CellStore<T>();
+            for (int c = 0; c < ColumnCount; c++)
+            {
+                col = _columnIndex[c].Index;
+                for (int p = 0;p < _columnIndex[c].PageCount; p++)
+                {
+                    for (int r = 0; r < _columnIndex[c]._pages[p].RowCount; r++)
+                    {
+                        row = _columnIndex[c]._pages[p].IndexOffset + _columnIndex[c]._pages[p].Rows[r].Index;
+                        ret.SetValue(row, col, _values[_columnIndex[c]._pages[p].Rows[r].IndexPointer]);
+                    }
+                }
+            }
+            return ret;
+        }
+        internal int Count
+        {
+            get
+            {
+                int count=0;
+                for (int c = 0; c < ColumnCount; c++)
+                {
+                    for (int p = 0; p < _columnIndex[c].PageCount; p++)
+                    {
+                        count += _columnIndex[c]._pages[p].RowCount;
+                    }
+                }
+                return count;
+            }
+        }
+        internal bool GetDimension(out int fromRow, out int fromCol, out int toRow, out int toCol)
+        {
+            if (ColumnCount == 0)
+            {
+                fromRow = fromCol = toRow = toCol = 0;
+                return false;
+            }
+            else
+            {
+                fromCol=_columnIndex[0].Index;
+                var fromIndex = 0;
+                if (fromCol <= 0 && ColumnCount > 1)
+                {
+                    fromCol = _columnIndex[1].Index;
+                    fromIndex = 1;
+                }
+                else if(ColumnCount == 1 && fromCol <= 0)
+                {
+                    fromRow = fromCol = toRow = toCol = 0;
+                    return false;
+                }
+                var col = ColumnCount - 1;
+                while (col > 0)
+                {
+                    if (_columnIndex[col].PageCount == 0 || _columnIndex[col]._pages[0].RowCount > 1 || _columnIndex[col]._pages[0].Rows[0].Index > 0)
+                    {
+                        break;
+                    }
+                    col--;
+                }
+                toCol=_columnIndex[col].Index;
+                if (toCol == 0)
+                {
+                    fromRow = fromCol = toRow = toCol = 0;
+                    return false;                    
+                }
+                fromRow = toRow= 0;
+
+                for (int c = fromIndex; c < ColumnCount; c++)
+                {                    
+                    int first, last;
+                    if (_columnIndex[c].PageCount == 0) continue;                    
+                    if (_columnIndex[c]._pages[0].RowCount > 0 && _columnIndex[c]._pages[0].Rows[0].Index > 0)
+                    {
+                        first = _columnIndex[c]._pages[0].IndexOffset + _columnIndex[c]._pages[0].Rows[0].Index;
+                    }
+                    else
+                    {
+                        if(_columnIndex[c]._pages[0].RowCount>1)
+                        {
+                            first = _columnIndex[c]._pages[0].IndexOffset + _columnIndex[c]._pages[0].Rows[1].Index;
+                        }
+                        else if (_columnIndex[c].PageCount > 1)
+                        {
+                            first = _columnIndex[c]._pages[0].IndexOffset + _columnIndex[c]._pages[1].Rows[0].Index;
+                        }
+                        else
+                        {
+                            first = 0;
+                        }
+                    }
+                    var lp = _columnIndex[c].PageCount - 1;
+                    while(_columnIndex[c]._pages[lp].RowCount==0 && lp!=0)
+                    {
+                        lp--;
+                    }
+                    var p = _columnIndex[c]._pages[lp];
+                    if (p.RowCount > 0)
+                    {
+                        last = p.IndexOffset + p.Rows[p.RowCount - 1].Index;
+                    }
+                    else
+                    {
+                        last = first;
+                    }
+                    if (first > 0 && (first < fromRow || fromRow == 0))
+                    {
+                        fromRow=first;
+                    }
+                    if (first>0 && (last > toRow || toRow == 0))
+                    {
+                        toRow=last;
+                    }
+                }
+                if (fromRow <= 0 || toRow <= 0)
+                {
+                    fromRow = fromCol = toRow = toCol = 0;
+                    return false;
+                }
+                else
+                {
+                    return true;
+                }
+            }
+        }
+        internal int FindNext(int Column)
+        {
+            var c = GetPosition(Column);
+            if (c < 0)
+            {
+                return ~c;
+            }
+            return c;
+        }
+        internal T GetValue(int Row, int Column)
+        {
+            int i = GetPointer(Row, Column);
+            if (i >= 0)
+            {
+                return _values[i];
+            }
+            else
+            {
+                return default(T);                
+            }
+            //var col = GetPosition(Column);
+            //if (col >= 0)  
+            //{
+            //    var pos = _columnIndex[col].GetPosition(Row);
+            //    if (pos >= 0) 
+            //    {
+            //        var pageItem = _columnIndex[col].Pages[pos];
+            //        if (pageItem.MinIndex > Row)
+            //        {
+            //            pos--;
+            //            if (pos < 0)
+            //            {
+            //                return default(T);
+            //            }
+            //            else
+            //            {
+            //                pageItem = _columnIndex[col].Pages[pos];
+            //            }
+            //        }
+            //        short ix = (short)(Row - pageItem.IndexOffset);
+            //        var cellPos = Array.BinarySearch(pageItem.Rows, 0, pageItem.RowCount, new IndexBase() { Index = ix });
+            //        if (cellPos >= 0) 
+            //        {
+            //            return _values[pageItem.Rows[cellPos].IndexPointer];
+            //        }
+            //        else //Cell does not exist
+            //        {
+            //            return default(T);
+            //        }
+            //    }
+            //    else //Page does not exist
+            //    {
+            //        return default(T);
+            //    }
+            //}
+            //else //Column does not exist
+            //{
+            //    return default(T);
+            //}
+        }
+        int GetPointer(int Row, int Column)
+        {
+            var col = GetPosition(Column);
+            if (col >= 0)
+            {
+                var pos = _columnIndex[col].GetPosition(Row);
+                if (pos >= 0 && pos < _columnIndex[col].PageCount)
+                {
+                    var pageItem = _columnIndex[col]._pages[pos];
+                    if (pageItem.MinIndex > Row)
+                    {
+                        pos--;
+                        if (pos < 0)
+                        {
+                            return -1;
+                        }
+                        else
+                        {
+                            pageItem = _columnIndex[col]._pages[pos];
+                        }
+                    }
+                    short ix = (short)(Row - pageItem.IndexOffset);
+                    _searchIx.Index = ix;
+                    var cellPos = Array.BinarySearch(pageItem.Rows, 0, pageItem.RowCount, _searchIx);
+                    if (cellPos >= 0)
+                    {
+                        return pageItem.Rows[cellPos].IndexPointer;
+                    }
+                    else //Cell does not exist
+                    {
+                        return -1;
+                    }
+                }
+                else //Page does not exist
+                {
+                    return -1;
+                }
+            }
+            else //Column does not exist
+            {
+                return -1;
+            }
+        }
+        internal bool Exists(int Row,int Column)
+        {
+            return GetPointer(Row, Column)>=0;
+        }
+        internal bool Exists(int Row, int Column, ref T value)
+        {
+            var p=GetPointer(Row, Column);
+            if (p >= 0)
+            {
+                value = _values[p];
+                return true;
+            }
+            else
+            {                
+                return false;
+            }
+        }
+        internal void SetValue(int Row, int Column, T Value)
+        {
+            lock (_columnIndex)
+            {
+                var col = Array.BinarySearch(_columnIndex, 0, ColumnCount, new IndexBase() { Index = (short)(Column) });
+                var page = (short)(Row >> pageBits);
+                if (col >= 0)
+                {
+                    //var pos = Array.BinarySearch(_columnIndex[col].Pages, 0, _columnIndex[col].Count, new IndexBase() { Index = page });
+                    var pos = _columnIndex[col].GetPosition(Row);
+                    if (pos < 0)
+                    {
+                        pos = ~pos;
+                        if (pos - 1 < 0 || _columnIndex[col]._pages[pos - 1].IndexOffset + PageSize - 1 < Row)
+                        {
+                            AddPage(_columnIndex[col], pos, page);
+                        }
+                        else
+                        {
+                            pos--;
+                        }
+                    }
+                    if (pos >= _columnIndex[col].PageCount)
+                    {
+                        AddPage(_columnIndex[col], pos, page);
+                    }
+                    var pageItem = _columnIndex[col]._pages[pos];
+                    if (pageItem.IndexOffset > Row)
+                    {
+                        pos--;
+                        page--;
+                        if (pos < 0)
+                        {
+                            throw (new Exception("Unexpected error when setting value"));
+                        }
+                        pageItem = _columnIndex[col]._pages[pos];
+                    }
+
+                    short ix = (short)(Row - ((pageItem.Index << pageBits) + pageItem.Offset));
+                    _searchIx.Index = ix;
+                    var cellPos = Array.BinarySearch(pageItem.Rows, 0, pageItem.RowCount, _searchIx);
+                    if (cellPos < 0)
+                    {
+                        cellPos = ~cellPos;
+                        AddCell(_columnIndex[col], pos, cellPos, ix, Value);
+                    }
+                    else
+                    {
+                        _values[pageItem.Rows[cellPos].IndexPointer] = Value;
+                    }
+                }
+                else //Column does not exist
+                {
+                    col = ~col;
+                    AddColumn(col, Column);
+                    AddPage(_columnIndex[col], 0, page);
+                    short ix = (short)(Row - (page << pageBits));
+                    AddCell(_columnIndex[col], 0, 0, ix, Value);
+                }
+            }
+        }
+
+        internal void Insert(int fromRow, int fromCol, int rows, int columns)
+        {
+            lock (_columnIndex)
+            {
+
+                if (columns > 0)
+                {
+                    var col = GetPosition(fromCol);
+                    if (col < 0)
+                    {
+                        col = ~col;
+                    }
+                    for (var c = col; c < ColumnCount; c++)
+                    {
+                        _columnIndex[c].Index += (short)columns;
+                    }
+                }
+                else
+                {
+                    var page = fromRow >> pageBits;
+                    for (int c = 0; c < ColumnCount; c++)
+                    {
+                        var column = _columnIndex[c];
+                        var pagePos = column.GetPosition(fromRow);
+                        if (pagePos >= 0)
+                        {
+                            if (fromRow >= column._pages[pagePos].MinIndex && fromRow <= column._pages[pagePos].MaxIndex) //The row is inside the page
+                            {
+                                int offset = fromRow - column._pages[pagePos].IndexOffset;
+                                var rowPos = column._pages[pagePos].GetPosition(offset);
+                                if (rowPos < 0)
+                                {
+                                    rowPos = ~rowPos;
+                                }
+                                UpdateIndexOffset(column, pagePos, rowPos, fromRow, rows);
+                            }
+                            else if (column._pages[pagePos].MinIndex > fromRow - 1 && pagePos > 0) //The row is on the page before.
+                            {
+                                int offset = fromRow - ((page - 1) << pageBits);
+                                var rowPos = column._pages[pagePos - 1].GetPosition(offset);
+                                if (rowPos > 0 && pagePos > 0)
+                                {
+                                    UpdateIndexOffset(column, pagePos - 1, rowPos, fromRow, rows);
+                                }
+                            }
+                            else if (column.PageCount >= pagePos + 1)
+                            {
+                                int offset = fromRow - column._pages[pagePos].IndexOffset;
+                                var rowPos = column._pages[pagePos].GetPosition(offset);
+                                if (rowPos < 0)
+                                {
+                                    rowPos = ~rowPos;
+                                }
+                                if (column._pages[pagePos].RowCount > rowPos)
+                                {
+                                    UpdateIndexOffset(column, pagePos, rowPos, fromRow, rows);
+                                }
+                                else
+                                {
+                                    UpdateIndexOffset(column, pagePos + 1, 0, fromRow, rows);
+                                }
+                            }
+                        }
+                        else
+                        {
+                            UpdateIndexOffset(column, ~pagePos, 0, fromRow, rows);
+                        }
+                    }
+                }
+            }
+        }
+        internal void Clear(int fromRow, int fromCol, int rows, int columns)
+        {
+            Delete(fromRow, fromCol, rows, columns, false);
+        }
+        internal void Delete(int fromRow, int fromCol, int rows, int columns)
+        {
+            Delete(fromRow, fromCol, rows, columns, true);
+        }
+        internal void Delete(int fromRow, int fromCol, int rows, int columns, bool shift)
+        {
+            lock (_columnIndex)
+            {
+                if (columns > 0 && fromRow == 1 && rows >= ExcelPackage.MaxRows)
+                {
+                    DeleteColumns(fromCol, columns, shift);
+                }
+                else
+                {
+                    var toCol = fromCol + columns - 1;
+                    var pageFromRow = fromRow >> pageBits;
+                    for (int c = 0; c < ColumnCount; c++)
+                    {
+                        var column = _columnIndex[c];
+                        if (column.Index >= fromCol)
+                        {
+                            if (column.Index > toCol) break;
+                            var pagePos = column.GetPosition(fromRow);
+                            if (pagePos < 0) pagePos = ~pagePos;
+                            if (pagePos < column.PageCount)
+                            {
+                                var page = column._pages[pagePos];
+                                if (shift && page.RowCount > 0 && page.MinIndex > fromRow && page.MaxIndex >= fromRow + rows)
+                                {
+                                    var o=page.MinIndex - fromRow;
+                                    if (o < rows)
+                                    {
+                                        rows -= o;
+                                        page.Offset -= o;
+                                        UpdatePageOffset(column, pagePos, o);
+                                    }
+                                    else
+                                    {
+                                        page.Offset -= rows;
+                                        UpdatePageOffset(column, pagePos, rows);
+                                        continue;
+                                    }
+                                }
+                                if (page.RowCount > 0 && page.MinIndex <= fromRow+rows-1 && page.MaxIndex >= fromRow) //The row is inside the page
+                                {
+                                    var endRow = fromRow + rows;
+                                    var delEndRow = DeleteCells(column._pages[pagePos], fromRow, endRow, shift);
+                                    if (shift && delEndRow != fromRow) UpdatePageOffset(column, pagePos, delEndRow - fromRow);
+                                    if (endRow > delEndRow && pagePos < column.PageCount && column._pages[pagePos].MinIndex < endRow)
+                                    {
+                                        pagePos = (delEndRow == fromRow ? pagePos : pagePos + 1);
+                                        var rowsLeft = DeletePage(fromRow, endRow - delEndRow, column, pagePos);
+                                        //if (shift) UpdatePageOffset(column, pagePos, endRow - fromRow - rowsLeft);
+                                        if (rowsLeft > 0)
+                                        {
+                                            pagePos = column.GetPosition(fromRow);
+                                            delEndRow = DeleteCells(column._pages[pagePos], fromRow, fromRow + rowsLeft, shift);
+                                            if (shift) UpdatePageOffset(column, pagePos, rowsLeft);
+                                        }
+                                    }
+                                }
+                                else if (pagePos > 0 && column._pages[pagePos].IndexOffset > fromRow) //The row is on the page before.
+                                {
+                                    int offset = fromRow + rows - 1 - ((pageFromRow - 1) << pageBits);
+                                    var rowPos = column._pages[pagePos - 1].GetPosition(offset);
+                                    if (rowPos > 0 && pagePos > 0)
+                                    {
+                                        if (shift) UpdateIndexOffset(column, pagePos - 1, rowPos, fromRow + rows - 1, -rows);
+                                    }
+                                }
+                                else
+                                {
+                                    if (shift && pagePos + 1 < column.PageCount) UpdateIndexOffset(column, pagePos + 1, 0, column._pages[pagePos + 1].MinIndex, -rows);
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+        private void UpdatePageOffset(ColumnIndex column, int pagePos, int rows)
+        {
+            //Update Pageoffset
+            
+            if (++pagePos < column.PageCount)
+            {
+                for (int p = pagePos; p < column.PageCount; p++)
+                {
+                    if (column._pages[p].Offset - rows <= -PageSize)
+                    {
+                        column._pages[p].Index--;
+                        column._pages[p].Offset -= rows-PageSize;
+                    }
+                    else
+                    {
+                        column._pages[p].Offset -= rows;
+                    }
+                }
+
+                if (Math.Abs(column._pages[pagePos].Offset) > PageSize ||
+                    Math.Abs(column._pages[pagePos].Rows[column._pages[pagePos].RowCount-1].Index) > PageSizeMax) //Split or Merge???
+                {
+                    rows=ResetPageOffset(column, pagePos, rows);
+                    ////MergePages
+                    //if (column.Pages[pagePos - 1].Index + 1 == column.Pages[pagePos].Index)
+                    //{
+                    //    if (column.Pages[pagePos].IndexOffset + column.Pages[pagePos].Rows[column.Pages[pagePos].RowCount - 1].Index + rows -
+                    //        column.Pages[pagePos - 1].IndexOffset + column.Pages[pagePos - 1].Rows[0].Index <= PageSize)
+                    //    {
+                    //        //Merge
+                    //        MergePage(column, pagePos - 1, -rows);
+                    //    }
+                    //    else
+                    //    {
+                    //        //Split
+                    //    }
+                    //}
+                    //rows -= PageSize;
+                    //for (int p = pagePos; p < column.PageCount; p++)
+                    //{                            
+                    //    column.Pages[p].Index -= 1;
+                    //}
+                    return;
+                }
+            }
+        }
+
+        private int ResetPageOffset(ColumnIndex column, int pagePos, int rows)
+        {
+            PageIndex fromPage=column._pages[pagePos];
+            PageIndex toPage;
+            short pageAdd = 0;
+            if (fromPage.Offset < -PageSize)
+            {
+                toPage=column._pages[pagePos-1];
+                pageAdd = -1;
+                if (fromPage.Index - 1 == toPage.Index)
+                {
+                    if (fromPage.IndexOffset + fromPage.Rows[fromPage.RowCount - 1].Index -
+                        toPage.IndexOffset + toPage.Rows[0].Index <= PageSizeMax)
+                    {
+                        MergePage(column, pagePos - 1);
+                        //var newPage = new PageIndex(toPage, 0, GetSize(fromPage.RowCount + toPage.RowCount));
+                        //newPage.RowCount = fromPage.RowCount + fromPage.RowCount;
+                        //Array.Copy(toPage.Rows, 0, newPage.Rows, 0, toPage.RowCount);
+                        //Array.Copy(fromPage.Rows, 0, newPage.Rows, toPage.RowCount, fromPage.RowCount);
+                        //for (int r = toPage.RowCount; r < newPage.RowCount; r++)
+                        //{
+                        //    newPage.Rows[r].Index += (short)(fromPage.IndexOffset - toPage.IndexOffset);
+                        //}
+                        
+                    }
+                }
+                else //No page after 
+                {
+                    fromPage.Index -= pageAdd;
+                    fromPage.Offset += PageSize;
+                }
+            }
+            else if (fromPage.Offset > PageSize)
+            {
+                toPage = column._pages[pagePos + 1];
+                pageAdd = 1;
+                if (fromPage.Index + 1 == toPage.Index)
+                {
+
+                }
+                else
+                {
+                    fromPage.Index += pageAdd;
+                    fromPage.Offset += PageSize;
+                }
+            }
+            return rows;
+        }
+
+        private int DeletePage(int fromRow, int rows, ColumnIndex column, int pagePos)
+        {
+            PageIndex page = column._pages[pagePos];
+            while (page != null && page.MinIndex >= fromRow && page.MaxIndex < fromRow + rows)
+            {
+                //Delete entire page.
+                var delSize=page.MaxIndex - page.MinIndex+1;
+                rows -= delSize;
+                var prevOffset = page.Offset;
+                Array.Copy(column._pages, pagePos + 1, column._pages, pagePos, column.PageCount - pagePos + 1);
+                column.PageCount--;
+                if (column.PageCount == 0)
+                {
+                    return 0;
+                }
+                else
+                {
+                    for (int i = pagePos; i < column.PageCount; i++)
+                    {
+                        column._pages[i].Offset -= delSize;
+                        if (column._pages[i].Offset <= -PageSize)
+                        {
+                            column._pages[i].Index--;
+                            column._pages[i].Offset += PageSize;
+                        }
+                    }
+                }                
+                if (column.PageCount > pagePos)
+                {
+                    page = column._pages[pagePos];
+                    //page.Offset = pagePos == 0 ? 1 : prevOffset;  //First page can only reference to rows starting from Index == 1
+                }
+                else
+                {
+                    //No more pages, return 0
+                    return 0;
+                }
+            }
+            return rows;
+        }
+        ///
+        private int DeleteCells(PageIndex page,  int fromRow, int toRow, bool shift)
+        {
+            var fromPos = page.GetPosition(fromRow - (page.IndexOffset));
+            if (fromPos < 0)
+            {
+                fromPos = ~fromPos;
+            }
+            var maxRow = page.MaxIndex;
+            var offset = toRow - page.IndexOffset;
+            if (offset > PageSizeMax) offset = PageSizeMax;
+            var toPos = page.GetPosition(offset);
+            if (toPos < 0)
+            {
+                toPos = ~toPos;
+            }
+
+            if (fromPos <= toPos && fromPos < page.RowCount && page.GetIndex(fromPos) < toRow)
+            {
+                if (toRow > page.MaxIndex)
+                {
+                    if (fromRow == page.MinIndex) //Delete entire page, late in the page delete method
+                    {
+                        return fromRow;
+                    }
+                    var r = page.MaxIndex;
+                    var deletedRow = page.RowCount - fromPos; 
+                    page.RowCount -= deletedRow;
+                    return r+1;
+                }
+                else
+                {
+                    var rows = toRow - fromRow;
+                    if(shift) UpdateRowIndex(page, toPos, rows);
+                    Array.Copy(page.Rows, toPos, page.Rows, fromPos, page.RowCount - toPos);
+                    page.RowCount -= toPos-fromPos;
+
+                    return toRow;
+                }
+            }
+            else if(shift)
+            {
+                UpdateRowIndex(page, toPos, toRow - fromRow);
+            }
+            return toRow < maxRow ? toRow : maxRow;
+        }
+
+        private static void UpdateRowIndex(PageIndex page, int toPos, int rows)
+        {
+            for (int r = toPos; r < page.RowCount; r++)
+            {
+                page.Rows[r].Index -= (short) rows;
+            }
+        }
+
+        private void DeleteColumns(int fromCol, int columns, bool shift)
+        {
+            var fPos = GetPosition(fromCol);
+            if (fPos < 0)
+            {
+                fPos = ~fPos;
+            }
+            int tPos = fPos;
+            for (var c = fPos; c <= ColumnCount; c++)
+            {
+                tPos = c;
+                if (tPos==ColumnCount || _columnIndex[c].Index >= fromCol + columns)
+                {
+                    break;
+                }
+            }
+
+            if (ColumnCount <= fPos)
+            {
+                return;
+            }
+
+            if (_columnIndex[fPos].Index >= fromCol && _columnIndex[fPos].Index <= fromCol + columns)
+            {
+                //if (_columnIndex[fPos].Index < ColumnCount)
+                //{
+                    if (tPos < ColumnCount)
+                    {
+                        Array.Copy(_columnIndex, tPos, _columnIndex, fPos, ColumnCount - tPos);
+                    }
+                    ColumnCount -= (tPos - fPos);
+                //}
+            }
+            if (shift)
+            {
+                for (var c = fPos; c < ColumnCount; c++)
+                {
+                    _columnIndex[c].Index -= (short)columns;
+                }
+            }
+        }
+
+        private void UpdateIndexOffset(ColumnIndex column, int pagePos, int rowPos, int row, int rows)
+        {
+            if (pagePos >= column.PageCount) return;    //A page after last cell.
+            var page = column._pages[pagePos];
+            if (rows > PageSize)
+            {
+                short addPages = (short)(rows >> pageBits);
+                int offset = +(int)(rows - (PageSize*addPages));
+                for (int p = pagePos + 1; p < column.PageCount; p++)
+                {
+                    if (column._pages[p].Offset + offset > PageSize)
+                    {
+                        column._pages[p].Index += (short)(addPages + 1);
+                        column._pages[p].Offset += offset - PageSize;
+                    }
+                    else
+                    {
+                        column._pages[p].Index += addPages;
+                        column._pages[p].Offset += offset;
+                    }
+                    
+                }
+
+                var size = page.RowCount - rowPos;
+                if (page.RowCount > rowPos)
+                {
+                    if (column.PageCount-1 == pagePos) //No page after, create a new one.
+                    {
+                        //Copy rows to next page.
+                        var newPage = CopyNew(page, rowPos, size);
+                        newPage.Index = (short)((row + rows) >> pageBits);
+                        newPage.Offset = row + rows - (newPage.Index * PageSize) - newPage.Rows[0].Index;
+                        if (newPage.Offset > PageSize)
+                        {
+                            newPage.Index++;
+                            newPage.Offset -= PageSize;
+                        }
+                        AddPage(column, pagePos + 1, newPage);
+                        page.RowCount = rowPos;
+                    }
+                    else
+                    {
+                        if (column._pages[pagePos + 1].RowCount + size > PageSizeMax) //Split Page
+                        {
+                            SplitPageInsert(column,pagePos, rowPos, rows, size, addPages);
+                        }
+                        else //Copy Page.
+                        {
+                            CopyMergePage(page, rowPos, rows, size, column._pages[pagePos + 1]);                            
+                        }
+                    }
+                }
+            }
+            else
+            {
+                //Add to Pages.
+                for (int r = rowPos; r < page.RowCount; r++)
+                {
+                    page.Rows[r].Index += (short)rows;
+                }
+                if (page.Offset + page.Rows[page.RowCount-1].Index >= PageSizeMax)   //Can not be larger than the max size of the page.
+                {
+                    AdjustIndex(column, pagePos);
+                    if (page.Offset + page.Rows[page.RowCount - 1].Index >= PageSizeMax)
+                    {
+                        pagePos=SplitPage(column, pagePos);
+                    }
+                    //IndexItem[] newRows = new IndexItem[GetSize(page.RowCount - page.Rows[r].Index)];
+                    //var newPage = new PageIndex(newRows, r);
+                    //newPage.Index = (short)(pagePos + 1);
+                    //TODO: MoveRows to next page.
+                }
+
+                for (int p = pagePos + 1; p < column.PageCount; p++)
+                {
+                    if (column._pages[p].Offset + rows < PageSize)
+                    {
+                        column._pages[p].Offset += rows;
+                    }
+                    else
+                    {
+                        column._pages[p].Index++;
+                        column._pages[p].Offset = (column._pages[p].Offset+rows) % PageSize;
+                    }
+                }
+            }
+        }
+
+        private void SplitPageInsert(ColumnIndex column,int pagePos, int rowPos, int rows, int size, int addPages)
+        {
+            var newRows = new IndexItem[GetSize(size)];
+            var page=column._pages[pagePos];
+
+            var rStart=-1;
+            for (int r = rowPos; r < page.RowCount; r++)
+            {
+                if (page.IndexExpanded - (page.Rows[r].Index + rows) > PageSize)
+                {
+                    rStart = r;
+                    break;
+                }
+                else
+                {
+                    page.Rows[r].Index += (short)rows;
+                }
+            }
+            var rc = page.RowCount - rStart;
+            page.RowCount=rStart;
+            if(rc>0)
+            {
+                //Copy to a new page
+                var row = page.IndexOffset;
+                var newPage=CopyNew(page,rStart,rc);
+                var ix = (short)(page.Index + addPages);
+                var offset = page.IndexOffset + rows - (ix * PageSize);
+                if (offset > PageSize)
+                {
+                    ix += (short)(offset / PageSize);
+                    offset %= PageSize;
+                }
+                newPage.Index = ix;
+                newPage.Offset = offset;
+                AddPage(column, pagePos + 1, newPage);
+            }
+
+            //Copy from next Row
+        }
+
+        private void CopyMergePage(PageIndex page, int rowPos, int rows, int size, PageIndex ToPage)
+        {
+            var startRow = page.IndexOffset + page.Rows[rowPos].Index + rows;
+            var newRows = new IndexItem[GetSize(ToPage.RowCount + size)];
+            page.RowCount -= size;
+            Array.Copy(page.Rows, rowPos, newRows, 0, size);
+            for (int r = 0; r < size; r++)
+            {
+                newRows[r].Index += (short)(page.IndexOffset + rows - ToPage.IndexOffset);
+            }
+
+            Array.Copy(ToPage.Rows, 0, newRows, size, ToPage.RowCount);
+            ToPage.Rows = newRows;
+            ToPage.RowCount += size;
+        }
+        private void MergePage(ColumnIndex column, int pagePos)
+        {
+            PageIndex Page1=column._pages[pagePos];
+            PageIndex Page2 = column._pages[pagePos + 1];
+
+            var newPage = new PageIndex(Page1, 0, Page1.RowCount + Page2.RowCount);
+            newPage.RowCount = Page1.RowCount + Page2.RowCount;
+            Array.Copy(Page1.Rows, 0, newPage.Rows, 0, Page1.RowCount);
+            Array.Copy(Page2.Rows, 0, newPage.Rows, Page1.RowCount, Page2.RowCount);
+            for (int r = Page1.RowCount; r < newPage.RowCount; r++)
+            {
+                newPage.Rows[r].Index += (short)(Page2.IndexOffset - Page1.IndexOffset);
+            }
+
+            column._pages[pagePos] = newPage;
+            column.PageCount--;
+
+            if (column.PageCount > (pagePos + 1))
+            {
+                Array.Copy(column._pages, pagePos+2, column._pages,pagePos+1,column.PageCount-(pagePos+1));
+                for (int p = pagePos + 1; p < column.PageCount; p++)
+                {
+                    column._pages[p].Index--;
+                    column._pages[p].Offset += PageSize;
+                }
+            }
+        }
+
+        private PageIndex CopyNew(PageIndex pageFrom, int rowPos, int size)
+        {
+            IndexItem[] newRows = new IndexItem[GetSize(size)];
+            Array.Copy(pageFrom.Rows, rowPos, newRows, 0, size);
+            return new PageIndex(newRows, size);
+        }
+
+        internal static int GetSize(int size)
+        {
+            var newSize=256;
+            while (newSize < size)
+            {
+                newSize <<= 1;
+            }
+            return newSize;
+        }
+        private void AddCell(ColumnIndex columnIndex, int pagePos, int pos, short ix, T value)
+        {
+            PageIndex pageItem = columnIndex._pages[pagePos];
+            if (pageItem.RowCount == pageItem.Rows.Length)
+            {
+                if (pageItem.RowCount == PageSizeMax) //Max size-->Split
+                {
+                    pagePos=SplitPage(columnIndex, pagePos);
+                    if (columnIndex._pages[pagePos - 1].RowCount > pos)
+                    {
+                        pagePos--;                        
+                    }
+                    else
+                    {
+                        pos -= columnIndex._pages[pagePos - 1].RowCount;
+                    }
+                    pageItem = columnIndex._pages[pagePos];
+                }
+                else //Expand to double size.
+                {
+                    var rowsTmp = new IndexItem[pageItem.Rows.Length << 1];
+                    Array.Copy(pageItem.Rows, 0, rowsTmp, 0, pageItem.RowCount);
+                    pageItem.Rows = rowsTmp;
+                }
+            }
+            if (pos < pageItem.RowCount)
+            {
+                Array.Copy(pageItem.Rows, pos, pageItem.Rows, pos + 1, pageItem.RowCount - pos);
+            }
+            pageItem.Rows[pos] = new IndexItem() { Index = ix,IndexPointer=_values.Count };
+            _values.Add(value);
+            pageItem.RowCount++;
+        }
+
+        private int SplitPage(ColumnIndex columnIndex, int pagePos)
+        {
+            var page = columnIndex._pages[pagePos];
+            if (page.Offset != 0)
+            {
+                var offset = page.Offset;
+                page.Offset = 0;
+                for (int r = 0; r < page.RowCount; r++)
+                {
+                    page.Rows[r].Index -= (short)offset;
+                }
+            }
+            //Find Split pos
+            int splitPos=0;            
+            for (int r = 0; r < page.RowCount; r++)
+            {
+                if (page.Rows[r].Index > PageSize)
+                {
+                    splitPos=r;
+                    break;
+                }
+            }
+            var newPage = new PageIndex(page, 0, splitPos);
+            var nextPage = new PageIndex(page, splitPos, page.RowCount - splitPos, (short)(page.Index + 1), page.Offset);
+
+            for (int r = 0; r < nextPage.RowCount; r++)
+            {
+                nextPage.Rows[r].Index = (short)(nextPage.Rows[r].Index - PageSize);
+            }
+            
+            columnIndex._pages[pagePos] = newPage;
+            if (columnIndex.PageCount + 1 > columnIndex._pages.Length)
+            {
+                var pageTmp = new PageIndex[columnIndex._pages.Length << 1];
+                Array.Copy(columnIndex._pages, 0, pageTmp, 0, columnIndex.PageCount);
+                columnIndex._pages = pageTmp;
+            }
+            Array.Copy(columnIndex._pages, pagePos + 1, columnIndex._pages, pagePos + 2, columnIndex.PageCount - pagePos - 1);
+            columnIndex._pages[pagePos + 1] = nextPage;
+            page = nextPage;
+            //pos -= PageSize;
+            columnIndex.PageCount++;
+            return pagePos+1;
+        }
+
+        private PageIndex AdjustIndex(ColumnIndex columnIndex, int pagePos)
+        {
+            PageIndex page = columnIndex._pages[pagePos];
+            //First Adjust indexes
+            if (page.Offset + page.Rows[0].Index >= PageSize ||
+                page.Offset >= PageSize ||
+                page.Rows[0].Index >= PageSize)
+            {
+                page.Index++;
+                page.Offset -= PageSize;
+            }
+            else if (page.Offset + page.Rows[0].Index  <= -PageSize || 
+                     page.Offset <= -PageSize ||
+                     page.Rows[0].Index <= -PageSize)
+            {
+                page.Index--;
+                page.Offset += PageSize;
+            }
+            //else if (page.Rows[0].Index >= PageSize) //Delete
+            //{
+            //    page.Index++;
+            //    AddPageRowOffset(page, -PageSize);
+            //}
+            //else if (page.Rows[0].Index <= -PageSize)   //Delete
+            //{
+            //    page.Index--;
+            //    AddPageRowOffset(page, PageSize);
+            //}
+            return page;
+        }
+
+        private void AddPageRowOffset(PageIndex page, short offset)
+        {
+            for (int r = 0; r < page.RowCount; r++)
+            {
+                page.Rows[r].Index += offset;
+            }
+        }
+        private void AddPage(ColumnIndex column, int pos, short index)
+        {
+            AddPage(column, pos);
+            column._pages[pos] = new PageIndex() { Index = index };
+            if (pos > 0)
+            {
+                var pp=column._pages[pos-1];
+                if(pp.RowCount>0 && pp.Rows[pp.RowCount-1].Index > PageSize)
+                {
+                    column._pages[pos].Offset = pp.Rows[pp.RowCount-1].Index-PageSize;
+                }
+            }
+        }
+        /// <summary>
+        /// Add a new page to the collection
+        /// </summary>
+        /// <param name="column">The column</param>
+        /// <param name="pos">Position</param>
+        /// <param name="page">The new page object to add</param>
+        private void AddPage(ColumnIndex column, int pos, PageIndex page)
+        {
+            AddPage(column, pos);
+            column._pages[pos] = page ;
+        }
+        /// <summary>
+        /// Add a new page to the collection
+        /// </summary>
+        /// <param name="column">The column</param>
+        /// <param name="pos">Position</param>
+        private void AddPage(ColumnIndex column, int pos)
+        {
+            if (column.PageCount ==column._pages.Length)
+            {
+                var pageTmp = new PageIndex[column._pages.Length * 2];
+                Array.Copy(column._pages, 0, pageTmp, 0, column.PageCount);
+                column._pages = pageTmp;
+            }
+            if (pos < column.PageCount)
+            {
+                Array.Copy(column._pages, pos, column._pages, pos + 1, column.PageCount - pos);
+            }
+            column.PageCount++;
+        }
+        private void AddColumn(int pos, int Column)
+        {
+            if (ColumnCount == _columnIndex.Length)
+            {
+                var colTmp = new ColumnIndex[_columnIndex.Length*2];
+                Array.Copy(_columnIndex, 0, colTmp, 0, ColumnCount);
+                _columnIndex = colTmp;
+            }
+            if (pos < ColumnCount)
+            {
+                Array.Copy(_columnIndex, pos, _columnIndex, pos + 1, ColumnCount - pos);
+            }
+            _columnIndex[pos] = new ColumnIndex() { Index = (short)(Column) };
+            ColumnCount++;
+        }        
+        int _colPos = -1, _row;
+        public ulong Current
+        {
+            get
+            {
+                return ((ulong)_row << 32) | (uint)(_columnIndex[_colPos].Index);
+            }
+        }
+
+        public void Dispose()
+        {
+            if(_values!=null) _values.Clear();
+            for(var c=0;c<ColumnCount;c++)
+            {
+                if (_columnIndex[c] != null)
+                {
+                    ((IDisposable)_columnIndex[c]).Dispose();
+                }
+            }
+            _values = null;
+            _columnIndex = null;
+        }
+
+        //object IEnumerator.Current
+        //{
+        //    get 
+        //    {
+        //        return GetValue(_row+1, _columnIndex[_colPos].Index);
+        //    }
+        //}
+        public bool MoveNext()
+        {
+            return GetNextCell(ref _row, ref _colPos, 0, ExcelPackage.MaxRows, ExcelPackage.MaxColumns);
+        }
+        internal bool NextCell(ref int row, ref int col)
+        {
+            
+            return NextCell(ref row, ref col, 0,0, ExcelPackage.MaxRows, ExcelPackage.MaxColumns);
+        }
+        internal bool NextCell(ref int row, ref int col, int minRow, int minColPos,int maxRow, int maxColPos)
+        {
+            if (minColPos >= ColumnCount)
+            {
+                return false;
+            }
+            if (maxColPos >= ColumnCount)
+            {
+                maxColPos = ColumnCount-1;
+            }
+            var c=GetPosition(col);
+            if(c>=0)
+            {
+                if (c > maxColPos)
+                {
+                    if (col <= minColPos)
+                    {
+                        return false;
+                    }
+                    col = minColPos;
+                    return NextCell(ref row, ref col);
+                }
+                else
+                {
+                    var r=GetNextCell(ref row, ref c, minColPos, maxRow, maxColPos);
+                    col = _columnIndex[c].Index;
+                    return r;
+                }
+            }
+            else
+            {
+                c=~c;
+                if (c > _columnIndex[c].Index)
+                {
+                    if (col <= minColPos)
+                    {
+                        return false;
+                    }
+                    col = minColPos;
+                    return NextCell(ref row, ref col, minRow, minColPos, maxRow, maxColPos);
+                }
+                else
+                {                    
+                    var r=GetNextCell(ref c, ref row, minColPos, maxRow, maxColPos);
+                    col = _columnIndex[c].Index;
+                    return r;
+                }
+            }
+        }
+        internal bool GetNextCell(ref int row, ref int colPos, int startColPos, int endRow, int endColPos)
+        {
+            if (ColumnCount == 0)
+            {
+                return false;
+            }
+            else
+            {
+                if (++colPos < ColumnCount && colPos <=endColPos)
+                {
+                    var r = _columnIndex[colPos].GetNextRow(row);
+                    if (r == row) //Exists next Row
+                    {
+                        return true;
+                    }
+                    else
+                    {
+                        int minRow, minCol;
+                        if (r > row)
+                        {
+                            minRow = r;
+                            minCol = colPos;
+                        }
+                        else
+                        {
+                            minRow = int.MaxValue;
+                            minCol = 0;
+                        }
+
+                        var c = colPos + 1;
+                        while (c < ColumnCount && c <= endColPos)
+                        {
+                            r = _columnIndex[c].GetNextRow(row);
+                            if (r == row) //Exists next Row
+                            {
+                                colPos = c;
+                                return true;
+                            }
+                            if (r > row && r < minRow)
+                            {
+                                minRow = r;
+                                minCol = c;
+                            }
+                            c++;
+                        }
+                        c = startColPos;
+                        if (row < endRow)
+                        {
+                            row++;
+                            while (c < colPos)
+                            {
+                                r = _columnIndex[c].GetNextRow(row);
+                                if (r == row) //Exists next Row
+                                {
+                                    colPos = c;
+                                    return true;
+                                }
+                                if (r > row && (r < minRow || (r==minRow && c<minCol)) && r <= endRow)
+                                {
+                                    minRow = r;
+                                    minCol = c;
+                                }
+                                c++;
+                            }
+                        }
+
+                        if (minRow == int.MaxValue || minRow > endRow)
+                        {
+                            return false;
+                        }
+                        else
+                        {
+                            row = minRow;
+                            colPos = minCol;
+                            return true;
+                        }
+                    }
+                }
+                else
+                {
+                    if (colPos <= startColPos || row>=endRow)
+                    {
+                        return false;
+                    }
+                    colPos = startColPos - 1;
+                    row++;
+                    return GetNextCell(ref row, ref colPos, startColPos, endRow, endColPos);
+                }
+            }
+        }
+        internal bool GetNextCell(ref int row, ref int colPos, int startColPos, int endRow, int endColPos, ref int[] pagePos, ref int[] cellPos)
+        {
+            if (colPos == endColPos)
+            {
+                colPos = startColPos;
+                row++;
+            }
+            else
+            {
+                colPos++;
+            }
+
+            if (pagePos[colPos] < 0)
+            {
+                if(pagePos[colPos]==-1)
+                {
+                    pagePos[colPos] = _columnIndex[colPos].GetPosition(row);
+                }
+            }
+            else if (_columnIndex[colPos]._pages[pagePos[colPos]].RowCount <= row)
+            {
+                if (_columnIndex[colPos].PageCount > pagePos[colPos])
+                    pagePos[colPos]++;
+                else
+                {
+                    pagePos[colPos]=-2;
+                }
+            }
+            
+            var r = _columnIndex[colPos]._pages[pagePos[colPos]].IndexOffset + _columnIndex[colPos]._pages[pagePos[colPos]].Rows[cellPos[colPos]].Index;
+            if (r == row)
+            {
+                row = r;
+            }
+            else
+            {
+            }
+            return true;
+        }
+        internal bool PrevCell(ref int row, ref int col)
+        {
+            return PrevCell(ref row, ref col, 0, 0, ExcelPackage.MaxRows, ExcelPackage.MaxColumns);
+        }
+        internal bool PrevCell(ref int row, ref int col, int minRow, int minColPos, int maxRow, int maxColPos)
+        {
+            if (minColPos >= ColumnCount)
+            {
+                return false;
+            }
+            if (maxColPos >= ColumnCount)
+            {
+                maxColPos = ColumnCount - 1;
+            }
+            var c = GetPosition(col);
+            if(c>=0)
+            {
+                if (c == 0)
+                {
+                    if (col >= maxColPos)
+                    {
+                        return false;
+                    }
+                    if (row == minRow)
+                    {
+                        return false;
+                    }
+                    row--;
+                    col = maxColPos;                    
+                    return PrevCell(ref row, ref col, minRow, minColPos, maxRow, maxColPos);
+                }
+                else
+                {
+                    var ret=GetPrevCell(ref row, ref c, minRow, minColPos, maxColPos);
+                    if (ret)
+                    {
+                        col = _columnIndex[c].Index;
+                    }
+                    return ret;
+                }
+            }
+            else
+            {
+                c=~c;
+                if (c == 0)
+                {
+                    if (col >= maxColPos || row<=0)
+                    {
+                        return false;
+                    }
+                    col = maxColPos;
+                    row--;
+                    return PrevCell(ref row, ref col, minRow, minColPos, maxRow, maxColPos);
+                }
+                else
+                {
+                    var ret = GetPrevCell(ref row, ref c, minRow, minColPos, maxColPos);
+                    if (ret)
+                    {
+                        col = _columnIndex[c].Index;
+                    }
+                    return ret;
+                }
+            }
+        }
+        internal bool GetPrevCell(ref int row, ref int colPos, int startRow, int startColPos, int endColPos)
+        {
+            if (ColumnCount == 0)
+            {
+                return false;
+            }
+            else
+            {
+                if (--colPos >= startColPos)
+//                if (++colPos < ColumnCount && colPos <= endColPos)
+                {
+                    var r = _columnIndex[colPos].GetNextRow(row);
+                    if (r == row) //Exists next Row
+                    {
+                        return true;
+                    }
+                    else
+                    {
+                        int minRow, minCol;
+                        if (r > row && r >= startRow)
+                        {
+                            minRow = r;
+                            minCol = colPos;
+                        }
+                        else
+                        {
+                            minRow = int.MaxValue;
+                            minCol = 0;
+                        }
+
+                        var c = colPos - 1;
+                        if (c >= startColPos)
+                        {
+                            while (c >= startColPos)
+                            {
+                                r = _columnIndex[c].GetNextRow(row);
+                                if (r == row) //Exists next Row
+                                {
+                                    colPos = c;
+                                    return true;
+                                }
+                                if (r > row && r < minRow && r >= startRow)
+                                {
+                                    minRow = r;
+                                    minCol = c;
+                                }
+                                c--;
+                            }
+                        }
+                        if (row > startRow)
+                        {
+                            c = endColPos;
+                            row--;
+                            while (c > colPos)
+                            {
+                                r = _columnIndex[c].GetNextRow(row);
+                                if (r == row) //Exists next Row
+                                {
+                                    colPos = c;
+                                    return true;
+                                }
+                                if (r > row && r < minRow && r >= startRow)
+                                {
+                                    minRow = r;
+                                    minCol = c;
+                                }
+                                c--;
+                            }
+                        }
+                        if (minRow == int.MaxValue || startRow < minRow)
+                        {
+                            return false;
+                        }
+                        else
+                        {
+                            row = minRow;
+                            colPos = minCol;
+                            return true;
+                        }
+                    }
+                }
+                else
+                {
+                    colPos = ColumnCount;
+                    row--;
+                    if (row < startRow)
+                    {
+                        Reset();
+                        return false;
+                    }
+                    else
+                    {
+                        return GetPrevCell(ref colPos, ref row, startRow, startColPos, endColPos);
+                    }
+                }
+            }
+        }
+        public void Reset()
+        {
+            _colPos = -1;            
+            _row= 0;
+        }
+
+        //public IEnumerator<ulong> GetEnumerator()
+        //{
+        //    this.Reset();
+        //    return this;
+        //}
+
+        //IEnumerator IEnumerable.GetEnumerator()
+        //{
+        //    this.Reset();
+        //    return this;
+        //}
+
+    }
+    internal class CellsStoreEnumerator<T> : IEnumerable<T>, IEnumerator<T>
+    {
+        CellStore<T> _cellStore;
+        int row, colPos;
+        int[] pagePos, cellPos;
+        int _startRow, _startCol, _endRow, _endCol;
+        int minRow, minColPos, maxRow, maxColPos;
+        public CellsStoreEnumerator(CellStore<T> cellStore) :
+            this(cellStore, 0,0,ExcelPackage.MaxRows, ExcelPackage.MaxColumns)        
+        {
+        }
+        public CellsStoreEnumerator(CellStore<T> cellStore, int StartRow, int StartCol, int EndRow, int EndCol)
+        {
+            _cellStore = cellStore;
+            
+            _startRow=StartRow;
+            _startCol=StartCol;
+            _endRow=EndRow;
+            _endCol=EndCol;
+
+            Init();
+
+        }
+
+        internal void Init()
+        {
+            minRow = _startRow;
+            maxRow = _endRow;
+
+            minColPos = _cellStore.GetPosition(_startCol);
+            if (minColPos < 0) minColPos = ~minColPos;
+            maxColPos = _cellStore.GetPosition(_endCol);
+            if (maxColPos < 0) maxColPos = ~maxColPos-1;
+            row = minRow;
+            colPos = minColPos - 1;
+
+            var cols = maxColPos - minColPos + 1;
+            pagePos = new int[cols];
+            cellPos = new int[cols];
+            for (int i = 0; i < cols; i++)
+            {
+                pagePos[i] = -1;
+                cellPos[i] = -1;
+            }
+        }
+        internal int Row 
+        {
+            get
+            {
+                return row;
+            }
+        }
+        internal int Column
+        {
+            get
+            {
+                if (colPos == -1) MoveNext();
+                if (colPos == -1) return 0;
+                return _cellStore._columnIndex[colPos].Index;
+            }
+        }
+        internal T Value
+        {
+            get
+            {
+                lock (_cellStore)
+                {
+                    return _cellStore.GetValue(row, Column);
+                }
+            }
+            set
+            {
+                lock (_cellStore)
+                {
+                    _cellStore.SetValue(row, Column, value);
+                }
+            }
+        }
+        internal bool Next()
+        {
+            //return _cellStore.GetNextCell(ref row, ref colPos, minColPos, maxRow, maxColPos);
+            return _cellStore.GetNextCell(ref row, ref colPos, minColPos, maxRow, maxColPos);
+        }
+        internal bool Previous()
+        {
+            lock (_cellStore)
+            {
+                return _cellStore.GetPrevCell(ref row, ref colPos, minRow, minColPos, maxColPos);
+            }
+        }
+
+        public string CellAddress 
+        {
+            get
+            {
+                return ExcelAddressBase.GetAddress(Row, Column);
+            }
+        }
+
+        public IEnumerator<T> GetEnumerator()
+        {
+            Reset();
+            return this;
+        }
+
+        IEnumerator IEnumerable.GetEnumerator()
+        {
+            Reset();
+            return this;
+        }
+
+        public T Current
+        {
+            get
+            {
+                return Value;
+            }
+        }
+
+        public void Dispose()
+        {
+            //_cellStore=null;
+        }
+
+        object IEnumerator.Current
+        {
+            get 
+            {
+                Reset();
+                return this;
+            }
+        }
+
+        public bool MoveNext()
+        {
+            return Next();
+        }
+
+        public void Reset()
+        {
+            Init();
+        }
+    }
+    internal class FlagCellStore : CellStore<byte>
+    {
+        internal void SetFlagValue(int Row, int Col, bool value, CellFlags cellFlags)
+        {
+            CellFlags currentValue = (CellFlags) GetValue(Row, Col);
+            if (value)
+            {
+                SetValue(Row, Col, (byte)(currentValue | cellFlags)); // add the CellFlag bit
+            }
+            else
+            {
+                SetValue(Row, Col, (byte)(currentValue & ~cellFlags)); // remove the CellFlag bit
+            }
+        }
+        internal bool GetFlagValue(int Row, int Col, CellFlags cellFlags)
+        {
+            return !(((byte)cellFlags & GetValue(Row, Col)) == 0);
+        }
+    }
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/CF Implementation.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/CF Implementation.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/CF Implementation.cs	(revision 12707)
@@ -0,0 +1,392 @@
+﻿#region TODO
+//TODO: Add the "DataBar" extended options
+//TODO: Add tests for all the rules
+//TODO: Add the IconSet options
+//TODO: Add all the "extList" options
+#endregion
+
+#region §18.3.1.18 conditionalFormatting (Conditional Formatting)
+//Childs:
+//cfRule          (Conditional Formatting Rule) §18.3.1.10
+//extLst          (Future Feature Data Storage Area) §18.2.10
+
+//Attributes:
+//pivot
+//sqref           ST_Sqref simple type (§18.18.76)
+#endregion
+
+#region §18.3.1.10 cfRule (Conditional Formatting Rule)
+//Childs:
+//colorScale      (Color Scale) §18.3.1.16
+//dataBar         (Data Bar) §18.3.1.28
+//extLst          (Future Feature Data Storage Area) §18.2.10
+//formula         (Formula) §18.3.1.43
+//iconSet         (Icon Set) §18.3.1.49
+
+//Attributes:
+//-----------
+//priority        (Priority) The priority of this conditional formatting rule. This value is used to determine which
+//                format should be evaluated and rendered. Lower numeric values are higher priority than
+//                higher numeric values, where 1 is the highest priority.
+//stopIfTrue      (Stop If True) If this flag is 1, no rules with lower priority shall be applied over this rule, when this rule
+//                evaluates to true.
+//type            (Type) Type of conditional formatting rule. ST_CfType §18.18.12.
+//aboveAverage    Indicates whether the rule is an "above average" rule. 1 indicates 'above average'.
+//                This attribute is ignored if type is not equal to aboveAverage.
+//equalAverage    (Equal Average)
+//                Flag indicating whether the 'aboveAverage' and 'belowAverage' criteria is inclusive of the
+//                average itself, or exclusive of that value. 1 indicates to include the average value in the
+//                criteria. This attribute is ignored if type is not equal to aboveAverage.
+//bottom          (Bottom N) Indicates whether a "top/bottom n" rule is a "bottom n" rule. 1 indicates 'bottom'.
+//                This attribute is ignored if type is not equal to top10.
+//dxfId           (Differential Formatting Id)
+//                This is an index to a dxf element in the Styles Part indicating which cell formatting to
+//                apply when the conditional formatting rule criteria is met. ST_DxfId simple type (§18.18.25).
+//operator        (Operator) The operator in a "cell value is" conditional formatting rule. This attribute is ignored if
+//                type is not equal to cellIs. The possible values ST_ConditionalFormattingOperator simple type (§18.18.15).
+//percent         (Top 10 Percent)
+//                Indicates whether a "top/bottom n" rule is a "top/bottom n percent" rule. This attribute
+//                is ignored if type is not equal to top10.
+//rank            (Rank) The value of "n" in a "top/bottom n" conditional formatting rule. This attribute is ignored
+//                if type is not equal to top10.
+//stdDev          (StdDev) The number of standard deviations to include above or below the average in the
+//                conditional formatting rule. This attribute is ignored if type is not equal to aboveAverage.
+//                If a value is present for stdDev and the rule type = aboveAverage, then this rule is automatically an
+//                "above or below N standard deviations" rule.
+//text            (Text) The text value in a "text contains" conditional formatting rule. This attribute is ignored if
+//                type is not equal to containsText.
+//timePeriod      (Time Period) The applicable time period in a "date occurring…" conditional formatting rule. This
+//                attribute is ignored if type is not equal to timePeriod. ST_TimePeriod §18.18.82.
+#endregion
+
+#region Conditional Formatting XML examples
+// All the examples are assumed to be inside <conditionalFormatting sqref="A1:A10">
+
+#region Example "beginsWith"
+//<x:cfRule type="beginsWith" dxfId="6" priority="5" operator="beginsWith" text="a">
+//  <x:formula>LEFT(A1,LEN("a"))="a"</x:formula>
+//</x:cfRule>
+
+//<x:cfRule type="beginsWith" dxfId="5" priority="14" operator="beginsWith" text="&quot;&lt;&gt;">
+//  <x:formula>LEFT(A3,LEN("""&lt;&gt;"))="""&lt;&gt;"</x:formula>
+//</x:cfRule>
+#endregion
+
+#region Example "between"
+//<x:cfRule type="cellIs" dxfId="8" priority="10" operator="between">
+//  <x:formula>3</x:formula>
+//  <x:formula>7</x:formula>
+//</x:cfRule>
+#endregion
+
+#region Example "containsText"
+//<x:cfRule type="containsText" dxfId="5" priority="4" operator="containsText" text="c">
+//  <x:formula>NOT(ISERROR(SEARCH("c",A1)))</x:formula>
+//</x:cfRule>
+#endregion
+
+#region Example "endsWith"
+//<x:cfRule type="endsWith" dxfId="9" priority="11" operator="endsWith" text="c">
+//  <x:formula>RIGHT(A1,LEN("c"))="c"</x:formula>
+//</x:cfRule>
+#endregion
+
+#region Example "equal"
+//<x:cfRule type="cellIs" dxfId="7" priority="8" operator="equal">
+//  <x:formula>"ab"</x:formula>
+//</x:cfRule>
+#endregion
+
+#region Example "greaterThan"
+//<x:cfRule type="cellIs" dxfId="6" priority="7" operator="greaterThan">
+//  <x:formula>4</x:formula>
+//</x:cfRule>
+#endregion
+
+#region Example "greaterThanOrEqual"
+//<x:cfRule type="cellIs" dxfId="3" priority="4" operator="greaterThanOrEqual">
+//  <x:formula>4</x:formula>
+//</x:cfRule>
+#endregion
+
+#region Example "lessThan"
+//<x:cfRule type="cellIs" dxfId="5" priority="6" operator="lessThan">
+//  <x:formula>4</x:formula>
+//</x:cfRule>
+#endregion
+
+#region Example "lessThanOrEqual"
+//<x:cfRule type="cellIs" dxfId="4" priority="5" operator="lessThanOrEqual">
+//  <x:formula>4</x:formula>
+//</x:cfRule>
+#endregion
+
+#region Example "notBetween"
+//<x:cfRule type="cellIs" dxfId="2" priority="3" operator="notBetween">
+//  <x:formula>3</x:formula>
+//  <x:formula>7</x:formula>
+//</x:cfRule>
+#endregion
+
+#region Example "notContainsText"
+//<x:cfRule type="notContainsText" dxfId="4" priority="3" operator="notContains" text="c">
+//  <x:formula>ISERROR(SEARCH("c",A1))</x:formula>
+//</x:cfRule>
+#endregion
+
+#region Example "notEqual"
+//<x:cfRule type="cellIs" dxfId="1" priority="2" operator="notEqual">
+//  <x:formula>"ab"</x:formula>
+//</x:cfRule>
+#endregion
+
+#region Example "containsBlanks"
+//<x:cfRule type="containsBlanks" dxfId="20" priority="37">
+//  <x:formula>LEN(TRIM(A1))=0</x:formula>
+//</x:cfRule>
+#endregion
+
+#region Example "containsErrors"
+//<x:cfRule type="containsErrors" dxfId="15" priority="19">
+//  <x:formula>ISERROR(A1)</x:formula>
+//</x:cfRule>
+#endregion
+
+#region Example "expression"
+//<x:cfRule type="expression" dxfId="0" priority="1">
+//  <x:formula>RIGHT(J16,1)="b"</x:formula>
+//</x:cfRule>
+#endregion
+
+#region Example "duplicateValues"
+//<x:cfRule type="duplicateValues" dxfId="14" priority="16" />
+#endregion
+
+#region Example "notContainsBlanks"
+//<x:cfRule type="notContainsBlanks" dxfId="12" priority="14">
+//  <x:formula>LEN(TRIM(A1))&gt;0</x:formula>
+//</x:cfRule>
+#endregion
+
+#region Example "notContainsErrors"
+//<x:cfRule type="notContainsErrors" dxfId="11" priority="36">
+//  <x:formula>NOT(ISERROR(A1))</x:formula>
+//</x:cfRule>
+#endregion
+
+#region Example "uniqueValues"
+//<x:cfRule type="uniqueValues" dxfId="13" priority="15" />
+#endregion
+
+#region Example "last7Days"
+//<x:cfRule type="timePeriod" dxfId="39" priority="10" timePeriod="last7Days">
+//  <x:formula>AND(TODAY()-FLOOR(A1,1)&lt;=6,FLOOR(A1,1)&lt;=TODAY())</x:formula>
+//</x:cfRule>
+#endregion
+
+#region Example "lastMonth"
+//<x:cfRule type="timePeriod" dxfId="38" priority="9" timePeriod="lastMonth">
+//  <x:formula>AND(MONTH(A1)=MONTH(EDATE(TODAY(),0-1)),YEAR(A1)=YEAR(EDATE(TODAY(),0-1)))</x:formula>
+//</x:cfRule>
+#endregion
+
+#region Example "lastWeek"
+//<x:cfRule type="timePeriod" dxfId="37" priority="8" timePeriod="lastWeek">
+//  <x:formula>AND(TODAY()-ROUNDDOWN(A1,0)&gt;=(WEEKDAY(TODAY())),TODAY()-ROUNDDOWN(A1,0)&lt;(WEEKDAY(TODAY())+7))</x:formula>
+//</x:cfRule>
+#endregion
+
+#region Example "nextMonth"
+//<x:cfRule type="timePeriod" dxfId="36" priority="7" timePeriod="nextMonth">
+//  <x:formula>AND(MONTH(A1)=MONTH(EDATE(TODAY(),0+1)),YEAR(A1)=YEAR(EDATE(TODAY(),0+1)))</x:formula>
+//</x:cfRule>
+#endregion
+
+#region Example "nextWeek"
+//<x:cfRule type="timePeriod" dxfId="35" priority="6" timePeriod="nextWeek">
+//  <x:formula>AND(ROUNDDOWN(A1,0)-TODAY()&gt;(7-WEEKDAY(TODAY())),ROUNDDOWN(A1,0)-TODAY()&lt;(15-WEEKDAY(TODAY())))</x:formula>
+//</x:cfRule>
+#endregion
+
+#region Example "thisMonth"
+//<x:cfRule type="timePeriod" dxfId="34" priority="5" timePeriod="thisMonth">
+//  <x:formula>AND(MONTH(A1)=MONTH(TODAY()),YEAR(A1)=YEAR(TODAY()))</x:formula>
+//</x:cfRule>
+#endregion
+
+#region Example "thisWeek"
+//<x:cfRule type="timePeriod" dxfId="33" priority="4" timePeriod="thisWeek">
+//  <x:formula>AND(TODAY()-ROUNDDOWN(A1,0)&lt;=WEEKDAY(TODAY())-1,ROUNDDOWN(A1,0)-TODAY()&lt;=7-WEEKDAY(TODAY()))</x:formula>
+//</x:cfRule>
+#endregion
+
+#region Example "today"
+//<x:cfRule type="timePeriod" dxfId="32" priority="3" timePeriod="today">
+//  <x:formula>FLOOR(A1,1)=TODAY()</x:formula>
+//</x:cfRule>
+#endregion
+
+#region Example "tomorrow"
+//<x:cfRule type="timePeriod" dxfId="31" priority="2" timePeriod="tomorrow">
+//  <x:formula>FLOOR(A1,1)=TODAY()+1</x:formula>
+//</x:cfRule>
+#endregion
+
+#region Example "yesterday"
+//<x:cfRule type="timePeriod" dxfId="1" priority="1" timePeriod="yesterday">
+//  <x:formula>FLOOR(A1,1)=TODAY()-1</x:formula>
+//</x:cfRule>
+#endregion
+
+#region Example "twoColorScale"
+//<cfRule type="colorScale" priority="1">
+//  <colorScale>
+//    <cfvo type="min"/>
+//    <cfvo type="max"/>
+//    <color rgb="FFF8696B"/>
+//    <color rgb="FF63BE7B"/>
+//  </colorScale>
+//</cfRule>
+#endregion
+
+#region Examples "iconSet3" (x all the 3 IconSet options)
+//<x:cfRule type="iconSet" priority="30">
+//  <x:iconSet>
+//    <x:cfvo type="percent" val="0" />
+//    <x:cfvo type="percent" val="33" />
+//    <x:cfvo type="percent" val="67" />
+//  </x:iconSet>
+//</x:cfRule>
+
+//<x:cfRule type="iconSet" priority="38">
+//  <x:iconSet iconSet="3Arrows">
+//    <x:cfvo type="percent" val="0" />
+//    <x:cfvo type="percent" val="33" />
+//    <x:cfvo type="percent" val="67" />
+//  </x:iconSet>
+//</x:cfRule>
+#endregion
+
+#region Examples "iconSet4" (x all the 4 IconSet options)
+//<x:cfRule type="iconSet" priority="34">
+//  <x:iconSet iconSet="4ArrowsGray">
+//    <x:cfvo type="percent" val="0" />
+//    <x:cfvo type="percent" val="25" />
+//    <x:cfvo type="percent" val="50" />
+//    <x:cfvo type="percent" val="75" />
+//  </x:iconSet>
+//</x:cfRule>
+#endregion
+
+#region Examples "iconSet5" (x all the 5 IconSet options)
+//<x:cfRule type="iconSet" priority="32">
+//  <x:iconSet iconSet="5ArrowsGray">
+//    <x:cfvo type="percent" val="0" />
+//    <x:cfvo type="percent" val="20" />
+//    <x:cfvo type="percent" val="40" />
+//    <x:cfvo type="percent" val="60" />
+//    <x:cfvo type="percent" val="80" />
+//  </x:iconSet>
+//</x:cfRule>
+#endregion
+
+#region Examples "iconSet" Extended (not implemented yet)
+//<x:extLst>
+//  <x:ext xmlns:x14="http://schemas.microsoft.com/office/spreadsheetml/2009/9/main" uri="{78C0D931-6437-407d-A8EE-F0AAD7539E65}">
+//    <x14:conditionalFormattings>
+//      <x14:conditionalFormatting xmlns:xm="http://schemas.microsoft.com/office/excel/2006/main">
+//        <x14:cfRule type="iconSet" priority="35" id="{F5114369-080A-47E6-B7EE-499137A3C896}">
+//          <x14:iconSet iconSet="3Triangles">
+//            <x14:cfvo type="percent">
+//              <xm:f>0</xm:f>
+//            </x14:cfvo>
+//            <x14:cfvo type="percent">
+//              <xm:f>33</xm:f>
+//            </x14:cfvo>
+//            <x14:cfvo type="percent">
+//              <xm:f>67</xm:f>
+//            </x14:cfvo>
+//          </x14:iconSet>
+//        </x14:cfRule>
+//        <xm:sqref>C3:C12</xm:sqref>
+//      </x14:conditionalFormatting>
+//      <x14:conditionalFormatting xmlns:xm="http://schemas.microsoft.com/office/excel/2006/main">
+//        <x14:cfRule type="iconSet" priority="6" id="{0A327384-BF2F-4BF5-9767-123CD690A536}">
+//          <x14:iconSet iconSet="3Stars">
+//            <x14:cfvo type="percent">
+//              <xm:f>0</xm:f>
+//            </x14:cfvo>
+//            <x14:cfvo type="percent">
+//              <xm:f>33</xm:f>
+//            </x14:cfvo>
+//            <x14:cfvo type="percent">
+//              <xm:f>67</xm:f>
+//            </x14:cfvo>
+//          </x14:iconSet>
+//        </x14:cfRule>
+//        <xm:sqref>A16:A25</xm:sqref>
+//      </x14:conditionalFormatting>
+//      <x14:conditionalFormatting xmlns:xm="http://schemas.microsoft.com/office/excel/2006/main">
+//        <x14:cfRule type="iconSet" priority="19" id="{0DDCA3E4-3536-44B3-A663-4877587295B8}">
+//          <x14:iconSet iconSet="3Triangles">
+//            <x14:cfvo type="percent">
+//              <xm:f>0</xm:f>
+//            </x14:cfvo>
+//            <x14:cfvo type="percent">
+//              <xm:f>33</xm:f>
+//            </x14:cfvo>
+//            <x14:cfvo type="percent">
+//              <xm:f>67</xm:f>
+//            </x14:cfvo>
+//          </x14:iconSet>
+//        </x14:cfRule>
+//        <xm:sqref>C16:C25</xm:sqref>
+//      </x14:conditionalFormatting>
+//      <x14:conditionalFormatting xmlns:xm="http://schemas.microsoft.com/office/excel/2006/main">
+//        <x14:cfRule type="iconSet" priority="2" id="{E4EDD7FB-880C-408F-B87C-C8DA446AEB78}">
+//          <x14:iconSet iconSet="5Boxes">
+//            <x14:cfvo type="percent">
+//              <xm:f>0</xm:f>
+//            </x14:cfvo>
+//            <x14:cfvo type="percent">
+//              <xm:f>20</xm:f>
+//            </x14:cfvo>
+//            <x14:cfvo type="percent">
+//              <xm:f>40</xm:f>
+//            </x14:cfvo>
+//            <x14:cfvo type="percent">
+//              <xm:f>60</xm:f>
+//            </x14:cfvo>
+//            <x14:cfvo type="percent">
+//              <xm:f>80</xm:f>
+//            </x14:cfvo>
+//          </x14:iconSet>
+//        </x14:cfRule>
+//        <xm:sqref>E16:E25</xm:sqref>
+//      </x14:conditionalFormatting>
+//      <x14:conditionalFormatting xmlns:xm="http://schemas.microsoft.com/office/excel/2006/main">
+//        <x14:cfRule type="iconSet" priority="1" id="{4CC82060-CB0A-4A31-AEF2-D1A587AC1674}">
+//          <x14:iconSet iconSet="3Stars" showValue="0" custom="1">
+//            <x14:cfvo type="percent">
+//              <xm:f>0</xm:f>
+//            </x14:cfvo>
+//            <x14:cfvo type="formula">
+//              <xm:f>$F$17</xm:f>
+//            </x14:cfvo>
+//            <x14:cfvo type="num">
+//              <xm:f>4</xm:f>
+//            </x14:cfvo>
+//            <x14:cfIcon iconSet="3Triangles" iconId="1" />
+//            <x14:cfIcon iconSet="4RedToBlack" iconId="3" />
+//            <x14:cfIcon iconSet="3Stars" iconId="2" />
+//          </x14:iconSet>
+//        </x14:cfRule>
+//        <xm:sqref>F16:F25</xm:sqref>
+//      </x14:conditionalFormatting>
+//    </x14:conditionalFormattings>
+//  </x:ext>
+//</x:extLst>
+#endregion
+
+
+#endregion
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingAverageGroup.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingAverageGroup.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingAverageGroup.cs	(revision 12707)
@@ -0,0 +1,49 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author          Change						                  Date
+ * ******************************************************************************
+ * Eyal Seagull    Conditional Formatting Adaption    2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+using OfficeOpenXml.ConditionalFormatting;
+
+namespace OfficeOpenXml.ConditionalFormatting.Contracts
+{
+  /// <summary>
+  /// IExcelConditionalFormattingAverageGroup
+  /// </summary>
+  public interface IExcelConditionalFormattingAverageGroup
+    : IExcelConditionalFormattingRule
+  {
+    #region Public Properties
+    #endregion Public Properties
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingBeginsWith.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingBeginsWith.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingBeginsWith.cs	(revision 12707)
@@ -0,0 +1,50 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author          Change						                  Date
+ * ******************************************************************************
+ * Eyal Seagull    Conditional Formatting Adaption    2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+using OfficeOpenXml.ConditionalFormatting;
+
+namespace OfficeOpenXml.ConditionalFormatting.Contracts
+{
+  /// <summary>
+  /// IExcelConditionalFormattingBeginsWith
+  /// </summary>
+  public interface IExcelConditionalFormattingBeginsWith
+    : IExcelConditionalFormattingRule,
+    IExcelConditionalFormattingWithText
+  {
+    #region Public Properties
+    #endregion Public Properties
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingBetween.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingBetween.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingBetween.cs	(revision 12707)
@@ -0,0 +1,50 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author          Change						                  Date
+ * ******************************************************************************
+ * Eyal Seagull    Conditional Formatting Adaption    2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+using OfficeOpenXml.ConditionalFormatting;
+
+namespace OfficeOpenXml.ConditionalFormatting.Contracts
+{
+  /// <summary>
+  /// IExcelConditionalFormattingBetween
+  /// </summary>
+  public interface IExcelConditionalFormattingBetween
+    : IExcelConditionalFormattingRule,
+    IExcelConditionalFormattingWithFormula2
+  {
+    #region Public Properties
+    #endregion Public Properties
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingColorScaleGroup.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingColorScaleGroup.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingColorScaleGroup.cs	(revision 12707)
@@ -0,0 +1,49 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author          Change						                  Date
+ * ******************************************************************************
+ * Eyal Seagull    Conditional Formatting Adaption    2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+using OfficeOpenXml.ConditionalFormatting;
+
+namespace OfficeOpenXml.ConditionalFormatting.Contracts
+{
+	/// <summary>
+  /// IExcelConditionalFormattingColorScaleGroup
+	/// </summary>
+  public interface IExcelConditionalFormattingColorScaleGroup
+		: IExcelConditionalFormattingRule
+	{
+		#region Public Properties
+		#endregion Public Properties
+	}
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingContainsBlanks.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingContainsBlanks.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingContainsBlanks.cs	(revision 12707)
@@ -0,0 +1,49 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author          Change						                  Date
+ * ******************************************************************************
+ * Eyal Seagull    Conditional Formatting Adaption    2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+using OfficeOpenXml.ConditionalFormatting;
+
+namespace OfficeOpenXml.ConditionalFormatting.Contracts
+{
+  /// <summary>
+  /// IExcelConditionalFormattingContainsBlanks
+  /// </summary>
+  public interface IExcelConditionalFormattingContainsBlanks
+    : IExcelConditionalFormattingRule
+  {
+    #region Public Properties
+    #endregion Public Properties
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingContainsErrors.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingContainsErrors.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingContainsErrors.cs	(revision 12707)
@@ -0,0 +1,49 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author          Change						                  Date
+ * ******************************************************************************
+ * Eyal Seagull    Conditional Formatting Adaption    2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+using OfficeOpenXml.ConditionalFormatting;
+
+namespace OfficeOpenXml.ConditionalFormatting.Contracts
+{
+  /// <summary>
+  /// IExcelConditionalFormattingContainsErrors
+  /// </summary>
+  public interface IExcelConditionalFormattingContainsErrors
+    : IExcelConditionalFormattingRule
+  {
+    #region Public Properties
+    #endregion Public Properties
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingContainsText.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingContainsText.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingContainsText.cs	(revision 12707)
@@ -0,0 +1,50 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author          Change						                  Date
+ * ******************************************************************************
+ * Eyal Seagull    Conditional Formatting Adaption    2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+using OfficeOpenXml.ConditionalFormatting;
+
+namespace OfficeOpenXml.ConditionalFormatting.Contracts
+{
+  /// <summary>
+  /// IExcelConditionalFormattingContainsText
+  /// </summary>
+  public interface IExcelConditionalFormattingContainsText
+    : IExcelConditionalFormattingRule,
+    IExcelConditionalFormattingWithText
+  {
+    #region Public Properties
+    #endregion Public Properties
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingDataBarGroup.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingDataBarGroup.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingDataBarGroup.cs	(revision 12707)
@@ -0,0 +1,67 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author          Change						                  Date
+ * ******************************************************************************
+ * Eyal Seagull    Conditional Formatting Adaption    2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+using OfficeOpenXml.ConditionalFormatting;
+using System.Drawing;
+
+namespace OfficeOpenXml.ConditionalFormatting.Contracts
+{
+	/// <summary>
+	/// IExcelConditionalFormattingDataBar
+	/// </summary>
+	public interface IExcelConditionalFormattingDataBarGroup
+        : IExcelConditionalFormattingRule
+	{
+		#region Public Properties
+        /// <summary>
+        /// ShowValue
+        /// </summary>
+        bool ShowValue { get; set; }
+        /// <summary>
+        /// Databar Low Value
+        /// </summary>
+        ExcelConditionalFormattingIconDataBarValue LowValue { get;  }
+
+        /// <summary>
+        /// Databar High Value
+        /// </summary>
+        ExcelConditionalFormattingIconDataBarValue HighValue { get; }
+        /// <summary>
+        /// The color of the databar
+        /// </summary>
+        Color Color { get; set;}
+        #endregion Public Properties
+	}
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingDuplicateValues.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingDuplicateValues.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingDuplicateValues.cs	(revision 12707)
@@ -0,0 +1,49 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author          Change						                  Date
+ * ******************************************************************************
+ * Eyal Seagull    Conditional Formatting Adaption    2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+using OfficeOpenXml.ConditionalFormatting;
+
+namespace OfficeOpenXml.ConditionalFormatting.Contracts
+{
+  /// <summary>
+  /// IExcelConditionalFormattingDuplicateValues
+  /// </summary>
+  public interface IExcelConditionalFormattingDuplicateValues
+    : IExcelConditionalFormattingRule
+  {
+    #region Public Properties
+    #endregion Public Properties
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingEndsWith.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingEndsWith.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingEndsWith.cs	(revision 12707)
@@ -0,0 +1,50 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author          Change						                  Date
+ * ******************************************************************************
+ * Eyal Seagull    Conditional Formatting Adaption    2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+using OfficeOpenXml.ConditionalFormatting;
+
+namespace OfficeOpenXml.ConditionalFormatting.Contracts
+{
+  /// <summary>
+  /// IExcelConditionalFormattingEndsWith
+  /// </summary>
+  public interface IExcelConditionalFormattingEndsWith
+    : IExcelConditionalFormattingRule,
+    IExcelConditionalFormattingWithText
+  {
+    #region Public Properties
+    #endregion Public Properties
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingEqual.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingEqual.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingEqual.cs	(revision 12707)
@@ -0,0 +1,50 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author          Change						                  Date
+ * ******************************************************************************
+ * Eyal Seagull    Conditional Formatting Adaption    2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+using OfficeOpenXml.ConditionalFormatting;
+
+namespace OfficeOpenXml.ConditionalFormatting.Contracts
+{
+  /// <summary>
+  /// IExcelConditionalFormattingEqual
+  /// </summary>
+  public interface IExcelConditionalFormattingEqual
+    : IExcelConditionalFormattingRule,
+    IExcelConditionalFormattingWithFormula
+  {
+    #region Public Properties
+    #endregion Public Properties
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingExpression.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingExpression.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingExpression.cs	(revision 12707)
@@ -0,0 +1,50 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author          Change						                  Date
+ * ******************************************************************************
+ * Eyal Seagull    Conditional Formatting Adaption    2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+using OfficeOpenXml.ConditionalFormatting;
+
+namespace OfficeOpenXml.ConditionalFormatting.Contracts
+{
+  /// <summary>
+  /// IExcelConditionalFormattingExpression
+  /// </summary>
+  public interface IExcelConditionalFormattingExpression
+    : IExcelConditionalFormattingRule,
+    IExcelConditionalFormattingWithFormula
+  {
+    #region Public Properties
+    #endregion Public Properties
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingFiveIconSet.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingFiveIconSet.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingFiveIconSet.cs	(revision 12707)
@@ -0,0 +1,52 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author          Change						                  Date
+ * ******************************************************************************
+ * Eyal Seagull    Conditional Formatting Adaption    2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+using OfficeOpenXml.ConditionalFormatting;
+
+namespace OfficeOpenXml.ConditionalFormatting.Contracts
+{
+  /// <summary>
+  /// IExcelConditionalFormattingFiveIconSet
+  /// </summary>eExcelconditionalFormatting4IconsSetType
+    public interface IExcelConditionalFormattingFiveIconSet : IExcelConditionalFormattingFourIconSet<eExcelconditionalFormatting5IconsSetType>
+  {
+    #region Public Properties
+    /// <summary>
+    /// Icon5 (part of the 5 Icon Set)
+    /// </summary>
+      ExcelConditionalFormattingIconDataBarValue Icon5 { get; }
+    #endregion Public Properties
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingFourIconSet.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingFourIconSet.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingFourIconSet.cs	(revision 12707)
@@ -0,0 +1,52 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author          Change						                  Date
+ * ******************************************************************************
+ * Eyal Seagull    Conditional Formatting Adaption    2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+using OfficeOpenXml.ConditionalFormatting;
+
+namespace OfficeOpenXml.ConditionalFormatting.Contracts
+{
+  /// <summary>
+  /// IExcelConditionalFormattingFourIconSet
+  /// </summary>
+    public interface IExcelConditionalFormattingFourIconSet<T> : IExcelConditionalFormattingThreeIconSet<T>
+  {
+    #region Public Properties
+    /// <summary>
+    /// Icon4 (part of the 4 ou 5 Icon Set)
+    /// </summary>
+      ExcelConditionalFormattingIconDataBarValue Icon4 { get; }      
+    #endregion Public Properties
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingGreaterThan.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingGreaterThan.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingGreaterThan.cs	(revision 12707)
@@ -0,0 +1,50 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author          Change						                  Date
+ * ******************************************************************************
+ * Eyal Seagull    Conditional Formatting Adaption    2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+using OfficeOpenXml.ConditionalFormatting;
+
+namespace OfficeOpenXml.ConditionalFormatting.Contracts
+{
+  /// <summary>
+  /// IExcelConditionalFormattingGreaterThan
+  /// </summary>
+  public interface IExcelConditionalFormattingGreaterThan
+    : IExcelConditionalFormattingRule,
+    IExcelConditionalFormattingWithFormula
+  {
+    #region Public Properties
+    #endregion Public Properties
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingGreaterThanOrEqual.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingGreaterThanOrEqual.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingGreaterThanOrEqual.cs	(revision 12707)
@@ -0,0 +1,50 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author          Change						                  Date
+ * ******************************************************************************
+ * Eyal Seagull    Conditional Formatting Adaption    2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+using OfficeOpenXml.ConditionalFormatting;
+
+namespace OfficeOpenXml.ConditionalFormatting.Contracts
+{
+  /// <summary>
+  /// IExcelConditionalFormattingGreaterThanOrEqual
+  /// </summary>
+  public interface IExcelConditionalFormattingGreaterThanOrEqual
+    : IExcelConditionalFormattingRule,
+    IExcelConditionalFormattingWithFormula
+  {
+    #region Public Properties
+    #endregion Public Properties
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingIconSetGroup.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingIconSetGroup.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingIconSetGroup.cs	(revision 12707)
@@ -0,0 +1,63 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author          Change						                  Date
+ * ******************************************************************************
+ * Eyal Seagull    Conditional Formatting Adaption    2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+using OfficeOpenXml.ConditionalFormatting;
+
+namespace OfficeOpenXml.ConditionalFormatting.Contracts
+{
+	/// <summary>
+	/// IExcelConditionalFormattingIconSetGroup
+	/// </summary>
+	public interface IExcelConditionalFormattingIconSetGroup<T>
+		: IExcelConditionalFormattingRule
+	{
+		#region Public Properties
+    /// <summary>
+    /// Reverse
+    /// </summary>
+    bool Reverse { get; set; }
+
+    /// <summary>
+    /// ShowValue
+    /// </summary>
+    bool ShowValue { get; set; }
+
+    /// <summary>
+    /// IconSet (3, 4 ou 5 IconSet)
+    /// </summary>
+    T IconSet { get; set; }
+    #endregion Public Properties
+	}
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingLessThan.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingLessThan.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingLessThan.cs	(revision 12707)
@@ -0,0 +1,50 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author          Change						                  Date
+ * ******************************************************************************
+ * Eyal Seagull    Conditional Formatting Adaption    2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+using OfficeOpenXml.ConditionalFormatting;
+
+namespace OfficeOpenXml.ConditionalFormatting.Contracts
+{
+  /// <summary>
+  /// IExcelConditionalFormattingLessThan
+  /// </summary>
+  public interface IExcelConditionalFormattingLessThan
+    : IExcelConditionalFormattingRule,
+    IExcelConditionalFormattingWithFormula
+  {
+    #region Public Properties
+    #endregion Public Properties
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingLessThanOrEqual.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingLessThanOrEqual.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingLessThanOrEqual.cs	(revision 12707)
@@ -0,0 +1,50 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author          Change						                  Date
+ * ******************************************************************************
+ * Eyal Seagull    Conditional Formatting Adaption    2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+using OfficeOpenXml.ConditionalFormatting;
+
+namespace OfficeOpenXml.ConditionalFormatting.Contracts
+{
+  /// <summary>
+  /// IExcelConditionalFormattingGreaterThanOrEqual
+  /// </summary>
+  public interface IExcelConditionalFormattingLessThanOrEqual
+    : IExcelConditionalFormattingRule,
+    IExcelConditionalFormattingWithFormula
+  {
+    #region Public Properties
+    #endregion Public Properties
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingNotBetween.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingNotBetween.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingNotBetween.cs	(revision 12707)
@@ -0,0 +1,50 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author          Change						                  Date
+ * ******************************************************************************
+ * Eyal Seagull    Conditional Formatting Adaption    2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+using OfficeOpenXml.ConditionalFormatting;
+
+namespace OfficeOpenXml.ConditionalFormatting.Contracts
+{
+  /// <summary>
+  /// IExcelConditionalFormattingNotBetween
+  /// </summary>
+  public interface IExcelConditionalFormattingNotBetween
+    : IExcelConditionalFormattingRule,
+    IExcelConditionalFormattingWithFormula2
+  {
+    #region Public Properties
+    #endregion Public Properties
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingNotContainsBlanks.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingNotContainsBlanks.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingNotContainsBlanks.cs	(revision 12707)
@@ -0,0 +1,49 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author          Change						                  Date
+ * ******************************************************************************
+ * Eyal Seagull    Conditional Formatting Adaption    2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+using OfficeOpenXml.ConditionalFormatting;
+
+namespace OfficeOpenXml.ConditionalFormatting.Contracts
+{
+  /// <summary>
+  /// IExcelConditionalFormattingNotContainsBlanks
+  /// </summary>
+  public interface IExcelConditionalFormattingNotContainsBlanks
+    : IExcelConditionalFormattingRule
+  {
+    #region Public Properties
+    #endregion Public Properties
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingNotContainsErrors.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingNotContainsErrors.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingNotContainsErrors.cs	(revision 12707)
@@ -0,0 +1,49 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author          Change						                  Date
+ * ******************************************************************************
+ * Eyal Seagull    Conditional Formatting Adaption    2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+using OfficeOpenXml.ConditionalFormatting;
+
+namespace OfficeOpenXml.ConditionalFormatting.Contracts
+{
+  /// <summary>
+  /// IExcelConditionalFormattingNotContainsErrors
+  /// </summary>
+  public interface IExcelConditionalFormattingNotContainsErrors
+    : IExcelConditionalFormattingRule
+  {
+    #region Public Properties
+    #endregion Public Properties
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingNotContainsText.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingNotContainsText.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingNotContainsText.cs	(revision 12707)
@@ -0,0 +1,50 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author          Change						                  Date
+ * ******************************************************************************
+ * Eyal Seagull    Conditional Formatting Adaption    2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+using OfficeOpenXml.ConditionalFormatting;
+
+namespace OfficeOpenXml.ConditionalFormatting.Contracts
+{
+  /// <summary>
+  /// IExcelConditionalFormattingNotContainsText
+  /// </summary>
+  public interface IExcelConditionalFormattingNotContainsText
+    : IExcelConditionalFormattingRule,
+    IExcelConditionalFormattingWithText
+  {
+    #region Public Properties
+    #endregion Public Properties
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingNotEqual.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingNotEqual.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingNotEqual.cs	(revision 12707)
@@ -0,0 +1,50 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author          Change						                  Date
+ * ******************************************************************************
+ * Eyal Seagull    Conditional Formatting Adaption    2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+using OfficeOpenXml.ConditionalFormatting;
+
+namespace OfficeOpenXml.ConditionalFormatting.Contracts
+{
+  /// <summary>
+  /// IExcelConditionalFormattingNotEqual
+  /// </summary>
+  public interface IExcelConditionalFormattingNotEqual
+    : IExcelConditionalFormattingRule,
+    IExcelConditionalFormattingWithFormula
+  {
+    #region Public Properties
+    #endregion Public Properties
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingRule.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingRule.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingRule.cs	(revision 12707)
@@ -0,0 +1,87 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author          Change						              Date
+ * ******************************************************************************
+ * Eyal Seagull    Conditional Formatting         2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Xml;
+using OfficeOpenXml.Style.Dxf;
+
+namespace OfficeOpenXml.ConditionalFormatting.Contracts
+{
+	/// <summary>
+	/// Interface for conditional formatting rule
+	/// </summary>
+	public interface IExcelConditionalFormattingRule
+	{
+    /// <summary>
+    /// The 'cfRule' XML node
+    /// </summary>
+    XmlNode Node { get; }
+
+    /// <summary>
+    /// Type of conditional formatting rule. ST_CfType §18.18.12.
+    /// </summary>
+    eExcelConditionalFormattingRuleType Type { get; }
+
+    /// <summary>
+    /// <para>Range over which these conditional formatting rules apply.</para>
+    /// <para>The possible values for this attribute are defined by the
+    /// ST_Sqref simple type (§18.18.76).</para>
+    /// </summary>
+    ExcelAddress Address { get; set; }
+
+		/// <summary>
+		/// The priority of this conditional formatting rule. This value is used to determine
+		/// which format should be evaluated and rendered. Lower numeric values are higher
+		/// priority than higher numeric values, where 1 is the highest priority.
+		/// </summary>
+    int Priority { get; set; }
+
+    /// <summary>
+    /// If this flag is 1, no rules with lower priority shall be applied over this rule,
+    /// when this rule evaluates to true.
+    /// </summary>
+    bool StopIfTrue { get; set; }
+
+    ///// <summary>
+    ///// <para>This is an index to a dxf element in the Styles Part indicating which cell
+    ///// formatting to apply when the conditional formatting rule criteria is met.</para>
+    ///// <para>The possible values for this attribute are defined by the ST_DxfId simple type
+    ///// (§18.18.25).</para>
+    ///// </summary>
+//    int DxfId { get; set; }
+    /// <summary>
+    /// Gives access to the differencial styling (DXF) for the rule.
+    /// </summary>
+    ExcelDxfStyleConditionalFormatting Style{ get; }
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingStdDevGroup.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingStdDevGroup.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingStdDevGroup.cs	(revision 12707)
@@ -0,0 +1,50 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author          Change						                  Date
+ * ******************************************************************************
+ * Eyal Seagull    Conditional Formatting Adaption    2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+using OfficeOpenXml.ConditionalFormatting;
+
+namespace OfficeOpenXml.ConditionalFormatting.Contracts
+{
+	/// <summary>
+  /// IExcelConditionalFormattingStdDevGroup
+	/// </summary>
+  public interface IExcelConditionalFormattingStdDevGroup
+    : IExcelConditionalFormattingRule,
+    IExcelConditionalFormattingWithStdDev
+  {
+		#region Public Properties
+		#endregion Public Properties
+	}
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingThreeColorScale.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingThreeColorScale.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingThreeColorScale.cs	(revision 12707)
@@ -0,0 +1,53 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author          Change						                  Date
+ * ******************************************************************************
+ * Eyal Seagull    Conditional Formatting Adaption    2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+using OfficeOpenXml.ConditionalFormatting;
+
+namespace OfficeOpenXml.ConditionalFormatting.Contracts
+{
+	/// <summary>
+	/// IExcelConditionalFormattingThreeColorScale
+	/// </summary>
+	public interface IExcelConditionalFormattingThreeColorScale
+    : IExcelConditionalFormattingTwoColorScale
+	{
+		#region Public Properties
+		/// <summary>
+		/// Three Color Scale Middle Value
+		/// </summary>
+		ExcelConditionalFormattingColorScaleValue MiddleValue { get; set; }
+		#endregion Public Properties
+	}
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingThreeIconSet.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingThreeIconSet.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingThreeIconSet.cs	(revision 12707)
@@ -0,0 +1,63 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author          Change						                  Date
+ * ******************************************************************************
+ * Eyal Seagull    Conditional Formatting Adaption    2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+using OfficeOpenXml.ConditionalFormatting;
+
+namespace OfficeOpenXml.ConditionalFormatting.Contracts
+{
+	/// <summary>
+	/// IExcelConditionalFormattingThreeIconSet
+	/// </summary>
+	public interface IExcelConditionalFormattingThreeIconSet<T>
+    : IExcelConditionalFormattingIconSetGroup<T>
+	{
+		#region Public Properties
+    /// <summary>
+    /// Icon1 (part of the 3, 4 ou 5 Icon Set)
+    /// </summary>
+        ExcelConditionalFormattingIconDataBarValue Icon1 { get; }
+
+    /// <summary>
+    /// Icon2 (part of the 3, 4 ou 5 Icon Set)
+    /// </summary>
+    ExcelConditionalFormattingIconDataBarValue Icon2 { get;  }
+
+    /// <summary>
+    /// Icon3 (part of the 3, 4 ou 5 Icon Set)
+    /// </summary>
+    ExcelConditionalFormattingIconDataBarValue Icon3 { get; }
+    #endregion Public Properties
+	}
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingTimePeriodGroup.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingTimePeriodGroup.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingTimePeriodGroup.cs	(revision 12707)
@@ -0,0 +1,49 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author          Change						                  Date
+ * ******************************************************************************
+ * Eyal Seagull    Conditional Formatting Adaption    2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+using OfficeOpenXml.ConditionalFormatting;
+
+namespace OfficeOpenXml.ConditionalFormatting.Contracts
+{
+	/// <summary>
+	/// IExcelConditionalFormattingTimePeriod
+	/// </summary>
+	public interface IExcelConditionalFormattingTimePeriodGroup
+		: IExcelConditionalFormattingRule
+	{
+		#region Public Properties
+		#endregion Public Properties
+	}
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingTopBottomGroup.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingTopBottomGroup.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingTopBottomGroup.cs	(revision 12707)
@@ -0,0 +1,50 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author          Change						                  Date
+ * ******************************************************************************
+ * Eyal Seagull    Conditional Formatting Adaption    2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+using OfficeOpenXml.ConditionalFormatting;
+
+namespace OfficeOpenXml.ConditionalFormatting.Contracts
+{
+  /// <summary>
+  /// IExcelConditionalFormattingTopBottomGroup
+  /// </summary>
+  public interface IExcelConditionalFormattingTopBottomGroup
+    : IExcelConditionalFormattingRule,
+    IExcelConditionalFormattingWithRank
+  {
+    #region Public Properties
+    #endregion Public Properties
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingTwoColorScale.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingTwoColorScale.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingTwoColorScale.cs	(revision 12707)
@@ -0,0 +1,58 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author          Change						                  Date
+ * ******************************************************************************
+ * Eyal Seagull    Conditional Formatting Adaption    2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+using OfficeOpenXml.ConditionalFormatting;
+
+namespace OfficeOpenXml.ConditionalFormatting.Contracts
+{
+	/// <summary>
+	/// IExcelConditionalFormattingTwoColorScale
+	/// </summary>
+	public interface IExcelConditionalFormattingTwoColorScale
+		: IExcelConditionalFormattingColorScaleGroup
+	{
+		#region Public Properties
+    /// <summary>
+    /// Two Color Scale Low Value
+    /// </summary>
+    ExcelConditionalFormattingColorScaleValue LowValue { get; set; }
+
+    /// <summary>
+    /// Two Color Scale High Value
+    /// </summary>
+    ExcelConditionalFormattingColorScaleValue HighValue { get; set; }
+    #endregion Public Properties
+	}
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingUniqueValues.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingUniqueValues.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingUniqueValues.cs	(revision 12707)
@@ -0,0 +1,49 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author          Change						                  Date
+ * ******************************************************************************
+ * Eyal Seagull    Conditional Formatting Adaption    2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+using OfficeOpenXml.ConditionalFormatting;
+
+namespace OfficeOpenXml.ConditionalFormatting.Contracts
+{
+  /// <summary>
+  /// IExcelConditionalFormattingUniqueValues
+  /// </summary>
+  public interface IExcelConditionalFormattingUniqueValues
+    : IExcelConditionalFormattingRule
+  {
+    #region Public Properties
+    #endregion Public Properties
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingWithFormula.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingWithFormula.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingWithFormula.cs	(revision 12707)
@@ -0,0 +1,52 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author          Change						                  Date
+ * ******************************************************************************
+ * Eyal Seagull    Conditional Formatting Adaption    2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+using OfficeOpenXml.ConditionalFormatting;
+
+namespace OfficeOpenXml.ConditionalFormatting.Contracts
+{
+  /// <summary>
+  /// IExcelConditionalFormattingWithFormula
+  /// </summary>
+  public interface IExcelConditionalFormattingWithFormula
+  {
+    #region Public Properties
+    /// <summary>
+    /// Formula Attribute
+    /// </summary>
+    string Formula { get; set; }
+    #endregion Public Properties
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingWithFormula2.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingWithFormula2.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingWithFormula2.cs	(revision 12707)
@@ -0,0 +1,53 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author          Change						                  Date
+ * ******************************************************************************
+ * Eyal Seagull    Conditional Formatting Adaption    2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+using OfficeOpenXml.ConditionalFormatting;
+
+namespace OfficeOpenXml.ConditionalFormatting.Contracts
+{
+  /// <summary>
+  /// IExcelConditionalFormattingWithFormula2
+  /// </summary>
+  public interface IExcelConditionalFormattingWithFormula2
+    : IExcelConditionalFormattingWithFormula
+  {
+    #region Public Properties
+    /// <summary>
+    /// Formula2 Attribute
+    /// </summary>
+    string Formula2 { get; set; }
+    #endregion Public Properties
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingWithRank.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingWithRank.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingWithRank.cs	(revision 12707)
@@ -0,0 +1,52 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author          Change						                  Date
+ * ******************************************************************************
+ * Eyal Seagull    Conditional Formatting Adaption    2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+using OfficeOpenXml.ConditionalFormatting;
+
+namespace OfficeOpenXml.ConditionalFormatting.Contracts
+{
+  /// <summary>
+  /// IExcelConditionalFormattingWithRank
+  /// </summary>
+  public interface IExcelConditionalFormattingWithRank
+  {
+    #region Public Properties
+    /// <summary>
+    /// Rank Attribute
+    /// </summary>
+    UInt16 Rank { get; set; }
+    #endregion Public Properties
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingWithReverse.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingWithReverse.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingWithReverse.cs	(revision 12707)
@@ -0,0 +1,52 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author          Change						                  Date
+ * ******************************************************************************
+ * Eyal Seagull    Conditional Formatting Adaption    2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+using OfficeOpenXml.ConditionalFormatting;
+
+namespace OfficeOpenXml.ConditionalFormatting.Contracts
+{
+  /// <summary>
+  /// IExcelConditionalFormattingWithReverse
+  /// </summary>
+  public interface IExcelConditionalFormattingWithReverse
+  {
+    #region Public Properties
+    /// <summary>
+    /// Reverse Attribute
+    /// </summary>
+    bool Reverse { get; set; }
+    #endregion Public Properties
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingWithShowValue.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingWithShowValue.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingWithShowValue.cs	(revision 12707)
@@ -0,0 +1,52 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author          Change						                  Date
+ * ******************************************************************************
+ * Eyal Seagull    Conditional Formatting Adaption    2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+using OfficeOpenXml.ConditionalFormatting;
+
+namespace OfficeOpenXml.ConditionalFormatting.Contracts
+{
+  /// <summary>
+  /// IExcelConditionalFormattingWithShowValue
+  /// </summary>
+  public interface IExcelConditionalFormattingWithShowValue
+  {
+    #region Public Properties
+    /// <summary>
+    /// ShowValue Attribute
+    /// </summary>
+    bool ShowValue { get; set; }
+    #endregion Public Properties
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingWithStdDev.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingWithStdDev.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingWithStdDev.cs	(revision 12707)
@@ -0,0 +1,52 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author          Change						                  Date
+ * ******************************************************************************
+ * Eyal Seagull    Conditional Formatting Adaption    2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+using OfficeOpenXml.ConditionalFormatting;
+
+namespace OfficeOpenXml.ConditionalFormatting.Contracts
+{
+  /// <summary>
+  /// IExcelConditionalFormattingWithStdDev
+  /// </summary>
+  public interface IExcelConditionalFormattingWithStdDev
+  {
+    #region Public Properties
+    /// <summary>
+    /// StdDev Attribute
+    /// </summary>
+    UInt16 StdDev { get; set; }
+    #endregion Public Properties
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingWithText.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingWithText.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IExcelConditionalFormattingWithText.cs	(revision 12707)
@@ -0,0 +1,52 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author          Change						                  Date
+ * ******************************************************************************
+ * Eyal Seagull    Conditional Formatting Adaption    2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+using OfficeOpenXml.ConditionalFormatting;
+
+namespace OfficeOpenXml.ConditionalFormatting.Contracts
+{
+  /// <summary>
+  /// IExcelConditionalFormattingWithText
+  /// </summary>
+  public interface IExcelConditionalFormattingWithText
+  {
+    #region Public Properties
+    /// <summary>
+    /// Text Attribute
+    /// </summary>
+    string Text { get; set; }
+    #endregion Public Properties
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IRangeConditionalFormatting.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IRangeConditionalFormatting.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Contracts/IRangeConditionalFormatting.cs	(revision 12707)
@@ -0,0 +1,313 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author             Change                    Date
+ * ******************************************************************************
+ * Eyal Seagull		    Conditional Formatting    2012-04-03
+ *******************************************************************************/
+using OfficeOpenXml.ConditionalFormatting.Contracts;
+using System.Drawing;
+
+namespace OfficeOpenXml.ConditionalFormatting
+{
+	/// <summary>
+	/// Provides functionality for adding Conditional Formatting to a range (<see cref="ExcelRangeBase"/>).
+	/// Each method will return a configurable condtional formatting type.
+	/// </summary>
+	public interface IRangeConditionalFormatting
+	{
+    /// <summary>
+    /// Adds a Above Average rule to the range
+    /// </summary>
+    /// <returns></returns>
+    IExcelConditionalFormattingAverageGroup AddAboveAverage();
+
+    /// <summary>
+    /// Adds a Above Or Equal Average rule to the range
+    /// </summary>
+    /// <returns></returns>
+    IExcelConditionalFormattingAverageGroup AddAboveOrEqualAverage();
+
+    /// <summary>
+    /// Adds a Below Average rule to the range
+    /// </summary>
+    /// <returns></returns>
+    IExcelConditionalFormattingAverageGroup AddBelowAverage();
+
+    /// <summary>
+    /// Adds a Below Or Equal Average rule to the range
+    /// </summary>
+    /// <returns></returns>
+    IExcelConditionalFormattingAverageGroup AddBelowOrEqualAverage();
+
+    /// <summary>
+    /// Adds a Above StdDev rule to the range
+    /// </summary>
+    /// <returns></returns>
+    IExcelConditionalFormattingStdDevGroup AddAboveStdDev();
+
+    /// <summary>
+    /// Adds a Below StdDev rule to the range
+    /// </summary>
+    /// <returns></returns>
+    IExcelConditionalFormattingStdDevGroup AddBelowStdDev();
+
+    /// <summary>
+    /// Adds a Bottom rule to the range
+    /// </summary>
+    /// <returns></returns>
+    IExcelConditionalFormattingTopBottomGroup AddBottom();
+
+    /// <summary>
+    /// Adds a Bottom Percent rule to the range
+    /// </summary>
+    /// <returns></returns>
+    IExcelConditionalFormattingTopBottomGroup AddBottomPercent();
+
+    /// <summary>
+    /// Adds a Top rule to the range
+    /// </summary>
+    /// <returns></returns>
+    IExcelConditionalFormattingTopBottomGroup AddTop();
+
+    /// <summary>
+    /// Adds a Top Percent rule to the range
+    /// </summary>
+    /// <returns></returns>
+    IExcelConditionalFormattingTopBottomGroup AddTopPercent();
+
+    /// <summary>
+    /// Adds a Last 7 Days rule to the range
+    /// </summary>
+    /// <returns></returns>
+    IExcelConditionalFormattingTimePeriodGroup AddLast7Days();
+
+    /// <summary>
+    /// Adds a Last Month rule to the range
+    /// </summary>
+    /// <returns></returns>
+    IExcelConditionalFormattingTimePeriodGroup AddLastMonth();
+
+    /// <summary>
+    /// Adds a Last Week rule to the range
+    /// </summary>
+    /// <returns></returns>
+    IExcelConditionalFormattingTimePeriodGroup AddLastWeek();
+
+    /// <summary>
+    /// Adds a Next Month rule to the range
+    /// </summary>
+    /// <returns></returns>
+    IExcelConditionalFormattingTimePeriodGroup AddNextMonth();
+
+    /// <summary>
+    /// Adds a Next Week rule to the range
+    /// </summary>
+    /// <returns></returns>
+    IExcelConditionalFormattingTimePeriodGroup AddNextWeek();
+
+    /// <summary>
+    /// Adds a This Month rule to the range
+    /// </summary>
+    /// <returns></returns>
+    IExcelConditionalFormattingTimePeriodGroup AddThisMonth();
+
+    /// <summary>
+    /// Adds a This Week rule to the range
+    /// </summary>
+    /// <returns></returns>
+    IExcelConditionalFormattingTimePeriodGroup AddThisWeek();
+
+    /// <summary>
+    /// Adds a Today rule to the range
+    /// </summary>
+    /// <returns></returns>
+    IExcelConditionalFormattingTimePeriodGroup AddToday();
+
+    /// <summary>
+    /// Adds a Tomorrow rule to the range
+    /// </summary>
+    /// <returns></returns>
+    IExcelConditionalFormattingTimePeriodGroup AddTomorrow();
+
+    /// <summary>
+    /// Adds a Yesterday rule to the range
+    /// </summary>
+    /// <returns></returns>
+    IExcelConditionalFormattingTimePeriodGroup AddYesterday();
+
+    /// <summary>
+    /// Adds a Begins With rule to the range
+    /// </summary>
+    /// <returns></returns>
+    IExcelConditionalFormattingBeginsWith AddBeginsWith();
+
+    /// <summary>
+    /// Adds a Between rule to the range
+    /// </summary>
+    /// <returns></returns>
+    IExcelConditionalFormattingBetween AddBetween();
+
+    /// <summary>
+    /// Adds a ContainsBlanks rule to the range
+    /// </summary>
+    /// <returns></returns>
+    IExcelConditionalFormattingContainsBlanks AddContainsBlanks();
+
+    /// <summary>
+    /// Adds a ContainsErrors rule to the range
+    /// </summary>
+    /// <returns></returns>
+    IExcelConditionalFormattingContainsErrors AddContainsErrors();
+
+    /// <summary>
+    /// Adds a ContainsText rule to the range
+    /// </summary>
+    /// <returns></returns>
+    IExcelConditionalFormattingContainsText AddContainsText();
+
+    /// <summary>
+    /// Adds a DuplicateValues rule to the range
+    /// </summary>
+    /// <returns></returns>
+    IExcelConditionalFormattingDuplicateValues AddDuplicateValues();
+
+    /// <summary>
+    /// Adds a EndsWith rule to the range
+    /// </summary>
+    /// <returns></returns>
+    IExcelConditionalFormattingEndsWith AddEndsWith();
+
+    /// <summary>
+    /// Adds a Equal rule to the range
+    /// </summary>
+    /// <returns></returns>
+    IExcelConditionalFormattingEqual AddEqual();
+
+    /// <summary>
+    /// Adds a Expression rule to the range
+    /// </summary>
+    /// <returns></returns>
+    IExcelConditionalFormattingExpression AddExpression();
+
+    /// <summary>
+    /// Adds a GreaterThan rule to the range
+    /// </summary>
+    /// <returns></returns>
+    IExcelConditionalFormattingGreaterThan AddGreaterThan();
+
+    /// <summary>
+    /// Adds a GreaterThanOrEqual rule to the range
+    /// </summary>
+    /// <returns></returns>
+    IExcelConditionalFormattingGreaterThanOrEqual AddGreaterThanOrEqual();
+
+    /// <summary>
+    /// Adds a LessThan rule to the range
+    /// </summary>
+    /// <returns></returns>
+    IExcelConditionalFormattingLessThan AddLessThan();
+
+    /// <summary>
+    /// Adds a LessThanOrEqual rule to the range
+    /// </summary>
+    /// <returns></returns>
+    IExcelConditionalFormattingLessThanOrEqual AddLessThanOrEqual();
+
+    /// <summary>
+    /// Adds a NotBetween rule to the range
+    /// </summary>
+    /// <returns></returns>
+    IExcelConditionalFormattingNotBetween AddNotBetween();
+
+    /// <summary>
+    /// Adds a NotContainsBlanks rule to the range
+    /// </summary>
+    /// <returns></returns>
+    IExcelConditionalFormattingNotContainsBlanks AddNotContainsBlanks();
+
+    /// <summary>
+    /// Adds a NotContainsErrors rule to the range
+    /// </summary>
+    /// <returns></returns>
+    IExcelConditionalFormattingNotContainsErrors AddNotContainsErrors();
+
+    /// <summary>
+    /// Adds a NotContainsText rule to the range
+    /// </summary>
+    /// <returns></returns>
+    IExcelConditionalFormattingNotContainsText AddNotContainsText();
+
+    /// <summary>
+    /// Adds a NotEqual rule to the range
+    /// </summary>
+    /// <returns></returns>
+    IExcelConditionalFormattingNotEqual AddNotEqual();
+
+    /// <summary>
+    /// Adds a UniqueValues rule to the range
+    /// </summary>
+    /// <returns></returns>
+    IExcelConditionalFormattingUniqueValues AddUniqueValues();
+
+    /// <summary>
+    /// Adds a <see cref="ExcelConditionalFormattingThreeColorScale"/> to the range
+    /// </summary>
+    /// <returns></returns>
+    IExcelConditionalFormattingThreeColorScale AddThreeColorScale();
+
+    /// <summary>
+    /// Adds a <see cref="ExcelConditionalFormattingTwoColorScale"/> to the range
+    /// </summary>
+    /// <returns></returns>
+    IExcelConditionalFormattingTwoColorScale AddTwoColorScale();
+
+    /// <summary>
+    /// Adds a <see cref="IExcelConditionalFormattingThreeIconSet&lt;eExcelconditionalFormatting3IconsSetType&gt;"/> to the range
+    /// </summary>
+    /// <param name="IconSet"></param>
+    /// <returns></returns>
+    IExcelConditionalFormattingThreeIconSet<eExcelconditionalFormatting3IconsSetType> AddThreeIconSet(eExcelconditionalFormatting3IconsSetType IconSet);
+    /// <summary>
+    /// Adds a <see cref="IExcelConditionalFormattingFourIconSet&lt;eExcelconditionalFormatting4IconsSetType&gt;"/> to the range
+    /// </summary>
+    /// <param name="IconSet"></param>
+    /// <returns></returns>
+    IExcelConditionalFormattingFourIconSet<eExcelconditionalFormatting4IconsSetType> AddFourIconSet(eExcelconditionalFormatting4IconsSetType IconSet);
+    /// <summary>
+    /// Adds a <see cref="IExcelConditionalFormattingFiveIconSet"/> to the range
+    /// </summary>
+    /// <param name="IconSet"></param>
+    /// <returns></returns>
+    IExcelConditionalFormattingFiveIconSet AddFiveIconSet(eExcelconditionalFormatting5IconsSetType IconSet);
+    /// <summary>
+    /// Adds a <see cref="IExcelConditionalFormattingDataBarGroup"/> to the range
+    /// </summary>
+    /// <param name="color"></param>
+    /// <returns></returns>
+    IExcelConditionalFormattingDataBarGroup AddDatabar(Color color);
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/ExcelConditionalFormattingCollection.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/ExcelConditionalFormattingCollection.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/ExcelConditionalFormattingCollection.cs	(revision 12707)
@@ -0,0 +1,999 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author					Change						                Date
+ * ******************************************************************************
+ * Eyal Seagull		Conditional Formatting            2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Collections;
+using OfficeOpenXml.Utils;
+using System.Xml;
+using OfficeOpenXml.ConditionalFormatting.Contracts;
+using System.Text.RegularExpressions;
+using System.Drawing;
+
+namespace OfficeOpenXml.ConditionalFormatting
+{
+  /// <summary>
+  /// Collection of <see cref="ExcelConditionalFormattingRule"/>.
+  /// This class is providing the API for EPPlus conditional formatting.
+  /// </summary>
+  /// <remarks>
+  /// <para>
+  /// The public methods of this class (Add[...]ConditionalFormatting) will create a ConditionalFormatting/CfRule entry in the worksheet. When this
+  /// Conditional Formatting has been created changes to the properties will affect the workbook immediately.
+  /// </para>
+  /// <para>
+  /// Each type of Conditional Formatting Rule has diferente set of properties.
+  /// </para>
+  /// <code>
+  /// // Add a Three Color Scale conditional formatting
+  /// var cf = worksheet.ConditionalFormatting.AddThreeColorScale(new ExcelAddress("A1:C10"));
+  /// // Set the conditional formatting properties
+  /// cf.LowValue.Type = ExcelConditionalFormattingValueObjectType.Min;
+  /// cf.LowValue.Color = Color.White;
+  /// cf.MiddleValue.Type = ExcelConditionalFormattingValueObjectType.Percent;
+  /// cf.MiddleValue.Value = 50;
+  /// cf.MiddleValue.Color = Color.Blue;
+  /// cf.HighValue.Type = ExcelConditionalFormattingValueObjectType.Max;
+  /// cf.HighValue.Color = Color.Black;
+  /// </code>
+  /// </remarks>
+  public class ExcelConditionalFormattingCollection
+    : XmlHelper,
+    IEnumerable<IExcelConditionalFormattingRule>
+  {
+    /****************************************************************************************/
+
+    #region Private Properties
+    private List<IExcelConditionalFormattingRule> _rules = new List<IExcelConditionalFormattingRule>();
+    private ExcelWorksheet _worksheet = null;
+    #endregion Private Properties
+
+    /****************************************************************************************/
+
+    #region Constructors
+    /// <summary>
+    /// Initialize the <see cref="ExcelConditionalFormattingCollection"/>
+    /// </summary>
+    /// <param name="worksheet"></param>
+    internal ExcelConditionalFormattingCollection(
+      ExcelWorksheet worksheet)
+      : base(
+        worksheet.NameSpaceManager,
+        worksheet.WorksheetXml.DocumentElement)
+    {
+      Require.Argument(worksheet).IsNotNull("worksheet");
+
+      _worksheet = worksheet;
+      SchemaNodeOrder = _worksheet.SchemaNodeOrder;
+
+      // Look for all the <conditionalFormatting>
+      var conditionalFormattingNodes = TopNode.SelectNodes(
+        "//" + ExcelConditionalFormattingConstants.Paths.ConditionalFormatting,
+        _worksheet.NameSpaceManager);
+
+      // Check if we found at least 1 node
+      if ((conditionalFormattingNodes != null)
+        && (conditionalFormattingNodes.Count > 0))
+      {
+        // Foreach <conditionalFormatting>
+        foreach (XmlNode conditionalFormattingNode in conditionalFormattingNodes)
+        {
+          // Check if @sqref attribute exists
+          if (conditionalFormattingNode.Attributes[ExcelConditionalFormattingConstants.Attributes.Sqref] == null)
+          {
+            throw new Exception(
+              ExcelConditionalFormattingConstants.Errors.MissingSqrefAttribute);
+          }
+
+          // Get the @sqref attribute
+          ExcelAddress address = new ExcelAddress(
+            conditionalFormattingNode.Attributes[ExcelConditionalFormattingConstants.Attributes.Sqref].Value);
+
+          // Check for all the <cfRules> nodes and load them
+          var cfRuleNodes = conditionalFormattingNode.SelectNodes(
+            ExcelConditionalFormattingConstants.Paths.CfRule,
+            _worksheet.NameSpaceManager);
+
+          // Foreach <cfRule> inside the current <conditionalFormatting>
+          foreach (XmlNode cfRuleNode in cfRuleNodes)
+          {
+            // Check if @type attribute exists
+            if (cfRuleNode.Attributes[ExcelConditionalFormattingConstants.Attributes.Type] == null)
+            {
+              throw new Exception(
+                ExcelConditionalFormattingConstants.Errors.MissingTypeAttribute);
+            }
+
+            // Check if @priority attribute exists
+            if (cfRuleNode.Attributes[ExcelConditionalFormattingConstants.Attributes.Priority] == null)
+            {
+              throw new Exception(
+                ExcelConditionalFormattingConstants.Errors.MissingPriorityAttribute);
+            }
+
+            // Get the <cfRule> main attributes
+            string typeAttribute = ExcelConditionalFormattingHelper.GetAttributeString(
+              cfRuleNode,
+              ExcelConditionalFormattingConstants.Attributes.Type);
+
+            int priority = ExcelConditionalFormattingHelper.GetAttributeInt(
+              cfRuleNode,
+              ExcelConditionalFormattingConstants.Attributes.Priority);
+
+            // Transform the @type attribute to EPPlus Rule Type (slighty diferente)
+            var type = ExcelConditionalFormattingRuleType.GetTypeByAttrbiute(
+              typeAttribute,
+              cfRuleNode,
+              _worksheet.NameSpaceManager);
+
+            // Create the Rule according to the correct type, address and priority
+            var cfRule = ExcelConditionalFormattingRuleFactory.Create(
+              type,
+              address,
+              priority,
+              _worksheet,
+              cfRuleNode);
+
+            // Add the new rule to the list
+            if(cfRule!=null)
+              _rules.Add(cfRule);
+          }
+        }
+      }
+    }
+    #endregion Constructors
+
+    /****************************************************************************************/
+
+    #region Methods
+    /// <summary>
+    /// 
+    /// </summary>
+    private void EnsureRootElementExists()
+    {
+      // Find the <worksheet> node
+      if (_worksheet.WorksheetXml.DocumentElement == null)
+      {
+        throw new Exception(
+          ExcelConditionalFormattingConstants.Errors.MissingWorksheetNode);
+      }
+    }
+
+    /// <summary>
+    /// GetRootNode
+    /// </summary>
+    /// <returns></returns>
+    private XmlNode GetRootNode()
+    {
+      EnsureRootElementExists();
+      return _worksheet.WorksheetXml.DocumentElement;
+    }
+
+    /// <summary>
+    /// Validates address - not empty (collisions are allowded)
+    /// </summary>
+    /// <param name="address"></param>
+    /// <returns></returns>
+    private ExcelAddress ValidateAddress(
+      ExcelAddress address)
+    {
+      Require.Argument(address).IsNotNull("address");
+
+      //TODO: Are there any other validation we need to do?
+      return address;
+    }
+
+    /// <summary>
+    /// Get the next priority sequencial number
+    /// </summary>
+    /// <returns></returns>
+    private int GetNextPriority()
+    {
+      // Consider zero as the last priority when we have no CF rules
+      int lastPriority = 0;
+
+      // Search for the last priority
+      foreach (var cfRule in _rules)
+      {
+        if (cfRule.Priority > lastPriority)
+        {
+          lastPriority = cfRule.Priority;
+        }
+      }
+
+      // Our next priority is the last plus one
+      return lastPriority + 1;
+    }
+    #endregion Methods
+
+    /****************************************************************************************/
+
+    #region IEnumerable<IExcelConditionalFormatting>
+    /// <summary>
+    /// Number of validations
+    /// </summary>
+    public int Count
+    {
+      get { return _rules.Count; }
+    }
+
+    /// <summary>
+    /// Index operator, returns by 0-based index
+    /// </summary>
+    /// <param name="index"></param>
+    /// <returns></returns>
+    public IExcelConditionalFormattingRule this[int index]
+    {
+      get { return _rules[index]; }
+      set { _rules[index] = value; }
+    }
+
+    /// <summary>
+    /// Get the 'cfRule' enumerator
+    /// </summary>
+    /// <returns></returns>
+    IEnumerator<IExcelConditionalFormattingRule> IEnumerable<IExcelConditionalFormattingRule>.GetEnumerator()
+    {
+      return _rules.GetEnumerator();
+    }
+
+    /// <summary>
+    /// Get the 'cfRule' enumerator
+    /// </summary>
+    /// <returns></returns>
+    IEnumerator System.Collections.IEnumerable.GetEnumerator()
+    {
+      return _rules.GetEnumerator();
+    }
+
+    /// <summary>
+    /// Removes all 'cfRule' from the collection and from the XML.
+    /// <remarks>
+    /// This is the same as removing all the 'conditionalFormatting' nodes.
+    /// </remarks>
+    /// </summary>
+    public void RemoveAll()
+    {
+      // Look for all the <conditionalFormatting> nodes
+      var conditionalFormattingNodes = TopNode.SelectNodes(
+        "//" + ExcelConditionalFormattingConstants.Paths.ConditionalFormatting,
+        _worksheet.NameSpaceManager);
+
+      // Remove all the <conditionalFormatting> nodes one by one
+      foreach (XmlNode conditionalFormattingNode in conditionalFormattingNodes)
+      {
+        conditionalFormattingNode.ParentNode.RemoveChild(conditionalFormattingNode);
+      }
+
+      // Clear the <cfRule> item list
+      _rules.Clear();
+    }
+
+    /// <summary>
+    /// Remove a Conditional Formatting Rule by its object
+    /// </summary>
+    /// <param name="item"></param>
+    public void Remove(
+      IExcelConditionalFormattingRule item)
+    {
+      Require.Argument(item).IsNotNull("item");
+
+      try
+      {
+        // Point to the parent node
+        var oldParentNode = item.Node.ParentNode;
+
+        // Remove the <cfRule> from the old <conditionalFormatting> parent node
+        oldParentNode.RemoveChild(item.Node);
+
+        // Check if the old <conditionalFormatting> parent node has <cfRule> node inside it
+        if (!oldParentNode.HasChildNodes)
+        {
+          // Remove the old parent node
+          oldParentNode.ParentNode.RemoveChild(oldParentNode);
+        }
+
+        _rules.Remove(item);
+      }
+      catch
+      {
+        throw new Exception(
+          ExcelConditionalFormattingConstants.Errors.InvalidRemoveRuleOperation);
+      }
+    }
+
+    /// <summary>
+    /// Remove a Conditional Formatting Rule by its 0-based index
+    /// </summary>
+    /// <param name="index"></param>
+    public void RemoveAt(
+      int index)
+    {
+      Require.Argument(index).IsInRange(0, this.Count - 1, "index");
+
+      Remove(this[index]);
+    }
+
+    /// <summary>
+    /// Remove a Conditional Formatting Rule by its priority
+    /// </summary>
+    /// <param name="priority"></param>
+    public void RemoveByPriority(
+      int priority)
+    {
+      try
+      {
+        Remove(RulesByPriority(priority));
+      }
+      catch
+      {
+      }
+    }
+
+    /// <summary>
+    /// Get a rule by its priority
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <returns></returns>
+    public IExcelConditionalFormattingRule RulesByPriority(
+      int priority)
+    {
+      return _rules.Find(x => x.Priority == priority);
+    }
+    #endregion IEnumerable<IExcelConditionalFormatting>
+
+    /****************************************************************************************/
+
+    #region Conditional Formatting Rules
+    /// <summary>
+    /// Add rule (internal)
+    /// </summary>
+    /// <param name="type"></param>
+    /// <param name="address"></param>
+    /// <returns></returns>F
+    internal IExcelConditionalFormattingRule AddRule(
+      eExcelConditionalFormattingRuleType type,
+      ExcelAddress address)
+    {
+      Require.Argument(address).IsNotNull("address");
+
+      address = ValidateAddress(address);
+      EnsureRootElementExists();
+
+      // Create the Rule according to the correct type, address and priority
+      IExcelConditionalFormattingRule cfRule = ExcelConditionalFormattingRuleFactory.Create(
+        type,
+        address,
+        GetNextPriority(),
+        _worksheet,
+        null);
+
+      // Add the newly created rule to the list
+      _rules.Add(cfRule);
+
+      // Return the newly created rule
+      return cfRule;
+    }
+
+    /// <summary>
+    /// Add AboveAverage Rule
+    /// </summary>
+    /// <param name="address"></param>
+    /// <returns></returns>
+    public IExcelConditionalFormattingAverageGroup AddAboveAverage(
+      ExcelAddress address)
+    {
+      return (IExcelConditionalFormattingAverageGroup)AddRule(
+        eExcelConditionalFormattingRuleType.AboveAverage,
+        address);
+    }
+
+    /// <summary>
+    /// Add AboveOrEqualAverage Rule
+    /// </summary>
+    /// <param name="address"></param>
+    /// <returns></returns>
+    public IExcelConditionalFormattingAverageGroup AddAboveOrEqualAverage(
+      ExcelAddress address)
+    {
+      return (IExcelConditionalFormattingAverageGroup)AddRule(
+        eExcelConditionalFormattingRuleType.AboveOrEqualAverage,
+        address);
+    }
+
+    /// <summary>
+    /// Add BelowAverage Rule
+    /// </summary>
+    /// <param name="address"></param>
+    /// <returns></returns>
+    public IExcelConditionalFormattingAverageGroup AddBelowAverage(
+      ExcelAddress address)
+    {
+      return (IExcelConditionalFormattingAverageGroup)AddRule(
+        eExcelConditionalFormattingRuleType.BelowAverage,
+        address);
+    }
+
+    /// <summary>
+    /// Add BelowOrEqualAverage Rule
+    /// </summary>
+    /// <param name="address"></param>
+    /// <returns></returns>
+    public IExcelConditionalFormattingAverageGroup AddBelowOrEqualAverage(
+      ExcelAddress address)
+    {
+      return (IExcelConditionalFormattingAverageGroup)AddRule(
+        eExcelConditionalFormattingRuleType.BelowOrEqualAverage,
+        address);
+    }
+
+    /// <summary>
+    /// Add AboveStdDev Rule
+    /// </summary>
+    /// <param name="address"></param>
+    /// <returns></returns>
+    public IExcelConditionalFormattingStdDevGroup AddAboveStdDev(
+      ExcelAddress address)
+    {
+      return (IExcelConditionalFormattingStdDevGroup)AddRule(
+        eExcelConditionalFormattingRuleType.AboveStdDev,
+        address);
+    }
+
+    /// <summary>
+    /// Add BelowStdDev Rule
+    /// </summary>
+    /// <param name="address"></param>
+    /// <returns></returns>
+    public IExcelConditionalFormattingStdDevGroup AddBelowStdDev(
+      ExcelAddress address)
+    {
+      return (IExcelConditionalFormattingStdDevGroup)AddRule(
+        eExcelConditionalFormattingRuleType.BelowStdDev,
+        address);
+    }
+
+    /// <summary>
+    /// Add Bottom Rule
+    /// </summary>
+    /// <param name="address"></param>
+    /// <returns></returns>
+    public IExcelConditionalFormattingTopBottomGroup AddBottom(
+      ExcelAddress address)
+    {
+      return (IExcelConditionalFormattingTopBottomGroup)AddRule(
+        eExcelConditionalFormattingRuleType.Bottom,
+        address);
+    }
+
+    /// <summary>
+    /// Add BottomPercent Rule
+    /// </summary>
+    /// <param name="address"></param>
+    /// <returns></returns>
+    public IExcelConditionalFormattingTopBottomGroup AddBottomPercent(
+      ExcelAddress address)
+    {
+      return (IExcelConditionalFormattingTopBottomGroup)AddRule(
+        eExcelConditionalFormattingRuleType.BottomPercent,
+        address);
+    }
+
+    /// <summary>
+    /// Add Top Rule
+    /// </summary>
+    /// <param name="address"></param>
+    /// <returns></returns>
+    public IExcelConditionalFormattingTopBottomGroup AddTop(
+      ExcelAddress address)
+    {
+      return (IExcelConditionalFormattingTopBottomGroup)AddRule(
+        eExcelConditionalFormattingRuleType.Top,
+        address);
+    }
+
+    /// <summary>
+    /// Add TopPercent Rule
+    /// </summary>
+    /// <param name="address"></param>
+    /// <returns></returns>
+    public IExcelConditionalFormattingTopBottomGroup AddTopPercent(
+      ExcelAddress address)
+    {
+      return (IExcelConditionalFormattingTopBottomGroup)AddRule(
+        eExcelConditionalFormattingRuleType.TopPercent,
+        address);
+    }
+
+    /// <summary>
+    /// Add Last7Days Rule
+    /// </summary>
+    /// <param name="address"></param>
+    /// <returns></returns>
+    public IExcelConditionalFormattingTimePeriodGroup AddLast7Days(
+      ExcelAddress address)
+    {
+      return (IExcelConditionalFormattingTimePeriodGroup)AddRule(
+        eExcelConditionalFormattingRuleType.Last7Days,
+        address);
+    }
+
+    /// <summary>
+    /// Add LastMonth Rule
+    /// </summary>
+    /// <param name="address"></param>
+    /// <returns></returns>
+    public IExcelConditionalFormattingTimePeriodGroup AddLastMonth(
+      ExcelAddress address)
+    {
+      return (IExcelConditionalFormattingTimePeriodGroup)AddRule(
+        eExcelConditionalFormattingRuleType.LastMonth,
+        address);
+    }
+
+    /// <summary>
+    /// Add LastWeek Rule
+    /// </summary>
+    /// <param name="address"></param>
+    /// <returns></returns>
+    public IExcelConditionalFormattingTimePeriodGroup AddLastWeek(
+      ExcelAddress address)
+    {
+      return (IExcelConditionalFormattingTimePeriodGroup)AddRule(
+        eExcelConditionalFormattingRuleType.LastWeek,
+        address);
+    }
+
+    /// <summary>
+    /// Add NextMonth Rule
+    /// </summary>
+    /// <param name="address"></param>
+    /// <returns></returns>
+    public IExcelConditionalFormattingTimePeriodGroup AddNextMonth(
+      ExcelAddress address)
+    {
+      return (IExcelConditionalFormattingTimePeriodGroup)AddRule(
+        eExcelConditionalFormattingRuleType.NextMonth,
+        address);
+    }
+
+    /// <summary>
+    /// Add NextWeek Rule
+    /// </summary>
+    /// <param name="address"></param>
+    /// <returns></returns>
+    public IExcelConditionalFormattingTimePeriodGroup AddNextWeek(
+      ExcelAddress address)
+    {
+      return (IExcelConditionalFormattingTimePeriodGroup)AddRule(
+        eExcelConditionalFormattingRuleType.NextWeek,
+        address);
+    }
+
+    /// <summary>
+    /// Add ThisMonth Rule
+    /// </summary>
+    /// <param name="address"></param>
+    /// <returns></returns>
+    public IExcelConditionalFormattingTimePeriodGroup AddThisMonth(
+      ExcelAddress address)
+    {
+      return (IExcelConditionalFormattingTimePeriodGroup)AddRule(
+        eExcelConditionalFormattingRuleType.ThisMonth,
+        address);
+    }
+
+    /// <summary>
+    /// Add ThisWeek Rule
+    /// </summary>
+    /// <param name="address"></param>
+    /// <returns></returns>
+    public IExcelConditionalFormattingTimePeriodGroup AddThisWeek(
+      ExcelAddress address)
+    {
+      return (IExcelConditionalFormattingTimePeriodGroup)AddRule(
+        eExcelConditionalFormattingRuleType.ThisWeek,
+        address);
+    }
+
+    /// <summary>
+    /// Add Today Rule
+    /// </summary>
+    /// <param name="address"></param>
+    /// <returns></returns>
+    public IExcelConditionalFormattingTimePeriodGroup AddToday(
+      ExcelAddress address)
+    {
+      return (IExcelConditionalFormattingTimePeriodGroup)AddRule(
+        eExcelConditionalFormattingRuleType.Today,
+        address);
+    }
+
+    /// <summary>
+    /// Add Tomorrow Rule
+    /// </summary>
+    /// <param name="address"></param>
+    /// <returns></returns>
+    public IExcelConditionalFormattingTimePeriodGroup AddTomorrow(
+      ExcelAddress address)
+    {
+      return (IExcelConditionalFormattingTimePeriodGroup)AddRule(
+        eExcelConditionalFormattingRuleType.Tomorrow,
+        address);
+    }
+
+    /// <summary>
+    /// Add Yesterday Rule
+    /// </summary>
+    /// <param name="address"></param>
+    /// <returns></returns>
+    public IExcelConditionalFormattingTimePeriodGroup AddYesterday(
+      ExcelAddress address)
+    {
+      return (IExcelConditionalFormattingTimePeriodGroup)AddRule(
+        eExcelConditionalFormattingRuleType.Yesterday,
+        address);
+    }
+
+    /// <summary>
+    /// Add BeginsWith Rule
+    /// </summary>
+    /// <param name="address"></param>
+    /// <returns></returns>
+    public IExcelConditionalFormattingBeginsWith AddBeginsWith(
+      ExcelAddress address)
+    {
+      return (IExcelConditionalFormattingBeginsWith)AddRule(
+        eExcelConditionalFormattingRuleType.BeginsWith,
+        address);
+    }
+
+    /// <summary>
+    /// Add Between Rule
+    /// </summary>
+    /// <param name="address"></param>
+    /// <returns></returns>
+    public IExcelConditionalFormattingBetween AddBetween(
+      ExcelAddress address)
+    {
+      return (IExcelConditionalFormattingBetween)AddRule(
+        eExcelConditionalFormattingRuleType.Between,
+        address);
+    }
+
+    /// <summary>
+    /// Add ContainsBlanks Rule
+    /// </summary>
+    /// <param name="address"></param>
+    /// <returns></returns>
+    public IExcelConditionalFormattingContainsBlanks AddContainsBlanks(
+      ExcelAddress address)
+    {
+      return (IExcelConditionalFormattingContainsBlanks)AddRule(
+        eExcelConditionalFormattingRuleType.ContainsBlanks,
+        address);
+    }
+
+    /// <summary>
+    /// Add ContainsErrors Rule
+    /// </summary>
+    /// <param name="address"></param>
+    /// <returns></returns>
+    public IExcelConditionalFormattingContainsErrors AddContainsErrors(
+      ExcelAddress address)
+    {
+      return (IExcelConditionalFormattingContainsErrors)AddRule(
+        eExcelConditionalFormattingRuleType.ContainsErrors,
+        address);
+    }
+
+    /// <summary>
+    /// Add ContainsText Rule
+    /// </summary>
+    /// <param name="address"></param>
+    /// <returns></returns>
+    public IExcelConditionalFormattingContainsText AddContainsText(
+      ExcelAddress address)
+    {
+      return (IExcelConditionalFormattingContainsText)AddRule(
+        eExcelConditionalFormattingRuleType.ContainsText,
+        address);
+    }
+
+    /// <summary>
+    /// Add DuplicateValues Rule
+    /// </summary>
+    /// <param name="address"></param>
+    /// <returns></returns>
+    public IExcelConditionalFormattingDuplicateValues AddDuplicateValues(
+      ExcelAddress address)
+    {
+      return (IExcelConditionalFormattingDuplicateValues)AddRule(
+        eExcelConditionalFormattingRuleType.DuplicateValues,
+        address);
+    }
+
+    /// <summary>
+    /// Add EndsWith Rule
+    /// </summary>
+    /// <param name="address"></param>
+    /// <returns></returns>
+    public IExcelConditionalFormattingEndsWith AddEndsWith(
+      ExcelAddress address)
+    {
+      return (IExcelConditionalFormattingEndsWith)AddRule(
+        eExcelConditionalFormattingRuleType.EndsWith,
+        address);
+    }
+
+    /// <summary>
+    /// Add Equal Rule
+    /// </summary>
+    /// <param name="address"></param>
+    /// <returns></returns>
+    public IExcelConditionalFormattingEqual AddEqual(
+      ExcelAddress address)
+    {
+      return (IExcelConditionalFormattingEqual)AddRule(
+        eExcelConditionalFormattingRuleType.Equal,
+        address);
+    }
+
+    /// <summary>
+    /// Add Expression Rule
+    /// </summary>
+    /// <param name="address"></param>
+    /// <returns></returns>
+    public IExcelConditionalFormattingExpression AddExpression(
+      ExcelAddress address)
+    {
+      return (IExcelConditionalFormattingExpression)AddRule(
+        eExcelConditionalFormattingRuleType.Expression,
+        address);
+    }
+
+    /// <summary>
+    /// Add GreaterThan Rule
+    /// </summary>
+    /// <param name="address"></param>
+    /// <returns></returns>
+    public IExcelConditionalFormattingGreaterThan AddGreaterThan(
+      ExcelAddress address)
+    {
+      return (IExcelConditionalFormattingGreaterThan)AddRule(
+        eExcelConditionalFormattingRuleType.GreaterThan,
+        address);
+    }
+
+    /// <summary>
+    /// Add GreaterThanOrEqual Rule
+    /// </summary>
+    /// <param name="address"></param>
+    /// <returns></returns>
+    public IExcelConditionalFormattingGreaterThanOrEqual AddGreaterThanOrEqual(
+      ExcelAddress address)
+    {
+      return (IExcelConditionalFormattingGreaterThanOrEqual)AddRule(
+        eExcelConditionalFormattingRuleType.GreaterThanOrEqual,
+        address);
+    }
+
+    /// <summary>
+    /// Add LessThan Rule
+    /// </summary>
+    /// <param name="address"></param>
+    /// <returns></returns>
+    public IExcelConditionalFormattingLessThan AddLessThan(
+      ExcelAddress address)
+    {
+      return (IExcelConditionalFormattingLessThan)AddRule(
+        eExcelConditionalFormattingRuleType.LessThan,
+        address);
+    }
+
+    /// <summary>
+    /// Add LessThanOrEqual Rule
+    /// </summary>
+    /// <param name="address"></param>
+    /// <returns></returns>
+    public IExcelConditionalFormattingLessThanOrEqual AddLessThanOrEqual(
+      ExcelAddress address)
+    {
+      return (IExcelConditionalFormattingLessThanOrEqual)AddRule(
+        eExcelConditionalFormattingRuleType.LessThanOrEqual,
+        address);
+    }
+
+    /// <summary>
+    /// Add NotBetween Rule
+    /// </summary>
+    /// <param name="address"></param>
+    /// <returns></returns>
+    public IExcelConditionalFormattingNotBetween AddNotBetween(
+      ExcelAddress address)
+    {
+      return (IExcelConditionalFormattingNotBetween)AddRule(
+        eExcelConditionalFormattingRuleType.NotBetween,
+        address);
+    }
+
+    /// <summary>
+    /// Add NotContainsBlanks Rule
+    /// </summary>
+    /// <param name="address"></param>
+    /// <returns></returns>
+    public IExcelConditionalFormattingNotContainsBlanks AddNotContainsBlanks(
+      ExcelAddress address)
+    {
+      return (IExcelConditionalFormattingNotContainsBlanks)AddRule(
+        eExcelConditionalFormattingRuleType.NotContainsBlanks,
+        address);
+    }
+
+    /// <summary>
+    /// Add NotContainsErrors Rule
+    /// </summary>
+    /// <param name="address"></param>
+    /// <returns></returns>
+    public IExcelConditionalFormattingNotContainsErrors AddNotContainsErrors(
+      ExcelAddress address)
+    {
+      return (IExcelConditionalFormattingNotContainsErrors)AddRule(
+        eExcelConditionalFormattingRuleType.NotContainsErrors,
+        address);
+    }
+
+    /// <summary>
+    /// Add NotContainsText Rule
+    /// </summary>
+    /// <param name="address"></param>
+    /// <returns></returns>
+    public IExcelConditionalFormattingNotContainsText AddNotContainsText(
+      ExcelAddress address)
+    {
+      return (IExcelConditionalFormattingNotContainsText)AddRule(
+        eExcelConditionalFormattingRuleType.NotContainsText,
+        address);
+    }
+
+    /// <summary>
+    /// Add NotEqual Rule
+    /// </summary>
+    /// <param name="address"></param>
+    /// <returns></returns>
+    public IExcelConditionalFormattingNotEqual AddNotEqual(
+      ExcelAddress address)
+    {
+      return (IExcelConditionalFormattingNotEqual)AddRule(
+        eExcelConditionalFormattingRuleType.NotEqual,
+        address);
+    }
+
+    /// <summary>
+    /// Add Unique Rule
+    /// </summary>
+    /// <param name="address"></param>
+    /// <returns></returns>
+    public IExcelConditionalFormattingUniqueValues AddUniqueValues(
+      ExcelAddress address)
+    {
+      return (IExcelConditionalFormattingUniqueValues)AddRule(
+        eExcelConditionalFormattingRuleType.UniqueValues,
+        address);
+    }
+
+    /// <summary>
+    /// Add ThreeColorScale Rule
+    /// </summary>
+    /// <param name="address"></param>
+    /// <returns></returns>
+    public IExcelConditionalFormattingThreeColorScale AddThreeColorScale(
+      ExcelAddress address)
+    {
+      return (IExcelConditionalFormattingThreeColorScale)AddRule(
+        eExcelConditionalFormattingRuleType.ThreeColorScale,
+        address);
+    }
+
+    /// <summary>
+    /// Add TwoColorScale Rule
+    /// </summary>
+    /// <param name="address"></param>
+    /// <returns></returns>
+    public IExcelConditionalFormattingTwoColorScale AddTwoColorScale(
+      ExcelAddress address)
+    {
+      return (IExcelConditionalFormattingTwoColorScale)AddRule(
+        eExcelConditionalFormattingRuleType.TwoColorScale,
+        address);
+    }
+
+    /// <summary>
+    /// Add ThreeIconSet Rule
+    /// </summary>
+    /// <param name="Address">The address</param>
+    /// <param name="IconSet">Type of iconset</param>
+    /// <returns></returns>
+    public IExcelConditionalFormattingThreeIconSet<eExcelconditionalFormatting3IconsSetType> AddThreeIconSet(ExcelAddress Address, eExcelconditionalFormatting3IconsSetType IconSet)
+    {
+        var icon = (IExcelConditionalFormattingThreeIconSet<eExcelconditionalFormatting3IconsSetType>)AddRule(
+            eExcelConditionalFormattingRuleType.ThreeIconSet,
+            Address);
+        icon.IconSet = IconSet;
+        return icon;
+    }
+    /// <summary>
+    /// Adds a FourIconSet rule
+    /// </summary>
+    /// <param name="Address"></param>
+    /// <param name="IconSet"></param>
+    /// <returns></returns>
+    public IExcelConditionalFormattingFourIconSet<eExcelconditionalFormatting4IconsSetType> AddFourIconSet(ExcelAddress Address, eExcelconditionalFormatting4IconsSetType IconSet)
+    {
+        var icon = (IExcelConditionalFormattingFourIconSet<eExcelconditionalFormatting4IconsSetType>)AddRule(
+            eExcelConditionalFormattingRuleType.FourIconSet,
+            Address);
+        icon.IconSet = IconSet;
+        return icon;
+    }
+    /// <summary>
+    /// Adds a FiveIconSet rule
+    /// </summary>
+    /// <param name="Address"></param>
+    /// <param name="IconSet"></param>
+    /// <returns></returns>
+    public IExcelConditionalFormattingFiveIconSet AddFiveIconSet(ExcelAddress Address, eExcelconditionalFormatting5IconsSetType IconSet)
+    {
+        var icon = (IExcelConditionalFormattingFiveIconSet)AddRule(
+            eExcelConditionalFormattingRuleType.FiveIconSet,
+            Address);
+        icon.IconSet = IconSet;
+        return icon;
+    }
+    /// <summary>
+    /// Adds a databar rule
+    /// </summary>
+    /// <param name="Address"></param>
+    /// <param name="color"></param>
+    /// <returns></returns>
+    public IExcelConditionalFormattingDataBarGroup AddDatabar(ExcelAddress Address, Color color)
+    {
+        var dataBar = (IExcelConditionalFormattingDataBarGroup)AddRule(
+            eExcelConditionalFormattingRuleType.DataBar,
+            Address);
+        dataBar.Color=color;
+        return dataBar;
+    }
+    #endregion Conditional Formatting Rules
+
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/ExcelConditionalFormattingColorScaleValue.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/ExcelConditionalFormattingColorScaleValue.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/ExcelConditionalFormattingColorScaleValue.cs	(revision 12707)
@@ -0,0 +1,511 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Eyal Seagull        Added       		  2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Drawing;
+using System.Xml;
+using OfficeOpenXml.Utils;
+using System.Text.RegularExpressions;
+using System.Globalization;
+using System.Security;
+
+namespace OfficeOpenXml.ConditionalFormatting
+{
+	/// <summary>
+	/// 18.3.1.11 cfvo (Conditional Format Value Object)
+	/// Describes the values of the interpolation points in a gradient scale.
+	/// </summary>
+	public class ExcelConditionalFormattingColorScaleValue
+		: XmlHelper
+	{
+		/****************************************************************************************/
+
+		#region Private Properties
+		private eExcelConditionalFormattingValueObjectPosition _position;
+		private eExcelConditionalFormattingRuleType _ruleType;
+		private ExcelWorksheet _worksheet;
+		#endregion Private Properties
+
+		/****************************************************************************************/
+
+		#region Constructors
+    /// <summary>
+    /// Initialize the cfvo (§18.3.1.11) node
+    /// </summary>
+    /// <param name="position"></param>
+    /// <param name="type"></param>
+    /// <param name="color"></param>
+    /// <param name="value"></param>
+    /// <param name="formula"></param>
+    /// <param name="ruleType"></param>
+    /// <param name="address"></param>
+    /// <param name="priority"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode">The cfvo (§18.3.1.11) node parent. Can be any of the following:
+    /// colorScale (§18.3.1.16); dataBar (§18.3.1.28); iconSet (§18.3.1.49)</param>
+    /// <param name="namespaceManager"></param>
+		internal ExcelConditionalFormattingColorScaleValue(
+			eExcelConditionalFormattingValueObjectPosition position,
+			eExcelConditionalFormattingValueObjectType type,
+			Color color,
+			double value,
+			string formula,
+			eExcelConditionalFormattingRuleType ruleType,
+      ExcelAddress address,
+      int priority,
+			ExcelWorksheet worksheet,
+			XmlNode itemElementNode,
+			XmlNamespaceManager namespaceManager)
+			: base(
+				namespaceManager,
+				itemElementNode)
+		{
+			Require.Argument(priority).IsInRange(1, int.MaxValue, "priority");
+			Require.Argument(address).IsNotNull("address");
+			Require.Argument(worksheet).IsNotNull("worksheet");
+
+			// Save the worksheet for private methods to use
+			_worksheet = worksheet;
+
+			// Schema order list
+			SchemaNodeOrder = new string[]
+			{
+        ExcelConditionalFormattingConstants.Nodes.Cfvo,
+        ExcelConditionalFormattingConstants.Nodes.Color
+			};
+
+			// Check if the parent does not exists
+			if (itemElementNode == null)
+			{
+				// Get the parent node path by the rule type
+				string parentNodePath = ExcelConditionalFormattingValueObjectType.GetParentPathByRuleType(
+					ruleType);
+
+				// Check for en error (rule type does not have <cfvo>)
+				if (parentNodePath == string.Empty)
+				{
+					throw new Exception(
+						ExcelConditionalFormattingConstants.Errors.MissingCfvoParentNode);
+				}
+
+				// Point to the <cfvo> parent node
+        itemElementNode = _worksheet.WorksheetXml.SelectSingleNode(
+					string.Format(
+						"//{0}[{1}='{2}']/{3}[{4}='{5}']/{6}",
+					// {0}
+						ExcelConditionalFormattingConstants.Paths.ConditionalFormatting,
+					// {1}
+						ExcelConditionalFormattingConstants.Paths.SqrefAttribute,
+					// {2}
+						address.Address,
+					// {3}
+						ExcelConditionalFormattingConstants.Paths.CfRule,
+					// {4}
+						ExcelConditionalFormattingConstants.Paths.PriorityAttribute,
+					// {5}
+						priority,
+					// {6}
+						parentNodePath),
+					_worksheet.NameSpaceManager);
+
+				// Check for en error (rule type does not have <cfvo>)
+        if (itemElementNode == null)
+				{
+					throw new Exception(
+						ExcelConditionalFormattingConstants.Errors.MissingCfvoParentNode);
+				}
+			}
+
+			// Point to the <cfvo> parent node (<colorScale>, <dataBar> or <iconSet>)
+      // This is different than normal, as TopNode does not point to the node itself but to
+      // its PARENT. Later, in the CreateNodeByOrdem method the TopNode will be updated.
+      TopNode = itemElementNode;
+
+			// Save the attributes
+			Position = position;
+			RuleType = ruleType;
+			Type = type;
+			Color = color;
+			Value = value;
+			Formula = formula;
+		}
+
+		/// <summary>
+		/// Initialize the <see cref="ExcelConditionalFormattingColorScaleValue"/>
+		/// </summary>
+		/// <param name="position"></param>
+		/// <param name="type"></param>
+		/// <param name="color"></param>
+		/// <param name="value"></param>
+		/// <param name="formula"></param>
+		/// <param name="ruleType"></param>
+		/// <param name="priority"></param>
+		/// <param name="address"></param>
+		/// <param name="worksheet"></param>
+		/// <param name="namespaceManager"></param>
+		internal ExcelConditionalFormattingColorScaleValue(
+			eExcelConditionalFormattingValueObjectPosition position,
+			eExcelConditionalFormattingValueObjectType type,
+			Color color,
+			double value,
+			string formula,
+			eExcelConditionalFormattingRuleType ruleType,
+      ExcelAddress address,
+      int priority,
+			ExcelWorksheet worksheet,
+			XmlNamespaceManager namespaceManager)
+			: this(
+				position,
+				type,
+				color,
+				value,
+				formula,
+				ruleType,
+        address,
+        priority,
+				worksheet,
+				null,
+				namespaceManager)
+		{
+		}
+
+		/// <summary>
+		/// Initialize the <see cref="ExcelConditionalFormattingColorScaleValue"/>
+		/// </summary>
+		/// <param name="position"></param>
+		/// <param name="type"></param>
+		/// <param name="color"></param>
+		/// <param name="ruleType"></param>
+		/// <param name="priority"></param>
+		/// <param name="address"></param>
+		/// <param name="worksheet"></param>
+		/// <param name="namespaceManager"></param>
+		internal ExcelConditionalFormattingColorScaleValue(
+			eExcelConditionalFormattingValueObjectPosition position,
+			eExcelConditionalFormattingValueObjectType type,
+			Color color,
+			eExcelConditionalFormattingRuleType ruleType,
+      ExcelAddress address,
+      int priority,
+			ExcelWorksheet worksheet,
+			XmlNamespaceManager namespaceManager)
+			: this(
+				position,
+				type,
+				color,
+				0,
+				null,
+				ruleType,
+        address,
+        priority,
+				worksheet,
+				null,
+				namespaceManager)
+		{
+		}
+		#endregion Constructors
+
+		/****************************************************************************************/
+
+		#region Methods
+		/// <summary>
+		/// Get the node order (1, 2 ou 3) according to the Position (Low, Middle and High)
+		/// and the Rule Type (TwoColorScale ou ThreeColorScale).
+		/// </summary>
+		/// <returns></returns>
+		private int GetNodeOrder()
+		{
+			return ExcelConditionalFormattingValueObjectType.GetOrderByPosition(
+				Position,
+				RuleType);
+		}
+
+		/// <summary>
+		/// Create the 'cfvo'/'color' nodes in the right order. They should appear like this:
+		///		"cfvo"   --> Low Value (value object)
+		///		"cfvo"   --> Middle Value (value object)
+		///		"cfvo"   --> High Value (value object)
+		///		"color"  --> Low Value (color)
+		///		"color"  --> Middle Value (color)
+		///		"color"  --> High Value (color)
+		/// </summary>
+		/// <param name="nodeType"></param>
+		/// <param name="attributePath"></param>
+		/// <param name="attributeValue"></param>
+		private void CreateNodeByOrdem(
+			eExcelConditionalFormattingValueObjectNodeType nodeType,
+			string attributePath,
+			string attributeValue)
+		{
+      // Save the current TopNode
+      XmlNode currentTopNode = TopNode;
+
+      string nodePath = ExcelConditionalFormattingValueObjectType.GetNodePathByNodeType(nodeType);
+			int nodeOrder = GetNodeOrder();
+			eNodeInsertOrder nodeInsertOrder = eNodeInsertOrder.SchemaOrder;
+			XmlNode referenceNode = null;
+
+			if (nodeOrder > 1)
+			{
+				// Find the node just before the one we need to include
+				referenceNode = TopNode.SelectSingleNode(
+					string.Format(
+						"{0}[position()={1}]",
+					// {0}
+						nodePath,
+					// {1}
+						nodeOrder - 1),
+					_worksheet.NameSpaceManager);
+
+				// Only if the prepend node exists than insert after
+				if (referenceNode != null)
+				{
+					nodeInsertOrder = eNodeInsertOrder.After;
+				}
+			}
+
+			// Create the node in the right order
+			var node = CreateComplexNode(
+				TopNode,
+				string.Format(
+					"{0}[position()={1}]",
+				// {0}
+					nodePath,
+				// {1}
+					nodeOrder),
+				nodeInsertOrder,
+				referenceNode);
+
+      // Point to the new node as the temporary TopNode (we need it for the XmlHelper functions)
+      TopNode = node;
+
+      // Add/Remove the attribute (if the attributeValue is empty then it will be removed)
+      SetXmlNodeString(
+        node,
+        attributePath,
+        attributeValue,
+        true);
+
+      // Point back to the <cfvo>/<color> parent node
+      TopNode = currentTopNode;
+		}
+		#endregion Methos
+
+		/****************************************************************************************/
+
+		#region Exposed Properties
+		/// <summary>
+		/// 
+		/// </summary>
+		internal eExcelConditionalFormattingValueObjectPosition Position
+		{
+			get { return _position; }
+			set { _position = value; }
+		}
+
+		/// <summary>
+		/// 
+		/// </summary>
+		internal eExcelConditionalFormattingRuleType RuleType
+		{
+			get { return _ruleType; }
+			set { _ruleType = value; }
+		}
+
+		/// <summary>
+		/// 
+		/// </summary>
+		public eExcelConditionalFormattingValueObjectType Type
+		{
+			get
+			{
+				var typeAttribute = GetXmlNodeString(
+					string.Format(
+						"{0}[position()={1}]/{2}",
+					// {0}
+						ExcelConditionalFormattingConstants.Paths.Cfvo,
+					// {1}
+						GetNodeOrder(),
+					// {2}
+						ExcelConditionalFormattingConstants.Paths.TypeAttribute));
+
+				return ExcelConditionalFormattingValueObjectType.GetTypeByAttrbiute(typeAttribute);
+			}
+			set
+			{
+				CreateNodeByOrdem(
+					eExcelConditionalFormattingValueObjectNodeType.Cfvo,
+					ExcelConditionalFormattingConstants.Paths.TypeAttribute,
+					ExcelConditionalFormattingValueObjectType.GetAttributeByType(value));
+
+				bool removeValAttribute = false;
+
+				// Make sure unnecessary attributes are removed (occures when we change
+				// the value object type)
+				switch (Type)
+				{
+					case eExcelConditionalFormattingValueObjectType.Min:
+					case eExcelConditionalFormattingValueObjectType.Max:
+						removeValAttribute = true;
+						break;
+				}
+
+				// Check if we need to remove the @val attribute
+				if (removeValAttribute)
+				{
+				  string nodePath = ExcelConditionalFormattingValueObjectType.GetNodePathByNodeType(
+						eExcelConditionalFormattingValueObjectNodeType.Cfvo);
+				  int nodeOrder = GetNodeOrder();
+
+					// Remove the attribute (removed when the value = '')
+				  CreateComplexNode(
+				    TopNode,
+				    string.Format(
+				      "{0}[position()={1}]/{2}=''",
+				    // {0}
+				      nodePath,
+				    // {1}
+				      nodeOrder,
+				    // {2}
+				      ExcelConditionalFormattingConstants.Paths.ValAttribute));
+				}
+			}
+		}
+
+		/// <summary>
+		/// 
+		/// </summary>
+		public Color Color
+		{
+			get
+			{
+				// Color Code like "FF5B34F2"
+				var colorCode = GetXmlNodeString(
+					string.Format(
+						"{0}[position()={1}]/{2}",
+					// {0}
+						ExcelConditionalFormattingConstants.Paths.Color,
+					// {1}
+						GetNodeOrder(),
+					// {2}
+						ExcelConditionalFormattingConstants.Paths.RgbAttribute));
+
+				return ExcelConditionalFormattingHelper.ConvertFromColorCode(colorCode);
+			}
+			set
+			{
+				// Use the color code to store (Ex. "FF5B35F2")
+				CreateNodeByOrdem(
+					eExcelConditionalFormattingValueObjectNodeType.Color,
+					ExcelConditionalFormattingConstants.Paths.RgbAttribute,
+					value.ToArgb().ToString("x"));
+			}
+		}
+
+		/// <summary>
+		/// Get/Set the 'cfvo' node @val attribute
+		/// </summary>
+		public Double Value
+		{
+			get
+			{
+				return GetXmlNodeDouble(
+					string.Format(
+						"{0}[position()={1}]/{2}",
+					// {0}
+						ExcelConditionalFormattingConstants.Paths.Cfvo,
+					// {1}
+						GetNodeOrder(),
+					// {2}
+						ExcelConditionalFormattingConstants.Paths.ValAttribute));
+			}
+			set
+			{
+				string valueToStore = string.Empty;
+
+				// Only some types use the @val attribute
+				if ((Type == eExcelConditionalFormattingValueObjectType.Num)
+					|| (Type == eExcelConditionalFormattingValueObjectType.Percent)
+					|| (Type == eExcelConditionalFormattingValueObjectType.Percentile))
+				{
+					valueToStore = value.ToString();
+				}
+
+				CreateNodeByOrdem(
+					eExcelConditionalFormattingValueObjectNodeType.Cfvo,
+					ExcelConditionalFormattingConstants.Paths.ValAttribute,
+					valueToStore);
+			}
+		}
+
+		/// <summary>
+		/// Get/Set the Formula of the Object Value (uses the same attribute as the Value)
+		/// </summary>
+		public string Formula
+		{
+			get
+			{
+				// Return empty if the Object Value type is not Formula
+				if (Type != eExcelConditionalFormattingValueObjectType.Formula)
+				{
+					return string.Empty;
+				}
+
+				// Excel stores the formula in the @val attribute
+				return GetXmlNodeString(
+					string.Format(
+						"{0}[position()={1}]/{2}",
+					// {0}
+						ExcelConditionalFormattingConstants.Paths.Cfvo,
+					// {1}
+						GetNodeOrder(),
+					// {2}
+						ExcelConditionalFormattingConstants.Paths.ValAttribute));
+			}
+			set
+			{
+				// Only store the formula if the Object Value type is Formula
+				if (Type == eExcelConditionalFormattingValueObjectType.Formula)
+				{
+					CreateNodeByOrdem(
+						eExcelConditionalFormattingValueObjectNodeType.Cfvo,
+						ExcelConditionalFormattingConstants.Paths.ValAttribute,
+						(value == null) ? string.Empty : value.ToString());
+				}
+			}
+		}
+		#endregion Exposed Properties
+
+		/****************************************************************************************/
+	}
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/ExcelConditionalFormattingConstants.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/ExcelConditionalFormattingConstants.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/ExcelConditionalFormattingConstants.cs	(revision 12707)
@@ -0,0 +1,283 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author          Change						                  Date
+ * ******************************************************************************
+ * Eyal Seagull    Conditional Formatting Adaption    2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Xml;
+
+namespace OfficeOpenXml.ConditionalFormatting
+{
+  /// <summary>
+  /// The conditional formatting constants
+  /// </summary>
+  internal static class ExcelConditionalFormattingConstants
+  {
+    #region Errors
+    internal class Errors
+    {
+      internal const string CommaSeparatedAddresses = @"Multiple addresses may not be commaseparated, use space instead";
+      internal const string InvalidCfruleObject = @"The supplied item must inherit OfficeOpenXml.ConditionalFormatting.ExcelConditionalFormattingRule";
+      internal const string InvalidConditionalFormattingObject = @"The supplied item must inherit OfficeOpenXml.ConditionalFormatting.ExcelConditionalFormatting";
+      internal const string InvalidPriority = @"Invalid priority number. Must be bigger than zero";
+      internal const string InvalidRemoveRuleOperation = @"Invalid remove rule operation";
+      internal const string MissingCfvoNode = @"Missing 'cfvo' node in Conditional Formatting";
+      internal const string MissingCfvoParentNode = @"Missing 'cfvo' parent node in Conditional Formatting";
+      internal const string MissingConditionalFormattingNode = @"Missing 'conditionalFormatting' node in Conditional Formatting";
+      internal const string MissingItemRuleList = @"Missing item with address '{0}' in Conditional Formatting Rule List";
+      internal const string MissingPriorityAttribute = @"Missing 'priority' attribute in Conditional Formatting Rule";
+      internal const string MissingRuleType = @"Missing eExcelConditionalFormattingRuleType Type in Conditional Formatting";
+      internal const string MissingSqrefAttribute = @"Missing 'sqref' attribute in Conditional Formatting";
+      internal const string MissingTypeAttribute = @"Missing 'type' attribute in Conditional Formatting Rule";
+      internal const string MissingWorksheetNode = @"Missing 'worksheet' node";
+      internal const string NonSupportedRuleType = @"Non supported conditionalFormattingType: {0}";
+      internal const string UnexistentCfvoTypeAttribute = @"Unexistent eExcelConditionalFormattingValueObjectType attribute in Conditional Formatting";
+      internal const string UnexistentOperatorTypeAttribute = @"Unexistent eExcelConditionalFormattingOperatorType attribute in Conditional Formatting";
+      internal const string UnexistentTimePeriodTypeAttribute = @"Unexistent eExcelConditionalFormattingTimePeriodType attribute in Conditional Formatting";
+      internal const string UnexpectedRuleTypeAttribute = @"Unexpected eExcelConditionalFormattingRuleType attribute in Conditional Formatting Rule";
+      internal const string UnexpectedRuleTypeName = @"Unexpected eExcelConditionalFormattingRuleType TypeName in Conditional Formatting Rule";
+      internal const string WrongNumberCfvoColorNodes = @"Wrong number of 'cfvo'/'color' nodes in Conditional Formatting Rule";
+    }
+    #endregion Errors
+
+    #region Nodes
+    internal class Nodes
+    {
+      internal const string Worksheet = "worksheet";
+      internal const string ConditionalFormatting = "conditionalFormatting";
+      internal const string CfRule = "cfRule";
+      internal const string ColorScale = "colorScale";
+      internal const string Cfvo = "cfvo";
+      internal const string Color = "color";
+      internal const string DataBar = "dataBar";
+      internal const string IconSet = "iconSet";
+      internal const string Formula = "formula";
+    }
+    #endregion Nodes
+
+    #region Attributes
+    internal class Attributes
+    {
+      internal const string AboveAverage = "aboveAverage";
+      internal const string Bottom = "bottom";
+      internal const string DxfId = "dxfId";
+      internal const string EqualAverage = "equalAverage";
+      internal const string IconSet = "iconSet";
+      internal const string Operator = "operator";
+      internal const string Percent = "percent";
+      internal const string Priority = "priority";
+      internal const string Rank = "rank";
+      internal const string Reverse = "reverse";
+      internal const string Rgb = "rgb";
+      internal const string ShowValue = "showValue";
+      internal const string Sqref = "sqref";
+      internal const string StdDev = "stdDev";
+      internal const string StopIfTrue = "stopIfTrue";
+      internal const string Text = "text";
+      internal const string Theme = "theme";
+      internal const string TimePeriod = "timePeriod";
+      internal const string Tint = "tint";
+      internal const string Type = "type";
+      internal const string Val = "val";
+    }
+    #endregion Attributes
+
+    #region XML Paths
+    internal class Paths
+    {
+      // Main node and attributes
+      internal const string Worksheet = "d:" + Nodes.Worksheet;
+
+      // <conditionalFormatting> §18.3.1.18 node
+      // can appear more than once in a worksheet
+      internal const string ConditionalFormatting = "d:" + Nodes.ConditionalFormatting;
+
+      // <cfRule> §18.3.1.10 node
+      // can appear more than once in a <conditionalFormatting>
+      internal const string CfRule = "d:" + Nodes.CfRule;
+
+      // <colorScale> §18.3.1.16 node
+      internal const string ColorScale = "d:" + Nodes.ColorScale;
+
+      // <cfvo> §18.3.1.11 node
+      internal const string Cfvo = "d:" + Nodes.Cfvo;
+
+      // <color> §18.3.1.15 node
+      internal const string Color = "d:" + Nodes.Color;
+
+      // <dataBar> §18.3.1.28 node
+      internal const string DataBar = "d:" + Nodes.DataBar;
+
+      // <iconSet> §18.3.1.49 node
+      internal const string IconSet = "d:" + Nodes.IconSet;
+
+      // <formula> §18.3.1.43 node
+      internal const string Formula = "d:" + Nodes.Formula;
+
+      // Attributes (for all the nodes)
+      internal const string AboveAverageAttribute = "@" + Attributes.AboveAverage;
+      internal const string BottomAttribute = "@" + Attributes.Bottom;
+      internal const string DxfIdAttribute = "@" + Attributes.DxfId;
+      internal const string EqualAverageAttribute = "@" + Attributes.EqualAverage;
+      internal const string IconSetAttribute = "@" + Attributes.IconSet;
+      internal const string OperatorAttribute = "@" + Attributes.Operator;
+      internal const string PercentAttribute = "@" + Attributes.Percent;
+      internal const string PriorityAttribute = "@" + Attributes.Priority;
+      internal const string RankAttribute = "@" + Attributes.Rank;
+      internal const string ReverseAttribute = "@" + Attributes.Reverse;
+      internal const string RgbAttribute = "@" + Attributes.Rgb;
+      internal const string ShowValueAttribute = "@" + Attributes.ShowValue;
+      internal const string SqrefAttribute = "@" + Attributes.Sqref;
+      internal const string StdDevAttribute = "@" + Attributes.StdDev;
+      internal const string StopIfTrueAttribute = "@" + Attributes.StopIfTrue;
+      internal const string TextAttribute = "@" + Attributes.Text;
+      internal const string ThemeAttribute = "@" + Attributes.Theme;
+      internal const string TimePeriodAttribute = "@" + Attributes.TimePeriod;
+      internal const string TintAttribute = "@" + Attributes.Tint;
+      internal const string TypeAttribute = "@" + Attributes.Type;
+      internal const string ValAttribute = "@" + Attributes.Val;
+    }
+    #endregion XML Paths
+
+    #region Rule Type ST_CfType §18.18.12 (with small EPPlus changes)
+    internal class RuleType
+    {
+      internal const string AboveAverage = "aboveAverage";
+      internal const string BeginsWith = "beginsWith";
+      internal const string CellIs = "cellIs";
+      internal const string ColorScale = "colorScale";
+      internal const string ContainsBlanks = "containsBlanks";
+      internal const string ContainsErrors = "containsErrors";
+      internal const string ContainsText = "containsText";
+      internal const string DataBar = "dataBar";
+      internal const string DuplicateValues = "duplicateValues";
+      internal const string EndsWith = "endsWith";
+      internal const string Expression = "expression";
+      internal const string IconSet = "iconSet";
+      internal const string NotContainsBlanks = "notContainsBlanks";
+      internal const string NotContainsErrors = "notContainsErrors";
+      internal const string NotContainsText = "notContainsText";
+      internal const string TimePeriod = "timePeriod";
+      internal const string Top10 = "top10";
+      internal const string UniqueValues = "uniqueValues";
+
+      // EPPlus Extended Types
+      internal const string AboveOrEqualAverage = "aboveOrEqualAverage";
+      internal const string AboveStdDev = "aboveStdDev";
+      internal const string BelowAverage = "belowAverage";
+      internal const string BelowOrEqualAverage = "belowOrEqualAverage";
+      internal const string BelowStdDev = "belowStdDev";
+      internal const string Between = "between";
+      internal const string Bottom = "bottom";
+      internal const string BottomPercent = "bottomPercent";
+      internal const string Equal = "equal";
+      internal const string GreaterThan = "greaterThan";
+      internal const string GreaterThanOrEqual = "greaterThanOrEqual";
+      internal const string IconSet3 = "iconSet3";
+      internal const string IconSet4 = "iconSet4";
+      internal const string IconSet5 = "iconSet5";
+      internal const string Last7Days = "last7Days";
+      internal const string LastMonth = "lastMonth";
+      internal const string LastWeek = "lastWeek";
+      internal const string LessThan = "lessThan";
+      internal const string LessThanOrEqual = "lessThanOrEqual";
+      internal const string NextMonth = "nextMonth";
+      internal const string NextWeek = "nextWeek";
+      internal const string NotBetween = "notBetween";
+      internal const string NotEqual = "notEqual";
+      internal const string ThisMonth = "thisMonth";
+      internal const string ThisWeek = "thisWeek";
+      internal const string ThreeColorScale = "threeColorScale";
+      internal const string Today = "today";
+      internal const string Tomorrow = "tomorrow";
+      internal const string Top = "top";
+      internal const string TopPercent = "topPercent";
+      internal const string TwoColorScale = "twoColorScale";
+      internal const string Yesterday = "yesterday";
+    }
+    #endregion Rule Type ST_CfType §18.18.12 (with small EPPlus changes)
+
+    #region CFVO Type ST_CfvoType §18.18.13
+    internal class CfvoType
+    {
+      internal const string Min = "min";
+      internal const string Max = "max";
+      internal const string Num = "num";
+      internal const string Formula = "formula";
+      internal const string Percent = "percent";
+      internal const string Percentile = "percentile";
+    }
+    #endregion CFVO Type ST_CfvoType §18.18.13
+
+    #region Operator Type ST_ConditionalFormattingOperator §18.18.15
+    internal class Operators
+    {
+      internal const string BeginsWith = "beginsWith";
+      internal const string Between = "between";
+      internal const string ContainsText = "containsText";
+      internal const string EndsWith = "endsWith";
+      internal const string Equal = "equal";
+      internal const string GreaterThan = "greaterThan";
+      internal const string GreaterThanOrEqual = "greaterThanOrEqual";
+      internal const string LessThan = "lessThan";
+      internal const string LessThanOrEqual = "lessThanOrEqual";
+      internal const string NotBetween = "notBetween";
+      internal const string NotContains = "notContains";
+      internal const string NotEqual = "notEqual";
+    }
+    #endregion Operator Type ST_ConditionalFormattingOperator §18.18.15
+
+    #region Time Period Type ST_TimePeriod §18.18.82
+    internal class TimePeriods
+    {
+      internal const string Last7Days = "last7Days";
+      internal const string LastMonth = "lastMonth";
+      internal const string LastWeek = "lastWeek";
+      internal const string NextMonth = "nextMonth";
+      internal const string NextWeek = "nextWeek";
+      internal const string ThisMonth = "thisMonth";
+      internal const string ThisWeek = "thisWeek";
+      internal const string Today = "today";
+      internal const string Tomorrow = "tomorrow";
+      internal const string Yesterday = "yesterday";
+    }
+    #endregion Time Period Type ST_TimePeriod §18.18.82
+
+    #region Colors
+    internal class Colors
+    {
+      internal const string CfvoLowValue = @"#FFF8696B";
+      internal const string CfvoMiddleValue = @"#FFFFEB84";
+      internal const string CfvoHighValue = @"#FF63BE7B";
+    }
+    #endregion Colors
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/ExcelConditionalFormattingEnums.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/ExcelConditionalFormattingEnums.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/ExcelConditionalFormattingEnums.cs	(revision 12707)
@@ -0,0 +1,784 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author          Change						                  Date
+ * ******************************************************************************
+ * Eyal Seagull    Conditional Formatting Adaption    2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Xml;
+
+namespace OfficeOpenXml.ConditionalFormatting
+{
+  /// <summary>
+  /// Enum for Conditional Format Type ST_CfType §18.18.12. With some changes.
+  /// </summary>
+  public enum eExcelConditionalFormattingRuleType
+  {
+    #region Average
+    /// <summary>
+    /// This conditional formatting rule highlights cells that are above the average
+    /// for all values in the range.
+    /// </summary>
+    /// <remarks>AboveAverage Excel CF Rule Type</remarks>
+    AboveAverage,
+
+    /// <summary>
+    /// This conditional formatting rule highlights cells that are above or equal
+    /// the average for all values in the range.
+    /// </summary>
+    /// <remarks>AboveAverage Excel CF Rule Type</remarks>
+    AboveOrEqualAverage,
+
+    /// <summary>
+    /// This conditional formatting rule highlights cells that are below the average
+    /// for all values in the range.
+    /// </summary>
+    /// <remarks>AboveAverage Excel CF Rule Type</remarks>
+    BelowAverage,
+
+    /// <summary>
+    /// This conditional formatting rule highlights cells that are below or equal
+    /// the average for all values in the range.
+    /// </summary>
+    /// <remarks>AboveAverage Excel CF Rule Type</remarks>
+    BelowOrEqualAverage,
+    #endregion
+
+    #region StdDev
+    /// <summary>
+    /// This conditional formatting rule highlights cells that are above the standard
+    /// deviationa for all values in the range.
+    /// <remarks>AboveAverage Excel CF Rule Type</remarks>
+    /// </summary>
+    AboveStdDev,
+
+    /// <summary>
+    /// This conditional formatting rule highlights cells that are below the standard
+    /// deviationa for all values in the range.
+    /// </summary>
+    /// <remarks>AboveAverage Excel CF Rule Type</remarks>
+    BelowStdDev,
+    #endregion
+
+    #region TopBottom
+    /// <summary>
+    /// This conditional formatting rule highlights cells whose values fall in the
+    /// bottom N bracket as specified.
+    /// </summary>
+    /// <remarks>Top10 Excel CF Rule Type</remarks>
+    Bottom,
+
+    /// <summary>
+    /// This conditional formatting rule highlights cells whose values fall in the
+    /// bottom N percent as specified.
+    /// </summary>
+    /// <remarks>Top10 Excel CF Rule Type</remarks>
+    BottomPercent,
+
+    /// <summary>
+    /// This conditional formatting rule highlights cells whose values fall in the
+    /// top N bracket as specified.
+    /// </summary>
+    /// <remarks>Top10 Excel CF Rule Type</remarks>
+    Top,
+
+    /// <summary>
+    /// This conditional formatting rule highlights cells whose values fall in the
+    /// top N percent as specified.
+    /// </summary>
+    /// <remarks>Top10 Excel CF Rule Type</remarks>
+    TopPercent,
+    #endregion
+
+    #region TimePeriod
+    /// <summary>
+    /// This conditional formatting rule highlights cells containing dates in the
+    /// last 7 days.
+    /// </summary>
+    /// <remarks>TimePeriod Excel CF Rule Type</remarks>
+    Last7Days,
+
+    /// <summary>
+    /// This conditional formatting rule highlights cells containing dates in the
+    /// last month.
+    /// </summary>
+    /// <remarks>TimePeriod Excel CF Rule Type</remarks>
+    LastMonth,
+
+    /// <summary>
+    /// This conditional formatting rule highlights cells containing dates in the
+    /// last week.
+    /// </summary>
+    /// <remarks>TimePeriod Excel CF Rule Type</remarks>
+    LastWeek,
+
+    /// <summary>
+    /// This conditional formatting rule highlights cells containing dates in the
+    /// next month.
+    /// </summary>
+    /// <remarks>TimePeriod Excel CF Rule Type</remarks>
+    NextMonth,
+
+    /// <summary>
+    /// This conditional formatting rule highlights cells containing dates in the
+    /// next week.
+    /// </summary>
+    /// <remarks>TimePeriod Excel CF Rule Type</remarks>
+    NextWeek,
+
+    /// <summary>
+    /// This conditional formatting rule highlights cells containing dates in this
+    /// month.
+    /// </summary>
+    /// <remarks>TimePeriod Excel CF Rule Type</remarks>
+    ThisMonth,
+
+    /// <summary>
+    /// This conditional formatting rule highlights cells containing dates in this
+    /// week.
+    /// </summary>
+    /// <remarks>TimePeriod Excel CF Rule Type</remarks>
+    ThisWeek,
+
+    /// <summary>
+    /// This conditional formatting rule highlights cells containing today dates.
+    /// </summary>
+    /// <remarks>TimePeriod Excel CF Rule Type</remarks>
+    Today,
+
+    /// <summary>
+    /// This conditional formatting rule highlights cells containing tomorrow dates.
+    /// </summary>
+    /// <remarks>TimePeriod Excel CF Rule Type</remarks>
+    Tomorrow,
+
+    /// <summary>
+    /// This conditional formatting rule highlights cells containing yesterday dates.
+    /// </summary>
+    /// <remarks>TimePeriod Excel CF Rule Type</remarks>
+    Yesterday,
+    #endregion
+
+    #region CellIs
+    /// <summary>
+    /// This conditional formatting rule highlights cells in the range that begin with
+    /// the given text.
+    /// </summary>
+    /// <remarks>
+    /// Equivalent to using the LEFT() sheet function and comparing values.
+    /// </remarks>
+    /// <remarks>BeginsWith Excel CF Rule Type</remarks>
+    BeginsWith,
+
+    /// <summary>
+    /// This conditional formatting rule highlights cells in the range between the
+    /// given two formulas.
+    /// </summary>
+    /// <remarks>CellIs Excel CF Rule Type</remarks>
+    Between,
+
+    /// <summary>
+    /// This conditional formatting rule highlights cells that are completely blank.
+    /// </summary>
+    /// <remarks>
+    /// Equivalent of using LEN(TRIM()). This means that if the cell contains only
+    /// characters that TRIM() would remove, then it is considered blank. An empty cell
+    /// is also considered blank.
+    /// </remarks>
+    /// <remarks>ContainsBlanks Excel CF Rule Type</remarks>
+    ContainsBlanks,
+
+    /// <summary>
+    /// This conditional formatting rule highlights cells with formula errors.
+    /// </summary>
+    /// <remarks>
+    /// Equivalent to using ISERROR() sheet function to determine if there is
+    /// a formula error.
+    /// </remarks>
+    /// <remarks>ContainsErrors Excel CF Rule Type</remarks>
+    ContainsErrors,
+
+    /// <summary>
+    /// This conditional formatting rule highlights cells in the range that begin with
+    /// the given text.
+    /// </summary>
+    /// <remarks>
+    /// Equivalent to using the LEFT() sheet function and comparing values.
+    /// </remarks>
+    /// <remarks>ContainsText Excel CF Rule Type</remarks>
+    ContainsText,
+
+    /// <summary>
+    /// This conditional formatting rule highlights duplicated values.
+    /// </summary>
+    /// <remarks>DuplicateValues Excel CF Rule Type</remarks>
+    DuplicateValues,
+
+    /// <summary>
+    /// This conditional formatting rule highlights cells ending with given text.
+    /// </summary>
+    /// <remarks>
+    /// Equivalent to using the RIGHT() sheet function and comparing values.
+    /// </remarks>
+    /// <remarks>EndsWith Excel CF Rule Type</remarks>
+    EndsWith,
+
+    /// <summary>
+    /// This conditional formatting rule highlights cells equals to with given formula.
+    /// </summary>
+    /// <remarks>CellIs Excel CF Rule Type</remarks>
+    Equal,
+
+    /// <summary>
+    /// This conditional formatting rule contains a formula to evaluate. When the 
+    /// formula result is true, the cell is highlighted.
+    /// </summary>
+    /// <remarks>Expression Excel CF Rule Type</remarks>
+    Expression,
+
+    /// <summary>
+    /// This conditional formatting rule highlights cells greater than the given formula.
+    /// </summary>
+    /// <remarks>CellIs Excel CF Rule Type</remarks>
+    GreaterThan,
+
+    /// <summary>
+    /// This conditional formatting rule highlights cells greater than or equal the
+    /// given formula.
+    /// </summary>
+    /// <remarks>CellIs Excel CF Rule Type</remarks>
+    GreaterThanOrEqual,
+
+    /// <summary>
+    /// This conditional formatting rule highlights cells less than the given formula.
+    /// </summary>
+    /// <remarks>CellIs Excel CF Rule Type</remarks>
+    LessThan,
+
+    /// <summary>
+    /// This conditional formatting rule highlights cells less than or equal the
+    /// given formula.
+    /// </summary>
+    /// <remarks>CellIs Excel CF Rule Type</remarks>
+    LessThanOrEqual,
+
+    /// <summary>
+    /// This conditional formatting rule highlights cells outside the range in
+    /// given two formulas.
+    /// </summary>
+    /// <remarks>CellIs Excel CF Rule Type</remarks>
+    NotBetween,
+
+    /// <summary>
+    /// This conditional formatting rule highlights cells that does not contains the
+    /// given formula.
+    /// </summary>
+    /// <remarks>CellIs Excel CF Rule Type</remarks>
+    NotContains,
+
+    /// <summary>
+    /// This conditional formatting rule highlights cells that are not blank.
+    /// </summary>
+    /// <remarks>
+    /// Equivalent of using LEN(TRIM()). This means that if the cell contains only
+    /// characters that TRIM() would remove, then it is considered blank. An empty cell
+    /// is also considered blank.
+    /// </remarks>
+    /// <remarks>NotContainsBlanks Excel CF Rule Type</remarks>
+    NotContainsBlanks,
+
+    /// <summary>
+    /// This conditional formatting rule highlights cells without formula errors.
+    /// </summary>
+    /// <remarks>
+    /// Equivalent to using ISERROR() sheet function to determine if there is a
+    /// formula error.
+    /// </remarks>
+    /// <remarks>NotContainsErrors Excel CF Rule Type</remarks>
+    NotContainsErrors,
+
+    /// <summary>
+    /// This conditional formatting rule highlights cells that do not contain
+    /// the given text.
+    /// </summary>
+    /// <remarks>
+    /// Equivalent to using the SEARCH() sheet function.
+    /// </remarks>
+    /// <remarks>NotContainsText Excel CF Rule Type</remarks>
+    NotContainsText,
+
+    /// <summary>
+    /// This conditional formatting rule highlights cells not equals to with
+    /// given formula.
+    /// </summary>
+    /// <remarks>CellIs Excel CF Rule Type</remarks>
+    NotEqual,
+
+    /// <summary>
+    /// This conditional formatting rule highlights unique values in the range.
+    /// </summary>
+    /// <remarks>UniqueValues Excel CF Rule Type</remarks>
+    UniqueValues,
+    #endregion
+
+    #region ColorScale
+    /// <summary>
+    /// Three Color Scale (Low, Middle and High Color Scale)
+    /// </summary>
+    /// <remarks>ColorScale Excel CF Rule Type</remarks>
+    ThreeColorScale,
+
+    /// <summary>
+    /// Two Color Scale (Low and High Color Scale)
+    /// </summary>
+    /// <remarks>ColorScale Excel CF Rule Type</remarks>
+    TwoColorScale,
+    #endregion
+
+    #region IconSet
+    /// <summary>
+    /// This conditional formatting rule applies a 3 set icons to cells according
+    /// to their values.
+    /// </summary>
+    /// <remarks>IconSet Excel CF Rule Type</remarks>
+    ThreeIconSet,
+
+    /// <summary>
+    /// This conditional formatting rule applies a 4 set icons to cells according
+    /// to their values.
+    /// </summary>
+    /// <remarks>IconSet Excel CF Rule Type</remarks>
+    FourIconSet,
+
+    /// <summary>
+    /// This conditional formatting rule applies a 5 set icons to cells according
+    /// to their values.
+    /// </summary>
+    /// <remarks>IconSet Excel CF Rule Type</remarks>
+    FiveIconSet,
+    #endregion
+
+    #region DataBar
+    /// <summary>
+    /// This conditional formatting rule displays a gradated data bar in the range of cells.
+    /// </summary>
+    /// <remarks>DataBar Excel CF Rule Type</remarks>
+    DataBar
+    #endregion
+  }
+
+  /// <summary>
+  /// Enum for Conditional Format Value Object Type ST_CfvoType §18.18.13
+  /// </summary>
+  public enum eExcelConditionalFormattingValueObjectType
+  {
+    /// <summary>
+    /// Formula
+    /// </summary>
+    Formula,
+
+    /// <summary>
+    /// Maximum Value
+    /// </summary>
+    Max,
+
+    /// <summary>
+    /// Minimum Value
+    /// </summary>
+    Min,
+
+    /// <summary>
+    /// Number Value
+    /// </summary>
+    Num,
+
+    /// <summary>
+    /// Percent
+    /// </summary>
+    Percent,
+
+    /// <summary>
+    /// Percentile
+    /// </summary>
+    Percentile
+  }
+
+  /// <summary>
+  /// Enum for Conditional Formatting Value Object Position
+  /// </summary>
+  public enum eExcelConditionalFormattingValueObjectPosition
+  {
+    /// <summary>
+    /// The lower position for both TwoColorScale and ThreeColorScale
+    /// </summary>
+    Low,
+
+    /// <summary>
+    /// The middle position only for ThreeColorScale
+    /// </summary>
+    Middle,
+
+    /// <summary>
+    /// The highest position for both TwoColorScale and ThreeColorScale
+    /// </summary>
+    High
+  }
+
+  /// <summary>
+  /// Enum for Conditional Formatting Value Object Node Type
+  /// </summary>
+  public enum eExcelConditionalFormattingValueObjectNodeType
+  {
+    /// <summary>
+    /// 'cfvo' node
+    /// </summary>
+    Cfvo,
+
+    /// <summary>
+    /// 'color' node
+    /// </summary>
+    Color
+  }
+
+  /// <summary>
+  /// Enum for Conditional Formatting Operartor Type ST_ConditionalFormattingOperator §18.18.15
+  /// </summary>
+  public enum eExcelConditionalFormattingOperatorType
+  {
+    /// <summary>
+    /// Begins With. 'Begins with' operator
+    /// </summary>
+    BeginsWith,
+
+    /// <summary>
+    /// Between. 'Between' operator
+    /// </summary>
+    Between,
+
+    /// <summary>
+    /// Contains. 'Contains' operator
+    /// </summary>
+    ContainsText,
+
+    /// <summary>
+    /// Ends With. 'Ends with' operator
+    /// </summary>
+    EndsWith,
+
+    /// <summary>
+    /// Equal. 'Equal to' operator
+    /// </summary>
+    Equal,
+
+    /// <summary>
+    /// Greater Than. 'Greater than' operator
+    /// </summary>
+    GreaterThan,
+
+    /// <summary>
+    /// Greater Than Or Equal. 'Greater than or equal to' operator
+    /// </summary>
+    GreaterThanOrEqual,
+
+    /// <summary>
+    /// Less Than. 'Less than' operator
+    /// </summary>
+    LessThan,
+
+    /// <summary>
+    /// Less Than Or Equal. 'Less than or equal to' operator
+    /// </summary>
+    LessThanOrEqual,
+
+    /// <summary>
+    /// Not Between. 'Not between' operator
+    /// </summary>
+    NotBetween,
+
+    /// <summary>
+    /// Does Not Contain. 'Does not contain' operator
+    /// </summary>
+    NotContains,
+
+    /// <summary>
+    /// Not Equal. 'Not equal to' operator
+    /// </summary>
+    NotEqual
+  }
+
+  /// <summary>
+  /// Enum for Conditional Formatting Time Period Type ST_TimePeriod §18.18.82
+  /// </summary>
+  public enum eExcelConditionalFormattingTimePeriodType
+  {
+    /// <summary>
+    /// Last 7 Days. A date in the last seven days.
+    /// </summary>
+    Last7Days,
+
+    /// <summary>
+    /// Last Month. A date occuring in the last calendar month.
+    /// </summary>
+    LastMonth,
+
+    /// <summary>
+    /// Last Week. A date occuring last week.
+    /// </summary>
+    LastWeek,
+
+    /// <summary>
+    /// Next Month. A date occuring in the next calendar month.
+    /// </summary>
+    NextMonth,
+
+    /// <summary>
+    /// Next Week. A date occuring next week.
+    /// </summary>
+    NextWeek,
+
+    /// <summary>
+    /// This Month. A date occuring in this calendar month.
+    /// </summary>
+    ThisMonth,
+
+    /// <summary>
+    /// This Week. A date occuring this week.
+    /// </summary>
+    ThisWeek,
+
+    /// <summary>
+    /// Today. Today's date.
+    /// </summary>
+    Today,
+
+    /// <summary>
+    /// Tomorrow. Tomorrow's date.
+    /// </summary>
+    Tomorrow,
+
+    /// <summary>
+    /// Yesterday. Yesterday's date.
+    /// </summary>
+    Yesterday
+  }
+
+  /// <summary>
+  /// 18.18.42 ST_IconSetType (Icon Set Type) - Only 3 icons
+  /// </summary>
+  public enum eExcelconditionalFormatting3IconsSetType
+  {
+    /// <summary>
+    /// (3 Arrows) 3 arrows icon set.
+    /// </summary>
+    Arrows,
+
+    /// <summary>
+    /// (3 Arrows (Gray)) 3 gray arrows icon set.
+    /// </summary>
+    ArrowsGray,
+
+    /// <summary>
+    /// (3 Flags) 3 flags icon set. 
+    /// </summary>
+    Flags,
+
+    /// <summary>
+    /// (3 Signs) 3 signs icon set.
+    /// </summary>
+    Signs,
+
+    /// <summary>
+    /// (3 Symbols Circled) 3 symbols icon set.
+    /// </summary>
+    Symbols,
+
+    /// <summary>
+    /// (3 Symbols) 3 Symbols icon set.
+    /// </summary>
+    Symbols2,
+
+    /// <summary>
+    /// (3 Traffic Lights) 3 traffic lights icon set (#1).
+    /// </summary>
+    TrafficLights1,
+
+    /// <summary>
+    /// (3 Traffic Lights Black) 3 traffic lights icon set with thick black border.
+    /// </summary>
+    TrafficLights2
+  }
+
+  /// <summary>
+  /// 18.18.42 ST_IconSetType (Icon Set Type) - Only 4 icons
+  /// </summary>
+  public enum eExcelconditionalFormatting4IconsSetType
+  {
+    /// <summary>
+    /// (4 Arrows) 4 arrows icon set.
+    /// </summary>
+    Arrows,
+
+    /// <summary>
+    /// (4 Arrows (Gray)) 4 gray arrows icon set.
+    /// </summary>
+    ArrowsGray,
+
+    /// <summary>
+    /// (4 Ratings) 4 ratings icon set.
+    /// </summary>
+    Rating,
+
+    /// <summary>
+    /// (4 Red To Black) 4 'red to black' icon set.
+    /// </summary>
+    RedToBlack,
+
+    /// <summary>
+    /// (4 Traffic Lights) 4 traffic lights icon set.
+    /// </summary>
+    TrafficLights
+  }
+
+  /// <summary>
+  /// 18.18.42 ST_IconSetType (Icon Set Type) - Only 5 icons
+  /// </summary>
+  public enum eExcelconditionalFormatting5IconsSetType
+  {
+    /// <summary>
+    /// (5 Arrows) 5 arrows icon set.
+    /// </summary>
+    Arrows,
+
+    /// <summary>
+    /// (5 Arrows (Gray)) 5 gray arrows icon set.
+    /// </summary>
+    ArrowsGray,
+
+    /// <summary>
+    /// (5 Quarters) 5 quarters icon set.
+    /// </summary>
+    Quarters,
+
+    /// <summary>
+    /// (5 Ratings Icon Set) 5 rating icon set.
+    /// </summary>
+    Rating
+  }
+  /// <summary>
+  /// 18.18.42 ST_IconSetType (Icon Set Type)
+  /// </summary>
+  public enum eExcelconditionalFormattingIconsSetType
+  {
+      /// <summary>
+      /// (3 Arrows) 3 arrows icon set.
+      /// </summary>
+      ThreeArrows,
+
+      /// <summary>
+      /// (3 Arrows (Gray)) 3 gray arrows icon set.
+      /// </summary>
+      ThreeArrowsGray,
+
+      /// <summary>
+      /// (3 Flags) 3 flags icon set. 
+      /// </summary>
+      ThreeFlags,
+
+      /// <summary>
+      /// (3 Signs) 3 signs icon set.
+      /// </summary>
+      ThreeSigns,
+
+      /// <summary>
+      /// (3 Symbols Circled) 3 symbols icon set.
+      /// </summary>
+      ThreeSymbols,
+
+      /// <summary>
+      /// (3 Symbols) 3 Symbols icon set.
+      /// </summary>
+      ThreeSymbols2,
+
+      /// <summary>
+      /// (3 Traffic Lights) 3 traffic lights icon set (#1).
+      /// </summary>
+      ThreeTrafficLights1,
+
+      /// <summary>
+      /// (3 Traffic Lights Black) 3 traffic lights icon set with thick black border.
+      /// </summary>
+      ThreeTrafficLights2,
+ 
+    /// <summary>
+    /// (4 Arrows) 4 arrows icon set.
+    /// </summary>
+    FourArrows,
+
+    /// <summary>
+    /// (4 Arrows (Gray)) 4 gray arrows icon set.
+    /// </summary>
+    FourArrowsGray,
+
+    /// <summary>
+    /// (4 Ratings) 4 ratings icon set.
+    /// </summary>
+    FourRating,
+
+    /// <summary>
+    /// (4 Red To Black) 4 'red to black' icon set.
+    /// </summary>
+    FourRedToBlack,
+
+    /// <summary>
+    /// (4 Traffic Lights) 4 traffic lights icon set.
+    /// </summary>
+    FourTrafficLights,
+
+      /// <summary>
+    /// (5 Arrows) 5 arrows icon set.
+    /// </summary>
+    FiveArrows,
+
+    /// <summary>
+    /// (5 Arrows (Gray)) 5 gray arrows icon set.
+    /// </summary>
+    FiveArrowsGray,
+
+    /// <summary>
+    /// (5 Quarters) 5 quarters icon set.
+    /// </summary>
+    FiveQuarters,
+
+    /// <summary>
+    /// (5 Ratings Icon Set) 5 rating icon set.
+    /// </summary>
+    FiveRating
+}
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/ExcelConditionalFormattingHelper.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/ExcelConditionalFormattingHelper.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/ExcelConditionalFormattingHelper.cs	(revision 12707)
@@ -0,0 +1,274 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Eyal Seagull        Added       		  2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+using OfficeOpenXml.Utils;
+using System.Drawing;
+using System.Globalization;
+using System.Xml;
+
+namespace OfficeOpenXml.ConditionalFormatting
+{
+  /// <summary>
+  /// Conditional formatting helper
+  /// </summary>
+  internal static class ExcelConditionalFormattingHelper
+  {
+    /// <summary>
+    /// Check and fix an address (string address)
+    /// </summary>
+    /// <param name="address"></param>
+    /// <returns></returns>
+    public static string CheckAndFixRangeAddress(
+      string address)
+    {
+      if (address.Contains(','))
+      {
+        throw new FormatException(
+          ExcelConditionalFormattingConstants.Errors.CommaSeparatedAddresses);
+      }
+
+      address = address.ToUpper(CultureInfo.InvariantCulture);
+
+      if (Regex.IsMatch(address, @"[A-Z]+:[A-Z]+"))
+      {
+        address = AddressUtility.ParseEntireColumnSelections(address);
+      }
+
+      return address;
+    }
+
+    /// <summary>
+    /// Convert a color code to Color Object
+    /// </summary>
+    /// <param name="colorCode">Color Code (Ex. "#FFB43C53" or "FFB43C53")</param>
+    /// <returns></returns>
+    public static Color ConvertFromColorCode(
+      string colorCode)
+    {
+      try
+      {
+        return Color.FromArgb(Int32.Parse(colorCode.Replace("#", ""), NumberStyles.HexNumber));
+      }
+      catch
+      {
+        // Assume white is the default color (instead of giving an error)
+        return Color.White;
+      }
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="node"></param>
+    /// <param name="attribute"></param>
+    /// <returns></returns>
+    public static string GetAttributeString(
+      XmlNode node,
+      string attribute)
+    {
+      try
+      {
+        var value = node.Attributes[attribute].Value;
+        return (value == null) ? string.Empty : value;
+      }
+      catch
+      {
+        return string.Empty;
+      }
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="node"></param>
+    /// <param name="attribute"></param>
+    /// <returns></returns>
+    public static int GetAttributeInt(
+      XmlNode node,
+      string attribute)
+    {
+      try
+      {
+        var value = node.Attributes[attribute].Value;
+        return int.Parse(value, NumberStyles.Integer, CultureInfo.InvariantCulture);
+      }
+      catch
+      {
+        return int.MinValue;
+      }
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="node"></param>
+    /// <param name="attribute"></param>
+    /// <returns></returns>
+    public static int? GetAttributeIntNullable(
+      XmlNode node,
+      string attribute)
+    {
+      try
+      {
+          if (node.Attributes[attribute] == null)
+          {
+              return null;
+          }
+          else
+          {
+              var value = node.Attributes[attribute].Value;
+              return int.Parse(value, NumberStyles.Integer, CultureInfo.InvariantCulture);
+          }
+      }
+      catch
+      {
+        return null;
+      }
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="node"></param>
+    /// <param name="attribute"></param>
+    /// <returns></returns>
+    public static bool GetAttributeBool(
+      XmlNode node,
+      string attribute)
+    {
+      try
+      {
+        var value = node.Attributes[attribute].Value;
+        return (value == "1" || value == "-1" || value.Equals("TRUE", StringComparison.InvariantCultureIgnoreCase));
+      }
+      catch
+      {
+        return false;
+      }
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="node"></param>
+    /// <param name="attribute"></param>
+    /// <returns></returns>
+    public static bool? GetAttributeBoolNullable(
+      XmlNode node,
+      string attribute)
+    {
+      try
+      {
+          if (node.Attributes[attribute] == null)
+          {
+              return null;
+          }
+          else
+          {
+              var value = node.Attributes[attribute].Value;
+              return (value == "1" || value == "-1" || value.Equals("TRUE",StringComparison.InvariantCultureIgnoreCase));
+          }
+      }
+      catch
+      {
+        return null;
+      }
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="node"></param>
+    /// <param name="attribute"></param>
+    /// <returns></returns>
+    public static double GetAttributeDouble(
+      XmlNode node,
+      string attribute)
+    {
+      try
+      {
+        var value = node.Attributes[attribute].Value;
+        return double.Parse(value, NumberStyles.Number, CultureInfo.InvariantCulture);
+      }
+      catch
+      {
+        return double.NaN;
+      }
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="node"></param>
+    /// <param name="attribute"></param>
+    /// <returns></returns>
+    public static decimal GetAttributeDecimal(
+      XmlNode node,
+      string attribute)
+    {
+      try
+      {
+        var value = node.Attributes[attribute].Value;
+        return decimal.Parse(value, NumberStyles.Any, CultureInfo.InvariantCulture);
+      }
+      catch
+      {
+        return decimal.MinValue;
+      }
+    }
+
+    /// <summary>
+    /// Encode to XML (special characteres: &apos; &quot; &gt; &lt; &amp;)
+    /// </summary>
+    /// <param name="s"></param>
+    /// <returns></returns>
+    public static string EncodeXML(
+      this string s)
+    {
+      return s.Replace("&", "&amp;").Replace("<", "&lt;").Replace(">", "&gt;").Replace("\"", "&quot;").Replace("'", "&apos;");
+    }
+
+    /// <summary>
+    /// Decode from XML (special characteres: &apos; &quot; &gt; &lt; &amp;)
+    /// </summary>
+    /// <param name="s"></param>
+    /// <returns></returns>
+    public static string DecodeXML(
+      this string s)
+    {
+      return s.Replace("'", "&apos;").Replace("\"", "&quot;").Replace(">", "&gt;").Replace("<", "&lt;").Replace("&", "&amp;");
+    }
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/ExcelConditionalFormattingIconDatabarValue.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/ExcelConditionalFormattingIconDatabarValue.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/ExcelConditionalFormattingIconDatabarValue.cs	(revision 12707)
@@ -0,0 +1,358 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Eyal Seagull        Added       		  2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Drawing;
+using System.Xml;
+using OfficeOpenXml.Utils;
+using System.Text.RegularExpressions;
+using System.Globalization;
+using System.Security;
+
+namespace OfficeOpenXml.ConditionalFormatting
+{
+	/// <summary>
+	/// 18.3.1.11 cfvo (Conditional Format Value Object)
+	/// Describes the values of the interpolation points in a gradient scale.
+	/// </summary>
+	public class ExcelConditionalFormattingIconDataBarValue
+		: XmlHelper
+	{
+		/****************************************************************************************/
+
+		#region Private Properties
+		private eExcelConditionalFormattingRuleType _ruleType;
+		private ExcelWorksheet _worksheet;
+		#endregion Private Properties
+
+		/****************************************************************************************/
+
+		#region Constructors
+    /// <summary>
+    /// Initialize the cfvo (§18.3.1.11) node
+    /// </summary>
+    /// <param name="type"></param>
+    /// <param name="value"></param>
+    /// <param name="formula"></param>
+    /// <param name="ruleType"></param>
+    /// <param name="address"></param>
+    /// <param name="priority"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode">The cfvo (§18.3.1.11) node parent. Can be any of the following:
+    /// colorScale (§18.3.1.16); dataBar (§18.3.1.28); iconSet (§18.3.1.49)</param>
+    /// <param name="namespaceManager"></param>
+		internal ExcelConditionalFormattingIconDataBarValue(
+			eExcelConditionalFormattingValueObjectType type,
+			double value,
+			string formula,
+			eExcelConditionalFormattingRuleType ruleType,
+            ExcelAddress address,
+            int priority,
+			ExcelWorksheet worksheet,
+			XmlNode itemElementNode,
+			XmlNamespaceManager namespaceManager)
+			: this(
+            ruleType,
+            address,
+            worksheet,
+            itemElementNode,
+			namespaceManager)
+		{
+			Require.Argument(priority).IsInRange(1, int.MaxValue, "priority");
+
+            // Check if the parent does not exists
+			if (itemElementNode == null)
+			{
+				// Get the parent node path by the rule type
+				string parentNodePath = ExcelConditionalFormattingValueObjectType.GetParentPathByRuleType(
+					ruleType);
+
+				// Check for en error (rule type does not have <cfvo>)
+				if (parentNodePath == string.Empty)
+				{
+					throw new Exception(
+						ExcelConditionalFormattingConstants.Errors.MissingCfvoParentNode);
+				}
+
+				// Point to the <cfvo> parent node
+        itemElementNode = _worksheet.WorksheetXml.SelectSingleNode(
+					string.Format(
+						"//{0}[{1}='{2}']/{3}[{4}='{5}']/{6}",
+					// {0}
+						ExcelConditionalFormattingConstants.Paths.ConditionalFormatting,
+					// {1}
+						ExcelConditionalFormattingConstants.Paths.SqrefAttribute,
+					// {2}
+						address.Address,
+					// {3}
+						ExcelConditionalFormattingConstants.Paths.CfRule,
+					// {4}
+						ExcelConditionalFormattingConstants.Paths.PriorityAttribute,
+					// {5}
+						priority,
+					// {6}
+						parentNodePath),
+					_worksheet.NameSpaceManager);
+
+				// Check for en error (rule type does not have <cfvo>)
+                if (itemElementNode == null)
+				{
+					throw new Exception(
+						ExcelConditionalFormattingConstants.Errors.MissingCfvoParentNode);
+				}
+			}
+
+            TopNode = itemElementNode;
+
+			// Save the attributes
+			RuleType = ruleType;
+			Type = type;
+			Value = value;
+			Formula = formula;
+		}
+    /// <summary>
+    /// Initialize the cfvo (§18.3.1.11) node
+    /// </summary>
+    /// <param name="ruleType"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode">The cfvo (§18.3.1.11) node parent. Can be any of the following:
+    /// colorScale (§18.3.1.16); dataBar (§18.3.1.28); iconSet (§18.3.1.49)</param>
+    /// <param name="namespaceManager"></param>
+        internal ExcelConditionalFormattingIconDataBarValue(
+            eExcelConditionalFormattingRuleType ruleType,
+            ExcelAddress address,
+            ExcelWorksheet worksheet,
+            XmlNode itemElementNode,
+            XmlNamespaceManager namespaceManager)
+            : base(
+                namespaceManager,
+                itemElementNode)
+        {
+            Require.Argument(address).IsNotNull("address");
+            Require.Argument(worksheet).IsNotNull("worksheet");
+
+            // Save the worksheet for private methods to use
+            _worksheet = worksheet;
+
+            // Schema order list
+            SchemaNodeOrder = new string[]
+			{
+                ExcelConditionalFormattingConstants.Nodes.Cfvo,
+			};
+
+            //Check if the parent does not exists
+            if (itemElementNode == null)
+            {
+                // Get the parent node path by the rule type
+                string parentNodePath = ExcelConditionalFormattingValueObjectType.GetParentPathByRuleType(
+                    ruleType);
+
+                // Check for en error (rule type does not have <cfvo>)
+                if (parentNodePath == string.Empty)
+                {
+                    throw new Exception(
+                        ExcelConditionalFormattingConstants.Errors.MissingCfvoParentNode);
+                }
+            }
+            RuleType = ruleType;            
+        }
+		/// <summary>
+		/// Initialize the <see cref="ExcelConditionalFormattingColorScaleValue"/>
+		/// </summary>
+		/// <param name="type"></param>
+		/// <param name="value"></param>
+		/// <param name="formula"></param>
+		/// <param name="ruleType"></param>
+		/// <param name="priority"></param>
+		/// <param name="address"></param>
+		/// <param name="worksheet"></param>
+		/// <param name="namespaceManager"></param>
+		internal ExcelConditionalFormattingIconDataBarValue(
+			eExcelConditionalFormattingValueObjectType type,
+			double value,
+			string formula,
+			eExcelConditionalFormattingRuleType ruleType,
+            ExcelAddress address,
+            int priority,
+			ExcelWorksheet worksheet,
+			XmlNamespaceManager namespaceManager)
+			: this(
+				type,
+				value,
+				formula,
+				ruleType,
+                address,
+                priority,
+				worksheet,
+				null,
+				namespaceManager)
+		{
+            
+		}
+		/// <summary>
+		/// Initialize the <see cref="ExcelConditionalFormattingColorScaleValue"/>
+		/// </summary>
+		/// <param name="type"></param>
+		/// <param name="color"></param>
+		/// <param name="ruleType"></param>
+		/// <param name="priority"></param>
+		/// <param name="address"></param>
+		/// <param name="worksheet"></param>
+		/// <param name="namespaceManager"></param>
+		internal ExcelConditionalFormattingIconDataBarValue(
+			eExcelConditionalFormattingValueObjectType type,
+			Color color,
+			eExcelConditionalFormattingRuleType ruleType,
+            ExcelAddress address,
+            int priority,
+			ExcelWorksheet worksheet,
+			XmlNamespaceManager namespaceManager)
+			: this(
+				type,
+				0,
+				null,
+				ruleType,
+                address,
+                priority,
+				worksheet,
+				null,
+				namespaceManager)
+		{
+		}
+		#endregion Constructors
+
+		/****************************************************************************************/
+
+		#region Methods
+        #endregion
+
+        /****************************************************************************************/
+
+		#region Exposed Properties
+
+		/// <summary>
+		/// 
+		/// </summary>
+		internal eExcelConditionalFormattingRuleType RuleType
+		{
+			get { return _ruleType; }
+			set { _ruleType = value; }
+		}
+
+		/// <summary>
+		/// 
+		/// </summary>
+		public eExcelConditionalFormattingValueObjectType Type
+		{
+			get
+			{
+				var typeAttribute = GetXmlNodeString(ExcelConditionalFormattingConstants.Paths.TypeAttribute);
+
+				return ExcelConditionalFormattingValueObjectType.GetTypeByAttrbiute(typeAttribute);
+			}
+			set
+			{
+                if ((_ruleType==eExcelConditionalFormattingRuleType.ThreeIconSet || _ruleType==eExcelConditionalFormattingRuleType.FourIconSet || _ruleType==eExcelConditionalFormattingRuleType.FiveIconSet) &&
+                    (value == eExcelConditionalFormattingValueObjectType.Min || value == eExcelConditionalFormattingValueObjectType.Max))
+                {
+                    throw(new ArgumentException("Value type can't be Min or Max for icon sets"));
+                }
+                SetXmlNodeString(ExcelConditionalFormattingConstants.Paths.TypeAttribute, value.ToString().ToLower(CultureInfo.InvariantCulture));                
+			}
+		}
+
+		/// <summary>
+		/// Get/Set the 'cfvo' node @val attribute
+		/// </summary>
+		public Double Value
+		{
+			get
+			{
+                if ((Type == eExcelConditionalFormattingValueObjectType.Num)
+                    || (Type == eExcelConditionalFormattingValueObjectType.Percent)
+                    || (Type == eExcelConditionalFormattingValueObjectType.Percentile))
+                {
+                    return GetXmlNodeDouble(ExcelConditionalFormattingConstants.Paths.ValAttribute);
+                }
+                else
+                {
+                    return 0;
+                }
+            }
+			set
+			{
+				string valueToStore = string.Empty;
+
+				// Only some types use the @val attribute
+				if ((Type == eExcelConditionalFormattingValueObjectType.Num)
+					|| (Type == eExcelConditionalFormattingValueObjectType.Percent)
+					|| (Type == eExcelConditionalFormattingValueObjectType.Percentile))
+				{
+					valueToStore = value.ToString(CultureInfo.InvariantCulture);
+				}
+
+                SetXmlNodeString(ExcelConditionalFormattingConstants.Paths.ValAttribute, valueToStore);
+			}
+		}
+
+		/// <summary>
+		/// Get/Set the Formula of the Object Value (uses the same attribute as the Value)
+		/// </summary>
+		public string Formula
+		{
+			get
+			{
+				// Return empty if the Object Value type is not Formula
+				if (Type != eExcelConditionalFormattingValueObjectType.Formula)
+				{
+					return string.Empty;
+				}
+
+				// Excel stores the formula in the @val attribute
+				return GetXmlNodeString(ExcelConditionalFormattingConstants.Paths.ValAttribute);
+			}
+			set
+			{
+				// Only store the formula if the Object Value type is Formula
+				if (Type == eExcelConditionalFormattingValueObjectType.Formula)
+				{
+                    SetXmlNodeString(ExcelConditionalFormattingConstants.Paths.ValAttribute, value);
+				}
+			}
+		}
+		#endregion Exposed Properties
+
+		/****************************************************************************************/
+	}
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/ExcelConditionalFormattingOperatorType.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/ExcelConditionalFormattingOperatorType.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/ExcelConditionalFormattingOperatorType.cs	(revision 12707)
@@ -0,0 +1,145 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author          Change						                  Date
+ * ******************************************************************************
+ * Eyal Seagull    Conditional Formatting Adaption    2012-04-17
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Xml;
+
+namespace OfficeOpenXml.ConditionalFormatting
+{
+	/// <summary>
+  /// Functions related to the <see cref="ExcelConditionalFormattingOperatorType"/>
+	/// </summary>
+  internal static class ExcelConditionalFormattingOperatorType
+	{
+		/// <summary>
+		/// 
+		/// </summary>
+		/// <param name="type"></param>
+		/// <returns></returns>
+		internal static string GetAttributeByType(
+			eExcelConditionalFormattingOperatorType type)
+		{
+			switch (type)
+			{
+        case eExcelConditionalFormattingOperatorType.BeginsWith:
+          return ExcelConditionalFormattingConstants.Operators.BeginsWith;
+
+        case eExcelConditionalFormattingOperatorType.Between:
+          return ExcelConditionalFormattingConstants.Operators.Between;
+
+        case eExcelConditionalFormattingOperatorType.ContainsText:
+          return ExcelConditionalFormattingConstants.Operators.ContainsText;
+
+        case eExcelConditionalFormattingOperatorType.EndsWith:
+          return ExcelConditionalFormattingConstants.Operators.EndsWith;
+
+        case eExcelConditionalFormattingOperatorType.Equal:
+          return ExcelConditionalFormattingConstants.Operators.Equal;
+
+        case eExcelConditionalFormattingOperatorType.GreaterThan:
+          return ExcelConditionalFormattingConstants.Operators.GreaterThan;
+
+        case eExcelConditionalFormattingOperatorType.GreaterThanOrEqual:
+          return ExcelConditionalFormattingConstants.Operators.GreaterThanOrEqual;
+
+        case eExcelConditionalFormattingOperatorType.LessThan:
+          return ExcelConditionalFormattingConstants.Operators.LessThan;
+
+        case eExcelConditionalFormattingOperatorType.LessThanOrEqual:
+          return ExcelConditionalFormattingConstants.Operators.LessThanOrEqual;
+
+        case eExcelConditionalFormattingOperatorType.NotBetween:
+          return ExcelConditionalFormattingConstants.Operators.NotBetween;
+
+        case eExcelConditionalFormattingOperatorType.NotContains:
+          return ExcelConditionalFormattingConstants.Operators.NotContains;
+
+        case eExcelConditionalFormattingOperatorType.NotEqual:
+          return ExcelConditionalFormattingConstants.Operators.NotEqual;
+			}
+
+			return string.Empty;
+		}
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// param name="attribute"
+    /// <returns></returns>
+    internal static eExcelConditionalFormattingOperatorType GetTypeByAttribute(
+      string attribute)
+    {
+      switch (attribute)
+      {
+        case ExcelConditionalFormattingConstants.Operators.BeginsWith:
+          return eExcelConditionalFormattingOperatorType.BeginsWith;
+
+        case ExcelConditionalFormattingConstants.Operators.Between:
+          return eExcelConditionalFormattingOperatorType.Between;
+
+        case ExcelConditionalFormattingConstants.Operators.ContainsText:
+          return eExcelConditionalFormattingOperatorType.ContainsText;
+
+        case ExcelConditionalFormattingConstants.Operators.EndsWith:
+          return eExcelConditionalFormattingOperatorType.EndsWith;
+
+        case ExcelConditionalFormattingConstants.Operators.Equal:
+          return eExcelConditionalFormattingOperatorType.Equal;
+
+        case ExcelConditionalFormattingConstants.Operators.GreaterThan:
+          return eExcelConditionalFormattingOperatorType.GreaterThan;
+
+        case ExcelConditionalFormattingConstants.Operators.GreaterThanOrEqual:
+          return eExcelConditionalFormattingOperatorType.GreaterThanOrEqual;
+
+        case ExcelConditionalFormattingConstants.Operators.LessThan:
+          return eExcelConditionalFormattingOperatorType.LessThan;
+
+        case ExcelConditionalFormattingConstants.Operators.LessThanOrEqual:
+          return eExcelConditionalFormattingOperatorType.LessThanOrEqual;
+
+        case ExcelConditionalFormattingConstants.Operators.NotBetween:
+          return eExcelConditionalFormattingOperatorType.NotBetween;
+
+        case ExcelConditionalFormattingConstants.Operators.NotContains:
+          return eExcelConditionalFormattingOperatorType.NotContains;
+
+        case ExcelConditionalFormattingConstants.Operators.NotEqual:
+          return eExcelConditionalFormattingOperatorType.NotEqual;
+      }
+
+      throw new Exception(
+        ExcelConditionalFormattingConstants.Errors.UnexistentOperatorTypeAttribute);
+    }
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/ExcelConditionalFormattingRuleFactory.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/ExcelConditionalFormattingRuleFactory.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/ExcelConditionalFormattingRuleFactory.cs	(revision 12707)
@@ -0,0 +1,388 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ *  * Author							Change						      Date
+ * ******************************************************************************
+ * Eyal Seagull		    Conditional Formatting      2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Xml;
+using OfficeOpenXml.Utils;
+using OfficeOpenXml.ConditionalFormatting.Contracts;
+
+namespace OfficeOpenXml.ConditionalFormatting
+{
+	/// <summary>
+	/// Factory class for ExcelConditionalFormatting.
+	/// </summary>
+	internal static class ExcelConditionalFormattingRuleFactory
+	{
+		public static ExcelConditionalFormattingRule Create(
+			eExcelConditionalFormattingRuleType type,
+      ExcelAddress address,
+      int priority,
+			ExcelWorksheet worksheet,
+			XmlNode itemElementNode)
+		{
+			Require.Argument(type);
+      Require.Argument(address).IsNotNull("address");
+      Require.Argument(priority).IsInRange(1, int.MaxValue, "priority");
+			Require.Argument(worksheet).IsNotNull("worksheet");
+			
+			// According the conditional formatting rule type
+			switch (type)
+			{
+        case eExcelConditionalFormattingRuleType.AboveAverage:
+          return new ExcelConditionalFormattingAboveAverage(
+            address,
+            priority,
+            worksheet,
+            itemElementNode);
+
+        case eExcelConditionalFormattingRuleType.AboveOrEqualAverage:
+          return new ExcelConditionalFormattingAboveOrEqualAverage(
+            address,
+            priority,
+            worksheet,
+            itemElementNode);
+
+        case eExcelConditionalFormattingRuleType.BelowAverage:
+          return new ExcelConditionalFormattingBelowAverage(
+            address,
+            priority,
+            worksheet,
+            itemElementNode);
+
+        case eExcelConditionalFormattingRuleType.BelowOrEqualAverage:
+          return new ExcelConditionalFormattingBelowOrEqualAverage(
+            address,
+            priority,
+            worksheet,
+            itemElementNode);
+
+        case eExcelConditionalFormattingRuleType.AboveStdDev:
+          return new ExcelConditionalFormattingAboveStdDev(
+            address,
+            priority,
+            worksheet,
+            itemElementNode);
+
+        case eExcelConditionalFormattingRuleType.BelowStdDev:
+          return new ExcelConditionalFormattingBelowStdDev(
+            address,
+            priority,
+            worksheet,
+            itemElementNode);
+
+        case eExcelConditionalFormattingRuleType.Bottom:
+          return new ExcelConditionalFormattingBottom(
+            address,
+            priority,
+            worksheet,
+            itemElementNode);
+
+        case eExcelConditionalFormattingRuleType.BottomPercent:
+          return new ExcelConditionalFormattingBottomPercent(
+            address,
+            priority,
+            worksheet,
+            itemElementNode);
+
+        case eExcelConditionalFormattingRuleType.Top:
+          return new ExcelConditionalFormattingTop(
+            address,
+            priority,
+            worksheet,
+            itemElementNode);
+
+        case eExcelConditionalFormattingRuleType.TopPercent:
+          return new ExcelConditionalFormattingTopPercent(
+            address,
+            priority,
+            worksheet,
+            itemElementNode);
+
+        case eExcelConditionalFormattingRuleType.Last7Days:
+          return new ExcelConditionalFormattingLast7Days(
+            address,
+            priority,
+            worksheet,
+            itemElementNode);
+
+
+        case eExcelConditionalFormattingRuleType.LastMonth:
+          return new ExcelConditionalFormattingLastMonth(
+            address,
+            priority,
+            worksheet,
+            itemElementNode);
+
+        case eExcelConditionalFormattingRuleType.LastWeek:
+          return new ExcelConditionalFormattingLastWeek(
+            address,
+            priority,
+            worksheet,
+            itemElementNode);
+
+        case eExcelConditionalFormattingRuleType.NextMonth:
+          return new ExcelConditionalFormattingNextMonth(
+            address,
+            priority,
+            worksheet,
+            itemElementNode);
+
+        case eExcelConditionalFormattingRuleType.NextWeek:
+          return new ExcelConditionalFormattingNextWeek(
+            address,
+            priority,
+            worksheet,
+            itemElementNode);
+
+        case eExcelConditionalFormattingRuleType.ThisMonth:
+          return new ExcelConditionalFormattingThisMonth(
+            address,
+            priority,
+            worksheet,
+            itemElementNode);
+
+        case eExcelConditionalFormattingRuleType.ThisWeek:
+          return new ExcelConditionalFormattingThisWeek(
+            address,
+            priority,
+            worksheet,
+            itemElementNode);
+
+        case eExcelConditionalFormattingRuleType.Today:
+          return new ExcelConditionalFormattingToday(
+            address,
+            priority,
+            worksheet,
+            itemElementNode);
+
+        case eExcelConditionalFormattingRuleType.Tomorrow:
+          return new ExcelConditionalFormattingTomorrow(
+            address,
+            priority,
+            worksheet,
+            itemElementNode);
+
+        case eExcelConditionalFormattingRuleType.Yesterday:
+          return new ExcelConditionalFormattingYesterday(
+            address,
+            priority,
+            worksheet,
+            itemElementNode);
+
+        case eExcelConditionalFormattingRuleType.BeginsWith:
+          return new ExcelConditionalFormattingBeginsWith(
+            address,
+            priority,
+            worksheet,
+            itemElementNode);
+
+        case eExcelConditionalFormattingRuleType.Between:
+          return new ExcelConditionalFormattingBetween(
+            address,
+            priority,
+            worksheet,
+            itemElementNode);
+
+        case eExcelConditionalFormattingRuleType.ContainsBlanks:
+          return new ExcelConditionalFormattingContainsBlanks(
+            address,
+            priority,
+            worksheet,
+            itemElementNode);
+
+        case eExcelConditionalFormattingRuleType.ContainsErrors:
+          return new ExcelConditionalFormattingContainsErrors(
+            address,
+            priority,
+            worksheet,
+            itemElementNode);
+
+        case eExcelConditionalFormattingRuleType.ContainsText:
+          return new ExcelConditionalFormattingContainsText(
+            address,
+            priority,
+            worksheet,
+            itemElementNode);
+
+        case eExcelConditionalFormattingRuleType.DuplicateValues:
+          return new ExcelConditionalFormattingDuplicateValues(
+            address,
+            priority,
+            worksheet,
+            itemElementNode);
+
+        case eExcelConditionalFormattingRuleType.EndsWith:
+          return new ExcelConditionalFormattingEndsWith(
+            address,
+            priority,
+            worksheet,
+            itemElementNode);
+
+        case eExcelConditionalFormattingRuleType.Equal:
+          return new ExcelConditionalFormattingEqual(
+            address,
+            priority,
+            worksheet,
+            itemElementNode);
+
+        case eExcelConditionalFormattingRuleType.Expression:
+          return new ExcelConditionalFormattingExpression(
+            address,
+            priority,
+            worksheet,
+            itemElementNode);
+
+        case eExcelConditionalFormattingRuleType.GreaterThan:
+          return new ExcelConditionalFormattingGreaterThan(
+            address,
+            priority,
+            worksheet,
+            itemElementNode);
+
+        case eExcelConditionalFormattingRuleType.GreaterThanOrEqual:
+          return new ExcelConditionalFormattingGreaterThanOrEqual(
+            address,
+            priority,
+            worksheet,
+            itemElementNode);
+
+        case eExcelConditionalFormattingRuleType.LessThan:
+          return new ExcelConditionalFormattingLessThan(
+            address,
+            priority,
+            worksheet,
+            itemElementNode);
+
+        case eExcelConditionalFormattingRuleType.LessThanOrEqual:
+          return new ExcelConditionalFormattingLessThanOrEqual(
+            address,
+            priority,
+            worksheet,
+            itemElementNode);
+
+        case eExcelConditionalFormattingRuleType.NotBetween:
+          return new ExcelConditionalFormattingNotBetween(
+            address,
+            priority,
+            worksheet,
+            itemElementNode);
+
+        case eExcelConditionalFormattingRuleType.NotContainsBlanks:
+          return new ExcelConditionalFormattingNotContainsBlanks(
+            address,
+            priority,
+            worksheet,
+            itemElementNode);
+
+        case eExcelConditionalFormattingRuleType.NotContainsErrors:
+          return new ExcelConditionalFormattingNotContainsErrors(
+            address,
+            priority,
+            worksheet,
+            itemElementNode);
+
+        case eExcelConditionalFormattingRuleType.NotContainsText:
+          return new ExcelConditionalFormattingNotContainsText(
+            address,
+            priority,
+            worksheet,
+            itemElementNode);
+
+        case eExcelConditionalFormattingRuleType.NotEqual:
+          return new ExcelConditionalFormattingNotEqual(
+            address,
+            priority,
+            worksheet,
+            itemElementNode);
+
+        case eExcelConditionalFormattingRuleType.UniqueValues:
+          return new ExcelConditionalFormattingUniqueValues(
+            address,
+            priority,
+            worksheet,
+            itemElementNode);
+
+        case eExcelConditionalFormattingRuleType.ThreeColorScale:
+          return new ExcelConditionalFormattingThreeColorScale(
+            address,
+            priority,
+            worksheet,
+            itemElementNode);
+
+        case eExcelConditionalFormattingRuleType.TwoColorScale:
+          return new ExcelConditionalFormattingTwoColorScale(
+            address,
+            priority,
+						worksheet,
+						itemElementNode);
+        case eExcelConditionalFormattingRuleType.ThreeIconSet:
+          return new ExcelConditionalFormattingThreeIconSet(
+            address,
+            priority,
+            worksheet,
+            itemElementNode,
+            null);
+        case eExcelConditionalFormattingRuleType.FourIconSet:
+          return new ExcelConditionalFormattingFourIconSet(
+            address,
+            priority,
+            worksheet,
+            itemElementNode,
+            null);
+        case eExcelConditionalFormattingRuleType.FiveIconSet:
+          return new ExcelConditionalFormattingFiveIconSet(
+            address,
+            priority,
+            worksheet,
+            itemElementNode,
+            null);
+        case eExcelConditionalFormattingRuleType.DataBar:
+          return new ExcelConditionalFormattingDataBar(
+            eExcelConditionalFormattingRuleType.DataBar,
+            address,
+            priority,
+            worksheet,
+            itemElementNode,
+            null);
+
+
+        //TODO: Add DataBar
+			}
+
+			throw new InvalidOperationException(
+        string.Format(
+          ExcelConditionalFormattingConstants.Errors.NonSupportedRuleType,
+          type.ToString()));
+		}
+	}
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/ExcelConditionalFormattingRuleType.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/ExcelConditionalFormattingRuleType.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/ExcelConditionalFormattingRuleType.cs	(revision 12707)
@@ -0,0 +1,539 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author          Change						                  Date
+ * ******************************************************************************
+ * Eyal Seagull    Conditional Formatting Adaption    2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Xml;
+
+namespace OfficeOpenXml.ConditionalFormatting
+{
+  /// <summary>
+  /// Functions related to the ExcelConditionalFormattingRule
+  /// </summary>
+  internal static class ExcelConditionalFormattingRuleType
+  {
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="attribute"></param>
+    /// <param name="topNode"></param>
+    /// <param name="nameSpaceManager"></param>
+    /// <returns></returns>
+    internal static eExcelConditionalFormattingRuleType GetTypeByAttrbiute(
+      string attribute,
+      XmlNode topNode,
+      XmlNamespaceManager nameSpaceManager)
+    {
+      switch (attribute)
+      {
+        case ExcelConditionalFormattingConstants.RuleType.AboveAverage:
+          return GetAboveAverageType(
+            topNode,
+            nameSpaceManager);
+
+        case ExcelConditionalFormattingConstants.RuleType.Top10:
+          return GetTop10Type(
+            topNode,
+            nameSpaceManager);
+
+        case ExcelConditionalFormattingConstants.RuleType.TimePeriod:
+          return GetTimePeriodType(
+            topNode,
+            nameSpaceManager);
+        case ExcelConditionalFormattingConstants.RuleType.CellIs:
+          return GetCellIs((XmlElement)topNode);
+        case ExcelConditionalFormattingConstants.RuleType.BeginsWith:
+          return eExcelConditionalFormattingRuleType.BeginsWith;
+
+        //case ExcelConditionalFormattingConstants.RuleType.Between:
+        //  return eExcelConditionalFormattingRuleType.Between;
+
+        case ExcelConditionalFormattingConstants.RuleType.ContainsBlanks:
+          return eExcelConditionalFormattingRuleType.ContainsBlanks;
+
+        case ExcelConditionalFormattingConstants.RuleType.ContainsErrors:
+          return eExcelConditionalFormattingRuleType.ContainsErrors;
+
+        case ExcelConditionalFormattingConstants.RuleType.ContainsText:
+          return eExcelConditionalFormattingRuleType.ContainsText;
+
+        case ExcelConditionalFormattingConstants.RuleType.DuplicateValues:
+          return eExcelConditionalFormattingRuleType.DuplicateValues;
+
+        case ExcelConditionalFormattingConstants.RuleType.EndsWith:
+          return eExcelConditionalFormattingRuleType.EndsWith;
+
+        //case ExcelConditionalFormattingConstants.RuleType.Equal:
+        //  return eExcelConditionalFormattingRuleType.Equal;
+
+        case ExcelConditionalFormattingConstants.RuleType.Expression:
+          return eExcelConditionalFormattingRuleType.Expression;
+
+        //case ExcelConditionalFormattingConstants.RuleType.GreaterThan:
+        //  return eExcelConditionalFormattingRuleType.GreaterThan;
+
+        //case ExcelConditionalFormattingConstants.RuleType.GreaterThanOrEqual:
+        //  return eExcelConditionalFormattingRuleType.GreaterThanOrEqual;
+
+        //case ExcelConditionalFormattingConstants.RuleType.LessThan:
+        //  return eExcelConditionalFormattingRuleType.LessThan;
+
+        //case ExcelConditionalFormattingConstants.RuleType.LessThanOrEqual:
+        //  return eExcelConditionalFormattingRuleType.LessThanOrEqual;
+
+        //case ExcelConditionalFormattingConstants.RuleType.NotBetween:
+        //  return eExcelConditionalFormattingRuleType.NotBetween;
+
+        case ExcelConditionalFormattingConstants.RuleType.NotContainsBlanks:
+          return eExcelConditionalFormattingRuleType.NotContainsBlanks;
+
+        case ExcelConditionalFormattingConstants.RuleType.NotContainsErrors:
+          return eExcelConditionalFormattingRuleType.NotContainsErrors;
+
+        case ExcelConditionalFormattingConstants.RuleType.NotContainsText:
+          return eExcelConditionalFormattingRuleType.NotContainsText;
+
+        //case ExcelConditionalFormattingConstants.RuleType.NotEqual:
+        //  return eExcelConditionalFormattingRuleType.NotEqual;
+
+        case ExcelConditionalFormattingConstants.RuleType.UniqueValues:
+          return eExcelConditionalFormattingRuleType.UniqueValues;
+
+        case ExcelConditionalFormattingConstants.RuleType.ColorScale:
+          return GetColorScaleType(
+            topNode,
+            nameSpaceManager);        
+        case ExcelConditionalFormattingConstants.RuleType.IconSet:
+            return GetIconSetType(topNode, nameSpaceManager);
+        case ExcelConditionalFormattingConstants.RuleType.DataBar:
+            return eExcelConditionalFormattingRuleType.DataBar;
+     }
+
+      throw new Exception(
+        ExcelConditionalFormattingConstants.Errors.UnexpectedRuleTypeAttribute);
+    }
+
+    private static eExcelConditionalFormattingRuleType GetCellIs(XmlElement node)
+    {
+        switch(node.GetAttribute("operator"))
+        {
+            case ExcelConditionalFormattingConstants.Operators.BeginsWith:
+              return eExcelConditionalFormattingRuleType.BeginsWith;
+            case ExcelConditionalFormattingConstants.Operators.Between:
+              return eExcelConditionalFormattingRuleType.Between;
+
+            case ExcelConditionalFormattingConstants.Operators.ContainsText:
+              return eExcelConditionalFormattingRuleType.ContainsText;
+
+            case ExcelConditionalFormattingConstants.Operators.EndsWith:
+              return eExcelConditionalFormattingRuleType.EndsWith;
+
+            case ExcelConditionalFormattingConstants.Operators.Equal:
+              return eExcelConditionalFormattingRuleType.Equal;
+
+            case ExcelConditionalFormattingConstants.Operators.GreaterThan:
+              return eExcelConditionalFormattingRuleType.GreaterThan;
+
+            case ExcelConditionalFormattingConstants.Operators.GreaterThanOrEqual:
+              return eExcelConditionalFormattingRuleType.GreaterThanOrEqual;
+
+            case ExcelConditionalFormattingConstants.Operators.LessThan:
+              return eExcelConditionalFormattingRuleType.LessThan;
+
+            case ExcelConditionalFormattingConstants.Operators.LessThanOrEqual:
+              return eExcelConditionalFormattingRuleType.LessThanOrEqual;
+
+            case ExcelConditionalFormattingConstants.Operators.NotBetween:
+              return eExcelConditionalFormattingRuleType.NotBetween;
+
+            case ExcelConditionalFormattingConstants.Operators.NotContains:
+              return eExcelConditionalFormattingRuleType.NotContains;
+
+            case ExcelConditionalFormattingConstants.Operators.NotEqual:
+              return eExcelConditionalFormattingRuleType.NotEqual;
+            default:
+              throw new Exception(
+                ExcelConditionalFormattingConstants.Errors.UnexistentOperatorTypeAttribute);
+        }
+    }
+    private static eExcelConditionalFormattingRuleType GetIconSetType(XmlNode topNode, XmlNamespaceManager nameSpaceManager)
+    {
+        var node = topNode.SelectSingleNode("d:iconSet/@iconSet", nameSpaceManager);
+        if (node == null)
+        {
+            return eExcelConditionalFormattingRuleType.ThreeIconSet;
+        }
+        else
+        {
+            var v = node.Value;
+
+            if (v[0] == '3')
+            {
+                return eExcelConditionalFormattingRuleType.ThreeIconSet;
+            }
+            else if (v[0] == '4')
+            {
+                return eExcelConditionalFormattingRuleType.FourIconSet;
+            }
+            else
+            {
+                return eExcelConditionalFormattingRuleType.FiveIconSet;
+            }
+        }
+    }
+
+    /// <summary>
+    /// Get the "colorScale" rule type according to the number of "cfvo" and "color" nodes.
+    /// If we have excatly 2 "cfvo" and "color" childs, then we return "twoColorScale"
+    /// </summary>
+    /// <returns>TwoColorScale or ThreeColorScale</returns>
+    internal static eExcelConditionalFormattingRuleType GetColorScaleType(
+      XmlNode topNode,
+      XmlNamespaceManager nameSpaceManager)
+    {
+      // Get the <cfvo> nodes
+      var cfvoNodes = topNode.SelectNodes(
+        string.Format(
+          "{0}/{1}",
+          ExcelConditionalFormattingConstants.Paths.ColorScale,
+          ExcelConditionalFormattingConstants.Paths.Cfvo),
+        nameSpaceManager);
+
+      // Get the <color> nodes
+      var colorNodes = topNode.SelectNodes(
+        string.Format(
+          "{0}/{1}",
+          ExcelConditionalFormattingConstants.Paths.ColorScale,
+          ExcelConditionalFormattingConstants.Paths.Color),
+        nameSpaceManager);
+
+      // We determine if it is "TwoColorScale" or "ThreeColorScale" by the
+      // number of <cfvo> and <color> inside the <colorScale> node
+      if ((cfvoNodes == null) || (cfvoNodes.Count < 2) || (cfvoNodes.Count > 3)
+        || (colorNodes == null) || (colorNodes.Count < 2) || (colorNodes.Count > 3)
+        || (cfvoNodes.Count != colorNodes.Count))
+      {
+        throw new Exception(
+          ExcelConditionalFormattingConstants.Errors.WrongNumberCfvoColorNodes);
+      }
+
+      // Return the corresponding rule type (TwoColorScale or ThreeColorScale)
+      return (cfvoNodes.Count == 2)
+        ? eExcelConditionalFormattingRuleType.TwoColorScale
+        : eExcelConditionalFormattingRuleType.ThreeColorScale;
+    }
+
+    /// <summary>
+    /// Get the "aboveAverage" rule type according to the follwoing attributes:
+    /// "AboveAverage", "EqualAverage" and "StdDev".
+    /// 
+    /// @StdDev greater than "0"                              == AboveStdDev
+    /// @StdDev less than "0"                                 == BelowStdDev
+    /// @AboveAverage = "1"/null and @EqualAverage = "0"/null == AboveAverage
+    /// @AboveAverage = "1"/null and @EqualAverage = "1"      == AboveOrEqualAverage
+    /// @AboveAverage = "0" and @EqualAverage = "0"/null      == BelowAverage
+    /// @AboveAverage = "0" and @EqualAverage = "1"           == BelowOrEqualAverage
+    /// /// </summary>
+    /// <returns>AboveAverage, AboveOrEqualAverage, BelowAverage or BelowOrEqualAverage</returns>
+    internal static eExcelConditionalFormattingRuleType GetAboveAverageType(
+      XmlNode topNode,
+      XmlNamespaceManager nameSpaceManager)
+    {
+      // Get @StdDev attribute
+      int? stdDev = ExcelConditionalFormattingHelper.GetAttributeIntNullable(
+        topNode,
+        ExcelConditionalFormattingConstants.Attributes.StdDev);
+
+      if (stdDev > 0)
+      {
+        // @StdDev > "0" --> AboveStdDev
+        return eExcelConditionalFormattingRuleType.AboveStdDev;
+      }
+
+      if (stdDev < 0)
+      {
+        // @StdDev < "0" --> BelowStdDev
+        return eExcelConditionalFormattingRuleType.BelowStdDev;
+      }
+
+      // Get @AboveAverage attribute
+      bool? isAboveAverage = ExcelConditionalFormattingHelper.GetAttributeBoolNullable(
+        topNode,
+        ExcelConditionalFormattingConstants.Attributes.AboveAverage);
+
+      // Get @EqualAverage attribute
+      bool? isEqualAverage = ExcelConditionalFormattingHelper.GetAttributeBoolNullable(
+        topNode,
+        ExcelConditionalFormattingConstants.Attributes.EqualAverage);
+
+      if ((isAboveAverage == null) || (isAboveAverage == true))
+      {
+        if (isEqualAverage == true)
+        {
+          // @AboveAverage = "1"/null and @EqualAverage = "1" == AboveOrEqualAverage
+          return eExcelConditionalFormattingRuleType.AboveOrEqualAverage;
+        }
+
+        // @AboveAverage = "1"/null and @EqualAverage = "0"/null == AboveAverage
+        return eExcelConditionalFormattingRuleType.AboveAverage;
+      }
+
+      if (isEqualAverage == true)
+      {
+        // @AboveAverage = "0" and @EqualAverage = "1" == BelowOrEqualAverage
+        return eExcelConditionalFormattingRuleType.BelowOrEqualAverage;
+      }
+
+      // @AboveAverage = "0" and @EqualAverage = "0"/null == BelowAverage
+      return eExcelConditionalFormattingRuleType.BelowAverage;
+    }
+
+    /// <summary>
+    /// Get the "top10" rule type according to the follwoing attributes:
+    /// "Bottom" and "Percent"
+    /// 
+    /// @Bottom = "1" and @Percent = "0"/null       == Bottom
+    /// @Bottom = "1" and @Percent = "1"            == BottomPercent
+    /// @Bottom = "0"/null and @Percent = "0"/null  == Top
+    /// @Bottom = "0"/null and @Percent = "1"       == TopPercent
+    /// /// </summary>
+    /// <returns>Top, TopPercent, Bottom or BottomPercent</returns>
+    public static eExcelConditionalFormattingRuleType GetTop10Type(
+      XmlNode topNode,
+      XmlNamespaceManager nameSpaceManager)
+    {
+      // Get @Bottom attribute
+      bool? isBottom = ExcelConditionalFormattingHelper.GetAttributeBoolNullable(
+        topNode,
+        ExcelConditionalFormattingConstants.Attributes.Bottom);
+
+      // Get @Percent attribute
+      bool? isPercent = ExcelConditionalFormattingHelper.GetAttributeBoolNullable(
+        topNode,
+        ExcelConditionalFormattingConstants.Attributes.Percent);
+
+      if (isBottom == true)
+      {
+        if (isPercent == true)
+        {
+          // @Bottom = "1" and @Percent = "1" == BottomPercent
+          return eExcelConditionalFormattingRuleType.BottomPercent;
+        }
+
+        // @Bottom = "1" and @Percent = "0"/null == Bottom
+        return eExcelConditionalFormattingRuleType.Bottom;
+      }
+
+      if (isPercent == true)
+      {
+        // @Bottom = "0"/null and @Percent = "1" == TopPercent
+        return eExcelConditionalFormattingRuleType.TopPercent;
+      }
+
+      // @Bottom = "0"/null and @Percent = "0"/null == Top
+      return eExcelConditionalFormattingRuleType.Top;
+    }
+
+    /// <summary>
+    /// Get the "timePeriod" rule type according to "TimePeriod" attribute.
+    /// /// </summary>
+    /// <returns>Last7Days, LastMonth etc.</returns>
+    public static eExcelConditionalFormattingRuleType GetTimePeriodType(
+      XmlNode topNode,
+      XmlNamespaceManager nameSpaceManager)
+    {
+      eExcelConditionalFormattingTimePeriodType timePeriod = ExcelConditionalFormattingTimePeriodType.GetTypeByAttribute(
+        ExcelConditionalFormattingHelper.GetAttributeString(
+          topNode,
+          ExcelConditionalFormattingConstants.Attributes.TimePeriod));
+
+      switch (timePeriod)
+      {
+        case eExcelConditionalFormattingTimePeriodType.Last7Days:
+          return eExcelConditionalFormattingRuleType.Last7Days;
+
+        case eExcelConditionalFormattingTimePeriodType.LastMonth:
+          return eExcelConditionalFormattingRuleType.LastMonth;
+
+        case eExcelConditionalFormattingTimePeriodType.LastWeek:
+          return eExcelConditionalFormattingRuleType.LastWeek;
+
+        case eExcelConditionalFormattingTimePeriodType.NextMonth:
+          return eExcelConditionalFormattingRuleType.NextMonth;
+
+        case eExcelConditionalFormattingTimePeriodType.NextWeek:
+          return eExcelConditionalFormattingRuleType.NextWeek;
+
+        case eExcelConditionalFormattingTimePeriodType.ThisMonth:
+          return eExcelConditionalFormattingRuleType.ThisMonth;
+
+        case eExcelConditionalFormattingTimePeriodType.ThisWeek:
+          return eExcelConditionalFormattingRuleType.ThisWeek;
+
+        case eExcelConditionalFormattingTimePeriodType.Today:
+          return eExcelConditionalFormattingRuleType.Today;
+
+        case eExcelConditionalFormattingTimePeriodType.Tomorrow:
+          return eExcelConditionalFormattingRuleType.Tomorrow;
+
+        case eExcelConditionalFormattingTimePeriodType.Yesterday:
+          return eExcelConditionalFormattingRuleType.Yesterday;
+      }
+
+      throw new Exception(
+        ExcelConditionalFormattingConstants.Errors.UnexistentTimePeriodTypeAttribute);
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="type"></param>
+    /// <returns></returns>
+    public static string GetAttributeByType(
+      eExcelConditionalFormattingRuleType type)
+    {
+      switch (type)
+      {
+        case eExcelConditionalFormattingRuleType.AboveAverage:
+        case eExcelConditionalFormattingRuleType.AboveOrEqualAverage:
+        case eExcelConditionalFormattingRuleType.BelowAverage:
+        case eExcelConditionalFormattingRuleType.BelowOrEqualAverage:
+        case eExcelConditionalFormattingRuleType.AboveStdDev:
+        case eExcelConditionalFormattingRuleType.BelowStdDev:
+          return ExcelConditionalFormattingConstants.RuleType.AboveAverage;
+
+        case eExcelConditionalFormattingRuleType.Bottom:
+        case eExcelConditionalFormattingRuleType.BottomPercent:
+        case eExcelConditionalFormattingRuleType.Top:
+        case eExcelConditionalFormattingRuleType.TopPercent:
+          return ExcelConditionalFormattingConstants.RuleType.Top10;
+
+        case eExcelConditionalFormattingRuleType.Last7Days:
+        case eExcelConditionalFormattingRuleType.LastMonth:
+        case eExcelConditionalFormattingRuleType.LastWeek:
+        case eExcelConditionalFormattingRuleType.NextMonth:
+        case eExcelConditionalFormattingRuleType.NextWeek:
+        case eExcelConditionalFormattingRuleType.ThisMonth:
+        case eExcelConditionalFormattingRuleType.ThisWeek:
+        case eExcelConditionalFormattingRuleType.Today:
+        case eExcelConditionalFormattingRuleType.Tomorrow:
+        case eExcelConditionalFormattingRuleType.Yesterday:
+          return ExcelConditionalFormattingConstants.RuleType.TimePeriod;
+
+        case eExcelConditionalFormattingRuleType.Between:
+        case eExcelConditionalFormattingRuleType.Equal:
+        case eExcelConditionalFormattingRuleType.GreaterThan:
+        case eExcelConditionalFormattingRuleType.GreaterThanOrEqual:
+        case eExcelConditionalFormattingRuleType.LessThan:
+        case eExcelConditionalFormattingRuleType.LessThanOrEqual:
+        case eExcelConditionalFormattingRuleType.NotBetween:
+        case eExcelConditionalFormattingRuleType.NotEqual:
+          return ExcelConditionalFormattingConstants.RuleType.CellIs;
+
+        case eExcelConditionalFormattingRuleType.ThreeIconSet:
+        case eExcelConditionalFormattingRuleType.FourIconSet:
+        case eExcelConditionalFormattingRuleType.FiveIconSet:
+          return ExcelConditionalFormattingConstants.RuleType.IconSet;
+
+        case eExcelConditionalFormattingRuleType.ThreeColorScale:
+        case eExcelConditionalFormattingRuleType.TwoColorScale:
+          return ExcelConditionalFormattingConstants.RuleType.ColorScale;
+
+        case eExcelConditionalFormattingRuleType.BeginsWith:
+          return ExcelConditionalFormattingConstants.RuleType.BeginsWith;
+
+        case eExcelConditionalFormattingRuleType.ContainsBlanks:
+          return ExcelConditionalFormattingConstants.RuleType.ContainsBlanks;
+
+        case eExcelConditionalFormattingRuleType.ContainsErrors:
+          return ExcelConditionalFormattingConstants.RuleType.ContainsErrors;
+
+        case eExcelConditionalFormattingRuleType.ContainsText:
+          return ExcelConditionalFormattingConstants.RuleType.ContainsText;
+
+        case eExcelConditionalFormattingRuleType.DuplicateValues:
+          return ExcelConditionalFormattingConstants.RuleType.DuplicateValues;
+
+        case eExcelConditionalFormattingRuleType.EndsWith:
+          return ExcelConditionalFormattingConstants.RuleType.EndsWith;
+
+        case eExcelConditionalFormattingRuleType.Expression:
+          return ExcelConditionalFormattingConstants.RuleType.Expression;
+
+        case eExcelConditionalFormattingRuleType.NotContainsBlanks:
+          return ExcelConditionalFormattingConstants.RuleType.NotContainsBlanks;
+
+        case eExcelConditionalFormattingRuleType.NotContainsErrors:
+          return ExcelConditionalFormattingConstants.RuleType.NotContainsErrors;
+
+        case eExcelConditionalFormattingRuleType.NotContainsText:
+          return ExcelConditionalFormattingConstants.RuleType.NotContainsText;
+
+        case eExcelConditionalFormattingRuleType.UniqueValues:
+          return ExcelConditionalFormattingConstants.RuleType.UniqueValues;
+
+        case eExcelConditionalFormattingRuleType.DataBar:
+          return ExcelConditionalFormattingConstants.RuleType.DataBar;
+      }
+
+      throw new Exception(
+        ExcelConditionalFormattingConstants.Errors.MissingRuleType);
+    }
+
+    /// <summary>
+    /// Return cfvo §18.3.1.11 parent according to the rule type
+    /// </summary>
+    /// <param name="type"></param>
+    /// <returns></returns>
+    public static string GetCfvoParentPathByType(
+      eExcelConditionalFormattingRuleType type)
+    {
+      switch (type)
+      {
+        case eExcelConditionalFormattingRuleType.TwoColorScale:
+        case eExcelConditionalFormattingRuleType.ThreeColorScale:
+          return ExcelConditionalFormattingConstants.Paths.ColorScale;
+
+        case eExcelConditionalFormattingRuleType.ThreeIconSet:
+        case eExcelConditionalFormattingRuleType.FourIconSet:
+        case eExcelConditionalFormattingRuleType.FiveIconSet:
+          return ExcelConditionalFormattingConstants.RuleType.IconSet;
+
+        case eExcelConditionalFormattingRuleType.DataBar:
+          return ExcelConditionalFormattingConstants.RuleType.DataBar;
+      }
+
+      throw new Exception(
+        ExcelConditionalFormattingConstants.Errors.MissingRuleType);
+    }
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/ExcelConditionalFormattingTimePeriodType.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/ExcelConditionalFormattingTimePeriodType.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/ExcelConditionalFormattingTimePeriodType.cs	(revision 12707)
@@ -0,0 +1,133 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author          Change						                  Date
+ * ******************************************************************************
+ * Eyal Seagull    Conditional Formatting Adaption    2012-04-17
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Xml;
+
+namespace OfficeOpenXml.ConditionalFormatting
+{
+	/// <summary>
+  /// Functions related to the <see cref="ExcelConditionalFormattingTimePeriodType"/>
+	/// </summary>
+  internal static class ExcelConditionalFormattingTimePeriodType
+	{
+		/// <summary>
+		/// 
+		/// </summary>
+		/// <param name="type"></param>
+		/// <returns></returns>
+		public static string GetAttributeByType(
+			eExcelConditionalFormattingTimePeriodType type)
+		{
+			switch (type)
+			{
+        case eExcelConditionalFormattingTimePeriodType.Last7Days:
+          return ExcelConditionalFormattingConstants.TimePeriods.Last7Days;
+
+        case eExcelConditionalFormattingTimePeriodType.LastMonth:
+          return ExcelConditionalFormattingConstants.TimePeriods.LastMonth;
+
+        case eExcelConditionalFormattingTimePeriodType.LastWeek:
+          return ExcelConditionalFormattingConstants.TimePeriods.LastWeek;
+
+        case eExcelConditionalFormattingTimePeriodType.NextMonth:
+          return ExcelConditionalFormattingConstants.TimePeriods.NextMonth;
+
+        case eExcelConditionalFormattingTimePeriodType.NextWeek:
+          return ExcelConditionalFormattingConstants.TimePeriods.NextWeek;
+
+        case eExcelConditionalFormattingTimePeriodType.ThisMonth:
+          return ExcelConditionalFormattingConstants.TimePeriods.ThisMonth;
+
+        case eExcelConditionalFormattingTimePeriodType.ThisWeek:
+          return ExcelConditionalFormattingConstants.TimePeriods.ThisWeek;
+
+        case eExcelConditionalFormattingTimePeriodType.Today:
+          return ExcelConditionalFormattingConstants.TimePeriods.Today;
+
+        case eExcelConditionalFormattingTimePeriodType.Tomorrow:
+          return ExcelConditionalFormattingConstants.TimePeriods.Tomorrow;
+
+        case eExcelConditionalFormattingTimePeriodType.Yesterday:
+          return ExcelConditionalFormattingConstants.TimePeriods.Yesterday;
+			}
+
+			return string.Empty;
+		}
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="attribute"></param>
+    /// <returns></returns>
+    public static eExcelConditionalFormattingTimePeriodType GetTypeByAttribute(
+      string attribute)
+    {
+      switch (attribute)
+      {
+        case ExcelConditionalFormattingConstants.TimePeriods.Last7Days:
+          return eExcelConditionalFormattingTimePeriodType.Last7Days;
+
+        case ExcelConditionalFormattingConstants.TimePeriods.LastMonth:
+          return eExcelConditionalFormattingTimePeriodType.LastMonth;
+
+        case ExcelConditionalFormattingConstants.TimePeriods.LastWeek:
+          return eExcelConditionalFormattingTimePeriodType.LastWeek;
+
+        case ExcelConditionalFormattingConstants.TimePeriods.NextMonth:
+          return eExcelConditionalFormattingTimePeriodType.NextMonth;
+
+        case ExcelConditionalFormattingConstants.TimePeriods.NextWeek:
+          return eExcelConditionalFormattingTimePeriodType.NextWeek;
+
+        case ExcelConditionalFormattingConstants.TimePeriods.ThisMonth:
+          return eExcelConditionalFormattingTimePeriodType.ThisMonth;
+
+        case ExcelConditionalFormattingConstants.TimePeriods.ThisWeek:
+          return eExcelConditionalFormattingTimePeriodType.ThisWeek;
+
+        case ExcelConditionalFormattingConstants.TimePeriods.Today:
+          return eExcelConditionalFormattingTimePeriodType.Today;
+
+        case ExcelConditionalFormattingConstants.TimePeriods.Tomorrow:
+          return eExcelConditionalFormattingTimePeriodType.Tomorrow;
+
+        case ExcelConditionalFormattingConstants.TimePeriods.Yesterday:
+          return eExcelConditionalFormattingTimePeriodType.Yesterday;
+      }
+
+      throw new Exception(
+        ExcelConditionalFormattingConstants.Errors.UnexistentTimePeriodTypeAttribute);
+    }
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/ExcelConditionalFormattingValueObjectType.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/ExcelConditionalFormattingValueObjectType.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/ExcelConditionalFormattingValueObjectType.cs	(revision 12707)
@@ -0,0 +1,222 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author          Change						                  Date
+ * ******************************************************************************
+ * Eyal Seagull    Conditional Formatting Adaption    2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Xml;
+
+namespace OfficeOpenXml.ConditionalFormatting
+{
+	/// <summary>
+	/// Functions related to the <see cref="ExcelConditionalFormattingColorScaleValue"/>
+	/// </summary>
+	internal static class ExcelConditionalFormattingValueObjectType
+	{
+		/// <summary>
+		/// Get the sequencial order of a cfvo/color by its position.
+		/// </summary>
+		/// <param name="position"></param>
+        /// <param name="ruleType"></param>
+		/// <returns>1, 2 or 3</returns>
+		internal static int GetOrderByPosition(
+			eExcelConditionalFormattingValueObjectPosition position,
+			eExcelConditionalFormattingRuleType ruleType)
+		{
+			switch (position)
+			{
+				case eExcelConditionalFormattingValueObjectPosition.Low:
+					return 1;
+
+				case eExcelConditionalFormattingValueObjectPosition.Middle:
+					return 2;
+
+				case eExcelConditionalFormattingValueObjectPosition.High:
+					// Check if the rule type is TwoColorScale.
+					if (ruleType == eExcelConditionalFormattingRuleType.TwoColorScale)
+					{
+						// There are only "Low" and "High". So "High" is the second
+						return 2;
+					}
+
+					// There are "Low", "Middle" and "High". So "High" is the third
+					return 3;
+			}
+
+			return 0;
+		}
+
+		/// <summary>
+		/// Get the CFVO type by its @type attribute
+		/// </summary>
+		/// <param name="attribute"></param>
+		/// <returns></returns>
+		public static eExcelConditionalFormattingValueObjectType GetTypeByAttrbiute(
+			string attribute)
+		{
+			switch (attribute)
+			{
+				case ExcelConditionalFormattingConstants.CfvoType.Min:
+					return eExcelConditionalFormattingValueObjectType.Min;
+
+        case ExcelConditionalFormattingConstants.CfvoType.Max:
+					return eExcelConditionalFormattingValueObjectType.Max;
+
+        case ExcelConditionalFormattingConstants.CfvoType.Num:
+					return eExcelConditionalFormattingValueObjectType.Num;
+
+        case ExcelConditionalFormattingConstants.CfvoType.Formula:
+					return eExcelConditionalFormattingValueObjectType.Formula;
+
+        case ExcelConditionalFormattingConstants.CfvoType.Percent:
+					return eExcelConditionalFormattingValueObjectType.Percent;
+
+        case ExcelConditionalFormattingConstants.CfvoType.Percentile:
+					return eExcelConditionalFormattingValueObjectType.Percentile;
+			}
+
+			throw new Exception(
+        ExcelConditionalFormattingConstants.Errors.UnexistentCfvoTypeAttribute);
+		}
+
+		/// <summary>
+		/// 
+		/// </summary>
+		/// <param name="position"></param>
+		///<param name="ruleType"></param>
+        /// <param name="topNode"></param>
+		/// <param name="nameSpaceManager"></param>
+		/// <returns></returns>
+		public static XmlNode GetCfvoNodeByPosition(
+			eExcelConditionalFormattingValueObjectPosition position,
+			eExcelConditionalFormattingRuleType ruleType,
+			XmlNode topNode,
+			XmlNamespaceManager nameSpaceManager)
+		{
+			// Get the corresponding <cfvo> node (by the position)
+			var node = topNode.SelectSingleNode(
+				string.Format(
+					"{0}[position()={1}]",
+				// {0}
+					ExcelConditionalFormattingConstants.Paths.Cfvo,
+				// {1}
+					ExcelConditionalFormattingValueObjectType.GetOrderByPosition(position, ruleType)),
+				nameSpaceManager);
+
+			if (node == null)
+			{
+				throw new Exception(
+          ExcelConditionalFormattingConstants.Errors.MissingCfvoNode);
+			}
+
+			return node;
+		}
+
+		/// <summary>
+		/// 
+		/// </summary>
+		/// <param name="type"></param>
+		/// <returns></returns>
+		public static string GetAttributeByType(
+			eExcelConditionalFormattingValueObjectType type)
+		{
+			switch (type)
+			{
+				case eExcelConditionalFormattingValueObjectType.Min:
+					return ExcelConditionalFormattingConstants.CfvoType.Min;
+
+				case eExcelConditionalFormattingValueObjectType.Max:
+          return ExcelConditionalFormattingConstants.CfvoType.Max;
+
+				case eExcelConditionalFormattingValueObjectType.Num:
+          return ExcelConditionalFormattingConstants.CfvoType.Num;
+
+				case eExcelConditionalFormattingValueObjectType.Formula:
+          return ExcelConditionalFormattingConstants.CfvoType.Formula;
+
+				case eExcelConditionalFormattingValueObjectType.Percent:
+          return ExcelConditionalFormattingConstants.CfvoType.Percent;
+
+				case eExcelConditionalFormattingValueObjectType.Percentile:
+          return ExcelConditionalFormattingConstants.CfvoType.Percentile;
+			}
+
+			return string.Empty;
+		}
+
+		/// <summary>
+		/// Get the cfvo (§18.3.1.11) node parent by the rule type. Can be any of the following:
+		/// "colorScale" (§18.3.1.16); "dataBar" (§18.3.1.28); "iconSet" (§18.3.1.49)
+		/// </summary>
+		/// <param name="ruleType"></param>
+		/// <returns></returns>
+		public static string GetParentPathByRuleType(
+			eExcelConditionalFormattingRuleType ruleType)
+		{
+			switch (ruleType)
+			{
+				case eExcelConditionalFormattingRuleType.TwoColorScale:
+				case eExcelConditionalFormattingRuleType.ThreeColorScale:
+					return ExcelConditionalFormattingConstants.Paths.ColorScale;
+
+				case eExcelConditionalFormattingRuleType.ThreeIconSet:
+                case eExcelConditionalFormattingRuleType.FourIconSet:
+                case eExcelConditionalFormattingRuleType.FiveIconSet:
+					        return ExcelConditionalFormattingConstants.Paths.IconSet;
+
+                case eExcelConditionalFormattingRuleType.DataBar:
+                  return ExcelConditionalFormattingConstants.Paths.DataBar;
+              }
+
+			return string.Empty;
+		}
+
+		/// <summary>
+		/// 
+		/// </summary>
+		/// <param name="nodeType"></param>
+		/// <returns></returns>
+		public static string GetNodePathByNodeType(
+			eExcelConditionalFormattingValueObjectNodeType nodeType)
+		{
+			switch(nodeType)
+			{
+				case eExcelConditionalFormattingValueObjectNodeType.Cfvo:
+					return ExcelConditionalFormattingConstants.Paths.Cfvo;
+
+				case eExcelConditionalFormattingValueObjectNodeType.Color:
+					return ExcelConditionalFormattingConstants.Paths.Color;
+			}
+
+			return string.Empty;
+		}
+	}
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/RangeConditionalFormatting.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/RangeConditionalFormatting.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/RangeConditionalFormatting.cs	(revision 12707)
@@ -0,0 +1,531 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author             Change                    Date
+ * ******************************************************************************
+ * Eyal Seagull       Conditional Formatting    2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.Utils;
+using OfficeOpenXml.ConditionalFormatting.Contracts;
+
+namespace OfficeOpenXml.ConditionalFormatting
+{
+  internal class RangeConditionalFormatting
+    : IRangeConditionalFormatting
+  {
+    #region Public Properties
+    public ExcelWorksheet _worksheet;
+    public ExcelAddress _address;
+    #endregion Public Properties
+
+    #region Constructors
+    public RangeConditionalFormatting(
+      ExcelWorksheet worksheet,
+      ExcelAddress address)
+    {
+      Require.Argument(worksheet).IsNotNull("worksheet");
+      Require.Argument(address).IsNotNull("address");
+
+      _worksheet = worksheet;
+      _address = address;
+    }
+    #endregion Constructors
+
+    #region Conditional Formatting Rule Types
+    /// <summary>
+    /// Add AboveOrEqualAverage Conditional Formatting
+    /// </summary>
+    ///  <returns></returns>
+    public IExcelConditionalFormattingAverageGroup AddAboveAverage()
+    {
+      return _worksheet.ConditionalFormatting.AddAboveAverage(
+        _address);
+    }
+
+    /// <summary>
+    /// Add AboveOrEqualAverage Conditional Formatting
+    /// </summary>
+    ///  <returns></returns>
+    public IExcelConditionalFormattingAverageGroup AddAboveOrEqualAverage()
+    {
+      return _worksheet.ConditionalFormatting.AddAboveOrEqualAverage(
+        _address);
+    }
+
+    /// <summary>
+    /// Add BelowOrEqualAverage Conditional Formatting
+    /// </summary>
+    ///  <returns></returns>
+    public IExcelConditionalFormattingAverageGroup AddBelowAverage()
+    {
+      return _worksheet.ConditionalFormatting.AddBelowAverage(
+        _address);
+    }
+
+    /// <summary>
+    /// Add BelowOrEqualAverage Conditional Formatting
+    /// </summary>
+    ///  <returns></returns>
+    public IExcelConditionalFormattingAverageGroup AddBelowOrEqualAverage()
+    {
+      return _worksheet.ConditionalFormatting.AddBelowOrEqualAverage(
+        _address);
+    }
+
+    /// <summary>
+    /// Add AboveStdDev Conditional Formatting
+    /// </summary>
+    ///  <returns></returns>
+    public IExcelConditionalFormattingStdDevGroup AddAboveStdDev()
+    {
+      return _worksheet.ConditionalFormatting.AddAboveStdDev(
+        _address);
+    }
+
+    /// <summary>
+    /// Add BelowStdDev Conditional Formatting
+    /// </summary>
+    ///  <returns></returns>
+    public IExcelConditionalFormattingStdDevGroup AddBelowStdDev()
+    {
+      return _worksheet.ConditionalFormatting.AddBelowStdDev(
+        _address);
+    }
+
+    /// <summary>
+    /// Add Bottom Conditional Formatting
+    /// </summary>
+    ///  <returns></returns>
+    public IExcelConditionalFormattingTopBottomGroup AddBottom()
+    {
+      return _worksheet.ConditionalFormatting.AddBottom(
+        _address);
+    }
+
+    /// <summary>
+    /// Add BottomPercent Conditional Formatting
+    /// </summary>
+    ///  <returns></returns>
+    public IExcelConditionalFormattingTopBottomGroup AddBottomPercent()
+    {
+      return _worksheet.ConditionalFormatting.AddBottomPercent(
+        _address);
+    }
+
+    /// <summary>
+    /// Add Top Conditional Formatting
+    /// </summary>
+    ///  <returns></returns>
+    public IExcelConditionalFormattingTopBottomGroup AddTop()
+    {
+      return _worksheet.ConditionalFormatting.AddTop(
+        _address);
+    }
+
+    /// <summary>
+    /// Add TopPercent Conditional Formatting
+    /// </summary>
+    ///  <returns></returns>
+    public IExcelConditionalFormattingTopBottomGroup AddTopPercent()
+    {
+      return _worksheet.ConditionalFormatting.AddTopPercent(
+        _address);
+    }
+
+    /// <summary>
+    /// Add Last7Days Conditional Formatting
+    /// </summary>
+    ///  <returns></returns>
+    public IExcelConditionalFormattingTimePeriodGroup AddLast7Days()
+    {
+      return _worksheet.ConditionalFormatting.AddLast7Days(
+        _address);
+    }
+
+    /// <summary>
+    /// Add LastMonth Conditional Formatting
+    /// </summary>
+    ///  <returns></returns>
+    public IExcelConditionalFormattingTimePeriodGroup AddLastMonth()
+    {
+      return _worksheet.ConditionalFormatting.AddLastMonth(
+        _address);
+    }
+
+    /// <summary>
+    /// Add LastWeek Conditional Formatting
+    /// </summary>
+    ///  <returns></returns>
+    public IExcelConditionalFormattingTimePeriodGroup AddLastWeek()
+    {
+      return _worksheet.ConditionalFormatting.AddLastWeek(
+        _address);
+    }
+
+    /// <summary>
+    /// Add NextMonth Conditional Formatting
+    /// </summary>
+    ///  <returns></returns>
+    public IExcelConditionalFormattingTimePeriodGroup AddNextMonth()
+    {
+      return _worksheet.ConditionalFormatting.AddNextMonth(
+        _address);
+    }
+
+    /// <summary>
+    /// Add NextWeek Conditional Formatting
+    /// </summary>
+    ///  <returns></returns>
+    public IExcelConditionalFormattingTimePeriodGroup AddNextWeek()
+    {
+      return _worksheet.ConditionalFormatting.AddNextWeek(
+        _address);
+    }
+
+    /// <summary>
+    /// Add ThisMonth Conditional Formatting
+    /// </summary>
+    ///  <returns></returns>
+    public IExcelConditionalFormattingTimePeriodGroup AddThisMonth()
+    {
+      return _worksheet.ConditionalFormatting.AddThisMonth(
+        _address);
+    }
+
+    /// <summary>
+    /// Add ThisWeek Conditional Formatting
+    /// </summary>
+    ///  <returns></returns>
+    public IExcelConditionalFormattingTimePeriodGroup AddThisWeek()
+    {
+      return _worksheet.ConditionalFormatting.AddThisWeek(
+        _address);
+    }
+
+    /// <summary>
+    /// Add Today Conditional Formatting
+    /// </summary>
+    ///  <returns></returns>
+    public IExcelConditionalFormattingTimePeriodGroup AddToday()
+    {
+      return _worksheet.ConditionalFormatting.AddToday(
+        _address);
+    }
+
+    /// <summary>
+    /// Add Tomorrow Conditional Formatting
+    /// </summary>
+    ///  <returns></returns>
+    public IExcelConditionalFormattingTimePeriodGroup AddTomorrow()
+    {
+      return _worksheet.ConditionalFormatting.AddTomorrow(
+        _address);
+    }
+
+    /// <summary>
+    /// Add Yesterday Conditional Formatting
+    /// </summary>
+    ///  <returns></returns>
+    public IExcelConditionalFormattingTimePeriodGroup AddYesterday()
+    {
+      return _worksheet.ConditionalFormatting.AddYesterday(
+        _address);
+    }
+
+    /// <summary>
+    /// Add BeginsWith Conditional Formatting
+    /// </summary>
+    ///  <returns></returns>
+    public IExcelConditionalFormattingBeginsWith AddBeginsWith()
+    {
+      return _worksheet.ConditionalFormatting.AddBeginsWith(
+        _address);
+    }
+
+    /// <summary>
+    /// Add Between Conditional Formatting
+    /// </summary>
+    ///  <returns></returns>
+    public IExcelConditionalFormattingBetween AddBetween()
+    {
+      return _worksheet.ConditionalFormatting.AddBetween(
+        _address);
+    }
+
+    /// <summary>
+    /// Add ContainsBlanks Conditional Formatting
+    /// </summary>
+    ///  <returns></returns>
+    public IExcelConditionalFormattingContainsBlanks AddContainsBlanks()
+    {
+      return _worksheet.ConditionalFormatting.AddContainsBlanks(
+        _address);
+    }
+
+    /// <summary>
+    /// Add ContainsErrors Conditional Formatting
+    /// </summary>
+    ///  <returns></returns>
+    public IExcelConditionalFormattingContainsErrors AddContainsErrors()
+    {
+      return _worksheet.ConditionalFormatting.AddContainsErrors(
+        _address);
+    }
+
+    /// <summary>
+    /// Add ContainsText Conditional Formatting
+    /// </summary>
+    ///  <returns></returns>
+    public IExcelConditionalFormattingContainsText AddContainsText()
+    {
+      return _worksheet.ConditionalFormatting.AddContainsText(
+        _address);
+    }
+
+    /// <summary>
+    /// Add DuplicateValues Conditional Formatting
+    /// </summary>
+    ///  <returns></returns>
+    public IExcelConditionalFormattingDuplicateValues AddDuplicateValues()
+    {
+      return _worksheet.ConditionalFormatting.AddDuplicateValues(
+        _address);
+    }
+
+    /// <summary>
+    /// Add EndsWith Conditional Formatting
+    /// </summary>
+    ///  <returns></returns>
+    public IExcelConditionalFormattingEndsWith AddEndsWith()
+    {
+      return _worksheet.ConditionalFormatting.AddEndsWith(
+        _address);
+    }
+
+    /// <summary>
+    /// Add Equal Conditional Formatting
+    /// </summary>
+    ///  <returns></returns>
+    public IExcelConditionalFormattingEqual AddEqual()
+    {
+      return _worksheet.ConditionalFormatting.AddEqual(
+        _address);
+    }
+
+    /// <summary>
+    /// Add Expression Conditional Formatting
+    /// </summary>
+    ///  <returns></returns>
+    public IExcelConditionalFormattingExpression AddExpression()
+    {
+      return _worksheet.ConditionalFormatting.AddExpression(
+        _address);
+    }
+
+    /// <summary>
+    /// Add GreaterThan Conditional Formatting
+    /// </summary>
+    ///  <returns></returns>
+    public IExcelConditionalFormattingGreaterThan AddGreaterThan()
+    {
+      return _worksheet.ConditionalFormatting.AddGreaterThan(
+        _address);
+    }
+
+    /// <summary>
+    /// Add GreaterThanOrEqual Conditional Formatting
+    /// </summary>
+    ///  <returns></returns>
+    public IExcelConditionalFormattingGreaterThanOrEqual AddGreaterThanOrEqual()
+    {
+      return _worksheet.ConditionalFormatting.AddGreaterThanOrEqual(
+        _address);
+    }
+
+    /// <summary>
+    /// Add LessThan Conditional Formatting
+    /// </summary>
+    ///  <returns></returns>
+    public IExcelConditionalFormattingLessThan AddLessThan()
+    {
+      return _worksheet.ConditionalFormatting.AddLessThan(
+        _address);
+    }
+
+    /// <summary>
+    /// Add LessThanOrEqual Conditional Formatting
+    /// </summary>
+    ///  <returns></returns>
+    public IExcelConditionalFormattingLessThanOrEqual AddLessThanOrEqual()
+    {
+      return _worksheet.ConditionalFormatting.AddLessThanOrEqual(
+        _address);
+    }
+
+    /// <summary>
+    /// Add NotBetween Conditional Formatting
+    /// </summary>
+    ///  <returns></returns>
+    public IExcelConditionalFormattingNotBetween AddNotBetween()
+    {
+      return _worksheet.ConditionalFormatting.AddNotBetween(
+        _address);
+    }
+
+    /// <summary>
+    /// Add NotContainsBlanks Conditional Formatting
+    /// </summary>
+    ///  <returns></returns>
+    public IExcelConditionalFormattingNotContainsBlanks AddNotContainsBlanks()
+    {
+      return _worksheet.ConditionalFormatting.AddNotContainsBlanks(
+        _address);
+    }
+
+    /// <summary>
+    /// Add NotContainsErrors Conditional Formatting
+    /// </summary>
+    ///  <returns></returns>
+    public IExcelConditionalFormattingNotContainsErrors AddNotContainsErrors()
+    {
+      return _worksheet.ConditionalFormatting.AddNotContainsErrors(
+        _address);
+    }
+
+    /// <summary>
+    /// Add NotContainsText Conditional Formatting
+    /// </summary>
+    ///  <returns></returns>
+    public IExcelConditionalFormattingNotContainsText AddNotContainsText()
+    {
+      return _worksheet.ConditionalFormatting.AddNotContainsText(
+        _address);
+    }
+
+    /// <summary>
+    /// Add NotEqual Conditional Formatting
+    /// </summary>
+    ///  <returns></returns>
+    public IExcelConditionalFormattingNotEqual AddNotEqual()
+    {
+      return _worksheet.ConditionalFormatting.AddNotEqual(
+        _address);
+    }
+
+    /// <summary>
+    /// Add UniqueValues Conditional Formatting
+    /// </summary>
+    ///  <returns></returns>
+    public IExcelConditionalFormattingUniqueValues AddUniqueValues()
+    {
+      return _worksheet.ConditionalFormatting.AddUniqueValues(
+        _address);
+    }
+
+    /// <summary>
+    /// Add ThreeColorScale Conditional Formatting
+    /// </summary>
+    ///  <returns></returns>
+    public IExcelConditionalFormattingThreeColorScale AddThreeColorScale()
+    {
+      return (IExcelConditionalFormattingThreeColorScale)(_worksheet.ConditionalFormatting.AddRule(
+        eExcelConditionalFormattingRuleType.ThreeColorScale,
+        _address));
+    }
+
+    /// <summary>
+    /// Add TwoColorScale Conditional Formatting
+    /// </summary>
+    ///  <returns></returns>
+    public IExcelConditionalFormattingTwoColorScale AddTwoColorScale()
+    {
+      return (IExcelConditionalFormattingTwoColorScale)(_worksheet.ConditionalFormatting.AddRule(
+        eExcelConditionalFormattingRuleType.TwoColorScale,
+        _address));
+    }
+
+    /// <summary>
+    /// Adds a ThreeIconSet rule 
+    /// </summary>
+    /// <param name="IconSet"></param>
+    /// <returns></returns>
+    public IExcelConditionalFormattingThreeIconSet<eExcelconditionalFormatting3IconsSetType> AddThreeIconSet(eExcelconditionalFormatting3IconsSetType IconSet)
+    {
+        var rule = (IExcelConditionalFormattingThreeIconSet<eExcelconditionalFormatting3IconsSetType>)(_worksheet.ConditionalFormatting.AddRule(
+          eExcelConditionalFormattingRuleType.ThreeIconSet,
+          _address));
+        rule.IconSet = IconSet;
+        return rule;
+    }
+
+    /// <summary>
+    /// Adds a FourIconSet rule 
+    /// </summary>
+    /// <param name="IconSet"></param>
+    /// <returns></returns>
+    public IExcelConditionalFormattingFourIconSet<eExcelconditionalFormatting4IconsSetType> AddFourIconSet(eExcelconditionalFormatting4IconsSetType IconSet)
+    {
+        var rule = (IExcelConditionalFormattingFourIconSet<eExcelconditionalFormatting4IconsSetType>)(_worksheet.ConditionalFormatting.AddRule(
+          eExcelConditionalFormattingRuleType.FourIconSet,
+          _address));
+        rule.IconSet = IconSet;
+        return rule;
+    }
+
+    /// <summary>
+    /// Adds a FiveIconSet rule 
+    /// </summary>
+    /// <param name="IconSet"></param>
+    /// <returns></returns>
+    public IExcelConditionalFormattingFiveIconSet AddFiveIconSet(eExcelconditionalFormatting5IconsSetType IconSet)
+    {
+        var rule = (IExcelConditionalFormattingFiveIconSet)(_worksheet.ConditionalFormatting.AddRule(
+          eExcelConditionalFormattingRuleType.FiveIconSet,
+          _address));
+        rule.IconSet = IconSet;
+        return rule;
+    }
+
+    /// <summary>
+    /// Adds a Databar rule 
+    /// </summary>
+    /// <param name="Color">The color of the databar</param>
+    /// <returns></returns>
+    public IExcelConditionalFormattingDataBarGroup AddDatabar(System.Drawing.Color Color)
+    {
+        var rule = (IExcelConditionalFormattingDataBarGroup)(_worksheet.ConditionalFormatting.AddRule(
+          eExcelConditionalFormattingRuleType.DataBar,
+          _address));
+        rule.Color = Color;
+        return rule;
+    }
+    #endregion Conditional Formatting Rule Types
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingAboveAverage.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingAboveAverage.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingAboveAverage.cs	(revision 12707)
@@ -0,0 +1,122 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Eyal Seagull        Added       		  2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Drawing;
+using System.Xml;
+using OfficeOpenXml.ConditionalFormatting.Contracts;
+
+namespace OfficeOpenXml.ConditionalFormatting
+{
+  /// <summary>
+  /// ExcelConditionalFormattingAboveAverage
+  /// </summary>
+  public class ExcelConditionalFormattingAboveAverage
+    : ExcelConditionalFormattingAverageGroup
+  {
+    /****************************************************************************************/
+
+    #region Constructors
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    /// <param name="namespaceManager"></param>
+    internal ExcelConditionalFormattingAboveAverage(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode,
+      XmlNamespaceManager namespaceManager)
+      : base(
+        eExcelConditionalFormattingRuleType.AboveAverage,
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        (namespaceManager == null) ? worksheet.NameSpaceManager : namespaceManager)
+    {
+        if (itemElementNode==null) //Set default values and create attributes if needed
+        {
+            AboveAverage = true;
+            EqualAverage = false;
+        }
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    internal ExcelConditionalFormattingAboveAverage(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode)
+      : this(
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        null)
+    {
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    internal ExcelConditionalFormattingAboveAverage(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet)
+      : this(
+        address,
+        priority,
+        worksheet,
+        null,
+        null)
+    {
+    }
+    #endregion Constructors
+
+    /****************************************************************************************/
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingAboveOrEqualAverage.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingAboveOrEqualAverage.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingAboveOrEqualAverage.cs	(revision 12707)
@@ -0,0 +1,122 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Eyal Seagull        Added       		  2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Drawing;
+using System.Xml;
+using OfficeOpenXml.ConditionalFormatting.Contracts;
+
+namespace OfficeOpenXml.ConditionalFormatting
+{
+  /// <summary>
+  /// ExcelConditionalFormattingAboveOrEqualAverage
+  /// </summary>
+  public class ExcelConditionalFormattingAboveOrEqualAverage
+    : ExcelConditionalFormattingAverageGroup
+  {
+    /****************************************************************************************/
+
+    #region Constructors
+    /// <summary>
+    /// 
+    /// </summary>
+      /// <param name="address"></param>
+      /// <param name="priority"></param>
+      /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    /// <param name="namespaceManager"></param>
+    internal ExcelConditionalFormattingAboveOrEqualAverage(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode,
+      XmlNamespaceManager namespaceManager)
+      : base(
+        eExcelConditionalFormattingRuleType.AboveOrEqualAverage,
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        (namespaceManager == null) ? worksheet.NameSpaceManager : namespaceManager)
+    {
+        if (itemElementNode==null) //Set default values and create attributes if needed
+        {
+            AboveAverage = true;
+            EqualAverage = true;
+        }
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    internal ExcelConditionalFormattingAboveOrEqualAverage(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode)
+      : this(
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        null)
+    {
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    internal ExcelConditionalFormattingAboveOrEqualAverage(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet)
+      : this(
+        address,
+        priority,
+        worksheet,
+        null,
+        null)
+    {
+    }
+    #endregion Constructors
+
+    /****************************************************************************************/
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingAboveStdDev.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingAboveStdDev.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingAboveStdDev.cs	(revision 12707)
@@ -0,0 +1,123 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Eyal Seagull        Added       		  2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Drawing;
+using System.Xml;
+using OfficeOpenXml.ConditionalFormatting.Contracts;
+
+namespace OfficeOpenXml.ConditionalFormatting
+{
+  /// <summary>
+  /// ExcelConditionalFormattingAboveStdDev
+  /// </summary>
+  public class ExcelConditionalFormattingAboveStdDev
+    : ExcelConditionalFormattingRule,
+    IExcelConditionalFormattingStdDevGroup
+  {
+    /****************************************************************************************/
+
+    #region Constructors
+    /// <summary>
+    /// 
+    /// </summary>
+      /// <param name="address"></param>
+      /// <param name="priority"></param>
+      /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    /// <param name="namespaceManager"></param>
+    internal ExcelConditionalFormattingAboveStdDev(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode,
+      XmlNamespaceManager namespaceManager)
+      : base(
+        eExcelConditionalFormattingRuleType.AboveStdDev,
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        (namespaceManager == null) ? worksheet.NameSpaceManager : namespaceManager)
+    {
+        if (itemElementNode==null) //Set default values and create attributes if needed
+        {
+            AboveAverage = true;
+            StdDev = 1;
+        }
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    internal ExcelConditionalFormattingAboveStdDev(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode)
+      : this(
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        null)
+    {
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    internal ExcelConditionalFormattingAboveStdDev(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet)
+      : this(
+        address,
+        priority,
+        worksheet,
+        null,
+        null)
+    {
+    }
+    #endregion Constructors
+
+    /****************************************************************************************/
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingAverageGroup.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingAverageGroup.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingAverageGroup.cs	(revision 12707)
@@ -0,0 +1,126 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Eyal Seagull        Added       		  2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Drawing;
+using System.Xml;
+using OfficeOpenXml.ConditionalFormatting.Contracts;
+
+namespace OfficeOpenXml.ConditionalFormatting
+{
+  /// <summary>
+  /// ExcelConditionalFormattingAverageGroup
+  /// </summary>
+  public class ExcelConditionalFormattingAverageGroup
+    : ExcelConditionalFormattingRule,
+    IExcelConditionalFormattingAverageGroup
+  {
+    /****************************************************************************************/
+
+    #region Constructors
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="type"></param>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    /// <param name="namespaceManager"></param>
+    internal ExcelConditionalFormattingAverageGroup(
+      eExcelConditionalFormattingRuleType type,
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode,
+      XmlNamespaceManager namespaceManager)
+      : base(
+        type,
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        (namespaceManager == null) ? worksheet.NameSpaceManager : namespaceManager)
+    {
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    ///<param name="type"></param>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    internal ExcelConditionalFormattingAverageGroup(
+      eExcelConditionalFormattingRuleType type,
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode)
+      : this(
+        type,
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        null)
+    {
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    ///<param name="type"></param>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    internal ExcelConditionalFormattingAverageGroup(
+      eExcelConditionalFormattingRuleType type,
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet)
+      : this(
+        type,
+        address,
+        priority,
+        worksheet,
+        null,
+        null)
+    {
+    }
+    #endregion Constructors
+
+    /****************************************************************************************/
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingBeginsWith.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingBeginsWith.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingBeginsWith.cs	(revision 12707)
@@ -0,0 +1,150 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Eyal Seagull        Added       		  2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Drawing;
+using System.Xml;
+using OfficeOpenXml.ConditionalFormatting.Contracts;
+
+namespace OfficeOpenXml.ConditionalFormatting
+{
+  /// <summary>
+  /// ExcelConditionalFormattingBeginsWith
+  /// </summary>
+  public class ExcelConditionalFormattingBeginsWith
+    : ExcelConditionalFormattingRule,
+    IExcelConditionalFormattingBeginsWith
+  {
+    /****************************************************************************************/
+
+    #region Constructors
+    /// <summary>
+    /// 
+    /// </summary>
+      /// <param name="address"></param>
+      /// <param name="priority"></param>
+      /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    /// <param name="namespaceManager"></param>
+    internal ExcelConditionalFormattingBeginsWith(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode,
+      XmlNamespaceManager namespaceManager)
+      : base(
+        eExcelConditionalFormattingRuleType.BeginsWith,
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        (namespaceManager == null) ? worksheet.NameSpaceManager : namespaceManager)
+    {
+        if (itemElementNode==null) //Set default values and create attributes if needed
+        {
+            Operator = eExcelConditionalFormattingOperatorType.BeginsWith;
+            Text = string.Empty;
+        }
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    internal ExcelConditionalFormattingBeginsWith(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode)
+      : this(
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        null)
+    {
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    internal ExcelConditionalFormattingBeginsWith(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet)
+      : this(
+        address,
+        priority,
+        worksheet,
+        null,
+        null)
+    {
+    }
+    #endregion Constructors
+
+    /****************************************************************************************/
+
+    #region Exposed Properties
+    /// <summary>
+    /// The text to search in the beginning of the cell
+    /// </summary>
+    public string Text
+    {
+      get
+      {
+        return GetXmlNodeString(
+          ExcelConditionalFormattingConstants.Paths.TextAttribute);
+      }
+      set
+      {
+        SetXmlNodeString(
+          ExcelConditionalFormattingConstants.Paths.TextAttribute,
+          value);
+
+        Formula = string.Format(
+          "LEFT({0},LEN(\"{1}\"))=\"{1}\"",
+          Address.Start.Address,
+          value.Replace("\"", "\"\""));
+      }
+    }
+    #endregion Exposed Properties
+
+    /****************************************************************************************/
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingBelowAverage.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingBelowAverage.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingBelowAverage.cs	(revision 12707)
@@ -0,0 +1,122 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Eyal Seagull        Added       		  2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Drawing;
+using System.Xml;
+using OfficeOpenXml.ConditionalFormatting.Contracts;
+
+namespace OfficeOpenXml.ConditionalFormatting
+{
+  /// <summary>
+  /// ExcelConditionalFormattingBelowAverage
+  /// </summary>
+  public class ExcelConditionalFormattingBelowAverage
+    : ExcelConditionalFormattingAverageGroup
+  {
+    /****************************************************************************************/
+
+    #region Constructors
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    /// <param name="namespaceManager"></param>
+    internal ExcelConditionalFormattingBelowAverage(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode,
+      XmlNamespaceManager namespaceManager)
+      : base(
+        eExcelConditionalFormattingRuleType.BelowAverage,
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        (namespaceManager == null) ? worksheet.NameSpaceManager : namespaceManager)
+    {
+        if (itemElementNode==null) //Set default values and create attributes if needed
+        {
+            AboveAverage = false;
+            EqualAverage = false;
+        }
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    internal ExcelConditionalFormattingBelowAverage(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode)
+      : this(
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        null)
+    {
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    internal ExcelConditionalFormattingBelowAverage(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet)
+      : this(
+        address,
+        priority,
+        worksheet,
+        null,
+        null)
+    {
+    }
+    #endregion Constructors
+
+    /****************************************************************************************/
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingBelowOrEqualAverage.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingBelowOrEqualAverage.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingBelowOrEqualAverage.cs	(revision 12707)
@@ -0,0 +1,122 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Eyal Seagull        Added       		  2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Drawing;
+using System.Xml;
+using OfficeOpenXml.ConditionalFormatting.Contracts;
+
+namespace OfficeOpenXml.ConditionalFormatting
+{
+  /// <summary>
+  /// ExcelConditionalFormattingBelowOrEqualAverage
+  /// </summary>
+  public class ExcelConditionalFormattingBelowOrEqualAverage
+    : ExcelConditionalFormattingAverageGroup
+  {
+    /****************************************************************************************/
+
+    #region Constructors
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="address"></param>
+    /// <param name="priority"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    /// <param name="namespaceManager"></param>
+    internal ExcelConditionalFormattingBelowOrEqualAverage(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode,
+      XmlNamespaceManager namespaceManager)
+      : base(
+        eExcelConditionalFormattingRuleType.BelowOrEqualAverage,
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        (namespaceManager == null) ? worksheet.NameSpaceManager : namespaceManager)
+    {
+        if (itemElementNode==null) //Set default values and create attributes if needed
+        {
+            AboveAverage = false;
+            EqualAverage = true;
+        }
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="address"></param>
+    /// <param name="priority"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    internal ExcelConditionalFormattingBelowOrEqualAverage(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode)
+      : this(
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        null)
+    {
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="address"></param>
+    /// <param name="priority"></param>
+    /// <param name="worksheet"></param>
+    internal ExcelConditionalFormattingBelowOrEqualAverage(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet)
+      : this(
+        address,
+        priority,
+        worksheet,
+        null,
+        null)
+    {
+    }
+    #endregion Constructors
+
+    /****************************************************************************************/
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingBelowStdDev.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingBelowStdDev.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingBelowStdDev.cs	(revision 12707)
@@ -0,0 +1,123 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Eyal Seagull        Added       		  2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Drawing;
+using System.Xml;
+using OfficeOpenXml.ConditionalFormatting.Contracts;
+
+namespace OfficeOpenXml.ConditionalFormatting
+{
+  /// <summary>
+  /// ExcelConditionalFormattingBelowStdDev
+  /// </summary>
+  public class ExcelConditionalFormattingBelowStdDev
+    : ExcelConditionalFormattingRule,
+    IExcelConditionalFormattingStdDevGroup
+  {
+    /****************************************************************************************/
+
+    #region Constructors
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    /// <param name="namespaceManager"></param>
+    internal ExcelConditionalFormattingBelowStdDev(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode,
+      XmlNamespaceManager namespaceManager)
+      : base(
+        eExcelConditionalFormattingRuleType.BelowStdDev,
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        (namespaceManager == null) ? worksheet.NameSpaceManager : namespaceManager)
+    {
+        if (itemElementNode==null) //Set default values and create attributes if needed
+        {
+            AboveAverage = false;
+            StdDev = 1;
+        }
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    internal ExcelConditionalFormattingBelowStdDev(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode)
+      : this(
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        null)
+    {
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    internal ExcelConditionalFormattingBelowStdDev(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet)
+      : this(
+        address,
+        priority,
+        worksheet,
+        null,
+        null)
+    {
+    }
+    #endregion Constructors
+
+    /****************************************************************************************/
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingBetween.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingBetween.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingBetween.cs	(revision 12707)
@@ -0,0 +1,124 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Eyal Seagull        Added       		  2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Drawing;
+using System.Xml;
+using OfficeOpenXml.ConditionalFormatting.Contracts;
+
+namespace OfficeOpenXml.ConditionalFormatting
+{
+  /// <summary>
+  /// ExcelConditionalFormattingBetween
+  /// </summary>
+  public class ExcelConditionalFormattingBetween
+    : ExcelConditionalFormattingRule,
+    IExcelConditionalFormattingBetween
+  {
+    /****************************************************************************************/
+
+    #region Constructors
+    /// <summary>
+    /// 
+    /// </summary>
+      /// <param name="address"></param>
+      /// <param name="priority"></param>
+      /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    /// <param name="namespaceManager"></param>
+    internal ExcelConditionalFormattingBetween(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode,
+      XmlNamespaceManager namespaceManager)
+      : base(
+        eExcelConditionalFormattingRuleType.Between,
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        (namespaceManager == null) ? worksheet.NameSpaceManager : namespaceManager)
+    {
+        if (itemElementNode==null) //Set default values and create attributes if needed
+        {
+            Operator = eExcelConditionalFormattingOperatorType.Between;
+            Formula = string.Empty;
+            Formula2 = string.Empty;
+        }
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    internal ExcelConditionalFormattingBetween(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode)
+      : this(
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        null)
+    {
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    internal ExcelConditionalFormattingBetween(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet)
+      : this(
+        address,
+        priority,
+        worksheet,
+        null,
+        null)
+    {
+    }
+    #endregion Constructors
+
+    /****************************************************************************************/
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingBottom.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingBottom.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingBottom.cs	(revision 12707)
@@ -0,0 +1,124 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Eyal Seagull        Added       		  2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Drawing;
+using System.Xml;
+using OfficeOpenXml.ConditionalFormatting.Contracts;
+
+namespace OfficeOpenXml.ConditionalFormatting
+{
+  /// <summary>
+  /// ExcelConditionalFormattingBottom
+  /// </summary>
+  public class ExcelConditionalFormattingBottom
+    : ExcelConditionalFormattingRule,
+    IExcelConditionalFormattingTopBottomGroup
+  {
+    /****************************************************************************************/
+
+    #region Constructors
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="address"></param>
+    /// <param name="priority"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    /// <param name="namespaceManager"></param>
+    internal ExcelConditionalFormattingBottom(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode,
+      XmlNamespaceManager namespaceManager)
+      : base(
+        eExcelConditionalFormattingRuleType.Bottom,
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        (namespaceManager == null) ? worksheet.NameSpaceManager : namespaceManager)
+    {
+        if (itemElementNode==null) //Set default values and create attributes if needed
+        {
+            Bottom = true;
+            Percent = false;
+            Rank = 10;  // Last 10 values
+        }
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    internal ExcelConditionalFormattingBottom(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode)
+      : this(
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        null)
+    {
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    internal ExcelConditionalFormattingBottom(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet)
+      : this(
+        address,
+        priority,
+        worksheet,
+        null,
+        null)
+    {
+    }
+    #endregion Constructors
+
+    /****************************************************************************************/
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingBottomPercent.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingBottomPercent.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingBottomPercent.cs	(revision 12707)
@@ -0,0 +1,124 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Eyal Seagull        Added       		  2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Drawing;
+using System.Xml;
+using OfficeOpenXml.ConditionalFormatting.Contracts;
+
+namespace OfficeOpenXml.ConditionalFormatting
+{
+  /// <summary>
+  /// ExcelConditionalFormattingBottomPercent
+  /// </summary>
+  public class ExcelConditionalFormattingBottomPercent
+    : ExcelConditionalFormattingRule,
+    IExcelConditionalFormattingTopBottomGroup
+  {
+    /****************************************************************************************/
+
+    #region Constructors
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    /// <param name="namespaceManager"></param>
+    internal ExcelConditionalFormattingBottomPercent(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode,
+      XmlNamespaceManager namespaceManager)
+      : base(
+        eExcelConditionalFormattingRuleType.BottomPercent,
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        (namespaceManager == null) ? worksheet.NameSpaceManager : namespaceManager)
+    {
+        if (itemElementNode==null) //Set default values and create attributes if needed
+        {
+            Bottom = true;
+            Percent = true;
+            Rank = 10;  // Last 10 percent
+        }
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    internal ExcelConditionalFormattingBottomPercent(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode)
+      : this(
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        null)
+    {
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    internal ExcelConditionalFormattingBottomPercent(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet)
+      : this(
+        address,
+        priority,
+        worksheet,
+        null,
+        null)
+    {
+    }
+    #endregion Constructors
+
+    /****************************************************************************************/
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingContainsBlanks.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingContainsBlanks.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingContainsBlanks.cs	(revision 12707)
@@ -0,0 +1,124 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Eyal Seagull        Added       		  2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Drawing;
+using System.Xml;
+using OfficeOpenXml.ConditionalFormatting.Contracts;
+
+namespace OfficeOpenXml.ConditionalFormatting
+{
+  /// <summary>
+  /// ExcelConditionalFormattingContainsBlanks
+  /// </summary>
+  public class ExcelConditionalFormattingContainsBlanks
+    : ExcelConditionalFormattingRule,
+    IExcelConditionalFormattingContainsBlanks
+  {
+    /****************************************************************************************/
+
+    #region Constructors
+    /// <summary>
+    /// 
+    /// </summary>
+      /// <param name="address"></param>
+      /// <param name="priority"></param>
+      /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    /// <param name="namespaceManager"></param>
+    internal ExcelConditionalFormattingContainsBlanks(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode,
+      XmlNamespaceManager namespaceManager)
+      : base(
+        eExcelConditionalFormattingRuleType.ContainsBlanks,
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        (namespaceManager == null) ? worksheet.NameSpaceManager : namespaceManager)
+    {
+        if (itemElementNode==null) //Set default values and create attributes if needed
+        {
+            Formula = string.Format(
+              "LEN(TRIM({0}))=0",
+              Address.Start.Address);
+        }
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    internal ExcelConditionalFormattingContainsBlanks(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode)
+      : this(
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        null)
+    {
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    internal ExcelConditionalFormattingContainsBlanks(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet)
+      : this(
+        address,
+        priority,
+        worksheet,
+        null,
+        null)
+    {
+    }
+    #endregion Constructors
+
+    /****************************************************************************************/
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingContainsErrors.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingContainsErrors.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingContainsErrors.cs	(revision 12707)
@@ -0,0 +1,124 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Eyal Seagull        Added       		  2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Drawing;
+using System.Xml;
+using OfficeOpenXml.ConditionalFormatting.Contracts;
+
+namespace OfficeOpenXml.ConditionalFormatting
+{
+  /// <summary>
+  /// ExcelConditionalFormattingContainsErrors
+  /// </summary>
+  public class ExcelConditionalFormattingContainsErrors
+    : ExcelConditionalFormattingRule,
+    IExcelConditionalFormattingContainsErrors
+  {
+    /****************************************************************************************/
+
+    #region Constructors
+    /// <summary>
+    /// 
+    /// </summary>
+      /// <param name="address"></param>
+      /// <param name="priority"></param>
+      /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    /// <param name="namespaceManager"></param>
+    internal ExcelConditionalFormattingContainsErrors(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode,
+      XmlNamespaceManager namespaceManager)
+      : base(
+        eExcelConditionalFormattingRuleType.ContainsErrors,
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        (namespaceManager == null) ? worksheet.NameSpaceManager : namespaceManager)
+    {
+        if (itemElementNode==null) //Set default values and create attributes if needed
+        {
+            Formula = string.Format(
+              "ISERROR({0})",
+              Address.Start.Address);
+        }
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    internal ExcelConditionalFormattingContainsErrors(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode)
+      : this(
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        null)
+    {
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    internal ExcelConditionalFormattingContainsErrors(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet)
+      : this(
+        address,
+        priority,
+        worksheet,
+        null,
+        null)
+    {
+    }
+    #endregion Constructors
+
+    /****************************************************************************************/
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingContainsText.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingContainsText.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingContainsText.cs	(revision 12707)
@@ -0,0 +1,150 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Eyal Seagull        Added       		  2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Drawing;
+using System.Xml;
+using OfficeOpenXml.ConditionalFormatting.Contracts;
+
+namespace OfficeOpenXml.ConditionalFormatting
+{
+  /// <summary>
+  /// ExcelConditionalFormattingContainsText
+  /// </summary>
+  public class ExcelConditionalFormattingContainsText
+    : ExcelConditionalFormattingRule,
+    IExcelConditionalFormattingContainsText
+  {
+    /****************************************************************************************/
+
+    #region Constructors
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="address"></param>
+    /// <param name="priority"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    /// <param name="namespaceManager"></param>
+    internal ExcelConditionalFormattingContainsText(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode,
+      XmlNamespaceManager namespaceManager)
+      : base(
+        eExcelConditionalFormattingRuleType.ContainsText,
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        (namespaceManager == null) ? worksheet.NameSpaceManager : namespaceManager)
+    {
+        if (itemElementNode==null) //Set default values and create attributes if needed
+        {
+            Operator = eExcelConditionalFormattingOperatorType.ContainsText;
+            Text = string.Empty;
+        }
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    internal ExcelConditionalFormattingContainsText(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode)
+      : this(
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        null)
+    {
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    internal ExcelConditionalFormattingContainsText(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet)
+      : this(
+        address,
+        priority,
+        worksheet,
+        null,
+        null)
+    {
+    }
+    #endregion Constructors
+
+    /****************************************************************************************/
+
+    #region Exposed Properties
+    /// <summary>
+    /// The text to search inside the cell
+    /// </summary>
+    public string Text
+    {
+      get
+      {
+        return GetXmlNodeString(
+          ExcelConditionalFormattingConstants.Paths.TextAttribute);
+      }
+      set
+      {
+        SetXmlNodeString(
+          ExcelConditionalFormattingConstants.Paths.TextAttribute,
+          value);
+
+        Formula = string.Format(
+          "NOT(ISERROR(SEARCH(\"{1}\",{0})))",
+          Address.Start.Address,
+          value.Replace("\"", "\"\""));
+      }
+    }
+    #endregion Exposed Properties
+
+    /****************************************************************************************/
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingDataBar.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingDataBar.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingDataBar.cs	(revision 12707)
@@ -0,0 +1,233 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Eyal Seagull        Added       		  2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Drawing;
+using System.Xml;
+using OfficeOpenXml.ConditionalFormatting.Contracts;
+using System.Globalization;
+namespace OfficeOpenXml.ConditionalFormatting
+{
+    /// <summary>
+    /// Databar
+    /// </summary>
+    public class ExcelConditionalFormattingDataBar
+      : ExcelConditionalFormattingRule,
+        IExcelConditionalFormattingDataBarGroup
+    {
+        /****************************************************************************************/
+
+        #region Private Properties
+
+        #endregion Private Properties
+
+        /****************************************************************************************/
+
+        #region Constructors
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="type"></param>
+        /// <param name="priority"></param>
+        /// <param name="address"></param>
+        /// <param name="worksheet"></param>
+        /// <param name="itemElementNode"></param>
+        /// <param name="namespaceManager"></param>
+        internal ExcelConditionalFormattingDataBar(
+          eExcelConditionalFormattingRuleType type,
+          ExcelAddress address,
+          int priority,
+          ExcelWorksheet worksheet,
+          XmlNode itemElementNode,
+          XmlNamespaceManager namespaceManager)
+            : base(
+              type,
+              address,
+              priority,
+              worksheet,
+              itemElementNode,
+              (namespaceManager == null) ? worksheet.NameSpaceManager : namespaceManager)
+        {
+            SchemaNodeOrder = new string[] { "cfvo", "color" };
+            //Create the <dataBar> node inside the <cfRule> node
+            if (itemElementNode!=null && itemElementNode.HasChildNodes)
+            {
+                bool high=false;
+                foreach (XmlNode node in itemElementNode.SelectNodes("d:dataBar/d:cfvo", NameSpaceManager))
+                {
+                    if (high == false)
+                    {
+                        LowValue = new ExcelConditionalFormattingIconDataBarValue(
+                                type,
+                                address,
+                                worksheet,
+                                node,
+                                namespaceManager);
+                        high = true;
+                    }
+                    else
+                    {
+                        HighValue = new ExcelConditionalFormattingIconDataBarValue(
+                                type,
+                                address,
+                                worksheet,
+                                node,
+                                namespaceManager);
+                    }
+                }
+            }
+            else
+            {
+                var iconSetNode = CreateComplexNode(
+                  Node,
+                  ExcelConditionalFormattingConstants.Paths.DataBar);
+
+                var lowNode = iconSetNode.OwnerDocument.CreateElement(ExcelConditionalFormattingConstants.Paths.Cfvo, ExcelPackage.schemaMain);
+                iconSetNode.AppendChild(lowNode);
+                LowValue = new ExcelConditionalFormattingIconDataBarValue(eExcelConditionalFormattingValueObjectType.Min,
+                        0,
+                        "",
+                        eExcelConditionalFormattingRuleType.DataBar,
+                        address,
+                        priority,
+                        worksheet,
+                        lowNode,
+                        namespaceManager);
+
+                var highNode = iconSetNode.OwnerDocument.CreateElement(ExcelConditionalFormattingConstants.Paths.Cfvo, ExcelPackage.schemaMain);
+                iconSetNode.AppendChild(highNode);
+                HighValue = new ExcelConditionalFormattingIconDataBarValue(eExcelConditionalFormattingValueObjectType.Max,
+                        0,
+                        "",
+                        eExcelConditionalFormattingRuleType.DataBar,
+                        address,
+                        priority,
+                        worksheet,
+                        highNode,
+                        namespaceManager);
+            }
+            Type = type;
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="type"></param>
+        /// <param name="priority"></param>
+        /// <param name="address"></param>
+        /// <param name="worksheet"></param>
+        /// <param name="itemElementNode"></param>
+        internal ExcelConditionalFormattingDataBar(
+          eExcelConditionalFormattingRuleType type,
+          ExcelAddress address,
+          int priority,
+          ExcelWorksheet worksheet,
+          XmlNode itemElementNode)
+            : this(
+              type,
+              address,
+              priority,
+              worksheet,
+              itemElementNode,
+              null)
+        {
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="type"></param>
+        /// <param name="priority"></param>
+        /// <param name="address"></param>
+        /// <param name="worksheet"></param>
+        internal ExcelConditionalFormattingDataBar(
+          eExcelConditionalFormattingRuleType type,
+          ExcelAddress address,
+          int priority,
+          ExcelWorksheet worksheet)
+            : this(
+              type,
+              address,
+              priority,
+              worksheet,
+              null,
+              null)
+        {
+        }
+        #endregion Constructors
+        private const string _showValuePath="d:dataBar/@showValue";
+        public bool ShowValue
+        {
+            get
+            {
+                return GetXmlNodeBool(_showValuePath, true);
+            }
+            set
+            {
+                SetXmlNodeBool(_showValuePath, value);
+            }
+        }
+
+
+        public ExcelConditionalFormattingIconDataBarValue LowValue
+        {
+            get;
+            internal set;
+        }
+
+        public ExcelConditionalFormattingIconDataBarValue HighValue
+        {
+            get;
+            internal set;
+        }
+
+
+        private const string _colorPath = "d:dataBar/d:color/@rgb";
+        public Color Color
+        {
+            get
+            {
+                var rgb=GetXmlNodeString(_colorPath);
+                if(!string.IsNullOrEmpty(rgb))
+                {
+                    return Color.FromArgb(int.Parse(rgb, NumberStyles.HexNumber));
+                }
+                return Color.White;
+            }
+            set
+            {
+                SetXmlNodeString(_colorPath, value.ToArgb().ToString("X"));
+            }
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingDuplicateValues.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingDuplicateValues.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingDuplicateValues.cs	(revision 12707)
@@ -0,0 +1,118 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Eyal Seagull        Added       		  2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Drawing;
+using System.Xml;
+using OfficeOpenXml.ConditionalFormatting.Contracts;
+
+namespace OfficeOpenXml.ConditionalFormatting
+{
+  /// <summary>
+  /// ExcelConditionalFormattingDuplicateValues
+  /// </summary>
+  public class ExcelConditionalFormattingDuplicateValues
+    : ExcelConditionalFormattingRule,
+    IExcelConditionalFormattingDuplicateValues
+  {
+    /****************************************************************************************/
+
+    #region Constructors
+    /// <summary>
+    /// 
+    /// </summary>
+      /// <param name="address"></param>
+      /// <param name="priority"></param>
+      /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    /// <param name="namespaceManager"></param>
+    internal ExcelConditionalFormattingDuplicateValues(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode,
+      XmlNamespaceManager namespaceManager)
+      : base(
+        eExcelConditionalFormattingRuleType.DuplicateValues,
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        (namespaceManager == null) ? worksheet.NameSpaceManager : namespaceManager)
+    {
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    internal ExcelConditionalFormattingDuplicateValues(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode)
+      : this(
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        null)
+    {
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    internal ExcelConditionalFormattingDuplicateValues(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet)
+      : this(
+        address,
+        priority,
+        worksheet,
+        null,
+        null)
+    {
+    }
+    #endregion Constructors
+
+    /****************************************************************************************/
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingEndsWith.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingEndsWith.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingEndsWith.cs	(revision 12707)
@@ -0,0 +1,150 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Eyal Seagull        Added       		  2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Drawing;
+using System.Xml;
+using OfficeOpenXml.ConditionalFormatting.Contracts;
+
+namespace OfficeOpenXml.ConditionalFormatting
+{
+  /// <summary>
+  /// ExcelConditionalFormattingEndsWith
+  /// </summary>
+  public class ExcelConditionalFormattingEndsWith
+    : ExcelConditionalFormattingRule,
+    IExcelConditionalFormattingEndsWith
+  {
+    /****************************************************************************************/
+
+    #region Constructors
+    /// <summary>
+    /// 
+    /// </summary>
+      /// <param name="address"></param>
+      /// <param name="priority"></param>
+      /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    /// <param name="namespaceManager"></param>
+    internal ExcelConditionalFormattingEndsWith(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode,
+      XmlNamespaceManager namespaceManager)
+      : base(
+        eExcelConditionalFormattingRuleType.EndsWith,
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        (namespaceManager == null) ? worksheet.NameSpaceManager : namespaceManager)
+    {
+        if (itemElementNode==null) //Set default values and create attributes if needed
+        {
+            Operator = eExcelConditionalFormattingOperatorType.EndsWith;
+            Text = string.Empty;
+        }
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    internal ExcelConditionalFormattingEndsWith(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode)
+      : this(
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        null)
+    {
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    internal ExcelConditionalFormattingEndsWith(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet)
+      : this(
+        address,
+        priority,
+        worksheet,
+        null,
+        null)
+    {
+    }
+    #endregion Constructors
+
+    /****************************************************************************************/
+
+    #region Exposed Properties
+    /// <summary>
+    /// The text to search in the end of the cell
+    /// </summary>
+    public string Text
+    {
+      get
+      {
+        return GetXmlNodeString(
+          ExcelConditionalFormattingConstants.Paths.TextAttribute);
+      }
+      set
+      {
+        SetXmlNodeString(
+          ExcelConditionalFormattingConstants.Paths.TextAttribute,
+          value);
+
+        Formula = string.Format(
+          "RIGHT({0},LEN(\"{1}\"))=\"{1}\"",
+          Address.Start.Address,
+          value.Replace("\"", "\"\""));
+      }
+    }
+    #endregion Exposed Properties
+
+    /****************************************************************************************/
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingEqual.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingEqual.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingEqual.cs	(revision 12707)
@@ -0,0 +1,123 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Eyal Seagull        Added       		  2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Drawing;
+using System.Xml;
+using OfficeOpenXml.ConditionalFormatting.Contracts;
+
+namespace OfficeOpenXml.ConditionalFormatting
+{
+  /// <summary>
+  /// ExcelConditionalFormattingEqual
+  /// </summary>
+  public class ExcelConditionalFormattingEqual
+    : ExcelConditionalFormattingRule,
+    IExcelConditionalFormattingEqual
+  {
+    /****************************************************************************************/
+
+    #region Constructors
+    /// <summary>
+    /// 
+    /// </summary>
+      /// <param name="address"></param>
+      /// <param name="priority"></param>
+      /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    /// <param name="namespaceManager"></param>
+    internal ExcelConditionalFormattingEqual(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode,
+      XmlNamespaceManager namespaceManager)
+      : base(
+        eExcelConditionalFormattingRuleType.Equal,
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        (namespaceManager == null) ? worksheet.NameSpaceManager : namespaceManager)
+    {
+        if (itemElementNode==null) //Set default values and create attributes if needed
+        {
+            Operator = eExcelConditionalFormattingOperatorType.Equal;
+            Formula = string.Empty;
+        }
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    internal ExcelConditionalFormattingEqual(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode)
+      : this(
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        null)
+    {
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    internal ExcelConditionalFormattingEqual(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet)
+      : this(
+        address,
+        priority,
+        worksheet,
+        null,
+        null)
+    {
+    }
+    #endregion Constructors
+
+    /****************************************************************************************/
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingExpression.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingExpression.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingExpression.cs	(revision 12707)
@@ -0,0 +1,122 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Eyal Seagull        Added       		  2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Drawing;
+using System.Xml;
+using OfficeOpenXml.ConditionalFormatting.Contracts;
+
+namespace OfficeOpenXml.ConditionalFormatting
+{
+  /// <summary>
+  /// ExcelConditionalFormattingExpression
+  /// </summary>
+  public class ExcelConditionalFormattingExpression
+    : ExcelConditionalFormattingRule,
+    IExcelConditionalFormattingExpression
+  {
+    /****************************************************************************************/
+
+    #region Constructors
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="address"></param>
+    /// <param name="priority"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    /// <param name="namespaceManager"></param>
+    internal ExcelConditionalFormattingExpression(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode,
+      XmlNamespaceManager namespaceManager)
+      : base(
+        eExcelConditionalFormattingRuleType.Expression,
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        (namespaceManager == null) ? worksheet.NameSpaceManager : namespaceManager)
+    {
+        if (itemElementNode==null) //Set default values and create attributes if needed
+        {
+            Formula = string.Empty;
+        }
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    internal ExcelConditionalFormattingExpression(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode)
+      : this(
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        null)
+    {
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    internal ExcelConditionalFormattingExpression(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet)
+      : this(
+        address,
+        priority,
+        worksheet,
+        null,
+        null)
+    {
+    }
+    #endregion Constructors
+
+    /****************************************************************************************/
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingFiveIconSet.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingFiveIconSet.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingFiveIconSet.cs	(revision 12707)
@@ -0,0 +1,180 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Eyal Seagull        Added       		  2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Drawing;
+using System.Xml;
+using OfficeOpenXml.ConditionalFormatting.Contracts;
+
+namespace OfficeOpenXml.ConditionalFormatting
+{
+  /// <summary>
+  /// ExcelConditionalFormattingThreeIconSet
+  /// </summary>
+  public class ExcelConditionalFormattingFiveIconSet
+    : ExcelConditionalFormattingIconSetBase<eExcelconditionalFormatting5IconsSetType>, IExcelConditionalFormattingFiveIconSet
+  {
+    /****************************************************************************************/
+
+    #region Private Properties
+
+    #endregion Private Properties
+
+    /****************************************************************************************/
+
+    #region Constructors
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    /// <param name="namespaceManager"></param>
+    internal ExcelConditionalFormattingFiveIconSet(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode,
+      XmlNamespaceManager namespaceManager)
+      : base(
+        eExcelConditionalFormattingRuleType.FiveIconSet,
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        (namespaceManager == null) ? worksheet.NameSpaceManager : namespaceManager)
+    {
+        if (itemElementNode != null && itemElementNode.HasChildNodes)
+        {
+            XmlNode iconNode4 = TopNode.SelectSingleNode("d:iconSet/d:cfvo[position()=4]", NameSpaceManager);
+            Icon4 = new ExcelConditionalFormattingIconDataBarValue(
+                    eExcelConditionalFormattingRuleType.FiveIconSet,
+                    address,
+                    worksheet,
+                    iconNode4,
+                    namespaceManager);
+            
+            XmlNode iconNode5 = TopNode.SelectSingleNode("d:iconSet/d:cfvo[position()=5]", NameSpaceManager);
+            Icon5 = new ExcelConditionalFormattingIconDataBarValue(
+                    eExcelConditionalFormattingRuleType.FiveIconSet,
+                    address,
+                    worksheet,
+                    iconNode5,
+                    namespaceManager);
+        }
+        else
+        {
+            XmlNode iconSetNode = TopNode.SelectSingleNode("d:iconSet", NameSpaceManager);
+            var iconNode4 = iconSetNode.OwnerDocument.CreateElement(ExcelConditionalFormattingConstants.Paths.Cfvo, ExcelPackage.schemaMain);
+            iconSetNode.AppendChild(iconNode4);
+
+            Icon4 = new ExcelConditionalFormattingIconDataBarValue(eExcelConditionalFormattingValueObjectType.Percent,
+                    60,
+                    "",
+                    eExcelConditionalFormattingRuleType.ThreeIconSet,
+                    address,
+                    priority,
+                    worksheet,
+                    iconNode4,
+                    namespaceManager);
+
+            var iconNode5 = iconSetNode.OwnerDocument.CreateElement(ExcelConditionalFormattingConstants.Paths.Cfvo, ExcelPackage.schemaMain);
+            iconSetNode.AppendChild(iconNode5);
+
+            Icon5 = new ExcelConditionalFormattingIconDataBarValue(eExcelConditionalFormattingValueObjectType.Percent,
+                    80,
+                    "",
+                    eExcelConditionalFormattingRuleType.ThreeIconSet,
+                    address,
+                    priority,
+                    worksheet,
+                    iconNode5,
+                    namespaceManager);
+        }
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    internal ExcelConditionalFormattingFiveIconSet(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode)
+      : this(
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        null)
+    {
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    internal ExcelConditionalFormattingFiveIconSet(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet)
+      : this(
+        address,
+        priority,
+        worksheet,
+        null,
+        null)
+    {
+    }
+    #endregion Constructors
+
+    public ExcelConditionalFormattingIconDataBarValue Icon5
+    {
+        get;
+        internal set;
+    }
+
+    public ExcelConditionalFormattingIconDataBarValue Icon4
+    {
+        get;
+        internal set;
+    }
+  }
+  }
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingFourIconSet.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingFourIconSet.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingFourIconSet.cs	(revision 12707)
@@ -0,0 +1,154 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Eyal Seagull        Added       		  2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Drawing;
+using System.Xml;
+using OfficeOpenXml.ConditionalFormatting.Contracts;
+
+namespace OfficeOpenXml.ConditionalFormatting
+{
+  /// <summary>
+  /// ExcelConditionalFormattingThreeIconSet
+  /// </summary>
+  public class ExcelConditionalFormattingFourIconSet
+    : ExcelConditionalFormattingIconSetBase<eExcelconditionalFormatting4IconsSetType>, IExcelConditionalFormattingFourIconSet<eExcelconditionalFormatting4IconsSetType>
+  {
+    /****************************************************************************************/
+
+    #region Private Properties
+
+    #endregion Private Properties
+
+    /****************************************************************************************/
+
+    #region Constructors
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    /// <param name="namespaceManager"></param>
+    internal ExcelConditionalFormattingFourIconSet(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode,
+      XmlNamespaceManager namespaceManager)
+      : base(
+        eExcelConditionalFormattingRuleType.FourIconSet,
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        (namespaceManager == null) ? worksheet.NameSpaceManager : namespaceManager)
+    {
+        if(itemElementNode!=null && itemElementNode.HasChildNodes)
+        {
+            XmlNode iconNode4 = TopNode.SelectSingleNode("d:iconSet/d:cfvo[position()=4]", NameSpaceManager);
+            Icon4 = new ExcelConditionalFormattingIconDataBarValue(
+                    eExcelConditionalFormattingRuleType.FourIconSet,
+                    address,
+                    worksheet,
+                    iconNode4,
+                    namespaceManager);
+        }
+        else
+        {
+            XmlNode iconSetNode = TopNode.SelectSingleNode("d:iconSet", NameSpaceManager);
+            var iconNode4 = iconSetNode.OwnerDocument.CreateElement(ExcelConditionalFormattingConstants.Paths.Cfvo, ExcelPackage.schemaMain);
+            iconSetNode.AppendChild(iconNode4);
+
+
+            Icon4 = new ExcelConditionalFormattingIconDataBarValue(eExcelConditionalFormattingValueObjectType.Percent,
+                    75,
+                    "",
+                    eExcelConditionalFormattingRuleType.ThreeIconSet,
+                    address,
+                    priority,
+                    worksheet,
+                    iconNode4,
+                    namespaceManager);
+        }
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    internal ExcelConditionalFormattingFourIconSet(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode)
+      : this(
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        null)
+    {
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    internal ExcelConditionalFormattingFourIconSet(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet)
+      : this(
+        address,
+        priority,
+        worksheet,
+        null,
+        null)
+    {
+    }
+    #endregion Constructors
+
+    public ExcelConditionalFormattingIconDataBarValue Icon4
+    {
+        get;
+        internal set;
+    }
+    }
+  }
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingGreaterThan.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingGreaterThan.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingGreaterThan.cs	(revision 12707)
@@ -0,0 +1,123 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Eyal Seagull        Added       		  2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Drawing;
+using System.Xml;
+using OfficeOpenXml.ConditionalFormatting.Contracts;
+
+namespace OfficeOpenXml.ConditionalFormatting
+{
+  /// <summary>
+  /// ExcelConditionalFormattingGreaterThan
+  /// </summary>
+  public class ExcelConditionalFormattingGreaterThan
+    : ExcelConditionalFormattingRule,
+    IExcelConditionalFormattingGreaterThan
+  {
+    /****************************************************************************************/
+
+    #region Constructors
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="address"></param>
+    /// <param name="priority"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    /// <param name="namespaceManager"></param>
+    internal ExcelConditionalFormattingGreaterThan(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode,
+      XmlNamespaceManager namespaceManager)
+      : base(
+        eExcelConditionalFormattingRuleType.GreaterThan,
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        (namespaceManager == null) ? worksheet.NameSpaceManager : namespaceManager)
+    {
+        if (itemElementNode==null) //Set default values and create attributes if needed
+        {
+            Operator = eExcelConditionalFormattingOperatorType.GreaterThan;
+            Formula = string.Empty;
+        }
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    internal ExcelConditionalFormattingGreaterThan(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode)
+      : this(
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        null)
+    {
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    internal ExcelConditionalFormattingGreaterThan(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet)
+      : this(
+        address,
+        priority,
+        worksheet,
+        null,
+        null)
+    {
+    }
+    #endregion Constructors
+
+    /****************************************************************************************/
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingGreaterThanOrEqual.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingGreaterThanOrEqual.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingGreaterThanOrEqual.cs	(revision 12707)
@@ -0,0 +1,123 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Eyal Seagull        Added       		  2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Drawing;
+using System.Xml;
+using OfficeOpenXml.ConditionalFormatting.Contracts;
+
+namespace OfficeOpenXml.ConditionalFormatting
+{
+  /// <summary>
+  /// ExcelConditionalFormattingGreaterThanOrEqual
+  /// </summary>
+  public class ExcelConditionalFormattingGreaterThanOrEqual
+    : ExcelConditionalFormattingRule,
+    IExcelConditionalFormattingGreaterThanOrEqual
+  {
+    /****************************************************************************************/
+
+    #region Constructors
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="address"></param>
+    /// <param name="priority"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    /// <param name="namespaceManager"></param>
+    internal ExcelConditionalFormattingGreaterThanOrEqual(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode,
+      XmlNamespaceManager namespaceManager)
+      : base(
+        eExcelConditionalFormattingRuleType.GreaterThanOrEqual,
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        (namespaceManager == null) ? worksheet.NameSpaceManager : namespaceManager)
+    {
+        if (itemElementNode==null) //Set default values and create attributes if needed
+        {
+            Operator = eExcelConditionalFormattingOperatorType.GreaterThanOrEqual;
+            Formula = string.Empty;
+        }
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    internal ExcelConditionalFormattingGreaterThanOrEqual(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode)
+      : this(
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        null)
+    {
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    internal ExcelConditionalFormattingGreaterThanOrEqual(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet)
+      : this(
+        address,
+        priority,
+        worksheet,
+        null,
+        null)
+    {
+    }
+    #endregion Constructors
+
+    /****************************************************************************************/
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingLast7Days.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingLast7Days.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingLast7Days.cs	(revision 12707)
@@ -0,0 +1,124 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Eyal Seagull        Added       		  2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Drawing;
+using System.Xml;
+using OfficeOpenXml.ConditionalFormatting.Contracts;
+
+namespace OfficeOpenXml.ConditionalFormatting
+{
+  /// <summary>
+  /// ExcelConditionalFormattingLast7Days
+  /// </summary>
+  public class ExcelConditionalFormattingLast7Days
+    : ExcelConditionalFormattingTimePeriodGroup
+  {
+    /****************************************************************************************/
+
+    #region Constructors
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    /// <param name="namespaceManager"></param>
+    internal ExcelConditionalFormattingLast7Days(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode,
+      XmlNamespaceManager namespaceManager)
+      : base(
+        eExcelConditionalFormattingRuleType.Last7Days,
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        (namespaceManager == null) ? worksheet.NameSpaceManager : namespaceManager)
+    {
+        if (itemElementNode==null) //Set default values and create attributes if needed
+        {
+            TimePeriod = eExcelConditionalFormattingTimePeriodType.Last7Days;
+            Formula = string.Format(
+              "AND(TODAY()-FLOOR({0},1)<=6,FLOOR({0},1)<=TODAY())",
+              Address.Start.Address);
+        }
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    internal ExcelConditionalFormattingLast7Days(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode)
+      : this(
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        null)
+    {
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    internal ExcelConditionalFormattingLast7Days(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet)
+      : this(
+        address,
+        priority,
+        worksheet,
+        null,
+        null)
+    {
+    }
+    #endregion Constructors
+
+    /****************************************************************************************/
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingLastMonth.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingLastMonth.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingLastMonth.cs	(revision 12707)
@@ -0,0 +1,124 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Eyal Seagull        Added       		  2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Drawing;
+using System.Xml;
+using OfficeOpenXml.ConditionalFormatting.Contracts;
+
+namespace OfficeOpenXml.ConditionalFormatting
+{
+  /// <summary>
+  /// ExcelConditionalFormattingLastMonth
+  /// </summary>
+  public class ExcelConditionalFormattingLastMonth
+    : ExcelConditionalFormattingTimePeriodGroup
+  {
+    /****************************************************************************************/
+
+    #region Constructors
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    /// <param name="namespaceManager"></param>
+    internal ExcelConditionalFormattingLastMonth(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode,
+      XmlNamespaceManager namespaceManager)
+      : base(
+        eExcelConditionalFormattingRuleType.LastMonth,
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        (namespaceManager == null) ? worksheet.NameSpaceManager : namespaceManager)
+    {
+        if (itemElementNode==null) //Set default values and create attributes if needed
+        {
+            TimePeriod = eExcelConditionalFormattingTimePeriodType.LastMonth;
+            Formula = string.Format(
+              "AND(MONTH({0})=MONTH(EDATE(TODAY(),0-1)),YEAR({0})=YEAR(EDATE(TODAY(),0-1)))",
+              Address.Start.Address);
+        }
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    internal ExcelConditionalFormattingLastMonth(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode)
+      : this(
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        null)
+    {
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    internal ExcelConditionalFormattingLastMonth(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet)
+      : this(
+        address,
+        priority,
+        worksheet,
+        null,
+        null)
+    {
+    }
+    #endregion Constructors
+
+    /****************************************************************************************/
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingLastWeek.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingLastWeek.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingLastWeek.cs	(revision 12707)
@@ -0,0 +1,124 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Eyal Seagull        Added       		  2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Drawing;
+using System.Xml;
+using OfficeOpenXml.ConditionalFormatting.Contracts;
+
+namespace OfficeOpenXml.ConditionalFormatting
+{
+  /// <summary>
+  /// ExcelConditionalFormattingLastWeek
+  /// </summary>
+  public class ExcelConditionalFormattingLastWeek
+    : ExcelConditionalFormattingTimePeriodGroup
+  {
+    /****************************************************************************************/
+
+    #region Constructors
+    /// <summary>
+    /// 
+    /// </summary>
+      /// <param name="address"></param>
+      /// <param name="priority"></param>
+      /// <param name="worksheet"></param>
+      /// <param name="itemElementNode"></param>
+    /// <param name="namespaceManager"></param>
+    internal ExcelConditionalFormattingLastWeek(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode,
+      XmlNamespaceManager namespaceManager)
+      : base(
+        eExcelConditionalFormattingRuleType.LastWeek,
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        (namespaceManager == null) ? worksheet.NameSpaceManager : namespaceManager)
+    {
+        if (itemElementNode==null) //Set default values and create attributes if needed
+        {
+            TimePeriod = eExcelConditionalFormattingTimePeriodType.LastWeek;
+            Formula = string.Format(
+              "AND(TODAY()-ROUNDDOWN({0},0)>=(WEEKDAY(TODAY())),TODAY()-ROUNDDOWN({0},0)<(WEEKDAY(TODAY())+7))",
+              Address.Start.Address);
+        }
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    internal ExcelConditionalFormattingLastWeek(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode)
+      : this(
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        null)
+    {
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    internal ExcelConditionalFormattingLastWeek(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet)
+      : this(
+        address,
+        priority,
+        worksheet,
+        null,
+        null)
+    {
+    }
+    #endregion Constructors
+
+    /****************************************************************************************/
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingLessThan.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingLessThan.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingLessThan.cs	(revision 12707)
@@ -0,0 +1,123 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Eyal Seagull        Added       		  2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Drawing;
+using System.Xml;
+using OfficeOpenXml.ConditionalFormatting.Contracts;
+
+namespace OfficeOpenXml.ConditionalFormatting
+{
+  /// <summary>
+  /// ExcelConditionalFormattingLessThan
+  /// </summary>
+  public class ExcelConditionalFormattingLessThan
+    : ExcelConditionalFormattingRule,
+    IExcelConditionalFormattingLessThan
+  {
+    /****************************************************************************************/
+
+    #region Constructors
+    /// <summary>
+    /// 
+    /// </summary>
+      /// <param name="address"></param>
+      /// <param name="priority"></param>
+      /// <param name="worksheet"></param>
+      /// <param name="itemElementNode"></param>
+    /// <param name="namespaceManager"></param>
+    internal ExcelConditionalFormattingLessThan(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode,
+      XmlNamespaceManager namespaceManager)
+      : base(
+        eExcelConditionalFormattingRuleType.LessThan,
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        (namespaceManager == null) ? worksheet.NameSpaceManager : namespaceManager)
+    {
+        if (itemElementNode==null) //Set default values and create attributes if needed
+        {
+            Operator = eExcelConditionalFormattingOperatorType.LessThan;
+            Formula = string.Empty;
+        }
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    internal ExcelConditionalFormattingLessThan(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode)
+      : this(
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        null)
+    {
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    internal ExcelConditionalFormattingLessThan(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet)
+      : this(
+        address,
+        priority,
+        worksheet,
+        null,
+        null)
+    {
+    }
+    #endregion Constructors
+
+    /****************************************************************************************/
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingLessThanOrEqual.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingLessThanOrEqual.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingLessThanOrEqual.cs	(revision 12707)
@@ -0,0 +1,123 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Eyal Seagull        Added       		  2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Drawing;
+using System.Xml;
+using OfficeOpenXml.ConditionalFormatting.Contracts;
+
+namespace OfficeOpenXml.ConditionalFormatting
+{
+  /// <summary>
+  /// ExcelConditionalFormattingLessThanOrEqual
+  /// </summary>
+  public class ExcelConditionalFormattingLessThanOrEqual
+    : ExcelConditionalFormattingRule,
+    IExcelConditionalFormattingLessThanOrEqual
+  {
+    /****************************************************************************************/
+
+    #region Constructors
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="address"></param>
+    /// <param name="priority"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    /// <param name="namespaceManager"></param>
+    internal ExcelConditionalFormattingLessThanOrEqual(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode,
+      XmlNamespaceManager namespaceManager)
+      : base(
+        eExcelConditionalFormattingRuleType.LessThanOrEqual,
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        (namespaceManager == null) ? worksheet.NameSpaceManager : namespaceManager)
+    {
+        if (itemElementNode==null) //Set default values and create attributes if needed
+        {
+            Operator = eExcelConditionalFormattingOperatorType.LessThanOrEqual;
+            Formula = string.Empty;
+        }
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    internal ExcelConditionalFormattingLessThanOrEqual(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode)
+      : this(
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        null)
+    {
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    internal ExcelConditionalFormattingLessThanOrEqual(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet)
+      : this(
+        address,
+        priority,
+        worksheet,
+        null,
+        null)
+    {
+    }
+    #endregion Constructors
+
+    /****************************************************************************************/
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingNextMonth.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingNextMonth.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingNextMonth.cs	(revision 12707)
@@ -0,0 +1,124 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Eyal Seagull        Added       		  2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Drawing;
+using System.Xml;
+using OfficeOpenXml.ConditionalFormatting.Contracts;
+
+namespace OfficeOpenXml.ConditionalFormatting
+{
+  /// <summary>
+  /// ExcelConditionalFormattingNextMonth
+  /// </summary>
+  public class ExcelConditionalFormattingNextMonth
+    : ExcelConditionalFormattingTimePeriodGroup
+  {
+    /****************************************************************************************/
+
+    #region Constructors
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    /// <param name="namespaceManager"></param>
+    internal ExcelConditionalFormattingNextMonth(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode,
+      XmlNamespaceManager namespaceManager)
+      : base(
+        eExcelConditionalFormattingRuleType.NextMonth,
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        (namespaceManager == null) ? worksheet.NameSpaceManager : namespaceManager)
+    {
+        if (itemElementNode==null) //Set default values and create attributes if needed
+        {
+            TimePeriod = eExcelConditionalFormattingTimePeriodType.NextMonth;
+            Formula = string.Format(
+              "AND(MONTH({0})=MONTH(EDATE(TODAY(),0+1)), YEAR({0})=YEAR(EDATE(TODAY(),0+1)))",
+              Address.Start.Address);
+        }
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    internal ExcelConditionalFormattingNextMonth(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode)
+      : this(
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        null)
+    {
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    internal ExcelConditionalFormattingNextMonth(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet)
+      : this(
+        address,
+        priority,
+        worksheet,
+        null,
+        null)
+    {
+    }
+    #endregion Constructors
+
+    /****************************************************************************************/
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingNextWeek.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingNextWeek.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingNextWeek.cs	(revision 12707)
@@ -0,0 +1,124 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Eyal Seagull        Added       		  2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Drawing;
+using System.Xml;
+using OfficeOpenXml.ConditionalFormatting.Contracts;
+
+namespace OfficeOpenXml.ConditionalFormatting
+{
+  /// <summary>
+  /// ExcelConditionalFormattingNextWeek
+  /// </summary>
+  public class ExcelConditionalFormattingNextWeek
+    : ExcelConditionalFormattingTimePeriodGroup
+  {
+    /****************************************************************************************/
+
+    #region Constructors
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    /// <param name="namespaceManager"></param>
+    internal ExcelConditionalFormattingNextWeek(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode,
+      XmlNamespaceManager namespaceManager)
+      : base(
+        eExcelConditionalFormattingRuleType.NextWeek,
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        (namespaceManager == null) ? worksheet.NameSpaceManager : namespaceManager)
+    {
+        if (itemElementNode==null) //Set default values and create attributes if needed
+        {
+            TimePeriod = eExcelConditionalFormattingTimePeriodType.NextWeek;
+            Formula = string.Format(
+              "AND(ROUNDDOWN({0},0)-TODAY()>(7-WEEKDAY(TODAY())),ROUNDDOWN({0},0)-TODAY()<(15-WEEKDAY(TODAY())))",
+              Address.Start.Address);
+        }
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    internal ExcelConditionalFormattingNextWeek(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode)
+      : this(
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        null)
+    {
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    internal ExcelConditionalFormattingNextWeek(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet)
+      : this(
+        address,
+        priority,
+        worksheet,
+        null,
+        null)
+    {
+    }
+    #endregion Constructors
+
+    /****************************************************************************************/
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingNotBetween.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingNotBetween.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingNotBetween.cs	(revision 12707)
@@ -0,0 +1,124 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Eyal Seagull        Added       		  2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Drawing;
+using System.Xml;
+using OfficeOpenXml.ConditionalFormatting.Contracts;
+
+namespace OfficeOpenXml.ConditionalFormatting
+{
+  /// <summary>
+  /// ExcelConditionalFormattingNotBetween
+  /// </summary>
+  public class ExcelConditionalFormattingNotBetween
+    : ExcelConditionalFormattingRule,
+    IExcelConditionalFormattingNotBetween
+  {
+    /****************************************************************************************/
+
+    #region Constructors
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="address"></param>
+    /// <param name="priority"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    /// <param name="namespaceManager"></param>
+    internal ExcelConditionalFormattingNotBetween(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode,
+      XmlNamespaceManager namespaceManager)
+      : base(
+        eExcelConditionalFormattingRuleType.NotBetween,
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        (namespaceManager == null) ? worksheet.NameSpaceManager : namespaceManager)
+    {
+        if (itemElementNode==null) //Set default values and create attributes if needed
+        {
+            Operator = eExcelConditionalFormattingOperatorType.NotBetween;
+            Formula = string.Empty;
+            Formula2 = string.Empty;
+        }
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    internal ExcelConditionalFormattingNotBetween(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode)
+      : this(
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        null)
+    {
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    internal ExcelConditionalFormattingNotBetween(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet)
+      : this(
+        address,
+        priority,
+        worksheet,
+        null,
+        null)
+    {
+    }
+    #endregion Constructors
+
+    /****************************************************************************************/
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingNotContainsBlanks.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingNotContainsBlanks.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingNotContainsBlanks.cs	(revision 12707)
@@ -0,0 +1,124 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Eyal Seagull        Added       		  2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Drawing;
+using System.Xml;
+using OfficeOpenXml.ConditionalFormatting.Contracts;
+
+namespace OfficeOpenXml.ConditionalFormatting
+{
+  /// <summary>
+  /// ExcelConditionalFormattingNotContainsBlanks
+  /// </summary>
+  public class ExcelConditionalFormattingNotContainsBlanks
+    : ExcelConditionalFormattingRule,
+    IExcelConditionalFormattingNotContainsBlanks
+  {
+    /****************************************************************************************/
+
+    #region Constructors
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="address"></param>
+    /// <param name="priority"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    /// <param name="namespaceManager"></param>
+    internal ExcelConditionalFormattingNotContainsBlanks(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode,
+      XmlNamespaceManager namespaceManager)
+      : base(
+        eExcelConditionalFormattingRuleType.NotContainsBlanks,
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        (namespaceManager == null) ? worksheet.NameSpaceManager : namespaceManager)
+    {
+        if (itemElementNode==null) //Set default values and create attributes if needed
+        {
+            Formula = string.Format(
+              "LEN(TRIM({0}))>0",
+              Address.Start.Address);
+        }
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    internal ExcelConditionalFormattingNotContainsBlanks(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode)
+      : this(
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        null)
+    {
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    internal ExcelConditionalFormattingNotContainsBlanks(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet)
+      : this(
+        address,
+        priority,
+        worksheet,
+        null,
+        null)
+    {
+    }
+    #endregion Constructors
+
+    /****************************************************************************************/
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingNotContainsErrors.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingNotContainsErrors.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingNotContainsErrors.cs	(revision 12707)
@@ -0,0 +1,124 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Eyal Seagull        Added       		  2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Drawing;
+using System.Xml;
+using OfficeOpenXml.ConditionalFormatting.Contracts;
+
+namespace OfficeOpenXml.ConditionalFormatting
+{
+  /// <summary>
+  /// ExcelConditionalFormattingNotContainsErrors
+  /// </summary>
+  public class ExcelConditionalFormattingNotContainsErrors
+    : ExcelConditionalFormattingRule,
+    IExcelConditionalFormattingNotContainsErrors
+  {
+    /****************************************************************************************/
+
+    #region Constructors
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="address"></param>
+    /// <param name="priority"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    /// <param name="namespaceManager"></param>
+    internal ExcelConditionalFormattingNotContainsErrors(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode,
+      XmlNamespaceManager namespaceManager)
+      : base(
+        eExcelConditionalFormattingRuleType.NotContainsErrors,
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        (namespaceManager == null) ? worksheet.NameSpaceManager : namespaceManager)
+    {
+        if (itemElementNode==null) //Set default values and create attributes if needed
+        {
+            Formula = string.Format(
+              "NOT(ISERROR({0}))",
+              Address.Start.Address);
+        }
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    internal ExcelConditionalFormattingNotContainsErrors(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode)
+      : this(
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        null)
+    {
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    internal ExcelConditionalFormattingNotContainsErrors(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet)
+      : this(
+        address,
+        priority,
+        worksheet,
+        null,
+        null)
+    {
+    }
+    #endregion Constructors
+
+    /****************************************************************************************/
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingNotContainsText.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingNotContainsText.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingNotContainsText.cs	(revision 12707)
@@ -0,0 +1,150 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Eyal Seagull        Added       		  2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Drawing;
+using System.Xml;
+using OfficeOpenXml.ConditionalFormatting.Contracts;
+
+namespace OfficeOpenXml.ConditionalFormatting
+{
+  /// <summary>
+  /// ExcelConditionalFormattingNotContainsText
+  /// </summary>
+  public class ExcelConditionalFormattingNotContainsText
+    : ExcelConditionalFormattingRule,
+    IExcelConditionalFormattingNotContainsText
+  {
+    /****************************************************************************************/
+
+    #region Constructors
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="address"></param>
+    /// <param name="priority"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    /// <param name="namespaceManager"></param>
+    internal ExcelConditionalFormattingNotContainsText(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode,
+      XmlNamespaceManager namespaceManager)
+      : base(
+        eExcelConditionalFormattingRuleType.NotContainsText,
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        (namespaceManager == null) ? worksheet.NameSpaceManager : namespaceManager)
+    {
+        if (itemElementNode==null) //Set default values and create attributes if needed
+        {
+            Operator = eExcelConditionalFormattingOperatorType.NotContains;
+            Text = string.Empty;
+        }
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    internal ExcelConditionalFormattingNotContainsText(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode)
+      : this(
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        null)
+    {
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    internal ExcelConditionalFormattingNotContainsText(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet)
+      : this(
+        address,
+        priority,
+        worksheet,
+        null,
+        null)
+    {
+    }
+    #endregion Constructors
+
+    /****************************************************************************************/
+
+    #region Exposed Properties
+    /// <summary>
+    /// The text to search inside the cell
+    /// </summary>
+    public string Text
+    {
+      get
+      {
+        return GetXmlNodeString(
+          ExcelConditionalFormattingConstants.Paths.TextAttribute);
+      }
+      set
+      {
+        SetXmlNodeString(
+          ExcelConditionalFormattingConstants.Paths.TextAttribute,
+          value);
+
+        Formula = string.Format(
+          "ISERROR(SEARCH(\"{1}\",{0}))",
+          Address.Start.Address,
+          value.Replace("\"", "\"\""));
+      }
+    }
+    #endregion Exposed Properties
+
+    /****************************************************************************************/
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingNotEqual.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingNotEqual.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingNotEqual.cs	(revision 12707)
@@ -0,0 +1,123 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Eyal Seagull        Added       		  2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Drawing;
+using System.Xml;
+using OfficeOpenXml.ConditionalFormatting.Contracts;
+
+namespace OfficeOpenXml.ConditionalFormatting
+{
+  /// <summary>
+  /// ExcelConditionalFormattingNotEqual
+  /// </summary>
+  public class ExcelConditionalFormattingNotEqual
+    : ExcelConditionalFormattingRule,
+    IExcelConditionalFormattingNotEqual
+  {
+    /****************************************************************************************/
+
+    #region Constructors
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="address"></param>
+    /// <param name="priority"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    /// <param name="namespaceManager"></param>
+    internal ExcelConditionalFormattingNotEqual(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode,
+      XmlNamespaceManager namespaceManager)
+      : base(
+        eExcelConditionalFormattingRuleType.NotEqual,
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        (namespaceManager == null) ? worksheet.NameSpaceManager : namespaceManager)
+    {
+        if (itemElementNode==null) //Set default values and create attributes if needed
+        {
+            Operator = eExcelConditionalFormattingOperatorType.NotEqual;
+            Formula = string.Empty;
+        }
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    internal ExcelConditionalFormattingNotEqual(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode)
+      : this(
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        null)
+    {
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    internal ExcelConditionalFormattingNotEqual(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet)
+      : this(
+        address,
+        priority,
+        worksheet,
+        null,
+        null)
+    {
+    }
+    #endregion Constructors
+
+    /****************************************************************************************/
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingRule.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingRule.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingRule.cs	(revision 12707)
@@ -0,0 +1,628 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Eyal Seagull        Added       		  2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Drawing;
+using System.Xml;
+using OfficeOpenXml.Utils;
+using System.Text.RegularExpressions;
+using OfficeOpenXml.ConditionalFormatting.Contracts;
+using OfficeOpenXml.Style.Dxf;
+
+namespace OfficeOpenXml.ConditionalFormatting
+{
+  /// <summary>
+  /// 
+  /// </summary>
+  public abstract class ExcelConditionalFormattingRule
+    : XmlHelper,
+    IExcelConditionalFormattingRule
+  {
+    /****************************************************************************************/
+
+    #region Private Properties
+    private eExcelConditionalFormattingRuleType? _type;
+    private ExcelWorksheet _worksheet;
+
+    /// <summary>
+    /// Sinalize that we are in a Cnaging Priorities opeartion so that we won't enter
+    /// a recursive loop.
+    /// </summary>
+    private static bool _changingPriority = false;
+    #endregion Private Properties
+
+    /****************************************************************************************/
+
+    #region Constructors
+    /// <summary>
+    /// Initialize the <see cref="ExcelConditionalFormattingRule"/>
+    /// </summary>
+    /// <param name="type"></param>
+    /// <param name="address"></param>
+    /// <param name="priority">Used also as the cfRule unique key</param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    /// <param name="namespaceManager"></param>
+    internal ExcelConditionalFormattingRule(
+      eExcelConditionalFormattingRuleType type,
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode,
+      XmlNamespaceManager namespaceManager)
+      : base(
+        namespaceManager,
+        itemElementNode)
+    {
+      Require.Argument(address).IsNotNull("address");
+      Require.Argument(priority).IsInRange(1, int.MaxValue, "priority");
+      Require.Argument(worksheet).IsNotNull("worksheet");
+
+      _type = type;
+      _worksheet = worksheet;
+      SchemaNodeOrder = _worksheet.SchemaNodeOrder;
+
+      if (itemElementNode == null)
+      {
+        // Create/Get the <cfRule> inside <conditionalFormatting>
+        itemElementNode = CreateComplexNode(
+          _worksheet.WorksheetXml.DocumentElement,
+          string.Format(
+            "{0}[{1}='{2}']/{1}='{2}'/{3}[{4}='{5}']/{4}='{5}'",
+          //{0}
+            ExcelConditionalFormattingConstants.Paths.ConditionalFormatting,
+          // {1}
+            ExcelConditionalFormattingConstants.Paths.SqrefAttribute,
+          // {2}
+            address.AddressSpaceSeparated,          //CF node don't what to have comma between multi addresses, use space instead.
+          // {3}
+            ExcelConditionalFormattingConstants.Paths.CfRule,
+          //{4}
+            ExcelConditionalFormattingConstants.Paths.PriorityAttribute,
+          //{5}
+            priority));
+      }
+
+      // Point to <cfRule>
+      TopNode = itemElementNode;
+
+      Address = address;
+      Priority = priority;
+      Type = type;
+      if (DxfId >= 0)
+      {
+          worksheet.Workbook.Styles.Dxfs[DxfId].AllowChange = true;  //This Id is referenced by CF, so we can use it when we save.
+          _style = worksheet.Workbook.Styles.Dxfs[DxfId].Clone();    //Clone, so it can be altered without effecting other dxf styles
+      }
+    }
+
+    /// <summary>
+    /// Initialize the <see cref="ExcelConditionalFormattingRule"/>
+    /// </summary>
+    /// <param name="type"></param>
+    /// <param name="address"></param>
+    /// <param name="priority"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="namespaceManager"></param>
+    internal ExcelConditionalFormattingRule(
+      eExcelConditionalFormattingRuleType type,
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNamespaceManager namespaceManager)
+      : this(
+        type,
+        address,
+        priority,
+        worksheet,
+        null,
+        namespaceManager)
+    {
+    }
+    #endregion Constructors
+
+    /****************************************************************************************/
+
+    #region Methods
+    #endregion Methods
+
+    /****************************************************************************************/
+
+    #region Exposed Properties
+    /// <summary>
+    /// Get the &lt;cfRule&gt; node
+    /// </summary>
+    public XmlNode Node
+    {
+      get { return TopNode; }
+    }
+
+    /// <summary>
+    /// Address of the conditional formatting rule
+    /// </summary>
+    /// <remarks>
+    /// The address is stores in a parent node called &lt;conditionalFormatting&gt; in the
+    /// @sqref attribute. Excel groups rules that have the same address inside one node.
+    /// </remarks>
+    public ExcelAddress Address
+    {
+      get
+      {
+        return new ExcelAddress(
+          Node.ParentNode.Attributes[ExcelConditionalFormattingConstants.Attributes.Sqref].Value);
+      }
+      set
+      {
+        // Check if the address is to be changed
+        if (Address.Address != value.Address)
+        {
+          // Save the old parente node
+          XmlNode oldNode = Node;
+          XmlNode oldParentNode = Node.ParentNode;
+
+          // Create/Get the new <conditionalFormatting> parent node
+          XmlNode newParentNode = CreateComplexNode(
+            _worksheet.WorksheetXml.DocumentElement,
+            string.Format(
+              "{0}[{1}='{2}']/{1}='{2}'",
+            //{0}
+              ExcelConditionalFormattingConstants.Paths.ConditionalFormatting,
+            // {1}
+              ExcelConditionalFormattingConstants.Paths.SqrefAttribute,
+            // {2}
+              value.AddressSpaceSeparated)); 
+
+          // Move the <cfRule> node to the new <conditionalFormatting> parent node
+          TopNode = newParentNode.AppendChild(Node);
+
+          // Check if the old <conditionalFormatting> parent node has <cfRule> node inside it
+          if (!oldParentNode.HasChildNodes)
+          {
+            // Remove the old parent node
+            oldParentNode.ParentNode.RemoveChild(oldParentNode);
+          }
+        }
+      }
+    }
+
+    /// <summary>
+    /// Type of conditional formatting rule. ST_CfType §18.18.12.
+    /// </summary>
+    public eExcelConditionalFormattingRuleType Type
+    {
+      get
+      {
+        // Transform the @type attribute to EPPlus Rule Type (slighty diferente)
+        if(_type==null)
+        {
+          _type = ExcelConditionalFormattingRuleType.GetTypeByAttrbiute(
+          GetXmlNodeString(ExcelConditionalFormattingConstants.Paths.TypeAttribute),
+          TopNode,
+          _worksheet.NameSpaceManager);
+        }
+        return (eExcelConditionalFormattingRuleType)_type;
+      }
+      internal set
+      {
+          _type = value;
+          // Transform the EPPlus Rule Type to @type attribute (slighty diferente)
+        SetXmlNodeString(
+          ExcelConditionalFormattingConstants.Paths.TypeAttribute,
+          ExcelConditionalFormattingRuleType.GetAttributeByType(value),
+          true);
+      }
+    }
+
+    /// <summary>
+    /// The priority of this conditional formatting rule. This value is used to determine
+    /// which format should be evaluated and rendered. Lower numeric values are higher
+    /// priority than higher numeric values, where 1 is the highest priority.
+    /// </summary>
+    public int Priority
+    {
+      get
+      {
+        return GetXmlNodeInt(
+          ExcelConditionalFormattingConstants.Paths.PriorityAttribute);
+      }
+      set
+      {
+        // Save the current CF rule priority
+        int priority = Priority;
+
+        // Check if the @priority is to be changed
+        if (priority != value)
+        {
+          // Check if we are not already inside a "Change Priority" operation
+          if (!_changingPriority)
+          {
+            if (value < 1)
+            {
+              throw new IndexOutOfRangeException(
+                ExcelConditionalFormattingConstants.Errors.InvalidPriority);
+            }
+
+            // Sinalize that we are already changing cfRules priorities
+            _changingPriority = true;
+
+            // Check if we lowered the priority
+            if (priority > value)
+            {
+              for (int i = priority - 1; i >= value; i--)
+              {
+                var cfRule = _worksheet.ConditionalFormatting.RulesByPriority(i);
+
+                if (cfRule != null)
+                {
+                  cfRule.Priority++;
+                }
+              }
+            }
+            else
+            {
+              for (int i = priority + 1; i <= value; i++)
+              {
+                var cfRule = _worksheet.ConditionalFormatting.RulesByPriority(i);
+
+                if (cfRule != null)
+                {
+                  cfRule.Priority--;
+                }
+              }
+            }
+
+            // Sinalize that we are no longer changing cfRules priorities
+            _changingPriority = false;
+          }
+
+          // Change the priority in the XML
+          SetXmlNodeString(
+            ExcelConditionalFormattingConstants.Paths.PriorityAttribute,
+            value.ToString(),
+            true);
+        }
+      }
+    }
+
+    /// <summary>
+    /// If this flag is true, no rules with lower priority shall be applied over this rule,
+    /// when this rule evaluates to true.
+    /// </summary>
+    public bool StopIfTrue
+    {
+      get
+      {
+        return GetXmlNodeBool(
+          ExcelConditionalFormattingConstants.Paths.StopIfTrueAttribute);
+      }
+      set
+      {
+        SetXmlNodeString(
+          ExcelConditionalFormattingConstants.Paths.StopIfTrueAttribute,
+          (value == true) ? "1" : string.Empty,
+          true);
+      }
+    }
+
+    /// <summary>
+    /// DxfId Style Attribute
+    /// </summary>
+    internal int DxfId
+    {
+      get
+      {
+        return GetXmlNodeInt(
+          ExcelConditionalFormattingConstants.Paths.DxfIdAttribute);
+      }
+      set
+      {
+        SetXmlNodeString(
+          ExcelConditionalFormattingConstants.Paths.DxfIdAttribute,
+          (value == int.MinValue) ? string.Empty : value.ToString(),
+          true);
+      }
+    }
+    internal ExcelDxfStyleConditionalFormatting _style = null;
+    public ExcelDxfStyleConditionalFormatting Style
+    {
+        get
+        {
+            if (_style == null)
+            {
+                _style = new ExcelDxfStyleConditionalFormatting(NameSpaceManager, null, _worksheet.Workbook.Styles);
+            }
+            return _style;
+        }
+    }
+    /// <summary>
+    /// StdDev (zero is not allowed and will be converted to 1)
+    /// </summary>
+    public UInt16 StdDev
+    {
+      get
+      {
+        return Convert.ToUInt16(GetXmlNodeInt(
+          ExcelConditionalFormattingConstants.Paths.StdDevAttribute));
+      }
+      set
+      {
+        SetXmlNodeString(
+          ExcelConditionalFormattingConstants.Paths.StdDevAttribute,
+          (value == 0) ? "1" : value.ToString(),
+          true);
+      }
+    }
+
+    /// <summary>
+    /// Rank (zero is not allowed and will be converted to 1)
+    /// </summary>
+    public UInt16 Rank
+    {
+      get
+      {
+        return Convert.ToUInt16(GetXmlNodeInt(
+          ExcelConditionalFormattingConstants.Paths.RankAttribute));
+      }
+      set
+      {
+        SetXmlNodeString(
+          ExcelConditionalFormattingConstants.Paths.RankAttribute,
+          (value == 0) ? "1" : value.ToString(),
+          true);
+      }
+    }
+    #endregion Exposed Properties
+
+    /****************************************************************************************/
+
+    #region Internal Properties
+    /// <summary>
+    /// AboveAverage
+    /// </summary>
+    internal protected bool? AboveAverage
+    {
+      get
+      {
+        bool? aboveAverage = GetXmlNodeBoolNullable(
+          ExcelConditionalFormattingConstants.Paths.AboveAverageAttribute);
+
+        // Above Avarege if TRUE or if attribute does not exists
+        return (aboveAverage == true) || (aboveAverage == null);
+      }
+      set
+      {
+        string aboveAverageValue = string.Empty;
+
+        // Only the types that needs the @AboveAverage
+        if ((_type == eExcelConditionalFormattingRuleType.BelowAverage)
+          || (_type == eExcelConditionalFormattingRuleType.BelowOrEqualAverage)
+          || (_type == eExcelConditionalFormattingRuleType.BelowStdDev))
+        {
+          aboveAverageValue = "0";
+        }
+
+        SetXmlNodeString(
+          ExcelConditionalFormattingConstants.Paths.AboveAverageAttribute,
+          aboveAverageValue,
+          true);
+      }
+    }
+
+    /// <summary>
+    /// EqualAverage
+    /// </summary>
+    internal protected bool? EqualAverage
+    {
+      get
+      {
+        bool? equalAverage = GetXmlNodeBoolNullable(
+          ExcelConditionalFormattingConstants.Paths.EqualAverageAttribute);
+
+        // Equal Avarege only if TRUE
+        return (equalAverage == true);
+      }
+      set
+      {
+        string equalAverageValue = string.Empty;
+
+        // Only the types that needs the @EqualAverage
+        if ((_type == eExcelConditionalFormattingRuleType.AboveOrEqualAverage)
+          || (_type == eExcelConditionalFormattingRuleType.BelowOrEqualAverage))
+        {
+          equalAverageValue = "1";
+        }
+
+        SetXmlNodeString(
+          ExcelConditionalFormattingConstants.Paths.EqualAverageAttribute,
+          equalAverageValue,
+          true);
+      }
+    }
+
+    /// <summary>
+    /// Bottom attribute
+    /// </summary>
+    internal protected bool? Bottom
+    {
+      get
+      {
+        bool? bottom = GetXmlNodeBoolNullable(
+          ExcelConditionalFormattingConstants.Paths.BottomAttribute);
+
+        // Bottom if TRUE
+        return (bottom == true);
+      }
+      set
+      {
+        string bottomValue = string.Empty;
+
+        // Only the types that needs the @Bottom
+        if ((_type == eExcelConditionalFormattingRuleType.Bottom)
+          || (_type == eExcelConditionalFormattingRuleType.BottomPercent))
+        {
+          bottomValue = "1";
+        }
+
+        SetXmlNodeString(
+          ExcelConditionalFormattingConstants.Paths.BottomAttribute,
+          bottomValue,
+          true);
+      }
+    }
+
+    /// <summary>
+    /// Percent attribute
+    /// </summary>
+    internal protected bool? Percent
+    {
+      get
+      {
+        bool? percent = GetXmlNodeBoolNullable(
+          ExcelConditionalFormattingConstants.Paths.PercentAttribute);
+
+        // Bottom if TRUE
+        return (percent == true);
+      }
+      set
+      {
+        string percentValue = string.Empty;
+
+        // Only the types that needs the @Bottom
+        if ((_type == eExcelConditionalFormattingRuleType.BottomPercent)
+          || (_type == eExcelConditionalFormattingRuleType.TopPercent))
+        {
+          percentValue = "1";
+        }
+
+        SetXmlNodeString(
+          ExcelConditionalFormattingConstants.Paths.PercentAttribute,
+          percentValue,
+          true);
+      }
+    }
+
+    /// <summary>
+    /// TimePeriod
+    /// </summary>
+    internal protected eExcelConditionalFormattingTimePeriodType TimePeriod
+    {
+      get
+      {
+        return ExcelConditionalFormattingTimePeriodType.GetTypeByAttribute(
+          GetXmlNodeString(ExcelConditionalFormattingConstants.Paths.TimePeriodAttribute));
+      }
+      set
+      {
+        SetXmlNodeString(
+          ExcelConditionalFormattingConstants.Paths.TimePeriodAttribute,
+          ExcelConditionalFormattingTimePeriodType.GetAttributeByType(value),
+          true);
+      }
+    }
+
+    /// <summary>
+    /// Operator
+    /// </summary>
+    internal protected eExcelConditionalFormattingOperatorType Operator
+    {
+      get
+      {
+        return ExcelConditionalFormattingOperatorType.GetTypeByAttribute(
+          GetXmlNodeString(ExcelConditionalFormattingConstants.Paths.OperatorAttribute));
+      }
+      set
+      {
+        SetXmlNodeString(
+          ExcelConditionalFormattingConstants.Paths.OperatorAttribute,
+          ExcelConditionalFormattingOperatorType.GetAttributeByType(value),
+          true);
+      }
+    }
+
+    /// <summary>
+    /// Formula
+    /// </summary>
+    public string Formula
+    {
+      get
+      {
+        return GetXmlNodeString(
+          ExcelConditionalFormattingConstants.Paths.Formula);
+      }
+      set
+      {
+        SetXmlNodeString(
+          ExcelConditionalFormattingConstants.Paths.Formula,
+          value);
+      }
+    }
+
+    /// <summary>
+    /// Formula2
+    /// </summary>
+    public string Formula2
+    {
+      get
+      {
+        return GetXmlNodeString(
+          string.Format(
+            "{0}[position()=2]",
+          // {0}
+            ExcelConditionalFormattingConstants.Paths.Formula));
+      }
+      set
+      {
+        // Create/Get the first <formula> node (ensure that it exists)
+        var firstNode = CreateComplexNode(
+          TopNode,
+          string.Format(
+            "{0}[position()=1]",
+          // {0}
+            ExcelConditionalFormattingConstants.Paths.Formula));
+
+        // Create/Get the seconde <formula> node (ensure that it exists)
+        var secondNode = CreateComplexNode(
+          TopNode,
+          string.Format(
+            "{0}[position()=2]",
+          // {0}
+            ExcelConditionalFormattingConstants.Paths.Formula));
+
+        // Save the formula in the second <formula> node
+        secondNode.InnerText = value;
+      }
+    }
+    #endregion Internal Properties
+    /****************************************************************************************/
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingThisMonth.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingThisMonth.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingThisMonth.cs	(revision 12707)
@@ -0,0 +1,124 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Eyal Seagull        Added       		  2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Drawing;
+using System.Xml;
+using OfficeOpenXml.ConditionalFormatting.Contracts;
+
+namespace OfficeOpenXml.ConditionalFormatting
+{
+  /// <summary>
+  /// ExcelConditionalFormattingThisMonth
+  /// </summary>
+  public class ExcelConditionalFormattingThisMonth
+    : ExcelConditionalFormattingTimePeriodGroup
+  {
+    /****************************************************************************************/
+
+    #region Constructors
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    /// <param name="namespaceManager"></param>
+    internal ExcelConditionalFormattingThisMonth(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode,
+      XmlNamespaceManager namespaceManager)
+      : base(
+        eExcelConditionalFormattingRuleType.ThisMonth,
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        (namespaceManager == null) ? worksheet.NameSpaceManager : namespaceManager)
+    {
+        if (itemElementNode==null) //Set default values and create attributes if needed
+        {
+            TimePeriod = eExcelConditionalFormattingTimePeriodType.ThisMonth;
+            Formula = string.Format(
+              "AND(MONTH({0})=MONTH(TODAY()), YEAR({0})=YEAR(TODAY()))",
+              Address.Start.Address);
+        }
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    internal ExcelConditionalFormattingThisMonth(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode)
+      : this(
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        null)
+    {
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    internal ExcelConditionalFormattingThisMonth(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet)
+      : this(
+        address,
+        priority,
+        worksheet,
+        null,
+        null)
+    {
+    }
+    #endregion Constructors
+
+    /****************************************************************************************/
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingThisWeek.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingThisWeek.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingThisWeek.cs	(revision 12707)
@@ -0,0 +1,124 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Eyal Seagull        Added       		  2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Drawing;
+using System.Xml;
+using OfficeOpenXml.ConditionalFormatting.Contracts;
+
+namespace OfficeOpenXml.ConditionalFormatting
+{
+  /// <summary>
+  /// ExcelConditionalFormattingThisWeek
+  /// </summary>
+  public class ExcelConditionalFormattingThisWeek
+    : ExcelConditionalFormattingTimePeriodGroup
+  {
+    /****************************************************************************************/
+
+    #region Constructors
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    /// <param name="namespaceManager"></param>
+    internal ExcelConditionalFormattingThisWeek(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode,
+      XmlNamespaceManager namespaceManager)
+      : base(
+        eExcelConditionalFormattingRuleType.ThisWeek,
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        (namespaceManager == null) ? worksheet.NameSpaceManager : namespaceManager)
+    {
+        if (itemElementNode==null) //Set default values and create attributes if needed
+        {
+            TimePeriod = eExcelConditionalFormattingTimePeriodType.ThisWeek;
+            Formula = string.Format(
+              "AND(TODAY()-ROUNDDOWN({0},0)<=WEEKDAY(TODAY())-1,ROUNDDOWN({0},0)-TODAY()<=7-WEEKDAY(TODAY()))",
+              Address.Start.Address);
+        }
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    internal ExcelConditionalFormattingThisWeek(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode)
+      : this(
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        null)
+    {
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    internal ExcelConditionalFormattingThisWeek(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet)
+      : this(
+        address,
+        priority,
+        worksheet,
+        null,
+        null)
+    {
+    }
+    #endregion Constructors
+
+    /****************************************************************************************/
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingThreeColorScale.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingThreeColorScale.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingThreeColorScale.cs	(revision 12707)
@@ -0,0 +1,207 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Eyal Seagull        Added       		  2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Drawing;
+using System.Xml;
+using OfficeOpenXml.ConditionalFormatting.Contracts;
+
+namespace OfficeOpenXml.ConditionalFormatting
+{
+  /// <summary>
+  /// ExcelConditionalFormattingThreeColorScale
+  /// </summary>
+  public class ExcelConditionalFormattingThreeColorScale
+    : ExcelConditionalFormattingRule,
+    IExcelConditionalFormattingThreeColorScale
+  {
+    /****************************************************************************************/
+
+    #region Private Properties
+    /// <summary>
+    /// Private Low Value
+    /// </summary>
+    private ExcelConditionalFormattingColorScaleValue _lowValue;
+
+    /// <summary>
+    /// Private Middle Value
+    /// </summary>
+    private ExcelConditionalFormattingColorScaleValue _middleValue;
+
+    /// <summary>
+    /// Private High Value
+    /// </summary>
+    private ExcelConditionalFormattingColorScaleValue _highValue;
+    #endregion Private Properties
+
+    /****************************************************************************************/
+
+    #region Constructors
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="address"></param>
+    /// <param name="priority"></param>
+     /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    /// <param name="namespaceManager"></param>
+    internal ExcelConditionalFormattingThreeColorScale(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode,
+      XmlNamespaceManager namespaceManager)
+      : base(
+        eExcelConditionalFormattingRuleType.ThreeColorScale,
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        (namespaceManager == null) ? worksheet.NameSpaceManager : namespaceManager)
+    {
+      // Create the <colorScale> node inside the <cfRule> node
+      var colorScaleNode = CreateComplexNode(
+        Node,
+        ExcelConditionalFormattingConstants.Paths.ColorScale);
+
+      // LowValue default
+      LowValue = new ExcelConditionalFormattingColorScaleValue(
+        eExcelConditionalFormattingValueObjectPosition.Low,
+        eExcelConditionalFormattingValueObjectType.Min,
+        ColorTranslator.FromHtml(ExcelConditionalFormattingConstants.Colors.CfvoLowValue),
+        eExcelConditionalFormattingRuleType.ThreeColorScale,
+        address,
+        priority,
+        worksheet,
+        NameSpaceManager);
+
+      // MiddleValue default
+      MiddleValue = new ExcelConditionalFormattingColorScaleValue(
+        eExcelConditionalFormattingValueObjectPosition.Middle,
+        eExcelConditionalFormattingValueObjectType.Percent,
+        ColorTranslator.FromHtml(ExcelConditionalFormattingConstants.Colors.CfvoMiddleValue),
+        50,
+        string.Empty,
+        eExcelConditionalFormattingRuleType.ThreeColorScale,
+        address,
+        priority,
+        worksheet,
+        NameSpaceManager);
+
+      // HighValue default
+      HighValue = new ExcelConditionalFormattingColorScaleValue(
+        eExcelConditionalFormattingValueObjectPosition.High,
+        eExcelConditionalFormattingValueObjectType.Max,
+        ColorTranslator.FromHtml(ExcelConditionalFormattingConstants.Colors.CfvoHighValue),
+        eExcelConditionalFormattingRuleType.ThreeColorScale,
+        address,
+        priority,
+        worksheet,
+        NameSpaceManager);
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    internal ExcelConditionalFormattingThreeColorScale(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode)
+      : this(
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        null)
+    {
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    internal ExcelConditionalFormattingThreeColorScale(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet)
+      : this(
+        address,
+        priority,
+        worksheet,
+        null,
+        null)
+    {
+    }
+    #endregion Constructors
+
+    /****************************************************************************************/
+
+    #region Public Properties
+    /// <summary>
+    /// Low Value for Three Color Scale Object Value
+    /// </summary>
+    public ExcelConditionalFormattingColorScaleValue LowValue
+    {
+      get { return _lowValue; }
+      set { _lowValue = value; }
+    }
+
+    /// <summary>
+    /// Middle Value for Three Color Scale Object Value
+    /// </summary>
+    public ExcelConditionalFormattingColorScaleValue MiddleValue
+    {
+      get { return _middleValue; }
+      set { _middleValue = value; }
+    }
+
+    /// <summary>
+    /// High Value for Three Color Scale Object Value
+    /// </summary>
+    public ExcelConditionalFormattingColorScaleValue HighValue
+    {
+      get { return _highValue; }
+      set { _highValue = value; }
+    }
+    #endregion Public Properties
+
+    /****************************************************************************************/
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingThreeIconSet.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingThreeIconSet.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingThreeIconSet.cs	(revision 12707)
@@ -0,0 +1,380 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Eyal Seagull        Added       		  2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Drawing;
+using System.Xml;
+using OfficeOpenXml.ConditionalFormatting.Contracts;
+
+namespace OfficeOpenXml.ConditionalFormatting
+{
+    public class ExcelConditionalFormattingThreeIconSet : ExcelConditionalFormattingIconSetBase<eExcelconditionalFormatting3IconsSetType>
+    {
+        internal ExcelConditionalFormattingThreeIconSet(
+        ExcelAddress address,
+        int priority,
+        ExcelWorksheet worksheet,
+        XmlNode itemElementNode,
+        XmlNamespaceManager namespaceManager)
+            : base(
+              eExcelConditionalFormattingRuleType.ThreeIconSet,
+              address,
+              priority,
+              worksheet,
+              itemElementNode,
+              (namespaceManager == null) ? worksheet.NameSpaceManager : namespaceManager)
+        {
+        }
+    }
+    /// <summary>
+    /// ExcelConditionalFormattingThreeIconSet
+    /// </summary>
+    public class ExcelConditionalFormattingIconSetBase<T>
+      : ExcelConditionalFormattingRule,
+        IExcelConditionalFormattingThreeIconSet<T>
+    {
+        /****************************************************************************************/
+
+        #region Private Properties
+
+        #endregion Private Properties
+
+        /****************************************************************************************/
+
+        #region Constructors
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="type"></param>
+        /// <param name="address"></param>
+        /// <param name="priority"></param>
+        /// <param name="worksheet"></param>
+        /// <param name="itemElementNode"></param>
+        /// <param name="namespaceManager"></param>
+        internal ExcelConditionalFormattingIconSetBase(
+          eExcelConditionalFormattingRuleType type,
+          ExcelAddress address,
+          int priority,
+          ExcelWorksheet worksheet,
+          XmlNode itemElementNode,
+          XmlNamespaceManager namespaceManager)
+            : base(
+              type,
+              address,
+              priority,
+              worksheet,
+              itemElementNode,
+              (namespaceManager == null) ? worksheet.NameSpaceManager : namespaceManager)
+        {
+            if (itemElementNode != null && itemElementNode.HasChildNodes)
+            {
+                int pos = 1;
+                foreach (XmlNode node in itemElementNode.SelectNodes("d:iconSet/d:cfvo", NameSpaceManager))
+                {
+                    if(pos==1)
+                    {
+                        Icon1 = new ExcelConditionalFormattingIconDataBarValue(
+                                type,
+                                address,
+                                worksheet,
+                                node,
+                                namespaceManager);
+                    }
+                    else if (pos == 2)
+                    {
+                        Icon2 = new ExcelConditionalFormattingIconDataBarValue(
+                                type,
+                                address,
+                                worksheet,
+                                node,
+                                namespaceManager);
+                    }
+                    else if (pos == 3)
+                    {
+                        Icon3 = new ExcelConditionalFormattingIconDataBarValue(
+                                type,
+                                address,
+                                worksheet,
+                                node,
+                                namespaceManager);
+                    }
+                    else
+                    {
+                        break;
+                    }
+                    pos++;
+                }
+            }
+            else
+            {
+                var iconSetNode = CreateComplexNode(
+                  Node,
+                  ExcelConditionalFormattingConstants.Paths.IconSet);
+
+                //Create the <iconSet> node inside the <cfRule> node
+                double spann;
+                if (type == eExcelConditionalFormattingRuleType.ThreeIconSet)
+                {
+                    spann = 3;
+                }
+                else if (type == eExcelConditionalFormattingRuleType.FourIconSet)
+                {
+                    spann = 4;
+                }
+                else
+                {
+                    spann = 5;
+                }
+
+                var iconNode1 = iconSetNode.OwnerDocument.CreateElement(ExcelConditionalFormattingConstants.Paths.Cfvo, ExcelPackage.schemaMain);
+                iconSetNode.AppendChild(iconNode1);
+                Icon1 = new ExcelConditionalFormattingIconDataBarValue(eExcelConditionalFormattingValueObjectType.Percent,
+                        0,
+                        "",
+                        eExcelConditionalFormattingRuleType.ThreeIconSet,
+                        address,
+                        priority,
+                        worksheet,
+                        iconNode1,
+                        namespaceManager);
+
+                var iconNode2 = iconSetNode.OwnerDocument.CreateElement(ExcelConditionalFormattingConstants.Paths.Cfvo, ExcelPackage.schemaMain);
+                iconSetNode.AppendChild(iconNode2);
+                Icon2 = new ExcelConditionalFormattingIconDataBarValue(eExcelConditionalFormattingValueObjectType.Percent,
+                        Math.Round(100D / spann, 0),
+                        "",
+                        eExcelConditionalFormattingRuleType.ThreeIconSet,
+                        address,
+                        priority,
+                        worksheet,
+                        iconNode2,
+                        namespaceManager);
+
+                var iconNode3 = iconSetNode.OwnerDocument.CreateElement(ExcelConditionalFormattingConstants.Paths.Cfvo, ExcelPackage.schemaMain);
+                iconSetNode.AppendChild(iconNode3);
+                Icon3 = new ExcelConditionalFormattingIconDataBarValue(eExcelConditionalFormattingValueObjectType.Percent,
+                        Math.Round(100D * (2D / spann), 0),
+                        "",
+                        eExcelConditionalFormattingRuleType.ThreeIconSet,
+                        address,
+                        priority,
+                        worksheet,
+                        iconNode3,
+                        namespaceManager);
+                Type = type;
+            }
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        ///<param name="type"></param>
+        /// <param name="priority"></param>
+        /// <param name="address"></param>
+        /// <param name="worksheet"></param>
+        /// <param name="itemElementNode"></param>
+        internal ExcelConditionalFormattingIconSetBase(
+          eExcelConditionalFormattingRuleType type,
+          ExcelAddress address,
+          int priority,
+          ExcelWorksheet worksheet,
+          XmlNode itemElementNode)
+            : this(
+              type,
+              address,
+              priority,
+              worksheet,
+              itemElementNode,
+              null)
+        {
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        ///<param name="type"></param>
+        /// <param name="priority"></param>
+        /// <param name="address"></param>
+        /// <param name="worksheet"></param>
+        internal ExcelConditionalFormattingIconSetBase(
+          eExcelConditionalFormattingRuleType type,
+          ExcelAddress address,
+          int priority,
+          ExcelWorksheet worksheet)
+            : this(
+              type,
+              address,
+              priority,
+              worksheet,
+              null,
+              null)
+        {
+        }
+        #endregion Constructors
+
+        /// <summary>
+        /// Settings for icon 1 in the iconset
+        /// </summary>
+        public ExcelConditionalFormattingIconDataBarValue Icon1
+        {
+            get;
+            internal set;
+        }
+
+        /// <summary>
+        /// Settings for icon 2 in the iconset
+        /// </summary>
+        public ExcelConditionalFormattingIconDataBarValue Icon2
+        {
+            get;
+            internal set;
+        }
+        /// <summary>
+        /// Settings for icon 2 in the iconset
+        /// </summary>
+        public ExcelConditionalFormattingIconDataBarValue Icon3
+        {
+            get;
+            internal set;
+        }
+        private const string _reversePath = "d:iconSet/@reverse";
+        /// <summary>
+        /// Reverse the order of the icons
+        /// </summary>
+        public bool Reverse
+        {
+            get
+            {
+                return GetXmlNodeBool(_reversePath, false);
+            }
+            set
+            {
+                SetXmlNodeBool(_reversePath, value);
+            }
+        }
+
+        private const string _showValuePath = "d:iconSet/@showValue";
+        /// <summary>
+        /// If the cell values are visible
+        /// </summary>
+        public bool ShowValue
+        {
+            get
+            {
+                return GetXmlNodeBool(_showValuePath, true);
+            }
+            set
+            {
+                SetXmlNodeBool(_showValuePath, value);
+            }
+        }
+        private const string _iconSetPath = "d:iconSet/@iconSet";
+        /// <summary>
+        /// Type of iconset
+        /// </summary>
+        public T IconSet
+        {
+            get
+            {
+                var v = GetXmlNodeString(_iconSetPath);
+                v = v.Substring(1); //Skip first icon.
+                return (T)Enum.Parse(typeof(T), v, true);
+            }
+            set
+            {
+                SetXmlNodeString(_iconSetPath, GetIconSetString(value));
+            }
+        }
+        private string GetIconSetString(T value)
+        {
+            if (Type == eExcelConditionalFormattingRuleType.FourIconSet)
+            {
+                switch (value.ToString())
+                {
+                    case "Arrows":
+                        return "4Arrows";
+                    case "ArrowsGray":
+                        return "4ArrowsGray";
+                    case "Rating":
+                        return "4Rating";
+                    case "RedToBlack":
+                        return "4RedToBlack";
+                    case "TrafficLights":
+                        return "4TrafficLights";
+                    default:
+                        throw (new ArgumentException("Invalid type"));
+                }
+            }
+            else if (Type == eExcelConditionalFormattingRuleType.FiveIconSet)
+            {
+                switch (value.ToString())
+                {
+                    case "Arrows":
+                        return "5Arrows";
+                    case "ArrowsGray":
+                        return "5ArrowsGray";
+                    case "Quarters":
+                        return "5Quarters";
+                    case "Rating":
+                        return "5Rating";
+                    default:
+                        throw (new ArgumentException("Invalid type"));
+                }
+            }
+            else
+            {
+                switch (value.ToString())
+                {
+                    case "Arrows":
+                        return "3Arrows";
+                    case "ArrowsGray":
+                        return "3ArrowsGray";
+                    case "Flags":
+                        return "3Flags";
+                    case "Signs":
+                        return "3Signs";
+                    case "Symbols":
+                        return "3Symbols";
+                    case "Symbols2":
+                        return "3Symbols2";
+                    case "TrafficLights1":
+                        return "3TrafficLights1";
+                    case "TrafficLights2":
+                        return "3TrafficLights2";
+                    default:
+                        throw (new ArgumentException("Invalid type"));
+                }
+            }
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingTimePeriodGroup.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingTimePeriodGroup.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingTimePeriodGroup.cs	(revision 12707)
@@ -0,0 +1,126 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Eyal Seagull        Added       		  2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Drawing;
+using System.Xml;
+using OfficeOpenXml.ConditionalFormatting.Contracts;
+
+namespace OfficeOpenXml.ConditionalFormatting
+{
+  /// <summary>
+  /// ExcelConditionalFormattingTimePeriodGroup
+  /// </summary>
+  public class ExcelConditionalFormattingTimePeriodGroup
+    : ExcelConditionalFormattingRule,
+    IExcelConditionalFormattingTimePeriodGroup
+  {
+    /****************************************************************************************/
+
+    #region Constructors
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="type"></param>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    /// <param name="namespaceManager"></param>
+    internal ExcelConditionalFormattingTimePeriodGroup(
+      eExcelConditionalFormattingRuleType type,
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode,
+      XmlNamespaceManager namespaceManager)
+      : base(
+        type,
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        (namespaceManager == null) ? worksheet.NameSpaceManager : namespaceManager)
+    {
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+      /// <param name="type"></param>
+      /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    internal ExcelConditionalFormattingTimePeriodGroup(
+      eExcelConditionalFormattingRuleType type,
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode)
+      : this(
+        type,
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        null)
+    {
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="type"></param>
+    /// <param name="address"></param>
+    /// <param name="priority"></param>
+    /// <param name="worksheet"></param>
+    internal ExcelConditionalFormattingTimePeriodGroup(
+      eExcelConditionalFormattingRuleType type,
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet)
+      : this(
+        type,
+        address,
+        priority,
+        worksheet,
+        null,
+        null)
+    {
+    }
+    #endregion Constructors
+
+    /****************************************************************************************/
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingToday.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingToday.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingToday.cs	(revision 12707)
@@ -0,0 +1,124 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Eyal Seagull        Added       		  2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Drawing;
+using System.Xml;
+using OfficeOpenXml.ConditionalFormatting.Contracts;
+
+namespace OfficeOpenXml.ConditionalFormatting
+{
+  /// <summary>
+  /// ExcelConditionalFormattingToday
+  /// </summary>
+  public class ExcelConditionalFormattingToday
+    : ExcelConditionalFormattingTimePeriodGroup
+  {
+    /****************************************************************************************/
+
+    #region Constructors
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    /// <param name="namespaceManager"></param>
+    internal ExcelConditionalFormattingToday(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode,
+      XmlNamespaceManager namespaceManager)
+      : base(
+        eExcelConditionalFormattingRuleType.Today,
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        (namespaceManager == null) ? worksheet.NameSpaceManager : namespaceManager)
+    {
+        if (itemElementNode==null) //Set default values and create attributes if needed
+        {
+            TimePeriod = eExcelConditionalFormattingTimePeriodType.Today;
+            Formula = string.Format(
+              "FLOOR({0},1)=TODAY()",
+              Address.Start.Address);
+        }
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    internal ExcelConditionalFormattingToday(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode)
+      : this(
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        null)
+    {
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    internal ExcelConditionalFormattingToday(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet)
+      : this(
+        address,
+        priority,
+        worksheet,
+        null,
+        null)
+    {
+    }
+    #endregion Constructors
+
+    /****************************************************************************************/
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingTomorrow.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingTomorrow.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingTomorrow.cs	(revision 12707)
@@ -0,0 +1,124 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Eyal Seagull        Added       		  2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Drawing;
+using System.Xml;
+using OfficeOpenXml.ConditionalFormatting.Contracts;
+
+namespace OfficeOpenXml.ConditionalFormatting
+{
+  /// <summary>
+  /// ExcelConditionalFormattingTomorrow
+  /// </summary>
+  public class ExcelConditionalFormattingTomorrow
+    : ExcelConditionalFormattingTimePeriodGroup
+  {
+    /****************************************************************************************/
+
+    #region Constructors
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    /// <param name="namespaceManager"></param>
+    internal ExcelConditionalFormattingTomorrow(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode,
+      XmlNamespaceManager namespaceManager)
+      : base(
+        eExcelConditionalFormattingRuleType.Tomorrow,
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        (namespaceManager == null) ? worksheet.NameSpaceManager : namespaceManager)
+    {
+        if (itemElementNode==null) //Set default values and create attributes if needed
+        {
+            TimePeriod = eExcelConditionalFormattingTimePeriodType.Tomorrow;
+            Formula = string.Format(
+              "FLOOR({0},1)=TODAY()+1",
+              Address.Start.Address);
+        }
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    internal ExcelConditionalFormattingTomorrow(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode)
+      : this(
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        null)
+    {
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    internal ExcelConditionalFormattingTomorrow(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet)
+      : this(
+        address,
+        priority,
+        worksheet,
+        null,
+        null)
+    {
+    }
+    #endregion Constructors
+
+    /****************************************************************************************/
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingTop.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingTop.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingTop.cs	(revision 12707)
@@ -0,0 +1,124 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Eyal Seagull        Added       		  2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Drawing;
+using System.Xml;
+using OfficeOpenXml.ConditionalFormatting.Contracts;
+
+namespace OfficeOpenXml.ConditionalFormatting
+{
+  /// <summary>
+  /// ExcelConditionalFormattingTop
+  /// </summary>
+  public class ExcelConditionalFormattingTop
+    : ExcelConditionalFormattingRule,
+    IExcelConditionalFormattingTopBottomGroup
+  {
+    /****************************************************************************************/
+
+    #region Constructors
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    /// <param name="namespaceManager"></param>
+    internal ExcelConditionalFormattingTop(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode,
+      XmlNamespaceManager namespaceManager)
+      : base(
+        eExcelConditionalFormattingRuleType.Top,
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        (namespaceManager == null) ? worksheet.NameSpaceManager : namespaceManager)
+    {
+        if (itemElementNode==null) //Set default values and create attributes if needed
+        {
+            Bottom = false;
+            Percent = false;
+            Rank = 10;  // First 10 values
+        }
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    internal ExcelConditionalFormattingTop(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode)
+      : this(
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        null)
+    {
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    internal ExcelConditionalFormattingTop(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet)
+      : this(
+        address,
+        priority,
+        worksheet,
+        null,
+        null)
+    {
+    }
+    #endregion Constructors
+
+    /****************************************************************************************/
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingTopPercent.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingTopPercent.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingTopPercent.cs	(revision 12707)
@@ -0,0 +1,124 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Eyal Seagull        Added       		  2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Drawing;
+using System.Xml;
+using OfficeOpenXml.ConditionalFormatting.Contracts;
+
+namespace OfficeOpenXml.ConditionalFormatting
+{
+  /// <summary>
+  /// ExcelConditionalFormattingTopPercent
+  /// </summary>
+  public class ExcelConditionalFormattingTopPercent
+    : ExcelConditionalFormattingRule,
+    IExcelConditionalFormattingTopBottomGroup
+  {
+    /****************************************************************************************/
+
+    #region Constructors
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    /// <param name="namespaceManager"></param>
+    internal ExcelConditionalFormattingTopPercent(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode,
+      XmlNamespaceManager namespaceManager)
+      : base(
+        eExcelConditionalFormattingRuleType.TopPercent,
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        (namespaceManager == null) ? worksheet.NameSpaceManager : namespaceManager)
+    {
+        if (itemElementNode==null) //Set default values and create attributes if needed
+        {
+            Bottom = false;
+            Percent = true;
+            Rank = 10;  // First 10 percent
+        }
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    internal ExcelConditionalFormattingTopPercent(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode)
+      : this(
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        null)
+    {
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    internal ExcelConditionalFormattingTopPercent(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet)
+      : this(
+        address,
+        priority,
+        worksheet,
+        null,
+        null)
+    {
+    }
+    #endregion Constructors
+
+    /****************************************************************************************/
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingTwoColorScale.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingTwoColorScale.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingTwoColorScale.cs	(revision 12707)
@@ -0,0 +1,180 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Eyal Seagull        Added       		  2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Drawing;
+using System.Xml;
+using OfficeOpenXml.ConditionalFormatting.Contracts;
+
+namespace OfficeOpenXml.ConditionalFormatting
+{
+  /// <summary>
+  /// ExcelConditionalFormattingTwoColorScale
+  /// </summary>
+  public class ExcelConditionalFormattingTwoColorScale
+    : ExcelConditionalFormattingRule,
+    IExcelConditionalFormattingTwoColorScale
+  {
+    /****************************************************************************************/
+
+    #region Private Properties
+    /// <summary>
+    /// Private Low Value
+    /// </summary>
+    private ExcelConditionalFormattingColorScaleValue _lowValue;
+
+    /// <summary>
+    /// Private High Value
+    /// </summary>
+    private ExcelConditionalFormattingColorScaleValue _highValue;
+    #endregion Private Properties
+
+    /****************************************************************************************/
+
+    #region Constructors
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    /// <param name="namespaceManager"></param>
+    internal ExcelConditionalFormattingTwoColorScale(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode,
+      XmlNamespaceManager namespaceManager)
+      : base(
+        eExcelConditionalFormattingRuleType.TwoColorScale,
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        (namespaceManager == null) ? worksheet.NameSpaceManager : namespaceManager)
+    {
+      // Create the <colorScale> node inside the <cfRule> node
+      var colorScaleNode = CreateComplexNode(
+        Node,
+        ExcelConditionalFormattingConstants.Paths.ColorScale);
+
+      // LowValue default
+      LowValue = new ExcelConditionalFormattingColorScaleValue(
+        eExcelConditionalFormattingValueObjectPosition.Low,
+        eExcelConditionalFormattingValueObjectType.Min,
+        ColorTranslator.FromHtml(ExcelConditionalFormattingConstants.Colors.CfvoLowValue),
+        eExcelConditionalFormattingRuleType.TwoColorScale,
+        address,
+        priority,
+        worksheet,
+        NameSpaceManager);
+
+      // HighValue default
+      HighValue = new ExcelConditionalFormattingColorScaleValue(
+        eExcelConditionalFormattingValueObjectPosition.High,
+        eExcelConditionalFormattingValueObjectType.Max,
+        ColorTranslator.FromHtml(ExcelConditionalFormattingConstants.Colors.CfvoHighValue),
+        eExcelConditionalFormattingRuleType.TwoColorScale,
+        address,
+        priority,
+        worksheet,
+        NameSpaceManager);
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    internal ExcelConditionalFormattingTwoColorScale(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode)
+      : this(
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        null)
+    {
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    internal ExcelConditionalFormattingTwoColorScale(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet)
+      : this(
+        address,
+        priority,
+        worksheet,
+        null,
+        null)
+    {
+    }
+    #endregion Constructors
+
+    /****************************************************************************************/
+
+    #region Public Properties
+    /// <summary>
+    /// Low Value for Two Color Scale Object Value
+    /// </summary>
+    public ExcelConditionalFormattingColorScaleValue LowValue
+    {
+      get { return _lowValue; }
+      set { _lowValue = value; }
+    }
+
+    /// <summary>
+    /// High Value for Two Color Scale Object Value
+    /// </summary>
+    public ExcelConditionalFormattingColorScaleValue HighValue
+    {
+      get { return _highValue; }
+      set { _highValue = value; }
+    }
+    #endregion Public Properties
+
+    /****************************************************************************************/
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingUniqueValues.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingUniqueValues.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingUniqueValues.cs	(revision 12707)
@@ -0,0 +1,118 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Eyal Seagull        Added       		  2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Drawing;
+using System.Xml;
+using OfficeOpenXml.ConditionalFormatting.Contracts;
+
+namespace OfficeOpenXml.ConditionalFormatting
+{
+  /// <summary>
+  /// ExcelConditionalFormattingUniqueValues
+  /// </summary>
+  public class ExcelConditionalFormattingUniqueValues
+    : ExcelConditionalFormattingRule,
+    IExcelConditionalFormattingUniqueValues
+  {
+    /****************************************************************************************/
+
+    #region Constructors
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="address"></param>
+    /// <param name="priority"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    /// <param name="namespaceManager"></param>
+    internal ExcelConditionalFormattingUniqueValues(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode,
+      XmlNamespaceManager namespaceManager)
+      : base(
+        eExcelConditionalFormattingRuleType.UniqueValues,
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        (namespaceManager == null) ? worksheet.NameSpaceManager : namespaceManager)
+    {
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    internal ExcelConditionalFormattingUniqueValues(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode)
+      : this(
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        null)
+    {
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    internal ExcelConditionalFormattingUniqueValues(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet)
+      : this(
+        address,
+        priority,
+        worksheet,
+        null,
+        null)
+    {
+    }
+    #endregion Constructors
+
+    /****************************************************************************************/
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingYesterday.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingYesterday.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ConditionalFormatting/Rules/ExcelConditionalFormattingYesterday.cs	(revision 12707)
@@ -0,0 +1,124 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Eyal Seagull        Added       		  2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Drawing;
+using System.Xml;
+using OfficeOpenXml.ConditionalFormatting.Contracts;
+
+namespace OfficeOpenXml.ConditionalFormatting
+{
+  /// <summary>
+  /// ExcelConditionalFormattingYesterday
+  /// </summary>
+  public class ExcelConditionalFormattingYesterday
+    : ExcelConditionalFormattingTimePeriodGroup
+  {
+    /****************************************************************************************/
+
+    #region Constructors
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    /// <param name="namespaceManager"></param>
+    internal ExcelConditionalFormattingYesterday(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode,
+      XmlNamespaceManager namespaceManager)
+      : base(
+        eExcelConditionalFormattingRuleType.Yesterday,
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        (namespaceManager == null) ? worksheet.NameSpaceManager : namespaceManager)
+    {
+        if (itemElementNode==null) //Set default values and create attributes if needed
+        {
+            TimePeriod = eExcelConditionalFormattingTimePeriodType.Yesterday;
+            Formula = string.Format(
+              "FLOOR({0},1)=TODAY()-1",
+              Address.Start.Address);
+        }
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    /// <param name="itemElementNode"></param>
+    internal ExcelConditionalFormattingYesterday(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet,
+      XmlNode itemElementNode)
+      : this(
+        address,
+        priority,
+        worksheet,
+        itemElementNode,
+        null)
+    {
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    /// <param name="priority"></param>
+    /// <param name="address"></param>
+    /// <param name="worksheet"></param>
+    internal ExcelConditionalFormattingYesterday(
+      ExcelAddress address,
+      int priority,
+      ExcelWorksheet worksheet)
+      : this(
+        address,
+        priority,
+        worksheet,
+        null,
+        null)
+    {
+    }
+    #endregion Constructors
+
+    /****************************************************************************************/
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Contracts/IExcelDataValidation.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Contracts/IExcelDataValidation.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Contracts/IExcelDataValidation.cs	(revision 12707)
@@ -0,0 +1,95 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2011-01-08
+ * Jan Källman		    License changed GPL-->LGPL  2011-12-27
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.DataValidation.Contracts
+{
+    /// <summary>
+    /// Interface for data validation
+    /// </summary>
+    public interface IExcelDataValidation
+    {
+        /// <summary>
+        /// Address of data validation
+        /// </summary>
+        ExcelAddress Address { get; }
+        /// <summary>
+        /// Validation type
+        /// </summary>
+        ExcelDataValidationType ValidationType { get; }
+        /// <summary>
+        /// Controls how Excel will handle invalid values.
+        /// </summary>
+        ExcelDataValidationWarningStyle ErrorStyle{ get; set; }
+        /// <summary>
+        /// True if input message should be shown
+        /// </summary>
+        bool? AllowBlank { get; set; }
+        /// <summary>
+        /// True if input message should be shown
+        /// </summary>
+        bool? ShowInputMessage { get; set; }
+        /// <summary>
+        /// True if error message should be shown.
+        /// </summary>
+        bool? ShowErrorMessage { get; set; }
+        /// <summary>
+        /// Title of error message box (see property ShowErrorMessage)
+        /// </summary>
+        string ErrorTitle { get; set; }
+        /// <summary>
+        /// Error message box text (see property ShowErrorMessage)
+        /// </summary>
+        string Error { get; set; }
+        /// <summary>
+        /// Title of info box if input message should be shown (see property ShowInputMessage)
+        /// </summary>
+        string PromptTitle { get; set; }
+        /// <summary>
+        /// Info message text (see property ShowErrorMessage)
+        /// </summary>
+        string Prompt { get; set; }
+        /// <summary>
+        /// True if the current validation type allows operator.
+        /// </summary>
+        bool AllowsOperator { get; }
+        /// <summary>
+        /// Validates the state of the validation.
+        /// </summary>
+        void Validate();
+
+
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Contracts/IExcelDataValidationAny.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Contracts/IExcelDataValidationAny.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Contracts/IExcelDataValidationAny.cs	(revision 12707)
@@ -0,0 +1,45 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Raziq York   		            Added       		        2014-08-08
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.DataValidation.Formulas.Contracts;
+
+namespace OfficeOpenXml.DataValidation.Contracts
+{
+    /// <summary>
+    /// Data validation interface for Any value validation.
+    /// </summary>
+    public interface IExcelDataValidationAny : IExcelDataValidation
+    {
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Contracts/IExcelDataValidationCustom.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Contracts/IExcelDataValidationCustom.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Contracts/IExcelDataValidationCustom.cs	(revision 12707)
@@ -0,0 +1,46 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2011-01-08
+ * Jan Källman		    License changed GPL-->LGPL  2011-12-27
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.DataValidation.Formulas.Contracts;
+
+namespace OfficeOpenXml.DataValidation.Contracts
+{
+    /// <summary>
+    /// Data validation interface for custom validation.
+    /// </summary>
+    public interface IExcelDataValidationCustom : IExcelDataValidationWithFormula<IExcelDataValidationFormula>, IExcelDataValidationWithOperator
+    {
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Contracts/IExcelDataValidationDateTime.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Contracts/IExcelDataValidationDateTime.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Contracts/IExcelDataValidationDateTime.cs	(revision 12707)
@@ -0,0 +1,46 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2011-01-08
+ * Jan Källman		    License changed GPL-->LGPL  2011-12-27
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.DataValidation.Formulas.Contracts;
+
+namespace OfficeOpenXml.DataValidation.Contracts
+{
+    /// <summary>
+    /// Validation interface for datetime validations
+    /// </summary>
+    public interface IExcelDataValidationDateTime : IExcelDataValidationWithFormula2<IExcelDataValidationFormulaDateTime>, IExcelDataValidationWithOperator
+    {
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Contracts/IExcelDataValidationDecimal.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Contracts/IExcelDataValidationDecimal.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Contracts/IExcelDataValidationDecimal.cs	(revision 12707)
@@ -0,0 +1,46 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2011-01-08
+ * Jan Källman		    License changed GPL-->LGPL  2011-12-27
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.DataValidation.Formulas.Contracts;
+
+namespace OfficeOpenXml.DataValidation.Contracts
+{
+    /// <summary>
+    /// Data validation interface for decimal values
+    /// </summary>
+    public interface IExcelDataValidationDecimal : IExcelDataValidationWithFormula2<IExcelDataValidationFormulaDecimal>, IExcelDataValidationWithOperator
+    {
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Contracts/IExcelDataValidationInt.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Contracts/IExcelDataValidationInt.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Contracts/IExcelDataValidationInt.cs	(revision 12707)
@@ -0,0 +1,43 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2011-01-08
+ * Jan Källman		    License changed GPL-->LGPL  2011-12-27
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.DataValidation.Formulas.Contracts;
+
+namespace OfficeOpenXml.DataValidation.Contracts
+{
+    public interface IExcelDataValidationInt : IExcelDataValidationWithFormula2<IExcelDataValidationFormulaInt>, IExcelDataValidationWithOperator
+    {
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Contracts/IExcelDataValidationList.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Contracts/IExcelDataValidationList.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Contracts/IExcelDataValidationList.cs	(revision 12707)
@@ -0,0 +1,43 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2011-01-08
+ * Jan Källman		    License changed GPL-->LGPL  2011-12-27
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.DataValidation.Formulas.Contracts;
+
+namespace OfficeOpenXml.DataValidation.Contracts
+{
+    public interface IExcelDataValidationList : IExcelDataValidationWithFormula<IExcelDataValidationFormulaList>
+    {
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Contracts/IExcelDataValidationTime.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Contracts/IExcelDataValidationTime.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Contracts/IExcelDataValidationTime.cs	(revision 12707)
@@ -0,0 +1,46 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2011-01-08
+ * Jan Källman		    License changed GPL-->LGPL  2011-12-27
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.DataValidation.Formulas.Contracts;
+
+namespace OfficeOpenXml.DataValidation.Contracts
+{
+    /// <summary>
+    /// Data validation interface for time validation.
+    /// </summary>
+    public interface IExcelDataValidationTime : IExcelDataValidationWithFormula2<IExcelDataValidationFormulaTime>, IExcelDataValidationWithOperator
+    {
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Contracts/IExcelDataValidationWithFormula.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Contracts/IExcelDataValidationWithFormula.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Contracts/IExcelDataValidationWithFormula.cs	(revision 12707)
@@ -0,0 +1,45 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2011-01-08
+ * Jan Källman		    License changed GPL-->LGPL  2011-12-27
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.DataValidation.Formulas.Contracts;
+
+namespace OfficeOpenXml.DataValidation.Contracts
+{
+    public interface IExcelDataValidationWithFormula<T> : IExcelDataValidation
+        where T : IExcelDataValidationFormula
+    {
+        T Formula { get; }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Contracts/IExcelDataValidationWithFormula2.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Contracts/IExcelDataValidationWithFormula2.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Contracts/IExcelDataValidationWithFormula2.cs	(revision 12707)
@@ -0,0 +1,52 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2011-01-08
+ * Jan Källman		    License changed GPL-->LGPL  2011-12-27
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.DataValidation.Formulas.Contracts;
+
+namespace OfficeOpenXml.DataValidation.Contracts
+{
+    /// <summary>
+    /// Interface for a data validation with two formulas
+    /// </summary>
+    /// <typeparam name="T"></typeparam>
+    public interface IExcelDataValidationWithFormula2<T> : IExcelDataValidationWithFormula<T>
+        where T : IExcelDataValidationFormula
+    {
+        /// <summary>
+        /// Formula 2
+        /// </summary>
+        T Formula2 { get; }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Contracts/IExcelDataValidationWithOperator.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Contracts/IExcelDataValidationWithOperator.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Contracts/IExcelDataValidationWithOperator.cs	(revision 12707)
@@ -0,0 +1,49 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2011-01-08
+ * Jan Källman		    License changed GPL-->LGPL  2011-12-27
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.DataValidation.Contracts
+{
+    /// <summary>
+    /// Represents a validation with an operator
+    /// </summary>
+    public interface IExcelDataValidationWithOperator
+    {
+        /// <summary>
+        /// Operator type
+        /// </summary>
+        ExcelDataValidationOperator Operator { get; set; }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/ExcelDataValidation.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/ExcelDataValidation.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/ExcelDataValidation.cs	(revision 12707)
@@ -0,0 +1,399 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2011-01-01
+ * Jan Källman		                License changed GPL-->LGPL  2011-12-27
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.Utils;
+using System.Xml;
+using System.Text.RegularExpressions;
+using OfficeOpenXml.DataValidation.Formulas.Contracts;
+using OfficeOpenXml.DataValidation.Contracts;
+
+namespace OfficeOpenXml.DataValidation
+{
+    /// <summary>
+    /// Excel datavalidation
+    /// </summary>
+    public abstract class ExcelDataValidation : XmlHelper, IExcelDataValidation
+    {
+        private const string _itemElementNodeName = "d:dataValidation";
+
+
+        private readonly string _errorStylePath = "@errorStyle";
+        private readonly string _errorTitlePath = "@errorTitle";
+        private readonly string _errorPath = "@error";
+        private readonly string _promptTitlePath = "@promptTitle";
+        private readonly string _promptPath = "@prompt";
+        private readonly string _operatorPath = "@operator";
+        private readonly string _showErrorMessagePath = "@showErrorMessage";
+        private readonly string _showInputMessagePath = "@showInputMessage";
+        private readonly string _typeMessagePath = "@type";
+        private readonly string _sqrefPath = "@sqref";
+        private readonly string _allowBlankPath = "@allowBlank";
+        protected readonly string _formula1Path = "d:formula1";
+        protected readonly string _formula2Path = "d:formula2";
+
+        internal ExcelDataValidation(ExcelWorksheet worksheet, string address, ExcelDataValidationType validationType)
+            : this(worksheet, address, validationType, null)
+        { }
+
+        /// <summary>
+        /// Constructor
+        /// </summary>
+        /// <param name="worksheet">worksheet that owns the validation</param>
+        /// <param name="itemElementNode">Xml top node (dataValidations)</param>
+        /// <param name="validationType">Data validation type</param>
+        /// <param name="address">address for data validation</param>
+        internal ExcelDataValidation(ExcelWorksheet worksheet, string address, ExcelDataValidationType validationType, XmlNode itemElementNode)
+            : this(worksheet, address, validationType, itemElementNode, null)
+        {
+
+        }
+
+        /// <summary>
+        /// Constructor
+        /// </summary>
+        /// <param name="worksheet">worksheet that owns the validation</param>
+        /// <param name="itemElementNode">Xml top node (dataValidations) when importing xml</param>
+        /// <param name="validationType">Data validation type</param>
+        /// <param name="address">address for data validation</param>
+        /// <param name="namespaceManager">Xml Namespace manager</param>
+        internal ExcelDataValidation(ExcelWorksheet worksheet, string address, ExcelDataValidationType validationType, XmlNode itemElementNode, XmlNamespaceManager namespaceManager)
+            : base(namespaceManager != null ? namespaceManager : worksheet.NameSpaceManager)
+        {
+            Require.Argument(address).IsNotNullOrEmpty("address");
+            address = CheckAndFixRangeAddress(address);
+            if (itemElementNode == null)
+            {
+                //var xmlDoc = worksheet.WorksheetXml;
+                TopNode = worksheet.WorksheetXml.SelectSingleNode("//d:dataValidations", worksheet.NameSpaceManager);
+                // did not succeed using the XmlHelper methods here... so I'm creating the new node using XmlDocument...
+                var nsUri = NameSpaceManager.LookupNamespace("d");
+                //itemElementNode = TopNode.OwnerDocument.CreateElement(_itemElementNodeName, nsUri);
+                itemElementNode = TopNode.OwnerDocument.CreateElement(_itemElementNodeName.Split(':')[1], nsUri);
+                TopNode.AppendChild(itemElementNode);
+            }
+            TopNode = itemElementNode;
+            ValidationType = validationType;
+            Address = new ExcelAddress(address);
+            Init();
+        }
+
+        private void Init()
+        {
+            // set schema node order
+            SchemaNodeOrder = new string[]{ 
+                "type", 
+                "errorStyle", 
+                "operator", 
+                "allowBlank",
+                "showInputMessage", 
+                "showErrorMessage", 
+                "errorTitle", 
+                "error", 
+                "promptTitle", 
+                "prompt", 
+                "sqref",
+                "formula1",
+                "formula2"
+            };
+        }
+
+        private string CheckAndFixRangeAddress(string address)
+        {
+            if (address.Contains(','))
+            {
+                throw new FormatException("Multiple addresses may not be commaseparated, use space instead");
+            }
+            address = address.ToUpper(CultureInfo.InvariantCulture);
+            if (Regex.IsMatch(address, @"[A-Z]+:[A-Z]+"))
+            {
+                address = AddressUtility.ParseEntireColumnSelections(address);
+            }
+            return address;
+        }
+
+        private void SetNullableBoolValue(string path, bool? val)
+        {
+            if (val.HasValue)
+            {
+                SetXmlNodeBool(path, val.Value);
+            }
+            else
+            {
+                DeleteNode(path);
+            }
+        }
+
+        /// <summary>
+        /// This method will validate the state of the validation
+        /// </summary>
+        /// <exception cref="InvalidOperationException">If the state breaks the rules of the validation</exception>
+        public virtual void Validate()
+        {
+            var address = Address.Address;
+            // validate Formula1
+            if (string.IsNullOrEmpty(Formula1Internal))
+            {
+                throw new InvalidOperationException("Validation of " + address + " failed: Formula1 cannot be empty");
+            }
+        }
+
+        #region Public properties
+
+        /// <summary>
+        /// True if the validation type allows operator to be set.
+        /// </summary>
+        public bool AllowsOperator
+        {
+            get
+            {
+                return ValidationType.AllowOperator;
+            }
+        }
+
+        /// <summary>
+        /// Address of data validation
+        /// </summary>
+        public ExcelAddress Address
+        {
+            get
+            {
+                return new ExcelAddress(GetXmlNodeString(_sqrefPath));
+            }
+            private set
+            {
+                var address = AddressUtility.ParseEntireColumnSelections(value.Address);
+                SetXmlNodeString(_sqrefPath, address);
+            }
+        }
+        /// <summary>
+        /// Validation type
+        /// </summary>
+        public ExcelDataValidationType ValidationType
+        {
+            get
+            {
+                var typeString = GetXmlNodeString(_typeMessagePath);
+                return ExcelDataValidationType.GetBySchemaName(typeString);
+            }
+            private set
+            {
+                SetXmlNodeString(_typeMessagePath, value.SchemaName, true);
+            }
+        }
+
+        /// <summary>
+        /// Operator for comparison between the entered value and Formula/Formulas.
+        /// </summary>
+        public ExcelDataValidationOperator Operator
+        {
+            get
+            {
+                var operatorString = GetXmlNodeString(_operatorPath);
+                if (!string.IsNullOrEmpty(operatorString))
+                {
+                    return (ExcelDataValidationOperator)Enum.Parse(typeof(ExcelDataValidationOperator), operatorString);
+                }
+                return default(ExcelDataValidationOperator);
+            }
+            set
+            {
+                if (!ValidationType.AllowOperator)
+                {
+                    throw new InvalidOperationException("The current validation type does not allow operator to be set");
+                }
+                SetXmlNodeString(_operatorPath, value.ToString());
+            }
+        }
+
+        /// <summary>
+        /// Warning style
+        /// </summary>
+        public ExcelDataValidationWarningStyle ErrorStyle
+        {
+            get
+            {
+                var errorStyleString = GetXmlNodeString(_errorStylePath);
+                if (!string.IsNullOrEmpty(errorStyleString))
+                {
+                    return (ExcelDataValidationWarningStyle)Enum.Parse(typeof(ExcelDataValidationWarningStyle), errorStyleString);
+                }
+                return ExcelDataValidationWarningStyle.undefined;
+            }
+            set
+            {
+                if (value == ExcelDataValidationWarningStyle.undefined)
+                {
+                    DeleteNode(_errorStylePath);
+                }
+                SetXmlNodeString(_errorStylePath, value.ToString());
+            }
+        }
+
+        /// <summary>
+        /// True if blanks should be allowed
+        /// </summary>
+        public bool? AllowBlank
+        {
+            get
+            {
+                return GetXmlNodeBoolNullable(_allowBlankPath);
+            }
+            set
+            {
+                SetNullableBoolValue(_allowBlankPath, value);
+            }
+        }
+
+        /// <summary>
+        /// True if input message should be shown
+        /// </summary>
+        public bool? ShowInputMessage
+        {
+            get
+            {
+                return GetXmlNodeBoolNullable(_showInputMessagePath);
+            }
+            set
+            {
+                SetNullableBoolValue(_showInputMessagePath, value);
+            }
+        }
+
+        /// <summary>
+        /// True if error message should be shown
+        /// </summary>
+        public bool? ShowErrorMessage
+        {
+            get
+            {
+                return GetXmlNodeBoolNullable(_showErrorMessagePath);
+            }
+            set
+            {
+                SetNullableBoolValue(_showErrorMessagePath, value);
+            }
+        }
+
+        /// <summary>
+        /// Title of error message box
+        /// </summary>
+        public string ErrorTitle
+        {
+            get
+            {
+                return GetXmlNodeString(_errorTitlePath);
+            }
+            set
+            {
+                SetXmlNodeString(_errorTitlePath, value);
+            }
+        }
+
+        /// <summary>
+        /// Error message box text
+        /// </summary>
+        public string Error
+        {
+            get
+            {
+                return GetXmlNodeString(_errorPath);
+            }
+            set
+            {
+                SetXmlNodeString(_errorPath, value);
+            }
+        }
+
+        public string PromptTitle
+        {
+            get
+            {
+                return GetXmlNodeString(_promptTitlePath);
+            }
+            set
+            {
+                SetXmlNodeString(_promptTitlePath, value);
+            }
+        }
+
+        public string Prompt
+        {
+            get
+            {
+                return GetXmlNodeString(_promptPath);
+            }
+            set
+            {
+                SetXmlNodeString(_promptPath, value);
+            }
+        }
+
+        /// <summary>
+        /// Formula 1
+        /// </summary>
+        protected string Formula1Internal
+        {
+            get
+            {
+                return GetXmlNodeString(_formula1Path);
+            }
+        }
+
+        /// <summary>
+        /// Formula 2
+        /// </summary>
+        protected string Formula2Internal
+        {
+            get
+            {
+                return GetXmlNodeString(_formula2Path);
+            }
+        }
+
+        #endregion
+
+        protected void SetValue<T>(Nullable<T> val, string path)
+            where T : struct
+        {
+            if (!val.HasValue)
+            {
+                DeleteNode(path);
+            }
+            var stringValue = val.Value.ToString().Replace(',', '.');
+            SetXmlNodeString(path, stringValue);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/ExcelDataValidationAny.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/ExcelDataValidationAny.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/ExcelDataValidationAny.cs	(revision 12707)
@@ -0,0 +1,90 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Raziq York   		            Added       		        2014-08-08
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.DataValidation.Formulas.Contracts;
+using OfficeOpenXml.DataValidation.Formulas;
+using System.Xml;
+using OfficeOpenXml.DataValidation.Contracts;
+
+namespace OfficeOpenXml.DataValidation
+{
+    /// <summary>
+    /// Any value validation.
+    /// </summary>
+    public class ExcelDataValidationAny : ExcelDataValidation, IExcelDataValidationAny
+    {
+        /// <summary>
+        /// Constructor
+        /// </summary>
+        /// <param name="worksheet"></param>
+        /// <param name="address"></param>
+        /// <param name="validationType"></param>
+        internal ExcelDataValidationAny(ExcelWorksheet worksheet, string address, ExcelDataValidationType validationType)
+            : base(worksheet, address, validationType)
+        {
+        }
+
+        /// <summary>
+        /// Constructor
+        /// </summary>
+        /// <param name="worksheet"></param>
+        /// <param name="address"></param>
+        /// <param name="validationType"></param>
+        /// <param name="itemElementNode"></param>
+        internal ExcelDataValidationAny(ExcelWorksheet worksheet, string address, ExcelDataValidationType validationType, XmlNode itemElementNode)
+            : base(worksheet, address, validationType, itemElementNode)
+        {
+        }
+
+        /// <summary>
+        /// Constructor
+        /// </summary>
+        /// <param name="worksheet"></param>
+        /// <param name="address"></param>
+        /// <param name="validationType"></param>
+        /// <param name="itemElementNode"></param>
+        /// <param name="namespaceManager"></param>
+        internal ExcelDataValidationAny(ExcelWorksheet worksheet, string address, ExcelDataValidationType validationType, XmlNode itemElementNode, XmlNamespaceManager namespaceManager)
+            : base(worksheet, address, validationType, itemElementNode, namespaceManager)
+        {
+        }
+
+        /// <summary>
+        /// This method will validate the state of the validation
+        /// </summary>
+        public override void Validate()
+        {
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/ExcelDataValidationCollection.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/ExcelDataValidationCollection.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/ExcelDataValidationCollection.cs	(revision 12707)
@@ -0,0 +1,408 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2011-01-01
+ * Mats Alm                         Applying patch submitted    2011-11-14
+ *                                  by Ted Heatherington
+ * Jan Källman		                License changed GPL-->LGPL  2011-12-27
+ * Raziq York		                Added support for Any type  2014-08-08
+*******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Collections;
+using OfficeOpenXml.Utils;
+using System.Xml;
+using OfficeOpenXml.DataValidation.Contracts;
+
+namespace OfficeOpenXml.DataValidation
+{
+    /// <summary>
+    /// <para>
+    /// Collection of <see cref="ExcelDataValidation"/>. This class is providing the API for EPPlus data validation.
+    /// </para>
+    /// <para>
+    /// The public methods of this class (Add[...]Validation) will create a datavalidation entry in the worksheet. When this
+    /// validation has been created changes to the properties will affect the workbook immediately.
+    /// </para>
+    /// <para>
+    /// Each type of validation has either a formula or a typed value/values, except for custom validation which has a formula only.
+    /// </para>
+    /// <code>
+    /// // Add a date time validation
+    /// var validation = worksheet.DataValidation.AddDateTimeValidation("A1");
+    /// // set validation properties
+    /// validation.ShowErrorMessage = true;
+    /// validation.ErrorTitle = "An invalid date was entered";
+    /// validation.Error = "The date must be between 2011-01-31 and 2011-12-31";
+    /// validation.Prompt = "Enter date here";
+    /// validation.Formula.Value = DateTime.Parse("2011-01-01");
+    /// validation.Formula2.Value = DateTime.Parse("2011-12-31");
+    /// validation.Operator = ExcelDataValidationOperator.between;
+    /// </code>
+    /// </summary>
+    public class ExcelDataValidationCollection : XmlHelper, IEnumerable<IExcelDataValidation>
+    {
+        private List<IExcelDataValidation> _validations = new List<IExcelDataValidation>();
+        private ExcelWorksheet _worksheet = null;
+
+        private const string DataValidationPath = "//d:dataValidations";
+        private readonly string DataValidationItemsPath = string.Format("{0}/d:dataValidation", DataValidationPath);
+
+        /// <summary>
+        /// Constructor
+        /// </summary>
+        /// <param name="worksheet"></param>
+        internal ExcelDataValidationCollection(ExcelWorksheet worksheet)
+            : base(worksheet.NameSpaceManager, worksheet.WorksheetXml.DocumentElement)
+        {
+            Require.Argument(worksheet).IsNotNull("worksheet");
+            _worksheet = worksheet;
+            SchemaNodeOrder = worksheet.SchemaNodeOrder;
+
+            // check existing nodes and load them
+            var dataValidationNodes = worksheet.WorksheetXml.SelectNodes(DataValidationItemsPath, worksheet.NameSpaceManager);
+            if (dataValidationNodes != null && dataValidationNodes.Count > 0)
+            {
+                foreach (XmlNode node in dataValidationNodes)
+                {
+                    if (node.Attributes["sqref"] == null) continue;
+
+                    var addr = node.Attributes["sqref"].Value;
+
+                    var typeSchema = node.Attributes["type"] != null ? node.Attributes["type"].Value : "";
+
+                    var type = ExcelDataValidationType.GetBySchemaName(typeSchema);
+                    _validations.Add(ExcelDataValidationFactory.Create(type, worksheet, addr, node));
+                }
+            }
+            if (_validations.Count > 0)
+            {
+                OnValidationCountChanged();
+            }
+        }
+
+        private void EnsureRootElementExists()
+        {
+            var node = _worksheet.WorksheetXml.SelectSingleNode(DataValidationPath, _worksheet.NameSpaceManager);
+            if (node == null)
+            {
+                CreateNode(DataValidationPath.TrimStart('/'));
+            }
+        }
+
+        private void OnValidationCountChanged()
+        {
+            //if (TopNode != null)
+            //{
+            //    SetXmlNodeString("@count", _validations.Count.ToString());
+            //}
+        }
+
+        private XmlNode GetRootNode()
+        {
+            EnsureRootElementExists();
+            TopNode = _worksheet.WorksheetXml.SelectSingleNode(DataValidationPath, _worksheet.NameSpaceManager);
+            return TopNode;
+        }
+
+        /// <summary>
+        /// Validates address - not empty, collisions
+        /// </summary>
+        /// <param name="address"></param>
+        /// <param name="validatingValidation"></param>
+        private void ValidateAddress(string address, IExcelDataValidation validatingValidation)
+        {
+            Require.Argument(address).IsNotNullOrEmpty("address");
+
+            // ensure that the new address does not collide with an existing validation.
+            var newAddress = new ExcelAddress(address);
+            if (_validations.Count > 0)
+            {
+                foreach (var validation in _validations)
+                {
+                    if (validatingValidation != null && validatingValidation == validation)
+                    {
+                        continue;
+                    }
+                    var result = validation.Address.Collide(newAddress);
+                    if (result != ExcelAddressBase.eAddressCollition.No)
+                    {
+                        throw new InvalidOperationException(string.Format("The address ({0}) collides with an existing validation ({1})", address, validation.Address.Address));
+                    }
+                }
+            }
+        }
+
+        private void ValidateAddress(string address)
+        {
+            ValidateAddress(address, null);
+        }
+
+        /// <summary>
+        /// Validates all data validations.
+        /// </summary>
+        internal void ValidateAll()
+        {
+            foreach (var validation in _validations)
+            {
+                validation.Validate();
+
+                ValidateAddress(validation.Address.Address, validation);
+            }
+        }
+
+        /// <summary>
+        /// Adds a <see cref="ExcelDataValidationAny"/> to the worksheet.
+        /// </summary>
+        /// <param name="address">The range/address to validate</param>
+        /// <returns></returns>
+        public IExcelDataValidationAny AddAnyValidation(string address)
+        {
+            ValidateAddress(address);
+            EnsureRootElementExists();
+            var item = new ExcelDataValidationAny(_worksheet, address, ExcelDataValidationType.Any);
+            _validations.Add(item);
+            OnValidationCountChanged();
+            return item;
+        }
+
+        /// <summary>
+        /// Adds an <see cref="IExcelDataValidationInt"/> to the worksheet. Whole means that the only accepted values
+        /// are integer values.
+        /// </summary>
+        /// <param name="address">the range/address to validate</param>
+        public IExcelDataValidationInt AddIntegerValidation(string address)
+        {
+            ValidateAddress(address);
+            EnsureRootElementExists();
+            var item = new ExcelDataValidationInt(_worksheet, address, ExcelDataValidationType.Whole);
+            _validations.Add(item);
+            OnValidationCountChanged();
+            return item;
+        }
+
+        /// <summary>
+        /// Addes an <see cref="IExcelDataValidationDecimal"/> to the worksheet. The only accepted values are
+        /// decimal values.
+        /// </summary>
+        /// <param name="address">The range/address to validate</param>
+        /// <returns></returns>
+        public IExcelDataValidationDecimal AddDecimalValidation(string address)
+        {
+            ValidateAddress(address);
+            EnsureRootElementExists();
+            var item = new ExcelDataValidationDecimal(_worksheet, address, ExcelDataValidationType.Decimal);
+            _validations.Add(item);
+            OnValidationCountChanged();
+            return item;
+        }
+
+        /// <summary>
+        /// Adds an <see cref="IExcelDataValidationList"/> to the worksheet. The accepted values are defined
+        /// in a list.
+        /// </summary>
+        /// <param name="address">The range/address to validate</param>
+        /// <returns></returns>
+        public IExcelDataValidationList AddListValidation(string address)
+        {
+            ValidateAddress(address);
+            EnsureRootElementExists();
+            var item = new ExcelDataValidationList(_worksheet, address, ExcelDataValidationType.List);
+            _validations.Add(item);
+            OnValidationCountChanged();
+            return item;
+        }
+
+        /// <summary>
+        /// Adds an <see cref="IExcelDataValidationInt"/> regarding text length to the worksheet.
+        /// </summary>
+        /// <param name="address">The range/address to validate</param>
+        /// <returns></returns>
+        public IExcelDataValidationInt AddTextLengthValidation(string address)
+        {
+            ValidateAddress(address);
+            EnsureRootElementExists();
+            var item = new ExcelDataValidationInt(_worksheet, address, ExcelDataValidationType.TextLength);
+            _validations.Add(item);
+            OnValidationCountChanged();
+            return item;
+        }
+
+        /// <summary>
+        /// Adds an <see cref="IExcelDataValidationDateTime"/> to the worksheet.
+        /// </summary>
+        /// <param name="address">The range/address to validate</param>
+        /// <returns></returns>
+        public IExcelDataValidationDateTime AddDateTimeValidation(string address)
+        {
+            ValidateAddress(address);
+            EnsureRootElementExists();
+            var item = new ExcelDataValidationDateTime(_worksheet, address, ExcelDataValidationType.DateTime);
+            _validations.Add(item);
+            OnValidationCountChanged();
+            return item;
+        }
+
+
+        public IExcelDataValidationTime AddTimeValidation(string address)
+        {
+            ValidateAddress(address);
+            EnsureRootElementExists();
+            var item = new ExcelDataValidationTime(_worksheet, address, ExcelDataValidationType.Time);
+            _validations.Add(item);
+            OnValidationCountChanged();
+            return item;
+        }
+        /// <summary>
+        /// Adds a <see cref="ExcelDataValidationCustom"/> to the worksheet.
+        /// </summary>
+        /// <param name="address">The range/address to validate</param>
+        /// <returns></returns>
+        public IExcelDataValidationCustom AddCustomValidation(string address)
+        {
+            ValidateAddress(address);
+            EnsureRootElementExists();
+            var item = new ExcelDataValidationCustom(_worksheet, address, ExcelDataValidationType.Custom);
+            _validations.Add(item);
+            OnValidationCountChanged();
+            return item;
+        }
+
+        /// <summary>
+        /// Removes an <see cref="ExcelDataValidation"/> from the collection.
+        /// </summary>
+        /// <param name="item">The item to remove</param>
+        /// <returns>True if remove succeeds, otherwise false</returns>
+        /// <exception cref="ArgumentNullException">if <paramref name="item"/> is null</exception>
+        public bool Remove(IExcelDataValidation item)
+        {
+            if (!(item is ExcelDataValidation))
+            {
+                throw new InvalidCastException("The supplied item must inherit OfficeOpenXml.DataValidation.ExcelDataValidation");
+            }
+            Require.Argument(item).IsNotNull("item");
+            TopNode.RemoveChild(((ExcelDataValidation)item).TopNode);
+            var retVal = _validations.Remove(item);
+            if (retVal) OnValidationCountChanged();
+            return retVal;
+        }
+
+        /// <summary>
+        /// Number of validations
+        /// </summary>
+        public int Count
+        {
+            get { return _validations.Count; }
+        }
+
+        /// <summary>
+        /// Index operator, returns by 0-based index
+        /// </summary>
+        /// <param name="index"></param>
+        /// <returns></returns>
+        public IExcelDataValidation this[int index]
+        {
+            get { return _validations[index]; }
+            set { _validations[index] = value; }
+        }
+
+        /// <summary>
+        /// Index operator, returns a data validation which address partly or exactly matches the searched address.
+        /// </summary>
+        /// <param name="address">A cell address or range</param>
+        /// <returns>A <see cref="ExcelDataValidation"/> or null if no match</returns>
+        public IExcelDataValidation this[string address]
+        {
+            get
+            {
+                var searchedAddress = new ExcelAddress(address);
+                return _validations.Find(x => x.Address.Collide(searchedAddress) != ExcelAddressBase.eAddressCollition.No);
+            }
+        }
+
+        /// <summary>
+        /// Returns all validations that matches the supplied predicate <paramref name="match"/>.
+        /// </summary>
+        /// <param name="match">predicate to filter out matching validations</param>
+        /// <returns></returns>
+        public IEnumerable<IExcelDataValidation> FindAll(Predicate<IExcelDataValidation> match)
+        {
+            return _validations.FindAll(match);
+        }
+
+        /// <summary>
+        /// Returns the first matching validation.
+        /// </summary>
+        /// <param name="match"></param>
+        /// <returns></returns>
+        public IExcelDataValidation Find(Predicate<IExcelDataValidation> match)
+        {
+            return _validations.Find(match);
+        }
+
+        /// <summary>
+        /// Removes all validations from the collection.
+        /// </summary>
+        public void Clear()
+        {
+            DeleteAllNode(DataValidationItemsPath.TrimStart('/'));
+            _validations.Clear();
+        }
+
+        /// <summary>
+        /// Removes the validations that matches the predicate
+        /// </summary>
+        /// <param name="match"></param>
+        public void RemoveAll(Predicate<IExcelDataValidation> match)
+        {
+            var matches = _validations.FindAll(match);
+            foreach (var m in matches)
+            {
+                if (!(m is ExcelDataValidation))
+                {
+                    throw new InvalidCastException("The supplied item must inherit OfficeOpenXml.DataValidation.ExcelDataValidation");
+                }
+                TopNode.SelectSingleNode(DataValidationPath.TrimStart('/'), NameSpaceManager).RemoveChild(((ExcelDataValidation)m).TopNode);
+            }
+            _validations.RemoveAll(match);
+            OnValidationCountChanged();
+        }
+
+        IEnumerator<IExcelDataValidation> IEnumerable<IExcelDataValidation>.GetEnumerator()
+        {
+            return _validations.GetEnumerator();
+        }
+
+        IEnumerator System.Collections.IEnumerable.GetEnumerator()
+        {
+            return _validations.GetEnumerator();
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/ExcelDataValidationCustom.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/ExcelDataValidationCustom.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/ExcelDataValidationCustom.cs	(revision 12707)
@@ -0,0 +1,87 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2011-01-01
+ * Jan Källman		                License changed GPL-->LGPL  2011-12-27
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.DataValidation.Formulas.Contracts;
+using OfficeOpenXml.DataValidation.Formulas;
+using System.Xml;
+using OfficeOpenXml.DataValidation.Contracts;
+
+namespace OfficeOpenXml.DataValidation
+{
+    /// <summary>
+    /// Custom validation, i.e. a formula.
+    /// </summary>
+    public class ExcelDataValidationCustom : ExcelDataValidationWithFormula<IExcelDataValidationFormula>, IExcelDataValidationCustom
+    {
+        /// <summary>
+        /// Constructor
+        /// </summary>
+        /// <param name="worksheet"></param>
+        /// <param name="address"></param>
+        /// <param name="validationType"></param>
+        internal ExcelDataValidationCustom(ExcelWorksheet worksheet, string address, ExcelDataValidationType validationType)
+            : base(worksheet, address, validationType)
+        {
+            Formula = new ExcelDataValidationFormulaCustom(NameSpaceManager, TopNode, _formula1Path);
+        }
+
+        /// <summary>
+        /// Constructor
+        /// </summary>
+        /// <param name="worksheet"></param>
+        /// <param name="address"></param>
+        /// <param name="validationType"></param>
+        /// <param name="itemElementNode"></param>
+        internal ExcelDataValidationCustom(ExcelWorksheet worksheet, string address, ExcelDataValidationType validationType, XmlNode itemElementNode)
+            : base(worksheet, address, validationType, itemElementNode)
+        {
+            Formula = new ExcelDataValidationFormulaCustom(NameSpaceManager, TopNode, _formula1Path);
+        }
+
+        /// <summary>
+        /// Constructor
+        /// </summary>
+        /// <param name="worksheet"></param>
+        /// <param name="address"></param>
+        /// <param name="validationType"></param>
+        /// <param name="itemElementNode"></param>
+        /// <param name="namespaceManager"></param>
+        internal ExcelDataValidationCustom(ExcelWorksheet worksheet, string address, ExcelDataValidationType validationType, XmlNode itemElementNode, XmlNamespaceManager namespaceManager)
+            : base(worksheet, address, validationType, itemElementNode, namespaceManager)
+        {
+            Formula = new ExcelDataValidationFormulaCustom(NameSpaceManager, TopNode, _formula1Path);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/ExcelDataValidationDateTime.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/ExcelDataValidationDateTime.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/ExcelDataValidationDateTime.cs	(revision 12707)
@@ -0,0 +1,90 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2011-01-01
+ * Jan Källman		                License changed GPL-->LGPL  2011-12-27
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.DataValidation.Formulas.Contracts;
+using OfficeOpenXml.DataValidation.Formulas;
+using System.Xml;
+using OfficeOpenXml.DataValidation.Contracts;
+
+namespace OfficeOpenXml.DataValidation
+{
+    /// <summary>
+    /// Validation for <see cref="DateTime"/>.
+    /// </summary>
+    public class ExcelDataValidationDateTime : ExcelDataValidationWithFormula2<IExcelDataValidationFormulaDateTime>, IExcelDataValidationDateTime
+    {
+        /// <summary>
+        /// Constructor
+        /// </summary>
+        /// <param name="worksheet"></param>
+        /// <param name="address"></param>
+        /// <param name="validationType"></param>
+        internal ExcelDataValidationDateTime(ExcelWorksheet worksheet, string address, ExcelDataValidationType validationType)
+            : base(worksheet, address, validationType)
+        {
+            Formula = new ExcelDataValidationFormulaDateTime(NameSpaceManager, TopNode, _formula1Path);
+            Formula2 = new ExcelDataValidationFormulaDateTime(NameSpaceManager, TopNode, _formula2Path);
+        }
+
+        /// <summary>
+        /// Constructor
+        /// </summary>
+        /// <param name="worksheet"></param>
+        /// <param name="address"></param>
+        /// <param name="validationType"></param>
+        /// <param name="itemElementNode"></param>
+        internal ExcelDataValidationDateTime(ExcelWorksheet worksheet, string address, ExcelDataValidationType validationType, XmlNode itemElementNode)
+            : base(worksheet, address, validationType, itemElementNode)
+        {
+            Formula = new ExcelDataValidationFormulaDateTime(NameSpaceManager, TopNode, _formula1Path);
+            Formula2 = new ExcelDataValidationFormulaDateTime(NameSpaceManager, TopNode, _formula2Path);
+        }
+
+        /// <summary>
+        /// Constructor
+        /// </summary>
+        /// <param name="worksheet"></param>
+        /// <param name="address"></param>
+        /// <param name="validationType"></param>
+        /// <param name="itemElementNode"></param>
+        /// <param name="namespaceManager"></param>
+        internal ExcelDataValidationDateTime(ExcelWorksheet worksheet, string address, ExcelDataValidationType validationType, XmlNode itemElementNode, XmlNamespaceManager namespaceManager)
+            : base(worksheet, address, validationType, itemElementNode, namespaceManager)
+        {
+            Formula = new ExcelDataValidationFormulaDateTime(NameSpaceManager, TopNode, _formula1Path);
+            Formula2 = new ExcelDataValidationFormulaDateTime(NameSpaceManager, TopNode, _formula2Path);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/ExcelDataValidationDecimal.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/ExcelDataValidationDecimal.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/ExcelDataValidationDecimal.cs	(revision 12707)
@@ -0,0 +1,91 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2011-01-01
+ * Jan Källman		                License changed GPL-->LGPL  2011-12-27
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Globalization;
+using System.Xml;
+using OfficeOpenXml.DataValidation.Formulas.Contracts;
+using OfficeOpenXml.DataValidation.Formulas;
+using OfficeOpenXml.DataValidation.Contracts;
+
+namespace OfficeOpenXml.DataValidation
+{
+    /// <summary>
+    /// Data validation for decimal values
+    /// </summary>
+    public class ExcelDataValidationDecimal : ExcelDataValidationWithFormula2<IExcelDataValidationFormulaDecimal>, IExcelDataValidationDecimal
+    {
+        /// <summary>
+        /// Constructor
+        /// </summary>
+        /// <param name="worksheet"></param>
+        /// <param name="address"></param>
+        /// <param name="validationType"></param>
+        internal ExcelDataValidationDecimal(ExcelWorksheet worksheet, string address, ExcelDataValidationType validationType)
+            : base(worksheet, address, validationType)
+        {
+            Formula = new ExcelDataValidationFormulaDecimal(NameSpaceManager, TopNode, _formula1Path);
+            Formula2 = new ExcelDataValidationFormulaDecimal(NameSpaceManager, TopNode, _formula2Path);
+        }
+
+        /// <summary>
+        /// Constructor
+        /// </summary>
+        /// <param name="worksheet"></param>
+        /// <param name="address"></param>
+        /// <param name="validationType"></param>
+        /// <param name="itemElementNode"></param>
+        internal ExcelDataValidationDecimal(ExcelWorksheet worksheet, string address, ExcelDataValidationType validationType, XmlNode itemElementNode)
+            : base(worksheet, address, validationType, itemElementNode)
+        {
+            Formula = new ExcelDataValidationFormulaDecimal(NameSpaceManager, TopNode, _formula1Path);
+            Formula2 = new ExcelDataValidationFormulaDecimal(NameSpaceManager, TopNode, _formula2Path);
+        }
+
+        /// <summary>
+        /// Constructor
+        /// </summary>
+        /// <param name="worksheet"></param>
+        /// <param name="address"></param>
+        /// <param name="validationType"></param>
+        /// <param name="itemElementNode"></param>
+        /// <param name="namespaceManager">For test purposes</param>
+        internal ExcelDataValidationDecimal(ExcelWorksheet worksheet, string address, ExcelDataValidationType validationType, XmlNode itemElementNode, XmlNamespaceManager namespaceManager)
+            : base(worksheet, address, validationType, itemElementNode, namespaceManager)
+        {
+            Formula = new ExcelDataValidationFormulaDecimal(NameSpaceManager, TopNode, _formula1Path);
+            Formula2 = new ExcelDataValidationFormulaDecimal(NameSpaceManager, TopNode, _formula2Path);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/ExcelDataValidationFactory.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/ExcelDataValidationFactory.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/ExcelDataValidationFactory.cs	(revision 12707)
@@ -0,0 +1,80 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2011-01-01
+ * Jan Källman		                License changed GPL-->LGPL  2011-12-27
+ * Raziq York 		                Added support for Any type  2014-08-08
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Xml;
+using OfficeOpenXml.Utils;
+
+namespace OfficeOpenXml.DataValidation
+{
+    /// <summary>
+    /// Factory class for ExcelDataValidation.
+    /// </summary>
+    internal static class ExcelDataValidationFactory
+    {
+        /// <summary>
+        /// Creates an instance of <see cref="ExcelDataValidation"/> out of the given parameters.
+        /// </summary>
+        /// <param name="type"></param>
+        /// <param name="worksheet"></param>
+        /// <param name="address"></param>
+        /// <param name="itemElementNode"></param>
+        /// <returns></returns>
+        public static ExcelDataValidation Create(ExcelDataValidationType type, ExcelWorksheet worksheet, string address, XmlNode itemElementNode)
+        {
+            Require.Argument(type).IsNotNull("validationType");
+            switch (type.Type)
+            {
+                case eDataValidationType.Any:
+                    return new ExcelDataValidationAny(worksheet, address, type, itemElementNode);
+                case eDataValidationType.TextLength:
+                case eDataValidationType.Whole:
+                    return new ExcelDataValidationInt(worksheet, address, type, itemElementNode);
+                case eDataValidationType.Decimal:
+                    return new ExcelDataValidationDecimal(worksheet, address, type, itemElementNode);
+                case eDataValidationType.List:
+                    return new ExcelDataValidationList(worksheet, address, type, itemElementNode);
+                case eDataValidationType.DateTime:
+                    return new ExcelDataValidationDateTime(worksheet, address, type, itemElementNode);
+                case eDataValidationType.Time:
+                    return new ExcelDataValidationTime(worksheet, address, type, itemElementNode);
+                case eDataValidationType.Custom:
+                    return new ExcelDataValidationCustom(worksheet, address, type, itemElementNode);
+                default:
+                    throw new InvalidOperationException("Non supported validationtype: " + type.Type.ToString());
+            }
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/ExcelDataValidationInt.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/ExcelDataValidationInt.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/ExcelDataValidationInt.cs	(revision 12707)
@@ -0,0 +1,90 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2011-01-08
+ * Jan Källman		                License changed GPL-->LGPL  2011-12-27
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.DataValidation.Formulas;
+using OfficeOpenXml.DataValidation.Formulas.Contracts;
+using System.Xml;
+using OfficeOpenXml.DataValidation.Contracts;
+
+namespace OfficeOpenXml.DataValidation
+{
+    /// <summary>
+    /// Data validation for integer values.
+    /// </summary>
+    public class ExcelDataValidationInt : ExcelDataValidationWithFormula2<IExcelDataValidationFormulaInt>, IExcelDataValidationInt
+    {
+        /// <summary>
+        /// Constructor
+        /// </summary>
+        /// <param name="worksheet"></param>
+        /// <param name="address"></param>
+        /// <param name="validationType"></param>
+        internal ExcelDataValidationInt(ExcelWorksheet worksheet, string address, ExcelDataValidationType validationType)
+            : base(worksheet, address, validationType)
+        {
+            Formula = new ExcelDataValidationFormulaInt(worksheet.NameSpaceManager, TopNode, _formula1Path);
+            Formula2 = new ExcelDataValidationFormulaInt(worksheet.NameSpaceManager, TopNode, _formula2Path);
+        }
+
+        /// <summary>
+        /// Constructor
+        /// </summary>
+        /// <param name="worksheet"></param>
+        /// <param name="address"></param>
+        /// <param name="validationType"></param>
+        /// <param name="itemElementNode"></param>
+        internal ExcelDataValidationInt(ExcelWorksheet worksheet, string address, ExcelDataValidationType validationType, XmlNode itemElementNode)
+            : base(worksheet, address, validationType, itemElementNode)
+        {
+            Formula = new ExcelDataValidationFormulaInt(worksheet.NameSpaceManager, TopNode, _formula1Path);
+            Formula2 = new ExcelDataValidationFormulaInt(worksheet.NameSpaceManager, TopNode, _formula2Path);
+        }
+
+        /// <summary>
+        /// Constructor
+        /// </summary>
+        /// <param name="worksheet"></param>
+        /// <param name="address"></param>
+        /// <param name="validationType"></param>
+        /// <param name="itemElementNode"></param>
+        /// <param name="namespaceManager">For test purposes</param>
+        internal ExcelDataValidationInt(ExcelWorksheet worksheet, string address, ExcelDataValidationType validationType, XmlNode itemElementNode, XmlNamespaceManager namespaceManager)
+            : base(worksheet, address, validationType, itemElementNode, namespaceManager)
+        {
+            Formula = new ExcelDataValidationFormulaInt(NameSpaceManager, TopNode, _formula1Path);
+            Formula2 = new ExcelDataValidationFormulaInt(NameSpaceManager, TopNode, _formula2Path);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/ExcelDataValidationList.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/ExcelDataValidationList.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/ExcelDataValidationList.cs	(revision 12707)
@@ -0,0 +1,88 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2011-01-08
+ * Jan Källman		                License changed GPL-->LGPL  2011-12-27
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.DataValidation.Formulas.Contracts;
+using OfficeOpenXml.DataValidation.Formulas;
+using System.Xml;
+using OfficeOpenXml.DataValidation.Contracts;
+
+namespace OfficeOpenXml.DataValidation
+{
+    /// <summary>
+    /// This class represents an List data validation.
+    /// </summary>
+    public class ExcelDataValidationList : ExcelDataValidationWithFormula<IExcelDataValidationFormulaList>, IExcelDataValidationList
+    {
+       
+        /// <summary>
+        /// Constructor
+        /// </summary>
+        /// <param name="worksheet"></param>
+        /// <param name="address"></param>
+        /// <param name="validationType"></param>
+        internal ExcelDataValidationList(ExcelWorksheet worksheet, string address, ExcelDataValidationType validationType)
+            : base(worksheet, address, validationType)
+        {
+            Formula = new ExcelDataValidationFormulaList(NameSpaceManager, TopNode, _formula1Path);
+        }
+
+        /// <summary>
+        /// Constructor
+        /// </summary>
+        /// <param name="worksheet"></param>
+        /// <param name="address"></param>
+        /// <param name="validationType"></param>
+        /// <param name="itemElementNode"></param>
+        internal ExcelDataValidationList(ExcelWorksheet worksheet, string address, ExcelDataValidationType validationType, XmlNode itemElementNode)
+            : base(worksheet, address, validationType, itemElementNode)
+        {
+            Formula = new ExcelDataValidationFormulaList(NameSpaceManager, TopNode, _formula1Path);
+        }
+
+        /// <summary>
+        /// Constructor
+        /// </summary>
+        /// <param name="worksheet"></param>
+        /// <param name="address"></param>
+        /// <param name="validationType"></param>
+        /// <param name="itemElementNode"></param>
+        /// <param name="namespaceManager">Namespace manager, for test purposes</param>
+        internal ExcelDataValidationList(ExcelWorksheet worksheet, string address, ExcelDataValidationType validationType, XmlNode itemElementNode, XmlNamespaceManager namespaceManager)
+            : base(worksheet, address, validationType, itemElementNode, namespaceManager)
+        {
+            Formula = new ExcelDataValidationFormulaList(NameSpaceManager, TopNode, _formula1Path);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/ExcelDataValidationOperator.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/ExcelDataValidationOperator.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/ExcelDataValidationOperator.cs	(revision 12707)
@@ -0,0 +1,54 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2011-01-01
+ * Jan Källman		                License changed GPL-->LGPL  2011-12-27
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.DataValidation
+{
+    /// <summary>
+    /// Operator for comparison between Formula and Formula2 in a validation.
+    /// </summary>
+    public enum ExcelDataValidationOperator
+    {
+        any,
+        equal,
+        notEqual,
+        lessThan,
+        lessThanOrEqual,
+        greaterThan,
+        greaterThanOrEqual,
+        between,
+        notBetween
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/ExcelDataValidationTime.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/ExcelDataValidationTime.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/ExcelDataValidationTime.cs	(revision 12707)
@@ -0,0 +1,91 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2011-01-08
+ * Jan Källman		                License changed GPL-->LGPL  2011-12-27
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.DataValidation.Formulas.Contracts;
+using OfficeOpenXml.DataValidation.Formulas;
+using System.Xml;
+using OfficeOpenXml.DataValidation.Contracts;
+using System.Runtime.CompilerServices;
+
+namespace OfficeOpenXml.DataValidation
+{
+    /// <summary>
+    /// Validation for times (<see cref="OfficeOpenXml.DataValidation.ExcelTime"/>).
+    /// </summary>
+    public class ExcelDataValidationTime : ExcelDataValidationWithFormula2<IExcelDataValidationFormulaTime>, IExcelDataValidationTime
+    {
+         /// <summary>
+        /// Constructor
+        /// </summary>
+        /// <param name="worksheet"></param>
+        /// <param name="address"></param>
+        /// <param name="validationType"></param>
+        internal ExcelDataValidationTime(ExcelWorksheet worksheet, string address, ExcelDataValidationType validationType)
+            : base(worksheet, address, validationType)
+        {
+            Formula = new ExcelDataValidationFormulaTime(NameSpaceManager, TopNode, _formula1Path);
+            Formula2 = new ExcelDataValidationFormulaTime(NameSpaceManager, TopNode, _formula2Path);
+        }
+
+        /// <summary>
+        /// Constructor
+        /// </summary>
+        /// <param name="worksheet"></param>
+        /// <param name="address"></param>
+        /// <param name="validationType"></param>
+        /// <param name="itemElementNode"></param>
+        internal ExcelDataValidationTime(ExcelWorksheet worksheet, string address, ExcelDataValidationType validationType, XmlNode itemElementNode)
+            : base(worksheet, address, validationType, itemElementNode)
+        {
+            Formula = new ExcelDataValidationFormulaTime(NameSpaceManager, TopNode, _formula1Path);
+            Formula2 = new ExcelDataValidationFormulaTime(NameSpaceManager, TopNode, _formula2Path);
+        }
+
+        /// <summary>
+        /// Constructor
+        /// </summary>
+        /// <param name="worksheet"></param>
+        /// <param name="address"></param>
+        /// <param name="validationType"></param>
+        /// <param name="itemElementNode"></param>
+        /// <param name="namespaceManager"></param>
+        internal ExcelDataValidationTime(ExcelWorksheet worksheet, string address, ExcelDataValidationType validationType, XmlNode itemElementNode, XmlNamespaceManager namespaceManager)
+            : base(worksheet, address, validationType, itemElementNode, namespaceManager)
+        {
+            Formula = new ExcelDataValidationFormulaTime(NameSpaceManager, TopNode, _formula1Path);
+            Formula2 = new ExcelDataValidationFormulaTime(NameSpaceManager, TopNode, _formula2Path);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/ExcelDataValidationType.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/ExcelDataValidationType.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/ExcelDataValidationType.cs	(revision 12707)
@@ -0,0 +1,319 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2011-01-01
+ * Jan Källman		                License changed GPL-->LGPL  2011-12-27
+ * Raziq York 		                Added support for Any type  2014-08-08
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.DataValidation
+{
+    /// <summary>
+    /// Enum for available data validation types
+    /// </summary>
+    public enum eDataValidationType
+    {
+        /// <summary>
+        /// Any value
+        /// </summary>
+        Any,
+        /// <summary>
+        /// Integer value
+        /// </summary>
+        Whole,
+        /// <summary>
+        /// Decimal values
+        /// </summary>
+        Decimal,
+        /// <summary>
+        /// List of values
+        /// </summary>
+        List,
+        /// <summary>
+        /// Text length validation
+        /// </summary>
+        TextLength,
+        /// <summary>
+        /// DateTime validation
+        /// </summary>
+        DateTime,
+        /// <summary>
+        /// Time validation
+        /// </summary>
+        Time,
+        /// <summary>
+        /// Custom validation
+        /// </summary>
+        Custom
+    }
+
+    internal static class DataValidationSchemaNames
+    {
+        public const string Any = "";
+        public const string Whole = "whole";
+        public const string Decimal = "decimal";
+        public const string List = "list";
+        public const string TextLength = "textLength";
+        public const string Date = "date";
+        public const string Time = "time";
+        public const string Custom = "custom";
+    }
+
+    /// <summary>
+    /// Types of datavalidation
+    /// </summary>
+    public class ExcelDataValidationType
+    {
+        private ExcelDataValidationType(eDataValidationType validationType, bool allowOperator, string schemaName)
+        {
+            Type = validationType;
+            AllowOperator = allowOperator;
+            SchemaName = schemaName;
+        }
+
+        /// <summary>
+        /// Validation type
+        /// </summary>
+        public eDataValidationType Type
+        {
+            get;
+            private set;
+        }
+
+        internal string SchemaName
+        {
+            get;
+            private set;
+        }
+
+        /// <summary>
+        /// This type allows operator to be set
+        /// </summary>
+        internal bool AllowOperator
+        {
+
+            get;
+            private set;
+        }
+
+        /// <summary>
+        /// Returns a validation type by <see cref="eDataValidationType"/>
+        /// </summary>
+        /// <param name="type"></param>
+        /// <returns></returns>
+        internal static ExcelDataValidationType GetByValidationType(eDataValidationType type)
+        {
+            switch (type)
+            {
+                case eDataValidationType.Any:
+                    return ExcelDataValidationType.Any;
+                case eDataValidationType.Whole:
+                    return ExcelDataValidationType.Whole;
+                case eDataValidationType.List:
+                    return ExcelDataValidationType.List;
+                case eDataValidationType.Decimal:
+                    return ExcelDataValidationType.Decimal;
+                case eDataValidationType.TextLength:
+                    return ExcelDataValidationType.TextLength;
+                case eDataValidationType.DateTime:
+                    return ExcelDataValidationType.DateTime;
+                case eDataValidationType.Time:
+                    return ExcelDataValidationType.Time;
+                case eDataValidationType.Custom:
+                    return ExcelDataValidationType.Custom;
+                default:
+                    throw new InvalidOperationException("Non supported Validationtype : " + type.ToString());
+            }
+        }
+
+        internal static ExcelDataValidationType GetBySchemaName(string schemaName)
+        {
+            switch (schemaName)
+            {
+                case DataValidationSchemaNames.Any:
+                    return ExcelDataValidationType.Any;
+                case DataValidationSchemaNames.Whole:
+                    return ExcelDataValidationType.Whole;
+                case DataValidationSchemaNames.Decimal:
+                    return ExcelDataValidationType.Decimal;
+                case DataValidationSchemaNames.List:
+                    return ExcelDataValidationType.List;
+                case DataValidationSchemaNames.TextLength:
+                    return ExcelDataValidationType.TextLength;
+                case DataValidationSchemaNames.Date:
+                    return ExcelDataValidationType.DateTime;
+                case DataValidationSchemaNames.Time:
+                    return ExcelDataValidationType.Time;
+                case DataValidationSchemaNames.Custom:
+                    return ExcelDataValidationType.Custom;
+                default:
+                    throw new ArgumentException("Invalid schemaname: " + schemaName);
+            }
+        }
+
+        /// <summary>
+        /// Overridden Equals, compares on internal validation type
+        /// </summary>
+        /// <param name="obj"></param>
+        /// <returns></returns>
+        public override bool Equals(object obj)
+        {
+            if (!(obj is ExcelDataValidationType))
+            {
+                return false;
+            }
+            return ((ExcelDataValidationType)obj).Type == Type;
+        }
+
+        /// <summary>
+        /// Overrides GetHashCode()
+        /// </summary>
+        /// <returns></returns>
+        public override int GetHashCode()
+        {
+            return base.GetHashCode();
+        }
+
+        /// <summary>
+        /// Integer values
+        /// </summary>
+        private static ExcelDataValidationType _any;
+        public static ExcelDataValidationType Any
+        {
+            get
+            {
+                if (_any == null)
+                {
+                    _any = new ExcelDataValidationType(eDataValidationType.Any, false, DataValidationSchemaNames.Any);
+                }
+                return _any;
+            }
+        }
+
+        /// <summary>
+        /// Integer values
+        /// </summary>
+        private static ExcelDataValidationType _whole;
+        public static ExcelDataValidationType Whole
+        {
+            get
+            {
+                if (_whole == null)
+                {
+                    _whole = new ExcelDataValidationType(eDataValidationType.Whole, true, DataValidationSchemaNames.Whole);
+                }
+                return _whole;
+            }
+        }
+
+        /// <summary>
+        /// List of allowed values
+        /// </summary>
+        private static ExcelDataValidationType _list;
+        public static ExcelDataValidationType List
+        {
+            get
+            {
+                if (_list == null)
+                {
+                    _list = new ExcelDataValidationType(eDataValidationType.List, false, DataValidationSchemaNames.List);
+                }
+                return _list;
+            }
+        }
+
+        private static ExcelDataValidationType _decimal;
+        public static ExcelDataValidationType Decimal
+        {
+            get
+            {
+                if (_decimal == null)
+                {
+                    _decimal = new ExcelDataValidationType(eDataValidationType.Decimal, true, DataValidationSchemaNames.Decimal);
+                }
+                return _decimal;
+            }
+        }
+
+        private static ExcelDataValidationType _textLength;
+        public static ExcelDataValidationType TextLength
+        {
+            get
+            {
+                if (_textLength == null)
+                {
+                    _textLength = new ExcelDataValidationType(eDataValidationType.TextLength, true, DataValidationSchemaNames.TextLength);
+                }
+                return _textLength;
+            }
+        }
+
+        private static ExcelDataValidationType _dateTime;
+        public static ExcelDataValidationType DateTime
+        {
+            get
+            {
+                if (_dateTime == null)
+                {
+                    _dateTime = new ExcelDataValidationType(eDataValidationType.DateTime, true, DataValidationSchemaNames.Date);
+                }
+                return _dateTime;
+            }
+        }
+
+        private static ExcelDataValidationType _time;
+        public static ExcelDataValidationType Time
+        {
+            get
+            {
+                if (_time == null)
+                {
+                    _time = new ExcelDataValidationType(eDataValidationType.Time, true, DataValidationSchemaNames.Time);
+                }
+                return _time;
+            }
+        }
+
+        private static ExcelDataValidationType _custom;
+        public static ExcelDataValidationType Custom
+        {
+            get
+            {
+                if (_custom == null)
+                {
+                    _custom = new ExcelDataValidationType(eDataValidationType.Custom, true, DataValidationSchemaNames.Custom);
+                }
+                return _custom;
+            }
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/ExcelDataValidationWarningStyle.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/ExcelDataValidationWarningStyle.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/ExcelDataValidationWarningStyle.cs	(revision 12707)
@@ -0,0 +1,61 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2011-01-01
+ * Jan Källman		                License changed GPL-->LGPL  2011-12-27
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.DataValidation
+{
+    /// <summary>
+    /// warning style, controls how Excel will handle invalid changes.
+    /// </summary>
+    public enum ExcelDataValidationWarningStyle
+    {
+        /// <summary>
+        /// warning style will be excluded
+        /// </summary>
+        undefined,
+        /// <summary>
+        /// stop warning style, invalid changes will not be accepted
+        /// </summary>
+        stop,
+        /// <summary>
+        /// warning will be presented when an attempt to an invalid change is done, but the change will be accepted.
+        /// </summary>
+        warning,
+        /// <summary>
+        /// information warning style.
+        /// </summary>
+        information
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/ExcelDataValidationWithFormula.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/ExcelDataValidationWithFormula.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/ExcelDataValidationWithFormula.cs	(revision 12707)
@@ -0,0 +1,109 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2011-01-01
+ * Jan Källman		                License changed GPL-->LGPL  2011-12-27
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.DataValidation.Formulas.Contracts;
+using System.Xml;
+
+namespace OfficeOpenXml.DataValidation
+{
+    /// <summary>
+    /// A validation containing a formula
+    /// </summary>
+    /// <typeparam name="T"></typeparam>
+    public class ExcelDataValidationWithFormula<T> : ExcelDataValidation
+        where T : IExcelDataValidationFormula
+    {
+        /// <summary>
+        /// Constructor
+        /// </summary>
+        /// <param name="worksheet"></param>
+        /// <param name="address"></param>
+        /// <param name="validationType"></param>
+        internal ExcelDataValidationWithFormula(ExcelWorksheet worksheet, string address, ExcelDataValidationType validationType)
+            : this(worksheet, address, validationType, null)
+        {
+
+        }
+
+         /// <summary>
+        /// Constructor
+        /// </summary>
+        /// <param name="worksheet">Worksheet that owns the validation</param>
+        /// <param name="itemElementNode">Xml top node (dataValidations)</param>
+        /// <param name="validationType">Data validation type</param>
+        /// <param name="address">address for data validation</param>
+        internal ExcelDataValidationWithFormula(ExcelWorksheet worksheet, string address, ExcelDataValidationType validationType, XmlNode itemElementNode)
+            : base(worksheet, address, validationType, itemElementNode)
+        {
+            
+        }
+
+        /// <summary>
+        /// Constructor
+        /// </summary>
+        /// <param name="worksheet">Worksheet that owns the validation</param>
+        /// <param name="itemElementNode">Xml top node (dataValidations)</param>
+        /// <param name="validationType">Data validation type</param>
+        /// <param name="address">address for data validation</param>
+        /// <param name="namespaceManager">for test purposes</param>
+        internal ExcelDataValidationWithFormula(ExcelWorksheet worksheet, string address, ExcelDataValidationType validationType, XmlNode itemElementNode, XmlNamespaceManager namespaceManager)
+            : base(worksheet, address, validationType, itemElementNode, namespaceManager)
+        {
+
+        }
+
+
+        /// <summary>
+        /// Formula - Either a {T} value (except for custom validation) or a spreadsheet formula
+        /// </summary>
+        public T Formula
+        {
+            get;
+            protected set;
+        }
+
+        public override void Validate()
+        {
+            base.Validate();
+            if (Operator == ExcelDataValidationOperator.between || Operator == ExcelDataValidationOperator.notBetween)
+            {
+                if (string.IsNullOrEmpty(Formula2Internal))
+                {
+                    throw new InvalidOperationException("Validation of " + Address.Address + " failed: Formula2 must be set if operator is 'between' or 'notBetween'");
+                }
+            }
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/ExcelDataValidationWithFormula2.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/ExcelDataValidationWithFormula2.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/ExcelDataValidationWithFormula2.cs	(revision 12707)
@@ -0,0 +1,91 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2011-01-01
+ * Jan Källman		                License changed GPL-->LGPL  2011-12-27
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.DataValidation.Formulas.Contracts;
+using System.Xml;
+
+namespace OfficeOpenXml.DataValidation
+{
+    public class ExcelDataValidationWithFormula2<T> : ExcelDataValidationWithFormula<T>
+        where T : IExcelDataValidationFormula
+    {
+        /// <summary>
+        /// Constructor
+        /// </summary>
+        /// <param name="worksheet"></param>
+        /// <param name="address"></param>
+        /// <param name="validationType"></param>
+        internal ExcelDataValidationWithFormula2(ExcelWorksheet worksheet, string address, ExcelDataValidationType validationType)
+            : this(worksheet, address, validationType, null)
+        {
+
+        }
+
+         /// <summary>
+        /// Constructor
+        /// </summary>
+        /// <param name="worksheet">Worksheet that owns the validation</param>
+        /// <param name="itemElementNode">Xml top node (dataValidations)</param>
+        /// <param name="validationType">Data validation type</param>
+        /// <param name="address">address for data validation</param>
+        internal ExcelDataValidationWithFormula2(ExcelWorksheet worksheet, string address, ExcelDataValidationType validationType, XmlNode itemElementNode)
+            : base(worksheet, address, validationType, itemElementNode)
+        {
+            
+        }
+
+        /// <summary>
+        /// Constructor
+        /// </summary>
+        /// <param name="worksheet">Worksheet that owns the validation</param>
+        /// <param name="itemElementNode">Xml top node (dataValidations)</param>
+        /// <param name="validationType">Data validation type</param>
+        /// <param name="address">address for data validation</param>
+        /// <param name="namespaceManager">for test purposes</param>
+        internal ExcelDataValidationWithFormula2(ExcelWorksheet worksheet, string address, ExcelDataValidationType validationType, XmlNode itemElementNode, XmlNamespaceManager namespaceManager)
+            : base(worksheet, address, validationType, itemElementNode, namespaceManager)
+        {
+
+        }
+        /// <summary>
+        /// Formula - Either a {T} value or a spreadsheet formula
+        /// </summary>
+        public T Formula2
+        {
+            get;
+            protected set;
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/ExcelTime.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/ExcelTime.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/ExcelTime.cs	(revision 12707)
@@ -0,0 +1,269 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2011-01-01
+ * Jan Källman		                License changed GPL-->LGPL  2011-12-27
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Globalization;
+
+namespace OfficeOpenXml.DataValidation
+{
+    /// <summary>
+    /// Represents a time between 00:00:00 and 23:59:59
+    /// </summary>
+    public class ExcelTime
+    {
+        private event EventHandler _timeChanged;
+        private readonly decimal SecondsPerDay = 3600 * 24;
+        private readonly decimal SecondsPerHour = 3600;
+        private readonly decimal SecondsPerMinute = 60;
+        /// <summary>
+        /// Max number of decimals when rounding.
+        /// </summary>
+        public const int NumberOfDecimals = 15;
+
+        /// <summary>
+        /// Default constructor
+        /// </summary>
+        public ExcelTime()
+        {
+
+        }
+
+        /// <summary>
+        /// Constructor
+        /// </summary>
+        /// <param name="value">An existing time for initialization</param>
+        public ExcelTime(decimal value)
+        {
+            if (value < 0M)
+            {
+                throw new ArgumentException("Value cannot be less than 0");
+            }
+            else if (value >= 1M)
+            {
+                throw new ArgumentException("Value cannot be greater or equal to 1");
+            }
+            Init(value);
+        }
+
+        private void Init(decimal value)
+        {
+            // handle hour
+            decimal totalSeconds = value * SecondsPerDay;
+            decimal hour = Math.Floor(totalSeconds / SecondsPerHour);
+            Hour = (int)hour;
+
+            // handle minute
+            decimal remainingSeconds = totalSeconds - (hour * SecondsPerHour);
+            decimal minute = Math.Floor(remainingSeconds / SecondsPerMinute);
+            Minute = (int)minute;
+
+            // handle second
+            remainingSeconds = totalSeconds - (hour * SecondsPerHour) - (minute * SecondsPerMinute);
+            decimal second = Math.Round(remainingSeconds, MidpointRounding.AwayFromZero);
+            // Second might be rounded to 60... the SetSecond method handles that.
+            SetSecond((int)second);
+        }
+
+        /// <summary>
+        /// If we are unlucky second might be rounded up to 60. This will have the minute to be raised and might affect the hour.
+        /// </summary>
+        /// <param name="value"></param>
+        private void SetSecond(int value)
+        {
+            if (value == 60)
+            {
+                Second = 0;
+                var minute = Minute + 1;
+                SetMinute(minute);
+            }
+            else
+            {
+                Second = value;
+            }
+        }
+
+        private void SetMinute(int value)
+        {
+            if (value == 60)
+            {
+                Minute = 0;
+                var hour = Hour + 1;
+                SetHour(hour);
+            }
+            else
+            {
+                Minute = value;
+            }
+        }
+
+        private void SetHour(int value)
+        {
+            if (value == 24)
+            {
+                Hour = 0;
+            }
+        }
+
+        internal event EventHandler TimeChanged
+        {
+            add { _timeChanged += value; }
+            remove { _timeChanged -= value; }
+        }
+
+        private void OnTimeChanged()
+        {
+            if (_timeChanged != null)
+            {
+                _timeChanged(this, EventArgs.Empty);
+            }
+        }
+
+        private int _hour;
+        /// <summary>
+        /// Hour between 0 and 23
+        /// </summary>
+        public int Hour 
+        {
+            get
+            {
+                return _hour;
+            }
+            set
+            {
+                if (value < 0)
+                {
+                    throw new InvalidOperationException("Value for hour cannot be negative");
+                }
+                if (value > 23)
+                {
+                    throw new InvalidOperationException("Value for hour cannot be greater than 23");
+                }
+                _hour = value;
+                OnTimeChanged();
+            }
+        }
+
+        private int _minute;
+        /// <summary>
+        /// Minute between 0 and 59
+        /// </summary>
+        public int Minute
+        {
+            get
+            {
+                return _minute;
+            }
+            set
+            {
+                if (value < 0)
+                {
+                    throw new InvalidOperationException("Value for minute cannot be negative");
+                }
+                if (value > 59)
+                {
+                    throw new InvalidOperationException("Value for minute cannot be greater than 59");
+                }
+                _minute = value;
+                OnTimeChanged();
+            }
+        }
+
+        private int? _second;
+        /// <summary>
+        /// Second between 0 and 59
+        /// </summary>
+        public int? Second
+        {
+            get
+            {
+                return _second;
+            }
+            set
+            {
+                if (value < 0)
+                {
+                    throw new InvalidOperationException("Value for second cannot be negative");
+                }
+                if (value > 59)
+                {
+                    throw new InvalidOperationException("Value for second cannot be greater than 59");
+                }
+                _second = value;
+                OnTimeChanged();
+            }
+        }
+
+        private decimal Round(decimal value)
+        {
+            return Math.Round(value, NumberOfDecimals);
+        }
+
+        private decimal ToSeconds()
+        {
+            var result = Hour * SecondsPerHour;
+            result += Minute * SecondsPerMinute;
+            result += Second ?? 0;
+            return (decimal)result;
+        }
+
+        /// <summary>
+        /// Returns the excel decimal representation of a time.
+        /// </summary>
+        /// <returns></returns>
+        public decimal ToExcelTime()
+        {
+            var seconds = ToSeconds();
+            return Round(seconds / (decimal)SecondsPerDay);
+        }
+
+        /// <summary>
+        /// Returns the excel decimal representation of a time as a string.
+        /// </summary>
+        /// <returns></returns>
+        public string ToExcelString()
+        {
+            return ToExcelTime().ToString(CultureInfo.InvariantCulture);
+        }
+
+        public override string ToString()
+        {
+            var second = Second ?? 0;
+            return string.Format("{0}:{1}:{2}",
+                Hour < 10 ? "0" + Hour.ToString() : Hour.ToString(),
+                Minute < 10 ? "0" + Minute.ToString() : Minute.ToString(),
+                second < 10 ? "0" + second.ToString() : second.ToString());
+        }
+
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Formulas/Contracts/IExcelDataValidationFormula.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Formulas/Contracts/IExcelDataValidationFormula.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Formulas/Contracts/IExcelDataValidationFormula.cs	(revision 12707)
@@ -0,0 +1,49 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2011-01-08
+ * Jan Källman		    License changed GPL-->LGPL  2011-12-27
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.DataValidation.Formulas.Contracts
+{
+    /// <summary>
+    /// Interface for a data validation formula
+    /// </summary>
+    public interface IExcelDataValidationFormula
+    {
+        /// <summary>
+        /// An excel formula
+        /// </summary>
+        string ExcelFormula { get; set; }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Formulas/Contracts/IExcelDataValidationFormulaDateTime.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Formulas/Contracts/IExcelDataValidationFormulaDateTime.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Formulas/Contracts/IExcelDataValidationFormulaDateTime.cs	(revision 12707)
@@ -0,0 +1,45 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2011-01-08
+ * Jan Källman		    License changed GPL-->LGPL  2011-12-27
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.DataValidation.Formulas.Contracts
+{
+    /// <summary>
+    /// Validation formula interface for <see cref="DateTime"/>
+    /// </summary>
+    public interface IExcelDataValidationFormulaDateTime : IExcelDataValidationFormulaWithValue<DateTime?>
+    {
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Formulas/Contracts/IExcelDataValidationFormulaDecimal.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Formulas/Contracts/IExcelDataValidationFormulaDecimal.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Formulas/Contracts/IExcelDataValidationFormulaDecimal.cs	(revision 12707)
@@ -0,0 +1,45 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2011-01-08
+ * Jan Källman		    License changed GPL-->LGPL  2011-12-27
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.DataValidation.Formulas.Contracts
+{
+    /// <summary>
+    /// Interface for a data validation formula of <see cref="System.Single">float</see> value
+    /// </summary>
+    public interface IExcelDataValidationFormulaDecimal : IExcelDataValidationFormulaWithValue<double?>
+    {
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Formulas/Contracts/IExcelDataValidationFormulaInt.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Formulas/Contracts/IExcelDataValidationFormulaInt.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Formulas/Contracts/IExcelDataValidationFormulaInt.cs	(revision 12707)
@@ -0,0 +1,45 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2011-01-08
+ * Jan Källman		    License changed GPL-->LGPL  2011-12-27
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.DataValidation.Formulas.Contracts
+{
+    /// <summary>
+    /// Interface for a data validation formula of <see cref="System.Int32"/> value
+    /// </summary>
+    public interface IExcelDataValidationFormulaInt : IExcelDataValidationFormulaWithValue<int?>
+    {
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Formulas/Contracts/IExcelDataValidationFormulaList.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Formulas/Contracts/IExcelDataValidationFormulaList.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Formulas/Contracts/IExcelDataValidationFormulaList.cs	(revision 12707)
@@ -0,0 +1,49 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2011-01-08
+ * Jan Källman		    License changed GPL-->LGPL  2011-12-27
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.DataValidation.Formulas.Contracts
+{
+    /// <summary>
+    /// Interface for a data validation of list type
+    /// </summary>
+    public interface IExcelDataValidationFormulaList : IExcelDataValidationFormula
+    {
+        /// <summary>
+        /// A list of value strings.
+        /// </summary>
+        IList<string> Values { get; }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Formulas/Contracts/IExcelDataValidationFormulaTime.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Formulas/Contracts/IExcelDataValidationFormulaTime.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Formulas/Contracts/IExcelDataValidationFormulaTime.cs	(revision 12707)
@@ -0,0 +1,43 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2011-01-08
+ * Jan Källman		    License changed GPL-->LGPL  2011-12-27
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.DataValidation;
+
+namespace OfficeOpenXml.DataValidation.Formulas.Contracts
+{
+    public interface IExcelDataValidationFormulaTime : IExcelDataValidationFormulaWithValue<ExcelTime>
+    {
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Formulas/Contracts/IExcelDataValidationFormulaWithValue.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Formulas/Contracts/IExcelDataValidationFormulaWithValue.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Formulas/Contracts/IExcelDataValidationFormulaWithValue.cs	(revision 12707)
@@ -0,0 +1,50 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2011-01-08
+ * Jan Källman		    License changed GPL-->LGPL  2011-12-27
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.DataValidation.Formulas.Contracts
+{
+    /// <summary>
+    /// Interface for a formula with a value
+    /// </summary>
+    /// <typeparam name="T"></typeparam>
+    public interface IExcelDataValidationFormulaWithValue<T> : IExcelDataValidationFormula
+    {
+        /// <summary>
+        /// The value.
+        /// </summary>
+        T Value { get; set; }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Formulas/ExcelDataValidationFormula.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Formulas/ExcelDataValidationFormula.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Formulas/ExcelDataValidationFormula.cs	(revision 12707)
@@ -0,0 +1,138 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2011-01-08
+ * Jan Källman		    License changed GPL-->LGPL  2011-12-27
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Xml;
+using OfficeOpenXml.Utils;
+using OfficeOpenXml.DataValidation.Formulas.Contracts;
+
+namespace OfficeOpenXml.DataValidation.Formulas
+{
+    /// <summary>
+    /// Enumeration representing the state of an <see cref="ExcelDataValidationFormulaValue{T}"/>
+    /// </summary>
+    internal enum FormulaState
+    {
+        /// <summary>
+        /// Value is set
+        /// </summary>
+        Value,
+        /// <summary>
+        /// Formula is set
+        /// </summary>
+        Formula
+    }
+
+    /// <summary>
+    /// Base class for a formula
+    /// </summary>
+    internal abstract class ExcelDataValidationFormula : XmlHelper
+    {
+        /// <summary>
+        /// Constructor
+        /// </summary>
+        /// <param name="namespaceManager">Namespacemanger of the worksheet</param>
+        /// <param name="topNode">validation top node</param>
+        /// <param name="formulaPath">xml path of the current formula</param>
+        public ExcelDataValidationFormula(XmlNamespaceManager namespaceManager, XmlNode topNode, string formulaPath)
+            : base(namespaceManager, topNode)
+        {
+            Require.Argument(formulaPath).IsNotNullOrEmpty("formulaPath");
+            FormulaPath = formulaPath;
+        }
+
+        private string _formula;
+
+        protected string FormulaPath
+        {
+            get;
+            private set;
+        }
+
+        /// <summary>
+        /// State of the validationformula, i.e. tells if value or formula is set
+        /// </summary>
+        protected FormulaState State
+        {
+            get;
+            set;
+        }
+
+        /// <summary>
+        /// A formula which output must match the current validation type
+        /// </summary>
+        public string ExcelFormula
+        {
+            get
+            {
+                return _formula;
+            }
+            set
+            {
+                if (!string.IsNullOrEmpty(value))
+                {
+                    ResetValue();
+                    State = FormulaState.Formula;
+                }
+                if (value != null && value.Length > 255)
+                {
+                    throw new InvalidOperationException("The length of a DataValidation formula cannot exceed 255 characters");
+                }
+                //var val = SqRefUtility.ToSqRefAddress(value);
+                _formula = value;
+                SetXmlNodeString(FormulaPath, value);
+            }
+        }
+
+        internal abstract void ResetValue();
+
+        /// <summary>
+        /// This value will be stored in the xml. Can be overridden by subclasses
+        /// </summary>
+        internal virtual string GetXmlValue()
+        {
+            if (State == FormulaState.Formula)
+            {
+                return ExcelFormula;
+            }
+            return GetValueAsString();
+        }
+
+        /// <summary>
+        /// Returns the value as a string. Must be implemented by subclasses
+        /// </summary>
+        /// <returns></returns>
+        protected abstract string GetValueAsString();
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Formulas/ExcelDataValidationFormulaCustom.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Formulas/ExcelDataValidationFormulaCustom.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Formulas/ExcelDataValidationFormulaCustom.cs	(revision 12707)
@@ -0,0 +1,72 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2011-01-08
+ * Jan Källman		    License changed GPL-->LGPL  2011-12-27
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.DataValidation.Formulas.Contracts;
+using System.Xml;
+
+namespace OfficeOpenXml.DataValidation.Formulas
+{
+    /// <summary>
+    /// 
+    /// </summary>
+    internal class ExcelDataValidationFormulaCustom : ExcelDataValidationFormula, IExcelDataValidationFormula
+    {
+        public ExcelDataValidationFormulaCustom(XmlNamespaceManager namespaceManager, XmlNode topNode, string formulaPath)
+            : base(namespaceManager, topNode, formulaPath)
+        {
+            var value = GetXmlNodeString(formulaPath);
+            if (!string.IsNullOrEmpty(value))
+            {
+                ExcelFormula = value;
+            }
+            State = FormulaState.Formula;
+        }
+
+        internal override string GetXmlValue()
+        {
+            return ExcelFormula;
+        }
+
+        protected override string GetValueAsString()
+        {
+            return ExcelFormula;
+        }
+
+        internal override void ResetValue()
+        {
+            ExcelFormula = null;
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Formulas/ExcelDataValidationFormulaDateTime.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Formulas/ExcelDataValidationFormulaDateTime.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Formulas/ExcelDataValidationFormulaDateTime.cs	(revision 12707)
@@ -0,0 +1,68 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2011-01-08
+ * Jan Källman		    License changed GPL-->LGPL  2011-12-27
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Xml;
+using OfficeOpenXml.DataValidation.Formulas.Contracts;
+using System.Globalization;
+
+namespace OfficeOpenXml.DataValidation.Formulas
+{
+    internal class ExcelDataValidationFormulaDateTime : ExcelDataValidationFormulaValue<DateTime?>, IExcelDataValidationFormulaDateTime
+    {
+        public ExcelDataValidationFormulaDateTime(XmlNamespaceManager namespaceManager, XmlNode topNode, string formulaPath)
+            : base(namespaceManager, topNode, formulaPath)
+        {
+            var value = GetXmlNodeString(formulaPath);
+            if (!string.IsNullOrEmpty(value))
+            {
+                double oADate = default(double);
+                if (double.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out oADate))
+                {
+                    Value = DateTime.FromOADate(oADate);
+                }
+                else
+                {
+                    ExcelFormula = value;
+                }
+            }
+        }
+
+        protected override string GetValueAsString()
+        {
+            return Value.HasValue ? Value.Value.ToOADate().ToString(CultureInfo.InvariantCulture) : string.Empty;
+        }
+
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Formulas/ExcelDataValidationFormulaDecimal.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Formulas/ExcelDataValidationFormulaDecimal.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Formulas/ExcelDataValidationFormulaDecimal.cs	(revision 12707)
@@ -0,0 +1,70 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2011-01-08
+ * Jan Källman		    License changed GPL-->LGPL  2011-12-27
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Xml;
+using OfficeOpenXml.DataValidation.Formulas.Contracts;
+using System.Globalization;
+
+namespace OfficeOpenXml.DataValidation.Formulas
+{
+    /// <summary>
+    /// 
+    /// </summary>
+    internal class ExcelDataValidationFormulaDecimal : ExcelDataValidationFormulaValue<double?>, IExcelDataValidationFormulaDecimal
+    {
+        public ExcelDataValidationFormulaDecimal(XmlNamespaceManager namespaceManager, XmlNode topNode, string formulaPath)
+            : base(namespaceManager, topNode, formulaPath)
+        {
+            var value = GetXmlNodeString(formulaPath);
+            if (!string.IsNullOrEmpty(value))
+            {
+                double dValue = default(double);
+                if (double.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out dValue))
+                {
+                    Value = dValue;
+                }
+                else
+                {
+                    ExcelFormula = value;
+                }
+            }
+        }
+
+        protected override string GetValueAsString()
+        {
+            return Value.HasValue ? Value.Value.ToString("R15", CultureInfo.InvariantCulture) : string.Empty;
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Formulas/ExcelDataValidationFormulaInt.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Formulas/ExcelDataValidationFormulaInt.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Formulas/ExcelDataValidationFormulaInt.cs	(revision 12707)
@@ -0,0 +1,67 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2011-01-08
+ * Jan Källman		    License changed GPL-->LGPL  2011-12-27
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Xml;
+using OfficeOpenXml.DataValidation.Formulas.Contracts;
+using System.Globalization;
+
+namespace OfficeOpenXml.DataValidation.Formulas
+{
+    internal class ExcelDataValidationFormulaInt : ExcelDataValidationFormulaValue<int?>, IExcelDataValidationFormulaInt
+    {
+        public ExcelDataValidationFormulaInt(XmlNamespaceManager namespaceManager, XmlNode topNode, string formulaPath)
+            : base(namespaceManager, topNode, formulaPath)
+        {
+            var value = GetXmlNodeString(formulaPath);
+            if (!string.IsNullOrEmpty(value))
+            {
+                int intValue = default(int);
+                if (int.TryParse(value, out intValue))
+                {
+                    Value = intValue;
+                }
+                else
+                {
+                    ExcelFormula = value;
+                }
+            }
+        }
+
+        protected override string GetValueAsString()
+        {
+            return Value.HasValue ? Value.Value.ToString() : string.Empty;
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Formulas/ExcelDataValidationFormulaList.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Formulas/ExcelDataValidationFormulaList.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Formulas/ExcelDataValidationFormulaList.cs	(revision 12707)
@@ -0,0 +1,247 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2011-01-08
+ * Jan Källman		    License changed GPL-->LGPL  2011-12-27
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Xml;
+using OfficeOpenXml.Utils;
+using OfficeOpenXml.DataValidation.Formulas.Contracts;
+using System.Text.RegularExpressions;
+using System.Collections;
+
+namespace OfficeOpenXml.DataValidation.Formulas
+{
+    internal class ExcelDataValidationFormulaList : ExcelDataValidationFormula, IExcelDataValidationFormulaList
+    {
+        #region class DataValidationList
+        private class DataValidationList : IList<string>, ICollection
+        {
+            private IList<string> _items = new List<string>();
+            private EventHandler<EventArgs> _listChanged;
+
+            public event EventHandler<EventArgs> ListChanged
+            {
+                add { _listChanged += value; }
+                remove { _listChanged -= value; }
+            }
+
+            private void OnListChanged()
+            {
+                if (_listChanged != null)
+                {
+                    _listChanged(this, EventArgs.Empty);
+                }
+            }
+
+            #region IList members
+            int IList<string>.IndexOf(string item)
+            {
+                return _items.IndexOf(item);
+            }
+
+            void IList<string>.Insert(int index, string item)
+            {
+                _items.Insert(index, item);
+                OnListChanged();
+            }
+
+            void IList<string>.RemoveAt(int index)
+            {
+                _items.RemoveAt(index);
+                OnListChanged();
+            }
+
+            string IList<string>.this[int index]
+            {
+                get
+                {
+                    return _items[index];
+                }
+                set
+                {
+                    _items[index] = value;
+                    OnListChanged();
+                }
+            }
+
+            void ICollection<string>.Add(string item)
+            {
+                _items.Add(item);
+                OnListChanged();
+            }
+
+            void ICollection<string>.Clear()
+            {
+                _items.Clear();
+                OnListChanged();
+            }
+
+            bool ICollection<string>.Contains(string item)
+            {
+                return _items.Contains(item);
+            }
+
+            void ICollection<string>.CopyTo(string[] array, int arrayIndex)
+            {
+                _items.CopyTo(array, arrayIndex);
+            }
+
+            int ICollection<string>.Count
+            {
+                get { return _items.Count; }
+            }
+
+            bool ICollection<string>.IsReadOnly
+            {
+                get { return false; }
+            }
+
+            bool ICollection<string>.Remove(string item)
+            {
+                var retVal = _items.Remove(item);
+                OnListChanged();
+                return retVal;
+            }
+
+            IEnumerator<string> IEnumerable<string>.GetEnumerator()
+            {
+                return _items.GetEnumerator();
+            }
+
+            System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
+            {
+                return _items.GetEnumerator();
+            }
+            #endregion
+
+            public void CopyTo(Array array, int index)
+            {
+                _items.CopyTo((string[])array, index);
+            }
+
+            int ICollection.Count
+            {
+                get { return _items.Count; }
+            }
+
+            public bool IsSynchronized
+            {
+                get { return ((ICollection)_items).IsSynchronized; }
+            }
+
+            public object SyncRoot
+            {
+                get { return ((ICollection)_items).SyncRoot; }
+            }
+        }
+        #endregion
+
+        public ExcelDataValidationFormulaList(XmlNamespaceManager namespaceManager, XmlNode itemNode, string formulaPath)
+            : base(namespaceManager, itemNode, formulaPath)
+        {
+            Require.Argument(formulaPath).IsNotNullOrEmpty("formulaPath");
+            _formulaPath = formulaPath;
+            var values = new DataValidationList();
+            values.ListChanged += new EventHandler<EventArgs>(values_ListChanged);
+            Values = values;
+            SetInitialValues();
+        }
+
+        private string _formulaPath;
+
+        private void SetInitialValues()
+        {
+            var @value = GetXmlNodeString(_formulaPath);
+            if (!string.IsNullOrEmpty(@value))
+            {
+                if (@value.StartsWith("\"") && @value.EndsWith("\""))
+                {
+                    @value = @value.TrimStart('"').TrimEnd('"');
+                    var items = @value.Split(new char[]{','}, StringSplitOptions.RemoveEmptyEntries);
+                    foreach (var item in items)
+                    {
+                        Values.Add(item);
+                    }
+                }
+                else
+                {
+                    ExcelFormula = @value;
+                }
+            }
+        }
+
+        void values_ListChanged(object sender, EventArgs e)
+        {
+            if (Values.Count > 0)
+            {
+                State = FormulaState.Value;
+            }
+            var valuesAsString = GetValueAsString();
+            // Excel supports max 255 characters in this field.
+            if (valuesAsString.Length > 255)
+            {
+                throw new InvalidOperationException("The total length of a DataValidation list cannot exceed 255 characters");
+            }
+            SetXmlNodeString(_formulaPath, valuesAsString);
+        }
+        public IList<string> Values
+        {
+            get;
+            private set;
+        }
+
+        protected override string  GetValueAsString()
+        {
+            var sb = new StringBuilder();
+            foreach (var val in Values)
+            {
+                if (sb.Length == 0)
+                {
+                    sb.Append("\"");
+                    sb.Append(val);
+                }
+                else
+                {
+                    sb.AppendFormat(",{0}", val);
+                }
+            }
+            sb.Append("\"");
+            return sb.ToString();
+        }
+
+        internal override void ResetValue()
+        {
+            Values.Clear();
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Formulas/ExcelDataValidationFormulaTime.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Formulas/ExcelDataValidationFormulaTime.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Formulas/ExcelDataValidationFormulaTime.cs	(revision 12707)
@@ -0,0 +1,88 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2011-01-08
+ * Jan Källman		                License changed GPL-->LGPL  2011-12-27
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.DataValidation.Formulas.Contracts;
+using OfficeOpenXml.DataValidation;
+using System.Xml;
+using System.Globalization;
+
+namespace OfficeOpenXml.DataValidation.Formulas
+{
+    internal class ExcelDataValidationFormulaTime : ExcelDataValidationFormulaValue<ExcelTime>, IExcelDataValidationFormulaTime
+    {
+        public ExcelDataValidationFormulaTime(XmlNamespaceManager namespaceManager, XmlNode topNode, string formulaPath)
+            : base(namespaceManager, topNode, formulaPath)
+        {
+            var value = GetXmlNodeString(formulaPath);
+            if (!string.IsNullOrEmpty(value))
+            {
+                decimal time = default(decimal);
+                if (decimal.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out time))
+                {
+                    Value = new ExcelTime(time);
+                }
+                else
+                {
+                    Value = new ExcelTime();
+                    ExcelFormula = value;
+                }
+            }
+            else
+            {
+                Value = new ExcelTime();
+            }
+            Value.TimeChanged += new EventHandler(Value_TimeChanged);
+        }
+
+        void Value_TimeChanged(object sender, EventArgs e)
+        {
+            SetXmlNodeString(FormulaPath, Value.ToExcelString());
+        }
+
+        protected override string GetValueAsString()
+        {
+            if (State == FormulaState.Value)
+            {
+                return Value.ToExcelString();
+            }
+            return string.Empty;
+        }
+
+        internal override void ResetValue()
+        {
+            Value = new ExcelTime();
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Formulas/ExcelDataValidationFormulaValue.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Formulas/ExcelDataValidationFormulaValue.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/Formulas/ExcelDataValidationFormulaValue.cs	(revision 12707)
@@ -0,0 +1,84 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2011-01-08
+ * Jan Källman		                License changed GPL-->LGPL  2011-12-27
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.Utils;
+using System.Xml;
+
+namespace OfficeOpenXml.DataValidation.Formulas
+{
+
+    /// <summary>
+    /// This class represents a validation formula. Its value can be specified as a value of the specified datatype or as a formula.
+    /// </summary>
+    /// <typeparam name="T"></typeparam>
+    internal abstract class ExcelDataValidationFormulaValue<T> : ExcelDataValidationFormula
+    {
+        /// <summary>
+        /// Constructor
+        /// </summary>
+        /// <param name="namespaceManager">Namespacemanger of the worksheet</param>
+        /// <param name="topNode">validation top node</param>
+        /// <param name="formulaPath">xml path of the current formula</param>
+        public ExcelDataValidationFormulaValue(XmlNamespaceManager namespaceManager, XmlNode topNode, string formulaPath)
+            : base(namespaceManager, topNode, formulaPath)
+        {
+
+        }
+
+        private T _value;
+        /// <summary>
+        /// Typed value
+        /// </summary>
+        public T Value 
+        {
+            get
+            {
+                return _value;
+            }
+            set
+            {
+                State = FormulaState.Value;
+                _value = value;
+                SetXmlNodeString(FormulaPath, GetValueAsString());
+            }
+        }
+
+        internal override void ResetValue()
+        {
+            Value = default(T);
+        }
+
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/IRangeDataValidation.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/IRangeDataValidation.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/IRangeDataValidation.cs	(revision 12707)
@@ -0,0 +1,85 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2011-03-23
+ * Jan Källman		                License changed GPL-->LGPL  2011-12-27
+ *******************************************************************************/
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.DataValidation.Contracts;
+
+namespace OfficeOpenXml.DataValidation
+{
+    /// <summary>
+    /// Provides functionality for adding datavalidation to a range (<see cref="ExcelRangeBase"/>). Each method will
+    /// return a configurable validation.
+    /// </summary>
+    public interface IRangeDataValidation
+    {
+        /// <summary>
+        /// Adds a <see cref="IExcelDataValidationAny"/> to the range.
+        /// </summary>
+        /// <returns>A <see cref="ExcelDataValidationAny"/> that can be configured for any validation</returns>
+        IExcelDataValidationAny AddAnyDataValidation();
+        /// <summary>
+        /// Adds a <see cref="IExcelDataValidationInt"/> to the range
+        /// </summary>
+        /// <returns>A <see cref="ExcelDataValidationInt"/> that can be configured for integer data validation</returns>
+        IExcelDataValidationInt AddIntegerDataValidation();
+        /// <summary>
+        /// Adds a <see cref="ExcelDataValidationDecimal"/> to the range
+        /// </summary>
+        /// <returns>A <see cref="ExcelDataValidationDecimal"/> that can be configured for decimal data validation</returns>
+        IExcelDataValidationDecimal AddDecimalDataValidation();
+        /// <summary>
+        /// Adds a <see cref="ExcelDataValidationDateTime"/> to the range
+        /// </summary>
+        /// <returns>A <see cref="ExcelDataValidationDecimal"/> that can be configured for datetime data validation</returns>
+        IExcelDataValidationDateTime AddDateTimeDataValidation();
+        /// <summary>
+        /// Adds a <see cref="IExcelDataValidationList"/> to the range
+        /// </summary>
+        /// <returns>A <see cref="ExcelDataValidationList"/> that can be configured for datetime data validation</returns>
+        IExcelDataValidationList AddListDataValidation();
+        /// <summary>
+        /// Adds a <see cref="IExcelDataValidationInt"/> regarding text length validation to the range.
+        /// </summary>
+        /// <returns></returns>
+        IExcelDataValidationInt AddTextLengthDataValidation();
+        /// <summary>
+        /// Adds a <see cref="IExcelDataValidationTime"/> to the range.
+        /// </summary>
+        /// <returns>A <see cref="IExcelDataValidationTime"/> that can be configured for time data validation</returns>
+        IExcelDataValidationTime AddTimeDataValidation();
+        /// <summary>
+        /// Adds a <see cref="IExcelDataValidationCustom"/> to the range.
+        /// </summary>
+        /// <returns>A <see cref="IExcelDataValidationCustom"/> that can be configured for custom validation</returns>
+        IExcelDataValidationCustom AddCustomDataValidation();
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/RangeDataValidation.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/RangeDataValidation.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/DataValidation/RangeDataValidation.cs	(revision 12707)
@@ -0,0 +1,94 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2011-03-23
+ * Jan Källman		                License changed GPL-->LGPL  2011-12-27
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.Utils;
+using OfficeOpenXml.DataValidation.Contracts;
+
+namespace OfficeOpenXml.DataValidation
+{
+    internal class RangeDataValidation : IRangeDataValidation
+    {
+        public RangeDataValidation(ExcelWorksheet worksheet, string address)
+        {
+            Require.Argument(worksheet).IsNotNull("worksheet");
+            Require.Argument(address).IsNotNullOrEmpty("address");
+            _worksheet = worksheet;
+            _address = address;
+        }
+
+        ExcelWorksheet _worksheet;
+        string _address;
+
+        public IExcelDataValidationAny AddAnyDataValidation()
+        {
+            return _worksheet.DataValidations.AddAnyValidation(_address);
+        }
+
+        public IExcelDataValidationInt AddIntegerDataValidation()
+        {
+            return _worksheet.DataValidations.AddIntegerValidation(_address);
+        }
+
+        public IExcelDataValidationDecimal AddDecimalDataValidation()
+        {
+            return _worksheet.DataValidations.AddDecimalValidation(_address);
+        }
+
+        public IExcelDataValidationDateTime AddDateTimeDataValidation()
+        {
+            return _worksheet.DataValidations.AddDateTimeValidation(_address);
+        }
+
+        public IExcelDataValidationList AddListDataValidation()
+        {
+            return _worksheet.DataValidations.AddListValidation(_address);
+        }
+
+        public IExcelDataValidationInt AddTextLengthDataValidation()
+        {
+            return _worksheet.DataValidations.AddTextLengthValidation(_address);
+        }
+
+        public IExcelDataValidationTime AddTimeDataValidation()
+        {
+            return _worksheet.DataValidations.AddTimeValidation(_address);
+        }
+
+        public IExcelDataValidationCustom AddCustomDataValidation()
+        {
+            return _worksheet.DataValidations.AddCustomValidation(_address);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelBarChart.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelBarChart.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelBarChart.cs	(revision 12707)
@@ -0,0 +1,493 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Jan Källman		Added		2009-10-01
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Xml;
+using OfficeOpenXml.Table.PivotTable;
+
+namespace OfficeOpenXml.Drawing.Chart
+{
+    /// <summary>
+    /// Bar chart
+    /// </summary>
+    public sealed class ExcelBarChart : ExcelChart
+    {
+        #region "Constructors"
+        //internal ExcelBarChart(ExcelDrawings drawings, XmlNode node) :
+        //    base(drawings, node/*, 1*/)
+        //{
+        //    SetChartNodeText("");
+        //}
+        //internal ExcelBarChart(ExcelDrawings drawings, XmlNode node, eChartType type) :
+        //    base(drawings, node, type)
+        //{
+        //    SetChartNodeText("");
+
+        //    SetTypeProperties(drawings, type);
+        //}
+        internal ExcelBarChart(ExcelDrawings drawings, XmlNode node, eChartType type, ExcelChart topChart, ExcelPivotTable PivotTableSource) :
+            base(drawings, node, type, topChart, PivotTableSource)
+        {
+            SetChartNodeText("");
+
+            SetTypeProperties(drawings, type);
+        }
+
+        internal ExcelBarChart(ExcelDrawings drawings, XmlNode node, Uri uriChart, Packaging.ZipPackagePart part, XmlDocument chartXml, XmlNode chartNode) :
+           base(drawings, node, uriChart, part, chartXml, chartNode)
+        {
+            SetChartNodeText(chartNode.Name);
+        }
+
+        internal ExcelBarChart(ExcelChart topChart, XmlNode chartNode) : 
+            base(topChart, chartNode)
+        {
+            SetChartNodeText(chartNode.Name);
+        }
+        #endregion
+        #region "Private functions"
+        //string _chartTopPath="c:chartSpace/c:chart/c:plotArea/{0}";
+        private void SetChartNodeText(string chartNodeText)
+        {
+            if(string.IsNullOrEmpty(chartNodeText))
+            {
+                chartNodeText = GetChartNodeText();
+            }
+            //_chartTopPath = string.Format(_chartTopPath, chartNodeText);
+            //_directionPath = string.Format(_directionPath, _chartTopPath);
+            //_shapePath = string.Format(_shapePath, _chartTopPath);
+        }
+        private void SetTypeProperties(ExcelDrawings drawings, eChartType type)
+        {
+            /******* Bar direction *******/
+            if (type == eChartType.BarClustered ||
+                type == eChartType.BarStacked ||
+                type == eChartType.BarStacked100 ||
+                type == eChartType.BarClustered3D ||
+                type == eChartType.BarStacked3D ||
+                type == eChartType.BarStacked1003D ||
+                type == eChartType.ConeBarClustered ||
+                type == eChartType.ConeBarStacked ||
+                type == eChartType.ConeBarStacked100 ||
+                type == eChartType.CylinderBarClustered ||
+                type == eChartType.CylinderBarStacked ||
+                type == eChartType.CylinderBarStacked100 ||
+                type == eChartType.PyramidBarClustered ||
+                type == eChartType.PyramidBarStacked ||
+                type == eChartType.PyramidBarStacked100)
+            {
+                Direction = eDirection.Bar;
+            }
+            else if (
+                type == eChartType.ColumnClustered ||
+                type == eChartType.ColumnStacked ||
+                type == eChartType.ColumnStacked100 ||
+                type == eChartType.Column3D ||
+                type == eChartType.ColumnClustered3D ||
+                type == eChartType.ColumnStacked3D ||
+                type == eChartType.ColumnStacked1003D ||
+                type == eChartType.ConeCol ||
+                type == eChartType.ConeColClustered ||
+                type == eChartType.ConeColStacked ||
+                type == eChartType.ConeColStacked100 ||
+                type == eChartType.CylinderCol ||
+                type == eChartType.CylinderColClustered ||
+                type == eChartType.CylinderColStacked ||
+                type == eChartType.CylinderColStacked100 ||
+                type == eChartType.PyramidCol ||
+                type == eChartType.PyramidColClustered ||
+                type == eChartType.PyramidColStacked ||
+                type == eChartType.PyramidColStacked100)
+            {
+                Direction = eDirection.Column;
+            }
+
+            /****** Shape ******/
+            if (/*type == eChartType.ColumnClustered ||
+                type == eChartType.ColumnStacked ||
+                type == eChartType.ColumnStacked100 ||*/
+                type == eChartType.Column3D ||
+                type == eChartType.ColumnClustered3D ||
+                type == eChartType.ColumnStacked3D ||
+                type == eChartType.ColumnStacked1003D ||
+                /*type == eChartType.BarClustered ||
+                type == eChartType.BarStacked ||
+                type == eChartType.BarStacked100 ||*/
+                type == eChartType.BarClustered3D ||
+                type == eChartType.BarStacked3D ||
+                type == eChartType.BarStacked1003D)
+            {
+                Shape = eShape.Box;
+            }
+            else if (
+                type == eChartType.CylinderBarClustered ||
+                type == eChartType.CylinderBarStacked ||
+                type == eChartType.CylinderBarStacked100 ||
+                type == eChartType.CylinderCol ||
+                type == eChartType.CylinderColClustered ||
+                type == eChartType.CylinderColStacked ||
+                type == eChartType.CylinderColStacked100)
+            {
+                Shape = eShape.Cylinder;
+            }
+            else if (
+                type == eChartType.ConeBarClustered ||
+                type == eChartType.ConeBarStacked ||
+                type == eChartType.ConeBarStacked100 ||
+                type == eChartType.ConeCol ||
+                type == eChartType.ConeColClustered ||
+                type == eChartType.ConeColStacked ||
+                type == eChartType.ConeColStacked100)
+            {
+                Shape = eShape.Cone;
+            }
+            else if (
+                type == eChartType.PyramidBarClustered ||
+                type == eChartType.PyramidBarStacked ||
+                type == eChartType.PyramidBarStacked100 ||
+                type == eChartType.PyramidCol ||
+                type == eChartType.PyramidColClustered ||
+                type == eChartType.PyramidColStacked ||
+                type == eChartType.PyramidColStacked100)
+            {
+                Shape = eShape.Pyramid;
+            }
+        }
+        #endregion
+        #region "Properties"
+        string _directionPath = "c:barDir/@val";
+        /// <summary>
+        /// Direction, Bar or columns
+        /// </summary>
+        public eDirection Direction
+        {
+            get
+            {
+                return GetDirectionEnum(_chartXmlHelper.GetXmlNodeString(_directionPath));
+            }
+            internal set
+            {
+                _chartXmlHelper.SetXmlNodeString(_directionPath, GetDirectionText(value));
+            }
+        }
+        string _shapePath = "c:shape/@val";
+        /// <summary>
+        /// The shape of the bar/columns
+        /// </summary>
+        public eShape Shape
+        {
+            get
+            {
+                return GetShapeEnum(_chartXmlHelper.GetXmlNodeString(_shapePath));
+            }
+            internal set
+            {
+                _chartXmlHelper.SetXmlNodeString(_shapePath, GetShapeText(value));
+            }
+        }
+        ExcelChartDataLabel _DataLabel = null;
+        /// <summary>
+        /// Access to datalabel properties
+        /// </summary>
+        public ExcelChartDataLabel DataLabel
+        {
+            get
+            {
+                if (_DataLabel == null)
+                {
+                    _DataLabel = new ExcelChartDataLabel(NameSpaceManager, ChartNode);
+                }
+                return _DataLabel;
+            }
+        }
+        #endregion
+        #region "Direction Enum Traslation"
+        private string GetDirectionText(eDirection direction)
+        {
+            switch (direction)
+            {
+                case eDirection.Bar:
+                    return "bar";
+                default:
+                    return "col";
+            }
+        }
+
+        private eDirection GetDirectionEnum(string direction)
+        {
+            switch (direction)
+            {
+                case "bar":
+                    return eDirection.Bar;
+                default:
+                    return eDirection.Column;
+            }
+        }
+        #endregion
+        #region "Shape Enum Translation"
+        private string GetShapeText(eShape Shape)
+        {
+            switch (Shape)
+            {
+                case eShape.Box:
+                    return "box";
+                case eShape.Cone:
+                    return "cone";
+                case eShape.ConeToMax:
+                    return "coneToMax";
+                case eShape.Cylinder:
+                    return "cylinder";
+                case eShape.Pyramid:
+                    return "pyramid";
+                case eShape.PyramidToMax:
+                    return "pyramidToMax";
+                default:
+                    return "box";
+            }
+        }
+
+        private eShape GetShapeEnum(string text)
+        {
+            switch (text)
+            {
+                case "box":
+                    return eShape.Box;
+                case "cone":
+                    return eShape.Cone;
+                case "coneToMax":
+                    return eShape.ConeToMax;
+                case "cylinder":
+                    return eShape.Cylinder;
+                case "pyramid":
+                    return eShape.Pyramid;
+                case "pyramidToMax":
+                    return eShape.PyramidToMax;
+                default:
+                    return eShape.Box;
+            }
+        }
+        #endregion
+        internal override eChartType GetChartType(string name)
+        {
+            if (name == "barChart")
+            {
+                if (this.Direction == eDirection.Bar)
+                {
+                    if (Grouping == eGrouping.Stacked)
+                    {
+                        return eChartType.BarStacked;
+                    }
+                    else if (Grouping == eGrouping.PercentStacked)
+                    {
+                        return eChartType.BarStacked100;
+                    }
+                    else
+                    {
+                        return eChartType.BarClustered;
+                    }
+                }
+                else
+                {
+                    if (Grouping == eGrouping.Stacked)
+                    {
+                        return eChartType.ColumnStacked;
+                    }
+                    else if (Grouping == eGrouping.PercentStacked)
+                    {
+                        return eChartType.ColumnStacked100;
+                    }
+                    else
+                    {
+                        return eChartType.ColumnClustered;
+                    }
+                }
+            }
+            if (name == "bar3DChart")
+            {
+                #region "Bar Shape"
+                if (this.Shape==eShape.Box)
+                {
+                    if (this.Direction == eDirection.Bar)
+                    {
+                        if (Grouping == eGrouping.Stacked)
+                        {
+                            return eChartType.BarStacked3D;
+                        }
+                        else if (Grouping == eGrouping.PercentStacked)
+                        {
+                            return eChartType.BarStacked1003D;
+                        }
+                        else
+                        {
+                            return eChartType.BarClustered3D;
+                        }
+                    }
+                    else
+                    {
+                        if (Grouping == eGrouping.Stacked)
+                        {
+                            return eChartType.ColumnStacked3D;
+                        }
+                        else if (Grouping == eGrouping.PercentStacked)
+                        {
+                            return eChartType.ColumnStacked1003D;
+                        }
+                        else
+                        {
+                            return eChartType.ColumnClustered3D;
+                        }
+                    }
+                }
+                #endregion
+                #region "Cone Shape"
+                if (this.Shape == eShape.Cone || this.Shape == eShape.ConeToMax)
+                {
+                    if (this.Direction == eDirection.Bar)
+                    {
+                        if (Grouping == eGrouping.Stacked)
+                        {
+                            return eChartType.ConeBarStacked;
+                        }
+                        else if (Grouping == eGrouping.PercentStacked)
+                        {
+                            return eChartType.ConeBarStacked100;
+                        }
+                        else if (Grouping == eGrouping.Clustered)
+                        {
+                            return eChartType.ConeBarClustered;
+                        }
+                    }
+                    else
+                    {
+                        if (Grouping == eGrouping.Stacked)
+                        {
+                            return eChartType.ConeColStacked;
+                        }
+                        else if (Grouping == eGrouping.PercentStacked)
+                        {
+                            return eChartType.ConeColStacked100;
+                        }
+                        else if (Grouping == eGrouping.Clustered)
+                        {
+                            return eChartType.ConeColClustered;
+                        }
+                        else
+                        {
+                            return eChartType.ConeCol;
+                        }
+                    }
+                }
+                #endregion
+                #region "Cylinder Shape"
+                if (this.Shape == eShape.Cylinder)
+                {
+                    if (this.Direction == eDirection.Bar)
+                    {
+                        if (Grouping == eGrouping.Stacked)
+                        {
+                            return eChartType.CylinderBarStacked;
+                        }
+                        else if (Grouping == eGrouping.PercentStacked)
+                        {
+                            return eChartType.CylinderBarStacked100;
+                        }
+                        else if (Grouping == eGrouping.Clustered)
+                        {
+                            return eChartType.CylinderBarClustered;
+                        }
+                    }
+                    else
+                    {
+                        if (Grouping == eGrouping.Stacked)
+                        {
+                            return eChartType.CylinderColStacked;
+                        }
+                        else if (Grouping == eGrouping.PercentStacked)
+                        {
+                            return eChartType.CylinderColStacked100;
+                        }
+                        else if (Grouping == eGrouping.Clustered)
+                        {
+                            return eChartType.CylinderColClustered;
+                        }
+                        else
+                        {
+                            return eChartType.CylinderCol;
+                        }
+                    }
+                }
+                #endregion
+                #region "Pyramide Shape"
+                if (this.Shape == eShape.Pyramid || this.Shape == eShape.PyramidToMax)
+                {
+                    if (this.Direction == eDirection.Bar)
+                    {
+                        if (Grouping == eGrouping.Stacked)
+                        {
+                            return eChartType.PyramidBarStacked;
+                        }
+                        else if (Grouping == eGrouping.PercentStacked)
+                        {
+                            return eChartType.PyramidBarStacked100;
+                        }
+                        else if (Grouping == eGrouping.Clustered)
+                        {
+                            return eChartType.PyramidBarClustered;
+                        }
+                    }
+                    else
+                    {
+                        if (Grouping == eGrouping.Stacked)
+                        {
+                            return eChartType.PyramidColStacked;
+                        }
+                        else if (Grouping == eGrouping.PercentStacked)
+                        {
+                            return eChartType.PyramidColStacked100;
+                        }
+                        else if (Grouping == eGrouping.Clustered)
+                        {
+                            return eChartType.PyramidColClustered;
+                        }
+                        else
+                        {
+                            return eChartType.PyramidCol;
+                        }
+                    }
+                }
+                #endregion
+            }
+            return base.GetChartType(name);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelBarChartSerie.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelBarChartSerie.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelBarChartSerie.cs	(revision 12707)
@@ -0,0 +1,83 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		Initial Release		        2009-10-01
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Xml;
+
+namespace OfficeOpenXml.Drawing.Chart
+{
+    /// <summary>
+    /// A serie for a scatter chart
+    /// </summary>
+    public sealed class ExcelBarChartSerie : ExcelChartSerie
+    {
+        /// <summary>
+        /// Default constructor
+        /// </summary>
+        /// <param name="chartSeries">Parent collection</param>
+        /// <param name="ns">Namespacemanager</param>
+        /// <param name="node">Topnode</param>
+        /// <param name="isPivot">Is pivotchart</param>
+        internal ExcelBarChartSerie(ExcelChartSeries chartSeries, XmlNamespaceManager ns, XmlNode node, bool isPivot) :
+            base(chartSeries, ns, node, isPivot)
+        {
+        }
+        ExcelChartSerieDataLabel _DataLabel = null;
+        /// <summary>
+        /// Datalabel
+        /// </summary>
+        public ExcelChartSerieDataLabel DataLabel
+        {
+            get
+            {
+                if (_DataLabel == null)
+                {
+                    _DataLabel = new ExcelChartSerieDataLabel(_ns, _node);
+                }
+                return _DataLabel;
+            }
+        }
+        const string INVERTIFNEGATIVE_PATH = "c:invertIfNegative/@val";
+        internal bool InvertIfNegative
+        {
+            get
+            {
+                return GetXmlNodeBool(INVERTIFNEGATIVE_PATH, true);
+            }
+            set
+            {
+                SetXmlNodeBool(INVERTIFNEGATIVE_PATH, value);
+            }
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelBubbleChart.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelBubbleChart.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelBubbleChart.cs	(revision 12707)
@@ -0,0 +1,136 @@
+﻿using System.Globalization;
+using OfficeOpenXml.Packaging;
+using OfficeOpenXml.Table.PivotTable;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Xml;
+
+namespace OfficeOpenXml.Drawing.Chart
+{
+    /// <summary>
+    /// Provides access to bubble chart specific properties
+    /// </summary>
+    public sealed class ExcelBubbleChart : ExcelChart
+    {
+        internal ExcelBubbleChart(ExcelDrawings drawings, XmlNode node, eChartType type, ExcelChart topChart, ExcelPivotTable PivotTableSource) :
+            base(drawings, node, type, topChart, PivotTableSource)
+        {
+            ShowNegativeBubbles = false;
+            BubbleScale = 100;
+            _chartSeries = new ExcelBubbleChartSeries(this, drawings.NameSpaceManager, _chartNode, PivotTableSource!=null);
+            //SetTypeProperties();
+        }
+
+        internal ExcelBubbleChart(ExcelDrawings drawings, XmlNode node, eChartType type, bool isPivot) :
+            base(drawings, node, type, isPivot)
+        {
+            _chartSeries = new ExcelBubbleChartSeries(this, drawings.NameSpaceManager, _chartNode, isPivot);
+            //SetTypeProperties();
+        }
+        internal ExcelBubbleChart(ExcelDrawings drawings, XmlNode node, Uri uriChart, ZipPackagePart part, XmlDocument chartXml, XmlNode chartNode) :
+            base(drawings, node, uriChart, part, chartXml, chartNode)
+        {
+            _chartSeries = new ExcelBubbleChartSeries(this, _drawings.NameSpaceManager, _chartNode, false);
+            //SetTypeProperties();
+        }
+        internal ExcelBubbleChart(ExcelChart topChart, XmlNode chartNode) :
+            base(topChart, chartNode)
+        {
+            _chartSeries = new ExcelBubbleChartSeries(this, _drawings.NameSpaceManager, _chartNode, false);
+        }
+        string BUBBLESCALE_PATH = "c:bubbleScale/@val";
+        /// <summary>
+        /// Specifies the scale factor for the bubble chart. Can range from 0 to 300, corresponding to a percentage of the default size,
+        /// </summary>
+        public int BubbleScale
+        {
+            get
+            {
+                return _chartXmlHelper.GetXmlNodeInt(BUBBLESCALE_PATH);
+            }
+            set
+            {
+                if(value < 0 && value > 300)
+                {
+                    throw(new ArgumentOutOfRangeException("Bubblescale out of range. 0-300 allowed"));
+                }
+                _chartXmlHelper.SetXmlNodeString(BUBBLESCALE_PATH, value.ToString());
+            }
+        }
+        string SHOWNEGBUBBLES_PATH = "c:showNegBubbles/@val";
+        /// <summary>
+        /// Specifies the scale factor for the bubble chart. Can range from 0 to 300, corresponding to a percentage of the default size,
+        /// </summary>
+        public bool ShowNegativeBubbles
+        {
+            get
+            {
+                return _chartXmlHelper.GetXmlNodeBool(SHOWNEGBUBBLES_PATH);
+            }
+            set
+            {
+                _chartXmlHelper.SetXmlNodeBool(BUBBLESCALE_PATH, value, true);
+            }
+        }
+        string BUBBLE3D_PATH = "c:bubble3D/@val";
+        /// <summary>
+        /// Specifies if the bubblechart is three dimensional
+        /// </summary>
+        public bool Bubble3D
+        {
+            get
+            {
+                return _chartXmlHelper.GetXmlNodeBool(BUBBLE3D_PATH);
+            }
+            set
+            {
+                _chartXmlHelper.SetXmlNodeBool(BUBBLE3D_PATH, value);
+                ChartType = value ? eChartType.Bubble3DEffect : eChartType.Bubble;
+            }
+        }
+        string SIZEREPRESENTS_PATH = "c:sizeRepresents/@val";
+        /// <summary>
+        /// Specifies the scale factor for the bubble chart. Can range from 0 to 300, corresponding to a percentage of the default size,
+        /// </summary>
+        public eSizeRepresents SizeRepresents
+        {
+            get
+            {
+                var v = _chartXmlHelper.GetXmlNodeString(SIZEREPRESENTS_PATH).ToLower(CultureInfo.InvariantCulture);
+                if (v == "w")
+                {
+                    return eSizeRepresents.Width;
+                }
+                else
+                {
+                    return eSizeRepresents.Area;
+                }
+            }
+            set
+            {
+                _chartXmlHelper.SetXmlNodeString(SIZEREPRESENTS_PATH, value == eSizeRepresents.Width ? "w" : "area");
+            }
+        }
+        public new ExcelBubbleChartSeries Series
+        {
+            get
+            {
+
+                return (ExcelBubbleChartSeries)_chartSeries;
+            }
+        }
+        internal override eChartType GetChartType(string name)
+        {
+            if (Bubble3D)
+            {
+                return eChartType.Bubble3DEffect;
+            }
+            else
+            {
+                return eChartType.Bubble;
+            }
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelBubbleChartSerie.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelBubbleChartSerie.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelBubbleChartSerie.cs	(revision 12707)
@@ -0,0 +1,161 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		Initial Release		        2009-10-01
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Xml;
+
+namespace OfficeOpenXml.Drawing.Chart
+{
+    /// <summary>
+    /// A serie for a scatter chart
+    /// </summary>
+    public sealed class ExcelBubbleChartSerie : ExcelChartSerie
+    {
+        /// <summary>
+        /// Default constructor
+        /// </summary>
+        /// <param name="chartSeries">Parent collection</param>
+        /// <param name="ns">Namespacemanager</param>
+        /// <param name="node">Topnode</param>
+        /// <param name="isPivot">Is pivotchart</param>
+        internal ExcelBubbleChartSerie(ExcelChartSeries chartSeries, XmlNamespaceManager ns, XmlNode node, bool isPivot) :
+            base(chartSeries, ns, node, isPivot)
+        {
+
+        }
+        ExcelChartSerieDataLabel _DataLabel = null;
+        /// <summary>
+        /// Datalabel
+        /// </summary>
+        public ExcelChartSerieDataLabel DataLabel
+        {
+            get
+            {
+                if (_DataLabel == null)
+                {
+                    _DataLabel = new ExcelChartSerieDataLabel(_ns, _node);
+                }
+                return _DataLabel;
+            }
+        }
+        const string BUBBLE3D_PATH = "c:bubble3D/@val";
+        internal bool Bubble3D
+        {
+            get
+            {
+                return GetXmlNodeBool(BUBBLE3D_PATH, true);
+            }
+            set
+            {
+                SetXmlNodeBool(BUBBLE3D_PATH, value);    
+            }
+        }
+        const string INVERTIFNEGATIVE_PATH = "c:invertIfNegative/@val";
+        internal bool InvertIfNegative
+        {
+            get
+            {
+                return GetXmlNodeBool(INVERTIFNEGATIVE_PATH, true);
+            }
+            set
+            {
+                SetXmlNodeBool(INVERTIFNEGATIVE_PATH, value);
+            }
+        }
+        public override string Series
+        {
+            get
+            {
+                return base.Series;
+            }
+            set
+            {
+                base.Series = value;
+                if(string.IsNullOrEmpty(BubbleSize))
+                {
+                    GenerateLit();
+                }
+            }
+        }
+        const string BUBBLESIZE_TOPPATH = "c:bubbleSize";
+        const string BUBBLESIZE_PATH = BUBBLESIZE_TOPPATH + "/c:numRef/c:f";
+        public string BubbleSize
+        {
+            get
+            {
+                return GetXmlNodeString(BUBBLESIZE_PATH);
+            }
+            set
+            {
+                if(string.IsNullOrEmpty(value))
+                {
+                    GenerateLit();
+                }
+                else
+                {
+                    SetXmlNodeString(BUBBLESIZE_PATH, ExcelCellBase.GetFullAddress(_chartSeries.Chart.WorkSheet.Name, value));
+                
+                    XmlNode cache = TopNode.SelectSingleNode(string.Format("{0}/c:numCache", BUBBLESIZE_PATH), _ns);
+                    if (cache != null)
+                    {
+                        cache.ParentNode.RemoveChild(cache);
+                    }
+
+                    DeleteNode(string.Format("{0}/c:numLit", BUBBLESIZE_TOPPATH));
+                    //XmlNode lit = TopNode.SelectSingleNode(string.Format("{0}/c:numLit", _xSeriesTopPath), _ns);
+                    //if (lit != null)
+                    //{
+                    //    lit.ParentNode.RemoveChild(lit);
+                    //}
+                }
+            }
+        }
+
+        internal void GenerateLit()
+        {
+            var s = new ExcelAddress(Series);
+            var ix = 0;
+            var sb = new StringBuilder();
+            for (int row = s._fromRow; row <= s._toRow; row++)
+            {
+                for (int c = s._fromCol; c <= s._toCol; c++)
+                {
+                    sb.AppendFormat("<c:pt idx=\"{0}\"><c:v>1</c:v></c:pt>", ix++);
+                }
+            }
+            CreateNode(BUBBLESIZE_TOPPATH + "/c:numLit", true);
+            XmlNode lit = TopNode.SelectSingleNode(string.Format("{0}/c:numLit", BUBBLESIZE_TOPPATH), _ns);
+            lit.InnerXml = string.Format("<c:formatCode>General</c:formatCode><c:ptCount val=\"{0}\"/>{1}", ix, sb.ToString());
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelChart.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelChart.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelChart.cs	(revision 12707)
@@ -0,0 +1,1932 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Jan Källman		Added		2009-10-01
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Text;
+using System.Xml;
+using System.IO;
+using OfficeOpenXml.Table.PivotTable;
+using OfficeOpenXml.Utils;
+using OfficeOpenXml.Packaging;
+
+namespace OfficeOpenXml.Drawing.Chart
+{
+    #region "Chart Enums"
+    /// <summary>
+    /// Chart type
+    /// </summary>
+    public enum eChartType
+    {
+        Area3D=-4098,
+        AreaStacked3D=78,
+        AreaStacked1003D=79,
+        BarClustered3D= 60,
+        BarStacked3D=61,
+        BarStacked1003D=62,
+        Column3D=-4100,
+        ColumnClustered3D=54,
+        ColumnStacked3D=55,
+        ColumnStacked1003D=56,
+        Line3D=-4101,
+        Pie3D=-4102,
+        PieExploded3D=70,
+        Area=1,
+        AreaStacked=76,
+        AreaStacked100=77,
+        BarClustered=57,
+        BarOfPie=71,
+        BarStacked=58,
+        BarStacked100=59,
+        Bubble=15,
+        Bubble3DEffect=87,
+        ColumnClustered=51,
+        ColumnStacked=52,
+        ColumnStacked100=53,
+        ConeBarClustered=102,
+        ConeBarStacked=103,
+        ConeBarStacked100=104,
+        ConeCol=105,
+        ConeColClustered=99,
+        ConeColStacked=100,
+        ConeColStacked100=101,
+        CylinderBarClustered=95,
+        CylinderBarStacked=96,
+        CylinderBarStacked100=97,
+        CylinderCol=98,
+        CylinderColClustered=92,
+        CylinderColStacked=93,
+        CylinderColStacked100=94,
+        Doughnut=-4120,
+        DoughnutExploded=80,
+        Line=4,
+        LineMarkers=65,
+        LineMarkersStacked=66,
+        LineMarkersStacked100=67,
+        LineStacked=63,
+        LineStacked100=64,
+        Pie=5,
+        PieExploded=69,
+        PieOfPie=68,
+        PyramidBarClustered=109,
+        PyramidBarStacked=110,
+        PyramidBarStacked100=111,
+        PyramidCol=112,
+        PyramidColClustered=106,
+        PyramidColStacked=107,
+        PyramidColStacked100=108,
+        Radar=-4151,
+        RadarFilled=82,
+        RadarMarkers=81,
+        StockHLC=88,
+        StockOHLC=89,
+        StockVHLC=90,
+        StockVOHLC=91,
+        Surface=83,
+        SurfaceTopView=85,
+        SurfaceTopViewWireframe=86,
+        SurfaceWireframe=84,
+        XYScatter=-4169,
+        XYScatterLines=74,
+        XYScatterLinesNoMarkers=75,
+        XYScatterSmooth=72,
+        XYScatterSmoothNoMarkers=73
+}
+    /// <summary>
+    /// Bar or column
+    /// </summary>
+    public enum eDirection
+    {
+        Column,
+        Bar
+    }
+    /// <summary>
+    /// How the series are grouped
+    /// </summary>
+    public enum eGrouping
+    {
+        Standard,
+        Clustered,
+        Stacked,
+        PercentStacked
+    }
+    /// <summary>
+    /// Shape for bar charts
+    /// </summary>
+    public enum eShape
+    {
+        Box,
+        Cone,
+        ConeToMax,
+        Cylinder,
+        Pyramid,
+        PyramidToMax
+    }
+    /// <summary>
+    /// Smooth or lines markers
+    /// </summary>
+    public enum eScatterStyle
+    {
+        LineMarker,
+        SmoothMarker,
+     }
+    public enum eRadarStyle
+    {
+        /// <summary>
+        /// Specifies that the radar chart shall be filled and have lines but no markers.
+        /// </summary>
+        Filled,
+        /// <summary>
+        /// Specifies that the radar chart shall have lines and markers but no fill.
+        /// </summary>
+        Marker,
+        /// <summary>
+        /// Specifies that the radar chart shall have lines but no markers and no fill.
+        /// </summary>
+        Standard 
+    }
+    /// <summary>
+    /// Bar or pie
+    /// </summary>
+    public enum ePieType
+    {
+        Bar,
+        Pie
+    }
+    /// <summary>
+    /// Position of the labels
+    /// </summary>
+    public enum eLabelPosition
+    {
+        BestFit,
+        Left,
+        Right,
+        Center,
+        Top,
+        Bottom,
+        InBase,
+        InEnd,
+        OutEnd
+    }
+    /// <summary>
+    /// Axis label position
+    /// </summary>
+    public enum eTickLabelPosition
+    {
+        High,
+        Low,
+        NextTo,
+        None
+    }
+    /// <summary>
+    /// Markerstyle
+    /// </summary>
+    public enum eMarkerStyle
+    {        
+        Circle,
+        Dash,
+        Diamond,
+        Dot,
+        None,
+        Picture,
+        Plus,
+        Square,
+        Star,
+        Triangle,
+        X,
+    }
+    /// <summary>
+    /// The build in style of the chart.
+    /// </summary>
+    public enum eChartStyle
+    {
+        None,
+        Style1,
+        Style2,
+        Style3,
+        Style4,
+        Style5,
+        Style6,
+        Style7,
+        Style8,
+        Style9,
+        Style10,
+        Style11,
+        Style12,
+        Style13,
+        Style14,
+        Style15,
+        Style16,
+        Style17,
+        Style18,
+        Style19,
+        Style20,
+        Style21,
+        Style22,
+        Style23,
+        Style24,
+        Style25,
+        Style26,
+        Style27,
+        Style28,
+        Style29,
+        Style30,
+        Style31,
+        Style32,
+        Style33,
+        Style34,
+        Style35,
+        Style36,
+        Style37,
+        Style38,
+        Style39,
+        Style40,
+        Style41,
+        Style42,
+        Style43,
+        Style44,
+        Style45,
+        Style46,
+        Style47,
+        Style48
+    }
+    /// <summary>
+    /// Type of Trendline for a chart
+    /// </summary>
+    public enum eTrendLine
+    {
+        /// <summary>
+        /// Specifies the trendline shall be an exponential curve in the form
+        /// </summary>
+        Exponential,
+        /// <summary>
+        /// Specifies the trendline shall be a logarithmic curve in the form , where log is the natural
+        /// </summary>
+        Linear,
+        /// <summary>
+        /// Specifies the trendline shall be a logarithmic curve in the form , where log is the natural
+        /// </summary>
+        Logarithmic,
+        /// <summary>
+        /// Specifies the trendline shall be a moving average of period Period
+        /// </summary>
+        MovingAvgerage,
+        /// <summary>
+        /// Specifies the trendline shall be a polynomial curve of order Order in the form 
+        /// </summary>
+        Polynomial,
+        /// <summary>
+        /// Specifies the trendline shall be a power curve in the form
+        /// </summary>
+        Power
+    }
+    /// <summary>
+    /// Specifies the possible ways to display blanks
+    /// </summary>
+    public enum eDisplayBlanksAs
+    {
+        /// <summary>
+        /// Blank values shall be left as a gap
+        /// </summary>
+        Gap,
+        /// <summary>
+        /// Blank values shall be spanned with a line (Line charts)
+        /// </summary>
+        Span,
+        /// <summary>
+        /// Blank values shall be treated as zero
+        /// </summary>
+        Zero
+    }
+    public enum eSizeRepresents
+    {
+        /// <summary>
+        /// Specifies the area of the bubbles shall be proportional to the bubble size value.
+        /// </summary>
+        Area,
+        /// <summary>
+        /// Specifies the radius of the bubbles shall be proportional to the bubble size value.
+        /// </summary>
+        Width
+    }
+    #endregion
+    
+    
+    /// <summary>
+   /// Base class for Chart object.
+   /// </summary>
+    public class ExcelChart : ExcelDrawing
+    {
+       const string rootPath = "c:chartSpace/c:chart/c:plotArea";
+       //string _chartPath;
+       protected internal ExcelChartSeries _chartSeries;
+       internal ExcelChartAxis[] _axis;
+       protected XmlHelper _chartXmlHelper;
+       #region "Constructors"
+       internal ExcelChart(ExcelDrawings drawings, XmlNode node, eChartType type, bool isPivot) :
+           base(drawings, node, "xdr:graphicFrame/xdr:nvGraphicFramePr/xdr:cNvPr/@name")
+       {
+           ChartType = type;
+           CreateNewChart(drawings, type, null);
+
+           Init(drawings, _chartNode);
+
+           _chartSeries = new ExcelChartSeries(this, drawings.NameSpaceManager, _chartNode, isPivot);
+
+           SetTypeProperties();
+           LoadAxis();
+       }
+       internal ExcelChart(ExcelDrawings drawings, XmlNode node, eChartType type, ExcelChart topChart, ExcelPivotTable PivotTableSource) :
+           base(drawings, node, "xdr:graphicFrame/xdr:nvGraphicFramePr/xdr:cNvPr/@name")
+       {
+           ChartType = type;
+           CreateNewChart(drawings, type, topChart);
+
+           Init(drawings, _chartNode);
+
+           _chartSeries = new ExcelChartSeries(this, drawings.NameSpaceManager, _chartNode, PivotTableSource!=null);
+           if (PivotTableSource != null) SetPivotSource(PivotTableSource);
+
+           SetTypeProperties();
+           if (topChart == null)
+               LoadAxis();
+           else
+           {
+               _axis = topChart.Axis;
+               if (_axis.Length > 0)
+               {
+                   XAxis = _axis[0];
+                   YAxis = _axis[1];
+               }
+           }
+       }
+       internal ExcelChart(ExcelDrawings drawings, XmlNode node, Uri uriChart, ZipPackagePart part, XmlDocument chartXml, XmlNode chartNode) :
+           base(drawings, node, "xdr:graphicFrame/xdr:nvGraphicFramePr/xdr:cNvPr/@name")
+       {
+           UriChart = uriChart;
+           Part = part;
+           ChartXml = chartXml;
+           _chartNode = chartNode;
+           InitChartLoad(drawings, chartNode);
+           ChartType = GetChartType(chartNode.LocalName);
+       }
+       internal ExcelChart(ExcelChart topChart, XmlNode chartNode) :
+           base(topChart._drawings, topChart.TopNode, "xdr:graphicFrame/xdr:nvGraphicFramePr/xdr:cNvPr/@name")
+       {
+           UriChart = topChart.UriChart;
+           Part = topChart.Part;
+           ChartXml = topChart.ChartXml;
+           _plotArea = topChart.PlotArea;
+           _chartNode = chartNode;
+
+           InitChartLoad(topChart._drawings, chartNode);
+       }
+       private void InitChartLoad(ExcelDrawings drawings, XmlNode chartNode)
+       {
+           //SetChartType();
+           bool isPivot = false;
+           Init(drawings, chartNode);
+           _chartSeries = new ExcelChartSeries(this, drawings.NameSpaceManager, _chartNode, isPivot /*ChartXml.SelectSingleNode(_chartPath, drawings.NameSpaceManager)*/);
+           LoadAxis();
+       }
+
+       private void Init(ExcelDrawings drawings, XmlNode chartNode)
+       {
+           //_chartXmlHelper = new XmlHelper(drawings.NameSpaceManager, chartNode);
+           _chartXmlHelper = XmlHelperFactory.Create(drawings.NameSpaceManager, chartNode);
+           _chartXmlHelper.SchemaNodeOrder = new string[] { "title", "pivotFmt", "autoTitleDeleted", "view3D", "floor", "sideWall", "backWall", "plotArea", "wireframe", "barDir", "grouping", "scatterStyle", "radarStyle", "varyColors", "ser", "dLbls", "bubbleScale", "showNegBubbles", "dropLines", "upDownBars", "marker", "smooth", "shape", "legend", "plotVisOnly", "dispBlanksAs", "showDLblsOverMax", "overlap", "bandFmts", "axId", "spPr", "printSettings" };
+           WorkSheet = drawings.Worksheet;
+       }
+       #endregion
+       #region "Private functions"
+       private void SetTypeProperties()
+       {
+           /******* Grouping *******/
+           if (IsTypeClustered())
+           {
+               Grouping = eGrouping.Clustered;
+           }
+           else if (
+               IsTypeStacked())
+           {
+               Grouping = eGrouping.Stacked;
+           }
+           else if (
+           IsTypePercentStacked())
+           {
+               Grouping = eGrouping.PercentStacked;
+           }
+
+           /***** 3D Perspective *****/
+           if (IsType3D())             
+           {
+               View3D.RotY = 20;
+               View3D.Perspective = 30;    //Default to 30
+               if (IsTypePieDoughnut())
+               {
+                   View3D.RotX = 30;
+               }
+               else
+               {
+                   View3D.RotX = 15;
+               }
+           }
+       }
+       private void CreateNewChart(ExcelDrawings drawings, eChartType type, ExcelChart topChart)
+       {
+           if (topChart == null)
+           {
+               XmlElement graphFrame = TopNode.OwnerDocument.CreateElement("graphicFrame", ExcelPackage.schemaSheetDrawings);
+               graphFrame.SetAttribute("macro", "");
+               TopNode.AppendChild(graphFrame); 
+               graphFrame.InnerXml = string.Format("<xdr:nvGraphicFramePr><xdr:cNvPr id=\"{0}\" name=\"Chart 1\" /><xdr:cNvGraphicFramePr /></xdr:nvGraphicFramePr><xdr:xfrm><a:off x=\"0\" y=\"0\" /> <a:ext cx=\"0\" cy=\"0\" /></xdr:xfrm><a:graphic><a:graphicData uri=\"http://schemas.openxmlformats.org/drawingml/2006/chart\"><c:chart xmlns:c=\"http://schemas.openxmlformats.org/drawingml/2006/chart\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" r:id=\"rId1\" />   </a:graphicData>  </a:graphic>",_id);
+               TopNode.AppendChild(TopNode.OwnerDocument.CreateElement("clientData", ExcelPackage.schemaSheetDrawings));
+
+               var package = drawings.Worksheet._package.Package;
+               UriChart = GetNewUri(package, "/xl/charts/chart{0}.xml");
+
+               ChartXml = new XmlDocument();
+               ChartXml.PreserveWhitespace = ExcelPackage.preserveWhitespace;
+               LoadXmlSafe(ChartXml, ChartStartXml(type), Encoding.UTF8);
+
+               // save it to the package
+               Part = package.CreatePart(UriChart, "application/vnd.openxmlformats-officedocument.drawingml.chart+xml", _drawings._package.Compression);
+
+               StreamWriter streamChart = new StreamWriter(Part.GetStream(FileMode.Create, FileAccess.Write));
+               ChartXml.Save(streamChart);
+               streamChart.Close();
+               package.Flush();
+
+               var chartRelation = drawings.Part.CreateRelationship(UriHelper.GetRelativeUri(drawings.UriDrawing, UriChart), Packaging.TargetMode.Internal, ExcelPackage.schemaRelationships + "/chart");
+               graphFrame.SelectSingleNode("a:graphic/a:graphicData/c:chart", NameSpaceManager).Attributes["r:id"].Value = chartRelation.Id;
+               package.Flush();
+               _chartNode = ChartXml.SelectSingleNode(string.Format("c:chartSpace/c:chart/c:plotArea/{0}", GetChartNodeText()), NameSpaceManager);
+           }
+           else
+           {
+               ChartXml = topChart.ChartXml;
+               Part = topChart.Part;
+               _plotArea = topChart.PlotArea;
+               UriChart = topChart.UriChart;
+               _axis = topChart._axis;
+
+               XmlNode preNode = _plotArea.ChartTypes[_plotArea.ChartTypes.Count - 1].ChartNode;
+               _chartNode = ((XmlDocument)ChartXml).CreateElement(GetChartNodeText(), ExcelPackage.schemaChart);
+               preNode.ParentNode.InsertAfter(_chartNode, preNode);
+               if (topChart.Axis.Length == 0)
+               {
+                   AddAxis();
+               }
+               string serieXML = GetChartSerieStartXml(type, int.Parse(topChart.Axis[0].Id), int.Parse(topChart.Axis[1].Id), topChart.Axis.Length>2?int.Parse(topChart.Axis[2].Id) : -1);
+               _chartNode.InnerXml = serieXML;
+           }
+       }
+       private void LoadAxis()
+       {
+           XmlNodeList nl = _chartNode.SelectNodes("c:axId", NameSpaceManager);
+           List<ExcelChartAxis> l = new List<ExcelChartAxis>();
+           foreach (XmlNode node in nl)
+           {
+               string id = node.Attributes["val"].Value;
+               var axNode = ChartXml.SelectNodes(rootPath + string.Format("/*/c:axId[@val=\"{0}\"]", id), NameSpaceManager);
+               if (axNode != null && axNode.Count>1)
+               {
+                   foreach (XmlNode axn in axNode)
+                   {
+                       if (axn.ParentNode.LocalName.EndsWith("Ax"))
+                       {
+                           XmlNode axisNode = axNode[1].ParentNode;
+                           ExcelChartAxis ax = new ExcelChartAxis(NameSpaceManager, axisNode);
+                           l.Add(ax);
+                       }
+                   }
+               }
+           }
+           _axis = l.ToArray();
+
+           if(_axis.Length > 0) XAxis = _axis[0];
+           if (_axis.Length > 1) YAxis = _axis[1];
+       }
+       //private void SetChartType()
+       //{
+       //    ChartType = 0;
+       //    //_plotArea = new ExcelChartPlotArea(NameSpaceManager, ChartXml.SelectSingleNode("c:chartSpace/c:chart/c:plotArea", NameSpaceManager));
+       //    int pos=0;
+       //    foreach (XmlElement n in ChartXml.SelectSingleNode(rootPath, _drawings.NameSpaceManager).ChildNodes)
+       //    {
+       //        if (pos == 0)
+       //        {
+       //            ChartType = GetChartType(n.Name);
+       //            if (ChartType != 0)
+       //            {
+       //                //_chartPath = rootPath + "/" + n.Name;
+       //                PlotArea.ChartTypes.Add(this);
+       //            }
+       //        }
+       //        else
+       //        {
+       //            var chartSerieType = GetChart(_drawings, TopNode/*, n*/);
+       //            chartSerieType = GetChart(n, _drawings, TopNode, UriChart, Part, ChartXml, null, isPivot);
+       //            PlotArea.ChartTypes.Add(chartSerieType);
+       //            //var chartType = GetChartType(n.Name);
+       //        }
+       //        if (ChartType != 0)
+       //        {
+       //            pos++;
+       //        }
+       //    }
+       //}
+       internal virtual eChartType GetChartType(string name)
+       {
+           
+           switch (name)
+           {
+               case "area3DChart":
+                   if(Grouping==eGrouping.Stacked)
+                   {
+                       return eChartType.AreaStacked3D;
+                   }
+                   else if (Grouping == eGrouping.PercentStacked)
+                   {
+                       return eChartType.AreaStacked1003D;
+                   }
+                   else
+                   {
+                       return eChartType.Area3D;
+                   }
+               case "areaChart":
+                   if (Grouping == eGrouping.Stacked)
+                   {
+                       return eChartType.AreaStacked;
+                   }
+                   else if (Grouping == eGrouping.PercentStacked)
+                   {
+                       return eChartType.AreaStacked100;
+                   }
+                   else
+                   {
+                       return eChartType.Area;
+                   }
+               case "doughnutChart":
+                   return eChartType.Doughnut;
+               case "pie3DChart":
+                   return eChartType.Pie3D;
+               case "pieChart":
+                   return eChartType.Pie;
+               case "radarChart":
+                   return eChartType.Radar;
+               case "scatterChart":
+                   return eChartType.XYScatter;
+               case "surface3DChart":
+               case "surfaceChart":
+                   return eChartType.Surface;
+               case "stockChart":
+                   return eChartType.StockHLC;
+               default:
+                   return 0;
+           }           
+       }
+       #region "Xml init Functions"
+       private string ChartStartXml(eChartType type)
+       {
+           StringBuilder xml=new StringBuilder();
+           int axID=1;
+           int xAxID=2;
+           int serAxID = IsTypeSurface() ? 3 : -1;
+
+           xml.Append("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>");
+           xml.AppendFormat("<c:chartSpace xmlns:c=\"{0}\" xmlns:a=\"{1}\" xmlns:r=\"{2}\">", ExcelPackage.schemaChart, ExcelPackage.schemaDrawings, ExcelPackage.schemaRelationships);       
+           xml.Append("<c:chart>");
+           xml.AppendFormat("{0}{1}<c:plotArea><c:layout/>",AddPerspectiveXml(type), AddSurfaceXml(type));
+
+           string chartNodeText = GetChartNodeText();
+           xml.AppendFormat("<{0}>", chartNodeText);
+           xml.Append(GetChartSerieStartXml(type, axID, xAxID, serAxID));
+           xml.AppendFormat("</{0}>", chartNodeText);
+
+           //Axis
+           if (!IsTypePieDoughnut())
+           {
+               if (IsTypeScatterBubble())
+               {
+                   xml.AppendFormat("<c:valAx><c:axId val=\"{0}\"/><c:scaling><c:orientation val=\"minMax\"/></c:scaling><c:delete val=\"0\"/><c:axPos val=\"b\"/><c:tickLblPos val=\"nextTo\"/><c:crossAx val=\"{1}\"/><c:crosses val=\"autoZero\"/></c:valAx>", axID, xAxID);
+               }
+               else
+               {
+                   xml.AppendFormat("<c:catAx><c:axId val=\"{0}\"/><c:scaling><c:orientation val=\"minMax\"/></c:scaling><c:delete val=\"0\"/><c:axPos val=\"b\"/><c:tickLblPos val=\"nextTo\"/><c:crossAx val=\"{1}\"/><c:crosses val=\"autoZero\"/><c:auto val=\"1\"/><c:lblAlgn val=\"ctr\"/><c:lblOffset val=\"100\"/></c:catAx>", axID, xAxID);
+               }
+               xml.AppendFormat("<c:valAx><c:axId val=\"{1}\"/><c:scaling><c:orientation val=\"minMax\"/></c:scaling><c:delete val=\"0\"/><c:axPos val=\"l\"/><c:majorGridlines/><c:tickLblPos val=\"nextTo\"/><c:crossAx val=\"{0}\"/><c:crosses val=\"autoZero\"/><c:crossBetween val=\"between\"/></c:valAx>", axID, xAxID);
+               if (serAxID==3) //Sureface Chart
+               {
+                   xml.AppendFormat("<c:serAx><c:axId val=\"{0}\"/><c:scaling><c:orientation val=\"minMax\"/></c:scaling><c:delete val=\"0\"/><c:axPos val=\"b\"/><c:tickLblPos val=\"nextTo\"/><c:crossAx val=\"{1}\"/><c:crosses val=\"autoZero\"/></c:serAx>", serAxID, xAxID);
+               }
+           }
+
+           xml.AppendFormat("</c:plotArea><c:legend><c:legendPos val=\"r\"/><c:layout/><c:overlay val=\"0\" /></c:legend><c:plotVisOnly val=\"1\"/></c:chart>", axID, xAxID);
+
+           xml.Append("<c:printSettings><c:headerFooter/><c:pageMargins b=\"0.75\" l=\"0.7\" r=\"0.7\" t=\"0.75\" header=\"0.3\" footer=\"0.3\"/><c:pageSetup/></c:printSettings></c:chartSpace>");          
+           return xml.ToString();
+       }
+
+       private string GetChartSerieStartXml(eChartType type, int axID, int xAxID, int serAxID)
+       {
+           StringBuilder xml = new StringBuilder();
+
+           xml.Append(AddScatterType(type));
+           xml.Append(AddRadarType(type));
+           xml.Append(AddBarDir(type));
+           xml.Append(AddGrouping());
+           xml.Append(AddVaryColors());
+           xml.Append(AddHasMarker(type));
+           xml.Append(AddShape(type));
+           xml.Append(AddFirstSliceAng(type));
+           xml.Append(AddHoleSize(type));
+           if (ChartType == eChartType.BarStacked100 || 
+               ChartType == eChartType.BarStacked ||
+               ChartType == eChartType.ColumnStacked ||
+               ChartType == eChartType.ColumnStacked100)
+           {
+               xml.Append("<c:overlap val=\"100\"/>");
+           }
+           if (IsTypeSurface())
+           {
+               xml.Append("<c:bandFmts/>");
+           }
+           xml.Append(AddAxisId(axID, xAxID, serAxID));
+
+           return xml.ToString();
+       }
+       private string AddAxisId(int axID,int xAxID, int serAxID)
+       {
+           if (!IsTypePieDoughnut())
+           {
+               if (IsTypeSurface())
+               {                                      
+                   return string.Format("<c:axId val=\"{0}\"/><c:axId val=\"{1}\"/><c:axId val=\"{2}\"/>", axID, xAxID, serAxID);
+               }
+               else
+               {
+                   return string.Format("<c:axId val=\"{0}\"/><c:axId val=\"{1}\"/>", axID, xAxID);
+               }
+           }
+           else
+           {
+               return "";
+           }
+       }
+       private string AddAxType()
+       {
+           switch(ChartType)
+           {
+               case eChartType.XYScatter:
+               case eChartType.XYScatterLines:
+               case eChartType.XYScatterLinesNoMarkers:
+               case eChartType.XYScatterSmooth:
+               case eChartType.XYScatterSmoothNoMarkers:
+               case eChartType.Bubble:
+               case eChartType.Bubble3DEffect:
+                   return "valAx";
+               default:
+                   return "catAx";
+           }
+       }
+       private string AddScatterType(eChartType type)
+       {
+           if (type == eChartType.XYScatter ||
+               type == eChartType.XYScatterLines ||
+               type == eChartType.XYScatterLinesNoMarkers ||
+               type == eChartType.XYScatterSmooth ||
+               type == eChartType.XYScatterSmoothNoMarkers)
+           {
+               return "<c:scatterStyle val=\"\" />";
+           }
+           else
+           {
+               return "";
+           }
+       }
+       private string AddRadarType(eChartType type)
+       {
+           if (type == eChartType.Radar ||
+               type == eChartType.RadarFilled||
+               type == eChartType.RadarMarkers)
+           {
+               return "<c:radarStyle val=\"\" />";
+           }
+           else
+           {
+               return "";
+           }
+       }
+       private string AddGrouping()
+       {
+           //IsTypeClustered() || IsTypePercentStacked() || IsTypeStacked() || 
+           if(IsTypeShape() || IsTypeLine())
+           {
+               return "<c:grouping val=\"standard\"/>";
+           }
+           else
+           {
+               return "";
+           }
+       }
+       private string AddHoleSize(eChartType type)
+       {
+           if (type == eChartType.Doughnut ||
+               type == eChartType.DoughnutExploded)
+           {
+               return "<c:holeSize val=\"50\" />";
+           }
+           else
+           {
+               return "";
+           }
+       }
+       private string AddFirstSliceAng(eChartType type)
+       {
+           if (type == eChartType.Doughnut ||
+               type == eChartType.DoughnutExploded)
+           {
+               return "<c:firstSliceAng val=\"0\" />";
+           }
+           else
+           {
+               return "";
+           }
+       }
+       private string AddVaryColors()
+       {
+           if (IsTypePieDoughnut())
+           {
+               return "<c:varyColors val=\"1\" />";
+           }
+           else
+           {
+               return "<c:varyColors val=\"0\" />";
+           }
+       }
+       private string AddHasMarker(eChartType type)
+       {
+           if (type == eChartType.LineMarkers ||
+               type == eChartType.LineMarkersStacked ||
+               type == eChartType.LineMarkersStacked100 /*||
+               type == eChartType.XYScatterLines ||
+               type == eChartType.XYScatterSmooth*/)
+           {
+               return "<c:marker val=\"1\"/>";
+           }
+           else
+           {
+               return "";
+           }
+       }
+       private string AddShape(eChartType type)
+       {
+           if (IsTypeShape())
+           {
+               return "<c:shape val=\"box\" />";
+           }
+           else
+           {
+               return "";
+           }
+       }
+       private string AddBarDir(eChartType type)
+       {
+           if (IsTypeShape())
+            {
+                return "<c:barDir val=\"col\" />";
+            }
+            else
+            {
+                return "";
+            }
+       }
+       private string AddPerspectiveXml(eChartType type)
+        {
+ 	        //Add for 3D sharts
+            if (IsType3D())
+            {
+                return "<c:view3D><c:perspective val=\"30\" /></c:view3D>";
+            }
+            else
+            {
+                return "";
+            }
+        }
+       private string AddSurfaceXml(eChartType type)
+       {
+           if (IsTypeSurface())
+           {
+               return AddSurfacePart("floor") + AddSurfacePart("sideWall") + AddSurfacePart("backWall");
+           }
+           else
+           {
+               return "";
+           }
+       }
+
+       private string AddSurfacePart(string name)
+       {
+           return string.Format("<c:{0}><c:thickness val=\"0\"/><c:spPr><a:noFill/><a:ln><a:noFill/></a:ln><a:effectLst/><a:sp3d/></c:spPr></c:{0}>", name);
+       }
+       #endregion
+       #endregion
+       #region "Chart type functions
+       internal static bool IsType3D(eChartType chartType)
+        {
+            return chartType == eChartType.Area3D ||
+                            chartType == eChartType.AreaStacked3D ||
+                            chartType == eChartType.AreaStacked1003D ||
+                            chartType == eChartType.BarClustered3D ||
+                            chartType == eChartType.BarStacked3D ||
+                            chartType == eChartType.BarStacked1003D ||
+                            chartType == eChartType.Column3D ||
+                            chartType == eChartType.ColumnClustered3D ||
+                            chartType == eChartType.ColumnStacked3D ||
+                            chartType == eChartType.ColumnStacked1003D ||
+                            chartType == eChartType.Line3D ||
+                            chartType == eChartType.Pie3D ||
+                            chartType == eChartType.PieExploded3D ||
+                            chartType == eChartType.ConeBarClustered ||
+                            chartType == eChartType.ConeBarStacked ||
+                            chartType == eChartType.ConeBarStacked100 ||
+                            chartType == eChartType.ConeCol ||
+                            chartType == eChartType.ConeColClustered ||
+                            chartType == eChartType.ConeColStacked ||
+                            chartType == eChartType.ConeColStacked100 ||
+                            chartType == eChartType.CylinderBarClustered ||
+                            chartType == eChartType.CylinderBarStacked ||
+                            chartType == eChartType.CylinderBarStacked100 ||
+                            chartType == eChartType.CylinderCol ||
+                            chartType == eChartType.CylinderColClustered ||
+                            chartType == eChartType.CylinderColStacked ||
+                            chartType == eChartType.CylinderColStacked100 ||
+                            chartType == eChartType.PyramidBarClustered ||
+                            chartType == eChartType.PyramidBarStacked ||
+                            chartType == eChartType.PyramidBarStacked100 ||
+                            chartType == eChartType.PyramidCol ||
+                            chartType == eChartType.PyramidColClustered ||
+                            chartType == eChartType.PyramidColStacked ||
+                            chartType == eChartType.PyramidColStacked100 ||
+                            chartType == eChartType.Surface ||
+                            chartType == eChartType.SurfaceTopView ||
+                            chartType == eChartType.SurfaceTopViewWireframe ||
+                            chartType == eChartType.SurfaceWireframe;
+        }
+       internal protected bool IsType3D()
+       {
+            return IsType3D(ChartType);
+       }
+        protected bool IsTypeLine()
+       {
+           return ChartType == eChartType.Line ||
+                   ChartType == eChartType.LineMarkers ||
+                   ChartType == eChartType.LineMarkersStacked100 ||
+                   ChartType == eChartType.LineStacked ||
+                   ChartType == eChartType.LineStacked100 ||
+                   ChartType == eChartType.Line3D;
+       }
+       protected bool IsTypeScatterBubble()
+       {
+           return ChartType == eChartType.XYScatter ||
+                   ChartType == eChartType.XYScatterLines ||
+                   ChartType == eChartType.XYScatterLinesNoMarkers ||
+                   ChartType == eChartType.XYScatterSmooth ||
+                   ChartType == eChartType.XYScatterSmoothNoMarkers ||
+                   ChartType == eChartType.Bubble ||
+                   ChartType == eChartType.Bubble3DEffect;
+       }
+        protected bool IsTypeSurface()
+        {
+            return ChartType == eChartType.Surface ||
+                   ChartType == eChartType.SurfaceTopView ||
+                   ChartType == eChartType.SurfaceTopViewWireframe ||
+                   ChartType == eChartType.SurfaceWireframe;
+        }
+       protected bool IsTypeShape()
+       {
+            return ChartType == eChartType.BarClustered3D ||
+                    ChartType == eChartType.BarStacked3D ||
+                    ChartType == eChartType.BarStacked1003D ||
+                    ChartType == eChartType.BarClustered3D ||
+                    ChartType == eChartType.BarStacked3D ||
+                    ChartType == eChartType.BarStacked1003D ||
+                    ChartType == eChartType.Column3D ||
+                    ChartType == eChartType.ColumnClustered3D ||
+                    ChartType == eChartType.ColumnStacked3D ||
+                    ChartType == eChartType.ColumnStacked1003D ||
+                //ChartType == eChartType.3DPie ||
+                //ChartType == eChartType.3DPieExploded ||
+                    //ChartType == eChartType.Bubble3DEffect ||
+                    ChartType == eChartType.ConeBarClustered ||
+                    ChartType == eChartType.ConeBarStacked ||
+                    ChartType == eChartType.ConeBarStacked100 ||
+                    ChartType == eChartType.ConeCol ||
+                    ChartType == eChartType.ConeColClustered ||
+                    ChartType == eChartType.ConeColStacked ||
+                    ChartType == eChartType.ConeColStacked100 ||
+                    ChartType == eChartType.CylinderBarClustered ||
+                    ChartType == eChartType.CylinderBarStacked ||
+                    ChartType == eChartType.CylinderBarStacked100 ||
+                    ChartType == eChartType.CylinderCol ||
+                    ChartType == eChartType.CylinderColClustered ||
+                    ChartType == eChartType.CylinderColStacked ||
+                    ChartType == eChartType.CylinderColStacked100 ||
+                    ChartType == eChartType.PyramidBarClustered ||
+                    ChartType == eChartType.PyramidBarStacked ||
+                    ChartType == eChartType.PyramidBarStacked100 ||
+                    ChartType == eChartType.PyramidCol ||
+                    ChartType == eChartType.PyramidColClustered ||
+                    ChartType == eChartType.PyramidColStacked ||
+                    ChartType == eChartType.PyramidColStacked100; //||
+                    //ChartType == eChartType.Doughnut ||
+                    //ChartType == eChartType.DoughnutExploded;
+        }
+        protected internal bool IsTypePercentStacked()
+        {
+            return ChartType == eChartType.AreaStacked100 ||
+                           ChartType == eChartType.BarStacked100 ||
+                           ChartType == eChartType.BarStacked1003D ||
+                           ChartType == eChartType.ColumnStacked100 ||
+                           ChartType == eChartType.ColumnStacked1003D ||
+                           ChartType == eChartType.ConeBarStacked100 ||
+                           ChartType == eChartType.ConeColStacked100 ||
+                           ChartType == eChartType.CylinderBarStacked100 ||
+                           ChartType == eChartType.CylinderColStacked ||
+                           ChartType == eChartType.LineMarkersStacked100 ||
+                           ChartType == eChartType.LineStacked100 ||
+                           ChartType == eChartType.PyramidBarStacked100 ||
+                           ChartType == eChartType.PyramidColStacked100;
+        }
+        protected internal bool IsTypeStacked()
+        {
+            return ChartType == eChartType.AreaStacked ||
+                           ChartType == eChartType.AreaStacked3D ||
+                           ChartType == eChartType.BarStacked ||
+                           ChartType == eChartType.BarStacked3D ||
+                           ChartType == eChartType.ColumnStacked3D ||
+                           ChartType == eChartType.ColumnStacked ||
+                           ChartType == eChartType.ConeBarStacked ||
+                           ChartType == eChartType.ConeColStacked ||
+                           ChartType == eChartType.CylinderBarStacked ||
+                           ChartType == eChartType.CylinderColStacked ||
+                           ChartType == eChartType.LineMarkersStacked ||
+                           ChartType == eChartType.LineStacked ||
+                           ChartType == eChartType.PyramidBarStacked ||
+                           ChartType == eChartType.PyramidColStacked;
+        }
+        protected bool IsTypeClustered()
+        {
+            return ChartType == eChartType.BarClustered ||
+                           ChartType == eChartType.BarClustered3D ||
+                           ChartType == eChartType.ColumnClustered3D ||
+                           ChartType == eChartType.ColumnClustered ||
+                           ChartType == eChartType.ConeBarClustered ||
+                           ChartType == eChartType.ConeColClustered ||
+                           ChartType == eChartType.CylinderBarClustered ||
+                           ChartType == eChartType.CylinderColClustered ||
+                           ChartType == eChartType.PyramidBarClustered ||
+                           ChartType == eChartType.PyramidColClustered;
+        }
+        protected internal bool IsTypePieDoughnut()
+        {
+            return ChartType == eChartType.Pie ||
+                           ChartType == eChartType.PieExploded ||
+                           ChartType == eChartType.PieOfPie ||
+                           ChartType == eChartType.Pie3D ||
+                           ChartType == eChartType.PieExploded3D ||
+                           ChartType == eChartType.BarOfPie ||
+                           ChartType == eChartType.Doughnut ||
+                           ChartType == eChartType.DoughnutExploded;
+        }
+        #endregion
+       /// <summary>
+       /// Get the name of the chart node
+       /// </summary>
+       /// <returns>The name</returns>
+        protected string GetChartNodeText()
+        {
+            switch (ChartType)
+            {
+                case eChartType.Area3D:
+                case eChartType.AreaStacked3D:
+                case eChartType.AreaStacked1003D:
+                    return "c:area3DChart";
+                case eChartType.Area:
+                case eChartType.AreaStacked:
+                case eChartType.AreaStacked100:
+                    return "c:areaChart";
+                case eChartType.BarClustered:
+                case eChartType.BarStacked:
+                case eChartType.BarStacked100:
+                case eChartType.ColumnClustered:
+                case eChartType.ColumnStacked:
+                case eChartType.ColumnStacked100:
+                    return "c:barChart";
+                case eChartType.BarClustered3D:
+                case eChartType.BarStacked3D:
+                case eChartType.BarStacked1003D:
+                case eChartType.ColumnClustered3D:
+                case eChartType.ColumnStacked3D:
+                case eChartType.ColumnStacked1003D:
+                case eChartType.ConeBarClustered:
+                case eChartType.ConeBarStacked:
+                case eChartType.ConeBarStacked100:
+                case eChartType.ConeCol:
+                case eChartType.ConeColClustered:
+                case eChartType.ConeColStacked:
+                case eChartType.ConeColStacked100:
+                case eChartType.CylinderBarClustered:
+                case eChartType.CylinderBarStacked:
+                case eChartType.CylinderBarStacked100:
+                case eChartType.CylinderCol:
+                case eChartType.CylinderColClustered:
+                case eChartType.CylinderColStacked:
+                case eChartType.CylinderColStacked100:
+                case eChartType.PyramidBarClustered:
+                case eChartType.PyramidBarStacked:
+                case eChartType.PyramidBarStacked100:
+                case eChartType.PyramidCol:
+                case eChartType.PyramidColClustered:
+                case eChartType.PyramidColStacked:
+                case eChartType.PyramidColStacked100:
+                    return "c:bar3DChart";
+                case eChartType.Bubble:
+                case eChartType.Bubble3DEffect:
+                    return "c:bubbleChart";
+                case eChartType.Doughnut:
+                case eChartType.DoughnutExploded:
+                    return "c:doughnutChart";
+                case eChartType.Line:
+                case eChartType.LineMarkers:
+                case eChartType.LineMarkersStacked:
+                case eChartType.LineMarkersStacked100:
+                case eChartType.LineStacked:
+                case eChartType.LineStacked100:
+                    return "c:lineChart";
+                case eChartType.Line3D:
+                    return "c:line3DChart";
+                case eChartType.Pie:
+                case eChartType.PieExploded:
+                    return "c:pieChart";
+                case eChartType.BarOfPie:
+                case eChartType.PieOfPie:
+                    return "c:ofPieChart";
+                case eChartType.Pie3D:
+                case eChartType.PieExploded3D:
+                    return "c:pie3DChart";
+                case eChartType.Radar:
+                case eChartType.RadarFilled:
+                case eChartType.RadarMarkers:
+                    return "c:radarChart";
+                case eChartType.XYScatter:
+                case eChartType.XYScatterLines:
+                case eChartType.XYScatterLinesNoMarkers:
+                case eChartType.XYScatterSmooth:
+                case eChartType.XYScatterSmoothNoMarkers:
+                    return "c:scatterChart";
+                case eChartType.Surface:
+                case eChartType.SurfaceWireframe:
+                    return "c:surface3DChart";
+                case eChartType.SurfaceTopView:
+                case eChartType.SurfaceTopViewWireframe:
+                    return "c:surfaceChart";
+                case eChartType.StockHLC:
+                    return "c:stockChart";
+                default:
+                    throw(new NotImplementedException("Chart type not implemented"));
+            }
+        }
+        /// <summary>
+        /// Add a secondary axis
+        /// </summary>
+        internal void AddAxis()
+        {
+            XmlElement catAx = ChartXml.CreateElement(string.Format("c:{0}",AddAxType()), ExcelPackage.schemaChart);
+            int axID;
+            if (_axis.Length == 0)
+            {
+                _plotArea.TopNode.AppendChild(catAx);
+                axID = 1;
+            }
+            else
+            {
+                _axis[0].TopNode.ParentNode.InsertAfter(catAx, _axis[_axis.Length-1].TopNode);
+                axID = int.Parse(_axis[0].Id) < int.Parse(_axis[1].Id) ? int.Parse(_axis[1].Id) + 1 : int.Parse(_axis[0].Id) + 1;
+            }
+
+
+            XmlElement valAx = ChartXml.CreateElement("c:valAx", ExcelPackage.schemaChart);
+            catAx.ParentNode.InsertAfter(valAx, catAx);
+
+            if (_axis.Length == 0)
+            {
+                catAx.InnerXml = string.Format("<c:axId val=\"{0}\"/><c:scaling><c:orientation val=\"minMax\"/></c:scaling><c:delete val=\"0\" /><c:axPos val=\"b\"/><c:tickLblPos val=\"nextTo\"/><c:crossAx val=\"{1}\"/><c:crosses val=\"autoZero\"/><c:auto val=\"1\"/><c:lblAlgn val=\"ctr\"/><c:lblOffset val=\"100\"/>", axID, axID + 1);
+                valAx.InnerXml = string.Format("<c:axId val=\"{1}\"/><c:scaling><c:orientation val=\"minMax\"/></c:scaling><c:delete val=\"0\" /><c:axPos val=\"l\"/><c:majorGridlines/><c:tickLblPos val=\"nextTo\"/><c:crossAx val=\"{0}\"/><c:crosses val=\"autoZero\"/><c:crossBetween val=\"between\"/>", axID, axID + 1);
+            }
+            else
+            {
+                catAx.InnerXml = string.Format("<c:axId val=\"{0}\"/><c:scaling><c:orientation val=\"minMax\"/></c:scaling><c:delete val=\"1\" /><c:axPos val=\"b\"/><c:tickLblPos val=\"none\"/><c:crossAx val=\"{1}\"/><c:crosses val=\"autoZero\"/>", axID, axID + 1);
+                valAx.InnerXml = string.Format("<c:axId val=\"{0}\"/><c:scaling><c:orientation val=\"minMax\"/></c:scaling><c:delete val=\"0\" /><c:axPos val=\"r\"/><c:tickLblPos val=\"nextTo\"/><c:crossAx val=\"{1}\"/><c:crosses val=\"max\"/><c:crossBetween val=\"between\"/>", axID + 1, axID);
+            }
+
+            if (_axis.Length == 0)
+            {
+                _axis = new ExcelChartAxis[2];
+            }
+            else
+            {
+                ExcelChartAxis[] newAxis = new ExcelChartAxis[_axis.Length + 2];
+                Array.Copy(_axis, newAxis, _axis.Length);
+                _axis = newAxis;
+            }
+
+            _axis[_axis.Length - 2] = new ExcelChartAxis(NameSpaceManager, catAx);
+            _axis[_axis.Length - 1] = new ExcelChartAxis(NameSpaceManager, valAx);
+            foreach (var chart in _plotArea.ChartTypes)
+            {
+                chart._axis = _axis;
+            }
+        }
+        internal void RemoveSecondaryAxis()
+        {
+            throw (new NotImplementedException("Not yet implemented"));
+        }
+        #region "Properties"
+        /// <summary>
+        /// Reference to the worksheet
+        /// </summary>
+        public ExcelWorksheet WorkSheet { get; internal set; }
+        /// <summary>
+        /// The chart xml document
+        /// </summary>
+        public XmlDocument ChartXml { get; internal set; }
+        /// <summary>
+        /// Type of chart
+        /// </summary>
+        public eChartType ChartType { get; internal set; }
+        internal protected XmlNode _chartNode = null;
+        internal XmlNode ChartNode
+        {
+            get
+            {
+                return _chartNode;
+            }
+        }
+        /// <summary>
+        /// Titel of the chart
+        /// </summary>
+        public ExcelChartTitle Title
+        {
+            get
+            {
+                if (_title == null)
+                {
+                    _title = new ExcelChartTitle(NameSpaceManager, ChartXml.SelectSingleNode("c:chartSpace/c:chart", NameSpaceManager));
+                }
+                return _title;
+            }
+        }
+        /// <summary>
+        /// Chart series
+        /// </summary>
+        public virtual ExcelChartSeries Series
+        {
+            get
+            {
+                return _chartSeries;
+            }
+        }
+        /// <summary>
+        /// An array containg all axis of all Charttypes
+        /// </summary>
+        public ExcelChartAxis[] Axis
+        {
+            get
+            {
+                return _axis;
+            }
+        }
+        /// <summary>
+        /// The XAxis
+        /// </summary>
+        public ExcelChartAxis XAxis
+        {
+            get;
+            private set;
+        }
+        /// <summary>
+        /// The YAxis
+        /// </summary>
+        public ExcelChartAxis YAxis
+        {
+            get;
+            private set;
+        }
+        bool _secondaryAxis=false;
+        /// <summary>
+        /// If true the charttype will use the secondary axis.
+        /// The chart must contain a least one other charttype that uses the primary axis.
+        /// </summary>
+        public bool UseSecondaryAxis
+        {
+            get
+            {
+                return _secondaryAxis;
+            }
+            set
+            {
+                 if (_secondaryAxis != value)
+                {
+                    if (value)
+                    {
+                        if (IsTypePieDoughnut())
+                        {
+                            throw (new Exception("Pie charts do not support axis"));
+                        }
+                        else if (HasPrimaryAxis() == false)
+                        {
+                            throw (new Exception("Can't set to secondary axis when no serie uses the primary axis"));
+                        }
+                        if (Axis.Length == 2)
+                        {
+                            AddAxis();
+                        }
+                        var nl = ChartNode.SelectNodes("c:axId", NameSpaceManager);
+                        nl[0].Attributes["val"].Value = Axis[2].Id;
+                        nl[1].Attributes["val"].Value = Axis[3].Id;
+                        XAxis = Axis[2];
+                        YAxis = Axis[3];
+                    }
+                    else
+                    {
+                        var nl = ChartNode.SelectNodes("c:axId", NameSpaceManager);
+                        nl[0].Attributes["val"].Value = Axis[0].Id;
+                        nl[1].Attributes["val"].Value = Axis[1].Id;
+                        XAxis = Axis[0];
+                        YAxis = Axis[1];
+                    }
+                    _secondaryAxis = value;
+                }
+            }
+        }
+        /// <summary>
+        /// The build-in chart styles. 
+        /// </summary>
+        public eChartStyle Style
+        {
+            get
+            {
+                XmlNode node = ChartXml.SelectSingleNode("c:chartSpace/c:style/@val", NameSpaceManager);
+                if (node == null)
+                {
+                    return eChartStyle.None;
+                }
+                else
+                {
+                    int v;
+                    if (int.TryParse(node.Value, out v))
+                    {
+                        return (eChartStyle)v;
+                    }
+                    else
+                    {
+                        return eChartStyle.None;
+                    }
+                }
+
+            }
+            set
+            {
+                if (value == eChartStyle.None)
+                {
+                    XmlElement element = ChartXml.SelectSingleNode("c:chartSpace/c:style", NameSpaceManager) as XmlElement;
+                    if (element != null)
+                    {
+                        element.ParentNode.RemoveChild(element);
+                    }
+                }
+                else
+                {
+                    XmlElement element = ChartXml.CreateElement("c:style", ExcelPackage.schemaChart);
+                    element.SetAttribute("val", ((int)value).ToString());
+                    XmlElement parent = ChartXml.SelectSingleNode("c:chartSpace", NameSpaceManager) as XmlElement;
+                    parent.InsertBefore(element, parent.SelectSingleNode("c:chart", NameSpaceManager));
+                }
+            }
+        }
+        const string _plotVisibleOnlyPath="../../c:plotVisOnly/@val";
+        /// <summary>
+        /// Show data in hidden rows and columns
+        /// </summary>
+        public bool ShowHiddenData
+        {
+            get
+            {
+                //!!Inverted value!!
+                return !_chartXmlHelper.GetXmlNodeBool(_plotVisibleOnlyPath);
+            }
+            set
+            {
+                //!!Inverted value!!
+                _chartXmlHelper.SetXmlNodeBool(_plotVisibleOnlyPath, !value);
+            }
+        }
+        const string _displayBlanksAsPath = "../../c:dispBlanksAs/@val";
+        /// <summary>
+        /// Specifies the possible ways to display blanks
+        /// </summary>
+        public eDisplayBlanksAs DisplayBlanksAs
+        {
+            get
+            {
+                string v=_chartXmlHelper.GetXmlNodeString(_displayBlanksAsPath);
+                if (string.IsNullOrEmpty(v))
+                {
+                    return eDisplayBlanksAs.Zero; //Issue 14715 Changed in Office 2010-?
+                }
+                else
+                {
+                    return (eDisplayBlanksAs)Enum.Parse(typeof(eDisplayBlanksAs), v, true);
+                }
+            }
+            set
+            {
+                _chartSeries.SetXmlNodeString(_displayBlanksAsPath, value.ToString().ToLower(CultureInfo.InvariantCulture));
+            }
+        }
+        const string _showDLblsOverMax = "../../c:showDLblsOverMax/@val";
+        /// <summary>
+        /// Specifies data labels over the maximum of the chart shall be shown
+        /// </summary>
+        public bool ShowDataLabelsOverMaximum
+        {
+            get
+            {
+                return _chartXmlHelper.GetXmlNodeBool(_showDLblsOverMax, true);
+            }
+            set
+            {
+                _chartXmlHelper.SetXmlNodeBool(_showDLblsOverMax,value, true);
+            }
+        }
+        private bool HasPrimaryAxis()
+        {
+            if (_plotArea.ChartTypes.Count == 1)
+            {
+                return false;
+            }
+            foreach (var chart in _plotArea.ChartTypes)
+            {
+                if (chart != this)
+                {
+                    if (chart.UseSecondaryAxis == false && chart.IsTypePieDoughnut()==false)
+                    {
+                        return true;
+                    }
+                }
+            }
+            return false;
+        }
+        ///// <summary>
+        ///// Sets position of the axis of a chart-serie
+        ///// </summary>
+        ///// <param name="XAxis">Left or Right</param>
+        ///// <param name="YAxis">Top or Bottom</param>
+        //internal void SetAxis(eXAxisPosition XAxis, eYAxisPosition YAxis)
+        //{
+        //    bool xAxisExists = false, yAxisExists = false;
+        //    foreach (var axis in _axis)
+        //    {
+        //        if (axis.AxisPosition == (eAxisPosition)XAxis)
+        //        {
+        //            //Found
+        //            xAxisExists=true;
+        //            if (axis != this.XAxis)
+        //            {
+        //                CheckRemoveAxis(this.XAxis);
+        //                this.XAxis = axis;
+        //            }
+        //        }
+        //        else if (axis.AxisPosition == (eAxisPosition)YAxis)
+        //        {
+        //            yAxisExists = true;
+        //            if (axis != this.YAxis)
+        //            {
+        //                CheckRemoveAxis(this.YAxis);
+        //                this.YAxis = axis;
+        //            }
+        //        }
+        //    }
+
+        //    if (!xAxisExists)
+        //    {
+        //        if (ExistsAxis(this.XAxis))
+        //        {
+        //            AddAxis((eAxisPosition)XAxis);
+        //            this.XAxis = Axis[Axis.Length - 1];
+        //        }
+        //        else
+        //        {
+        //            this.XAxis.AxisPosition = (eAxisPosition)XAxis;
+        //        }
+        //    }
+        //    if (!yAxisExists)
+        //    {
+        //        if (ExistsAxis(this.XAxis))
+        //        {
+        //            AddAxis((eAxisPosition)YAxis);
+        //            this.YAxis = Axis[Axis.Length - 1];
+        //        }
+        //        else
+        //        {
+        //            this.YAxis.AxisPosition = (eAxisPosition)YAxis;
+        //        }
+        //    }
+        //}
+
+        /// <summary>
+        /// Remove all axis that are not used any more
+        /// </summary>
+        /// <param name="excelChartAxis"></param>
+        private void CheckRemoveAxis(ExcelChartAxis excelChartAxis)
+        {
+            if (ExistsAxis(excelChartAxis))
+            {
+                //Remove the axis
+                ExcelChartAxis[] newAxis = new ExcelChartAxis[Axis.Length - 1];
+                int pos = 0;
+                foreach (var ax in Axis)
+                {
+                    if (ax != excelChartAxis)
+                    {
+                        newAxis[pos] = ax;
+                    }
+                }
+
+                //Update all charttypes.
+                foreach (ExcelChart chartType in _plotArea.ChartTypes)
+                {
+                    chartType._axis = newAxis;
+                }
+            }
+        }
+
+        private bool ExistsAxis(ExcelChartAxis excelChartAxis)
+        {
+            foreach (ExcelChart chartType in _plotArea.ChartTypes)
+            {
+                if (chartType != this)
+                {
+                    if (chartType.XAxis.AxisPosition == excelChartAxis.AxisPosition ||
+                       chartType.YAxis.AxisPosition == excelChartAxis.AxisPosition)
+                    {
+                        //The axis exists
+                        return true;
+                    }
+                }
+            }
+            return false;
+        }
+        ExcelChartPlotArea _plotArea = null;
+        /// <summary>
+        /// Plotarea
+        /// </summary>
+        public ExcelChartPlotArea PlotArea
+        {
+            get
+            {
+                if (_plotArea == null)
+                {
+                    _plotArea = new ExcelChartPlotArea(NameSpaceManager, ChartXml.SelectSingleNode("c:chartSpace/c:chart/c:plotArea", NameSpaceManager), this); 
+                }
+                return _plotArea;
+            }
+        }
+        ExcelChartLegend _legend = null;
+        /// <summary>
+        /// Legend
+        /// </summary>
+        public ExcelChartLegend Legend
+        {
+            get
+            {
+                if (_legend == null)
+                {
+                    _legend = new ExcelChartLegend(NameSpaceManager, ChartXml.SelectSingleNode("c:chartSpace/c:chart/c:legend", NameSpaceManager), this);
+                }
+                return _legend;
+            }
+
+        }
+        ExcelDrawingBorder _border = null;
+        /// <summary>
+        /// Border
+        /// </summary>
+        public ExcelDrawingBorder Border
+        {
+            get
+            {
+                if (_border == null)
+                {
+                    _border = new ExcelDrawingBorder(NameSpaceManager, ChartXml.SelectSingleNode("c:chartSpace",NameSpaceManager), "c:spPr/a:ln"); 
+                }
+                return _border;
+            }
+        }
+        ExcelDrawingFill _fill = null;
+        /// <summary>
+        /// Fill
+        /// </summary>
+        public ExcelDrawingFill Fill
+        {
+            get
+            {
+                if (_fill == null)
+                {
+                    _fill = new ExcelDrawingFill(NameSpaceManager, ChartXml.SelectSingleNode("c:chartSpace", NameSpaceManager), "c:spPr");
+                }
+                return _fill;
+            }
+        }
+        /// <summary>
+        /// 3D-settings
+        /// </summary>
+        public ExcelView3D View3D
+        {
+            get
+            {
+                if (IsType3D())
+                {
+                    return new ExcelView3D(NameSpaceManager, ChartXml.SelectSingleNode("//c:view3D", NameSpaceManager));
+                }
+                else
+                {
+                    throw (new Exception("Charttype does not support 3D"));
+                }
+
+            }
+        }
+        //string _groupingPath = "c:chartSpace/c:chart/c:plotArea/{0}/c:grouping/@val";
+        string _groupingPath = "c:grouping/@val";
+        public eGrouping Grouping
+        {
+            get
+            {
+                return GetGroupingEnum(_chartXmlHelper.GetXmlNodeString(_groupingPath));
+            }
+            internal set
+            {
+                _chartXmlHelper.SetXmlNodeString(_groupingPath, GetGroupingText(value));
+            }
+        }
+        //string _varyColorsPath = "c:chartSpace/c:chart/c:plotArea/{0}/c:varyColors/@val";
+        string _varyColorsPath = "c:varyColors/@val";
+        /// <summary>
+        /// If the chart has only one serie this varies the colors for each point.
+        /// </summary>
+        public bool VaryColors
+        {
+            get
+            {
+                return _chartXmlHelper.GetXmlNodeBool(_varyColorsPath);
+            }
+            set
+            {
+                if (value)
+                {
+                    _chartXmlHelper.SetXmlNodeString(_varyColorsPath, "1");
+                }
+                else
+                {
+                    _chartXmlHelper.SetXmlNodeString(_varyColorsPath, "0");
+                }
+            }
+        }
+        internal Packaging.ZipPackagePart Part { get; set; }
+        /// <summary>
+        /// Package internal URI
+        /// </summary>
+        internal Uri UriChart { get; set; }
+        internal new string Id
+        {
+            get { return ""; }
+        }
+        ExcelChartTitle _title = null;
+        #endregion
+       #region "Grouping Enum Translation"
+        private string GetGroupingText(eGrouping grouping)
+       {
+           switch (grouping)
+           {
+               case eGrouping.Clustered:
+                   return "clustered";
+               case eGrouping.Stacked:
+                   return "stacked";
+               case eGrouping.PercentStacked:
+                   return "percentStacked";
+               default:
+                   return "standard";
+
+           }
+       }
+       private eGrouping GetGroupingEnum(string grouping)
+       {
+           switch (grouping)
+           {
+               case "stacked":
+                   return eGrouping.Stacked;
+               case "percentStacked":
+                   return eGrouping.PercentStacked;
+               default: //"clustered":               
+                   return eGrouping.Clustered;
+           }         
+       }
+       #endregion
+       internal static ExcelChart GetChart(ExcelDrawings drawings, XmlNode node/*, XmlNode chartTypeNode*/)
+       {
+           XmlNode chartNode = node.SelectSingleNode("xdr:graphicFrame/a:graphic/a:graphicData/c:chart", drawings.NameSpaceManager);
+           if (chartNode != null)
+           {
+               var drawingRelation = drawings.Part.GetRelationship(chartNode.Attributes["r:id"].Value);
+               var uriChart = UriHelper.ResolvePartUri(drawings.UriDrawing, drawingRelation.TargetUri);
+
+               var part = drawings.Part.Package.GetPart(uriChart);
+               var chartXml = new XmlDocument();
+               LoadXmlSafe(chartXml, part.GetStream()); 
+
+               ExcelChart topChart = null;
+               foreach (XmlElement n in chartXml.SelectSingleNode(rootPath, drawings.NameSpaceManager).ChildNodes)
+                {
+                    if (topChart == null)
+                    {
+                        topChart = GetChart(n, drawings, node, uriChart, part, chartXml, null);
+                        if(topChart!=null)
+                        {
+                            topChart.PlotArea.ChartTypes.Add(topChart);
+                        }
+                    }
+                    else
+                    {
+                        var subChart = GetChart(n, null, null, null, null, null, topChart);
+                        if (subChart != null)
+                        {
+                            topChart.PlotArea.ChartTypes.Add(subChart);
+                        }
+                    }
+                }               
+                return topChart;
+           }
+           else
+           {
+               return null;
+           }           
+       }
+       internal static ExcelChart GetChart(XmlElement chartNode, ExcelDrawings drawings, XmlNode node,  Uri uriChart, Packaging.ZipPackagePart part, XmlDocument chartXml, ExcelChart topChart)
+       {
+           switch (chartNode.LocalName)
+           {
+               case "area3DChart":
+               case "areaChart":
+               case "stockChart":
+                   if (topChart == null)
+                   {
+                       return new ExcelChart(drawings, node, uriChart, part, chartXml, chartNode);
+                   }
+                   else
+                   {
+                       return new ExcelChart(topChart, chartNode);
+                   }
+               case "surface3DChart":
+               case "surfaceChart":
+                   if (topChart == null)
+                   {
+                       return new ExcelSurfaceChart(drawings, node, uriChart, part, chartXml, chartNode);
+                   }
+                   else
+                   {
+                       return new ExcelSurfaceChart(topChart, chartNode);
+                   }
+               case "radarChart":
+                   if (topChart == null)
+                   {
+                       return new ExcelRadarChart(drawings, node, uriChart, part, chartXml, chartNode);
+                   }
+                   else
+                   {
+                       return new ExcelRadarChart(topChart, chartNode);
+                   }
+               case "bubbleChart":
+                   if (topChart == null)
+                   {
+                       return new ExcelBubbleChart(drawings, node, uriChart, part, chartXml, chartNode);
+                   }
+                   else
+                   {
+                       return new ExcelBubbleChart(topChart, chartNode);
+                   }
+               case "barChart":
+               case "bar3DChart":
+                   if (topChart == null)
+                   {
+                       return new ExcelBarChart(drawings, node, uriChart, part, chartXml, chartNode);
+                   }
+                   else
+                   {
+                       return new ExcelBarChart(topChart, chartNode);
+                   }
+               case "doughnutChart":
+                   if (topChart == null)
+                   {
+                       return new ExcelDoughnutChart(drawings, node, uriChart, part, chartXml, chartNode);
+                   }
+                   else
+                   {
+                       return new ExcelDoughnutChart(topChart, chartNode);
+                   }
+               case "pie3DChart":
+               case "pieChart":
+                   if (topChart == null)
+                   {
+                       return new ExcelPieChart(drawings, node, uriChart, part, chartXml, chartNode);
+                   }
+                   else
+                   {
+                       return new ExcelPieChart(topChart, chartNode);
+                   }
+           case "ofPieChart":
+                   if (topChart == null)
+                   {
+                       return new ExcelOfPieChart(drawings, node, uriChart, part, chartXml, chartNode);
+                   }
+                   else
+                   {
+                       return new ExcelBarChart(topChart, chartNode);
+                   }
+               case "lineChart":
+               case "line3DChart":
+                   if (topChart == null)
+                   {
+                       return new ExcelLineChart(drawings, node, uriChart, part, chartXml, chartNode);
+                   }
+                   else
+                   {
+                       return new ExcelLineChart(topChart, chartNode);
+                   }
+               case "scatterChart":
+                   if (topChart == null)
+                   {
+                       return new ExcelScatterChart(drawings, node, uriChart, part, chartXml, chartNode);
+                   }
+                   else
+                   {
+                       return new ExcelScatterChart(topChart, chartNode);
+                   }
+               default:
+                   return null;
+           }       
+       }
+       internal static ExcelChart GetNewChart(ExcelDrawings drawings, XmlNode drawNode, eChartType chartType, ExcelChart topChart, ExcelPivotTable PivotTableSource)
+       {
+            switch(chartType)
+            {
+                case eChartType.Pie:
+                case eChartType.PieExploded:
+                case eChartType.Pie3D:
+                case eChartType.PieExploded3D:
+                    return new ExcelPieChart(drawings, drawNode, chartType, topChart, PivotTableSource);
+                case eChartType.BarOfPie:
+                case eChartType.PieOfPie:
+                    return new ExcelOfPieChart(drawings, drawNode, chartType, topChart, PivotTableSource);
+                case eChartType.Doughnut:
+                case eChartType.DoughnutExploded:
+                    return new ExcelDoughnutChart(drawings, drawNode, chartType, topChart, PivotTableSource);
+                case eChartType.BarClustered:
+                case eChartType.BarStacked:
+                case eChartType.BarStacked100:
+                case eChartType.BarClustered3D:
+                case eChartType.BarStacked3D:
+                case eChartType.BarStacked1003D:
+                case eChartType.ConeBarClustered:
+                case eChartType.ConeBarStacked:
+                case eChartType.ConeBarStacked100:
+                case eChartType.CylinderBarClustered:
+                case eChartType.CylinderBarStacked:
+                case eChartType.CylinderBarStacked100:
+                case eChartType.PyramidBarClustered:
+                case eChartType.PyramidBarStacked:
+                case eChartType.PyramidBarStacked100:
+                case eChartType.ColumnClustered:
+                case eChartType.ColumnStacked:
+                case eChartType.ColumnStacked100:
+                case eChartType.Column3D:
+                case eChartType.ColumnClustered3D:
+                case eChartType.ColumnStacked3D:
+                case eChartType.ColumnStacked1003D:
+                case eChartType.ConeCol:
+                case eChartType.ConeColClustered:
+                case eChartType.ConeColStacked:
+                case eChartType.ConeColStacked100:
+                case eChartType.CylinderCol:
+                case eChartType.CylinderColClustered:
+                case eChartType.CylinderColStacked:
+                case eChartType.CylinderColStacked100:
+                case eChartType.PyramidCol:
+                case eChartType.PyramidColClustered:
+                case eChartType.PyramidColStacked:
+                case eChartType.PyramidColStacked100:
+                    return new ExcelBarChart(drawings, drawNode, chartType, topChart, PivotTableSource);
+                case eChartType.XYScatter:
+                case eChartType.XYScatterLines:
+                case eChartType.XYScatterLinesNoMarkers:
+                case eChartType.XYScatterSmooth:
+                case eChartType.XYScatterSmoothNoMarkers:
+                    return new ExcelScatterChart(drawings, drawNode, chartType, topChart, PivotTableSource);
+                case eChartType.Line:
+                case eChartType.Line3D:
+                case eChartType.LineMarkers:
+                case eChartType.LineMarkersStacked:
+                case eChartType.LineMarkersStacked100:
+                case eChartType.LineStacked:
+                case eChartType.LineStacked100:
+                    return new ExcelLineChart(drawings, drawNode, chartType, topChart, PivotTableSource);
+                case eChartType.Bubble:
+                case eChartType.Bubble3DEffect:
+                    return new ExcelBubbleChart(drawings, drawNode, chartType, topChart, PivotTableSource);
+                case eChartType.Radar:
+                case eChartType.RadarFilled:
+                case eChartType.RadarMarkers:
+                    return new ExcelRadarChart(drawings, drawNode, chartType, topChart, PivotTableSource);
+                case eChartType.Surface:
+                case eChartType.SurfaceTopView:
+                case eChartType.SurfaceTopViewWireframe:
+                case eChartType.SurfaceWireframe:
+                    return new ExcelSurfaceChart(drawings, drawNode, chartType, topChart, PivotTableSource);
+                default:
+                    return new ExcelChart(drawings, drawNode, chartType, topChart, PivotTableSource);
+            }
+        }
+        public ExcelPivotTable PivotTableSource
+        {
+            get;
+            private set;
+        }
+       internal void SetPivotSource(ExcelPivotTable pivotTableSource)
+       {
+           PivotTableSource = pivotTableSource;
+           XmlElement chart = ChartXml.SelectSingleNode("c:chartSpace/c:chart", NameSpaceManager) as XmlElement;
+
+           var pivotSource = ChartXml.CreateElement("pivotSource", ExcelPackage.schemaChart);
+           chart.ParentNode.InsertBefore(pivotSource, chart);
+           pivotSource.InnerXml = string.Format("<c:name>[]{0}!{1}</c:name><c:fmtId val=\"0\"/>", PivotTableSource.WorkSheet.Name, pivotTableSource.Name);
+
+           var fmts = ChartXml.CreateElement("pivotFmts", ExcelPackage.schemaChart);
+           chart.PrependChild(fmts);
+           fmts.InnerXml = "<c:pivotFmt><c:idx val=\"0\"/><c:marker><c:symbol val=\"none\"/></c:marker></c:pivotFmt>";
+
+           Series.AddPivotSerie(pivotTableSource);
+       }
+       internal override void DeleteMe()
+       {
+           try
+           {
+               Part.Package.DeletePart(UriChart);
+           }
+           catch (Exception ex)
+           {
+               throw (new InvalidDataException("EPPlus internal error when deleteing chart.", ex));
+           }
+           base.DeleteMe();
+       }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelChartAxis.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelChartAxis.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelChartAxis.cs	(revision 12707)
@@ -0,0 +1,762 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Jan Källman		Added		2009-10-01
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Xml;
+using OfficeOpenXml.Style;
+using System.Globalization;
+namespace OfficeOpenXml.Drawing.Chart
+{
+    /// <summary>
+    /// Position of the axis.
+    /// </summary>
+    public enum eAxisPosition
+    {
+        Left = 0,
+        Bottom = 1,
+        Right = 2,
+        Top = 3
+    }
+    /// <summary>
+    /// Position of the Y-Axis
+    /// </summary>
+    public enum eYAxisPosition
+    {
+        Left = 0,
+        Right = 2,
+    }
+    /// <summary>
+    /// Position of the X-Axis
+    /// </summary>
+    public enum eXAxisPosition
+    {
+        Bottom = 1,
+        Top = 3
+    }
+    /// <summary>
+    /// Axis orientaion
+    /// </summary>
+    public enum eAxisOrientation
+    {
+        MaxMin,
+        MinMax
+    }
+    /// <summary>
+    /// How the axis are crossed
+    /// </summary>
+    public enum eCrossBetween
+    {
+        /// <summary>
+        /// Specifies the value axis shall cross the category axis between data markers
+        /// </summary>
+        Between,
+        /// <summary>
+        /// Specifies the value axis shall cross the category axis at the midpoint of a category.
+        /// </summary>
+        MidCat
+    }
+    /// <summary>
+    /// Where the axis cross. 
+    /// </summary>
+    public enum eCrosses
+    {
+        /// <summary>
+        /// (Axis Crosses at Zero) The category axis crosses at the zero point of the valueaxis (if possible), or the minimum value (if theminimum is greater than zero) or the maximum (if the maximum is less than zero).
+        /// </summary>
+        AutoZero,
+        /// <summary>
+        /// The axis crosses at the maximum value
+        /// </summary>
+        Max,
+        /// <summary>
+        /// (Axis crosses at the minimum value of the chart.
+        /// </summary>
+        Min
+    }
+    /// <summary>
+    /// Tickmarks
+    /// </summary>
+    public enum eAxisTickMark
+    {
+        /// <summary>
+        /// Specifies the tick marks shall cross the axis. 
+        /// </summary>
+        Cross,   
+        /// <summary>
+        /// Specifies the tick marks shall be inside the plot area. 
+        /// </summary>
+        In,     
+        /// <summary>
+        /// Specifies there shall be no tick marks.
+        /// </summary>
+        None,    
+        /// <summary>
+        /// Specifies the tick marks shall be outside the plot area.
+        /// </summary>
+        Out
+    }
+    public enum eBuildInUnits : long
+    {
+        hundreds = 100,
+        thousands = 1000,
+        tenThousands = 10000,
+        hundredThousands = 100000,
+        millions = 1000000,
+        tenMillions = 10000000,
+        hundredMillions = 100000000,
+        billions = 1000000000,
+        trillions = 1000000000000
+    }
+    /// <summary>
+    /// An axis for a chart
+    /// </summary>
+    public sealed class ExcelChartAxis : XmlHelper
+    {
+        /// <summary>
+        /// Type of axis
+        /// </summary>
+        internal enum eAxisType
+        {
+            /// <summary>
+            /// Value axis
+            /// </summary>
+            Val,
+            /// <summary>
+            /// Category axis
+            /// </summary>
+            Cat,
+            /// <summary>
+            /// Date axis
+            /// </summary>
+            Date,
+            /// <summary>
+            /// Series axis
+            /// </summary>
+            Serie
+        }
+        internal ExcelChartAxis(XmlNamespaceManager nameSpaceManager, XmlNode topNode) :
+            base(nameSpaceManager, topNode)
+        {
+            SchemaNodeOrder = new string[] { "axId", "scaling", "logBase", "orientation", "max", "min", "delete", "axPos", "majorGridlines", "title", "numFmt", "majorTickMark", "minorTickMark", "tickLblPos", "spPr", "txPr", "crossAx", "crossesAt", "crosses", "crossBetween", "auto", "lblOffset", "majorUnit", "minorUnit", "dispUnits", "spPr", "txPr" };
+        }
+        internal string Id
+        {
+            get
+            {
+                return GetXmlNodeString("c:axId/@val");
+            }
+        }
+        const string _majorTickMark = "c:majorTickMark/@val";
+        /// <summary>
+        /// majorTickMark 
+        /// This element specifies the major tick marks for the axis. 
+        /// </summary>
+        public eAxisTickMark MajorTickMark
+        {
+            get
+            {
+                var v=GetXmlNodeString(_majorTickMark);
+                if(string.IsNullOrEmpty(v))
+                {
+                    return eAxisTickMark.Cross;
+                }
+                else
+                {
+                    try
+                    {
+                        return (eAxisTickMark)Enum.Parse( typeof( eAxisTickMark ), v );
+                    }
+                    catch
+                    {
+                        return eAxisTickMark.Cross;
+                    }
+                }
+            }
+            set
+            {
+                SetXmlNodeString( _majorTickMark, value.ToString().ToLower(CultureInfo.InvariantCulture) );
+            }
+        }
+
+        const string _minorTickMark = "c:minorTickMark/@val";
+        /// <summary>
+        /// minorTickMark 
+        /// This element specifies the minor tick marks for the axis. 
+        /// </summary>
+        public eAxisTickMark MinorTickMark
+        {
+            get
+            {
+                var v=GetXmlNodeString(_minorTickMark);
+                if(string.IsNullOrEmpty(v))
+                {
+                    return eAxisTickMark.Cross;
+                }
+                else
+                {
+                    try
+                    {
+                        return (eAxisTickMark)Enum.Parse(typeof(eAxisTickMark), v );
+                    }
+                    catch
+                    {
+                        return eAxisTickMark.Cross;
+                    }
+                }
+            }
+            set
+            {
+                SetXmlNodeString(_minorTickMark, value.ToString().ToLower(CultureInfo.InvariantCulture));
+            }
+        }
+         /// <summary>
+        /// Type of axis
+        /// </summary>
+        internal eAxisType AxisType
+        {
+            get
+            {
+                try
+                {
+                    return (eAxisType)Enum.Parse(typeof(eAxisType), TopNode.LocalName.Substring(0,3), true);
+                }
+                catch
+                {
+                    return eAxisType.Val;
+                }
+            }
+        }
+        private string AXIS_POSITION_PATH = "c:axPos/@val";
+        /// <summary>
+        /// Where the axis is located
+        /// </summary>
+        public eAxisPosition AxisPosition
+        {
+            get
+            {                
+                switch(GetXmlNodeString(AXIS_POSITION_PATH))
+                {
+                    case "b":
+                        return eAxisPosition.Bottom;
+                    case "r":
+                        return eAxisPosition.Right;
+                    case "t":
+                        return eAxisPosition.Top;
+                    default: 
+                        return eAxisPosition.Left;
+                }
+            }
+            internal set
+            {
+                SetXmlNodeString(AXIS_POSITION_PATH, value.ToString().ToLower(CultureInfo.InvariantCulture).Substring(0,1));
+            }
+        }
+        const string _crossesPath = "c:crosses/@val";
+        /// <summary>
+        /// Where the axis cross
+        /// </summary>
+        public eCrosses Crosses
+        {
+            get
+            {
+                var v=GetXmlNodeString(_crossesPath);
+                if (string.IsNullOrEmpty(v))
+                {
+                    return eCrosses.AutoZero;
+                }
+                else
+                {
+                    try
+                    {
+                        return (eCrosses)Enum.Parse(typeof(eCrosses), v, true);
+                    }
+                    catch
+                    {
+                        return eCrosses.AutoZero;
+                    }
+                }
+            }
+            set
+            {
+                var v = value.ToString();
+                v = v.Substring(0, 1).ToLower(CultureInfo.InvariantCulture) + v.Substring(1, v.Length - 1);
+                SetXmlNodeString(_crossesPath, v);
+            }
+
+        }
+        const string _crossBetweenPath = "c:crossBetween/@val";
+        /// <summary>
+        /// How the axis are crossed
+        /// </summary>
+        public eCrossBetween CrossBetween
+        {
+            get
+            {
+                var v=GetXmlNodeString(_crossBetweenPath);
+                if(string.IsNullOrEmpty(v))
+                {
+                    return eCrossBetween.Between;
+                }
+                else
+                {
+                    try
+                    {
+                        return (eCrossBetween)Enum.Parse(typeof(eCrossBetween), v, true);
+                    }
+                    catch
+                    {
+                        return eCrossBetween.Between;
+                    }
+                }
+            }
+            set
+            {
+                var v = value.ToString();
+                v = v.Substring(0, 1).ToLower(CultureInfo.InvariantCulture) + v.Substring(1);
+                SetXmlNodeString(_crossBetweenPath, v);
+            }
+        }
+        const string _crossesAtPath = "c:crossesAt/@val";
+        /// <summary>
+        /// The value where the axis cross. 
+        /// Null is automatic
+        /// </summary>
+        public double? CrossesAt
+        {
+            get
+            {
+                return GetXmlNodeDoubleNull(_crossesAtPath);
+            }
+            set
+            {
+                if (value == null)
+                {
+                    DeleteNode(_crossesAtPath);
+                }
+                else
+                {
+                    SetXmlNodeString(_crossesAtPath, ((double)value).ToString(CultureInfo.InvariantCulture));
+                }
+            }
+        }
+        const string _formatPath = "c:numFmt/@formatCode";
+        /// <summary>
+        /// Numberformat
+        /// </summary>
+        public string Format 
+        {
+            get
+            {
+                return GetXmlNodeString(_formatPath);
+            }
+            set
+            {
+                SetXmlNodeString(_formatPath,value);
+            }
+        }
+
+        const string _lblPos = "c:tickLblPos/@val";
+        /// <summary>
+        /// Position of the labels
+        /// </summary>
+        public eTickLabelPosition LabelPosition
+        {
+            get
+            {
+                var v=GetXmlNodeString(_lblPos);
+                if (string.IsNullOrEmpty(v))
+                {
+                    return eTickLabelPosition.NextTo;
+                }
+                else
+                {
+                    try
+                    {
+                        return (eTickLabelPosition)Enum.Parse(typeof(eTickLabelPosition), v, true);
+                    }
+                    catch
+                    {
+                        return eTickLabelPosition.NextTo;
+                    }
+                }
+            }
+            set
+            {
+                string lp = value.ToString();
+                SetXmlNodeString(_lblPos, lp.Substring(0, 1).ToLower(CultureInfo.InvariantCulture) + lp.Substring(1, lp.Length - 1));
+            }
+        }
+        ExcelDrawingFill _fill = null;
+        /// <summary>
+        /// Access to fill properties
+        /// </summary>
+        public ExcelDrawingFill Fill
+        {
+            get
+            {
+                if (_fill == null)
+                {
+                    _fill = new ExcelDrawingFill(NameSpaceManager, TopNode, "c:spPr");
+                }
+                return _fill;
+            }
+        }
+        ExcelDrawingBorder _border = null;
+        /// <summary>
+        /// Access to border properties
+        /// </summary>
+        public ExcelDrawingBorder Border
+        {
+            get
+            {
+                if (_border == null)
+                {
+                    _border = new ExcelDrawingBorder(NameSpaceManager, TopNode, "c:spPr/a:ln");
+                }
+                return _border;
+            }
+        }
+        ExcelTextFont _font = null;
+        /// <summary>
+        /// Access to font properties
+        /// </summary>
+        public ExcelTextFont Font
+        {
+            get
+            {
+                if (_font == null)
+                {
+                    if (TopNode.SelectSingleNode("c:txPr", NameSpaceManager) == null)
+                    {
+                        CreateNode("c:txPr/a:bodyPr");
+                        CreateNode("c:txPr/a:lstStyle");
+                    }
+                    _font = new ExcelTextFont(NameSpaceManager, TopNode, "c:txPr/a:p/a:pPr/a:defRPr", new string[] { "pPr", "defRPr", "solidFill", "uFill", "latin", "cs", "r", "rPr", "t" });
+                }
+                return _font;
+            }
+        }
+        /// <summary>
+        /// If the axis is deleted
+        /// </summary>
+        public bool Deleted 
+        {
+            get
+            {
+                return GetXmlNodeBool("c:delete/@val");
+            }
+            set
+            {
+                SetXmlNodeBool("c:delete/@val", value);
+            }
+        }
+        const string _ticLblPos_Path = "c:tickLblPos/@val";
+        /// <summary>
+        /// Position of the Lables
+        /// </summary>
+        public eTickLabelPosition TickLabelPosition 
+        {
+            get
+            {
+                string v = GetXmlNodeString(_ticLblPos_Path);
+                if (v == "")
+                {
+                    return eTickLabelPosition.None;
+                }
+                else
+                {
+                    return (eTickLabelPosition)Enum.Parse(typeof(eTickLabelPosition), v, true);
+                }
+            }
+            set
+            {
+                string v = value.ToString();
+                v=v.Substring(0, 1).ToLower(CultureInfo.InvariantCulture) + v.Substring(1, v.Length - 1);
+                SetXmlNodeString(_ticLblPos_Path,v);
+            }
+        }
+        const string _displayUnitPath = "c:dispUnits/c:builtInUnit/@val";
+        const string _custUnitPath = "c:dispUnits/c:custUnit/@val";
+        public double DisplayUnit
+        {
+            get
+            {
+                string v = GetXmlNodeString(_displayUnitPath);
+                if (string.IsNullOrEmpty(v))
+                {
+                    var c = GetXmlNodeDoubleNull(_custUnitPath);
+                    if (c == null)
+                    {
+                        return 0;
+                    }
+                    else
+                    {
+                        return c.Value;
+                    }
+                }
+                else
+                {
+                    try
+                    {
+                        return (double)(long)Enum.Parse(typeof(eBuildInUnits), v, true);
+                    }
+                    catch
+                    {
+                        return 0;
+                    }
+                }
+            }
+            set
+            {
+                if (AxisType == eAxisType.Val && value>=0)
+                {
+                    foreach(var v in Enum.GetValues(typeof(eBuildInUnits)))
+                    {
+                        if((double)(long)v==value)
+                        {
+                            DeleteNode(_custUnitPath);
+                            SetXmlNodeString(_displayUnitPath, ((eBuildInUnits)value).ToString());
+                            return;
+                        }
+                    }
+                    DeleteNode(_displayUnitPath);
+                    if(value!=0)
+                    {
+                        SetXmlNodeString(_custUnitPath, value.ToString(CultureInfo.InvariantCulture));
+                    }
+                }
+            }
+        }        
+        ExcelChartTitle _title = null;
+        /// <summary>
+        /// Chart axis title
+        /// </summary>
+        public ExcelChartTitle Title
+        {
+            get
+            {
+                if (_title == null)
+                {
+                    var node = TopNode.SelectSingleNode("c:title", NameSpaceManager);
+                    if (node == null)
+                    {
+                        CreateNode("c:title");
+                        node = TopNode.SelectSingleNode("c:title", NameSpaceManager);
+                        node.InnerXml = "<c:tx><c:rich><a:bodyPr /><a:lstStyle /><a:p><a:r><a:t /></a:r></a:p></c:rich></c:tx><c:layout /><c:overlay val=\"0\" />";
+                    }
+                    _title = new ExcelChartTitle(NameSpaceManager, TopNode);
+                }
+                return _title;
+            }            
+        }
+        #region "Scaling"
+        const string _minValuePath = "c:scaling/c:min/@val";
+        /// <summary>
+        /// Minimum value for the axis.
+        /// Null is automatic
+        /// </summary>
+        public double? MinValue
+        {
+            get
+            {
+                return GetXmlNodeDoubleNull(_minValuePath);
+            }
+            set
+            {
+                if (value == null)
+                {
+                    DeleteNode(_minValuePath);
+                }
+                else
+                {
+                    SetXmlNodeString(_minValuePath, ((double)value).ToString(CultureInfo.InvariantCulture));
+                }
+            }
+        }
+        const string _maxValuePath = "c:scaling/c:max/@val";
+        /// <summary>
+        /// Max value for the axis.
+        /// Null is automatic
+        /// </summary>
+        public double? MaxValue
+        {
+            get
+            {
+                return GetXmlNodeDoubleNull(_maxValuePath);
+            }
+            set
+            {
+                if (value == null)
+                {
+                    DeleteNode(_maxValuePath);
+                }
+                else
+                {
+                    SetXmlNodeString(_maxValuePath, ((double)value).ToString(CultureInfo.InvariantCulture));
+                }
+            }
+        }
+        const string _majorUnitPath = "c:majorUnit/@val";
+        const string _majorUnitCatPath = "c:tickLblSkip/@val";
+        /// <summary>
+        /// Major unit for the axis.
+        /// Null is automatic
+        /// </summary>
+        public double? MajorUnit
+        {
+            get
+            {
+                if (AxisType == eAxisType.Cat)
+                {
+                    return GetXmlNodeDoubleNull(_majorUnitCatPath);
+                }
+                else
+                {
+                    return GetXmlNodeDoubleNull(_majorUnitPath);
+                }
+            }
+            set
+            {
+                if (value == null)
+                {
+                    DeleteNode(_majorUnitPath);
+                    DeleteNode(_majorUnitCatPath);
+                }
+                else
+                {
+                    if (AxisType == eAxisType.Cat)
+                    {
+                        SetXmlNodeString(_majorUnitCatPath, ((double)value).ToString(CultureInfo.InvariantCulture));
+                    }
+                    else
+                    {
+                        SetXmlNodeString(_majorUnitPath, ((double)value).ToString(CultureInfo.InvariantCulture));
+                    }
+                }
+            }
+        }
+        const string _minorUnitPath = "c:minorUnit/@val";
+        const string _minorUnitCatPath = "c:tickMarkSkip/@val";
+        /// <summary>
+        /// Minor unit for the axis.
+        /// Null is automatic
+        /// </summary>
+        public double? MinorUnit
+        {
+            get
+            {
+                if (AxisType == eAxisType.Cat)
+                {
+                    return GetXmlNodeDoubleNull(_minorUnitCatPath);
+                }
+                else
+                {
+                    return GetXmlNodeDoubleNull(_minorUnitPath);
+                }
+            }
+            set
+            {
+                if (value == null)
+                {
+                    DeleteNode(_minorUnitPath);
+                    DeleteNode(_minorUnitCatPath);
+                }
+                else
+                {
+                    if (AxisType == eAxisType.Cat)
+                    {
+                        SetXmlNodeString(_minorUnitCatPath, ((double)value).ToString(CultureInfo.InvariantCulture));
+                    }
+                    else
+                    {
+                        SetXmlNodeString(_minorUnitPath, ((double)value).ToString(CultureInfo.InvariantCulture));
+                    }
+                }
+            }
+        }
+        const string _logbasePath = "c:scaling/c:logBase/@val";
+        /// <summary>
+        /// The base for a logaritmic scale
+        /// Null for a normal scale
+        /// </summary>
+        public double? LogBase
+        {
+            get
+            {
+                return GetXmlNodeDoubleNull(_logbasePath);
+            }
+            set
+            {
+                if (value == null)
+                {
+                    DeleteNode(_logbasePath);
+                }
+                else
+                {
+                    double v = ((double)value);
+                    if (v < 2 || v > 1000)
+                    {
+                        throw(new ArgumentOutOfRangeException("Value must be between 2 and 1000"));
+                    }
+                    SetXmlNodeString(_logbasePath, v.ToString("0.0", CultureInfo.InvariantCulture));
+                }
+            }
+        }
+        const string _orientationPath = "c:scaling/c:orientation/@val";
+        /// <summary>
+        /// 
+        /// </summary>
+        public eAxisOrientation Orientation
+        {
+            get
+            {
+                string v = GetXmlNodeString(_orientationPath);
+                if (v == "")
+                {
+                    return eAxisOrientation.MinMax;
+                }
+                else
+                {
+                    return (eAxisOrientation)Enum.Parse(typeof(eAxisOrientation), v, true);
+                }
+            }
+            set
+            {
+                string s=value.ToString();
+                s=s.Substring(0,1).ToLower(CultureInfo.InvariantCulture) + s.Substring(1,s.Length-1);
+                SetXmlNodeString(_orientationPath, s);
+            }
+        }
+        #endregion
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelChartCollection.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelChartCollection.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelChartCollection.cs	(revision 12707)
@@ -0,0 +1,108 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Jan Källman		Added		2009-10-01
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Xml;
+
+namespace OfficeOpenXml.Drawing.Chart
+{
+    /// <summary>
+    /// Enumerates charttypes 
+    /// </summary>
+    public class ExcelChartCollection : IEnumerable<ExcelChart>
+    {
+        List<ExcelChart> _list = new List<ExcelChart>();
+        ExcelChart _topChart;
+        internal ExcelChartCollection(ExcelChart chart)
+        {
+            _topChart = chart;
+            _list.Add(chart);
+        }
+        internal void Add(ExcelChart chart)
+        {
+            _list.Add(chart);
+        }
+        /// <summary>
+        /// Add a new charttype to the chart
+        /// </summary>
+        /// <param name="chartType">The type of the new chart</param>
+        /// <returns></returns>
+        public ExcelChart Add(eChartType chartType)
+        {
+            if (_topChart.PivotTableSource != null)
+            {
+                throw (new InvalidOperationException("Can not add other charttypes to a pivot chart"));
+            }
+            else if (ExcelChart.IsType3D(chartType) || _list[0].IsType3D())
+            {
+                throw(new InvalidOperationException("3D charts can not be combined with other charttypes"));
+            }
+
+            var prependingChartNode = _list[_list.Count - 1].TopNode;
+            ExcelChart chart = ExcelChart.GetNewChart(_topChart.WorkSheet.Drawings, _topChart.TopNode, chartType, _topChart, null);
+
+            _list.Add(chart);
+            return chart;
+        }
+        public int Count
+        {
+            get
+            {
+                return _list.Count;
+            }
+        }
+        IEnumerator<ExcelChart> IEnumerable<ExcelChart>.GetEnumerator()
+        {
+            return _list.GetEnumerator();
+        }
+
+        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
+        {
+            return _list.GetEnumerator();
+        }
+        /// <summary>
+        /// Returns a chart at the specific position.  
+        /// </summary>
+        /// <param name="PositionID">The position of the chart. 0-base</param>
+        /// <returns></returns>
+        public ExcelChart this[int PositionID]
+        {
+            get
+            {
+                return (_list[PositionID]);
+            }
+        }
+
+
+}
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelChartDataLabel.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelChartDataLabel.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelChartDataLabel.cs	(revision 12707)
@@ -0,0 +1,290 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Jan Källman		Added		2009-12-30
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Xml;
+using OfficeOpenXml.Style;
+
+namespace OfficeOpenXml.Drawing.Chart
+{
+    /// <summary>
+    /// Datalabel on chart level. 
+    /// This class is inherited by ExcelChartSerieDataLabel
+    /// </summary>
+    public class ExcelChartDataLabel : XmlHelper
+    {
+       internal ExcelChartDataLabel(XmlNamespaceManager ns, XmlNode node)
+           : base(ns,node)
+       {
+           XmlNode topNode = node.SelectSingleNode("c:dLbls", NameSpaceManager);
+           if (topNode == null)
+           {
+               topNode = node.OwnerDocument.CreateElement("c", "dLbls", ExcelPackage.schemaChart);
+               //node.InsertAfter(_topNode, node.SelectSingleNode("c:order", NameSpaceManager));
+               InserAfter(node, "c:marker,c:tx,c:order,c:ser", topNode);
+               SchemaNodeOrder = new string[] { "spPr", "txPr", "dLblPos", "showLegendKey", "showVal", "showCatName", "showSerName", "showPercent", "showBubbleSize", "separator", "showLeaderLines" };
+               topNode.InnerXml = "<c:showLegendKey val=\"0\" /><c:showVal val=\"0\" /><c:showCatName val=\"0\" /><c:showSerName val=\"0\" /><c:showPercent val=\"0\" /><c:showBubbleSize val=\"0\" /> <c:separator>\r\n</c:separator><c:showLeaderLines val=\"0\" />";                      
+           }
+           TopNode = topNode;
+       }
+       #region "Public properties"
+       const string showValPath = "c:showVal/@val";
+       /// <summary>
+       /// Show the values 
+       /// </summary>
+        public bool ShowValue
+       {
+           get
+           {
+               return GetXmlNodeBool(showValPath);
+           }
+           set
+           {
+               SetXmlNodeString(showValPath, value ? "1" : "0");
+           }
+       }
+       const string showCatPath = "c:showCatName/@val";
+       /// <summary>
+       /// Show category names
+       /// </summary>
+        public bool ShowCategory
+       {
+           get
+           {
+               return GetXmlNodeBool(showCatPath);
+           }
+           set
+           {
+               SetXmlNodeString(showCatPath, value ? "1" : "0");
+           }
+       }
+       const string showSerPath = "c:showSerName/@val";
+       /// <summary>
+       /// Show series names
+       /// </summary>
+        public bool ShowSeriesName
+       {
+           get
+           {
+               return GetXmlNodeBool(showSerPath);
+           }
+           set
+           {
+               SetXmlNodeString(showSerPath, value ? "1" : "0");
+           }
+       }
+       const string showPerentPath = "c:showPercent/@val";
+       /// <summary>
+       /// Show percent values
+       /// </summary>
+        public bool ShowPercent
+       {
+           get
+           {
+               return GetXmlNodeBool(showPerentPath);
+           }
+           set
+           {
+               SetXmlNodeString(showPerentPath, value ? "1" : "0");
+           }
+       }
+       const string showLeaderLinesPath = "c:showLeaderLines/@val";
+       /// <summary>
+       /// Show the leader lines
+       /// </summary>
+        public bool ShowLeaderLines
+       {
+           get
+           {
+               return GetXmlNodeBool(showLeaderLinesPath);
+           }
+           set
+           {
+               SetXmlNodeString(showLeaderLinesPath, value ? "1" : "0");
+           }
+       }
+       const string showBubbleSizePath = "c:showBubbleSize/@val";
+       /// <summary>
+       /// Bubble Size.
+       /// </summary>
+        public bool ShowBubbleSize
+       {
+           get
+           {
+               return GetXmlNodeBool(showBubbleSizePath);
+           }
+           set
+           {
+               SetXmlNodeString(showBubbleSizePath, value ? "1" : "0");
+           }
+       }
+       const string showLegendKeyPath = "c:showLegendKey/@val";
+       public bool ShowLegendKey
+       {
+           get
+           {
+               return GetXmlNodeBool(showLegendKeyPath);
+           }
+           set
+           {
+               SetXmlNodeString(showLegendKeyPath, value ? "1" : "0");
+           }
+       }
+       const string separatorPath = "c:separator";
+       /// <summary>
+       /// Separator string 
+       /// </summary>
+        public string Separator
+       {
+           get
+           {
+               return GetXmlNodeString(separatorPath);
+           }
+           set
+           {
+               if (string.IsNullOrEmpty(value))
+               {
+                   DeleteNode(separatorPath);
+               }
+               else
+               {
+                   SetXmlNodeString(separatorPath, value);
+               }
+           }
+       }
+
+       ExcelDrawingFill _fill = null;
+       /// <summary>
+       /// Access fill properties
+       /// </summary>
+       public ExcelDrawingFill Fill
+       {
+           get
+           {
+               if (_fill == null)
+               {
+                   _fill = new ExcelDrawingFill(NameSpaceManager, TopNode, "c:spPr");
+               }
+               return _fill;
+           }
+       }
+       ExcelDrawingBorder _border = null;
+       /// <summary>
+       /// Access border properties
+       /// </summary>
+       public ExcelDrawingBorder Border
+       {
+           get
+           {
+               if (_border == null)
+               {
+                   _border = new ExcelDrawingBorder(NameSpaceManager, TopNode, "c:spPr/a:ln");
+               }
+               return _border;
+           }
+       }
+       string[] _paragraphSchemaOrder = new string[] { "spPr", "txPr", "dLblPos", "showVal", "showCatName", "showSerName", "showPercent", "separator", "showLeaderLines", "pPr", "defRPr", "solidFill", "uFill", "latin", "cs", "r", "rPr", "t" };
+       ExcelTextFont _font = null;
+       /// <summary>
+       /// Access font properties
+       /// </summary>
+       public ExcelTextFont Font
+       {
+           get
+           {
+               if (_font == null)
+               {
+                   if (TopNode.SelectSingleNode("c:txPr", NameSpaceManager) == null)
+                   {
+                       CreateNode("c:txPr/a:bodyPr");
+                       CreateNode("c:txPr/a:lstStyle");
+                   }
+                   _font = new ExcelTextFont(NameSpaceManager, TopNode, "c:txPr/a:p/a:pPr/a:defRPr", _paragraphSchemaOrder);
+               }
+               return _font;
+           }
+       }
+       #endregion
+       #region "Position Enum Translation"
+       protected string GetPosText(eLabelPosition pos)
+       {
+           switch (pos)
+           {
+               case eLabelPosition.Bottom:
+                   return "b";
+               case eLabelPosition.Center:
+                   return "ctr";
+               case eLabelPosition.InBase:
+                   return "inBase";
+               case eLabelPosition.InEnd:
+                   return "inEnd";
+               case eLabelPosition.Left:
+                   return "l";
+               case eLabelPosition.Right:
+                   return "r";
+               case eLabelPosition.Top:
+                   return "t";
+               case eLabelPosition.OutEnd:
+                   return "outEnd";
+               default:
+                   return "bestFit";
+           }
+       }
+
+       protected eLabelPosition GetPosEnum(string pos)
+       {
+           switch (pos)
+           {
+               case "b":
+                   return eLabelPosition.Bottom;
+               case "ctr":
+                   return eLabelPosition.Center;
+               case "inBase":
+                   return eLabelPosition.InBase;
+               case "inEnd":
+                   return eLabelPosition.InEnd;
+               case "l":
+                   return eLabelPosition.Left;
+               case "r":
+                   return eLabelPosition.Right;
+               case "t":
+                   return eLabelPosition.Top;
+               case "outEnd":
+                   return eLabelPosition.OutEnd;
+               default:
+                   return eLabelPosition.BestFit;
+           }
+       }
+    #endregion
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelChartLegend.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelChartLegend.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelChartLegend.cs	(revision 12707)
@@ -0,0 +1,200 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Jan Källman		Added		2009-10-01
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Text;
+using System.Xml;
+using OfficeOpenXml.Style;
+
+namespace OfficeOpenXml.Drawing.Chart
+{
+    /// <summary>
+    /// Position of the legend
+    /// </summary>
+    public enum eLegendPosition
+    {
+        Top,
+        Left,
+        Right,
+        Bottom,
+        TopRight
+    }
+    /// <summary>
+    /// Chart ledger
+    /// </summary>
+    public class ExcelChartLegend : XmlHelper
+    {
+        ExcelChart _chart;
+        internal ExcelChartLegend(XmlNamespaceManager ns, XmlNode node, ExcelChart chart)
+           : base(ns,node)
+       {
+           _chart=chart;
+           SchemaNodeOrder = new string[] { "legendPos", "layout","overlay", "txPr", "bodyPr", "lstStyle", "spPr" };
+       }
+        const string POSITION_PATH = "c:legendPos/@val";
+        /// <summary>
+        /// Position of the Legend
+        /// </summary>
+        public eLegendPosition Position 
+        {
+            get
+            {
+                switch(GetXmlNodeString(POSITION_PATH).ToLower(CultureInfo.InvariantCulture))
+                {
+                    case "t":
+                        return eLegendPosition.Top;
+                    case "b":
+                        return eLegendPosition.Bottom;
+                    case "l":
+                        return eLegendPosition.Left;
+                    case "tr":
+                        return eLegendPosition.TopRight;
+                    default:
+                        return eLegendPosition.Right;
+                }
+            }
+            set
+            {
+                if (TopNode == null) throw(new Exception("Can't set position. Chart has no legend"));
+                switch (value)
+                {
+                    case eLegendPosition.Top:
+                        SetXmlNodeString(POSITION_PATH, "t");
+                        break;
+                    case eLegendPosition.Bottom:
+                        SetXmlNodeString(POSITION_PATH, "b");
+                        break;
+                    case eLegendPosition.Left:
+                        SetXmlNodeString(POSITION_PATH, "l");
+                        break;
+                    case eLegendPosition.TopRight:
+                        SetXmlNodeString(POSITION_PATH, "tr");
+                        break;
+                    default:
+                        SetXmlNodeString(POSITION_PATH, "r");
+                        break;
+                }
+            }
+        }
+        const string OVERLAY_PATH = "c:overlay/@val";
+        /// <summary>
+        /// If the legend overlays other objects
+        /// </summary>
+        public bool Overlay
+        {
+            get
+            {
+                return GetXmlNodeBool(OVERLAY_PATH);
+            }
+            set
+            {
+                if (TopNode == null) throw (new Exception("Can't set overlay. Chart has no legend"));
+                SetXmlNodeBool(OVERLAY_PATH, value);
+            }
+        }
+        ExcelDrawingFill _fill = null;
+        /// <summary>
+        /// Fill style
+        /// </summary>
+        public ExcelDrawingFill Fill
+        {
+            get
+            {
+                if (_fill == null)
+                {
+                    _fill = new ExcelDrawingFill(NameSpaceManager, TopNode, "c:spPr");
+                }
+                return _fill;
+            }
+        }
+        ExcelDrawingBorder _border = null;
+        /// <summary>
+        /// Border style
+        /// </summary>
+        public ExcelDrawingBorder Border
+        {
+            get
+            {
+                if (_border == null)
+                {
+                    _border = new ExcelDrawingBorder(NameSpaceManager, TopNode, "c:spPr/a:ln");
+                }
+                return _border;
+            }
+        }
+        ExcelTextFont _font = null;
+        /// <summary>
+        /// Font properties
+        /// </summary>
+        public ExcelTextFont Font
+        {
+            get
+            {
+                if (_font == null)
+                {
+                    if (TopNode.SelectSingleNode("c:txPr",NameSpaceManager) == null)
+                    {
+                        CreateNode("c:txPr/a:bodyPr");
+                        CreateNode("c:txPr/a:lstStyle");
+                    }
+                    _font = new ExcelTextFont(NameSpaceManager, TopNode, "c:txPr/a:p/a:pPr/a:defRPr", new string[] { "legendPos", "layout", "pPr", "defRPr", "solidFill", "uFill", "latin", "cs", "r", "rPr", "t" });
+                }
+                return _font;
+            }
+        }
+        /// <summary>
+        /// Remove the legend
+        /// </summary>
+        public void Remove()
+        {
+            if (TopNode == null) return;
+            TopNode.ParentNode.RemoveChild(TopNode);
+            TopNode = null;
+        }
+        /// <summary>
+        /// Add a legend to the chart
+        /// </summary>
+        public void Add()
+        {
+            if(TopNode!=null) return;
+
+            //XmlHelper xml = new XmlHelper(NameSpaceManager, _chart.ChartXml);
+            XmlHelper xml = XmlHelperFactory.Create(NameSpaceManager, _chart.ChartXml);
+            xml.SchemaNodeOrder=_chart.SchemaNodeOrder;
+
+            xml.CreateNode("c:chartSpace/c:chart/c:legend");
+            TopNode = _chart.ChartXml.SelectSingleNode("c:chartSpace/c:chart/c:legend", NameSpaceManager);
+            TopNode.InnerXml="<c:legendPos val=\"r\" /><c:layout />";                        
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelChartPlotArea.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelChartPlotArea.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelChartPlotArea.cs	(revision 12707)
@@ -0,0 +1,88 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Jan Källman		Added		2009-12-30
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Xml;
+
+namespace OfficeOpenXml.Drawing.Chart
+{
+    /// <summary>
+    /// A charts plot area
+    /// </summary>
+    public sealed class ExcelChartPlotArea :  XmlHelper
+    {
+        ExcelChart _firstChart;
+        internal ExcelChartPlotArea(XmlNamespaceManager ns, XmlNode node, ExcelChart firstChart)
+           : base(ns,node)
+       {
+           _firstChart = firstChart;
+       }
+
+        ExcelChartCollection _chartTypes;
+        public ExcelChartCollection ChartTypes
+        {
+            get
+            {
+                if (_chartTypes == null)
+                {
+                    _chartTypes = new ExcelChartCollection(_firstChart); 
+                }
+                return _chartTypes;
+            }
+        }
+        ExcelDrawingFill _fill = null;
+        public ExcelDrawingFill Fill
+        {
+            get
+            {
+                if (_fill == null)
+                {
+                    _fill = new ExcelDrawingFill(NameSpaceManager, TopNode, "c:spPr");
+                }
+                return _fill;
+            }
+        }
+        ExcelDrawingBorder _border = null;
+        public ExcelDrawingBorder Border
+        {
+            get
+            {
+                if (_border == null)
+                {
+                    _border = new ExcelDrawingBorder(NameSpaceManager, TopNode, "c:spPr/a:ln");
+                }
+                return _border;
+            }
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelChartSerie.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelChartSerie.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelChartSerie.cs	(revision 12707)
@@ -0,0 +1,222 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Jan Källman		Added		2009-12-30
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Xml;
+using System.Collections;
+
+namespace OfficeOpenXml.Drawing.Chart
+{
+   /// <summary>
+   /// A chart serie
+   /// </summary>
+    public class ExcelChartSerie : XmlHelper
+   {
+       internal ExcelChartSeries _chartSeries;
+       protected XmlNode _node;
+       protected XmlNamespaceManager _ns;
+        /// <summary>
+        /// Default constructor
+        /// </summary>
+        /// <param name="chartSeries">Parent collection</param>
+        /// <param name="ns">Namespacemanager</param>
+        /// <param name="node">Topnode</param>
+       /// <param name="isPivot">Is pivotchart</param>
+       internal ExcelChartSerie(ExcelChartSeries chartSeries, XmlNamespaceManager ns, XmlNode node, bool isPivot)
+           : base(ns,node)
+       {
+           _chartSeries = chartSeries;
+           _node=node;
+           _ns=ns;
+           SchemaNodeOrder = new string[] { "idx", "order","spPr", "tx", "marker", "trendline", "explosion","invertIfNegative", "dLbls", "cat", "val", "xVal", "yVal", "bubbleSize", "bubble3D", "smooth" };
+
+           if (chartSeries.Chart.ChartType == eChartType.XYScatter ||
+               chartSeries.Chart.ChartType == eChartType.XYScatterLines ||
+               chartSeries.Chart.ChartType == eChartType.XYScatterLinesNoMarkers ||
+               chartSeries.Chart.ChartType == eChartType.XYScatterSmooth ||
+               chartSeries.Chart.ChartType == eChartType.XYScatterSmoothNoMarkers ||
+               chartSeries.Chart.ChartType == eChartType.Bubble ||
+               chartSeries.Chart.ChartType == eChartType.Bubble3DEffect)
+           {
+               _seriesTopPath = "c:yVal";
+               _xSeriesTopPath = "c:xVal";
+           }
+           else
+           {
+               _seriesTopPath = "c:val";
+               _xSeriesTopPath = "c:cat";
+           }
+           _seriesPath = string.Format(_seriesPath, _seriesTopPath);
+           _xSeriesPath = string.Format(_xSeriesPath, _xSeriesTopPath, isPivot ? "c:multiLvlStrRef" : "c:numRef");
+       }
+       internal void SetID(string id)
+       {
+           SetXmlNodeString("c:idx/@val",id);
+           SetXmlNodeString("c:order/@val", id);
+       }
+       const string headerPath="c:tx/c:v";
+       /// <summary>
+       /// Header for the serie.
+       /// </summary>
+       public string Header 
+       {
+           get
+           {
+                return GetXmlNodeString(headerPath);
+            }
+            set
+            {
+                Cleartx();
+                SetXmlNodeString(headerPath, value);            
+            }
+        }
+
+       private void Cleartx()
+       {
+           var n = TopNode.SelectSingleNode("c:tx", NameSpaceManager);
+           if (n != null)
+           {
+               n.InnerXml = "";
+           }
+       }
+       const string headerAddressPath = "c:tx/c:strRef/c:f";
+        /// <summary>
+       /// Header address for the serie.
+       /// </summary>
+       public ExcelAddressBase HeaderAddress
+       {
+           get
+           {
+               string address = GetXmlNodeString(headerAddressPath);
+               if (address == "")
+               {
+                   return null;
+               }
+               else
+               {
+                   return new ExcelAddressBase(address);
+               }
+            }
+            set
+            {
+                if ((value._fromCol != value._toCol && value._fromRow != value._toRow) || value.Addresses != null) //Single cell removed, allow row & column --> issue 15102. 
+                {
+                    throw (new ArgumentException("Address must be a row, column or single cell"));
+                }
+
+                Cleartx();
+                SetXmlNodeString(headerAddressPath, ExcelCellBase.GetFullAddress(value.WorkSheet, value.Address));
+                SetXmlNodeString("c:tx/c:strRef/c:strCache/c:ptCount/@val", "0");
+            }
+        }        
+        string _seriesTopPath;
+        string _seriesPath = "{0}/c:numRef/c:f";       
+       /// <summary>
+       /// Set this to a valid address or the drawing will be invalid.
+       /// </summary>
+       public virtual string Series
+       {
+           get
+           {
+               return GetXmlNodeString(_seriesPath);
+           }
+           set
+           {
+               CreateNode(_seriesPath,true);
+               SetXmlNodeString(_seriesPath, ExcelCellBase.GetFullAddress(_chartSeries.Chart.WorkSheet.Name, value));
+               
+               XmlNode cache = TopNode.SelectSingleNode(string.Format("{0}/c:numRef/c:numCache",_seriesTopPath), _ns);
+               if (cache != null)
+               {
+                   cache.ParentNode.RemoveChild(cache);
+               }
+
+               if (_chartSeries.Chart.PivotTableSource != null)
+               {
+                   SetXmlNodeString(string.Format("{0}/c:numRef/c:numCache", _seriesTopPath), "General");
+               }
+               
+               XmlNode lit = TopNode.SelectSingleNode(string.Format("{0}/c:numLit",_seriesTopPath), _ns);
+               if (lit != null)
+               {
+                   lit.ParentNode.RemoveChild(lit);
+               }
+           }
+
+       }
+       string _xSeriesTopPath;
+       string _xSeriesPath = "{0}/{1}/c:f";
+       /// <summary>
+       /// Set an address for the horisontal labels
+       /// </summary>
+       public virtual string XSeries
+       {
+           get
+           {
+               return GetXmlNodeString(_xSeriesPath);
+           }
+           set
+           {
+               CreateNode(_xSeriesPath, true);
+               SetXmlNodeString(_xSeriesPath, ExcelCellBase.GetFullAddress(_chartSeries.Chart.WorkSheet.Name, value));
+
+               XmlNode cache = TopNode.SelectSingleNode(string.Format("{0}/c:numRef/c:numCache",_xSeriesTopPath), _ns);
+               if (cache != null)
+               {
+                   cache.ParentNode.RemoveChild(cache);
+               }
+
+               XmlNode lit = TopNode.SelectSingleNode(string.Format("{0}/c:numLit",_xSeriesTopPath), _ns);
+               if (lit != null)
+               {
+                   lit.ParentNode.RemoveChild(lit);
+               }
+           }
+       }
+       ExcelChartTrendlineCollection _trendLines = null;
+       /// <summary>
+       /// Access to the trendline collection
+       /// </summary>
+        public ExcelChartTrendlineCollection TrendLines
+        {
+            get
+            {
+                if (_trendLines == null)
+                {
+                    _trendLines = new ExcelChartTrendlineCollection(this);
+                }
+                return _trendLines;
+            }
+        }
+   }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelChartSerieDataLabel.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelChartSerieDataLabel.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelChartSerieDataLabel.cs	(revision 12707)
@@ -0,0 +1,118 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Jan Källman		Added		2009-10-01
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Xml;
+using OfficeOpenXml.Style;
+
+namespace OfficeOpenXml.Drawing.Chart
+{
+    /// <summary>
+    /// Datalabel properties
+    /// </summary>
+    public sealed class ExcelChartSerieDataLabel : ExcelChartDataLabel
+    {
+       internal ExcelChartSerieDataLabel(XmlNamespaceManager ns, XmlNode node)
+           : base(ns,node)
+       {
+           CreateNode(positionPath);
+           Position = eLabelPosition.Center;
+       }
+
+       const string positionPath="c:dLblPos/@val";
+       /// <summary>
+       /// Position of the labels
+       /// </summary>
+       public eLabelPosition Position
+       {
+           get
+           {
+               return GetPosEnum(GetXmlNodeString(positionPath));
+           }
+           set
+           {
+               SetXmlNodeString(positionPath,GetPosText(value));
+           }
+       }
+       ExcelDrawingFill _fill = null;
+       /// <summary>
+       /// Access fill properties
+       /// </summary>
+        public new ExcelDrawingFill Fill
+       {
+           get
+           {
+               if (_fill == null)
+               {
+                   _fill = new ExcelDrawingFill(NameSpaceManager, TopNode, "c:spPr");
+               }    
+               return _fill;
+           }
+       }
+       ExcelDrawingBorder _border = null;
+       /// <summary>
+       /// Access border properties
+       /// </summary>
+        public new ExcelDrawingBorder Border
+       {
+           get
+           {
+               if (_border == null)
+               {
+                   _border = new ExcelDrawingBorder(NameSpaceManager, TopNode, "c:spPr/a:ln");
+               }
+               return _border;
+           }
+       }
+       ExcelTextFont _font = null;
+       /// <summary>
+       /// Access font properties
+       /// </summary>
+        public new ExcelTextFont Font
+       {
+           get
+           {
+               if (_font == null)
+               {
+                   if (TopNode.SelectSingleNode("c:txPr", NameSpaceManager) == null)
+                   {
+                       CreateNode("c:txPr/a:bodyPr");
+                       CreateNode("c:txPr/a:lstStyle");
+                   }
+                   _font = new ExcelTextFont(NameSpaceManager, TopNode, "c:txPr/a:p/a:pPr/a:defRPr", new string[] { "spPr", "txPr", "dLblPos", "showVal", "showCatName ", "pPr", "defRPr", "solidFill", "uFill", "latin", "cs", "r", "rPr", "t" });
+               }
+               return _font;
+           }
+       }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelChartSeries.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelChartSeries.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelChartSeries.cs	(revision 12707)
@@ -0,0 +1,406 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Jan Källman		Added		2009-10-01
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Xml;
+using System.Collections;
+using OfficeOpenXml.Table.PivotTable;
+namespace OfficeOpenXml.Drawing.Chart
+{
+    public sealed class ExcelBubbleChartSeries : ExcelChartSeries
+    {
+        internal ExcelBubbleChartSeries(ExcelChart chart, XmlNamespaceManager ns, XmlNode node, bool isPivot)
+           : base(chart,ns,node, isPivot)
+        {
+            //_chartSeries = new ExcelChartSeries(this, _drawings.NameSpaceManager, _chartNode, isPivot);
+        }
+        public ExcelChartSerie Add(ExcelRangeBase Serie, ExcelRangeBase XSerie, ExcelRangeBase BubbleSize)
+        {
+            return base.AddSeries(Serie.FullAddressAbsolute, XSerie.FullAddressAbsolute, BubbleSize.FullAddressAbsolute);
+        }
+        public ExcelChartSerie Add(string SerieAddress, string XSerieAddress, string BubbleSizeAddress)
+        {
+            return base.AddSeries(SerieAddress, XSerieAddress, BubbleSizeAddress);
+        }
+    }
+    /// <summary>
+   /// Collection class for chart series
+   /// </summary>
+    public class ExcelChartSeries : XmlHelper, IEnumerable
+    {
+       List<ExcelChartSerie> _list=new List<ExcelChartSerie>();
+       internal ExcelChart _chart;
+       XmlNode _node;
+       XmlNamespaceManager _ns;
+       internal ExcelChartSeries(ExcelChart chart, XmlNamespaceManager ns, XmlNode node, bool isPivot)
+           : base(ns,node)
+       {
+           _ns = ns;
+           _chart=chart;
+           _node=node;
+           _isPivot = isPivot;
+           SchemaNodeOrder = new string[] { "view3D", "plotArea", "barDir", "grouping", "scatterStyle", "varyColors", "ser", "explosion", "dLbls", "firstSliceAng", "holeSize", "shape", "legend", "axId" };
+           foreach(XmlNode n in node.SelectNodes("c:ser",ns))
+           {
+               ExcelChartSerie s;
+               if (chart.ChartNode.LocalName == "scatterChart")
+               {
+                   s = new ExcelScatterChartSerie(this, ns, n, isPivot);
+               }
+               else if (chart.ChartNode.LocalName == "lineChart")
+               {
+                   s = new ExcelLineChartSerie(this, ns, n, isPivot);
+               }
+               else if (chart.ChartNode.LocalName == "pieChart" ||
+                        chart.ChartNode.LocalName == "ofPieChart" ||
+                        chart.ChartNode.LocalName == "pie3DChart" ||
+                        chart.ChartNode.LocalName == "doughnutChart")                                                                       
+               {
+                   s = new ExcelPieChartSerie(this, ns, n, isPivot);
+               }
+               else
+               {
+                   s = new ExcelChartSerie(this, ns, n, isPivot);
+               }
+               _list.Add(s);
+           }
+       }
+
+       #region IEnumerable Members
+
+       public IEnumerator GetEnumerator()
+       {
+           return (_list.GetEnumerator());
+       }
+       /// <summary>
+       /// Returns the serie at the specified position.  
+       /// </summary>
+       /// <param name="PositionID">The position of the series.</param>
+       /// <returns></returns>
+       public ExcelChartSerie this[int PositionID]
+       {
+           get
+           {
+               return (_list[PositionID]);
+           }
+       }
+       public int Count
+       {
+           get
+           {
+               return _list.Count;
+           }
+       }
+       /// <summary>
+       /// Delete the chart at the specific position
+       /// </summary>
+       /// <param name="PositionID">Zero based</param>
+       public void Delete(int PositionID)
+       {
+           ExcelChartSerie ser = _list[PositionID];
+           ser.TopNode.ParentNode.RemoveChild(ser.TopNode);
+           _list.RemoveAt(PositionID);
+       }
+       #endregion
+       /// <summary>
+       /// A reference to the chart object
+       /// </summary>
+       public ExcelChart Chart
+       {
+           get
+           {
+               return _chart;
+           }
+       }
+       #region "Add Series"
+
+       /// <summary>
+       /// Add a new serie to the chart. Do not apply to pivotcharts.
+       /// </summary>
+       /// <param name="Serie">The Y-Axis range</param>
+       /// <param name="XSerie">The X-Axis range</param>
+       /// <returns></returns>
+       public virtual ExcelChartSerie Add(ExcelRangeBase Serie, ExcelRangeBase XSerie)
+       {
+           if (_chart.PivotTableSource != null)
+           {
+               throw (new InvalidOperationException("Can't add a serie to a pivotchart"));
+           }
+           return AddSeries(Serie.FullAddressAbsolute, XSerie.FullAddressAbsolute,"");
+       }
+       /// <summary>
+       /// Add a new serie to the chart.Do not apply to pivotcharts.
+       /// </summary>
+       /// <param name="SerieAddress">The Y-Axis range</param>
+       /// <param name="XSerieAddress">The X-Axis range</param>
+       /// <returns></returns>
+       public virtual ExcelChartSerie Add(string SerieAddress, string XSerieAddress)
+       {
+           if (_chart.PivotTableSource != null)
+           {
+               throw (new InvalidOperationException("Can't add a serie to a pivotchart"));
+           }
+           return AddSeries(SerieAddress, XSerieAddress, "");
+       }
+       internal protected ExcelChartSerie AddSeries(string SeriesAddress, string XSeriesAddress, string bubbleSizeAddress)
+        {
+               XmlElement ser = _node.OwnerDocument.CreateElement("ser", ExcelPackage.schemaChart);
+               XmlNodeList node = _node.SelectNodes("c:ser", _ns);
+               if (node.Count > 0)
+               {
+                   _node.InsertAfter(ser, node[node.Count-1]);
+               }
+               else
+               {
+                   InserAfter(_node, "c:varyColors,c:grouping,c:barDir,c:scatterStyle", ser);
+                }
+               int idx = FindIndex();
+               ser.InnerXml = string.Format("<c:idx val=\"{1}\" /><c:order val=\"{1}\" /><c:tx><c:strRef><c:f></c:f><c:strCache><c:ptCount val=\"1\" /></c:strCache></c:strRef></c:tx>{5}{0}{2}{3}{4}", AddExplosion(Chart.ChartType), idx, AddScatterPoint(Chart.ChartType), AddAxisNodes(Chart.ChartType), AddSmooth(Chart.ChartType), AddMarker(Chart.ChartType));
+               ExcelChartSerie serie;
+               switch (Chart.ChartType)
+               {
+                   case eChartType.Bubble:
+                   case eChartType.Bubble3DEffect:
+                       serie = new ExcelBubbleChartSerie(this, NameSpaceManager, ser, _isPivot)
+                       {
+                           Bubble3D=Chart.ChartType==eChartType.Bubble3DEffect,
+                           Series = SeriesAddress,
+                           XSeries = XSeriesAddress,
+                           BubbleSize = bubbleSizeAddress                            
+                       };
+                       break;
+                   case eChartType.XYScatter:
+                   case eChartType.XYScatterLines:
+                   case eChartType.XYScatterLinesNoMarkers:
+                   case eChartType.XYScatterSmooth:
+                   case eChartType.XYScatterSmoothNoMarkers:
+                       serie = new ExcelScatterChartSerie(this, NameSpaceManager, ser, _isPivot);
+                       break;
+                   case eChartType.Radar:
+                   case eChartType.RadarFilled:
+                   case eChartType.RadarMarkers:
+                       serie = new ExcelRadarChartSerie(this, NameSpaceManager, ser, _isPivot);
+                       break;
+                   case eChartType.Surface:
+                   case eChartType.SurfaceTopView:
+                   case eChartType.SurfaceTopViewWireframe:
+                   case eChartType.SurfaceWireframe:
+                       serie = new ExcelSurfaceChartSerie(this, NameSpaceManager, ser, _isPivot);
+                       break;
+                   case eChartType.Pie:
+                   case eChartType.Pie3D:
+                   case eChartType.PieExploded:
+                   case eChartType.PieExploded3D:
+                   case eChartType.PieOfPie:
+                   case eChartType.Doughnut:
+                   case eChartType.DoughnutExploded:
+                   case eChartType.BarOfPie:
+                       serie = new ExcelPieChartSerie(this, NameSpaceManager, ser, _isPivot);
+                       break;
+                   case eChartType.Line:
+                   case eChartType.LineMarkers:
+                   case eChartType.LineMarkersStacked:
+                   case eChartType.LineMarkersStacked100:
+                   case eChartType.LineStacked:
+                   case eChartType.LineStacked100:
+                       serie = new ExcelLineChartSerie(this, NameSpaceManager, ser, _isPivot);
+                       if (Chart.ChartType == eChartType.LineMarkers ||
+                           Chart.ChartType == eChartType.LineMarkersStacked ||
+                           Chart.ChartType == eChartType.LineMarkersStacked100)
+                       {
+                           ((ExcelLineChartSerie)serie).Marker = eMarkerStyle.Square;
+                       }
+                       ((ExcelLineChartSerie)serie).Smooth = ((ExcelLineChart)Chart).Smooth;
+                       break;
+                   case eChartType.BarClustered:
+                   case eChartType.BarStacked:
+                   case eChartType.BarStacked100:
+                   case eChartType.ColumnClustered:
+                   case eChartType.ColumnStacked:
+                   case eChartType.ColumnStacked100:
+                   case eChartType.BarClustered3D:
+                   case eChartType.BarStacked3D:
+                   case eChartType.BarStacked1003D:
+                   case eChartType.ColumnClustered3D:
+                   case eChartType.ColumnStacked3D:
+                   case eChartType.ColumnStacked1003D:
+                   case eChartType.ConeBarClustered:
+                   case eChartType.ConeBarStacked:
+                   case eChartType.ConeBarStacked100:
+                   case eChartType.ConeCol:
+                   case eChartType.ConeColClustered:
+                   case eChartType.ConeColStacked:
+                   case eChartType.ConeColStacked100:
+                   case eChartType.CylinderBarClustered:
+                   case eChartType.CylinderBarStacked:
+                   case eChartType.CylinderBarStacked100:
+                   case eChartType.CylinderCol:
+                   case eChartType.CylinderColClustered:
+                   case eChartType.CylinderColStacked:
+                   case eChartType.CylinderColStacked100:
+                   case eChartType.PyramidBarClustered:
+                   case eChartType.PyramidBarStacked:
+                   case eChartType.PyramidBarStacked100:
+                   case eChartType.PyramidCol:
+                   case eChartType.PyramidColClustered:
+                   case eChartType.PyramidColStacked:
+                   case eChartType.PyramidColStacked100:
+                       serie = new ExcelBarChartSerie(this, NameSpaceManager, ser, _isPivot);
+                       ((ExcelBarChartSerie)serie).InvertIfNegative=false;
+                       break;
+                   default:
+                       serie = new ExcelChartSerie(this, NameSpaceManager, ser, _isPivot);
+                       break;
+               }               
+               serie.Series = SeriesAddress;
+               serie.XSeries = XSeriesAddress;                     
+           _list.Add(serie);
+               return serie;
+        }
+       bool _isPivot;
+       internal void AddPivotSerie(ExcelPivotTable pivotTableSource)
+       {
+           var r=pivotTableSource.WorkSheet.Cells[pivotTableSource.Address.Address];
+           _isPivot = true;
+           AddSeries(r.Offset(0, 1, r._toRow - r._fromRow + 1, 1).FullAddressAbsolute, r.Offset(0, 0, r._toRow - r._fromRow + 1, 1).FullAddressAbsolute,"");
+       }
+       private int FindIndex()
+       {    
+           int ret = 0, newID=0;
+           if (_chart.PlotArea.ChartTypes.Count > 1)
+           {
+               foreach (var chart in _chart.PlotArea.ChartTypes)
+               {
+                   if (newID>0)
+                   {
+                       foreach (ExcelChartSerie serie in chart.Series)
+                       {
+                           serie.SetID((++newID).ToString());
+                       }
+                   }
+                   else
+                   {
+                       if (chart == _chart)
+                       {
+                           ret += _list.Count + 1;
+                           newID=ret;
+                       }
+                       else
+                       {
+                           ret += chart.Series.Count;
+                       }
+                   }
+               }
+               return ret-1;
+           }
+           else
+           {
+               return _list.Count;
+           }
+       }
+       #endregion
+       #region "Xml init Functions"
+       private string AddMarker(eChartType chartType)
+       {
+           if (chartType == eChartType.Line ||
+               chartType == eChartType.LineStacked ||
+               chartType == eChartType.LineStacked100 ||
+               chartType == eChartType.XYScatterLines ||
+               chartType == eChartType.XYScatterSmooth ||
+               chartType == eChartType.XYScatterLinesNoMarkers ||
+               chartType == eChartType.XYScatterSmoothNoMarkers)
+           {
+               return "<c:marker><c:symbol val=\"none\" /></c:marker>";
+           }
+           else
+           {
+               return "";
+           }
+       }
+       private string AddScatterPoint(eChartType chartType)
+       {
+           if (chartType == eChartType.XYScatter)
+           {
+               return "<c:spPr><a:ln w=\"28575\"><a:noFill /></a:ln></c:spPr>";
+           }
+           else
+           {
+               return "";
+           }
+       }
+       private string AddAxisNodes(eChartType chartType)
+       {
+           if ( chartType == eChartType.XYScatter ||
+                chartType == eChartType.XYScatterLines ||
+                chartType == eChartType.XYScatterLinesNoMarkers ||
+                chartType == eChartType.XYScatterSmooth ||
+                chartType == eChartType.XYScatterSmoothNoMarkers || 
+                chartType == eChartType.Bubble ||
+                chartType == eChartType.Bubble3DEffect)
+           {
+               return "<c:xVal /><c:yVal />";
+           }
+           else
+           {
+               return "<c:val />";
+           }
+       }
+
+       private string AddExplosion(eChartType chartType)
+       {
+           if (chartType == eChartType.PieExploded3D ||
+              chartType == eChartType.PieExploded ||
+               chartType == eChartType.DoughnutExploded)
+           {
+               return "<c:explosion val=\"25\" />"; //Default 25;
+           }
+           else
+           {
+               return "";
+           }
+       }
+       private string AddSmooth(eChartType chartType)
+       {
+           if (chartType == eChartType.XYScatterSmooth ||
+              chartType == eChartType.XYScatterSmoothNoMarkers)
+           {
+               return "<c:smooth val=\"1\" />"; //Default 25;
+           }
+           else
+           {
+               return "";
+           }
+       }
+        #endregion
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelChartSurface.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelChartSurface.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelChartSurface.cs	(revision 12707)
@@ -0,0 +1,102 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Jan Källman		Added		2009-12-30
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Xml;
+using OfficeOpenXml.Style;
+
+namespace OfficeOpenXml.Drawing.Chart
+{
+    /// <summary>
+    /// Chart surface settings
+    /// </summary>
+    public class ExcelChartSurface : XmlHelper
+    {
+        internal ExcelChartSurface(XmlNamespaceManager ns, XmlNode node)
+           : base(ns,node)
+       {
+           SchemaNodeOrder = new string[] { "thickness", "spPr", "pictureOptions" };
+       }
+       #region "Public properties"
+        const string THICKNESS_PATH = "c:thickness/@val";
+       /// <summary>
+       /// Show the values 
+       /// </summary>
+        public int Thickness
+       {
+           get
+           {
+               return GetXmlNodeInt(THICKNESS_PATH);
+           }
+           set
+           {
+               if(value < 0 && value > 9)
+               {
+                   throw (new ArgumentOutOfRangeException("Thickness out of range. (0-9)"));
+               }
+               SetXmlNodeString(THICKNESS_PATH, value.ToString());
+           }
+       }
+       ExcelDrawingFill _fill = null;
+       /// <summary>
+       /// Access fill properties
+       /// </summary>
+       public ExcelDrawingFill Fill
+       {
+           get
+           {
+               if (_fill == null)
+               {
+                   _fill = new ExcelDrawingFill(NameSpaceManager, TopNode, "c:spPr");
+               }
+               return _fill;
+           }
+       }
+       ExcelDrawingBorder _border = null;
+       /// <summary>
+       /// Access border properties
+       /// </summary>
+       public ExcelDrawingBorder Border
+       {
+           get
+           {
+               if (_border == null)
+               {
+                   _border = new ExcelDrawingBorder(NameSpaceManager, TopNode, "c:spPr/a:ln");
+               }
+               return _border;
+           }
+       }
+       #endregion
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelChartTitle.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelChartTitle.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelChartTitle.cs	(revision 12707)
@@ -0,0 +1,236 @@
+﻿/************** *****************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Jan Källman		Added		2009-10-01
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Xml;
+using OfficeOpenXml.Style;
+
+namespace OfficeOpenXml.Drawing.Chart
+{
+    /// <summary>
+    /// The title of a chart
+    /// </summary>
+    public class ExcelChartTitle : XmlHelper
+    {
+        internal ExcelChartTitle(XmlNamespaceManager nameSpaceManager, XmlNode node) :
+            base(nameSpaceManager, node)
+        {
+            XmlNode topNode = node.SelectSingleNode("c:title", NameSpaceManager);
+            if (topNode == null)
+            {
+                topNode = node.OwnerDocument.CreateElement("c", "title", ExcelPackage.schemaChart);
+                node.InsertBefore(topNode, node.ChildNodes[0]);
+                topNode.InnerXml = "<c:tx><c:rich><a:bodyPr /><a:lstStyle /><a:p><a:pPr><a:defRPr sz=\"1800\" b=\"0\" /></a:pPr><a:r><a:t /></a:r></a:p></c:rich></c:tx><c:layout /><c:overlay val=\"0\" />";
+            }
+            TopNode = topNode;
+            SchemaNodeOrder = new string[] { "tx","bodyPr", "lstStyle", "layout", "overlay" };
+        }
+        const string titlePath = "c:tx/c:rich/a:p/a:r/a:t";
+        /// <summary>
+        /// The text
+        /// </summary>
+        public string Text
+        {
+            get
+            {
+                //return GetXmlNode(titlePath);
+                return RichText.Text;
+            }
+            set
+            {
+                //SetXmlNode(titlePath, value);
+                RichText.Text = value;
+            }
+        }
+        ExcelDrawingBorder _border = null;
+        /// <summary>
+        /// A reference to the border properties
+        /// </summary>
+        public ExcelDrawingBorder Border
+        {
+            get
+            {
+                if (_border == null)
+                {
+                    _border = new ExcelDrawingBorder(NameSpaceManager, TopNode, "c:spPr/a:ln");
+                }
+                return _border;
+            }
+        }
+        ExcelDrawingFill _fill = null;
+        /// <summary>
+        /// A reference to the fill properties
+        /// </summary>
+        public ExcelDrawingFill Fill
+        {
+            get
+            {
+                if (_fill == null)
+                {
+                    _fill = new ExcelDrawingFill(NameSpaceManager, TopNode, "c:spPr");
+                }
+                return _fill;
+            }
+        }
+        //ExcelTextFont _font = null;
+        /// <summary>
+        /// A reference to the font properties
+        /// </summary>
+        public ExcelTextFont Font
+        {
+            get
+            {
+                //if (_font == null)
+                //{
+                //    _font = new ExcelTextFont(NameSpaceManager, TopNode, "c:tx/c:rich/a:p/a:r/a:rPr", new string[] { "rPr", "solidFill", "uFill", "latin", "cs", "r", "rPr", "t" });
+                //}
+                //return _font;
+                if (_richText==null || _richText.Count == 0)
+                {
+                    RichText.Add("");
+                }
+                return _richText[0];
+            }
+        }
+        string[] paragraphNodeOrder = new string[] { "pPr", "defRPr", "solidFill", "uFill", "latin", "cs", "r", "rPr", "t" };
+        ExcelParagraphCollection _richText = null;
+        /// <summary>
+        /// Richtext
+        /// </summary>
+        public ExcelParagraphCollection RichText
+        {
+            get
+            {
+                if (_richText == null)
+                {
+                    _richText = new ExcelParagraphCollection(NameSpaceManager, TopNode, "c:tx/c:rich/a:p", paragraphNodeOrder);
+                }
+                return _richText;
+            }
+        }
+        /// <summary>
+        /// Show without overlaping the chart.
+        /// </summary>
+        public bool Overlay
+        {
+            get
+            {
+                return GetXmlNodeBool("c:overlay/@val");
+            }
+            set
+            {
+                SetXmlNodeBool("c:overlay/@val", value);
+            }
+        }
+        /// <summary>
+        /// Specifies the centering of the text box. 
+        /// The way it works fundamentally is to determine the smallest possible "bounds box" for the text and then to center that "bounds box" accordingly. 
+        /// This is different than paragraph alignment, which aligns the text within the "bounds box" for the text. 
+        /// This flag is compatible with all of the different kinds of anchoring. 
+        /// If this attribute is omitted, then a value of 0 or false is implied.
+        /// </summary>
+        public bool AnchorCtr
+        {
+            get
+            {
+                return GetXmlNodeBool("c:tx/c:rich/a:bodyPr/@anchorCtr", false);
+            }
+            set
+            {
+                SetXmlNodeBool("c:tx/c:rich/a:bodyPr/@anchorCtr", value, false);
+            }
+        }
+        public eTextAnchoringType Anchor
+        {
+            get
+            {
+                return ExcelDrawing.GetTextAchoringEnum(GetXmlNodeString("c:tx/c:rich/a:bodyPr/@anchor"));
+            }
+            set
+            {
+                SetXmlNodeString("c:tx/c:rich/a:bodyPr/@anchorCtr", ExcelDrawing.GetTextAchoringText(value));
+            }
+        }
+        const string TextVerticalPath = "xdr:sp/xdr:txBody/a:bodyPr/@vert";
+        /// <summary>
+        /// Vertical text
+        /// </summary>
+        public eTextVerticalType TextVertical
+        {
+            get
+            {
+                return ExcelDrawing.GetTextVerticalEnum(GetXmlNodeString("c:tx/c:rich/a:bodyPr/@vert"));
+            }
+            set
+            {
+                SetXmlNodeString("c:tx/c:rich/a:bodyPr/@vert", ExcelDrawing.GetTextVerticalText(value));
+            }
+        }
+        /// <summary>
+        /// Rotation in degrees (0-360)
+        /// </summary>
+        public double Rotation
+        {
+            get
+            {
+                var i=GetXmlNodeInt("c:tx/c:rich/a:bodyPr/@rot");
+                if (i < 0)
+                {
+                    return 360 - (i / 60000);
+                }
+                else
+                {
+                    return (i / 60000);
+                }
+            }
+            set
+            {
+                int v;
+                if(value <0 || value > 360)
+                {
+                    throw(new ArgumentOutOfRangeException("Rotation must be between 0 and 360"));
+                }
+
+                if (value > 180)
+                {
+                    v = (int)((value - 360) * 60000);
+                }
+                else
+                {
+                    v = (int)(value * 60000);
+                }
+                SetXmlNodeString("c:tx/c:rich/a:bodyPr/@rot", v.ToString());
+            }
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelChartTrendline.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelChartTrendline.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelChartTrendline.cs	(revision 12707)
@@ -0,0 +1,298 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		Initial Release		        2011-05-25
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Xml;
+using System.Globalization;
+
+namespace OfficeOpenXml.Drawing.Chart
+{
+    /// <summary>
+    /// A collection of trendlines.
+    /// </summary>
+    public class ExcelChartTrendlineCollection : IEnumerable<ExcelChartTrendline>
+    {
+        List<ExcelChartTrendline> _list = new List<ExcelChartTrendline>();
+        ExcelChartSerie _serie;
+        internal ExcelChartTrendlineCollection(ExcelChartSerie serie)
+        {
+            _serie = serie;
+            foreach (XmlNode node in _serie.TopNode.SelectNodes("c:trendline", _serie.NameSpaceManager))
+            {
+                _list.Add(new ExcelChartTrendline(_serie.NameSpaceManager, node));
+            }
+        }
+        /// <summary>
+        /// Add a new trendline
+        /// </summary>
+        /// <param name="Type"></param>
+        /// <returns>The trendline</returns>
+        public ExcelChartTrendline Add(eTrendLine Type)
+        {
+            if (_serie._chartSeries._chart.IsType3D() ||
+                _serie._chartSeries._chart.IsTypePercentStacked() ||
+                _serie._chartSeries._chart.IsTypeStacked() ||
+                _serie._chartSeries._chart.IsTypePieDoughnut())
+            {
+                throw(new ArgumentException("Trendlines don't apply to 3d-charts, stacked charts, pie charts or doughnut charts"));
+            }
+            ExcelChartTrendline tl;
+            XmlNode insertAfter;
+            if (_list.Count > 0)
+            {
+                insertAfter = _list[_list.Count - 1].TopNode;
+            }
+            else
+            {
+                insertAfter = _serie.TopNode.SelectSingleNode("c:marker", _serie.NameSpaceManager);
+                if (insertAfter == null)
+                {
+                    insertAfter = _serie.TopNode.SelectSingleNode("c:tx", _serie.NameSpaceManager);
+                    if (insertAfter == null)
+                    {
+                        insertAfter = _serie.TopNode.SelectSingleNode("c:order", _serie.NameSpaceManager);
+                    }
+                }
+            }
+            var node=_serie.TopNode.OwnerDocument.CreateElement("c","trendline", ExcelPackage.schemaChart);
+            _serie.TopNode.InsertAfter(node, insertAfter);
+
+            tl = new ExcelChartTrendline(_serie.NameSpaceManager, node);
+            tl.Type = Type;
+            return tl;
+        }
+        IEnumerator<ExcelChartTrendline> IEnumerable<ExcelChartTrendline>.GetEnumerator()
+        {
+            return _list.GetEnumerator();
+        }
+
+        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
+        {
+            return _list.GetEnumerator();
+        }
+    }
+    /// <summary>
+    /// A trendline object
+    /// </summary>
+    public class ExcelChartTrendline : XmlHelper
+    {
+        internal ExcelChartTrendline(XmlNamespaceManager namespaceManager, XmlNode topNode) :
+            base(namespaceManager,topNode)
+
+        {
+            SchemaNodeOrder = new string[] { "name", "trendlineType","order","period", "forward","backward","intercept", "dispRSqr", "dispEq", "trendlineLbl" };
+        }
+        const string TRENDLINEPATH = "c:trendlineType/@val";
+        /// <summary>
+        /// Type of Trendline
+        /// </summary>
+        public eTrendLine Type
+        {
+           get
+           {
+               switch (GetXmlNodeString(TRENDLINEPATH).ToLower(CultureInfo.InvariantCulture))
+               {
+                   case "exp":
+                       return eTrendLine.Exponential;
+                   case "log":
+                        return eTrendLine.Logarithmic;
+                   case "poly":
+                       return eTrendLine.Polynomial;
+                   case "movingavg":
+                       return eTrendLine.MovingAvgerage;
+                   case "power":
+                       return eTrendLine.Power;
+                   default:
+                       return eTrendLine.Linear;
+               }
+           }
+           set
+           {
+                switch (value)
+                {
+                    case eTrendLine.Exponential:
+                        SetXmlNodeString(TRENDLINEPATH, "exp");
+                        break;
+                    case eTrendLine.Logarithmic:
+                        SetXmlNodeString(TRENDLINEPATH, "log");
+                        break;
+                    case eTrendLine.Polynomial:
+                        SetXmlNodeString(TRENDLINEPATH, "poly");
+                        Order = 2;
+                        break;
+                    case eTrendLine.MovingAvgerage:
+                        SetXmlNodeString(TRENDLINEPATH, "movingAvg");
+                        Period = 2;
+                        break;
+                    case eTrendLine.Power:
+                        SetXmlNodeString(TRENDLINEPATH, "power");
+                        break;
+                    default: 
+                        SetXmlNodeString(TRENDLINEPATH, "linear");
+                        break;
+                }
+           }
+        }
+        const string NAMEPATH = "c:name";
+        /// <summary>
+        /// Name in the legend
+        /// </summary>
+        public string Name
+        {
+            get
+            {
+                return GetXmlNodeString(NAMEPATH);
+            }
+            set
+            {
+                SetXmlNodeString(NAMEPATH, value, true);
+            }
+        }
+        const string ORDERPATH = "c:order/@val";
+        /// <summary>
+        /// Order for polynominal trendlines
+        /// </summary>
+        public decimal Order
+        {
+            get
+            {
+                return GetXmlNodeDecimal(ORDERPATH);
+            }
+            set
+            {
+                if (Type == eTrendLine.MovingAvgerage)
+                {
+                    throw (new ArgumentException("Can't set period for trendline type MovingAvgerage"));
+                }
+                DeleteAllNode(PERIODPATH);
+                SetXmlNodeString(ORDERPATH, value.ToString(CultureInfo.InvariantCulture));
+            }
+        }
+        const string PERIODPATH = "c:period/@val";
+        /// <summary>
+        /// Period for monthly average trendlines
+        /// </summary>
+        public decimal Period
+        {
+            get
+            {
+                return GetXmlNodeDecimal(PERIODPATH);
+            }
+            set
+            {
+                if (Type == eTrendLine.Polynomial)
+                {
+                    throw (new ArgumentException("Can't set period for trendline type Polynomial"));
+                }
+                DeleteAllNode(ORDERPATH);
+                SetXmlNodeString(PERIODPATH, value.ToString(CultureInfo.InvariantCulture));
+            }
+        }
+        const string FORWARDPATH = "c:forward/@val";
+        /// <summary>
+        /// Forcast forward periods
+        /// </summary>
+        public decimal Forward
+        {
+            get
+            {
+                return GetXmlNodeDecimal(FORWARDPATH);
+            }
+            set
+            {
+                SetXmlNodeString(FORWARDPATH, value.ToString(CultureInfo.InvariantCulture));
+            }
+        }
+        const string BACKWARDPATH = "c:backward/@val";
+        /// <summary>
+        /// Forcast backwards periods
+        /// </summary>
+        public decimal Backward
+        {
+            get
+            {
+                return GetXmlNodeDecimal(BACKWARDPATH);
+            }
+            set
+            {
+                SetXmlNodeString(BACKWARDPATH, value.ToString(CultureInfo.InvariantCulture));
+            }
+        }
+        const string INTERCEPTPATH = "c:intercept/@val";
+        /// <summary>
+        /// Specify the point where the trendline crosses the vertical axis
+        /// </summary>
+        public decimal Intercept
+        {
+            get
+            {
+                return GetXmlNodeDecimal(INTERCEPTPATH);
+            }
+            set
+            {
+                SetXmlNodeString(INTERCEPTPATH, value.ToString(CultureInfo.InvariantCulture));
+            }
+        }
+        const string DISPLAYRSQUAREDVALUEPATH = "c:dispRSqr/@val";
+        /// <summary>
+        /// Display the R-squared value for a trendline
+        /// </summary>
+        public bool DisplayRSquaredValue
+        {
+            get
+            {
+                return GetXmlNodeBool(DISPLAYRSQUAREDVALUEPATH, true);
+            }
+            set
+            {
+                SetXmlNodeBool(DISPLAYRSQUAREDVALUEPATH, value, true);
+            }
+        }
+        const string DISPLAYEQUATIONPATH = "c:dispEq/@val";
+        /// <summary>
+        /// Display the trendline equation on the chart
+        /// </summary>
+        public bool DisplayEquation
+        {
+            get
+            {
+                return GetXmlNodeBool(DISPLAYEQUATIONPATH, true);
+            }
+            set
+            {
+                SetXmlNodeBool(DISPLAYEQUATIONPATH, value, true);
+            }
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelDoughnutChart.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelDoughnutChart.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelDoughnutChart.cs	(revision 12707)
@@ -0,0 +1,127 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		Initial Release		        2009-10-01
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Xml;
+using System.Globalization;
+using OfficeOpenXml.Table.PivotTable;
+
+namespace OfficeOpenXml.Drawing.Chart
+{
+    /// <summary>
+    /// Provides access to doughnut chart specific properties
+    /// </summary>
+    public class ExcelDoughnutChart : ExcelPieChart
+    {
+        //internal ExcelDoughnutChart(ExcelDrawings drawings, XmlNode node) :
+        //    base(drawings, node)
+        //{
+        //    SetPaths();
+        //}
+        internal ExcelDoughnutChart(ExcelDrawings drawings, XmlNode node, eChartType type, bool isPivot) :
+            base(drawings, node, type, isPivot)
+        {
+            //SetPaths();
+        }
+        internal ExcelDoughnutChart(ExcelDrawings drawings, XmlNode node, eChartType type, ExcelChart topChart, ExcelPivotTable PivotTableSource) :
+            base(drawings, node, type, topChart, PivotTableSource)
+        {
+            //SetPaths();
+        }
+        internal ExcelDoughnutChart(ExcelDrawings drawings, XmlNode node, Uri uriChart, Packaging.ZipPackagePart part, XmlDocument chartXml, XmlNode chartNode) :
+           base(drawings, node, uriChart, part, chartXml, chartNode)
+        {
+            //SetPaths();
+        }
+
+        internal ExcelDoughnutChart(ExcelChart topChart, XmlNode chartNode) :
+            base(topChart, chartNode)
+        {
+            //SetPaths();
+        }
+
+        //private void SetPaths()
+        //{
+        //    string chartNodeText = GetChartNodeText();
+        //    _firstSliceAngPath = string.Format(_firstSliceAngPath, chartNodeText);
+        //    _holeSizePath = string.Format(_holeSizePath, chartNodeText);
+        //}
+        //string _firstSliceAngPath = "c:chartSpace/c:chart/c:plotArea/{0}/c:firstSliceAng/@val";
+        string _firstSliceAngPath = "c:firstSliceAng/@val";
+        /// <summary>
+        /// Angle of the first slize
+        /// </summary>
+        public decimal FirstSliceAngle
+        {
+            get
+            {
+                return _chartXmlHelper.GetXmlNodeDecimal(_firstSliceAngPath);
+            }
+            internal set
+            {
+                _chartXmlHelper.SetXmlNodeString(_firstSliceAngPath, value.ToString(CultureInfo.InvariantCulture));
+            }
+        }
+        //string _holeSizePath = "c:chartSpace/c:chart/c:plotArea/{0}/c:holeSize/@val";
+        string _holeSizePath = "c:holeSize/@val";
+        /// <summary>
+        /// Size of the doubnut hole
+        /// </summary>
+        public decimal HoleSize
+        {
+            get
+            {
+                return _chartXmlHelper.GetXmlNodeDecimal(_holeSizePath);
+            }
+            internal set
+            {
+                _chartXmlHelper.SetXmlNodeString(_holeSizePath, value.ToString(CultureInfo.InvariantCulture));
+            }
+        }
+        internal override eChartType GetChartType(string name)
+        {
+            if (name == "doughnutChart")
+            {
+                if (((ExcelPieChartSerie)Series[0]).Explosion > 0)
+                {
+                    return eChartType.DoughnutExploded;
+                }
+                else
+                {
+                    return eChartType.Doughnut;
+                }
+            }
+            return base.GetChartType(name);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelLineChart.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelLineChart.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelLineChart.cs	(revision 12707)
@@ -0,0 +1,150 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		Initial Release		        2009-10-01
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Xml;
+using OfficeOpenXml.Table.PivotTable;
+
+namespace OfficeOpenXml.Drawing.Chart
+{
+    /// <summary>
+    /// Provides access to line chart specific properties
+    /// </summary>
+    public class ExcelLineChart : ExcelChart
+    {
+        #region "Constructors"
+        internal ExcelLineChart(ExcelDrawings drawings, XmlNode node, Uri uriChart, Packaging.ZipPackagePart part, XmlDocument chartXml, XmlNode chartNode) :
+            base(drawings, node, uriChart, part, chartXml, chartNode)
+        {
+        }
+
+        internal ExcelLineChart (ExcelChart topChart, XmlNode chartNode) :
+            base(topChart, chartNode)
+        {
+        }
+        internal ExcelLineChart(ExcelDrawings drawings, XmlNode node, eChartType type, ExcelChart topChart, ExcelPivotTable PivotTableSource) :
+            base(drawings, node, type, topChart, PivotTableSource)
+        {
+            Smooth = false;
+        }
+        #endregion
+        string MARKER_PATH="c:marker/@val";
+        /// <summary>
+        /// If the series has markers
+        /// </summary>
+        public bool Marker
+        {
+            get
+            {
+                return _chartXmlHelper.GetXmlNodeBool(MARKER_PATH, false);
+            }
+            set
+            {
+                _chartXmlHelper.SetXmlNodeBool(MARKER_PATH, value, false);
+            }
+        }
+
+        string SMOOTH_PATH = "c:smooth/@val";
+        /// <summary>
+        /// If the series has smooth lines
+        /// </summary>
+        public bool Smooth
+        {
+            get
+            {
+                return _chartXmlHelper.GetXmlNodeBool(SMOOTH_PATH, false);
+            }
+            set
+            {
+                _chartXmlHelper.SetXmlNodeBool(SMOOTH_PATH, value);
+            }
+        }
+        //string _chartTopPath = "c:chartSpace/c:chart/c:plotArea/{0}";
+        ExcelChartDataLabel _DataLabel = null;
+        /// <summary>
+        /// Access to datalabel properties
+        /// </summary>
+        public ExcelChartDataLabel DataLabel
+        {
+            get
+            {
+                if (_DataLabel == null)
+                {
+                    _DataLabel = new ExcelChartDataLabel(NameSpaceManager, ChartNode);
+                }
+                return _DataLabel;
+            }
+        }
+        internal override eChartType GetChartType(string name)
+        {
+               if(name=="lineChart")
+               {
+                   if(Marker)
+                   {
+                       if(Grouping==eGrouping.Stacked)
+                       {
+                           return eChartType.LineMarkersStacked;
+                       }
+                       else if (Grouping == eGrouping.PercentStacked)
+                       {
+                           return eChartType.LineMarkersStacked100;
+                       }
+                       else
+                       {
+                           return eChartType.LineMarkers;
+                       }
+                   }
+                   else
+                   {
+                       if(Grouping==eGrouping.Stacked)
+                       {
+                           return eChartType.LineStacked;
+                       }
+                       else if (Grouping == eGrouping.PercentStacked)
+                       {
+                           return eChartType.LineStacked100;
+                       }
+                       else
+                       {
+                           return eChartType.Line;
+                       }
+                   }
+               }
+               else if (name=="line3DChart")
+               {
+                   return eChartType.Line3D;               
+               }
+               return base.GetChartType(name);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelLineChartSerie.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelLineChartSerie.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelLineChartSerie.cs	(revision 12707)
@@ -0,0 +1,110 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		Initial Release		        2009-10-01
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Text;
+using System.Xml;
+
+namespace OfficeOpenXml.Drawing.Chart
+{
+    /// <summary>
+    /// A serie for a line chart
+    /// </summary>
+    public sealed class ExcelLineChartSerie : ExcelChartSerie
+    {
+        /// <summary>
+        /// Default constructor
+        /// </summary>
+        /// <param name="chartSeries">Parent collection</param>
+        /// <param name="ns">Namespacemanager</param>
+        /// <param name="node">Topnode</param>
+        /// <param name="isPivot">Is pivotchart</param>
+        internal ExcelLineChartSerie(ExcelChartSeries chartSeries, XmlNamespaceManager ns, XmlNode node, bool isPivot) :
+            base(chartSeries, ns, node, isPivot)
+        {
+        }
+        ExcelChartSerieDataLabel _DataLabel = null;
+        /// <summary>
+        /// Datalabels
+        /// </summary>
+        public ExcelChartSerieDataLabel DataLabel
+        {
+            get
+            {
+                if (_DataLabel == null)
+                {
+                    _DataLabel = new ExcelChartSerieDataLabel(_ns, _node);
+                }
+                return _DataLabel;
+            }
+        }
+        const string markerPath = "c:marker/c:symbol/@val";
+        /// <summary>
+        /// Marker symbol 
+        /// </summary>
+        public eMarkerStyle Marker
+        {
+            get
+            {
+                string marker = GetXmlNodeString(markerPath);
+                if (marker == "")
+                {
+                    return eMarkerStyle.None;
+                }
+                else
+                {
+                    return (eMarkerStyle)Enum.Parse(typeof(eMarkerStyle), marker, true);
+                }
+            }
+            set
+            {
+                SetXmlNodeString(markerPath, value.ToString().ToLower(CultureInfo.InvariantCulture));
+            }
+        }
+        const string smoothPath = "c:smooth/@val";
+        /// <summary>
+        /// Smoth lines
+        /// </summary>
+        public bool Smooth
+        {
+            get
+            {
+                return GetXmlNodeBool(smoothPath, false);
+            }
+            set
+            {
+                SetXmlNodeBool(smoothPath, value);
+            }
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelOfPieChart.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelOfPieChart.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelOfPieChart.cs	(revision 12707)
@@ -0,0 +1,116 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		Initial Release		        2009-10-01
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Xml;
+using OfficeOpenXml.Table.PivotTable;
+
+namespace OfficeOpenXml.Drawing.Chart
+{
+    /// <summary>
+    /// Provides access to ofpie-chart specific properties
+    /// </summary>
+    public class ExcelOfPieChart : ExcelPieChart
+    {
+        //internal ExcelOfPieChart(ExcelDrawings drawings, XmlNode node) :
+        //    base(drawings, node)
+        //{
+
+        //}
+        internal ExcelOfPieChart(ExcelDrawings drawings, XmlNode node, eChartType type, bool isPivot) :
+            base(drawings, node, type, isPivot)
+        {
+                SetTypeProperties();
+        }
+        internal ExcelOfPieChart(ExcelDrawings drawings, XmlNode node, eChartType type, ExcelChart topChart, ExcelPivotTable PivotTableSource) :
+            base(drawings, node, type, topChart, PivotTableSource)
+        {
+            SetTypeProperties();
+        }
+
+        internal ExcelOfPieChart(ExcelDrawings drawings, XmlNode node, Uri uriChart, Packaging.ZipPackagePart part, XmlDocument chartXml, XmlNode chartNode) :
+           base(drawings, node, uriChart, part, chartXml, chartNode)
+        {
+            SetTypeProperties();
+        }
+
+        private void SetTypeProperties()
+        {
+            if (ChartType == eChartType.BarOfPie)
+            {
+                OfPieType = ePieType.Bar;
+            }
+            else
+            {
+                OfPieType = ePieType.Pie;
+            }
+        }
+
+        const string pieTypePath = "c:chartSpace/c:chart/c:plotArea/c:ofPieChart/c:ofPieType/@val";
+        /// <summary>
+        /// Type, pie or bar
+        /// </summary>
+        public ePieType OfPieType
+        {
+            get
+            {
+                if (_chartXmlHelper.GetXmlNodeString(pieTypePath) == "bar")
+                    return ePieType.Bar;
+                else
+                {
+                    return ePieType.Pie;
+                }
+            }
+            internal set
+            {
+                _chartXmlHelper.CreateNode(pieTypePath,true);
+                _chartXmlHelper.SetXmlNodeString(pieTypePath, value == ePieType.Bar ? "bar" : "pie");
+            }
+        }
+        internal override eChartType GetChartType(string name)
+        {
+            if (name == "ofPieChart")
+            {
+                if (OfPieType==ePieType.Bar)
+                {
+                    return eChartType.BarOfPie;
+                }
+                else
+                {
+                    return eChartType.PieOfPie;
+                }
+            }
+            return base.GetChartType(name);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelPieChart.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelPieChart.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelPieChart.cs	(revision 12707)
@@ -0,0 +1,106 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		Initial Release		        2009-10-01
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Xml;
+using OfficeOpenXml.Table.PivotTable;
+
+namespace OfficeOpenXml.Drawing.Chart
+{
+    /// <summary>
+    /// Provides access to pie chart specific properties
+    /// </summary>
+    public class ExcelPieChart : ExcelChart
+    {
+        internal ExcelPieChart(ExcelDrawings drawings, XmlNode node, eChartType type, bool isPivot) :
+            base(drawings, node, type, isPivot)
+        {
+        }
+        internal ExcelPieChart(ExcelDrawings drawings, XmlNode node, eChartType type, ExcelChart topChart, ExcelPivotTable PivotTableSource) :
+            base(drawings, node, type, topChart, PivotTableSource)
+        {
+        }
+
+        internal ExcelPieChart(ExcelDrawings drawings, XmlNode node, Uri uriChart, Packaging.ZipPackagePart part, XmlDocument chartXml, XmlNode chartNode) :
+           base(drawings, node, uriChart, part, chartXml, chartNode)
+        {
+        }
+
+        internal ExcelPieChart(ExcelChart topChart, XmlNode chartNode) :
+            base(topChart, chartNode)
+        {
+        }
+        ExcelChartDataLabel _DataLabel = null;
+        /// <summary>
+        /// Access to datalabel properties
+        /// </summary>
+        public ExcelChartDataLabel DataLabel
+        {
+            get
+            {
+                if (_DataLabel == null)
+                {
+                    _DataLabel = new ExcelChartDataLabel(NameSpaceManager, ChartNode);
+                }
+                return _DataLabel;
+            }
+        }
+
+        internal override eChartType GetChartType(string name)
+        {
+            if (name == "pieChart")
+            {
+                if (Series.Count > 0 && ((ExcelPieChartSerie)Series[0]).Explosion>0)
+                {
+                    return eChartType.PieExploded;
+                }
+                else
+                {
+                    return eChartType.Pie;
+                }
+            }
+            else if (name == "pie3DChart")
+            {
+                if (Series.Count > 0 && ((ExcelPieChartSerie)Series[0]).Explosion > 0)
+                {
+                    return eChartType.PieExploded3D;
+                }
+                else
+                {
+                    return eChartType.Pie3D;
+                }
+            }
+            return base.GetChartType(name);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelPieChartSerie.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelPieChartSerie.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelPieChartSerie.cs	(revision 12707)
@@ -0,0 +1,92 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		Initial Release		        2009-10-01
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Xml;
+
+namespace OfficeOpenXml.Drawing.Chart
+{
+    /// <summary>
+    /// A serie for a pie chart
+    /// </summary>
+    public sealed class ExcelPieChartSerie : ExcelChartSerie
+    {
+        /// <summary>
+        /// Default constructor
+        /// </summary>
+        /// <param name="chartSeries">Parent collection</param>
+        /// <param name="ns">Namespacemanager</param>
+        /// <param name="node">Topnode</param>
+        /// <param name="isPivot">Is pivotchart</param>
+        internal ExcelPieChartSerie(ExcelChartSeries chartSeries, XmlNamespaceManager ns, XmlNode node, bool isPivot) :
+            base(chartSeries, ns, node, isPivot)
+        {
+
+        }
+        const string explosionPath = "c:explosion/@val";
+        /// <summary>
+        /// Explosion for Piecharts
+        /// </summary>
+        public int Explosion
+        {
+            get
+            {
+                return GetXmlNodeInt(explosionPath);
+            }
+            set
+            {
+                if (value < 0 || value > 400)
+                {
+                    throw(new ArgumentOutOfRangeException("Explosion range is 0-400"));
+                }
+                SetXmlNodeString(explosionPath, value.ToString());
+            }
+        }
+        ExcelChartSerieDataLabel _DataLabel = null;
+        /// <summary>
+        /// DataLabels
+        /// </summary>
+        public ExcelChartSerieDataLabel DataLabel
+        {
+            get
+            {
+                if (_DataLabel == null)
+                {
+                    _DataLabel = new ExcelChartSerieDataLabel(_ns, _node);
+                }
+                return _DataLabel;
+            }
+        }
+       
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelRadarChart.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelRadarChart.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelRadarChart.cs	(revision 12707)
@@ -0,0 +1,151 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		Initial Release		        2009-10-01
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Text;
+using System.Xml;
+using OfficeOpenXml.Table.PivotTable;
+
+namespace OfficeOpenXml.Drawing.Chart
+{
+    /// <summary>
+    /// Provides access to line chart specific properties
+    /// </summary>
+    public class ExcelRadarChart : ExcelChart
+    {
+        #region "Constructors"
+        internal ExcelRadarChart(ExcelDrawings drawings, XmlNode node, Uri uriChart, Packaging.ZipPackagePart part, XmlDocument chartXml, XmlNode chartNode) :
+            base(drawings, node, uriChart, part, chartXml, chartNode)
+        {
+            SetTypeProperties();
+        }
+
+        internal ExcelRadarChart(ExcelChart topChart, XmlNode chartNode) :
+            base(topChart, chartNode)
+        {
+            SetTypeProperties();
+        }
+        internal ExcelRadarChart(ExcelDrawings drawings, XmlNode node, eChartType type, ExcelChart topChart, ExcelPivotTable PivotTableSource) :
+            base(drawings, node, type, topChart, PivotTableSource)
+        {
+            SetTypeProperties();
+        }
+        #endregion
+        private void SetTypeProperties()
+        {
+            if (ChartType == eChartType.RadarFilled)
+            {
+                RadarStyle = eRadarStyle.Filled;
+            }
+            else if  (ChartType == eChartType.RadarMarkers)
+            {
+                RadarStyle =  eRadarStyle.Marker;
+            }
+            else
+            {
+                RadarStyle = eRadarStyle.Standard;
+            }
+        }
+
+        string STYLE_PATH = "c:radarStyle/@val";
+        /// <summary>
+        /// The type of radarchart
+        /// </summary>
+        public eRadarStyle RadarStyle
+        {
+            get
+            {
+                var v=_chartXmlHelper.GetXmlNodeString(STYLE_PATH);
+                if (string.IsNullOrEmpty(v))
+                {
+                    return eRadarStyle.Standard;
+                }
+                else
+                {
+                    return (eRadarStyle)Enum.Parse(typeof(eRadarStyle), v, true);
+                }
+            }
+            set
+            {
+                _chartXmlHelper.SetXmlNodeString(STYLE_PATH, value.ToString().ToLower(CultureInfo.InvariantCulture));
+            }
+        }
+
+        //string SMOOTH_PATH = "c:smooth/@val";
+        ///// <summary>
+        ///// If the series has smooth lines
+        ///// </summary>
+        //public bool Smooth
+        //{
+        //    get
+        //    {
+        //        return _chartXmlHelper.GetXmlNodeBool(SMOOTH_PATH, false);
+        //    }
+        //    set
+        //    {
+        //        _chartXmlHelper.SetXmlNodeBool(SMOOTH_PATH, value);
+        //    }
+        //}
+        //string _chartTopPath = "c:chartSpace/c:chart/c:plotArea/{0}";
+        ExcelChartDataLabel _DataLabel = null;
+        /// <summary>
+        /// Access to datalabel properties
+        /// </summary>
+        public ExcelChartDataLabel DataLabel
+        {
+            get
+            {
+                if (_DataLabel == null)
+                {
+                    _DataLabel = new ExcelChartDataLabel(NameSpaceManager, ChartNode);
+                }
+                return _DataLabel;
+            }
+        }
+        internal override eChartType GetChartType(string name)
+        {
+            if (RadarStyle == eRadarStyle.Filled)
+            {
+                return eChartType.RadarFilled;
+            }
+            else if (RadarStyle == eRadarStyle.Marker)
+            {
+                return eChartType.RadarMarkers;
+            }
+            else
+            {
+                return eChartType.Radar;
+            }
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelRadarChartSerie.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelRadarChartSerie.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelRadarChartSerie.cs	(revision 12707)
@@ -0,0 +1,116 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		Initial Release		        2009-10-01
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Text;
+using System.Xml;
+
+namespace OfficeOpenXml.Drawing.Chart
+{
+    /// <summary>
+    /// A serie for a scatter chart
+    /// </summary>
+    public sealed class ExcelRadarChartSerie : ExcelChartSerie
+    {
+        /// <summary>
+        /// Default constructor
+        /// </summary>
+        /// <param name="chartSeries">Parent collection</param>
+        /// <param name="ns">Namespacemanager</param>
+        /// <param name="node">Topnode</param>
+        /// <param name="isPivot">Is pivotchart</param>
+        internal ExcelRadarChartSerie(ExcelChartSeries chartSeries, XmlNamespaceManager ns, XmlNode node, bool isPivot) :
+            base(chartSeries, ns, node, isPivot)
+        {
+            if (chartSeries.Chart.ChartType == eChartType.Radar)
+            {
+                Marker = eMarkerStyle.None;
+            }
+        }
+        ExcelChartSerieDataLabel _DataLabel = null;
+        /// <summary>
+        /// Datalabel
+        /// </summary>
+        public ExcelChartSerieDataLabel DataLabel
+        {
+            get
+            {
+                if (_DataLabel == null)
+                {
+                    _DataLabel = new ExcelChartSerieDataLabel(_ns, _node);
+                }
+                return _DataLabel;
+            }
+        }
+        const string markerPath = "c:marker/c:symbol/@val";
+        /// <summary>
+        /// Marker symbol 
+        /// </summary>
+        public eMarkerStyle Marker
+        {
+            get
+            {
+                string marker = GetXmlNodeString(markerPath);
+                if (marker == "" || marker=="none")
+                {
+                    return eMarkerStyle.None;
+                }
+                else
+                {
+                    return (eMarkerStyle)Enum.Parse(typeof(eMarkerStyle), marker, true);
+                }                
+            }
+            internal set
+            {
+                SetXmlNodeString(markerPath, value.ToString().ToLower(CultureInfo.InvariantCulture));
+            }
+        }
+        const string MARKERSIZE_PATH = "c:marker/c:size/@val";
+        public int MarkerSize
+        {
+            get
+            {
+                return GetXmlNodeInt(MARKERSIZE_PATH);
+            }
+            set
+            {
+                if (value < 2 && value > 72)
+                {
+                    throw (new ArgumentOutOfRangeException("MarkerSize out of range. Range from 2-72 allowed."));
+                }
+                SetXmlNodeString(MARKERSIZE_PATH, value.ToString(CultureInfo.InvariantCulture));
+            }
+        }
+
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelScatterChart.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelScatterChart.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelScatterChart.cs	(revision 12707)
@@ -0,0 +1,170 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		Initial Release		        2009-10-01
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Xml;
+using OfficeOpenXml.Table.PivotTable;
+
+namespace OfficeOpenXml.Drawing.Chart
+{
+    /// <summary>
+    /// Provides access to scatter chart specific properties
+    /// </summary>
+    public sealed class ExcelScatterChart : ExcelChart
+    {
+        internal ExcelScatterChart(ExcelDrawings drawings, XmlNode node, eChartType type, ExcelChart topChart, ExcelPivotTable PivotTableSource) :
+            base(drawings, node, type, topChart, PivotTableSource)
+        {
+            SetTypeProperties();
+        }
+
+        internal ExcelScatterChart(ExcelDrawings drawings, XmlNode node, Uri uriChart, Packaging.ZipPackagePart part, XmlDocument chartXml, XmlNode chartNode) :
+            base(drawings, node, uriChart, part, chartXml, chartNode)
+        {
+            SetTypeProperties();
+        }
+
+        internal ExcelScatterChart(ExcelChart topChart, XmlNode chartNode) :
+            base(topChart, chartNode)
+        {
+            SetTypeProperties();
+        }
+        private void SetTypeProperties()
+        {
+           /***** ScatterStyle *****/
+           if(ChartType == eChartType.XYScatter ||
+              ChartType == eChartType.XYScatterLines ||
+              ChartType == eChartType.XYScatterLinesNoMarkers)
+           {
+               ScatterStyle = eScatterStyle.LineMarker;
+          }
+           else if (
+              ChartType == eChartType.XYScatterSmooth ||
+              ChartType == eChartType.XYScatterSmoothNoMarkers) 
+           {
+               ScatterStyle = eScatterStyle.SmoothMarker;
+           }
+        }
+        #region "Grouping Enum Translation"
+        string _scatterTypePath = "c:scatterStyle/@val";
+        private eScatterStyle GetScatterEnum(string text)
+        {
+            switch (text)
+            {
+                case "smoothMarker":
+                    return eScatterStyle.SmoothMarker;
+                default:
+                    return eScatterStyle.LineMarker;
+            }
+        }
+
+        private string GetScatterText(eScatterStyle shatterStyle)
+        {
+            switch (shatterStyle)
+            {
+                case eScatterStyle.SmoothMarker:
+                    return "smoothMarker";
+                default:
+                    return "lineMarker";
+            }
+        }
+        #endregion
+        /// <summary>
+        /// If the scatter has LineMarkers or SmoothMarkers
+        /// </summary>
+        public eScatterStyle ScatterStyle
+        {
+            get
+            {
+                return GetScatterEnum(_chartXmlHelper.GetXmlNodeString(_scatterTypePath));
+            }
+            internal set
+            {
+                _chartXmlHelper.CreateNode(_scatterTypePath, true);
+                _chartXmlHelper.SetXmlNodeString(_scatterTypePath, GetScatterText(value));
+            }
+        }
+        string MARKER_PATH = "c:marker/@val";
+        /// <summary>
+        /// If the series has markers
+        /// </summary>
+        public bool Marker
+        {
+            get
+            {
+                return GetXmlNodeBool(MARKER_PATH, false);
+            }
+            set
+            {
+                SetXmlNodeBool(MARKER_PATH, value, false);
+            }
+        }
+        internal override eChartType GetChartType(string name)
+        {
+            if (name == "scatterChart")
+            {
+                if (ScatterStyle==eScatterStyle.LineMarker)
+                {
+                    if (((ExcelScatterChartSerie)Series[0]).Marker == eMarkerStyle.None)
+                    {
+                        return eChartType.XYScatterLinesNoMarkers;
+                    }
+                    else
+                    {
+                        if(ExistNode("c:ser/c:spPr/a:ln/noFill"))
+                        {
+                            return eChartType.XYScatter;
+                        }
+                        else
+                        {
+                            return eChartType.XYScatterLines;
+                        }
+                    }
+                }
+                else if (ScatterStyle == eScatterStyle.SmoothMarker)
+                {
+                    if (((ExcelScatterChartSerie)Series[0]).Marker == eMarkerStyle.None)
+                    {
+                        return eChartType.XYScatterSmoothNoMarkers;
+                    }
+                    else
+                    {
+                        return eChartType.XYScatterSmooth;
+                    }
+                }
+            }
+            return base.GetChartType(name);
+        }
+
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelScatterChartSerie.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelScatterChartSerie.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelScatterChartSerie.cs	(revision 12707)
@@ -0,0 +1,126 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		Initial Release		        2009-10-01
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Text;
+using System.Xml;
+
+namespace OfficeOpenXml.Drawing.Chart
+{
+    /// <summary>
+    /// A serie for a scatter chart
+    /// </summary>
+    public sealed class ExcelScatterChartSerie : ExcelChartSerie
+    {
+        /// <summary>
+        /// Default constructor
+        /// </summary>
+        /// <param name="chartSeries">Parent collection</param>
+        /// <param name="ns">Namespacemanager</param>
+        /// <param name="node">Topnode</param>
+        /// <param name="isPivot">Is pivotchart</param>
+        internal ExcelScatterChartSerie(ExcelChartSeries chartSeries, XmlNamespaceManager ns, XmlNode node, bool isPivot) :
+            base(chartSeries, ns, node, isPivot)
+        {
+            if (chartSeries.Chart.ChartType == eChartType.XYScatterLines ||
+                chartSeries.Chart.ChartType == eChartType.XYScatterSmooth)
+            {
+                Marker = eMarkerStyle.Square;
+            }
+
+            if (chartSeries.Chart.ChartType == eChartType.XYScatterSmooth ||
+                chartSeries.Chart.ChartType == eChartType.XYScatterSmoothNoMarkers)
+            {
+                Smooth = 1;
+            }
+            else if (chartSeries.Chart.ChartType == eChartType.XYScatterLines || chartSeries.Chart.ChartType == eChartType.XYScatterLinesNoMarkers || chartSeries.Chart.ChartType == eChartType.XYScatter)
+
+            {
+                Smooth = 0;
+            }
+        }
+        ExcelChartSerieDataLabel _DataLabel = null;
+        /// <summary>
+        /// Datalabel
+        /// </summary>
+        public ExcelChartSerieDataLabel DataLabel
+        {
+            get
+            {
+                if (_DataLabel == null)
+                {
+                    _DataLabel = new ExcelChartSerieDataLabel(_ns, _node);
+                }
+                return _DataLabel;
+            }
+        }
+        const string smoothPath = "c:smooth/@val";
+        /// <summary>
+        /// Smooth for scattercharts
+        /// </summary>
+        public int Smooth
+        {
+            get
+            {
+                return GetXmlNodeInt(smoothPath);
+            }
+            internal set
+            {
+                SetXmlNodeString(smoothPath, value.ToString());
+            }
+        }
+        const string markerPath = "c:marker/c:symbol/@val";
+        /// <summary>
+        /// Marker symbol 
+        /// </summary>
+        public eMarkerStyle Marker
+        {
+            get
+            {
+                string marker = GetXmlNodeString(markerPath);
+                if (marker == "")
+                {
+                    return eMarkerStyle.None;
+                }
+                else
+                {
+                    return (eMarkerStyle)Enum.Parse(typeof(eMarkerStyle), marker, true);
+                }
+            }
+            internal set
+            {
+                SetXmlNodeString(markerPath, value.ToString().ToLower(CultureInfo.InvariantCulture));
+            }
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelSurfaceChart.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelSurfaceChart.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelSurfaceChart.cs	(revision 12707)
@@ -0,0 +1,159 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Jan Källman		Added		2009-10-01
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Xml;
+using OfficeOpenXml.Table.PivotTable;
+
+namespace OfficeOpenXml.Drawing.Chart
+{
+    /// <summary>
+    /// A Surface chart
+    /// </summary>
+    public sealed class ExcelSurfaceChart : ExcelChart
+    {
+        #region "Constructors"
+        internal ExcelSurfaceChart(ExcelDrawings drawings, XmlNode node, eChartType type, ExcelChart topChart, ExcelPivotTable PivotTableSource) :
+            base(drawings, node, type, topChart, PivotTableSource)
+        {
+            Init();
+        }
+        internal ExcelSurfaceChart(ExcelDrawings drawings, XmlNode node, Uri uriChart, Packaging.ZipPackagePart part, XmlDocument chartXml, XmlNode chartNode) :
+           base(drawings, node, uriChart, part, chartXml, chartNode)
+        {
+            Init();
+        }
+
+        internal ExcelSurfaceChart(ExcelChart topChart, XmlNode chartNode) : 
+            base(topChart, chartNode)
+        {
+            Init();
+        }
+        private void Init()
+        {
+ 	        _floor=new ExcelChartSurface(NameSpaceManager, _chartXmlHelper.TopNode.SelectSingleNode("c:floor", NameSpaceManager));
+            _backWall = new ExcelChartSurface(NameSpaceManager, _chartXmlHelper.TopNode.SelectSingleNode("c:sideWall", NameSpaceManager));
+            _sideWall = new ExcelChartSurface(NameSpaceManager, _chartXmlHelper.TopNode.SelectSingleNode("c:backWall", NameSpaceManager));
+            SetTypeProperties();
+        }
+        #endregion
+
+
+        ExcelChartSurface _floor;
+        public ExcelChartSurface Floor
+        {
+            get
+            {
+                return _floor;
+            }
+        }
+        ExcelChartSurface _sideWall;
+        public ExcelChartSurface SideWall
+        {
+            get
+            {
+                return _sideWall;
+            }
+        }
+        ExcelChartSurface _backWall;
+        public ExcelChartSurface BackWall
+        {
+            get
+            {
+                return _backWall;
+            }
+        }
+        const string WIREFRAME_PATH = "c:wireframe/@val";
+        public bool Wireframe
+        {
+            get
+            {
+                return _chartXmlHelper.GetXmlNodeBool(WIREFRAME_PATH);
+            }
+            set
+            {
+                _chartXmlHelper.SetXmlNodeBool(WIREFRAME_PATH, value);
+            }
+        }        
+        internal void SetTypeProperties()
+        {
+               if(ChartType==eChartType.SurfaceWireframe || ChartType==eChartType.SurfaceTopViewWireframe)
+               {
+                   Wireframe=true;
+               }
+               else 
+               {
+                   Wireframe=false;
+               }
+
+                if(ChartType==eChartType.SurfaceTopView || ChartType==eChartType.SurfaceTopViewWireframe)
+                {
+                   View3D.RotY = 0;
+                   View3D.RotX = 90;
+                }
+                else
+                {
+                   View3D.RotY = 20;
+                   View3D.RotX = 15;
+                }
+                View3D.RightAngleAxes = false;
+                View3D.Perspective = 0;
+                Axis[1].CrossBetween = eCrossBetween.MidCat;
+        }
+        internal override eChartType GetChartType(string name)
+        {
+            if(Wireframe)
+            {
+                if (name == "surfaceChart")
+                {
+                    return eChartType.SurfaceTopViewWireframe;
+                }
+                else
+                {
+                    return eChartType.SurfaceWireframe;
+                }
+            }
+            else
+            {
+                if (name == "surfaceChart")
+                {
+                    return eChartType.SurfaceTopView;
+                }
+                else
+                {
+                    return eChartType.Surface;
+                }
+            }
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelSurfaceChartSerie.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelSurfaceChartSerie.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Chart/ExcelSurfaceChartSerie.cs	(revision 12707)
@@ -0,0 +1,57 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		Initial Release		        2009-10-01
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Text;
+using System.Xml;
+
+namespace OfficeOpenXml.Drawing.Chart
+{
+    /// <summary>
+    /// A serie for a surface chart
+    /// </summary>
+    public sealed class ExcelSurfaceChartSerie : ExcelChartSerie
+    {
+        /// <summary>
+        /// Default constructor
+        /// </summary>
+        /// <param name="chartSeries">Parent collection</param>
+        /// <param name="ns">Namespacemanager</param>
+        /// <param name="node">Topnode</param>
+        /// <param name="isPivot">Is pivotchart</param>
+        internal ExcelSurfaceChartSerie(ExcelChartSeries chartSeries, XmlNamespaceManager ns, XmlNode node, bool isPivot) :
+            base(chartSeries, ns, node, isPivot)
+        {
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/ExcelDrawingBase.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/ExcelDrawingBase.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/ExcelDrawingBase.cs	(revision 12707)
@@ -0,0 +1,662 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		Initial Release		        2010-06-01
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Text;
+using System.Xml;
+using OfficeOpenXml.Drawing.Chart;
+namespace OfficeOpenXml.Drawing
+{
+    /// <summary>
+    /// Text anchoring
+    /// </summary>
+    public enum eTextAnchoringType
+    {
+        Bottom,
+        Center,
+        Distributed,
+        Justify,
+        Top
+    }
+    /// <summary>
+    /// Vertical text type
+    /// </summary>
+    public enum eTextVerticalType
+    {
+        EastAsianVertical,
+        Horizontal,
+        MongolianVertical,
+        Vertical,
+        Vertical270,
+        WordArtVertical,
+        WordArtVerticalRightToLeft
+
+    }
+    /// <summary>
+    /// How the drawing will be resized.
+    /// </summary>
+    public enum eEditAs
+    {
+        /// <summary>
+        /// Specifies that the current start and end positions shall
+        /// be maintained with respect to the distances from the
+        /// absolute start point of the worksheet.
+        /// </summary>
+        Absolute,
+        /// <summary>
+        /// Specifies that the current drawing shall move with its
+        ///row and column (i.e. the object is anchored to the
+        /// actual from row and column), but that the size shall
+        ///remain absolute.
+        /// </summary>
+        OneCell,
+        /// <summary>
+        /// Specifies that the current drawing shall move and
+        /// resize to maintain its row and column anchors (i.e. the
+        /// object is anchored to the actual from and to row and column).
+        /// </summary>
+        TwoCell
+    }
+    /// <summary>
+    /// Base class for twoanchored drawings. 
+    /// Drawings are Charts, shapes and Pictures.
+    /// </summary>
+    public class ExcelDrawing : XmlHelper, IDisposable 
+    {
+        /// <summary>
+        /// Position of the a drawing.
+        /// </summary>
+        public class ExcelPosition : XmlHelper
+        {
+            XmlNode _node;
+            XmlNamespaceManager _ns;            
+            internal ExcelPosition(XmlNamespaceManager ns, XmlNode node) :
+                base (ns,node)
+            {
+                _node = node;
+                _ns = ns;
+            }
+            const string colPath="xdr:col";
+            public int Column
+            {
+                get
+                {
+                    return GetXmlNodeInt(colPath);
+                }
+                set
+                {
+                    SetXmlNodeString(colPath, value.ToString());
+                }
+            }
+            const string rowPath="xdr:row";
+            public int Row
+            {
+                get
+                {
+                    return GetXmlNodeInt(rowPath);
+                }
+                set
+                {
+                    SetXmlNodeString(rowPath, value.ToString());
+                }
+            }
+            const string colOffPath = "xdr:colOff";
+            /// <summary>
+            /// Column Offset
+            /// 
+            /// EMU units   1cm         =   1/360000 
+            ///             1US inch    =   1/914400
+            ///             1pixel      =   1/9525
+            /// </summary>
+            public int ColumnOff
+            {
+                get
+                {
+                    return GetXmlNodeInt(colOffPath);
+                }
+                set
+                {
+                    SetXmlNodeString(colOffPath, value.ToString());
+                }
+            }
+            const string rowOffPath = "xdr:rowOff";
+            /// <summary>
+            /// Row Offset
+            /// 
+            /// EMU units   1cm         =   1/360000 
+            ///             1US inch    =   1/914400
+            ///             1pixel      =   1/9525
+            /// </summary>
+            public int RowOff
+            {
+                get
+                {
+                    return GetXmlNodeInt(rowOffPath);
+                }
+                set
+                {
+                    SetXmlNodeString(rowOffPath, value.ToString());
+                }
+            }
+        }
+        protected ExcelDrawings _drawings;
+        protected XmlNode _topNode;
+        string _nameXPath;
+        protected internal int _id;
+        const float STANDARD_DPI = 96;
+        public const int EMU_PER_PIXEL = 9525;
+
+        internal ExcelDrawing(ExcelDrawings drawings, XmlNode node, string nameXPath) :
+            base(drawings.NameSpaceManager, node)
+        {
+            _drawings = drawings;
+            _topNode = node;
+            _id = drawings.Worksheet.Workbook._nextDrawingID++;
+            XmlNode posNode = node.SelectSingleNode("xdr:from", drawings.NameSpaceManager);
+            if (node != null)
+            {
+                From = new ExcelPosition(drawings.NameSpaceManager, posNode);
+            }
+            posNode = node.SelectSingleNode("xdr:to", drawings.NameSpaceManager);
+            if (node != null)
+            {
+                To = new ExcelPosition(drawings.NameSpaceManager, posNode);
+            }
+            else
+            {
+                To = null;
+            }
+            _nameXPath = nameXPath;
+            SchemaNodeOrder = new string[] { "from", "to", "graphicFrame", "sp", "clientData"  };
+        }
+        /// <summary>
+        /// The name of the drawing object
+        /// </summary>
+        public string Name 
+        {
+            get
+            {
+                try
+                {
+                    if (_nameXPath == "") return "";
+                    return GetXmlNodeString(_nameXPath);
+                }
+                catch
+                {
+                    return ""; 
+                }
+            }
+            set
+            {
+                try
+                {
+                    if (_nameXPath == "") throw new NotImplementedException();
+                    SetXmlNodeString(_nameXPath, value);
+                }
+                catch
+                {
+                    throw new NotImplementedException();
+                }
+            }
+        }
+        /// <summary>
+        /// How Excel resize drawings when the column width is changed within Excel.
+        /// The width of drawings are currently NOT resized in EPPLus when the column width changes
+        /// </summary>
+        public eEditAs EditAs
+        {
+            get
+            {
+                try
+                {
+                    string s = GetXmlNodeString("@editAs");
+                    if (s == "")
+                    {
+                        return eEditAs.TwoCell;
+                    }
+                    else
+                    {
+                        return (eEditAs)Enum.Parse(typeof(eEditAs), s,true);
+                    }
+                }
+                catch
+                {
+                    return eEditAs.TwoCell;
+                }
+            }
+            set
+            {
+                string s=value.ToString();
+                SetXmlNodeString("@editAs", s.Substring(0,1).ToLower(CultureInfo.InvariantCulture)+s.Substring(1,s.Length-1));
+            }
+        }
+        const string lockedPath="xdr:clientData/@fLocksWithSheet";
+        /// <summary>
+        /// Lock drawing
+        /// </summary>
+        public bool Locked
+        {
+            get
+            {
+                return GetXmlNodeBool(lockedPath, true);
+            }
+            set
+            {
+                SetXmlNodeBool(lockedPath, value);
+            }
+        }
+        const string printPath = "xdr:clientData/@fPrintsWithSheet";
+        /// <summary>
+        /// Print drawing with sheet
+        /// </summary>
+        public bool Print
+        {
+            get
+            {
+                return GetXmlNodeBool(printPath, true);
+            }
+            set
+            {
+                SetXmlNodeBool(printPath, value);
+            }
+        }        /// <summary>
+        /// Top Left position
+        /// </summary>
+        public ExcelPosition From { get; set; }
+        /// <summary>
+        /// Bottom right position
+        /// </summary>
+        public ExcelPosition To
+        {
+            get;
+            set;
+        }
+        /// <summary>
+        /// Add new Drawing types here
+        /// </summary>
+        /// <param name="drawings">The drawing collection</param>
+        /// <param name="node">Xml top node</param>
+        /// <returns>The Drawing object</returns>
+        internal static ExcelDrawing GetDrawing(ExcelDrawings drawings, XmlNode node)
+        {
+            if (node.SelectSingleNode("xdr:sp", drawings.NameSpaceManager) != null)
+            {
+                return new ExcelShape(drawings, node);
+            }
+            else if (node.SelectSingleNode("xdr:pic", drawings.NameSpaceManager) != null)
+            {
+                return new ExcelPicture(drawings, node);
+            }
+            else if (node.SelectSingleNode("xdr:graphicFrame", drawings.NameSpaceManager) != null)
+            {
+                return ExcelChart.GetChart(drawings, node);
+            }
+            else
+            {
+                return new ExcelDrawing(drawings, node, "");
+            }
+        }
+        internal string Id
+        {
+            get { return _id.ToString(); }
+        }
+        internal static string GetTextAchoringText(eTextAnchoringType value)
+        {
+            switch (value)
+            {
+                case eTextAnchoringType.Bottom:
+                    return "b";
+                case eTextAnchoringType.Center:
+                    return "ctr";
+                case eTextAnchoringType.Distributed:
+                    return "dist";
+                case eTextAnchoringType.Justify:
+                    return "just";
+                default:
+                    return "t";
+            }
+        }
+        internal static eTextAnchoringType GetTextAchoringEnum(string text)
+        {
+            switch (text)
+            {
+                case "b":
+                    return eTextAnchoringType.Bottom;
+                case "ctr":
+                    return eTextAnchoringType.Center;
+                case "dist":
+                    return eTextAnchoringType.Distributed;
+                case "just":
+                    return eTextAnchoringType.Justify;
+                default:
+                    return eTextAnchoringType.Top;
+            }
+        }
+        internal static string GetTextVerticalText(eTextVerticalType value)
+        {
+            switch (value)
+            {
+                case eTextVerticalType.EastAsianVertical:
+                    return "eaVert";
+                case eTextVerticalType.MongolianVertical:
+                    return "mongolianVert";
+                case eTextVerticalType.Vertical:
+                    return "vert";
+                case eTextVerticalType.Vertical270:
+                    return "vert270";
+                case eTextVerticalType.WordArtVertical:
+                    return "wordArtVert";
+                case eTextVerticalType.WordArtVerticalRightToLeft:
+                    return "wordArtVertRtl";
+                default:
+                    return "horz";
+            }
+        }
+        internal static eTextVerticalType GetTextVerticalEnum(string text)
+        {
+            switch (text)
+            {
+                case "eaVert":
+                    return eTextVerticalType.EastAsianVertical;
+                case "mongolianVert":
+                    return eTextVerticalType.MongolianVertical;
+                case "vert":
+                    return eTextVerticalType.Vertical;
+                case "vert270":
+                    return eTextVerticalType.Vertical270;
+                case "wordArtVert":
+                    return eTextVerticalType.WordArtVertical;
+                case "wordArtVertRtl":
+                    return eTextVerticalType.WordArtVerticalRightToLeft;
+                default:
+                    return eTextVerticalType.Horizontal;
+            }
+        }
+        #region "Internal sizing functions"
+        internal int GetPixelLeft()
+        {
+            ExcelWorksheet ws = _drawings.Worksheet;
+            decimal mdw = ws.Workbook.MaxFontWidth;
+
+            int pix = 0;
+            for (int col = 0; col < From.Column; col++)
+            {
+                pix += (int)decimal.Truncate(((256 * GetColumnWidth(col + 1) + decimal.Truncate(128 / (decimal)mdw)) / 256) * mdw);
+            }
+            pix += From.ColumnOff / EMU_PER_PIXEL;
+            return pix;
+        }
+        internal int GetPixelTop()
+        {
+            ExcelWorksheet ws = _drawings.Worksheet;
+            int pix = 0;
+            for (int row = 0; row < From.Row; row++)
+            {
+                pix += (int)(GetRowWidth(row + 1) / 0.75);
+            }
+            pix += From.RowOff / EMU_PER_PIXEL;
+            return pix;
+        }
+        internal int GetPixelWidth()
+        {
+            ExcelWorksheet ws = _drawings.Worksheet;
+            decimal mdw = ws.Workbook.MaxFontWidth;
+
+            int pix = -From.ColumnOff / EMU_PER_PIXEL;
+            for (int col = From.Column + 1; col <= To.Column; col++)
+            {
+                pix += (int)decimal.Truncate(((256 * GetColumnWidth(col) + decimal.Truncate(128 / (decimal)mdw)) / 256) * mdw);
+            }
+            pix += To.ColumnOff / EMU_PER_PIXEL;
+            return pix;
+        }
+        internal int GetPixelHeight()
+        {
+            ExcelWorksheet ws = _drawings.Worksheet;
+
+            int pix = -(From.RowOff / EMU_PER_PIXEL);
+            for (int row = From.Row + 1; row <= To.Row; row++)
+            {
+                pix += (int)(GetRowWidth(row) / 0.75);
+            }
+            pix += To.RowOff / EMU_PER_PIXEL;
+            return pix;
+        }
+
+        private decimal GetColumnWidth(int col)
+        {
+            ExcelWorksheet ws = _drawings.Worksheet;
+            var column = ws._values.GetValue(0, col) as ExcelColumn;
+            if (column == null)   //Check that the column exists
+            {
+                return (decimal)ws.DefaultColWidth;
+            }
+            else
+            {
+                return (decimal)ws.Column(col).VisualWidth;
+            }
+        }
+        private double GetRowWidth(int row)
+        {
+            ExcelWorksheet ws = _drawings.Worksheet;
+            object o = null;
+            if (ws._values.Exists(row, 0, ref o) && o != null)   //Check that the row exists
+            {
+                var internalRow = (RowInternal)o;
+                if (internalRow.Height >= 0)
+                {
+                    return internalRow.Height;
+                }
+            }
+            return (double)ws.DefaultRowHeight;
+        }
+        internal void SetPixelTop(int pixels)
+        {
+            ExcelWorksheet ws = _drawings.Worksheet;
+            decimal mdw = ws.Workbook.MaxFontWidth;
+            int prevPix = 0;
+            int pix = (int)(GetRowWidth(1) / 0.75);
+            int row = 2;
+
+            while (pix < pixels)
+            {
+                prevPix = pix;
+                pix += (int)(GetRowWidth(row++) / 0.75);
+            }
+
+            if (pix == pixels)
+            {
+                From.Row = row - 1;
+                From.RowOff = 0;
+            }
+            else
+            {
+                From.Row = row - 2;
+                From.RowOff = (pixels - prevPix) * EMU_PER_PIXEL;
+            }
+        }
+        internal void SetPixelLeft(int pixels)
+        {
+            ExcelWorksheet ws = _drawings.Worksheet;
+            decimal mdw = ws.Workbook.MaxFontWidth;
+            int prevPix = 0;
+            int pix = (int)decimal.Truncate(((256 * GetColumnWidth(1) + decimal.Truncate(128 / (decimal)mdw)) / 256) * mdw);
+            int col = 2;
+
+            while (pix < pixels)
+            {
+                prevPix = pix;
+                pix += (int)decimal.Truncate(((256 * GetColumnWidth(col++) + decimal.Truncate(128 / (decimal)mdw)) / 256) * mdw);
+            }
+            if (pix == pixels)
+            {
+                From.Column = col - 1;
+                From.ColumnOff = 0;
+            }
+            else
+            {
+                From.Column = col - 2;
+                From.ColumnOff = (pixels - prevPix) * EMU_PER_PIXEL;
+            }
+        }
+        internal void SetPixelHeight(int pixels)
+        {
+            SetPixelHeight(pixels, STANDARD_DPI);
+        }
+        internal void SetPixelHeight(int pixels, float dpi)
+        {
+            ExcelWorksheet ws = _drawings.Worksheet;
+            //decimal mdw = ws.Workbook.MaxFontWidth;
+            pixels = (int)(pixels / (dpi / STANDARD_DPI) + .5);
+            int pixOff = pixels - ((int)(ws.Row(From.Row + 1).Height / 0.75) - (int)(From.RowOff / EMU_PER_PIXEL));
+            int prevPixOff = pixels;
+            int row = From.Row + 1;
+
+            while (pixOff >= 0)
+            {
+                prevPixOff = pixOff;
+                pixOff -= (int)(GetRowWidth(++row) / 0.75);
+            }
+            To.Row = row - 1;
+            if (From.Row == To.Row)
+            {
+                To.RowOff = From.RowOff + (pixels) * EMU_PER_PIXEL;
+            }
+            else
+            {
+                To.RowOff = prevPixOff * EMU_PER_PIXEL;
+            }
+        }
+        internal void SetPixelWidth(int pixels)
+        {
+            SetPixelWidth(pixels, STANDARD_DPI);
+        }
+        internal void SetPixelWidth(int pixels, float dpi)
+        {
+            ExcelWorksheet ws = _drawings.Worksheet;
+            decimal mdw = ws.Workbook.MaxFontWidth;
+
+            pixels = (int)(pixels / (dpi / STANDARD_DPI) + .5);
+            int pixOff = (int)pixels - ((int)decimal.Truncate(((256 * GetColumnWidth(From.Column + 1) + decimal.Truncate(128 / (decimal)mdw)) / 256) * mdw) - From.ColumnOff / EMU_PER_PIXEL);
+            int prevPixOff = From.ColumnOff / EMU_PER_PIXEL + (int)pixels;
+            int col = From.Column + 2;
+
+            while (pixOff >= 0)
+            {
+                prevPixOff = pixOff;
+                pixOff -= (int)decimal.Truncate(((256 * GetColumnWidth(col++) + decimal.Truncate(128 / (decimal)mdw)) / 256) * mdw);
+            }
+
+            To.Column = col - 2;
+            To.ColumnOff = prevPixOff * EMU_PER_PIXEL;
+        }
+        #endregion
+        #region "Public sizing functions"
+        /// <summary>
+        /// Set the top left corner of a drawing. 
+        /// Note that resizing columns / rows after using this function will effect the position of the drawing
+        /// </summary>
+        /// <param name="PixelTop">Top pixel</param>
+        /// <param name="PixelLeft">Left pixel</param>
+        public void SetPosition(int PixelTop, int PixelLeft)
+        {
+            int width = GetPixelWidth();
+            int height = GetPixelHeight();
+
+            SetPixelTop(PixelTop);
+            SetPixelLeft(PixelLeft);
+
+            SetPixelWidth(width);
+            SetPixelHeight(height);
+        }
+        /// <summary>
+        /// Set the top left corner of a drawing. 
+        /// Note that resizing columns / rows after using this function will effect the position of the drawing
+        /// </summary>
+        /// <param name="Row">Start row</param>
+        /// <param name="RowOffsetPixels">Offset in pixels</param>
+        /// <param name="Column">Start Column</param>
+        /// <param name="ColumnOffsetPixels">Offset in pixels</param>
+        public void SetPosition(int Row, int RowOffsetPixels, int Column, int ColumnOffsetPixels)
+        {
+            int width = GetPixelWidth();
+            int height = GetPixelHeight();
+
+            From.Row = Row;
+            From.RowOff = RowOffsetPixels * EMU_PER_PIXEL;
+            From.Column = Column;
+            From.ColumnOff = ColumnOffsetPixels * EMU_PER_PIXEL;
+
+            SetPixelWidth(width);
+            SetPixelHeight(height);
+        }
+        /// <summary>
+        /// Set size in Percent
+        /// Note that resizing columns / rows after using this function will effect the size of the drawing
+        /// </summary>
+        /// <param name="Percent"></param>
+        public virtual void SetSize(int Percent)
+        {
+            int width = GetPixelWidth();
+            int height = GetPixelHeight();
+
+            width = (int)(width * ((decimal)Percent / 100));
+            height = (int)(height * ((decimal)Percent / 100));
+
+            SetPixelWidth(width, 96);
+            SetPixelHeight(height, 96);
+        }
+        /// <summary>
+        /// Set size in pixels
+        /// Note that resizing columns / rows after using this function will effect the size of the drawing
+        /// </summary>
+        /// <param name="PixelWidth">Width in pixels</param>
+        /// <param name="PixelHeight">Height in pixels</param>
+        public void SetSize(int PixelWidth, int PixelHeight)
+        {
+            SetPixelWidth(PixelWidth);
+            SetPixelHeight(PixelHeight);
+        }
+        #endregion
+        internal virtual void DeleteMe()
+        {
+            TopNode.ParentNode.RemoveChild(TopNode);
+        }
+
+        public virtual void Dispose()
+        {
+            _topNode = null;
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/ExcelDrawingBorder.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/ExcelDrawingBorder.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/ExcelDrawingBorder.cs	(revision 12707)
@@ -0,0 +1,227 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		                Initial Release		        2009-12-22
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Text;
+using System.Xml;
+using System.Drawing;
+
+namespace OfficeOpenXml.Drawing
+{
+    /// <summary>
+    /// Type of Line cap
+    /// </summary>
+    public enum eLineCap
+    {
+        Flat,   //flat
+        Round,  //rnd
+        Square  //Sq
+    }
+    /// <summary>
+    /// Line style.
+    /// </summary>
+    public enum eLineStyle
+    {
+        Dash,
+        DashDot,
+        Dot,
+        LongDash,
+        LongDashDot,
+        LongDashDotDot,
+        Solid,
+        SystemDash,
+        SystemDashDot,
+        SystemDashDotDot,
+        SystemDot
+    }
+    /// <summary>
+    /// Border for drawings
+    /// </summary>    
+    public sealed class ExcelDrawingBorder : XmlHelper
+    {
+        string _linePath;
+        internal ExcelDrawingBorder(XmlNamespaceManager nameSpaceManager, XmlNode topNode, string linePath) : 
+            base(nameSpaceManager, topNode)
+        {
+            SchemaNodeOrder = new string[] { "chart","tickLblPos", "spPr", "txPr","crossAx", "printSettings", "showVal", "showCatName", "showSerName", "showPercent", "separator", "showLeaderLines", "noFill", "solidFill", "blipFill", "gradFill", "noFill", "pattFill", "prstDash" };
+            _linePath = linePath;   
+            _lineStylePath = string.Format(_lineStylePath, linePath);
+            _lineCapPath = string.Format(_lineCapPath, linePath);
+            _lineWidth = string.Format(_lineWidth, linePath);
+        }
+        #region "Public properties"
+        ExcelDrawingFill _fill = null;
+        /// <summary>
+        /// Fill
+        /// </summary>
+        public ExcelDrawingFill Fill
+        {
+            get
+            {
+                if (_fill == null)
+                {
+                    _fill = new ExcelDrawingFill(NameSpaceManager, TopNode, _linePath);
+                }
+                return _fill;
+            }
+        }
+        string _lineStylePath = "{0}/a:prstDash/@val";
+        /// <summary>
+        /// Linestyle
+        /// </summary>
+        public eLineStyle LineStyle
+        {
+            get
+            {
+                return TranslateLineStyle(GetXmlNodeString(_lineStylePath));
+            }
+            set
+            {
+                CreateNode(_linePath, false);
+                SetXmlNodeString(_lineStylePath, TranslateLineStyleText(value));
+            }
+        }
+        string _lineCapPath = "{0}/@cap";
+        /// <summary>
+        /// Linecap
+        /// </summary>
+        public eLineCap LineCap
+        {
+            get
+            {
+                return TranslateLineCap(GetXmlNodeString(_lineCapPath));
+            }
+            set
+            {
+                CreateNode(_linePath, false);
+                SetXmlNodeString(_lineCapPath, TranslateLineCapText(value));
+            }
+        }
+        string _lineWidth = "{0}/@w";
+        /// <summary>
+        /// Width in pixels
+        /// </summary>
+        public int Width
+        {
+            get
+            {
+                return GetXmlNodeInt(_lineWidth) / 12700;
+            }
+            set
+            {
+                SetXmlNodeString(_lineWidth, (value * 12700).ToString());
+            }
+        }
+        #endregion
+        #region "Translate Enum functions"
+        private string TranslateLineStyleText(eLineStyle value)
+        {
+            string text=value.ToString();
+            switch (value)
+            {
+                case eLineStyle.Dash:
+                case eLineStyle.Dot:
+                case eLineStyle.DashDot:
+                case eLineStyle.Solid:
+                    return text.Substring(0,1).ToLower(CultureInfo.InvariantCulture) + text.Substring(1,text.Length-1); //First to Lower case.
+                case eLineStyle.LongDash:
+                case eLineStyle.LongDashDot:
+                case eLineStyle.LongDashDotDot:
+                    return "lg" + text.Substring(4, text.Length - 4);
+                case eLineStyle.SystemDash:
+                case eLineStyle.SystemDashDot:
+                case eLineStyle.SystemDashDotDot:
+                case eLineStyle.SystemDot:
+                    return "sys" + text.Substring(6, text.Length - 6);
+                default:
+                    throw(new Exception("Invalid Linestyle"));
+            }
+        }
+        private eLineStyle TranslateLineStyle(string text)
+        {
+            switch (text)
+            {
+                case "dash":
+                case "dot":
+                case "dashDot":
+                case "solid":
+                    return (eLineStyle)Enum.Parse(typeof(eLineStyle), text, true);
+                case "lgDash":
+                case "lgDashDot":
+                case "lgDashDotDot":
+                    return (eLineStyle)Enum.Parse(typeof(eLineStyle), "Long" + text.Substring(2, text.Length - 2));
+                case "sysDash":
+                case "sysDashDot":
+                case "sysDashDotDot":
+                case "sysDot":
+                    return (eLineStyle)Enum.Parse(typeof(eLineStyle), "System" + text.Substring(3, text.Length - 3));
+                default:
+                    throw (new Exception("Invalid Linestyle"));
+            }
+        }
+        private string TranslateLineCapText(eLineCap value)
+        {
+            switch (value)
+            {
+                case eLineCap.Round:
+                    return "rnd";
+                case eLineCap.Square:
+                    return "sq";
+                default:
+                    return "flat";
+            }
+        }
+        private eLineCap TranslateLineCap(string text)
+        {
+            switch (text)
+            {
+                case "rnd":
+                    return eLineCap.Round;
+                case "sq":
+                    return eLineCap.Square;
+                default:
+                    return eLineCap.Flat;
+            }
+        }
+        #endregion
+
+        
+        //public ExcelDrawingFont Font
+        //{
+        //    get
+        //    { 
+            
+        //    }
+        //}
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/ExcelDrawingFill.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/ExcelDrawingFill.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/ExcelDrawingFill.cs	(revision 12707)
@@ -0,0 +1,204 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		                Initial Release		        2009-12-22
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Xml;
+using System.Drawing;
+
+namespace OfficeOpenXml.Drawing
+{
+    /// <summary>
+    /// Fill properties for drawing objects
+    /// </summary>
+    public sealed class ExcelDrawingFill : XmlHelper
+    {
+        //ExcelShape _shp;                
+        string _fillPath;
+        XmlNode _fillNode;
+        internal ExcelDrawingFill(XmlNamespaceManager nameSpaceManager, XmlNode topNode, string fillPath) : 
+            base(nameSpaceManager, topNode)
+        {
+          //  _shp=shp;
+            _fillPath = fillPath;
+            _fillNode = topNode.SelectSingleNode(_fillPath, NameSpaceManager);
+            SchemaNodeOrder = new string[] { "tickLblPos", "spPr", "txPr","dLblPos", "crossAx", "printSettings", "showVal", "prstGeom", "noFill", "solidFill", "blipFill", "gradFill", "noFill", "pattFill", "ln", "prstDash" };
+            //Setfill node
+            if (_fillNode != null)
+            {
+                _fillTypeNode = topNode.SelectSingleNode("solidFill");
+                if (_fillTypeNode == null) _fillTypeNode = topNode.SelectSingleNode("noFill");
+                if (_fillTypeNode == null) _fillTypeNode = topNode.SelectSingleNode("blipFill");
+                if (_fillTypeNode == null) _fillTypeNode = topNode.SelectSingleNode("gradFill");
+                if (_fillTypeNode == null) _fillTypeNode = topNode.SelectSingleNode("pattFill");
+            }
+        }
+        eFillStyle _style;
+        XmlNode _fillTypeNode = null;
+        /// <summary>
+        /// Fill style
+        /// </summary>
+        public eFillStyle Style
+        {
+            get
+            {
+                if (_fillTypeNode == null)
+                {
+                    return eFillStyle.SolidFill;
+                }
+                else
+                {
+                    _style=GetStyleEnum(_fillTypeNode.Name);
+                }
+                return _style;
+            }
+            set
+            {
+                if (value == eFillStyle.NoFill || value == eFillStyle.SolidFill)
+                {
+                    _style = value;
+                    CreateFillTopNode(value);
+                }
+                else
+                {
+                    throw new NotImplementedException("Fillstyle not implemented");
+                }
+            }
+        }
+
+        private void CreateFillTopNode(eFillStyle value)
+        {
+            if (_fillTypeNode != null)
+            {
+                TopNode.RemoveChild(_fillTypeNode);
+            }
+            CreateNode(_fillPath + "/a:" + GetStyleText(value), false);
+            _fillNode=TopNode.SelectSingleNode(_fillPath + "/a:" + GetStyleText(value), NameSpaceManager);
+        }
+
+        private eFillStyle GetStyleEnum(string name)
+        {
+            switch(name)
+            {
+                case "noFill":
+                    return eFillStyle.NoFill;
+                case "blipFill":
+                    return eFillStyle.BlipFill;
+                case "gradFill":
+                    return eFillStyle.GradientFill;
+                case "grpFill":
+                    return eFillStyle.GroupFill;
+                case "pattFill":
+                    return eFillStyle.PatternFill;
+                default:
+                    return eFillStyle.SolidFill;
+            }
+        }
+
+        private string GetStyleText(eFillStyle style)
+        {
+            switch (style)
+            {
+                case eFillStyle.BlipFill:
+                    return "blipFill";
+                case eFillStyle.GradientFill:
+                    return "gradFill";
+                case eFillStyle.GroupFill:
+                    return "grpFill";
+                case eFillStyle.NoFill:
+                    return "noFill";                
+                case eFillStyle.PatternFill:
+                    return "pattFill";
+                default:
+                    return "solidFill";
+            }
+        }
+
+        const string ColorPath = "/a:solidFill/a:srgbClr/@val";
+        /// <summary>
+        /// Fill color for solid fills
+        /// </summary>
+        public Color Color
+        {
+            get
+            {
+                string col = GetXmlNodeString(_fillPath + ColorPath);
+                if (col == "")
+                {
+                    return Color.FromArgb(79, 129, 189);
+                }
+                else
+                {
+                    return Color.FromArgb(int.Parse(col,System.Globalization.NumberStyles.AllowHexSpecifier));
+                }
+            }
+            set
+            {
+                if (_fillTypeNode == null)
+                {
+                    _style = eFillStyle.SolidFill;
+                }
+                else if (_style != eFillStyle.SolidFill)
+                {
+                    throw new Exception("FillStyle must be set to SolidFill");
+                }
+                CreateNode(_fillPath, false);
+                SetXmlNodeString(_fillPath + ColorPath, value.ToArgb().ToString("X").Substring(2, 6));
+            }
+        }
+        const string alphaPath = "/a:solidFill/a:srgbClr/a:alpha/@val";
+        /// <summary>
+        /// Transparancy in percent
+        /// </summary>
+        public int Transparancy
+        {
+            get
+            {
+                return 100 - (GetXmlNodeInt(_fillPath + alphaPath) / 1000);
+            }
+            set
+            {
+                if (_fillTypeNode == null)
+                {
+                    _style = eFillStyle.SolidFill;
+                    Color = Color.FromArgb(79, 129, 189);   //Set a Default color
+                }
+                else if (_style != eFillStyle.SolidFill)
+                {
+                    throw new Exception("FillStyle must be set to SolidFill");
+                }
+                //CreateNode(_fillPath, false);
+                SetXmlNodeString(_fillPath + alphaPath, ((100 - value) * 1000).ToString());
+            }
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/ExcelDrawings.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/ExcelDrawings.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/ExcelDrawings.cs	(revision 12707)
@@ -0,0 +1,595 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		                Initial Release		        2009-12-22
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Xml;
+using System.Collections;
+using System.IO;
+using System.Drawing;
+using System.Linq;
+using OfficeOpenXml.Drawing.Chart;
+using OfficeOpenXml.Table.PivotTable;
+using OfficeOpenXml.Utils;
+namespace OfficeOpenXml.Drawing
+{
+    /// <summary>
+    /// Collection for Drawing objects.
+    /// </summary>
+    public class ExcelDrawings : IEnumerable<ExcelDrawing>, IDisposable
+    {
+        private XmlDocument _drawingsXml=new XmlDocument();
+        private Dictionary<string, int> _drawingNames;
+        private List<ExcelDrawing> _drawings;
+        internal class ImageCompare
+        {
+            internal byte[] image { get; set; }
+            internal string relID { get; set; }
+
+            internal bool Comparer(byte[] compareImg)
+            {
+                if (compareImg.Length != image.Length)
+                {
+                    return false;
+                }
+
+                for (int i = 0; i < image.Length; i++)
+                {
+                    if (image[i] != compareImg[i])
+                    {
+                        return false;
+                    }
+                }
+                return true; //Equal
+            }
+        }
+        //internal List<ImageCompare> _pics = new List<ImageCompare>();
+        internal Dictionary<string, string> _hashes = new Dictionary<string, string>();
+        internal ExcelPackage _package;
+        internal Packaging.ZipPackageRelationship _drawingRelation = null;
+        internal ExcelDrawings(ExcelPackage xlPackage, ExcelWorksheet sheet)
+        {
+                _drawingsXml = new XmlDocument();                
+                _drawingsXml.PreserveWhitespace = false;
+                _drawings = new List<ExcelDrawing>();
+                _drawingNames = new Dictionary<string,int>(StringComparer.InvariantCultureIgnoreCase);
+                _package = xlPackage;
+                Worksheet = sheet;
+                XmlNode node = sheet.WorksheetXml.SelectSingleNode("//d:drawing", sheet.NameSpaceManager);
+                CreateNSM();
+                if (node != null)
+                {
+                    _drawingRelation = sheet.Part.GetRelationship(node.Attributes["r:id"].Value);
+                    _uriDrawing = UriHelper.ResolvePartUri(sheet.WorksheetUri, _drawingRelation.TargetUri);
+
+                    _part = xlPackage.Package.GetPart(_uriDrawing);
+                    XmlHelper.LoadXmlSafe(_drawingsXml, _part.GetStream()); 
+
+                    AddDrawings();
+                }
+         }
+        internal ExcelWorksheet Worksheet { get; set; }
+        /// <summary>
+        /// A reference to the drawing xml document
+        /// </summary>
+        public XmlDocument DrawingXml
+        {
+            get
+            {
+                return _drawingsXml;
+            }
+        }
+        private void AddDrawings()
+        {
+            // Look inside all children for the drawings because they could be inside
+            // Markup Compatibility AlternativeContent/Choice or AlternativeContent/Fallback nodes.
+            // The code below currently pretends that loading all Choice alternative drawings doesn't cause a problem
+            // elsewhere. This seems to be ok for the time being as encountered drawing files so far only seem to have
+            // one Choice node (and no Fallback) underneath the AlternativeContent node. (Excel 2013 that is.)
+            // This change prevents CodePlex issue #15028 from occurring. 
+            // (the drawing xml part (that ONLY contained AlternativeContent nodes) was incorrectly being garbage collected when the package was saved)
+            XmlNodeList list = _drawingsXml.SelectNodes("//*[self::xdr:twoCellAnchor or self::xdr:oneCellAnchor or self::xdr:absoluteAnchor]", NameSpaceManager);
+
+            foreach (XmlNode node in list)
+            {
+                
+                ExcelDrawing dr;
+                switch(node.LocalName)
+                {
+                    case "oneCellAnchor":
+                        dr = new ExcelDrawing(this, node, "xdr:sp/xdr:nvSpPr/xdr:cNvPr/@name");
+                        break;
+                    case "twoCellAnchor":
+                        dr = ExcelDrawing.GetDrawing(this, node);
+                        break;
+                    case "absoluteAnchor":
+                        dr = ExcelDrawing.GetDrawing(this, node);
+                        break;
+                    default: //"absoluteCellAnchor":
+                        dr = null;
+                        break;
+                }
+                if (dr != null)
+                {
+                    _drawings.Add(dr);
+                    if (!_drawingNames.ContainsKey(dr.Name))
+                    {
+                        _drawingNames.Add(dr.Name, _drawings.Count - 1);
+                    }
+                }
+            }
+        }
+
+
+        #region NamespaceManager
+        /// <summary>
+        /// Creates the NamespaceManager. 
+        /// </summary>
+        private void CreateNSM()
+        {
+            NameTable nt = new NameTable();
+            _nsManager = new XmlNamespaceManager(nt);
+            _nsManager.AddNamespace("a", ExcelPackage.schemaDrawings);
+            _nsManager.AddNamespace("xdr", ExcelPackage.schemaSheetDrawings);
+            _nsManager.AddNamespace("c", ExcelPackage.schemaChart);
+            _nsManager.AddNamespace("r", ExcelPackage.schemaRelationships);
+        }
+        /// <summary>
+        /// Provides access to a namespace manager instance to allow XPath searching
+        /// </summary>
+        XmlNamespaceManager _nsManager=null;
+        public XmlNamespaceManager NameSpaceManager
+        {
+            get
+            {
+                return _nsManager;
+            }
+        }
+        #endregion
+        #region IEnumerable Members
+
+        public IEnumerator GetEnumerator()
+        {
+            return (_drawings.GetEnumerator());
+        }
+        #region IEnumerable<ExcelDrawing> Members
+
+        IEnumerator<ExcelDrawing> IEnumerable<ExcelDrawing>.GetEnumerator()
+        {
+            return (_drawings.GetEnumerator());
+        }
+
+        #endregion
+
+        /// <summary>
+        /// Returns the drawing at the specified position.  
+        /// </summary>
+        /// <param name="PositionID">The position of the drawing. 0-base</param>
+        /// <returns></returns>
+        public ExcelDrawing this[int PositionID]
+        {
+            get
+            {
+                return (_drawings[PositionID]);
+            }
+        }
+
+        /// <summary>
+        /// Returns the drawing matching the specified name
+        /// </summary>
+        /// <param name="Name">The name of the worksheet</param>
+        /// <returns></returns>
+        public ExcelDrawing this[string Name]
+        {
+            get
+            {
+                if (_drawingNames.ContainsKey(Name))
+                {
+                    return _drawings[_drawingNames[Name]];
+                }
+                else
+                {
+                    return null;
+                }
+            }
+        }
+        public int Count
+        {
+            get
+            {
+                if (_drawings == null)
+                {
+                    return 0;
+                }
+                else
+                {
+                    return _drawings.Count;
+                }
+            }
+        }
+        Packaging.ZipPackagePart _part=null;
+        internal Packaging.ZipPackagePart Part
+        {
+            get
+            {
+                return _part;
+            }        
+        }
+        Uri _uriDrawing=null;
+        public Uri UriDrawing
+        {
+            get
+            {
+                return _uriDrawing;
+            }
+        }
+        #endregion
+        #region Add functions
+            /// <summary>
+            /// Add a new chart to the worksheet.
+            /// Do not support Bubble-, Radar-, Stock- or Surface charts. 
+            /// </summary>
+            /// <param name="Name"></param>
+            /// <param name="ChartType">Type of chart</param>
+            /// <param name="PivotTableSource">The pivottable source for a pivotchart</param>    
+            /// <returns>The chart</returns>
+            public ExcelChart AddChart(string Name, eChartType ChartType, ExcelPivotTable PivotTableSource)
+            {
+                if(_drawingNames.ContainsKey(Name))
+                {
+                    throw new Exception("Name already exists in the drawings collection");
+                }
+
+                if (ChartType == eChartType.StockHLC ||
+                    ChartType == eChartType.StockOHLC ||
+                    ChartType == eChartType.StockVOHLC)
+                {
+                    throw(new NotImplementedException("Chart type is not supported in the current version"));
+                }
+                if (Worksheet is ExcelChartsheet && _drawings.Count > 0)
+                {
+                    throw new InvalidOperationException("Chart Worksheets can't have more than one chart");                
+                }
+                XmlElement drawNode = CreateDrawingXml();
+
+                ExcelChart chart = ExcelChart.GetNewChart(this, drawNode, ChartType, null, PivotTableSource);
+                chart.Name = Name;
+                _drawings.Add(chart);
+                _drawingNames.Add(Name, _drawings.Count - 1);
+                return chart;
+            }
+            /// <summary>
+            /// Add a new chart to the worksheet.
+            /// Do not support Bubble-, Radar-, Stock- or Surface charts. 
+            /// </summary>
+            /// <param name="Name"></param>
+            /// <param name="ChartType">Type of chart</param>
+            /// <returns>The chart</returns>
+            public ExcelChart AddChart(string Name, eChartType ChartType)
+            {
+                return AddChart(Name, ChartType, null);
+            }
+            /// <summary>
+            /// Add a picure to the worksheet
+            /// </summary>
+            /// <param name="Name"></param>
+            /// <param name="image">An image. Allways saved in then JPeg format</param>
+            /// <returns></returns>
+            public ExcelPicture AddPicture(string Name, Image image)
+            {
+               return AddPicture(Name, image, null);
+            }
+            /// <summary>
+            /// Add a picure to the worksheet
+            /// </summary>
+            /// <param name="Name"></param>
+            /// <param name="image">An image. Allways saved in then JPeg format</param>
+            /// <param name="Hyperlink">Picture Hyperlink</param>
+            /// <returns></returns>
+            public ExcelPicture AddPicture(string Name, Image image, Uri Hyperlink)
+            {
+                if (image != null)
+                {
+                    if (_drawingNames.ContainsKey(Name))
+                    {
+                        throw new Exception("Name already exists in the drawings collection");
+                    }
+                    XmlElement drawNode = CreateDrawingXml();
+                    drawNode.SetAttribute("editAs", "oneCell");
+                    ExcelPicture pic = new ExcelPicture(this, drawNode, image, Hyperlink);
+                    pic.Name = Name;
+                    _drawings.Add(pic);
+                    _drawingNames.Add(Name, _drawings.Count - 1);
+                    return pic;
+                }
+                throw (new Exception("AddPicture: Image can't be null"));
+            }
+            /// <summary>
+            /// Add a picure to the worksheet
+            /// </summary>
+            /// <param name="Name"></param>
+            /// <param name="ImageFile">The image file</param>
+            /// <returns></returns>
+            public ExcelPicture AddPicture(string Name, FileInfo ImageFile)
+            {
+               return AddPicture(Name, ImageFile, null);
+            }
+            /// <summary>
+            /// Add a picure to the worksheet
+            /// </summary>
+            /// <param name="Name"></param>
+            /// <param name="ImageFile">The image file</param>
+            /// <param name="Hyperlink">Picture Hyperlink</param>
+            /// <returns></returns>
+            public ExcelPicture AddPicture(string Name, FileInfo ImageFile, Uri Hyperlink)
+            {
+                if (Worksheet is ExcelChartsheet && _drawings.Count > 0)
+                {
+                    throw new InvalidOperationException("Chart worksheets can't have more than one drawing");
+                }
+                if (ImageFile != null)
+               {
+                  if (_drawingNames.ContainsKey(Name))
+                  {
+                     throw new Exception("Name already exists in the drawings collection");
+                  }
+                  XmlElement drawNode = CreateDrawingXml();
+                  drawNode.SetAttribute("editAs", "oneCell");
+                  ExcelPicture pic = new ExcelPicture(this, drawNode, ImageFile, Hyperlink);
+                  pic.Name = Name;
+                  _drawings.Add(pic);
+                  _drawingNames.Add(Name, _drawings.Count - 1);
+                  return pic;
+               }
+               throw (new Exception("AddPicture: ImageFile can't be null"));
+            }
+
+        /// <summary>
+        /// Add a new shape to the worksheet
+        /// </summary>
+        /// <param name="Name">Name</param>
+        /// <param name="Style">Shape style</param>
+        /// <returns>The shape object</returns>
+    
+        public ExcelShape AddShape(string Name, eShapeStyle Style)
+            {
+                if (Worksheet is ExcelChartsheet && _drawings.Count > 0)
+                {
+                    throw new InvalidOperationException("Chart worksheets can't have more than one drawing");
+                }
+                if (_drawingNames.ContainsKey(Name))
+                {
+                    throw new Exception("Name already exists in the drawings collection");
+                }
+                XmlElement drawNode = CreateDrawingXml();
+                ExcelShape shape = new ExcelShape(this, drawNode, Style);
+                shape.Name = Name;
+                shape.Style = Style;
+                _drawings.Add(shape);
+                _drawingNames.Add(Name, _drawings.Count - 1);
+                return shape;
+            }
+            private XmlElement CreateDrawingXml()
+            {
+                if (DrawingXml.OuterXml == "")
+                {
+                    DrawingXml.LoadXml(string.Format("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><xdr:wsDr xmlns:xdr=\"{0}\" xmlns:a=\"{1}\" />", ExcelPackage.schemaSheetDrawings, ExcelPackage.schemaDrawings));
+                    _uriDrawing = new Uri(string.Format("/xl/drawings/drawing{0}.xml", Worksheet.SheetID),UriKind.Relative);
+
+                    Packaging.ZipPackage package = Worksheet._package.Package;
+                    _part = package.CreatePart(_uriDrawing, "application/vnd.openxmlformats-officedocument.drawing+xml", _package.Compression);
+
+                    StreamWriter streamChart = new StreamWriter(_part.GetStream(FileMode.Create, FileAccess.Write));
+                    DrawingXml.Save(streamChart);
+                    streamChart.Close();
+                    package.Flush();
+
+                    _drawingRelation = Worksheet.Part.CreateRelationship(UriHelper.GetRelativeUri(Worksheet.WorksheetUri, _uriDrawing), Packaging.TargetMode.Internal, ExcelPackage.schemaRelationships + "/drawing");
+                    XmlElement e = Worksheet.WorksheetXml.CreateElement("drawing", ExcelPackage.schemaMain);
+                    e.SetAttribute("id",ExcelPackage.schemaRelationships, _drawingRelation.Id);
+
+                    Worksheet.WorksheetXml.DocumentElement.AppendChild(e);
+                    package.Flush();                    
+                }
+                XmlNode colNode = _drawingsXml.SelectSingleNode("//xdr:wsDr", NameSpaceManager);
+                XmlElement drawNode;
+                if (this.Worksheet is ExcelChartsheet)
+                {
+                    drawNode = _drawingsXml.CreateElement("xdr", "absoluteAnchor", ExcelPackage.schemaSheetDrawings);
+                    XmlElement posNode = _drawingsXml.CreateElement("xdr", "pos", ExcelPackage.schemaSheetDrawings);
+                    posNode.SetAttribute("y", "0");
+                    posNode.SetAttribute("x", "0");
+                    drawNode.AppendChild(posNode);
+                    XmlElement extNode = _drawingsXml.CreateElement("xdr", "ext", ExcelPackage.schemaSheetDrawings);
+                    extNode.SetAttribute("cy", "6072876");
+                    extNode.SetAttribute("cx", "9299263");
+                    drawNode.AppendChild(extNode);
+                    colNode.AppendChild(drawNode);
+                }
+                else
+                {
+                    drawNode = _drawingsXml.CreateElement("xdr", "twoCellAnchor", ExcelPackage.schemaSheetDrawings);
+                    colNode.AppendChild(drawNode);
+                    //Add from position Element;
+                    XmlElement fromNode = _drawingsXml.CreateElement("xdr", "from", ExcelPackage.schemaSheetDrawings);
+                    drawNode.AppendChild(fromNode);
+                    fromNode.InnerXml = "<xdr:col>0</xdr:col><xdr:colOff>0</xdr:colOff><xdr:row>0</xdr:row><xdr:rowOff>0</xdr:rowOff>";
+
+                    //Add to position Element;
+                    XmlElement toNode = _drawingsXml.CreateElement("xdr", "to", ExcelPackage.schemaSheetDrawings);
+                    drawNode.AppendChild(toNode);
+                    toNode.InnerXml = "<xdr:col>10</xdr:col><xdr:colOff>0</xdr:colOff><xdr:row>10</xdr:row><xdr:rowOff>0</xdr:rowOff>";
+                }
+
+                return drawNode;
+            }
+        #endregion
+        #region Remove methods
+            /// <summary>
+            /// Removes a drawing.
+            /// </summary>
+            /// <param name="Index">The index of the drawing</param>
+        public void Remove(int Index)
+        {
+            if (Worksheet is ExcelChartsheet && _drawings.Count > 0)
+            {
+                throw new InvalidOperationException("Can' remove charts from chart worksheets");
+            }
+            RemoveDrawing(Index);
+        }
+
+        internal void RemoveDrawing(int Index)
+        {
+            var draw = _drawings[Index];
+            draw.DeleteMe();
+            for (int i = Index + 1; i < _drawings.Count; i++)
+            {
+                _drawingNames[_drawings[i].Name]--;
+            }
+            _drawingNames.Remove(draw.Name);
+            _drawings.Remove(draw);
+        }
+        /// <summary>
+        /// Removes a drawing.
+        /// </summary>
+        /// <param name="Drawing">The drawing</param>
+        public void Remove(ExcelDrawing Drawing)
+        {
+            Remove(_drawingNames[Drawing.Name]);
+        }
+        /// <summary>
+        /// Removes a drawing.
+        /// </summary>
+        /// <param name="Name">The name of the drawing</param>
+        public void Remove(string Name)
+        {
+            Remove(_drawingNames[Name]);
+        }
+        /// <summary>
+        /// Removes all drawings from the collection
+        /// </summary>
+        public void Clear()
+        {
+            if (Worksheet is ExcelChartsheet && _drawings.Count > 0)
+            {
+                throw new InvalidOperationException("Can' remove charts from chart worksheets");
+            }
+            ClearDrawings();
+        }
+
+        internal void ClearDrawings()
+        {
+            while (Count > 0)
+            {
+                RemoveDrawing(0);
+            }
+        }
+        #endregion
+            internal void AdjustWidth(int[,] pos)
+            {
+                var ix = 0;
+                //Now set the size for all drawings depending on the editAs property.
+                foreach (OfficeOpenXml.Drawing.ExcelDrawing d in this)
+                {
+                    if (d.EditAs != Drawing.eEditAs.TwoCell)
+                    {
+                        if (d.EditAs == Drawing.eEditAs.Absolute)
+                        {
+                            d.SetPixelLeft(pos[ix, 0]);
+                        }
+                        d.SetPixelWidth(pos[ix, 1]);
+                        
+                    }
+                    ix++;
+                }
+            }
+            internal void AdjustHeight(int[,] pos)
+            {
+                var ix = 0;
+                //Now set the size for all drawings depending on the editAs property.
+                foreach (OfficeOpenXml.Drawing.ExcelDrawing d in this)
+                {
+                    if (d.EditAs != Drawing.eEditAs.TwoCell)
+                    {
+                        if (d.EditAs == Drawing.eEditAs.Absolute)
+                        {
+                            d.SetPixelTop(pos[ix, 0]);
+                        }
+                        d.SetPixelHeight(pos[ix, 1]);
+
+                    }
+                    ix++;
+                }
+            }
+            internal int[,] GetDrawingWidths()
+            {
+                int[,] pos = new int[Count, 2];
+                int ix = 0;
+                //Save the size for all drawings
+                foreach (ExcelDrawing d in this)
+                {
+                    pos[ix, 0] = d.GetPixelLeft();
+                    pos[ix++, 1] = d.GetPixelWidth();
+                }
+                return pos;
+            }
+            internal int[,] GetDrawingHeight()
+            {
+                int[,] pos = new int[Count, 2];
+                int ix = 0;
+                //Save the size for all drawings
+                foreach (ExcelDrawing d in this)
+                {
+                    pos[ix, 0] = d.GetPixelTop();
+                    pos[ix++, 1] = d.GetPixelHeight();
+                }
+                return pos;
+            }
+
+            public void Dispose()
+            {
+                _drawingsXml = null;
+                _hashes.Clear();
+                _hashes = null;
+                _part = null;
+                _drawingNames.Clear();
+                _drawingNames = null;
+                _drawingRelation = null;
+                foreach (var d in _drawings)
+                {
+                    d.Dispose();
+                }
+                _drawings.Clear();
+                _drawings = null;
+            }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/ExcelPicture.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/ExcelPicture.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/ExcelPicture.cs	(revision 12707)
@@ -0,0 +1,406 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		                Initial Release		        2009-10-01
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Text;
+using System.Xml;
+using System.IO;
+using System.Drawing;
+using System.Drawing.Imaging;
+using System.Diagnostics;
+using OfficeOpenXml.Utils;
+
+namespace OfficeOpenXml.Drawing
+{
+    /// <summary>
+    /// An image object
+    /// </summary>
+    public sealed class ExcelPicture : ExcelDrawing
+    {
+        #region "Constructors"
+        internal ExcelPicture(ExcelDrawings drawings, XmlNode node) :
+            base(drawings, node, "xdr:pic/xdr:nvPicPr/xdr:cNvPr/@name")
+        {
+            XmlNode picNode = node.SelectSingleNode("xdr:pic/xdr:blipFill/a:blip", drawings.NameSpaceManager);
+            if (picNode != null)
+            {
+                RelPic = drawings.Part.GetRelationship(picNode.Attributes["r:embed"].Value);
+                UriPic = UriHelper.ResolvePartUri(drawings.UriDrawing, RelPic.TargetUri);
+
+                Part = drawings.Part.Package.GetPart(UriPic);
+                FileInfo f = new FileInfo(UriPic.OriginalString);
+                ContentType = GetContentType(f.Extension);
+                _image = Image.FromStream(Part.GetStream());
+                ImageConverter ic=new ImageConverter();
+                var iby=(byte[])ic.ConvertTo(_image, typeof(byte[]));
+                var ii = _drawings._package.LoadImage(iby, UriPic, Part);
+                ImageHash = ii.Hash;
+
+                string relID = GetXmlNodeString("xdr:pic/xdr:nvPicPr/xdr:cNvPr/a:hlinkClick/@r:id");
+                if (!string.IsNullOrEmpty(relID))
+                {
+                    HypRel = drawings.Part.GetRelationship(relID);
+                    if (HypRel.TargetUri.IsAbsoluteUri)
+                    {
+                        _hyperlink = new ExcelHyperLink(HypRel.TargetUri.AbsoluteUri);
+                    }
+                    else
+                    {
+                        _hyperlink = new ExcelHyperLink(HypRel.TargetUri.OriginalString, UriKind.Relative);
+                    }
+                    ((ExcelHyperLink)_hyperlink).ToolTip = GetXmlNodeString("xdr:pic/xdr:nvPicPr/xdr:cNvPr/a:hlinkClick/@tooltip");
+                }
+            }
+        }
+        internal ExcelPicture(ExcelDrawings drawings, XmlNode node, Image image) :
+           this(drawings, node, image, null)
+        {
+        }
+        internal ExcelPicture(ExcelDrawings drawings, XmlNode node, Image image, Uri hyperlink) :
+            base(drawings, node, "xdr:pic/xdr:nvPicPr/xdr:cNvPr/@name")
+        {
+            XmlElement picNode = node.OwnerDocument.CreateElement("xdr", "pic", ExcelPackage.schemaSheetDrawings);
+            node.InsertAfter(picNode,node.SelectSingleNode("xdr:to",NameSpaceManager));
+            _hyperlink = hyperlink;
+            picNode.InnerXml = PicStartXml();
+
+            node.InsertAfter(node.OwnerDocument.CreateElement("xdr", "clientData", ExcelPackage.schemaSheetDrawings), picNode);
+
+            var package = drawings.Worksheet._package.Package;
+            //Get the picture if it exists or save it if not.
+            _image = image;
+            string relID = SavePicture(image);
+
+            //Create relationship
+            node.SelectSingleNode("xdr:pic/xdr:blipFill/a:blip/@r:embed", NameSpaceManager).Value = relID;
+
+            SetPosDefaults(image);
+            package.Flush();
+        }
+        internal ExcelPicture(ExcelDrawings drawings, XmlNode node, FileInfo imageFile) :
+           this(drawings,node,imageFile,null)
+        {
+        }
+        internal ExcelPicture(ExcelDrawings drawings, XmlNode node, FileInfo imageFile, Uri hyperlink) :
+            base(drawings, node, "xdr:pic/xdr:nvPicPr/xdr:cNvPr/@name")
+        {
+            XmlElement picNode = node.OwnerDocument.CreateElement("xdr", "pic", ExcelPackage.schemaSheetDrawings);
+            node.InsertAfter(picNode, node.SelectSingleNode("xdr:to", NameSpaceManager));
+            _hyperlink = hyperlink;
+            picNode.InnerXml = PicStartXml();
+
+            node.InsertAfter(node.OwnerDocument.CreateElement("xdr", "clientData", ExcelPackage.schemaSheetDrawings), picNode);
+
+            //Changed to stream 2/4-13 (issue 14834). Thnx SClause
+            var package = drawings.Worksheet._package.Package;
+            ContentType = GetContentType(imageFile.Extension);
+            var imagestream = new FileStream(imageFile.FullName, FileMode.Open, FileAccess.Read);
+            _image = Image.FromStream(imagestream);
+            ImageConverter ic = new ImageConverter();
+            var img = (byte[])ic.ConvertTo(_image, typeof(byte[]));
+            imagestream.Close();
+
+            UriPic = GetNewUri(package, "/xl/media/{0}" + imageFile.Name);
+            var ii = _drawings._package.AddImage(img, UriPic, ContentType);
+            string relID;
+            if(!drawings._hashes.ContainsKey(ii.Hash))
+            {
+                Part = ii.Part;
+                RelPic = drawings.Part.CreateRelationship(UriHelper.GetRelativeUri(drawings.UriDrawing, ii.Uri), Packaging.TargetMode.Internal, ExcelPackage.schemaRelationships + "/image");
+                relID = RelPic.Id;
+                _drawings._hashes.Add(ii.Hash, relID);
+                AddNewPicture(img, relID);
+            }
+            else
+            {
+                relID = drawings._hashes[ii.Hash];
+                var rel = _drawings.Part.GetRelationship(relID);
+                UriPic = UriHelper.ResolvePartUri(rel.SourceUri, rel.TargetUri);
+            }
+            SetPosDefaults(Image);
+            //Create relationship
+            node.SelectSingleNode("xdr:pic/xdr:blipFill/a:blip/@r:embed", NameSpaceManager).Value = relID;
+            package.Flush();
+        }
+
+        internal static string GetContentType(string extension)
+        {
+            switch (extension.ToLower(CultureInfo.InvariantCulture))
+            {
+                case ".bmp":
+                    return  "image/bmp";
+                case ".jpg":
+                case ".jpeg":
+                    return "image/jpeg";
+                case ".gif":
+                    return "image/gif";
+                case ".png":
+                    return "image/png";
+                case ".cgm":
+                    return "image/cgm";
+                case ".emf":
+                    return "image/x-emf";
+                case ".eps":
+                    return "image/x-eps";
+                case ".pcx":
+                    return "image/x-pcx";
+                case ".tga":
+                    return "image/x-tga";
+                case ".tif":
+                case ".tiff":
+                    return "image/x-tiff";
+                case ".wmf":
+                    return "image/x-wmf";
+                default:
+                    return "image/jpeg";
+
+            }
+        }
+        //Add a new image to the compare collection
+        private void AddNewPicture(byte[] img, string relID)
+        {
+            var newPic = new ExcelDrawings.ImageCompare();
+            newPic.image = img;
+            newPic.relID = relID;
+            //_drawings._pics.Add(newPic);
+        }
+        #endregion
+        private string SavePicture(Image image)
+        {
+            ImageConverter ic = new ImageConverter();
+            byte[] img = (byte[])ic.ConvertTo(image, typeof(byte[]));
+            var ii = _drawings._package.AddImage(img);
+
+            if (_drawings._hashes.ContainsKey(ii.Hash))
+            {
+                var relID = _drawings._hashes[ii.Hash];
+                var rel = _drawings.Part.GetRelationship(relID);
+                UriPic = UriHelper.ResolvePartUri(rel.SourceUri, rel.TargetUri);
+                return relID;
+            }
+            else
+            {
+                UriPic = ii.Uri;
+            }
+
+            //Set the Image and save it to the package.
+            RelPic = _drawings.Part.CreateRelationship(UriHelper.GetRelativeUri(_drawings.UriDrawing, UriPic), Packaging.TargetMode.Internal, ExcelPackage.schemaRelationships + "/image");
+            
+            //AddNewPicture(img, picRelation.Id);
+            _drawings._hashes.Add(ii.Hash, RelPic.Id);
+            ImageHash = ii.Hash;
+
+            return RelPic.Id;
+        }
+        private void SetPosDefaults(Image image)
+        {
+            EditAs = eEditAs.OneCell;
+            SetPixelWidth(image.Width, image.HorizontalResolution);
+            SetPixelHeight(image.Height, image.VerticalResolution);
+        }
+
+        private string PicStartXml()
+        {
+            StringBuilder xml = new StringBuilder();
+            
+            xml.Append("<xdr:nvPicPr>");
+            
+            if (_hyperlink == null)
+            {
+                xml.AppendFormat("<xdr:cNvPr id=\"{0}\" descr=\"\" />", _id);
+            }
+            else
+            {
+               HypRel = _drawings.Part.CreateRelationship(_hyperlink, Packaging.TargetMode.External, ExcelPackage.schemaHyperlink);
+               xml.AppendFormat("<xdr:cNvPr id=\"{0}\" descr=\"\">", _id);
+               if (HypRel != null)
+               {
+                   if (_hyperlink is ExcelHyperLink)
+                   {
+                       xml.AppendFormat("<a:hlinkClick xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" r:id=\"{0}\" tooltip=\"{1}\"/>",
+                         HypRel.Id, ((ExcelHyperLink)_hyperlink).ToolTip);
+                   }
+                   else
+                   {
+                       xml.AppendFormat("<a:hlinkClick xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" r:id=\"{0}\" />",
+                         HypRel.Id);
+                   }
+               }
+               xml.Append("</xdr:cNvPr>");
+            }
+           
+            xml.Append("<xdr:cNvPicPr><a:picLocks noChangeAspect=\"1\" /></xdr:cNvPicPr></xdr:nvPicPr><xdr:blipFill><a:blip xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" r:embed=\"\" cstate=\"print\" /><a:stretch><a:fillRect /> </a:stretch> </xdr:blipFill> <xdr:spPr> <a:xfrm> <a:off x=\"0\" y=\"0\" />  <a:ext cx=\"0\" cy=\"0\" /> </a:xfrm> <a:prstGeom prst=\"rect\"> <a:avLst /> </a:prstGeom> </xdr:spPr>");
+
+            return xml.ToString();
+        }
+
+        internal string ImageHash { get; set; }
+        Image _image = null;
+        /// <summary>
+        /// The Image
+        /// </summary>
+        public Image Image 
+        {
+            get
+            {
+                return _image;
+            }
+            set
+            {
+                if (value != null)
+                {
+                    _image = value;
+                    try
+                    {
+                        string relID = SavePicture(value);
+
+                        //Create relationship
+                        TopNode.SelectSingleNode("xdr:pic/xdr:blipFill/a:blip/@r:embed", NameSpaceManager).Value = relID;
+                        //_image.Save(Part.GetStream(FileMode.Create, FileAccess.Write), _imageFormat);   //Always JPEG here at this point. 
+                    }
+                    catch(Exception ex)
+                    {
+                        throw(new Exception("Can't save image - " + ex.Message, ex));
+                    }
+                }
+            }
+        }
+        ImageFormat _imageFormat=ImageFormat.Jpeg;
+        /// <summary>
+        /// Image format
+        /// If the picture is created from an Image this type is always Jpeg
+        /// </summary>
+        public ImageFormat ImageFormat
+        {
+            get
+            {
+                return _imageFormat;
+            }
+            internal set
+            {
+                _imageFormat = value;
+            }
+        }
+        internal string ContentType
+        {
+            get;
+            set;
+        }
+        /// <summary>
+        /// Set the size of the image in percent from the orginal size
+        /// Note that resizing columns / rows after using this function will effect the size of the picture
+        /// </summary>
+        /// <param name="Percent">Percent</param>
+        public override void SetSize(int Percent)
+        {
+            if(Image == null)
+            {
+                base.SetSize(Percent);
+            }
+            else
+            {
+                int width = Image.Width;
+                int height = Image.Height;
+
+                width = (int)(width * ((decimal)Percent / 100));
+                height = (int)(height * ((decimal)Percent / 100));
+
+                SetPixelWidth(width, Image.HorizontalResolution);
+                SetPixelHeight(height, Image.VerticalResolution);
+            }
+        }
+        internal Uri UriPic { get; set; }
+        internal Packaging.ZipPackageRelationship RelPic {get; set;}
+        internal Packaging.ZipPackageRelationship HypRel { get; set; }
+        internal Packaging.ZipPackagePart Part;
+
+        internal new string Id
+        {
+            get { return Name; }
+        }
+        ExcelDrawingFill _fill = null;
+        /// <summary>
+        /// Fill
+        /// </summary>
+        public ExcelDrawingFill Fill
+        {
+            get
+            {
+                if (_fill == null)
+                {
+                    _fill = new ExcelDrawingFill(NameSpaceManager, TopNode, "xdr:pic/xdr:spPr");
+                }
+                return _fill;
+            }
+        }
+        ExcelDrawingBorder _border = null;
+        /// <summary>
+        /// Border
+        /// </summary>
+        public ExcelDrawingBorder Border
+        {
+            get
+            {
+                if (_border == null)
+                {
+                    _border = new ExcelDrawingBorder(NameSpaceManager, TopNode, "xdr:pic/xdr:spPr/a:ln");
+                }
+                return _border;
+            }
+        }
+
+        private Uri _hyperlink = null;
+        /// <summary>
+        /// Hyperlink
+        /// </summary>
+        public Uri Hyperlink
+        {
+           get
+           {
+              return _hyperlink;
+           }
+        }
+        internal override void DeleteMe()
+        {
+            _drawings._package.RemoveImage(ImageHash);
+            base.DeleteMe();
+        }
+        public override void Dispose()
+        {
+            base.Dispose();
+            _hyperlink = null;
+            _image.Dispose();
+            _image = null;            
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/ExcelShape.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/ExcelShape.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/ExcelShape.cs	(revision 12707)
@@ -0,0 +1,553 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		                Initial Release		        2009-10-01
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Text;
+using System.Xml;
+using OfficeOpenXml.Style.XmlAccess;
+using OfficeOpenXml.Drawing;
+using OfficeOpenXml.Style;
+/// <summary>
+/// Shape style
+/// </summary>
+public enum eShapeStyle
+{
+    AccentBorderCallout1,
+    AccentBorderCallout2,
+    AccentBorderCallout3,
+    AccentCallout1,
+    AccentCallout2,
+    AccentCallout3,
+    ActionButtonBackPrevious,
+    ActionButtonBeginning,
+    ActionButtonBlank,
+    ActionButtonDocument,
+    ActionButtonEnd,
+    ActionButtonForwardNext,
+    ActionButtonHelp,
+    ActionButtonHome,
+    ActionButtonInformation,
+    ActionButtonMovie,
+    ActionButtonReturn,
+    ActionButtonSound,
+    Arc,
+    BentArrow,
+    BentConnector2,
+    BentConnector3,
+    BentConnector4,
+    BentConnector5,
+    BentUpArrow,
+    Bevel,
+    BlockArc,
+    BorderCallout1,
+    BorderCallout2,
+    BorderCallout3,
+    BracePair,
+    BracketPair,
+    Callout1,
+    Callout2,
+    Callout3,
+    Can,
+    ChartPlus,
+    ChartStar,
+    ChartX,
+    Chevron,
+    Chord,
+    CircularArrow,
+    Cloud,
+    CloudCallout,
+    Corner,
+    CornerTabs,
+    Cube,
+    CurvedConnector2,
+    CurvedConnector3,
+    CurvedConnector4,
+    CurvedConnector5,
+    CurvedDownArrow,
+    CurvedLeftArrow,
+    CurvedRightArrow,
+    CurvedUpArrow,
+    Decagon,
+    DiagStripe,
+    Diamond,
+    Dodecagon,
+    Donut,
+    DoubleWave,
+    DownArrow,
+    DownArrowCallout,
+    Ellipse,
+    EllipseRibbon,
+    EllipseRibbon2,
+    FlowChartAlternateProcess,
+    FlowChartCollate,
+    FlowChartConnector,
+    FlowChartDecision,
+    FlowChartDelay,
+    FlowChartDisplay,
+    FlowChartDocument,
+    FlowChartExtract,
+    FlowChartInputOutput,
+    FlowChartInternalStorage,
+    FlowChartMagneticDisk,
+    FlowChartMagneticDrum,
+    FlowChartMagneticTape,
+    FlowChartManualInput,
+    FlowChartManualOperation,
+    FlowChartMerge,
+    FlowChartMultidocument,
+    FlowChartOfflineStorage,
+    FlowChartOffpageConnector,
+    FlowChartOnlineStorage,
+    FlowChartOr,
+    FlowChartPredefinedProcess,
+    FlowChartPreparation,
+    FlowChartProcess,
+    FlowChartPunchedCard,
+    FlowChartPunchedTape,
+    FlowChartSort,
+    FlowChartSummingJunction,
+    FlowChartTerminator,
+    FoldedCorner,
+    Frame,
+    Funnel,
+    Gear6,
+    Gear9,
+    HalfFrame,
+    Heart,
+    Heptagon,
+    Hexagon,
+    HomePlate,
+    HorizontalScroll,
+    IrregularSeal1,
+    IrregularSeal2,
+    LeftArrow,
+    LeftArrowCallout,
+    LeftBrace,
+    LeftBracket,
+    LeftCircularArrow,
+    LeftRightArrow,
+    LeftRightArrowCallout,
+    LeftRightCircularArrow,
+    LeftRightRibbon,
+    LeftRightUpArrow,
+    LeftUpArrow,
+    LightningBolt,
+    Line,
+    LineInv,
+    MathDivide,
+    MathEqual,
+    MathMinus,
+    MathMultiply,
+    MathNotEqual,
+    MathPlus,
+    Moon,
+    NonIsoscelesTrapezoid,
+    NoSmoking,
+    NotchedRightArrow,
+    Octagon,
+    Parallelogram,
+    Pentagon,
+    Pie,
+    PieWedge,
+    Plaque,
+    PlaqueTabs,
+    Plus,
+    QuadArrow,
+    QuadArrowCallout,
+    Rect,
+    Ribbon,
+    Ribbon2,
+    RightArrow,
+    RightArrowCallout,
+    RightBrace,
+    RightBracket,
+    Round1Rect,
+    Round2DiagRect,
+    Round2SameRect,
+    RoundRect,
+    RtTriangle,
+    SmileyFace,
+    Snip1Rect,
+    Snip2DiagRect,
+    Snip2SameRect,
+    SnipRoundRect,
+    SquareTabs,
+    Star10,
+    Star12,
+    Star16,
+    Star24,
+    Star32,
+    Star4,
+    Star5,
+    Star6,
+    Star7,
+    Star8,
+    StraightConnector1,
+    StripedRightArrow,
+    Sun,
+    SwooshArrow,
+    Teardrop,
+    Trapezoid,
+    Triangle,
+    UpArrow,
+    UpArrowCallout,
+    UpDownArrow,
+    UpDownArrowCallout,
+    UturnArrow,
+    Wave,
+    WedgeEllipseCallout,
+    WedgeRectCallout,
+    WedgeRoundRectCallout,
+    VerticalScroll
+}
+/// <summary>
+/// Text alignment
+/// </summary>
+public enum eTextAlignment
+{
+    Left,
+    Center,
+    Right,
+    Distributed,
+    Justified,
+    JustifiedLow,
+    ThaiDistributed
+}
+/// <summary>
+/// Fillstyle.
+/// </summary>
+public enum eFillStyle
+{
+    NoFill,
+    SolidFill,
+    GradientFill,
+    PatternFill,
+    BlipFill,
+    GroupFill
+}
+namespace OfficeOpenXml.Drawing
+{
+    /// <summary>
+    /// An Excel shape.
+    /// </summary>
+    public sealed class ExcelShape : ExcelDrawing
+    {
+        internal ExcelShape(ExcelDrawings drawings, XmlNode node) :
+            base(drawings, node, "xdr:sp/xdr:nvSpPr/xdr:cNvPr/@name")
+        {
+            init();
+        }
+        internal ExcelShape(ExcelDrawings drawings, XmlNode node, eShapeStyle style) :
+            base(drawings, node, "xdr:sp/xdr:nvSpPr/xdr:cNvPr/@name")
+        {
+            init();
+            XmlElement shapeNode = node.OwnerDocument.CreateElement("xdr", "sp", ExcelPackage.schemaSheetDrawings);
+            shapeNode.SetAttribute("macro", "");
+            shapeNode.SetAttribute("textlink", "");
+            node.AppendChild(shapeNode);
+
+            shapeNode.InnerXml = ShapeStartXml();
+            node.AppendChild(shapeNode.OwnerDocument.CreateElement("xdr", "clientData", ExcelPackage.schemaSheetDrawings));
+        }
+        private void init()
+        {
+            SchemaNodeOrder = new string[] { "prstGeom", "ln", "pPr", "defRPr", "solidFill", "uFill", "latin", "cs", "r", "rPr", "t" };
+        }
+        #region "public methods"
+        const string ShapeStylePath = "xdr:sp/xdr:spPr/a:prstGeom/@prst";
+        /// <summary>
+        /// Shape style
+        /// </summary>
+        public eShapeStyle Style
+        {
+            get
+            {
+                string v = GetXmlNodeString(ShapeStylePath);
+                try
+                {
+                    return (eShapeStyle)Enum.Parse(typeof(eShapeStyle), v, true);
+                }
+                catch
+                {
+                    throw (new Exception(string.Format("Invalid shapetype {0}", v)));
+                }
+            }
+            set
+            {
+                string v = value.ToString();
+                v = v.Substring(0, 1).ToLower(CultureInfo.InvariantCulture) + v.Substring(1, v.Length - 1);
+                SetXmlNodeString(ShapeStylePath, v);
+            }
+        }
+        ExcelDrawingFill _fill = null;
+        /// <summary>
+        /// Fill
+        /// </summary>
+        public ExcelDrawingFill Fill
+        {
+            get
+            {
+                if (_fill == null)
+                {
+                    _fill = new ExcelDrawingFill(NameSpaceManager, TopNode, "xdr:sp/xdr:spPr");
+                }
+                return _fill;
+            }
+        }
+        ExcelDrawingBorder _border = null;
+        /// <summary>
+        /// Border
+        /// </summary>
+        public ExcelDrawingBorder Border        
+        {
+            get
+            {
+                if (_border == null)
+                {
+                    _border = new ExcelDrawingBorder(NameSpaceManager, TopNode, "xdr:sp/xdr:spPr/a:ln");
+                }
+                return _border;
+            }
+        }
+        string[] paragraphNodeOrder = new string[] { "pPr", "defRPr", "solidFill", "uFill", "latin", "cs", "r", "rPr", "t" };
+        const string PARAGRAPH_PATH = "xdr:sp/xdr:txBody/a:p";
+        ExcelTextFont _font=null;
+        public ExcelTextFont Font
+        {
+            get
+            {
+                if (_font == null)
+                {
+                    XmlNode node = TopNode.SelectSingleNode(PARAGRAPH_PATH, NameSpaceManager);
+                    if(node==null)
+                    {
+                        Text="";    //Creates the node p element
+                        node = TopNode.SelectSingleNode(PARAGRAPH_PATH, NameSpaceManager);
+                    }
+                    _font = new ExcelTextFont(NameSpaceManager, TopNode, "xdr:sp/xdr:txBody/a:p/a:pPr/a:defRPr", paragraphNodeOrder);
+                }
+                return _font;
+            }
+        }
+        const string TextPath = "xdr:sp/xdr:txBody/a:p/a:r/a:t";
+        /// <summary>
+        /// Text inside the shape
+        /// </summary>
+        public string Text
+        {
+            get
+            {
+                return GetXmlNodeString(TextPath);
+            }
+            set
+            {
+                SetXmlNodeString(TextPath, value);
+            }
+
+        }
+        string lockTextPath = "xdr:sp/@fLocksText";
+        /// <summary>
+        /// Lock drawing
+        /// </summary>
+        public bool LockText
+        {
+            get
+            {
+                return GetXmlNodeBool(lockTextPath, true);
+            }
+            set
+            {
+                SetXmlNodeBool(lockTextPath, value);
+            }
+        }
+        ExcelParagraphCollection _richText = null;
+        /// <summary>
+        /// Richtext collection. Used to format specific parts of the text
+        /// </summary>
+        public ExcelParagraphCollection RichText
+        {
+            get
+            {
+                if (_richText == null)
+                {
+                    //XmlNode node=TopNode.SelectSingleNode(PARAGRAPH_PATH, NameSpaceManager);
+                    //if (node == null)
+                    //{
+                    //    CreateNode(PARAGRAPH_PATH);
+                    //}
+                        _richText = new ExcelParagraphCollection(NameSpaceManager, TopNode, PARAGRAPH_PATH, paragraphNodeOrder);
+                }
+                return _richText;
+            }
+        }
+        const string TextAnchoringPath = "xdr:sp/xdr:txBody/a:bodyPr/@anchor";
+        /// <summary>
+        /// Text Anchoring
+        /// </summary>
+        public eTextAnchoringType TextAnchoring
+        {
+            get
+            {
+                return GetTextAchoringEnum(GetXmlNodeString(TextAnchoringPath));
+            }
+            set
+            {
+                SetXmlNodeString(TextAnchoringPath, GetTextAchoringText(value));
+            }
+        }
+        const string TextAnchoringCtlPath = "xdr:sp/xdr:txBody/a:bodyPr/@anchorCtr";
+        /// <summary>
+        /// Specifies the centering of the text box.
+        /// </summary>
+        public bool TextAnchoringControl
+        {
+            get
+            {
+                return GetXmlNodeBool(TextAnchoringCtlPath);
+            }
+            set
+            {
+                if (value)
+                {
+                    SetXmlNodeString(TextAnchoringCtlPath, "1");
+                }
+                else
+                {
+                    SetXmlNodeString(TextAnchoringCtlPath, "0");
+                }
+            }
+        }
+        const string TEXT_ALIGN_PATH = "xdr:sp/xdr:txBody/a:p/a:pPr/@algn";
+        /// <summary>
+        /// How the text is aligned
+        /// </summary>
+        public eTextAlignment TextAlignment
+        {
+            get
+            {
+               switch(GetXmlNodeString(TEXT_ALIGN_PATH))
+               {
+                   case "ctr":
+                       return eTextAlignment.Center;
+                   case "r":
+                       return eTextAlignment.Right;
+                   case "dist":
+                       return eTextAlignment.Distributed;
+                   case "just":
+                       return eTextAlignment.Justified;
+                   case "justLow":
+                       return eTextAlignment.JustifiedLow;
+                   case "thaiDist":
+                       return eTextAlignment.ThaiDistributed;
+                   default: 
+                       return eTextAlignment.Left;
+               }
+            }
+            set
+            {
+                switch (value)
+                {
+                    case eTextAlignment.Right:
+                        SetXmlNodeString(TEXT_ALIGN_PATH, "r");
+                        break;
+                    case eTextAlignment.Center:
+                        SetXmlNodeString(TEXT_ALIGN_PATH, "ctr");
+                        break;
+                    case eTextAlignment.Distributed:
+                        SetXmlNodeString(TEXT_ALIGN_PATH, "dist");
+                        break;
+                    case eTextAlignment.Justified:
+                        SetXmlNodeString(TEXT_ALIGN_PATH, "just");
+                        break;
+                    case eTextAlignment.JustifiedLow:
+                        SetXmlNodeString(TEXT_ALIGN_PATH, "justLow");
+                        break;
+                    case eTextAlignment.ThaiDistributed:
+                        SetXmlNodeString(TEXT_ALIGN_PATH, "thaiDist");
+                        break;
+                    default:
+                        DeleteNode(TEXT_ALIGN_PATH);
+                        break;
+                }                
+            }
+        }
+        const string INDENT_ALIGN_PATH = "xdr:sp/xdr:txBody/a:p/a:pPr/@lvl";
+        /// <summary>
+        /// Indentation
+        /// </summary>
+        public int Indent
+        {
+            get
+            {
+                return GetXmlNodeInt(INDENT_ALIGN_PATH);
+            }
+            set
+            {
+                if (value < 0 || value > 8)
+                {
+                    throw(new ArgumentOutOfRangeException("Indent level must be between 0 and 8"));
+                }
+                SetXmlNodeString(INDENT_ALIGN_PATH, value.ToString());
+            }
+        }
+        const string TextVerticalPath = "xdr:sp/xdr:txBody/a:bodyPr/@vert";
+        /// <summary>
+        /// Vertical text
+        /// </summary>
+        public eTextVerticalType TextVertical
+        {
+            get
+            {
+                return GetTextVerticalEnum(GetXmlNodeString(TextVerticalPath));
+            }
+            set
+            {
+                SetXmlNodeString(TextVerticalPath, GetTextVerticalText(value));
+            }
+        }
+
+        #endregion
+        #region "Private Methods"
+        private string ShapeStartXml()
+        {
+            StringBuilder xml = new StringBuilder();
+            xml.AppendFormat("<xdr:nvSpPr><xdr:cNvPr id=\"{0}\" name=\"{1}\" /><xdr:cNvSpPr /></xdr:nvSpPr><xdr:spPr><a:prstGeom prst=\"rect\"><a:avLst /></a:prstGeom></xdr:spPr><xdr:style><a:lnRef idx=\"2\"><a:schemeClr val=\"accent1\"><a:shade val=\"50000\" /></a:schemeClr></a:lnRef><a:fillRef idx=\"1\"><a:schemeClr val=\"accent1\" /></a:fillRef><a:effectRef idx=\"0\"><a:schemeClr val=\"accent1\" /></a:effectRef><a:fontRef idx=\"minor\"><a:schemeClr val=\"lt1\" /></a:fontRef></xdr:style><xdr:txBody><a:bodyPr vertOverflow=\"clip\" rtlCol=\"0\" anchor=\"ctr\" /><a:lstStyle /><a:p></a:p></xdr:txBody>", _id, Name);
+            return xml.ToString();
+        }
+        #endregion
+        internal new string Id
+        {
+            get { return Name + Text; }
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/ExcelView3D.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/ExcelView3D.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/ExcelView3D.cs	(revision 12707)
@@ -0,0 +1,151 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		                Initial Release		        2009-10-01
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Xml;
+using System.Globalization;
+
+namespace OfficeOpenXml.Drawing
+{
+    /// <summary>
+    /// 3D settings
+    /// </summary>
+    public sealed class ExcelView3D : XmlHelper
+    {
+       internal ExcelView3D(XmlNamespaceManager ns, XmlNode node)
+           : base(ns,node)
+       {
+           SchemaNodeOrder = new string[] { "rotX", "hPercent", "rotY", "depthPercent","rAngAx", "perspective"};
+       }
+       const string perspectivePath = "c:perspective/@val";
+       /// <summary>
+       /// Degree of perspective 
+       /// </summary>
+       public decimal Perspective
+       {
+           get
+           {
+               return GetXmlNodeInt(perspectivePath);
+           }
+           set
+           {
+               SetXmlNodeString(perspectivePath, value.ToString(CultureInfo.InvariantCulture));
+           }
+       }
+       const string rotXPath = "c:rotX/@val";
+       /// <summary>
+       /// Rotation X-axis
+       /// </summary>
+       public decimal RotX
+       {
+           get
+           {
+               return GetXmlNodeDecimal(rotXPath);
+           }
+           set
+           {
+               CreateNode(rotXPath);
+               SetXmlNodeString(rotXPath, value.ToString(CultureInfo.InvariantCulture));
+           }
+       }
+       const string rotYPath = "c:rotY/@val";
+       /// <summary>
+       /// Rotation Y-axis
+       /// </summary>
+       public decimal RotY
+       {
+           get
+           {
+               return GetXmlNodeDecimal(rotYPath);
+           }
+           set
+           {
+               CreateNode(rotYPath);
+               SetXmlNodeString(rotYPath, value.ToString(CultureInfo.InvariantCulture));
+           }
+       }
+       const string rAngAxPath = "c:rAngAx/@val";
+       /// <summary>
+       /// Right Angle Axes
+       /// </summary>
+       public bool RightAngleAxes
+       {
+           get
+           {
+               return GetXmlNodeBool(rAngAxPath);
+           }
+           set
+           {
+               SetXmlNodeBool(rAngAxPath, value);
+           }
+       }
+       const string depthPercentPath = "c:depthPercent/@val";
+       /// <summary>
+       /// Depth % of base
+       /// </summary>
+       public int DepthPercent
+       {
+           get
+           {
+               return GetXmlNodeInt(depthPercentPath);
+           }
+           set
+           {
+               if (value < 0 || value > 2000)
+               {
+                   throw(new ArgumentOutOfRangeException("Value must be between 0 and 2000"));
+               }
+               SetXmlNodeString(depthPercentPath, value.ToString());
+           }
+       }
+       const string heightPercentPath = "c:hPercent/@val";
+       /// <summary>
+       /// Height % of base
+       /// </summary>
+       public int HeightPercent
+       {
+           get
+           {
+               return GetXmlNodeInt(heightPercentPath);
+           }
+           set
+           {
+               if (value < 5 || value > 500)
+               {
+                   throw (new ArgumentOutOfRangeException("Value must be between 5 and 500"));
+               }
+               SetXmlNodeString(heightPercentPath, value.ToString());
+           }
+       }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Vml/ExcelVmlDrawingBase.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Vml/ExcelVmlDrawingBase.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Vml/ExcelVmlDrawingBase.cs	(revision 12707)
@@ -0,0 +1,152 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		Initial Release		        2010-06-01
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Xml;
+using System.Globalization;
+using System.Drawing;
+
+namespace OfficeOpenXml.Drawing.Vml
+{
+    /// <summary>
+    /// Horizontal Alingment
+    /// </summary>
+    public enum eTextAlignHorizontalVml
+    {
+        Left,
+        Center,
+        Right
+    }
+    /// <summary>
+    /// Vertical Alingment
+    /// </summary>
+    public enum eTextAlignVerticalVml
+    {
+        Top,
+        Center,
+        Bottom
+    }
+    /// <summary>
+    /// Linestyle
+    /// </summary>
+    public enum eLineStyleVml
+    {
+        Solid,
+        Round,
+        Square,
+        Dash,
+        DashDot,
+        LongDash,
+        LongDashDot,
+        LongDashDotDot
+    }
+    /// <summary>
+    /// Drawing object used for comments
+    /// </summary>
+    public class ExcelVmlDrawingBase : XmlHelper
+    {
+        internal ExcelVmlDrawingBase(XmlNode topNode, XmlNamespaceManager ns) :
+            base(ns, topNode)
+        {
+            SchemaNodeOrder = new string[] { "fill", "stroke", "shadow", "path", "textbox", "ClientData", "MoveWithCells", "SizeWithCells", "Anchor", "Locked", "AutoFill", "LockText", "TextHAlign", "TextVAlign", "Row", "Column", "Visible" };
+        }   
+        public string Id 
+        {
+            get
+            {
+                return GetXmlNodeString("@id");
+            }
+            set
+            {
+                SetXmlNodeString("@id",value);
+            }
+        }
+        #region "Style Handling methods"
+        protected bool GetStyle(string style, string key, out string value)
+        {
+            string[]styles = style.Split(';');
+            foreach(string s in styles)
+            {
+                if (s.IndexOf(':') > 0)
+                {
+                    string[] split = s.Split(':');
+                    if (split[0] == key)
+                    {
+                        value=split[1];
+                        return true;
+                    }
+                }
+                else if (s == key)
+                {
+                    value="";
+                    return true;
+                }
+            }
+            value="";
+            return false;
+        }
+        protected string SetStyle(string style, string key, string value)
+        {
+            string[] styles = style.Split(';');
+            string newStyle="";
+            bool changed = false;
+            foreach (string s in styles)
+            {
+                string[] split = s.Split(':');
+                if (split[0].Trim() == key)
+                {
+                    if (value.Trim() != "") //If blank remove the item
+                    {
+                        newStyle += key + ':' + value;
+                    }
+                    changed = true;
+                }
+                else
+                {
+                    newStyle += s;
+                }
+                newStyle += ';';
+            }
+            if (!changed)
+            {
+                newStyle += key + ':' + value;
+            }
+            else
+            {
+                newStyle = style.Substring(0, style.Length - 1);
+            }
+            return newStyle;
+        }
+        #endregion
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Vml/ExcelVmlDrawingBaseCollection.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Vml/ExcelVmlDrawingBaseCollection.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Vml/ExcelVmlDrawingBaseCollection.cs	(revision 12707)
@@ -0,0 +1,69 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		Initial Release		        2010-06-01
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Xml;
+using System.Collections;
+
+namespace OfficeOpenXml.Drawing.Vml
+{
+    public class ExcelVmlDrawingBaseCollection
+    {        
+        internal ExcelVmlDrawingBaseCollection(ExcelPackage pck, ExcelWorksheet ws, Uri uri)
+        {
+            VmlDrawingXml = new XmlDocument();
+            VmlDrawingXml.PreserveWhitespace = false;
+            
+            NameTable nt=new NameTable();
+            NameSpaceManager = new XmlNamespaceManager(nt);
+            NameSpaceManager.AddNamespace("v", ExcelPackage.schemaMicrosoftVml);
+            NameSpaceManager.AddNamespace("o", ExcelPackage.schemaMicrosoftOffice);
+            NameSpaceManager.AddNamespace("x", ExcelPackage.schemaMicrosoftExcel);
+            Uri = uri;
+            if (uri == null)
+            {
+                Part = null;
+            }
+            else
+            {
+                Part=pck.Package.GetPart(uri);
+                XmlHelper.LoadXmlSafe(VmlDrawingXml, Part.GetStream()); 
+            }
+        }
+        internal XmlDocument VmlDrawingXml { get; set; }
+        internal Uri Uri { get; set; }
+        internal string RelId { get; set; }
+        internal Packaging.ZipPackagePart Part { get; set; }
+        internal XmlNamespaceManager NameSpaceManager { get; set; }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Vml/ExcelVmlDrawingComment.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Vml/ExcelVmlDrawingComment.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Vml/ExcelVmlDrawingComment.cs	(revision 12707)
@@ -0,0 +1,459 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		Initial Release		        2010-06-01
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Xml;
+using System.Globalization;
+using System.Drawing;
+
+namespace OfficeOpenXml.Drawing.Vml
+{
+    /// <summary>
+    /// Drawing object used for comments
+    /// </summary>
+    public class ExcelVmlDrawingComment : ExcelVmlDrawingBase, IRangeID
+    {
+        internal ExcelVmlDrawingComment(XmlNode topNode, ExcelRangeBase range, XmlNamespaceManager ns) :
+            base(topNode, ns)
+        {
+            Range = range;
+            SchemaNodeOrder = new string[] { "fill", "stroke", "shadow", "path", "textbox", "ClientData", "MoveWithCells", "SizeWithCells", "Anchor", "Locked", "AutoFill", "LockText", "TextHAlign", "TextVAlign", "Row", "Column", "Visible" };
+        }   
+        internal ExcelRangeBase Range { get; set; }
+        //public string Id 
+        //{
+        //    get
+        //    {
+        //        return GetXmlNodeString("@id");
+        //    }
+        //    set
+        //    {
+        //        SetXmlNodeString("@id",value);
+        //    }
+        //}
+        const string VERTICAL_ALIGNMENT_PATH="x:ClientData/x:TextVAlign";
+        /// <summary>
+        /// Vertical alignment for text
+        /// </summary>
+        public eTextAlignVerticalVml VerticalAlignment
+        {
+            get
+            {
+                switch (GetXmlNodeString(VERTICAL_ALIGNMENT_PATH))
+                {
+                    case "Center":
+                        return eTextAlignVerticalVml.Center;
+                    case "Bottom":
+                        return eTextAlignVerticalVml.Bottom;
+                    default:
+                        return eTextAlignVerticalVml.Top;
+                }
+            }
+            set
+            {
+                switch (value)
+                {
+                    case eTextAlignVerticalVml.Center:
+                        SetXmlNodeString(VERTICAL_ALIGNMENT_PATH, "Center");
+                        break;
+                    case eTextAlignVerticalVml.Bottom:
+                        SetXmlNodeString(VERTICAL_ALIGNMENT_PATH, "Bottom");
+                        break;
+                    default:
+                        DeleteNode(VERTICAL_ALIGNMENT_PATH);
+                        break;
+                }
+            }
+        }
+        const string HORIZONTAL_ALIGNMENT_PATH="x:ClientData/x:TextHAlign";
+        /// <summary>
+        /// Horizontal alignment for text
+        /// </summary>
+        public eTextAlignHorizontalVml HorizontalAlignment
+        {
+            get
+            {
+                switch (GetXmlNodeString(HORIZONTAL_ALIGNMENT_PATH))
+                {
+                    case "Center":
+                        return eTextAlignHorizontalVml.Center;
+                    case "Right":
+                        return eTextAlignHorizontalVml.Right;
+                    default:
+                        return eTextAlignHorizontalVml.Left;
+                }
+            }
+            set
+            {
+                switch (value)
+                {
+                    case eTextAlignHorizontalVml.Center:
+                        SetXmlNodeString(HORIZONTAL_ALIGNMENT_PATH, "Center");
+                        break;
+                    case eTextAlignHorizontalVml.Right:
+                        SetXmlNodeString(HORIZONTAL_ALIGNMENT_PATH, "Right");
+                        break;
+                    default:
+                        DeleteNode(HORIZONTAL_ALIGNMENT_PATH);
+                        break;
+                }
+            }
+        }
+        const string VISIBLE_PATH = "x:ClientData/x:Visible";
+        /// <summary>
+        /// If the drawing object is visible.
+        /// </summary>
+        public bool Visible 
+        { 
+            get
+            {
+                return (TopNode.SelectSingleNode(VISIBLE_PATH, NameSpaceManager)!=null);
+            }
+            set
+            {
+                if (value)
+                {
+                    CreateNode(VISIBLE_PATH);
+                    Style = SetStyle(Style,"visibility", "visible");
+                }
+                else
+                {
+                    DeleteNode(VISIBLE_PATH);
+                    Style = SetStyle(Style,"visibility", "hidden");
+                }                
+            }
+        }
+        const string BACKGROUNDCOLOR_PATH = "@fillcolor";
+        const string BACKGROUNDCOLOR2_PATH = "v:fill/@color2";
+        /// <summary>
+        /// Background color
+        /// </summary>
+        public Color BackgroundColor
+        {
+            get
+            {
+                string col = GetXmlNodeString(BACKGROUNDCOLOR_PATH);
+                if (col == "")
+                {
+                    return Color.FromArgb(0xff, 0xff, 0xe1);
+                }
+                else
+                {
+                    if(col.StartsWith("#")) col=col.Substring(1,col.Length-1);
+                    int res;
+                    if (int.TryParse(col,System.Globalization.NumberStyles.AllowHexSpecifier, CultureInfo.InvariantCulture, out res))
+                    {
+                        return Color.FromArgb(res);
+                    }
+                    else
+                    {
+                        return Color.Empty;
+                    }
+                }
+            }
+            set
+            {
+                string color = "#" + value.ToArgb().ToString("X").Substring(2, 6);
+                SetXmlNodeString(BACKGROUNDCOLOR_PATH, color);
+                //SetXmlNode(BACKGROUNDCOLOR2_PATH, color);
+            }
+        }
+        const string LINESTYLE_PATH="v:stroke/@dashstyle";
+        const string ENDCAP_PATH = "v:stroke/@endcap";
+        /// <summary>
+        /// Linestyle for border
+        /// </summary>
+        public eLineStyleVml LineStyle 
+        { 
+            get
+            {
+                string v=GetXmlNodeString(LINESTYLE_PATH);
+                if (v == "")
+                {
+                    return eLineStyleVml.Solid;
+                }
+                else if (v == "1 1")
+                {
+                    v = GetXmlNodeString(ENDCAP_PATH);
+                    return (eLineStyleVml)Enum.Parse(typeof(eLineStyleVml), v, true);
+                }
+                else
+                {
+                    return (eLineStyleVml)Enum.Parse(typeof(eLineStyleVml), v, true);
+                }
+            }
+            set
+            {
+                if (value == eLineStyleVml.Round || value == eLineStyleVml.Square)
+                {
+                    SetXmlNodeString(LINESTYLE_PATH, "1 1");
+                    if (value == eLineStyleVml.Round)
+                    {
+                        SetXmlNodeString(ENDCAP_PATH, "round");
+                    }
+                    else
+                    {
+                        DeleteNode(ENDCAP_PATH);
+                    }
+                }
+                else
+                {
+                    string v = value.ToString();
+                    v = v.Substring(0, 1).ToLower(CultureInfo.InvariantCulture) + v.Substring(1, v.Length - 1);
+                    SetXmlNodeString(LINESTYLE_PATH, v);
+                    DeleteNode(ENDCAP_PATH);
+                }
+            }
+        }
+        const string LINECOLOR_PATH="@strokecolor";
+        /// <summary>
+        /// Line color 
+        /// </summary>
+        public Color LineColor
+        {
+            get
+            {
+                string col = GetXmlNodeString(LINECOLOR_PATH);
+                if (col == "")
+                {
+                    return Color.Black;
+                }
+                else
+                {
+                    if (col.StartsWith("#")) col = col.Substring(1, col.Length - 1);
+                    int res;
+                    if (int.TryParse(col, System.Globalization.NumberStyles.AllowHexSpecifier, CultureInfo.InvariantCulture, out res))
+                    {
+                        return Color.FromArgb(res);
+                    }
+                    else
+                    {
+                        return Color.Empty;
+                    }
+                }                
+            }
+            set
+            {
+                string color = "#" + value.ToArgb().ToString("X").Substring(2, 6);
+                SetXmlNodeString(LINECOLOR_PATH, color);
+            }
+        }
+        const string LINEWIDTH_PATH="@strokeweight";
+        /// <summary>
+        /// Width of the border
+        /// </summary>
+        public Single LineWidth 
+        {
+            get
+            {
+                string wt=GetXmlNodeString(LINEWIDTH_PATH);
+                if (wt == "") return (Single).75;
+                if(wt.EndsWith("pt")) wt=wt.Substring(0,wt.Length-2);
+
+                Single ret;
+                if(Single.TryParse(wt,System.Globalization.NumberStyles.Any, CultureInfo.InvariantCulture, out ret))
+                {
+                    return ret;
+                }
+                else
+                {
+                    return 0;
+                }
+            }
+            set
+            {
+                SetXmlNodeString(LINEWIDTH_PATH, value.ToString(CultureInfo.InvariantCulture) + "pt");
+            }
+        }
+        ///// <summary>
+        ///// Width of the Comment 
+        ///// </summary>
+        //public Single Width
+        //{
+        //    get
+        //    {
+        //        string v;
+        //        GetStyle("width", out v);
+        //        if(v.EndsWith("pt"))
+        //        {
+        //            v = v.Substring(0, v.Length - 2);
+        //        }
+        //        short ret;
+        //        if (short.TryParse(v,System.Globalization.NumberStyles.Any, CultureInfo.InvariantCulture, out ret))
+        //        {
+        //            return ret;
+        //        }
+        //        else
+        //        {
+        //            return 0;
+        //        }
+        //    }
+        //    set
+        //    {
+        //        SetStyle("width", value.ToString("N2",CultureInfo.InvariantCulture) + "pt");
+        //    }
+        //}
+        ///// <summary>
+        ///// Height of the Comment 
+        ///// </summary>
+        //public Single Height
+        //{
+        //    get
+        //    {
+        //        string v;
+        //        GetStyle("height", out v);
+        //        if (v.EndsWith("pt"))
+        //        {
+        //            v = v.Substring(0, v.Length - 2);
+        //        }
+        //        short ret;
+        //        if (short.TryParse(v, System.Globalization.NumberStyles.Any, CultureInfo.InvariantCulture, out ret))
+        //        {
+        //            return ret;
+        //        }
+        //        else
+        //        {
+        //            return 0;
+        //        }
+        //    }
+        //    set
+        //    {
+        //        SetStyle("height", value.ToString("N2", CultureInfo.InvariantCulture) + "pt");
+        //    }
+        //}
+        const string TEXTBOX_STYLE_PATH = "v:textbox/@style";
+        /// <summary>
+        /// Autofits the drawingobject 
+        /// </summary>
+        public bool AutoFit
+        {
+            get
+            {
+                string value;
+                GetStyle(GetXmlNodeString(TEXTBOX_STYLE_PATH), "mso-fit-shape-to-text", out value);
+                return value=="t";
+            }
+            set
+            {                
+                SetXmlNodeString(TEXTBOX_STYLE_PATH, SetStyle(GetXmlNodeString(TEXTBOX_STYLE_PATH),"mso-fit-shape-to-text", value?"t":"")); 
+            }
+        }        
+        const string LOCKED_PATH = "x:ClientData/x:Locked";
+        /// <summary>
+        /// If the object is locked when the sheet is protected
+        /// </summary>
+        public bool Locked 
+        {
+            get
+            {
+                return GetXmlNodeBool(LOCKED_PATH, false);
+            }
+            set
+            {
+                SetXmlNodeBool(LOCKED_PATH, value, false);                
+            }
+        }
+        const string LOCK_TEXT_PATH = "x:ClientData/x:LockText";        
+        /// <summary>
+        /// Specifies that the object's text is locked
+        /// </summary>
+        public bool LockText
+        {
+            get
+            {
+                return GetXmlNodeBool(LOCK_TEXT_PATH, false);
+            }
+            set
+            {
+                SetXmlNodeBool(LOCK_TEXT_PATH, value, false);
+            }
+        }
+        ExcelVmlDrawingPosition _from = null;
+        /// <summary>
+        /// From position. For comments only when Visible=true.
+        /// </summary>
+        public ExcelVmlDrawingPosition From
+        {
+            get
+            {
+                if (_from == null)
+                {
+                    _from = new ExcelVmlDrawingPosition(NameSpaceManager, TopNode.SelectSingleNode("x:ClientData", NameSpaceManager), 0);
+                }
+                return _from;
+            }
+        }
+        ExcelVmlDrawingPosition _to = null;
+        /// <summary>
+        /// To position. For comments only when Visible=true.
+        /// </summary>
+        public ExcelVmlDrawingPosition To
+        {
+            get
+            {
+                if (_to == null)
+                {
+                    _to = new ExcelVmlDrawingPosition(NameSpaceManager, TopNode.SelectSingleNode("x:ClientData", NameSpaceManager), 4);
+                }
+                return _to;
+            }
+        }
+        const string STYLE_PATH = "@style";
+        internal string Style
+        {
+            get
+            {
+                return GetXmlNodeString(STYLE_PATH);
+            }
+            set
+            {
+                SetXmlNodeString(STYLE_PATH, value);
+            }
+        }
+        #region IRangeID Members
+
+        ulong IRangeID.RangeID
+        {
+            get
+            {
+                return ExcelCellBase.GetCellID(Range.Worksheet.SheetID, Range.Start.Row, Range.Start.Column);
+            }
+            set
+            {
+                
+            }
+        }
+
+        #endregion
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Vml/ExcelVmlDrawingCommentCollection.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Vml/ExcelVmlDrawingCommentCollection.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Vml/ExcelVmlDrawingCommentCollection.cs	(revision 12707)
@@ -0,0 +1,206 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		Initial Release		        2010-06-01
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Xml;
+using System.Collections;
+
+namespace OfficeOpenXml.Drawing.Vml
+{
+    internal class ExcelVmlDrawingCommentCollection : ExcelVmlDrawingBaseCollection, IEnumerable
+    {
+        internal RangeCollection _drawings;
+        internal ExcelVmlDrawingCommentCollection(ExcelPackage pck, ExcelWorksheet ws, Uri uri) :
+            base(pck, ws,uri)
+        {
+            if (uri == null)
+            {
+                VmlDrawingXml.LoadXml(CreateVmlDrawings());
+                _drawings = new RangeCollection(new List<IRangeID>());
+            }
+            else
+            {
+                AddDrawingsFromXml(ws);
+            }
+        }
+        protected void AddDrawingsFromXml(ExcelWorksheet ws)
+        {
+            var nodes = VmlDrawingXml.SelectNodes("//v:shape", NameSpaceManager);
+            var list = new List<IRangeID>();
+            foreach (XmlNode node in nodes)
+            {
+                var rowNode = node.SelectSingleNode("x:ClientData/x:Row", NameSpaceManager);
+                var colNode = node.SelectSingleNode("x:ClientData/x:Column", NameSpaceManager);
+                if (rowNode != null && colNode != null)
+                {
+                    var row = int.Parse(rowNode.InnerText) + 1;
+                    var col = int.Parse(colNode.InnerText) + 1;
+                    list.Add(new ExcelVmlDrawingComment(node, ws.Cells[row, col], NameSpaceManager));
+                }
+                else
+                {
+                    list.Add(new ExcelVmlDrawingComment(node, ws.Cells[1, 1], NameSpaceManager));
+                }
+            }
+            list.Sort(new Comparison<IRangeID>((r1, r2) => (r1.RangeID < r2.RangeID ? -1 : r1.RangeID > r2.RangeID ? 1 : 0)));  //Vml drawings are not sorted. Sort to avoid missmatches.
+            _drawings = new RangeCollection(list);
+        }
+        private string CreateVmlDrawings()
+        {
+            string vml=string.Format("<xml xmlns:v=\"{0}\" xmlns:o=\"{1}\" xmlns:x=\"{2}\">", 
+                ExcelPackage.schemaMicrosoftVml, 
+                ExcelPackage.schemaMicrosoftOffice, 
+                ExcelPackage.schemaMicrosoftExcel);
+            
+             vml+="<o:shapelayout v:ext=\"edit\">";
+             vml+="<o:idmap v:ext=\"edit\" data=\"1\"/>";
+             vml+="</o:shapelayout>";
+
+             vml+="<v:shapetype id=\"_x0000_t202\" coordsize=\"21600,21600\" o:spt=\"202\" path=\"m,l,21600r21600,l21600,xe\">";
+             vml+="<v:stroke joinstyle=\"miter\" />";
+             vml+="<v:path gradientshapeok=\"t\" o:connecttype=\"rect\" />";
+             vml+="</v:shapetype>";
+             vml+= "</xml>";
+
+            return vml;
+        }
+        internal ExcelVmlDrawingComment Add(ExcelRangeBase cell)
+        {
+            XmlNode node = AddDrawing(cell);
+            var draw = new ExcelVmlDrawingComment(node, cell, NameSpaceManager);            
+            _drawings.Add(draw);
+            return draw;
+        }
+        private XmlNode AddDrawing(ExcelRangeBase cell)
+        {
+            int row = cell.Start.Row, col = cell.Start.Column;
+            var node = VmlDrawingXml.CreateElement("v", "shape", ExcelPackage.schemaMicrosoftVml);
+
+            var id = ExcelCellBase.GetCellID(cell.Worksheet.SheetID, cell._fromRow, cell._fromCol);
+            var ix = _drawings.IndexOf(id);
+            if (ix < 0 && (~ix < _drawings.Count))
+            {
+                ix = ~ix;
+                var prevDraw = _drawings[ix] as ExcelVmlDrawingBase;
+                prevDraw.TopNode.ParentNode.InsertBefore(node, prevDraw.TopNode);
+            }
+            else
+            {
+                VmlDrawingXml.DocumentElement.AppendChild(node);
+            }
+
+            node.SetAttribute("id", GetNewId());
+            node.SetAttribute("type", "#_x0000_t202");
+            node.SetAttribute("style", "position:absolute;z-index:1; visibility:hidden");
+            //node.SetAttribute("style", "position:absolute; margin-left:59.25pt;margin-top:1.5pt;width:108pt;height:59.25pt;z-index:1; visibility:hidden"); 
+            node.SetAttribute("fillcolor", "#ffffe1");
+            node.SetAttribute("insetmode",ExcelPackage.schemaMicrosoftOffice,"auto");
+
+            string vml = "<v:fill color2=\"#ffffe1\" />";
+            vml += "<v:shadow on=\"t\" color=\"black\" obscured=\"t\" />";
+            vml += "<v:path o:connecttype=\"none\" />";
+            vml += "<v:textbox style=\"mso-direction-alt:auto\">";
+            vml += "<div style=\"text-align:left\" />";
+            vml += "</v:textbox>";
+            vml += "<x:ClientData ObjectType=\"Note\">";
+            vml += "<x:MoveWithCells />";
+            vml += "<x:SizeWithCells />";
+            vml += string.Format("<x:Anchor>{0}, 15, {1}, 2, {2}, 31, {3}, 1</x:Anchor>", col, row - 1, col + 2, row + 3);
+            vml += "<x:AutoFill>False</x:AutoFill>";
+            vml += string.Format("<x:Row>{0}</x:Row>", row - 1); ;
+            vml += string.Format("<x:Column>{0}</x:Column>", col - 1);
+            vml += "</x:ClientData>";
+
+            node.InnerXml = vml;
+            return node;
+        }
+        int _nextID = 0;
+        /// <summary>
+        /// returns the next drawing id.
+        /// </summary>
+        /// <returns></returns>
+        internal string GetNewId()
+        {
+            if (_nextID == 0)
+            {
+                foreach (ExcelVmlDrawingComment draw in this)
+                {
+                    if (draw.Id.Length > 3 && draw.Id.StartsWith("vml"))
+                    {
+                        int id;
+                        if (int.TryParse(draw.Id.Substring(3, draw.Id.Length - 3), out id))
+                        {
+                            if (id > _nextID)
+                            {
+                                _nextID = id;
+                            }
+                        }
+                    }
+                }
+            }
+            _nextID++;
+            return "vml" + _nextID.ToString();
+        }
+        internal ExcelVmlDrawingBase this[ulong rangeID]
+        {
+            get
+            {
+                return _drawings[rangeID] as ExcelVmlDrawingComment;
+            }
+        }
+        internal bool ContainsKey(ulong rangeID)
+        {
+            return _drawings.ContainsKey(rangeID);
+        }
+        internal int Count
+        {
+            get
+            {
+                return _drawings.Count;
+            }
+        }
+        #region IEnumerable Members
+
+        #endregion
+
+        public IEnumerator GetEnumerator()
+        {
+            return _drawings;
+        }
+
+        IEnumerator IEnumerable.GetEnumerator()
+        {
+            return _drawings;
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Vml/ExcelVmlDrawingPicture.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Vml/ExcelVmlDrawingPicture.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Vml/ExcelVmlDrawingPicture.cs	(revision 12707)
@@ -0,0 +1,357 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		Initial Release		        2010-06-01
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Xml;
+using System.Globalization;
+using System.Drawing;
+
+
+namespace OfficeOpenXml.Drawing.Vml
+{
+    /// <summary>
+    /// Drawing object used for header and footer pictures
+    /// </summary>
+    public class ExcelVmlDrawingPicture : ExcelVmlDrawingBase
+    {
+        ExcelWorksheet _worksheet;
+        internal ExcelVmlDrawingPicture(XmlNode topNode, XmlNamespaceManager ns, ExcelWorksheet ws) :
+            base(topNode, ns)
+        {
+            _worksheet = ws;
+        }
+        /// <summary>
+        /// Position ID
+        /// </summary>
+        public string Position
+        {
+            get
+            {
+                return GetXmlNodeString("@id");
+            }
+        }
+        /// <summary>
+        /// The width in points
+        /// </summary>
+        public double Width
+        {
+            get
+            {
+                return GetStyleProp("width");
+            }
+            set
+            {
+                SetStyleProp("width",value.ToString(CultureInfo.InvariantCulture) + "pt");
+            }
+        }
+        /// <summary>
+        /// The height in points
+        /// </summary>
+        public double Height
+        {
+            get
+            {
+                return GetStyleProp("height");
+            }
+            set
+            {
+                SetStyleProp("height", value.ToString(CultureInfo.InvariantCulture) + "pt");
+            }
+        }
+        /// <summary>
+        /// Margin Left in points
+        /// </summary>
+        public double Left
+        {
+            get
+            {
+                return GetStyleProp("left");
+            }
+            set
+            {
+                SetStyleProp("left", value.ToString(CultureInfo.InvariantCulture));
+            }
+        }
+        /// <summary>
+        /// Margin top in points
+        /// </summary>
+        public double Top
+        {
+            get
+            {
+                return GetStyleProp("top");
+            }
+            set
+            {
+                SetStyleProp("top", value.ToString(CultureInfo.InvariantCulture));
+            }
+        }
+        /// <summary>
+        /// The Title of the image
+        /// </summary>
+        public string Title
+        {
+            get
+            {
+                return GetXmlNodeString("v:imagedata/@o:title");
+            }
+            set
+            {
+                SetXmlNodeString("v:imagedata/@o:title",value);
+            }
+        }
+        /// <summary>
+        /// The image
+        /// </summary>
+        public Image Image
+        {
+            get
+            {
+                var pck = _worksheet._package.Package;
+                if (pck.PartExists(ImageUri))
+                {
+                    var part = pck.GetPart(ImageUri);
+                    return Image.FromStream(part.GetStream());
+                }
+                else
+                {
+                    return null;
+                }
+            }
+        }
+        internal Uri ImageUri
+        {
+            get;
+            set;
+        }
+        internal string RelId
+        {
+            get
+            {
+                return GetXmlNodeString("v:imagedata/@o:relid");
+            }
+            set
+            {
+                SetXmlNodeString("v:imagedata/@o:relid",value);
+            }
+        }        
+        /// <summary>
+        /// Determines whether an image will be displayed in black and white
+        /// </summary>
+        public bool BiLevel
+        {
+            get
+            {
+                return GetXmlNodeString("v:imagedata/@bilevel")=="t";
+            }
+            set
+            {
+                if (value)
+                {
+                    SetXmlNodeString("v:imagedata/@bilevel", "t");
+                }
+                else
+                {
+                    DeleteNode("v:imagedata/@bilevel");
+                }
+            }
+        }
+        /// <summary>
+        /// Determines whether a picture will be displayed in grayscale mode
+        /// </summary>
+        public bool GrayScale
+        {
+            get
+            {
+                return GetXmlNodeString("v:imagedata/@grayscale")=="t";
+            }
+            set
+            {
+                if (value)
+                {
+                    SetXmlNodeString("v:imagedata/@grayscale", "t");
+                }
+                else
+                {
+                    DeleteNode("v:imagedata/@grayscale");
+                }
+            }
+        }
+        /// <summary>
+        /// Defines the intensity of all colors in an image
+        /// Default value is 1
+        /// </summary>
+        public double Gain
+        {
+            get
+            {
+                string v = GetXmlNodeString("v:imagedata/@gain");
+                return GetFracDT(v,1);
+            }
+            set
+            {
+                if (value < 0)
+                {
+                    throw (new ArgumentOutOfRangeException("Value must be positive"));
+                }
+                if (value == 1)
+                {
+                    DeleteNode("v:imagedata/@gamma");
+                }
+                else
+                {
+                    SetXmlNodeString("v:imagedata/@gain", value.ToString("#.0#", CultureInfo.InvariantCulture));
+                }
+            }
+        }
+        /// <summary>
+        /// Defines the amount of contrast for an image
+        /// Default value is 0;
+        /// </summary>
+        public double Gamma
+        {
+            get
+            {
+                string v = GetXmlNodeString("v:imagedata/@gamma");
+                return GetFracDT(v,0);
+            }
+            set
+            {
+                if (value == 0) //Default
+                {
+                    DeleteNode("v:imagedata/@gamma");
+                }
+                else
+                {
+                    SetXmlNodeString("v:imagedata/@gamma", value.ToString("#.0#", CultureInfo.InvariantCulture));
+                }
+            }
+        }
+        /// <summary>
+        /// Defines the intensity of black in an image
+        /// Default value is 0
+        /// </summary>
+        public double BlackLevel
+        {
+            get
+            {
+                string v = GetXmlNodeString("v:imagedata/@blacklevel");
+                return GetFracDT(v, 0);
+            }
+            set
+            {
+                if (value == 0)
+                {
+                    DeleteNode("v:imagedata/@blacklevel");
+                }
+                else
+                {
+                    SetXmlNodeString("v:imagedata/@blacklevel", value.ToString("#.0#", CultureInfo.InvariantCulture));
+                }
+            }
+        }
+
+        #region Private Methods
+        private double GetFracDT(string v, double def)
+        {
+            double d;
+            if (v.EndsWith("f"))
+            {
+                v = v.Substring(0, v.Length - 1);
+                if (double.TryParse(v, out d))
+                {
+                    d /= 65535;
+                }
+                else
+                {
+                    d = def;
+                }
+            }
+            else
+            {
+                if (!double.TryParse(v, out d))
+                {
+                    d = def;
+                }
+            }
+            return d;
+        }
+        private void SetStyleProp(string propertyName, string value)
+        {
+            string style = GetXmlNodeString("@style");
+            string newStyle = "";
+            bool found = false;
+            foreach (string prop in style.Split(';'))
+            {
+                string[] split = prop.Split(':');
+                if (split[0] == propertyName)
+                {
+                    newStyle += propertyName + ":" + value + ";";
+                    found = true;
+                }
+                else
+                {
+                    newStyle += prop + ";";
+                }
+            }
+            if (!found)
+            {
+                newStyle += propertyName + ":" + value + ";";
+            }
+            SetXmlNodeString("@style", newStyle.Substring(0, newStyle.Length - 1));
+        }
+        private double GetStyleProp(string propertyName)
+        {
+            string style = GetXmlNodeString("@style");
+            foreach (string prop in style.Split(';'))
+            {
+                string[] split = prop.Split(':');
+                if (split[0] == propertyName && split.Length > 1)
+                {
+                    string value = split[1].EndsWith("pt") ? split[1].Substring(0, split[1].Length - 2) : split[1];
+                    double ret;
+                    if (double.TryParse(value, NumberStyles.Number, CultureInfo.InvariantCulture, out ret))
+                    {
+                        return ret;
+                    }
+                    else
+                    {
+                        return 0;
+                    }
+                }
+            }
+            return 0;
+        }
+        #endregion
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Vml/ExcelVmlDrawingPictureCollection.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Vml/ExcelVmlDrawingPictureCollection.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Vml/ExcelVmlDrawingPictureCollection.cs	(revision 12707)
@@ -0,0 +1,172 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		Initial Release		        2010-06-01
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Xml;
+using System.Collections;
+using System.Globalization;
+using OfficeOpenXml.Utils;
+
+namespace OfficeOpenXml.Drawing.Vml
+{
+    public class ExcelVmlDrawingPictureCollection : ExcelVmlDrawingBaseCollection, IEnumerable
+    {
+        internal List<ExcelVmlDrawingPicture> _images;
+        ExcelPackage _pck;
+        ExcelWorksheet _ws;
+        internal ExcelVmlDrawingPictureCollection(ExcelPackage pck, ExcelWorksheet ws, Uri uri) :
+            base(pck, ws, uri)
+        {            
+            _pck = pck;
+            _ws = ws;
+            if (uri == null)
+            {
+                VmlDrawingXml.LoadXml(CreateVmlDrawings());
+                _images = new List<ExcelVmlDrawingPicture>();
+            }
+            else
+            {
+                AddDrawingsFromXml();
+            }
+        }
+
+        private void AddDrawingsFromXml()
+        {
+            var nodes = VmlDrawingXml.SelectNodes("//v:shape", NameSpaceManager);
+            _images = new List<ExcelVmlDrawingPicture>();
+            foreach (XmlNode node in nodes)
+            {
+                var img = new ExcelVmlDrawingPicture(node, NameSpaceManager, _ws);
+                var rel = Part.GetRelationship(img.RelId);
+                img.ImageUri = UriHelper.ResolvePartUri(rel.SourceUri, rel.TargetUri);
+                _images.Add(img);
+            }
+        }
+
+        private string CreateVmlDrawings()
+        {
+            string vml=string.Format("<xml xmlns:v=\"{0}\" xmlns:o=\"{1}\" xmlns:x=\"{2}\">", 
+                ExcelPackage.schemaMicrosoftVml, 
+                ExcelPackage.schemaMicrosoftOffice, 
+                ExcelPackage.schemaMicrosoftExcel);
+            
+             vml+="<o:shapelayout v:ext=\"edit\">";
+             vml+="<o:idmap v:ext=\"edit\" data=\"1\"/>";
+             vml+="</o:shapelayout>";
+
+             vml+="<v:shapetype id=\"_x0000_t202\" coordsize=\"21600,21600\" o:spt=\"202\" path=\"m,l,21600r21600,l21600,xe\">";
+             vml+="<v:stroke joinstyle=\"miter\" />";
+             vml+="<v:path gradientshapeok=\"t\" o:connecttype=\"rect\" />";
+             vml+="</v:shapetype>";
+             vml+= "</xml>";
+
+            return vml;
+        }
+        internal ExcelVmlDrawingPicture Add(string id, Uri uri, string name, double width, double height)
+        {
+            XmlNode node = AddImage(id, uri, name, width, height);
+            var draw = new ExcelVmlDrawingPicture(node, NameSpaceManager, _ws);
+            draw.ImageUri = uri;
+            _images.Add(draw);
+            return draw;
+        }
+        private XmlNode AddImage(string id, Uri targeUri, string Name, double width, double height)
+        {
+            var node = VmlDrawingXml.CreateElement("v", "shape", ExcelPackage.schemaMicrosoftVml);
+            VmlDrawingXml.DocumentElement.AppendChild(node);
+            node.SetAttribute("id", id);
+            node.SetAttribute("o:type", "#_x0000_t75");
+            node.SetAttribute("style", string.Format("position:absolute;margin-left:0;margin-top:0;width:{0}pt;height:{1}pt;z-index:1", width.ToString(CultureInfo.InvariantCulture), height.ToString(CultureInfo.InvariantCulture)));
+            //node.SetAttribute("fillcolor", "#ffffe1");
+            //node.SetAttribute("insetmode", ExcelPackage.schemaMicrosoftOffice, "auto");
+
+            node.InnerXml = string.Format("<v:imagedata o:relid=\"\" o:title=\"{0}\"/><o:lock v:ext=\"edit\" rotation=\"t\"/>",  Name);
+            return node;
+        }
+        /// <summary>
+        /// Indexer
+        /// </summary>
+        /// <param name="Index">Index</param>
+        /// <returns>The VML Drawing Picture object</returns>
+        public ExcelVmlDrawingPicture this[int Index]
+        {
+            get
+            {
+                return _images[Index] as ExcelVmlDrawingPicture;
+            }
+        }
+        public int Count
+        {
+            get
+            {
+                return _images.Count;
+            }
+        }
+
+        int _nextID = 0;
+        /// <summary>
+        /// returns the next drawing id.
+        /// </summary>
+        /// <returns></returns>
+        internal string GetNewId()
+        {
+            if (_nextID == 0)
+            {
+                foreach (ExcelVmlDrawingComment draw in this)
+                {
+                    if (draw.Id.Length > 3 && draw.Id.StartsWith("vml"))
+                    {
+                        int id;
+                        if (int.TryParse(draw.Id.Substring(3, draw.Id.Length - 3), out id))
+                        {
+                            if (id > _nextID)
+                            {
+                                _nextID = id;
+                            }
+                        }
+                    }
+                }
+            }
+            _nextID++;
+            return "vml" + _nextID.ToString();
+        }
+        #region IEnumerable Members
+
+        IEnumerator IEnumerable.GetEnumerator() 
+        {
+            return _images.GetEnumerator();
+        }
+
+        #endregion
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Vml/ExcelVmlDrawingPosition.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Vml/ExcelVmlDrawingPosition.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Drawing/Vml/ExcelVmlDrawingPosition.cs	(revision 12707)
@@ -0,0 +1,135 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		Initial Release		        2010-06-01
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Xml;
+namespace OfficeOpenXml.Drawing.Vml
+{
+    /// <summary>
+    /// The position of a VML drawing. Used for comments
+    /// </summary>
+    public class ExcelVmlDrawingPosition : XmlHelper
+    {
+        int _startPos;
+        internal ExcelVmlDrawingPosition(XmlNamespaceManager ns, XmlNode topNode, int startPos) : 
+            base(ns, topNode)
+        {
+            _startPos = startPos;
+        }
+        /// <summary>
+        /// Row. Zero based
+        /// </summary>
+        public int Row
+        {
+            get
+            {
+                return GetNumber(2);
+            }
+            set
+            {
+                SetNumber(2, value);
+            } 
+        }
+        /// <summary>
+        /// Row offset in pixels. Zero based
+        /// </summary>
+        public int RowOffset
+        {
+            get
+            {
+                return GetNumber(3);
+            }
+            set
+            {
+                SetNumber(3, value);
+            }
+        }
+        /// <summary>
+        /// Column. Zero based
+        /// </summary>
+        public int Column
+        {
+            get
+            {
+                return GetNumber(0);
+            }
+            set
+            {
+                SetNumber(0, value);
+            }
+        }
+        /// <summary>
+        /// Column offset. Zero based
+        /// </summary>
+        public int ColumnOffset
+        {
+            get
+            {
+                return GetNumber(1);
+            }
+            set
+            {
+                SetNumber(1, value);
+            }
+        }
+        private void SetNumber(int pos, int value)
+        {
+            string anchor = GetXmlNodeString("x:Anchor");
+            string[] numbers = anchor.Split(',');
+            if (numbers.Length == 8)
+            {
+                numbers[_startPos + pos] = value.ToString();
+            }
+            else
+            {
+                throw (new Exception("Anchor element is invalid in vmlDrawing"));
+            }
+            SetXmlNodeString("x:Anchor", string.Join(",",numbers));
+        }
+
+        private int GetNumber(int pos)
+        {
+            string anchor = GetXmlNodeString("x:Anchor");
+            string[] numbers = anchor.Split(',');
+            if (numbers.Length == 8)
+            {
+                int ret;
+                if (int.TryParse(numbers[_startPos + pos], out ret))
+                {
+                    return ret;
+                }
+            }
+            throw(new Exception("Anchor element is invalid in vmlDrawing"));
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/EPPlus-4.0.3.csproj
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/EPPlus-4.0.3.csproj	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/EPPlus-4.0.3.csproj	(revision 12707)
@@ -0,0 +1,864 @@
+﻿<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="12.0">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>9.0.30729</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{832EA4F3-20F7-42D7-B079-B588BA559E5F}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>OfficeOpenXml</RootNamespace>
+    <AssemblyName>EPPlus-4.0.3</AssemblyName>
+    <SignAssembly>true</SignAssembly>
+    <AssemblyOriginatorKeyFile>OpenOfficeXml.snk</AssemblyOriginatorKeyFile>
+    <SccProjectName>
+    </SccProjectName>
+    <SccLocalPath>
+    </SccLocalPath>
+    <SccAuxPath>
+    </SccAuxPath>
+    <SccProvider>
+    </SccProvider>
+    <FileUpgradeFlags>
+    </FileUpgradeFlags>
+    <UpgradeBackupLocation>
+    </UpgradeBackupLocation>
+    <OldToolsVersion>3.5</OldToolsVersion>
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+    <PublishUrl>publish\</PublishUrl>
+    <Install>true</Install>
+    <InstallFrom>Disk</InstallFrom>
+    <UpdateEnabled>false</UpdateEnabled>
+    <UpdateMode>Foreground</UpdateMode>
+    <UpdateInterval>7</UpdateInterval>
+    <UpdateIntervalUnits>Days</UpdateIntervalUnits>
+    <UpdatePeriodically>false</UpdatePeriodically>
+    <UpdateRequired>false</UpdateRequired>
+    <MapFileExtensions>true</MapFileExtensions>
+    <ApplicationRevision>0</ApplicationRevision>
+    <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
+    <IsWebBootstrapper>false</IsWebBootstrapper>
+    <UseApplicationTrust>false</UseApplicationTrust>
+    <BootstrapperEnabled>true</BootstrapperEnabled>
+    <TargetFrameworkProfile>
+    </TargetFrameworkProfile>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <DocumentationFile>
+    </DocumentationFile>
+    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <NoWarn>
+    </NoWarn>
+    <Prefer32Bit>false</Prefer32Bit>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <DocumentationFile>
+    </DocumentationFile>
+    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <Prefer32Bit>false</Prefer32Bit>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>bin\x86\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <DebugType>full</DebugType>
+    <PlatformTarget>x86</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
+    <OutputPath>bin\x86\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <Optimize>true</Optimize>
+    <DebugType>pdbonly</DebugType>
+    <PlatformTarget>x86</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>bin\x64\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <DebugType>full</DebugType>
+    <PlatformTarget>x64</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
+    <OutputPath>bin\x64\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <Optimize>true</Optimize>
+    <DebugType>pdbonly</DebugType>
+    <PlatformTarget>x64</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="PresentationCore" />
+    <Reference Include="PresentationFramework" />
+    <Reference Include="System" />
+    <Reference Include="System.Core">
+      <HintPath>C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Data" />
+    <Reference Include="System.Drawing" />
+    <Reference Include="System.Security" />
+    <Reference Include="System.Xml" />
+    <Reference Include="WindowsBase" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="CellStore.cs" />
+    <Compile Include="ConditionalFormatting\Contracts\IExcelConditionalFormattingAverageGroup.cs" />
+    <Compile Include="ConditionalFormatting\Contracts\IExcelConditionalFormattingBeginsWith.cs" />
+    <Compile Include="ConditionalFormatting\Contracts\IExcelConditionalFormattingBetween.cs" />
+    <Compile Include="ConditionalFormatting\Contracts\IExcelConditionalFormattingColorScaleGroup.cs" />
+    <Compile Include="ConditionalFormatting\Contracts\IExcelConditionalFormattingContainsBlanks.cs" />
+    <Compile Include="ConditionalFormatting\Contracts\IExcelConditionalFormattingContainsErrors.cs" />
+    <Compile Include="ConditionalFormatting\Contracts\IExcelConditionalFormattingContainsText.cs" />
+    <Compile Include="ConditionalFormatting\Contracts\IExcelConditionalFormattingDataBarGroup.cs" />
+    <Compile Include="ConditionalFormatting\Contracts\IExcelConditionalFormattingDuplicateValues.cs" />
+    <Compile Include="ConditionalFormatting\Contracts\IExcelConditionalFormattingEndsWith.cs" />
+    <Compile Include="ConditionalFormatting\Contracts\IExcelConditionalFormattingEqual.cs" />
+    <Compile Include="ConditionalFormatting\Contracts\IExcelConditionalFormattingExpression.cs" />
+    <Compile Include="ConditionalFormatting\Contracts\IExcelConditionalFormattingGreaterThan.cs" />
+    <Compile Include="ConditionalFormatting\Contracts\IExcelConditionalFormattingGreaterThanOrEqual.cs" />
+    <Compile Include="ConditionalFormatting\Contracts\IExcelConditionalFormattingThreeIconSet.cs" />
+    <Compile Include="ConditionalFormatting\Contracts\IExcelConditionalFormattingFourIconSet.cs" />
+    <Compile Include="ConditionalFormatting\Contracts\IExcelConditionalFormattingFiveIconSet.cs" />
+    <Compile Include="ConditionalFormatting\Contracts\IExcelConditionalFormattingIconSetGroup.cs" />
+    <Compile Include="ConditionalFormatting\Contracts\IExcelConditionalFormattingThreeColorScale.cs" />
+    <Compile Include="ConditionalFormatting\Contracts\IExcelConditionalFormattingLessThan.cs" />
+    <Compile Include="ConditionalFormatting\Contracts\IExcelConditionalFormattingLessThanOrEqual.cs" />
+    <Compile Include="ConditionalFormatting\Contracts\IExcelConditionalFormattingNotBetween.cs" />
+    <Compile Include="ConditionalFormatting\Contracts\IExcelConditionalFormattingNotContainsBlanks.cs" />
+    <Compile Include="ConditionalFormatting\Contracts\IExcelConditionalFormattingNotContainsErrors.cs" />
+    <Compile Include="ConditionalFormatting\Contracts\IExcelConditionalFormattingNotContainsText.cs" />
+    <Compile Include="ConditionalFormatting\Contracts\IExcelConditionalFormattingNotEqual.cs" />
+    <Compile Include="ConditionalFormatting\Contracts\IExcelConditionalFormattingStdDevGroup.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="ConditionalFormatting\Contracts\IExcelConditionalFormattingTimePeriodGroup.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="ConditionalFormatting\Contracts\IExcelConditionalFormattingTopBottomGroup.cs" />
+    <Compile Include="ConditionalFormatting\Contracts\IExcelConditionalFormattingTwoColorScale.cs" />
+    <Compile Include="ConditionalFormatting\Contracts\IExcelConditionalFormattingUniqueValues.cs" />
+    <Compile Include="ConditionalFormatting\Contracts\IExcelConditionalFormattingWithFormula.cs" />
+    <Compile Include="ConditionalFormatting\Contracts\IExcelConditionalFormattingWithFormula2.cs" />
+    <Compile Include="ConditionalFormatting\Contracts\IExcelConditionalFormattingWithRank.cs" />
+    <Compile Include="ConditionalFormatting\Contracts\IExcelConditionalFormattingWithReverse.cs" />
+    <Compile Include="ConditionalFormatting\Contracts\IExcelConditionalFormattingWithShowValue.cs" />
+    <Compile Include="ConditionalFormatting\Contracts\IExcelConditionalFormattingWithStdDev.cs" />
+    <Compile Include="ConditionalFormatting\Contracts\IExcelConditionalFormattingWithText.cs" />
+    <Compile Include="ConditionalFormatting\ExcelConditionalFormattingIconDataBarValue.cs" />
+    <Compile Include="ConditionalFormatting\Rules\ExcelConditionalFormattingDataBar.cs" />
+    <Compile Include="ConditionalFormatting\Rules\ExcelConditionalFormattingFiveIconSet.cs" />
+    <Compile Include="ConditionalFormatting\Rules\ExcelConditionalFormattingFourIconSet.cs" />
+    <Compile Include="ConditionalFormatting\Rules\ExcelConditionalFormattingAboveStdDev.cs" />
+    <Compile Include="ConditionalFormatting\Rules\ExcelConditionalFormattingAboveOrEqualAverage.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="ConditionalFormatting\Rules\ExcelConditionalFormattingAverageGroup.cs" />
+    <Compile Include="ConditionalFormatting\Rules\ExcelConditionalFormattingAboveAverage.cs" />
+    <Compile Include="ConditionalFormatting\ExcelConditionalFormattingCollection.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="ConditionalFormatting\ExcelConditionalFormattingOperatorType.cs" />
+    <Compile Include="ConditionalFormatting\ExcelConditionalFormattingRuleFactory.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="ConditionalFormatting\ExcelConditionalFormattingConstants.cs" />
+    <Compile Include="ConditionalFormatting\ExcelConditionalFormattingTimePeriodType.cs" />
+    <Compile Include="ConditionalFormatting\ExcelConditionalFormattingColorScaleValue.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="ConditionalFormatting\ExcelConditionalFormattingEnums.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="ConditionalFormatting\ExcelConditionalFormattingValueObjectType.cs" />
+    <Compile Include="ConditionalFormatting\Rules\ExcelConditionalFormattingBeginsWith.cs" />
+    <Compile Include="ConditionalFormatting\Rules\ExcelConditionalFormattingBelowAverage.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="ConditionalFormatting\Rules\ExcelConditionalFormattingBelowOrEqualAverage.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="ConditionalFormatting\Rules\ExcelConditionalFormattingBelowStdDev.cs" />
+    <Compile Include="ConditionalFormatting\Rules\ExcelConditionalFormattingBetween.cs" />
+    <Compile Include="ConditionalFormatting\Rules\ExcelConditionalFormattingBottom.cs" />
+    <Compile Include="ConditionalFormatting\Rules\ExcelConditionalFormattingBottomPercent.cs" />
+    <Compile Include="ConditionalFormatting\Rules\ExcelConditionalFormattingContainsBlanks.cs" />
+    <Compile Include="ConditionalFormatting\Rules\ExcelConditionalFormattingContainsErrors.cs" />
+    <Compile Include="ConditionalFormatting\Rules\ExcelConditionalFormattingContainsText.cs" />
+    <Compile Include="ConditionalFormatting\Rules\ExcelConditionalFormattingDuplicateValues.cs" />
+    <Compile Include="ConditionalFormatting\Rules\ExcelConditionalFormattingEndsWith.cs" />
+    <Compile Include="ConditionalFormatting\Rules\ExcelConditionalFormattingEqual.cs" />
+    <Compile Include="ConditionalFormatting\Rules\ExcelConditionalFormattingExpression.cs" />
+    <Compile Include="ConditionalFormatting\Rules\ExcelConditionalFormattingGreaterThan.cs" />
+    <Compile Include="ConditionalFormatting\Rules\ExcelConditionalFormattingGreaterThanOrEqual.cs" />
+    <Compile Include="ConditionalFormatting\Rules\ExcelConditionalFormattingLast7Days.cs" />
+    <Compile Include="ConditionalFormatting\Rules\ExcelConditionalFormattingLastMonth.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="ConditionalFormatting\Rules\ExcelConditionalFormattingLastWeek.cs" />
+    <Compile Include="ConditionalFormatting\Rules\ExcelConditionalFormattingLessThan.cs" />
+    <Compile Include="ConditionalFormatting\Rules\ExcelConditionalFormattingLessThanOrEqual.cs" />
+    <Compile Include="ConditionalFormatting\Rules\ExcelConditionalFormattingNextMonth.cs" />
+    <Compile Include="ConditionalFormatting\Rules\ExcelConditionalFormattingNextWeek.cs" />
+    <Compile Include="ConditionalFormatting\Rules\ExcelConditionalFormattingNotBetween.cs" />
+    <Compile Include="ConditionalFormatting\Rules\ExcelConditionalFormattingNotContainsBlanks.cs" />
+    <Compile Include="ConditionalFormatting\Rules\ExcelConditionalFormattingNotContainsErrors.cs" />
+    <Compile Include="ConditionalFormatting\Rules\ExcelConditionalFormattingNotContainsText.cs" />
+    <Compile Include="ConditionalFormatting\Rules\ExcelConditionalFormattingNotEqual.cs" />
+    <Compile Include="ConditionalFormatting\Rules\ExcelConditionalFormattingRule.cs" />
+    <Compile Include="ConditionalFormatting\ExcelConditionalFormattingRuleType.cs" />
+    <Compile Include="ConditionalFormatting\Rules\ExcelConditionalFormattingThisMonth.cs" />
+    <Compile Include="ConditionalFormatting\Rules\ExcelConditionalFormattingThisWeek.cs" />
+    <Compile Include="ConditionalFormatting\Rules\ExcelConditionalFormattingThreeColorScale.cs" />
+    <Compile Include="ConditionalFormatting\Rules\ExcelConditionalFormattingThreeIconSet.cs" />
+    <Compile Include="ConditionalFormatting\Rules\ExcelConditionalFormattingTimePeriodGroup.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="ConditionalFormatting\Rules\ExcelConditionalFormattingToday.cs" />
+    <Compile Include="ConditionalFormatting\Rules\ExcelConditionalFormattingTomorrow.cs" />
+    <Compile Include="ConditionalFormatting\Rules\ExcelConditionalFormattingTop.cs" />
+    <Compile Include="ConditionalFormatting\Rules\ExcelConditionalFormattingTopPercent.cs" />
+    <Compile Include="ConditionalFormatting\Rules\ExcelConditionalFormattingTwoColorScale.cs" />
+    <Compile Include="ConditionalFormatting\Contracts\IExcelConditionalFormattingRule.cs" />
+    <Compile Include="ConditionalFormatting\ExcelConditionalFormattingHelper.cs" />
+    <Compile Include="ConditionalFormatting\Contracts\IRangeConditionalFormatting.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="ConditionalFormatting\RangeConditionalFormatting.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="ConditionalFormatting\Rules\ExcelConditionalFormattingUniqueValues.cs" />
+    <Compile Include="ConditionalFormatting\Rules\ExcelConditionalFormattingYesterday.cs" />
+    <Compile Include="DataValidation\Contracts\IExcelDataValidation.cs" />
+    <Compile Include="DataValidation\Contracts\IExcelDataValidationAny.cs" />
+    <Compile Include="DataValidation\Contracts\IExcelDataValidationCustom.cs" />
+    <Compile Include="DataValidation\Contracts\IExcelDataValidationDateTime.cs" />
+    <Compile Include="DataValidation\Contracts\IExcelDataValidationDecimal.cs" />
+    <Compile Include="DataValidation\Contracts\IExcelDataValidationInt.cs" />
+    <Compile Include="DataValidation\Contracts\IExcelDataValidationList.cs" />
+    <Compile Include="DataValidation\Contracts\IExcelDataValidationTime.cs" />
+    <Compile Include="DataValidation\Contracts\IExcelDataValidationWithFormula.cs" />
+    <Compile Include="DataValidation\Contracts\IExcelDataValidationWithFormula2.cs" />
+    <Compile Include="DataValidation\Contracts\IExcelDataValidationWithOperator.cs" />
+    <Compile Include="DataValidation\ExcelDataValidationAny.cs" />
+    <Compile Include="DataValidation\ExcelDataValidationCustom.cs" />
+    <Compile Include="DataValidation\ExcelDataValidationDateTime.cs" />
+    <Compile Include="DataValidation\ExcelDataValidationFactory.cs" />
+    <Compile Include="DataValidation\ExcelDataValidationTime.cs" />
+    <Compile Include="DataValidation\ExcelDataValidationWithFormula.cs" />
+    <Compile Include="DataValidation\ExcelDataValidationWithFormula2.cs" />
+    <Compile Include="DataValidation\ExcelTime.cs" />
+    <Compile Include="DataValidation\Formulas\Contracts\IExcelDataValidationFormula.cs" />
+    <Compile Include="DataValidation\Formulas\Contracts\IExcelDataValidationFormulaDateTime.cs" />
+    <Compile Include="DataValidation\Formulas\Contracts\IExcelDataValidationFormulaTime.cs" />
+    <Compile Include="DataValidation\Formulas\ExcelDataValidationFormula.cs" />
+    <Compile Include="DataValidation\Formulas\Contracts\IExcelDataValidationFormulaList.cs" />
+    <Compile Include="DataValidation\Formulas\ExcelDataValidationFormulaCustom.cs" />
+    <Compile Include="DataValidation\Formulas\ExcelDataValidationFormulaDateTime.cs" />
+    <Compile Include="DataValidation\Formulas\ExcelDataValidationFormulaList.cs" />
+    <Compile Include="DataValidation\Formulas\Contracts\IExcelDataValidationFormulaWithValue.cs" />
+    <Compile Include="DataValidation\Formulas\Contracts\IExcelDataValidationFormulaDecimal.cs" />
+    <Compile Include="DataValidation\Formulas\Contracts\IExcelDataValidationFormulaInt.cs" />
+    <Compile Include="DataValidation\Formulas\ExcelDataValidationFormulaTime.cs" />
+    <Compile Include="DataValidation\Formulas\ExcelDataValidationFormulaValue.cs" />
+    <Compile Include="DataValidation\Formulas\ExcelDataValidationFormulaDecimal.cs" />
+    <Compile Include="DataValidation\Formulas\ExcelDataValidationFormulaInt.cs" />
+    <Compile Include="DataValidation\ExcelDataValidationOperator.cs" />
+    <Compile Include="DataValidation\ExcelDataValidationWarningStyle.cs" />
+    <Compile Include="DataValidation\ExcelDataValidationDecimal.cs" />
+    <Compile Include="DataValidation\ExcelDataValidationList.cs" />
+    <Compile Include="DataValidation\ExcelDataValidationInt.cs" />
+    <Compile Include="DataValidation\IRangeDataValidation.cs" />
+    <Compile Include="DataValidation\RangeDataValidation.cs" />
+    <Compile Include="Drawing\Chart\ExcelBarChartSerie.cs" />
+    <Compile Include="Drawing\Chart\ExcelSurfaceChartSerie.cs" />
+    <Compile Include="Drawing\Chart\ExcelSurfaceChart.cs" />
+    <Compile Include="Drawing\Chart\ExcelRadarChart.cs" />
+    <Compile Include="Drawing\Chart\ExcelBubbleChartSerie.cs" />
+    <Compile Include="Drawing\Chart\ExcelLineChartSerie.cs" />
+    <Compile Include="Drawing\Chart\ExcelChart.cs" />
+    <Compile Include="Drawing\Chart\ExcelChartCollection.cs" />
+    <Compile Include="Drawing\Chart\ExcelChartTrendline.cs" />
+    <Compile Include="Drawing\Chart\ExcelBubbleChart.cs" />
+    <Compile Include="Drawing\Chart\ExcelChartSurface.cs" />
+    <Compile Include="Drawing\ExcelDrawingBase.cs" />
+    <Compile Include="Drawing\ExcelPicture.cs" />
+    <Compile Include="Drawing\Chart\ExcelRadarChartSerie.cs" />
+    <Compile Include="Drawing\Vml\ExcelVmlDrawingPictureCollection.cs" />
+    <Compile Include="Drawing\Vml\ExcelVmlDrawingCommentCollection.cs" />
+    <Compile Include="Drawing\Vml\ExcelVmlDrawingPicture.cs" />
+    <Compile Include="Drawing\Vml\ExcelVmlDrawingBase.cs" />
+    <Compile Include="Encryption\EncryptionHandler.cs" />
+    <Compile Include="Encryption\EncryptionHeader.cs" />
+    <Compile Include="Encryption\EncryptionInfo.cs" />
+    <Compile Include="Encryption\EncryptionVerifier.cs" />
+    <Compile Include="ExcelBackgroundImage.cs" />
+    <Compile Include="DataValidation\ExcelDataValidation.cs" />
+    <Compile Include="DataValidation\ExcelDataValidationCollection.cs" />
+    <Compile Include="DataValidation\ExcelDataValidationType.cs" />
+    <Compile Include="ExcelEncryption.cs" />
+    <Compile Include="ExcelProtectedRange.cs" />
+    <Compile Include="ExcelProtectedRangeCollection.cs" />
+    <Compile Include="ExcelStyleCollection.cs" />
+    <Compile Include="ExcelColumn.cs" />
+    <Compile Include="Drawing\ExcelDrawings.cs" />
+    <Compile Include="ExcelHeaderFooter.cs" />
+    <Compile Include="ExcelPackage.cs" />
+    <Compile Include="ExcelRange.cs" />
+    <Compile Include="ExcelRow.cs" />
+    <Compile Include="Drawing\ExcelShape.cs" />
+    <Compile Include="ExcelStyles.cs" />
+    <Compile Include="ExcelProtection.cs" />
+    <Compile Include="ExcelTextFormat.cs" />
+    <Compile Include="FormulaParsing\CalculateExtentions.cs" />
+    <Compile Include="FormulaParsing\DependencyChain\DependenyChainFactory.cs" />
+    <Compile Include="FormulaParsing\DependencyChain\DependencyChain.cs" />
+    <Compile Include="FormulaParsing\DependencyChain\FormulaCell.cs" />
+    <Compile Include="FormulaParsing\EpplusExcelDataProvider.cs" />
+    <Compile Include="FormulaParsing\ExcelCalculationOption.cs" />
+    <Compile Include="FormulaParsing\ExcelCell.cs" />
+    <Compile Include="FormulaParsing\ExcelDataProvider.cs" />
+    <Compile Include="FormulaParsing\ExcelUtilities\AddressTranslator.cs" />
+    <Compile Include="FormulaParsing\ExcelUtilities\CellReferenceProvider.cs" />
+    <Compile Include="FormulaParsing\ExcelUtilities\ExcelAddressInfo.cs" />
+    <Compile Include="FormulaParsing\ExcelUtilities\ExcelAddressUtil.cs" />
+    <Compile Include="FormulaParsing\ExcelUtilities\ExcelReferenceType.cs" />
+    <Compile Include="FormulaParsing\ExcelUtilities\FormulaDependencies.cs" />
+    <Compile Include="FormulaParsing\ExcelUtilities\FormulaDependency.cs" />
+    <Compile Include="FormulaParsing\ExcelUtilities\FormulaDependencyFactory.cs" />
+    <Compile Include="FormulaParsing\ExcelUtilities\IndexToAddressTranslator.cs" />
+    <Compile Include="FormulaParsing\ExcelUtilities\LookupValueMatcher.cs" />
+    <Compile Include="FormulaParsing\ExcelUtilities\NumericExpressionEvaluator.cs" />
+    <Compile Include="FormulaParsing\ExcelUtilities\RangeAddress.cs" />
+    <Compile Include="FormulaParsing\ExcelUtilities\RangeAddressFactory.cs" />
+    <Compile Include="FormulaParsing\ExcelUtilities\ValueMatcher.cs" />
+    <Compile Include="FormulaParsing\ExcelUtilities\WildCardValueMatcher.cs" />
+    <Compile Include="FormulaParsing\ExcelValues.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\CompileResultValidator.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\CompileResultValidators.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\CellStateHelper.cs" />
+    <Compile Include="FormulaParsing\Excel\ExcelCellState.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\ArgumentCollectionUtil.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\ArgumentParser.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\ArgumentParserFactory.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\ArgumentParsers.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\BoolArgumentParser.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\BuiltInFunctions.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\CollectionFlattener.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\DateTime\Date.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\DateTime\DateParsingFunction.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\DateTime\DateStringParser.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\DateTime\Day.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\DateTime\Days360.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\DateTime\Edate.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\DateTime\Eomonth.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\DateTime\Hour.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\DateTime\IsoWeekNum.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\DateTime\Weeknum.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\DateTime\Minute.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\DateTime\Month.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\DateTime\Now.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\DateTime\Second.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\DateTime\Time.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\DateTime\TimeBaseFunction.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\DateTime\TimeStringParser.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\DateTime\Today.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\DateTime\Weekday.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\DateTime\Workday.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\DateTime\Year.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\DateTime\Yearfrac.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\DecimalCompileResultValidator.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\DoubleArgumentParser.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\DoubleEnumerableArgConverter.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\ErrorHandlingFunction.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\ExcelFunction.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\FunctionArgument.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\FunctionRepository.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\FunctionsModule.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\HiddenValuesHandlingFunction.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\IFunctionModule.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\IFunctionNameProvider.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Information\ErrorType.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Information\IsBlank.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Information\IsErr.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Information\IsError.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Information\IsEven.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Information\IsLogical.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Information\IsNa.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Information\IsNonText.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Information\IsNumber.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Information\IsOdd.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Information\IsText.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Information\N.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Information\Na.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\IntArgumentParser.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Logical\And.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Logical\False.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Logical\If.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Logical\IfError.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Logical\IfNa.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Logical\Not.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Logical\Or.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Logical\True.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Math\Abs.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Math\Acos.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Math\Acosh.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Math\Asin.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Math\Asinh.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Math\Atan.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Math\Atan2.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Math\Atanh.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Math\Average.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Math\AverageA.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Math\AverageIf.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Math\AverageIfs.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Math\Ceiling.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Math\Cos.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Math\Cosh.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Math\Count.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Math\CountA.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Math\CountBlank.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Math\CountIf.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Math\CountIfs.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Math\Degrees.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Math\Exp.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Math\Fact.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Math\Floor.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Math\Large.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Math\Ln.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Math\Log.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Math\Log10.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Math\MathHelper.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Math\Max.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Math\Maxa.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Math\Median.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Math\Min.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Math\Mina.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Math\Mod.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Math\MultipleRangeCriteriasFunction.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Math\Pi.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Math\Power.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Math\Product.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Math\Quotient.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Math\Rand.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Math\RandBetween.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Math\Round.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Math\Rounddown.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Math\Roundup.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Math\Sign.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Math\Sin.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Math\Sinh.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Math\Small.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Math\Sqrt.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Math\SqrtPi.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Math\Stdev.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Math\StdevP.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Math\Subtotal.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Math\Sum.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Math\SumIf.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Math\SumIfs.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Math\SumProduct.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Math\Sumsq.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Math\Tan.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Math\Tanh.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Math\Trunc.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Math\Var.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Math\VarP.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Numeric\CInt.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\ObjectEnumerableArgConverter.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\RefAndLookup\Address.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\RefAndLookup\ArrayLookupNavigator.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\RefAndLookup\Choose.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\RefAndLookup\Column.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\RefAndLookup\Columns.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\RefAndLookup\ExcelLookupNavigator.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\RefAndLookup\HLookup.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\RefAndLookup\Index.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\RefAndLookup\Indirect.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\RefAndLookup\Lookup.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\RefAndLookup\LookupArguments.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\RefAndLookup\LookupDirection.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\RefAndLookup\LookupFunction.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\RefAndLookup\LookupNavigator.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\RefAndLookup\LookupNavigatorFactory.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\RefAndLookup\Match.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\RefAndLookup\Offset.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\RefAndLookup\Row.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\RefAndLookup\Rows.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\RefAndLookup\VLookup.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Text\CharFunction.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Text\Concatenate.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Text\CStr.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Text\Exact.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Text\Find.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Text\Fixed.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Text\Hyperlink.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Text\Left.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Text\Len.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Text\Lower.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Text\Rept.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Text\Text.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Text\Mid.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Text\Proper.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Text\Replace.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Text\Right.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Text\Substitute.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Text\T.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\Text\Upper.cs" />
+    <Compile Include="FormulaParsing\Excel\Operators\IOperator.cs" />
+    <Compile Include="FormulaParsing\Excel\Operators\Operator.cs" />
+    <Compile Include="FormulaParsing\Excel\Operators\Operators.cs" />
+    <Compile Include="FormulaParsing\Excel\Operators\OperatorsDict.cs" />
+    <Compile Include="FormulaParsing\Exceptions\CircularReferenceException.cs" />
+    <Compile Include="FormulaParsing\Exceptions\ExcelErrorCodes.cs" />
+    <Compile Include="FormulaParsing\Exceptions\ExcelErrorValueException.cs" />
+    <Compile Include="FormulaParsing\Exceptions\UnrecognizedTokenException.cs" />
+    <Compile Include="FormulaParsing\ExpressionGraph\AtomicExpression.cs" />
+    <Compile Include="FormulaParsing\ExpressionGraph\BooleanExpression.cs" />
+    <Compile Include="FormulaParsing\ExpressionGraph\CompileResult.cs" />
+    <Compile Include="FormulaParsing\ExpressionGraph\CompileResultFactory.cs" />
+    <Compile Include="FormulaParsing\ExpressionGraph\CompileStrategy\CompileStrategy.cs" />
+    <Compile Include="FormulaParsing\ExpressionGraph\CompileStrategy\CompileStrategyFactory.cs" />
+    <Compile Include="FormulaParsing\ExpressionGraph\CompileStrategy\DefaultCompileStrategy.cs" />
+    <Compile Include="FormulaParsing\ExpressionGraph\CompileStrategy\ICompileStrategyFactory.cs" />
+    <Compile Include="FormulaParsing\ExpressionGraph\CompileStrategy\StringConcatStrategy.cs" />
+    <Compile Include="FormulaParsing\ExpressionGraph\ExcelErrorExpression.cs" />
+    <Compile Include="FormulaParsing\ExpressionGraph\DataType.cs" />
+    <Compile Include="FormulaParsing\ExpressionGraph\DateExpression.cs" />
+    <Compile Include="FormulaParsing\ExpressionGraph\DecimalExpression.cs" />
+    <Compile Include="FormulaParsing\ExpressionGraph\EnumerableExpression.cs" />
+    <Compile Include="FormulaParsing\ExpressionGraph\ExcelAddressExpression.cs" />
+    <Compile Include="FormulaParsing\ExpressionGraph\Expression.cs" />
+    <Compile Include="FormulaParsing\ExpressionGraph\ExpressionCompiler.cs" />
+    <Compile Include="FormulaParsing\ExpressionGraph\ConstantExpressions.cs" />
+    <Compile Include="FormulaParsing\ExpressionGraph\ExpressionConverter.cs" />
+    <Compile Include="FormulaParsing\ExpressionGraph\ExpressionFactory.cs" />
+    <Compile Include="FormulaParsing\ExpressionGraph\ExpressionGraph.cs" />
+    <Compile Include="FormulaParsing\ExpressionGraph\ExpressionGraphBuilder.cs" />
+    <Compile Include="FormulaParsing\ExpressionGraph\FunctionArgumentExpression.cs" />
+    <Compile Include="FormulaParsing\ExpressionGraph\FunctionCompilers\DefaultCompiler.cs" />
+    <Compile Include="FormulaParsing\ExpressionGraph\FunctionCompilers\ErrorHandlingFunctionCompiler.cs" />
+    <Compile Include="FormulaParsing\ExpressionGraph\FunctionCompilers\FunctionCompiler.cs" />
+    <Compile Include="FormulaParsing\ExpressionGraph\FunctionCompilers\FunctionCompilerFactory.cs" />
+    <Compile Include="FormulaParsing\ExpressionGraph\FunctionCompilers\IfErrorFunctionCompiler.cs" />
+    <Compile Include="FormulaParsing\ExpressionGraph\FunctionCompilers\IfFunctionCompiler.cs" />
+    <Compile Include="FormulaParsing\ExpressionGraph\FunctionCompilers\IfNaFunctionCompiler.cs" />
+    <Compile Include="FormulaParsing\ExpressionGraph\FunctionCompilers\LookupFunctionCompiler.cs" />
+    <Compile Include="FormulaParsing\ExpressionGraph\FunctionExpression.cs" />
+    <Compile Include="FormulaParsing\ExpressionGraph\GroupExpression.cs" />
+    <Compile Include="FormulaParsing\ExpressionGraph\IExpressionCompiler.cs" />
+    <Compile Include="FormulaParsing\ExpressionGraph\IExpressionConverter.cs" />
+    <Compile Include="FormulaParsing\ExpressionGraph\IExpressionFactory.cs" />
+    <Compile Include="FormulaParsing\ExpressionGraph\IExpressionGraphBuilder.cs" />
+    <Compile Include="FormulaParsing\ExpressionGraph\IntegerExpression.cs" />
+    <Compile Include="FormulaParsing\ExpressionGraph\NamedValueExpression.cs" />
+    <Compile Include="FormulaParsing\ExpressionGraph\StringExpression.cs" />
+    <Compile Include="FormulaParsing\FormulaParser.cs" />
+    <Compile Include="FormulaParsing\FormulaParserManager.cs" />
+    <Compile Include="FormulaParsing\Logging\IFormulaParserLogger.cs" />
+    <Compile Include="FormulaParsing\INameValueProvider.cs" />
+    <Compile Include="FormulaParsing\IParsingLifetimeEventHandler.cs" />
+    <Compile Include="FormulaParsing\Excel\Functions\FunctionNameProvider.cs" />
+    <Compile Include="FormulaParsing\LexicalAnalysis\ILexer.cs" />
+    <Compile Include="FormulaParsing\LexicalAnalysis\ISourceCodeTokenizer.cs" />
+    <Compile Include="FormulaParsing\LexicalAnalysis\ISyntacticAnalyzer.cs" />
+    <Compile Include="FormulaParsing\LexicalAnalysis\ITokenFactory.cs" />
+    <Compile Include="FormulaParsing\LexicalAnalysis\ITokenSeparatorProvider.cs" />
+    <Compile Include="FormulaParsing\LexicalAnalysis\Lexer.cs" />
+    <Compile Include="FormulaParsing\LexicalAnalysis\SourceCodeTokenizer.cs" />
+    <Compile Include="FormulaParsing\LexicalAnalysis\SyntacticAnalyzer.cs" />
+    <Compile Include="FormulaParsing\LexicalAnalysis\Token.cs" />
+    <Compile Include="FormulaParsing\LexicalAnalysis\TokenFactory.cs" />
+    <Compile Include="FormulaParsing\LexicalAnalysis\TokenizerContext.cs" />
+    <Compile Include="FormulaParsing\LexicalAnalysis\TokenSeparatorProvider.cs" />
+    <Compile Include="FormulaParsing\LexicalAnalysis\TokenType.cs" />
+    <Compile Include="FormulaParsing\EpplusNameValueProvider.cs" />
+    <Compile Include="FormulaParsing\Logging\LoggerFactory.cs" />
+    <Compile Include="FormulaParsing\Logging\TextFileLogger.cs" />
+    <Compile Include="FormulaParsing\NameValueProvider.cs" />
+    <Compile Include="FormulaParsing\ParsedValue.cs" />
+    <Compile Include="FormulaParsing\ParsingConfiguration.cs" />
+    <Compile Include="FormulaParsing\ParsingContext.cs" />
+    <Compile Include="FormulaParsing\ParsingScope.cs" />
+    <Compile Include="FormulaParsing\ParsingScopes.cs" />
+    <Compile Include="FormulaParsing\Utilities\ArgumentInfo.cs" />
+    <Compile Include="FormulaParsing\Utilities\ExtensionMethods.cs" />
+    <Compile Include="FormulaParsing\Utilities\IdProvider.cs" />
+    <Compile Include="FormulaParsing\Utilities\IntegerIdProvider.cs" />
+    <Compile Include="FormulaParsing\Utilities\RegexConstants.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="FormulaParsing\Utilities\Require.cs" />
+    <Compile Include="Packaging\DotNetZip\ComHelper.cs" />
+    <Compile Include="Packaging\DotNetZip\CRC32.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Packaging\DotNetZip\EncryptionAlgorithm.cs" />
+    <Compile Include="Packaging\DotNetZip\Events.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Packaging\DotNetZip\Exceptions.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Packaging\DotNetZip\ExtractExistingFileAction.cs" />
+    <Compile Include="Packaging\DotNetZip\FileSelector.cs" />
+    <Compile Include="Packaging\DotNetZip\OffsetStream.cs" />
+    <Compile Include="Packaging\DotNetZip\Shared.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Packaging\DotNetZip\WinZipAes.cs" />
+    <Compile Include="Packaging\DotNetZip\ZipConstants.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Packaging\DotNetZip\ZipCrypto.cs" />
+    <Compile Include="Packaging\DotNetZip\ZipDirEntry.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Packaging\DotNetZip\ZipEntry.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Packaging\DotNetZip\ZipEntry.Extract.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Packaging\DotNetZip\ZipEntry.Read.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Packaging\DotNetZip\ZipEntry.Write.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Packaging\DotNetZip\ZipEntrySource.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Packaging\DotNetZip\ZipErrorAction.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Packaging\DotNetZip\ZipFile.AddUpdate.cs" />
+    <Compile Include="Packaging\DotNetZip\ZipFile.Check.cs" />
+    <Compile Include="Packaging\DotNetZip\ZipFile.cs" />
+    <Compile Include="Packaging\DotNetZip\ZipFile.Events.cs" />
+    <Compile Include="Packaging\DotNetZip\ZipFile.Extract.cs" />
+    <Compile Include="Packaging\DotNetZip\ZipFile.Read.cs" />
+    <Compile Include="Packaging\DotNetZip\ZipFile.Save.cs" />
+    <Compile Include="Packaging\DotNetZip\ZipFile.SaveSelfExtractor.cs" />
+    <Compile Include="Packaging\DotNetZip\ZipFile.Selector.cs" />
+    <Compile Include="Packaging\DotNetZip\ZipFile.x-IEnumerable.cs" />
+    <Compile Include="Packaging\DotNetZip\ZipInputStream.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Packaging\DotNetZip\ZipOutputStream.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Packaging\DotNetZip\ZipSegmentedStream.cs" />
+    <Compile Include="Packaging\DotNetZip\Zlib\Deflate.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Packaging\DotNetZip\Zlib\DeflateStream.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Packaging\DotNetZip\Zlib\GZipStream.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Packaging\DotNetZip\Zlib\Inflate.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Packaging\DotNetZip\Zlib\InfTree.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Packaging\DotNetZip\Zlib\ParallelDeflateOutputStream.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Packaging\DotNetZip\Zlib\Tree.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Packaging\DotNetZip\Zlib\Zlib.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Packaging\DotNetZip\Zlib\ZlibBaseStream.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Packaging\DotNetZip\Zlib\ZlibCodec.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Packaging\DotNetZip\Zlib\ZlibConstants.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Packaging\DotNetZip\Zlib\ZlibStream.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="RangeCollection.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Utils\ConvertUtil.cs" />
+    <Compile Include="Utils\UriHelper.cs" />
+    <Compile Include="Packaging\ZipPackage.cs" />
+    <Compile Include="VBA\ExcelVbaModule.cs" />
+    <Compile Include="VBA\ExcelVbaModuleAttribute.cs" />
+    <Compile Include="VBA\ExcelVbaModuleCollection.cs" />
+    <Compile Include="VBA\ExcelVbaProject.cs" />
+    <Compile Include="ExcelWorkbookView.cs" />
+    <Compile Include="ExcelWorksheetView.cs" />
+    <Compile Include="Style\Dxf\DxfStyleBase.cs" />
+    <Compile Include="Style\Dxf\ExcelDxfBorder.cs" />
+    <Compile Include="Style\Dxf\ExcelDxfBorderItem.cs" />
+    <Compile Include="Style\Dxf\ExcelDxfColor.cs" />
+    <Compile Include="Style\Dxf\ExcelDxfFill.cs" />
+    <Compile Include="Style\Dxf\ExcelDxfFontBase.cs" />
+    <Compile Include="Style\Dxf\ExcelDxfNumberFormat.cs" />
+    <Compile Include="Style\Dxf\ExcelDxfStyle.cs" />
+    <Compile Include="Style\ExcelGradientFill.cs" />
+    <Compile Include="Style\XmlAccess\ExcelGradientFillXml.cs" />
+    <Compile Include="Table\PivotTable\ExcelPivotTableFieldGroup.cs" />
+    <Compile Include="Table\PivotTable\ExcelPivotTableFieldItem.cs" />
+    <Compile Include="Table\PivotTable\ExcelPivotTablePageFieldSettings.cs" />
+    <Compile Include="Table\PivotTable\ExcelPivotTableDataField.cs" />
+    <Compile Include="Table\PivotTable\ExcelPivotTableFieldCollection.cs" />
+    <Compile Include="Style\IStyle.cs" />
+    <Compile Include="OfficeProperties.cs" />
+    <Compile Include="ExcelWorkbook.cs" />
+    <Compile Include="ExcelWorksheet.cs" />
+    <Compile Include="ExcelWorksheets.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="Style\XmlAccess\ExcelBorderXml.cs" />
+    <Compile Include="Style\XmlAccess\ExcelBorderItemXml.cs" />
+    <Compile Include="Style\XmlAccess\ExcelXfsXml.cs" />
+    <Compile Include="Style\XmlAccess\ExcelNamedStyleXml.cs" />
+    <Compile Include="Style\XmlAccess\ExcelColorXml.cs" />
+    <Compile Include="Style\XmlAccess\ExcelFillXml.cs" />
+    <Compile Include="Style\XmlAccess\ExcelFontXml.cs" />
+    <Compile Include="Style\XmlAccess\ExcelNumberFormatXml.cs" />
+    <Compile Include="Style\StyleChangeEventArgs.cs" />
+    <Compile Include="Table\PivotTable\ExcelPivotCacheDefinition.cs" />
+    <Compile Include="Table\PivotTable\ExcelPivotTableField.cs" />
+    <Compile Include="Table\PivotTable\ExcelPivotTableCollection.cs" />
+    <Compile Include="Table\PivotTable\ExcelPivotTable.cs" />
+    <Compile Include="Table\ExcelTableColumnCollection.cs" />
+    <Compile Include="Table\ExcelTable.cs" />
+    <Compile Include="Table\ExcelTableCollection.cs" />
+    <Compile Include="Table\ExcelTableColumn.cs" />
+    <Compile Include="Utils\AddressUtility.cs" />
+    <Compile Include="Utils\Argument.cs" />
+    <Compile Include="Utils\ArgumentExtensions.cs" />
+    <Compile Include="Utils\CompoundDocument.cs" />
+    <Compile Include="Utils\IArgument.cs" />
+    <Compile Include="Utils\Require.cs" />
+    <Compile Include="Utils\SqRefUtility.cs" />
+    <Compile Include="VBA\ExcelVbaProtection.cs" />
+    <Compile Include="VBA\ExcelVbaReference.cs" />
+    <Compile Include="VBA\ExcelVbaSignature.cs" />
+    <Compile Include="XmlHelper.cs" />
+    <Compile Include="XmlHelperFactory.cs" />
+    <Compile Include="Packaging\ZipPackagePart.cs" />
+    <Compile Include="Packaging\ZipPackageRelationship.cs" />
+    <Compile Include="Packaging\ZipPackageRelationshipCollection.cs" />
+    <Compile Include="Packaging\ZipPackageRelationshipBase.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Drawing\Chart\ExcelLineChart.cs" />
+    <Compile Include="Drawing\Vml\ExcelVmlDrawingComment.cs" />
+    <Compile Include="Drawing\Vml\ExcelVmlDrawingPosition.cs" />
+    <Compile Include="Drawing\Vml\ExcelVmlDrawingBaseCollection.cs" />
+    <Compile Include="ExcelAddress.cs" />
+    <Compile Include="ExcelCellAddress.cs" />
+    <Compile Include="ExcelComment.cs" />
+    <Compile Include="ExcelCommentCollection.cs" />
+    <Compile Include="ExcelSheetProtection.cs" />
+    <Compile Include="Drawing\Chart\ExcelChartLegend.cs" />
+    <Compile Include="Drawing\Chart\ExcelChartPlotArea.cs" />
+    <Compile Include="Drawing\Chart\ExcelChartSerieDataLabel.cs" />
+    <Compile Include="Drawing\Chart\ExcelScatterChartSerie.cs" />
+    <Compile Include="Drawing\Chart\ExcelChartTitle.cs" />
+    <Compile Include="Drawing\ExcelDrawingBorder.cs" />
+    <Compile Include="Drawing\Chart\ExcelOfPieChart.cs" />
+    <Compile Include="Drawing\ExcelDrawingFill.cs" />
+    <Compile Include="Drawing\Chart\ExcelPieChartSerie.cs" />
+    <Compile Include="Drawing\ExcelView3D.cs" />
+    <Compile Include="Drawing\Chart\ExcelBarChart.cs" />
+    <Compile Include="Drawing\Chart\ExcelChartAxis.cs" />
+    <Compile Include="Drawing\Chart\ExcelChartDataLabel.cs" />
+    <Compile Include="Drawing\Chart\ExcelChartSerie.cs" />
+    <Compile Include="Drawing\Chart\ExcelChartSeries.cs" />
+    <Compile Include="Drawing\Chart\ExcelDoughnutChart.cs" />
+    <Compile Include="Drawing\Chart\ExcelPieChart.cs" />
+    <Compile Include="Drawing\Chart\ExcelScatterChart.cs" />
+    <Compile Include="ExcelCellBase.cs" />
+    <Compile Include="ExcelHyperLink.cs" />
+    <Compile Include="ExcelNamedRange.cs" />
+    <Compile Include="ExcelNamedRangeCollection.cs" />
+    <Compile Include="ExcelPrinterSettings.cs" />
+    <Compile Include="ExcelRangeBase.cs" />
+    <Compile Include="IRangeID.cs" />
+    <Compile Include="Style\ExcelParagraph.cs" />
+    <Compile Include="Style\ExcelParagraphCollection.cs" />
+    <Compile Include="Style\ExcelBorder.cs" />
+    <Compile Include="Style\ExcelBorderItem.cs" />
+    <Compile Include="Style\ExcelColor.cs" />
+    <Compile Include="Style\ExcelFill.cs" />
+    <Compile Include="Style\ExcelRichText.cs" />
+    <Compile Include="Style\ExcelRichTextCollection.cs" />
+    <Compile Include="Utils\IExcelCell.cs" />
+    <Compile Include="Style\ExcelStyle.cs" />
+    <Compile Include="Style\ExcelFont.cs" />
+    <Compile Include="Style\XmlAccess\StyleXmlHelper.cs" />
+    <Compile Include="Style\ExcelNumberFormat.cs" />
+    <Compile Include="Style\StyleBase.cs" />
+    <Compile Include="Style\ExcelTextFont.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="OpenOfficeXml.snk" />
+  </ItemGroup>
+  <ItemGroup>
+    <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
+      <Visible>False</Visible>
+      <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
+      <Install>false</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
+      <Visible>False</Visible>
+      <ProductName>.NET Framework 3.5 SP1</ProductName>
+      <Install>true</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
+      <Visible>False</Visible>
+      <ProductName>Windows Installer 3.1</ProductName>
+      <Install>true</Install>
+    </BootstrapperPackage>
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="ConditionalFormatting\CF Implementation.cs" />
+  </ItemGroup>
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+  <PropertyGroup>
+    <PostBuildEvent>
+    </PostBuildEvent>
+    <PreBuildEvent>
+    </PreBuildEvent>
+  </PropertyGroup>
+</Project>
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Encryption/EncryptionHandler.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Encryption/EncryptionHandler.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Encryption/EncryptionHandler.cs	(revision 12707)
@@ -0,0 +1,1001 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		    Added       		        2013-01-05
+ *******************************************************************************/
+using OfficeOpenXml.Utils;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices;
+using System.Security;
+using System.Security.Cryptography;
+using System.Text;
+using System.Xml;
+using comTypes = System.Runtime.InteropServices.ComTypes;
+
+namespace OfficeOpenXml.Encryption
+{
+
+    /// <summary>
+    /// Handels encrypted Excel documents 
+    /// </summary>
+    internal class EncryptedPackageHandler
+    {
+#if !MONO
+        /// <summary>
+        /// Read the package from the OLE document and decrypt it using the supplied password
+        /// </summary>
+        /// <param name="fi">The file</param>
+        /// <param name="encryption"></param>
+        /// <returns></returns>
+        internal MemoryStream DecryptPackage(FileInfo fi, ExcelEncryption encryption)
+        {
+            CompoundDocument doc = new CompoundDocument(fi);
+            
+            MemoryStream ret = null;
+            if (CompoundDocument.IsStorageFile(fi.FullName) == 0)
+            {
+                ret = GetStreamFromPackage(doc, encryption);
+            }
+            else
+            {
+                throw (new InvalidDataException(string.Format("File {0} is not an encrypted package", fi.FullName)));
+            }
+            return ret;
+        }
+
+        //Helpmethod to output the streams in the storage
+        //private void WriteDoc(CompoundDocument.StoragePart storagePart, string p)
+        //{
+        //    foreach (var store in storagePart.SubStorage)
+        //    {
+        //        string sdir=p + store.Key.Replace((char)6,'x') + "\\";
+        //        Directory.CreateDirectory(sdir);
+        //        WriteDoc(store.Value, sdir);
+        //    }
+        //    foreach (var str in storagePart.DataStreams)
+        //    {
+        //        File.WriteAllBytes(p + str.Key.Replace((char)6, 'x') + ".bin", str.Value);
+        //    }
+        //}
+        /// <summary>
+        /// Read the package from the OLE document and decrypt it using the supplied password
+        /// </summary>
+        /// <param name="stream">The memory stream. </param>
+        /// <param name="encryption">The encryption object from the Package</param>
+        /// <returns></returns>
+        [SecuritySafeCritical]
+        internal MemoryStream DecryptPackage(MemoryStream stream, ExcelEncryption encryption)
+        {
+            //Create the lockBytes object.
+            CompoundDocument.ILockBytes lb=null;
+            try
+            {
+                lb = CompoundDocument.GetLockbyte(stream);
+
+                if (CompoundDocument.IsStorageILockBytes(lb) == 0)
+                {
+                    var doc = new CompoundDocument(lb);
+                    return GetStreamFromPackage(doc, encryption);
+                }
+                else
+                {
+                    Marshal.ReleaseComObject(lb);
+                    throw (new InvalidDataException("The stream is not an valid/supported encrypted document."));
+                }
+            }
+            catch// (Exception ex)
+            {                
+                throw;
+            }
+            finally
+            {
+                Marshal.ReleaseComObject(lb);
+                lb = null;
+            }
+
+        }
+        /// <summary>
+        /// Encrypts a package
+        /// </summary>
+        /// <param name="package">The package as a byte array</param>
+        /// <param name="encryption">The encryption info from the workbook</param>
+        /// <returns></returns>
+        internal MemoryStream EncryptPackage(byte[] package, ExcelEncryption encryption)
+        {
+            if (encryption.Version == EncryptionVersion.Standard) //Standard encryption
+            {
+                return EncryptPackageBinary(package, encryption);
+            }
+            else if (encryption.Version == EncryptionVersion.Agile) //Agile encryption
+            {
+                return EncryptPackageAgile(package, encryption);
+            }
+            throw(new ArgumentException("Unsupported encryption version."));
+        }
+
+        private MemoryStream EncryptPackageAgile(byte[] package, ExcelEncryption encryption)
+        {
+            var xml= "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\r\n";
+            xml += "<encryption xmlns=\"http://schemas.microsoft.com/office/2006/encryption\" xmlns:p=\"http://schemas.microsoft.com/office/2006/keyEncryptor/password\" xmlns:c=\"http://schemas.microsoft.com/office/2006/keyEncryptor/certificate\">";
+            xml += "<keyData saltSize=\"16\" blockSize=\"16\" keyBits=\"256\" hashSize=\"64\" cipherAlgorithm=\"AES\" cipherChaining=\"ChainingModeCBC\" hashAlgorithm=\"SHA512\" saltValue=\"\"/>";
+            xml += "<dataIntegrity encryptedHmacKey=\"\" encryptedHmacValue=\"\"/>";
+            xml += "<keyEncryptors>";
+            xml += "<keyEncryptor uri=\"http://schemas.microsoft.com/office/2006/keyEncryptor/password\">";
+            xml += "<p:encryptedKey spinCount=\"100000\" saltSize=\"16\" blockSize=\"16\" keyBits=\"256\" hashSize=\"64\" cipherAlgorithm=\"AES\" cipherChaining=\"ChainingModeCBC\" hashAlgorithm=\"SHA512\" saltValue=\"\" encryptedVerifierHashInput=\"\" encryptedVerifierHashValue=\"\" encryptedKeyValue=\"\" />";
+            xml += "</keyEncryptor></keyEncryptors></encryption>";
+            
+            var encryptionInfo = new EncryptionInfoAgile();
+            encryptionInfo.ReadFromXml(xml);
+            var encr = encryptionInfo.KeyEncryptors[0];
+            var rnd = RandomNumberGenerator.Create();
+            
+            var s = new byte[16];
+            rnd.GetBytes(s);
+            encryptionInfo.KeyData.SaltValue = s;
+
+            rnd.GetBytes(s);
+            encr.SaltValue = s;
+
+            encr.KeyValue = new byte[encr.KeyBits / 8];
+            rnd.GetBytes(encr.KeyValue);
+
+            //Get the passwork key.
+            var hashProvider = GetHashProvider(encryptionInfo.KeyEncryptors[0]);
+            var baseHash = GetPasswordHash(hashProvider, encr.SaltValue, encryption.Password, encr.SpinCount, encr.HashSize);
+            var hashFinal = GetFinalHash(hashProvider, encr, BlockKey_KeyValue, baseHash);
+            hashFinal = FixHashSize(hashFinal, encr.KeyBits / 8);
+
+            var encrData = EncryptDataAgile(package, encryptionInfo, hashProvider);
+
+            /**** Data Integrity ****/
+            var saltHMAC=new byte[64];
+            rnd.GetBytes(saltHMAC);
+
+            SetHMAC(encryptionInfo,hashProvider,saltHMAC, encrData);
+
+            /**** Verifier ****/
+            encr.VerifierHashInput = new byte[16];
+            rnd.GetBytes(encr.VerifierHashInput);
+
+            encr.VerifierHash = hashProvider.ComputeHash(encr.VerifierHashInput);
+
+            var VerifierInputKey = GetFinalHash(hashProvider, encr, BlockKey_HashInput, baseHash);
+            var VerifierHashKey = GetFinalHash(hashProvider, encr, BlockKey_HashValue, baseHash);
+            var KeyValueKey = GetFinalHash(hashProvider, encr, BlockKey_KeyValue, baseHash);
+
+            var ms = new MemoryStream();
+            EncryptAgileFromKey(encr, VerifierInputKey, encr.VerifierHashInput, 0, encr.VerifierHashInput.Length, encr.SaltValue, ms);
+            encr.EncryptedVerifierHashInput = ms.ToArray();
+
+            ms = new MemoryStream(); 
+            EncryptAgileFromKey(encr, VerifierHashKey, encr.VerifierHash, 0, encr.VerifierHash.Length, encr.SaltValue, ms);
+            encr.EncryptedVerifierHash = ms.ToArray();
+
+            ms = new MemoryStream();
+            EncryptAgileFromKey(encr, KeyValueKey, encr.KeyValue, 0, encr.KeyValue.Length, encr.SaltValue, ms);
+            encr.EncryptedKeyValue = ms.ToArray();
+
+            xml = encryptionInfo.Xml.OuterXml;
+
+            var byXml = Encoding.UTF8.GetBytes(xml);
+            
+            ms = new MemoryStream();
+            ms.Write(BitConverter.GetBytes((ushort)4), 0, 2); //Major Version
+            ms.Write(BitConverter.GetBytes((ushort)4), 0, 2); //Minor Version
+            ms.Write(BitConverter.GetBytes((uint)0x40), 0, 4); //Reserved
+            ms.Write(byXml,0,byXml.Length);
+
+            var doc = new CompoundDocument();
+            
+            //Add the dataspace streams
+            CreateDataSpaces(doc);
+            //EncryptionInfo...
+            doc.Storage.DataStreams.Add("EncryptionInfo", ms.ToArray());
+            //...and the encrypted package
+            doc.Storage.DataStreams.Add("EncryptedPackage", encrData);
+
+            ms = new MemoryStream();
+            var e=doc.Save();
+            ms.Write(e,0,e.Length);
+            return ms;
+        }
+
+        private byte[] EncryptDataAgile(byte[] data, EncryptionInfoAgile encryptionInfo, HashAlgorithm hashProvider)
+        {
+            var ke = encryptionInfo.KeyEncryptors[0];
+            RijndaelManaged aes = new RijndaelManaged();
+            aes.KeySize = ke.KeyBits;
+            aes.Mode = CipherMode.CBC;
+            aes.Padding = PaddingMode.Zeros;
+
+            int pos=0;
+            int segment=0;
+
+            //Encrypt the data
+            var ms = new MemoryStream();
+            ms.Write(BitConverter.GetBytes(data.LongLength), 0, 8);
+            while (pos < data.Length)
+            {
+                var segmentSize = (int)(data.Length - pos > 4096 ? 4096 : data.Length - pos);
+                
+                var ivTmp = new byte[4 + encryptionInfo.KeyData.SaltSize];
+                Array.Copy(encryptionInfo.KeyData.SaltValue, 0, ivTmp, 0, encryptionInfo.KeyData.SaltSize);
+                Array.Copy(BitConverter.GetBytes(segment), 0, ivTmp, encryptionInfo.KeyData.SaltSize, 4);
+                var iv=hashProvider.ComputeHash(ivTmp);
+
+                EncryptAgileFromKey(ke, ke.KeyValue, data, pos, segmentSize, iv, ms);
+                pos += segmentSize;
+                segment++;
+            }
+            ms.Flush();
+            return ms.ToArray();
+        }
+        // Set the dataintegrity
+        private void SetHMAC(EncryptionInfoAgile ei, HashAlgorithm hashProvider, byte[] salt, byte[] data)
+        {
+            var iv = GetFinalHash(hashProvider, ei.KeyEncryptors[0], BlockKey_HmacKey, ei.KeyData.SaltValue);
+            var ms = new MemoryStream();
+            EncryptAgileFromKey(ei.KeyEncryptors[0], ei.KeyEncryptors[0].KeyValue, salt, 0L, salt.LongLength, iv, ms);
+            ei.DataIntegrity.EncryptedHmacKey = ms.ToArray();
+            
+            var h = GetHmacProvider(ei.KeyEncryptors[0], salt);
+            var hmacValue = h.ComputeHash(data);
+
+            ms = new MemoryStream();
+            iv = GetFinalHash(hashProvider, ei.KeyEncryptors[0], BlockKey_HmacValue, ei.KeyData.SaltValue);
+            EncryptAgileFromKey(ei.KeyEncryptors[0], ei.KeyEncryptors[0].KeyValue, hmacValue, 0L, hmacValue.LongLength, iv, ms);
+            ei.DataIntegrity.EncryptedHmacValue = ms.ToArray();
+        }
+
+        private HMAC GetHmacProvider(EncryptionInfoAgile.EncryptionKeyEncryptor ei, byte[] salt)
+        {
+            switch (ei.HashAlgorithm)
+            {
+                case eHashAlogorithm.RIPEMD160:
+                    return new HMACRIPEMD160(salt);
+                case eHashAlogorithm.MD5:
+                    return new HMACMD5(salt);              
+                case eHashAlogorithm.SHA1:
+                    return new HMACSHA1(salt);
+                case eHashAlogorithm.SHA256:
+                    return new HMACSHA256(salt);
+                case eHashAlogorithm.SHA384:
+                    return new HMACSHA384(salt);
+                case eHashAlogorithm.SHA512:
+                    return new HMACSHA512(salt);
+                default:
+                    throw(new NotSupportedException(string.Format("Hash method {0} not supported.",ei.HashAlgorithm)));
+            }
+        }
+
+        private MemoryStream EncryptPackageBinary(byte[] package, ExcelEncryption encryption)
+        {
+            byte[] encryptionKey;
+            //Create the Encryption Info. This also returns the Encryptionkey
+            var encryptionInfo = CreateEncryptionInfo(encryption.Password,
+                    encryption.Algorithm == EncryptionAlgorithm.AES128 ?
+                        AlgorithmID.AES128 :
+                    encryption.Algorithm == EncryptionAlgorithm.AES192 ?
+                        AlgorithmID.AES192 :
+                        AlgorithmID.AES256, out encryptionKey);
+
+            //ILockBytes lb;
+            //var iret = CreateILockBytesOnHGlobal(IntPtr.Zero, true, out lb);
+
+            //IStorage storage = null;
+            //MemoryStream ret = null;
+
+            var doc = new CompoundDocument();
+            CreateDataSpaces(doc);
+
+            doc.Storage.DataStreams.Add("EncryptionInfo", encryptionInfo.WriteBinary());
+            
+            //Encrypt the package
+            byte[] encryptedPackage = EncryptData(encryptionKey, package, false);
+            MemoryStream ms = new MemoryStream();
+            ms.Write(BitConverter.GetBytes((ulong)package.LongLength), 0, 8);
+            ms.Write(encryptedPackage, 0, encryptedPackage.Length);
+            doc.Storage.DataStreams.Add("EncryptedPackage", ms.ToArray());
+
+            var ret = new MemoryStream();                
+            var buffer = doc.Save();
+            ret.Write(buffer, 0, buffer.Length);
+
+            return ret;
+        }
+        #region "Dataspaces Stream methods"
+        private void CreateDataSpaces(CompoundDocument doc)
+        {
+            var ds = new CompoundDocument.StoragePart();
+            doc.Storage.SubStorage.Add("\x06" + "DataSpaces", ds);
+            var ver=new CompoundDocument.StoragePart();
+            ds.DataStreams.Add("Version", CreateVersionStream());
+            ds.DataStreams.Add("DataSpaceMap", CreateDataSpaceMap());
+            
+            var dsInfo=new CompoundDocument.StoragePart();
+            ds.SubStorage.Add("DataSpaceInfo", dsInfo);
+            dsInfo.DataStreams.Add("StrongEncryptionDataSpace", CreateStrongEncryptionDataSpaceStream());
+            
+            var transInfo=new CompoundDocument.StoragePart();
+            ds.SubStorage.Add("TransformInfo", transInfo);
+
+            var strEncTrans=new CompoundDocument.StoragePart();
+            transInfo.SubStorage.Add("StrongEncryptionTransform", strEncTrans);
+            
+            strEncTrans.DataStreams.Add("\x06Primary", CreateTransformInfoPrimary());
+        }
+        private byte[] CreateStrongEncryptionDataSpaceStream()
+        {
+            MemoryStream ms = new MemoryStream();
+            BinaryWriter bw = new BinaryWriter(ms);
+
+            bw.Write((int)8);       //HeaderLength
+            bw.Write((int)1);       //EntryCount
+
+            string tr = "StrongEncryptionTransform";
+            bw.Write((int)tr.Length*2);
+            bw.Write(UTF8Encoding.Unicode.GetBytes(tr + "\0")); // end \0 is for padding
+
+            bw.Flush();
+            return ms.ToArray();
+        }
+        private byte[] CreateVersionStream()
+        {
+            MemoryStream ms = new MemoryStream();
+            BinaryWriter bw = new BinaryWriter(ms);
+
+            bw.Write((short)0x3C);  //Major
+            bw.Write((short)0);     //Minor
+            bw.Write(UTF8Encoding.Unicode.GetBytes("Microsoft.Container.DataSpaces"));
+            bw.Write((int)1);       //ReaderVersion
+            bw.Write((int)1);       //UpdaterVersion
+            bw.Write((int)1);       //WriterVersion
+
+            bw.Flush();
+            return ms.ToArray();
+        }
+        private byte[] CreateDataSpaceMap()
+        {
+            MemoryStream ms = new MemoryStream();
+            BinaryWriter bw = new BinaryWriter(ms);
+
+            bw.Write((int)8);       //HeaderLength
+            bw.Write((int)1);       //EntryCount
+            string s1 = "EncryptedPackage";
+            string s2 = "StrongEncryptionDataSpace";
+            bw.Write((int)(s1.Length + s2.Length)*2 + 0x16);
+            bw.Write((int)1);       //ReferenceComponentCount
+            bw.Write((int)0);       //Stream=0
+            bw.Write((int)s1.Length * 2); //Length s1
+            bw.Write(UTF8Encoding.Unicode.GetBytes(s1));
+            bw.Write((int)(s2.Length * 2));   //Length s2
+            bw.Write(UTF8Encoding.Unicode.GetBytes(s2 + "\0"));   // end \0 is for padding
+
+            bw.Flush();
+            return ms.ToArray();
+        }
+        private byte[] CreateTransformInfoPrimary()
+        {
+            MemoryStream ms = new MemoryStream();
+            BinaryWriter bw = new BinaryWriter(ms);
+            string TransformID = "{FF9A3F03-56EF-4613-BDD5-5A41C1D07246}";
+            string TransformName = "Microsoft.Container.EncryptionTransform";
+            bw.Write(TransformID.Length * 2 + 12);
+            bw.Write((int)1);
+            bw.Write(TransformID.Length * 2);
+            bw.Write(UTF8Encoding.Unicode.GetBytes(TransformID));
+            bw.Write(TransformName.Length * 2);
+            bw.Write(UTF8Encoding.Unicode.GetBytes(TransformName + "\0"));
+            bw.Write((int)1);   //ReaderVersion
+            bw.Write((int)1);   //UpdaterVersion
+            bw.Write((int)1);   //WriterVersion
+
+            bw.Write((int)0);
+            bw.Write((int)0);
+            bw.Write((int)0);       //CipherMode
+            bw.Write((int)4);       //Reserved
+
+            bw.Flush();
+            return ms.ToArray();
+        }
+        #endregion
+        /// <summary>
+        /// Create an EncryptionInfo object to encrypt a workbook
+        /// </summary>
+        /// <param name="password">The password</param>
+        /// <param name="algID"></param>
+        /// <param name="key">The Encryption key</param>
+        /// <returns></returns>
+        private EncryptionInfoBinary CreateEncryptionInfo(string password, AlgorithmID algID, out byte[] key)
+        {
+            if (algID == AlgorithmID.Flags || algID == AlgorithmID.RC4)
+            {
+                throw (new ArgumentException("algID must be AES128, AES192 or AES256"));
+            }
+            var encryptionInfo = new EncryptionInfoBinary();
+            encryptionInfo.MajorVersion = 4;
+            encryptionInfo.MinorVersion = 2;
+            encryptionInfo.Flags = Flags.fAES | Flags.fCryptoAPI;
+
+            //Header
+            encryptionInfo.Header = new EncryptionHeader();
+            encryptionInfo.Header.AlgID = algID;
+            encryptionInfo.Header.AlgIDHash = AlgorithmHashID.SHA1;
+            encryptionInfo.Header.Flags = encryptionInfo.Flags;
+            encryptionInfo.Header.KeySize =
+                (algID == AlgorithmID.AES128 ? 0x80 : algID == AlgorithmID.AES192 ? 0xC0 : 0x100);
+            encryptionInfo.Header.ProviderType = ProviderType.AES;
+            encryptionInfo.Header.CSPName = "Microsoft Enhanced RSA and AES Cryptographic Provider\0";
+            encryptionInfo.Header.Reserved1 = 0;
+            encryptionInfo.Header.Reserved2 = 0;
+            encryptionInfo.Header.SizeExtra = 0;
+
+            //Verifier
+            encryptionInfo.Verifier = new EncryptionVerifier();
+            encryptionInfo.Verifier.Salt = new byte[16];
+
+            var rnd = RandomNumberGenerator.Create();
+            rnd.GetBytes(encryptionInfo.Verifier.Salt);
+            encryptionInfo.Verifier.SaltSize = 0x10;
+
+            key = GetPasswordHashBinary(password, encryptionInfo);
+
+            var verifier = new byte[16];
+            rnd.GetBytes(verifier);
+            encryptionInfo.Verifier.EncryptedVerifier = EncryptData(key, verifier, true);
+
+            //AES = 32 Bits
+            encryptionInfo.Verifier.VerifierHashSize = 0x20;
+            SHA1 sha = new SHA1Managed();
+            var verifierHash = sha.ComputeHash(verifier);
+
+            encryptionInfo.Verifier.EncryptedVerifierHash = EncryptData(key, verifierHash, false);
+
+            return encryptionInfo;
+        }
+        private byte[] EncryptData(byte[] key, byte[] data, bool useDataSize)
+        {
+            RijndaelManaged aes = new RijndaelManaged();
+            aes.KeySize = key.Length * 8;
+            aes.Mode = CipherMode.ECB;
+            aes.Padding = PaddingMode.Zeros;
+
+            //Encrypt the data
+            var crypt = aes.CreateEncryptor(key, null);
+            var ms = new MemoryStream();
+            var cs = new CryptoStream(ms, crypt, CryptoStreamMode.Write);
+            cs.Write(data, 0, data.Length);
+
+            cs.FlushFinalBlock();
+
+            byte[] ret;
+            if (useDataSize)
+            {
+                ret = new byte[data.Length];
+                ms.Seek(0, SeekOrigin.Begin);
+                ms.Read(ret, 0, data.Length);  //Truncate any padded Zeros
+                return ret;
+            }
+            else
+            {
+                return ms.ToArray();
+            }
+        }
+        private MemoryStream GetStreamFromPackage(CompoundDocument doc, ExcelEncryption encryption)
+        {
+            var ret = new MemoryStream();
+            if(doc.Storage.DataStreams.ContainsKey("EncryptionInfo") ||
+               doc.Storage.DataStreams.ContainsKey("EncryptedPackage"))
+            {
+                var encryptionInfo = EncryptionInfo.ReadBinary(doc.Storage.DataStreams["EncryptionInfo"]);
+                
+                return DecryptDocument(doc.Storage.DataStreams["EncryptedPackage"], encryptionInfo, encryption.Password);
+            }
+            else
+            {
+                throw (new InvalidDataException("Invalid document. EncryptionInfo or EncryptedPackage stream is missing"));
+            }
+        }
+
+        /// <summary>
+        /// Decrypt a document
+        /// </summary>
+        /// <param name="data">The Encrypted data</param>
+        /// <param name="encryptionInfo">Encryption Info object</param>
+        /// <param name="password">The password</param>
+        /// <returns></returns>
+        private MemoryStream DecryptDocument(byte[] data, EncryptionInfo encryptionInfo, string password)
+        {
+            long size = BitConverter.ToInt64(data, 0);
+
+            var encryptedData = new byte[data.Length - 8];
+            Array.Copy(data, 8, encryptedData, 0, encryptedData.Length);
+
+            if (encryptionInfo is EncryptionInfoBinary)
+            {
+                return DecryptBinary((EncryptionInfoBinary)encryptionInfo, password, size, encryptedData);
+            }
+            else
+            {
+                return DecryptAgile((EncryptionInfoAgile)encryptionInfo, password, size, encryptedData, data);
+            }
+
+        }
+
+        readonly byte[] BlockKey_HashInput = new byte[] { 0xfe, 0xa7, 0xd2, 0x76, 0x3b, 0x4b, 0x9e, 0x79 };
+        readonly byte[] BlockKey_HashValue = new byte[] { 0xd7, 0xaa, 0x0f, 0x6d, 0x30, 0x61, 0x34, 0x4e };
+        readonly byte[] BlockKey_KeyValue = new byte[] { 0x14, 0x6e, 0x0b, 0xe7, 0xab, 0xac, 0xd0, 0xd6 };
+        readonly byte[] BlockKey_HmacKey = new byte[] { 0x5f, 0xb2, 0xad, 0x01, 0x0c, 0xb9, 0xe1, 0xf6 };//MSOFFCRYPTO 2.3.4.14 section 3
+        readonly byte[] BlockKey_HmacValue = new byte[] { 0xa0, 0x67, 0x7f, 0x02, 0xb2, 0x2c, 0x84, 0x33 };//MSOFFCRYPTO 2.3.4.14 section 5
+        
+        private MemoryStream DecryptAgile(EncryptionInfoAgile encryptionInfo, string password, long size, byte[] encryptedData, byte[] data)
+        { 
+            MemoryStream doc = new MemoryStream();
+
+            if (encryptionInfo.KeyData.CipherAlgorithm == eCipherAlgorithm.AES)
+            {
+                var encr = encryptionInfo.KeyEncryptors[0];
+                var hashProvider = GetHashProvider(encr);
+                var baseHash = GetPasswordHash(hashProvider, encr.SaltValue, password, encr.SpinCount, encr.HashSize);
+
+                //Get the keys for the verifiers and the key value
+                var valInputKey = GetFinalHash(hashProvider, encr, BlockKey_HashInput, baseHash);
+                var valHashKey = GetFinalHash(hashProvider, encr, BlockKey_HashValue, baseHash);
+                var valKeySizeKey = GetFinalHash(hashProvider, encr, BlockKey_KeyValue, baseHash);
+
+                //Decrypt
+                encr.VerifierHashInput = DecryptAgileFromKey(encr, valInputKey, encr.EncryptedVerifierHashInput, encr.SaltSize, encr.SaltValue);
+                encr.VerifierHash = DecryptAgileFromKey(encr, valHashKey, encr.EncryptedVerifierHash, encr.HashSize, encr.SaltValue);
+                encr.KeyValue = DecryptAgileFromKey(encr, valKeySizeKey, encr.EncryptedKeyValue, encr.KeyBits / 8, encr.SaltValue);
+
+                if (IsPasswordValid(hashProvider, encr))
+                {
+                    var ivhmac = GetFinalHash(hashProvider, encr, BlockKey_HmacKey, encryptionInfo.KeyData.SaltValue);
+                    var key = DecryptAgileFromKey(encr, encr.KeyValue, encryptionInfo.DataIntegrity.EncryptedHmacKey, encryptionInfo.KeyData.HashSize, ivhmac);
+
+                    ivhmac = GetFinalHash(hashProvider, encr, BlockKey_HmacValue, encryptionInfo.KeyData.SaltValue);
+                    var value = DecryptAgileFromKey(encr, encr.KeyValue, encryptionInfo.DataIntegrity.EncryptedHmacValue, encryptionInfo.KeyData.HashSize, ivhmac);
+
+                    var hmca = GetHmacProvider(encr, key);
+                    var v2 = hmca.ComputeHash(data);
+
+                    for (int i = 0; i < v2.Length; i++)
+                    {
+                        if (value[i] != v2[i])
+                        {
+                            throw (new Exception("Dataintegrity key missmatch"));
+                        }
+                    }
+
+                    int pos = 0;
+                    uint segment = 0;
+                    while (pos < size)
+                    {
+                        var segmentSize = (int)(size - pos > 4096 ? 4096 : size - pos);
+                        var bufferSize = (int)(encryptedData.Length - pos > 4096 ? 4096 : encryptedData.Length - pos);
+                        var ivTmp = new byte[4 + encryptionInfo.KeyData.SaltSize];
+                        Array.Copy(encryptionInfo.KeyData.SaltValue, 0, ivTmp, 0, encryptionInfo.KeyData.SaltSize);
+                        Array.Copy(BitConverter.GetBytes(segment), 0, ivTmp, encryptionInfo.KeyData.SaltSize, 4);
+                        var iv = hashProvider.ComputeHash(ivTmp);
+                        var buffer = new byte[bufferSize];
+                        Array.Copy(encryptedData, pos, buffer, 0, bufferSize);
+
+                        var b = DecryptAgileFromKey(encr, encr.KeyValue, buffer, segmentSize, iv);
+                        doc.Write(b, 0, b.Length);
+                        pos += segmentSize;
+                        segment++;
+                    }
+                    doc.Flush();
+                    return doc;
+                }
+                else
+                {
+                    throw (new SecurityException("Invalid password"));
+                }
+            }
+            return null;
+        }
+        private HashAlgorithm GetHashProvider(EncryptionInfoAgile.EncryptionKeyEncryptor encr)
+        {
+            switch (encr.HashAlgorithm)
+            {
+                case eHashAlogorithm.MD5:
+                        return new MD5CryptoServiceProvider();
+                case eHashAlogorithm.RIPEMD160:
+                        return new RIPEMD160Managed();
+                case eHashAlogorithm.SHA1:
+                        return new SHA1CryptoServiceProvider();
+                case eHashAlogorithm.SHA256:
+                        return  new SHA256CryptoServiceProvider();
+                case eHashAlogorithm.SHA384:
+                        return new SHA384CryptoServiceProvider();
+                case eHashAlogorithm.SHA512:
+                        return new SHA512CryptoServiceProvider();
+                default:
+                        throw new NotSupportedException(string.Format("Hash provider is unsupported. {0}", encr.HashAlgorithm));
+            }
+        }
+        private MemoryStream DecryptBinary(EncryptionInfoBinary encryptionInfo, string password, long size, byte[] encryptedData)
+        {
+            MemoryStream doc = new MemoryStream();
+
+            if (encryptionInfo.Header.AlgID == AlgorithmID.AES128 || (encryptionInfo.Header.AlgID == AlgorithmID.Flags && ((encryptionInfo.Flags & (Flags.fAES | Flags.fExternal | Flags.fCryptoAPI)) == (Flags.fAES | Flags.fCryptoAPI)))
+                ||
+                encryptionInfo.Header.AlgID == AlgorithmID.AES192
+                ||
+                encryptionInfo.Header.AlgID == AlgorithmID.AES256
+                )
+            {
+                RijndaelManaged decryptKey = new RijndaelManaged();
+                decryptKey.KeySize = encryptionInfo.Header.KeySize;
+                decryptKey.Mode = CipherMode.ECB;
+                decryptKey.Padding = PaddingMode.None;
+
+                var key = GetPasswordHashBinary(password, encryptionInfo);
+                if (IsPasswordValid(key, encryptionInfo))
+                {
+                    ICryptoTransform decryptor = decryptKey.CreateDecryptor(
+                                                             key,
+                                                             null);
+
+                    var dataStream = new MemoryStream(encryptedData);
+                    var cryptoStream = new CryptoStream(dataStream,
+                                                                  decryptor,
+                                                                  CryptoStreamMode.Read);
+
+                    var decryptedData = new byte[size];
+
+                    cryptoStream.Read(decryptedData, 0, (int)size);
+                    doc.Write(decryptedData, 0, (int)size);
+                }
+                else
+                {
+                    throw (new UnauthorizedAccessException("Invalid password"));
+                }
+            }
+            return doc;
+        }
+        /// <summary>
+        /// Validate the password
+        /// </summary>
+        /// <param name="key">The encryption key</param>
+        /// <param name="encryptionInfo">The encryption info extracted from the ENCRYPTIOINFO stream inside the OLE document</param>
+        /// <returns></returns>
+        private bool IsPasswordValid(byte[] key, EncryptionInfoBinary encryptionInfo)
+        {
+            RijndaelManaged decryptKey = new RijndaelManaged();
+            decryptKey.KeySize = encryptionInfo.Header.KeySize;
+            decryptKey.Mode = CipherMode.ECB;
+            decryptKey.Padding = PaddingMode.None;
+
+            ICryptoTransform decryptor = decryptKey.CreateDecryptor(
+                                                     key,
+                                                     null);
+
+
+            //Decrypt the verifier
+            MemoryStream dataStream = new MemoryStream(encryptionInfo.Verifier.EncryptedVerifier);
+            CryptoStream cryptoStream = new CryptoStream(dataStream,
+                                                          decryptor,
+                                                          CryptoStreamMode.Read);
+            var decryptedVerifier = new byte[16];
+            cryptoStream.Read(decryptedVerifier, 0, 16);
+
+            dataStream = new MemoryStream(encryptionInfo.Verifier.EncryptedVerifierHash);
+
+            cryptoStream = new CryptoStream(dataStream,
+                                                decryptor,
+                                                CryptoStreamMode.Read);
+
+            //Decrypt the verifier hash
+            var decryptedVerifierHash = new byte[16];
+            cryptoStream.Read(decryptedVerifierHash, 0, (int)16);
+
+            //Get the hash for the decrypted verifier
+            var sha = new SHA1Managed();
+            var hash = sha.ComputeHash(decryptedVerifier);
+
+            //Equal?
+            for (int i = 0; i < 16; i++)
+            {
+                if (hash[i] != decryptedVerifierHash[i])
+                {
+                    return false;
+                }
+            }
+            return true;
+        }
+        /// <summary>
+        /// Validate the password
+        /// </summary>
+        /// <param name="sha">The hash algorithm</param>
+        /// <param name="encr">The encryption info extracted from the ENCRYPTIOINFO stream inside the OLE document</param>
+        /// <returns></returns>
+        private bool IsPasswordValid(HashAlgorithm sha, EncryptionInfoAgile.EncryptionKeyEncryptor encr)
+        {
+            var valHash = sha.ComputeHash(encr.VerifierHashInput);
+
+            //Equal?
+            for (int i = 0; i < valHash.Length; i++)
+            {
+                if (encr.VerifierHash[i] != valHash[i])
+                {
+                    return false;
+                }
+            }
+            return true;
+        }
+
+        private byte[] DecryptAgileFromKey(EncryptionInfoAgile.EncryptionKeyEncryptor encr, byte[] key, byte[] encryptedData, long size, byte[] iv)
+        {
+            SymmetricAlgorithm decryptKey = GetEncryptionAlgorithm(encr);
+            decryptKey.BlockSize = encr.BlockSize << 3;
+            decryptKey.KeySize = encr.KeyBits;
+            decryptKey.Mode = encr.ChiptherChaining == eChainingMode.ChainingModeCBC ? CipherMode.CBC : CipherMode.CFB;
+            decryptKey.Padding = PaddingMode.Zeros;
+
+            ICryptoTransform decryptor = decryptKey.CreateDecryptor(
+                                                        FixHashSize(key, encr.KeyBits / 8),
+                                                        FixHashSize(iv, encr.BlockSize, 0x36));
+
+
+            MemoryStream dataStream = new MemoryStream(encryptedData);
+
+            CryptoStream cryptoStream = new CryptoStream(dataStream,
+                                                            decryptor,
+                                                            CryptoStreamMode.Read);
+
+            var decryptedData = new byte[size];
+
+            cryptoStream.Read(decryptedData, 0, (int)size);
+            return decryptedData;
+        }
+
+        private SymmetricAlgorithm GetEncryptionAlgorithm(EncryptionInfoAgile.EncryptionKeyEncryptor encr)
+        {
+            switch (encr.CipherAlgorithm)
+            {
+                case eCipherAlgorithm.AES:
+                    return new RijndaelManaged();
+                case eCipherAlgorithm.DES:
+                    return new DESCryptoServiceProvider();
+                case eCipherAlgorithm.TRIPLE_DES:
+                case eCipherAlgorithm.TRIPLE_DES_112:
+                    return new TripleDESCryptoServiceProvider();
+                case eCipherAlgorithm.RC2:
+                    return new RC2CryptoServiceProvider();
+                default:
+                    throw(new NotSupportedException(string.Format("Unsupported Cipher Algorithm: {0}", encr.CipherAlgorithm.ToString())));
+            }
+        }
+        private void EncryptAgileFromKey(EncryptionInfoAgile.EncryptionKeyEncryptor encr, byte[] key, byte[] data, long pos, long size, byte[] iv,MemoryStream ms)
+        {
+            var encryptKey = GetEncryptionAlgorithm(encr);
+            encryptKey.BlockSize = encr.BlockSize << 3;
+            encryptKey.KeySize = encr.KeyBits;
+            encryptKey.Mode = encr.ChiptherChaining==eChainingMode.ChainingModeCBC ? CipherMode.CBC : CipherMode.CFB;
+            encryptKey.Padding = PaddingMode.Zeros;
+
+            ICryptoTransform encryptor = encryptKey.CreateEncryptor(
+                                                        FixHashSize(key, encr.KeyBits / 8),
+                                                        FixHashSize(iv, 16, 0x36));
+
+
+            CryptoStream cryptoStream = new CryptoStream(ms,
+                                                         encryptor,
+                                                         CryptoStreamMode.Write);
+            
+            var cryptoSize = size % encr.BlockSize == 0 ? size : (size + (encr.BlockSize - (size % encr.BlockSize)));
+            var buffer = new byte[size];
+            Array.Copy(data, pos, buffer, 0, size);
+            cryptoStream.Write(buffer, 0, (int)size);
+            while (size % encr.BlockSize != 0)
+            {
+                cryptoStream.WriteByte(0);
+                size++;
+            }
+        }
+
+        /// <summary>
+        /// Create the hash.
+        /// This method is written with the help of Lyquidity library, many thanks for this nice sample
+        /// </summary>
+        /// <param name="password">The password</param>
+        /// <param name="encryptionInfo">The encryption info extracted from the ENCRYPTIOINFO stream inside the OLE document</param>
+        /// <returns>The hash to encrypt the document</returns>
+        private byte[] GetPasswordHashBinary(string password, EncryptionInfoBinary encryptionInfo)
+        {
+            byte[] hash = null;
+            byte[] tempHash = new byte[4 + 20];    //Iterator + prev. hash
+            try
+            {
+                HashAlgorithm hashProvider;
+                if (encryptionInfo.Header.AlgIDHash == AlgorithmHashID.SHA1 || encryptionInfo.Header.AlgIDHash == AlgorithmHashID.App && (encryptionInfo.Flags & Flags.fExternal) == 0)
+                {
+                    hashProvider = new SHA1CryptoServiceProvider();
+                }
+                else if (encryptionInfo.Header.KeySize > 0 && encryptionInfo.Header.KeySize < 80)
+                {
+                    throw new NotSupportedException("RC4 Hash provider is not supported. Must be SHA1(AlgIDHash == 0x8004)");
+                }
+                else
+                {
+                    throw new NotSupportedException("Hash provider is invalid. Must be SHA1(AlgIDHash == 0x8004)");
+                }
+
+                hash = GetPasswordHash(hashProvider, encryptionInfo.Verifier.Salt, password, 50000, 20);
+
+                // Append "block" (0)
+                Array.Copy(hash, tempHash, hash.Length);
+                Array.Copy(System.BitConverter.GetBytes(0), 0, tempHash, hash.Length, 4);
+                hash = hashProvider.ComputeHash(tempHash);
+
+                /***** Now use the derived key algorithm *****/
+                byte[] derivedKey = new byte[64];
+                int keySizeBytes = encryptionInfo.Header.KeySize / 8;
+
+                //First XOR hash bytes with 0x36 and fill the rest with 0x36
+                for (int i = 0; i < derivedKey.Length; i++)
+                    derivedKey[i] = (byte)(i < hash.Length ? 0x36 ^ hash[i] : 0x36);
+
+
+                byte[] X1 = hashProvider.ComputeHash(derivedKey);
+
+                //if verifier size is bigger than the key size we can return X1
+                if ((int)encryptionInfo.Verifier.VerifierHashSize > keySizeBytes)
+                    return FixHashSize(X1, keySizeBytes);
+
+                //Else XOR hash bytes with 0x5C and fill the rest with 0x5C
+                for (int i = 0; i < derivedKey.Length; i++)
+                    derivedKey[i] = (byte)(i < hash.Length ? 0x5C ^ hash[i] : 0x5C);
+
+                byte[] X2 = hashProvider.ComputeHash(derivedKey);
+
+                //Join the two and return 
+                byte[] join = new byte[X1.Length + X2.Length];
+
+                Array.Copy(X1, 0, join, 0, X1.Length);
+                Array.Copy(X2, 0, join, X1.Length, X2.Length);
+
+
+                return FixHashSize(join, keySizeBytes);
+            }
+            catch (Exception ex)
+            {
+                throw (new Exception("An error occured when the encryptionkey was created", ex));
+            }
+        }
+
+        /// <summary>
+        /// Create the hash.
+        /// This method is written with the help of Lyquidity library, many thanks for this nice sample
+        /// </summary>
+        /// <param name="password">The password</param>
+        /// <param name="encr">The encryption info extracted from the ENCRYPTIOINFO stream inside the OLE document</param>
+        /// <param name="blockKey">The block key appended to the hash to obtain the final hash</param>
+        /// <returns>The hash to encrypt the document</returns>
+        private byte[] GetPasswordHashAgile(string password, EncryptionInfoAgile.EncryptionKeyEncryptor encr, byte[] blockKey)
+        {
+            try
+            {
+                var hashProvider = GetHashProvider(encr);
+                var hash = GetPasswordHash(hashProvider, encr.SaltValue, password, encr.SpinCount, encr.HashSize);
+                var hashFinal = GetFinalHash(hashProvider, encr, blockKey, hash);
+
+                return FixHashSize(hashFinal, encr.KeyBits / 8);
+            }
+            catch (Exception ex)
+            {
+                throw (new Exception("An error occured when the encryptionkey was created", ex));
+            }
+        }
+#endif
+			private byte[] GetFinalHash(HashAlgorithm hashProvider, EncryptionInfoAgile.EncryptionKeyEncryptor encr, byte[] blockKey, byte[] hash)
+        {
+            //2.3.4.13 MS-OFFCRYPTO
+            var tempHash = new byte[hash.Length + blockKey.Length];
+            Array.Copy(hash, tempHash, hash.Length);
+            Array.Copy(blockKey, 0, tempHash, hash.Length, blockKey.Length);
+            var hashFinal = hashProvider.ComputeHash(tempHash);
+            return hashFinal;
+        }
+        private byte[] GetPasswordHash(HashAlgorithm hashProvider, byte[] salt, string password, int spinCount, int hashSize)
+        {
+            byte[] hash = null;
+            byte[] tempHash = new byte[4 + hashSize];    //Iterator + prev. hash
+            hash = hashProvider.ComputeHash(CombinePassword(salt, password));
+
+            //Iterate "spinCount" times, inserting i in first 4 bytes and then the prev. hash in byte 5-24
+            for (int i = 0; i < spinCount; i++)
+            {
+                Array.Copy(BitConverter.GetBytes(i), tempHash, 4);
+                Array.Copy(hash, 0, tempHash, 4, hash.Length);
+
+                hash = hashProvider.ComputeHash(tempHash);
+            }
+
+            return hash;
+        }
+        private byte[] FixHashSize(byte[] hash, int size, byte fill=0)
+        {
+            if (hash.Length == size)
+                return hash;
+            else if (hash.Length < size)
+            {
+                byte[] buff = new byte[size];
+                Array.Copy(hash, buff, hash.Length);
+                for (int i = hash.Length; i < size; i++)
+                {
+                    buff[i] = fill;
+                }
+                return buff;
+            }
+            else
+            {
+                byte[] buff = new byte[size];
+                Array.Copy(hash, buff, size);
+                return buff;
+            }
+        }
+        private byte[] CombinePassword(byte[] salt, string password)
+        {
+            if (password == "")
+            {
+                password = "VelvetSweatshop";   //Used if Password is blank
+            }
+            // Convert password to unicode...
+            byte[] passwordBuf = UnicodeEncoding.Unicode.GetBytes(password);
+
+            byte[] inputBuf = new byte[salt.Length + passwordBuf.Length];
+            Array.Copy(salt, inputBuf, salt.Length);
+            Array.Copy(passwordBuf, 0, inputBuf, salt.Length, passwordBuf.Length);
+            return inputBuf;
+        }
+        internal static ushort CalculatePasswordHash(string Password)
+        {
+            //Calculate the hash
+            //Thanks to Kohei Yoshida for the sample http://kohei.us/2008/01/18/excel-sheet-protection-password-hash/
+            ushort hash = 0;
+            for (int i = Password.Length - 1; i >= 0; i--)
+            {
+                hash ^= Password[i];
+                hash = (ushort)(((ushort)((hash >> 14) & 0x01))
+                                |
+                                ((ushort)((hash << 1) & 0x7FFF)));  //Shift 1 to the left. Overflowing bit 15 goes into bit 0
+            }
+
+            hash ^= (0x8000 | ('N' << 8) | 'K'); //Xor NK with high bit set(0xCE4B)
+            hash ^= (ushort)Password.Length;
+
+            return hash;
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Encryption/EncryptionHeader.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Encryption/EncryptionHeader.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Encryption/EncryptionHeader.cs	(revision 12707)
@@ -0,0 +1,101 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		    Added       		        2013-01-05
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.Encryption
+{
+    [Flags]
+    internal enum Flags
+    {
+        Reserved1 = 1,   // (1 bit): MUST be set to zero, and MUST be ignored.
+        Reserved2 = 2,   // (1 bit): MUST be set to zero, and MUST be ignored.
+        fCryptoAPI = 4,   // (1 bit): A flag that specifies whether CryptoAPI RC4 or [ECMA-376] encryption is used. It MUST be set to 1 unless fExternal is 1. If fExternal is set to 1, it MUST be set to zero.        
+        fDocProps = 8,   // (1 bit): MUST be set to zero if document properties are encrypted. Otherwise, it MUST be set to 1. Encryption of document properties is specified in section 2.3.5.4.
+        fExternal = 16,  // (1 bit): If extensible encryption is used, it MUST be set to 1. Otherwise, it MUST be set to zero. If this field is set to 1, all other fields in this structure MUST be set to zero.
+        fAES = 32   //(1 bit): If the protected content is an [ECMA-376] document, it MUST be set to 1. Otherwise, it MUST be set to zero. If the fAES bit is set to 1, the fCryptoAPI bit MUST also be set to 1
+    }
+    internal enum AlgorithmID
+    {
+        Flags = 0x00000000,   // Determined by Flags
+        RC4 = 0x00006801,   // RC4
+        AES128 = 0x0000660E,   // 128-bit AES
+        AES192 = 0x0000660F,   // 192-bit AES
+        AES256 = 0x00006610    // 256-bit AES
+    }
+    internal enum AlgorithmHashID
+    {
+        App = 0x00000000,
+        SHA1 = 0x00008004,
+    }
+    internal enum ProviderType
+    {
+        Flags = 0x00000000,//Determined by Flags
+        RC4 = 0x00000001,
+        AES = 0x00000018,
+    }
+    /// <summary>
+    /// Encryption Header inside the EncryptionInfo stream
+    /// </summary>
+    internal class EncryptionHeader
+    {
+        internal Flags Flags;
+        internal int SizeExtra;             //MUST be 0x00000000.
+        internal AlgorithmID AlgID;         //MUST be 0x0000660E (AES-128), 0x0000660F (AES-192), or 0x00006610 (AES-256).
+        internal AlgorithmHashID AlgIDHash; //MUST be 0x00008004 (SHA-1).
+        internal int KeySize;               //MUST be 0x00000080 (AES-128), 0x000000C0 (AES-192), or 0x00000100 (AES-256).
+        internal ProviderType ProviderType; //SHOULD<10> be 0x00000018 (AES).
+        internal int Reserved1;             //Undefined and MUST be ignored.
+        internal int Reserved2;             //MUST be 0x00000000 and MUST be ignored.
+        internal string CSPName;            //SHOULD<11> be set to either "Microsoft Enhanced RSA and AES Cryptographic Provider" or "Microsoft Enhanced RSA and AES Cryptographic Provider (Prototype)" as a null-terminated Unicode string.
+        internal byte[] WriteBinary()
+        {
+            MemoryStream ms = new MemoryStream();
+            BinaryWriter bw = new BinaryWriter(ms);
+
+            bw.Write((int)Flags);
+            bw.Write(SizeExtra);
+            bw.Write((int)AlgID);
+            bw.Write((int)AlgIDHash);
+            bw.Write((int)KeySize);
+            bw.Write((int)ProviderType);
+            bw.Write(Reserved1);
+            bw.Write(Reserved2);
+            bw.Write(Encoding.Unicode.GetBytes(CSPName));
+
+            bw.Flush();
+            return ms.ToArray();
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Encryption/EncryptionInfo.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Encryption/EncryptionInfo.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Encryption/EncryptionInfo.cs	(revision 12707)
@@ -0,0 +1,584 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		    Added       		        2013-01-05
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Xml;
+
+namespace OfficeOpenXml.Encryption
+{
+    internal abstract class EncryptionInfo
+    {
+        internal short MajorVersion;
+        internal short MinorVersion;
+        internal abstract void Read(byte[] data);
+
+        internal static EncryptionInfo ReadBinary(byte[] data)
+        {
+            var majorVersion = BitConverter.ToInt16(data, 0);
+            var minorVersion = BitConverter.ToInt16(data, 2);
+            EncryptionInfo ret;
+            if ((minorVersion == 2 || minorVersion == 3) && majorVersion <= 4) // minorVersion==1 is RC4, not supported.
+            {
+                ret = new EncryptionInfoBinary();
+            }
+            else if (majorVersion == 4 && minorVersion==4)
+            {
+                ret = new EncryptionInfoAgile();
+            }
+            else
+            {
+                throw (new NotSupportedException("Unsupported encryption format"));
+            }
+            ret.MajorVersion = majorVersion;
+            ret.MinorVersion = minorVersion;
+            ret.Read(data);
+            return ret;
+        }
+    }
+    internal enum eCipherAlgorithm
+    {
+        /// <summary>
+        /// AES. MUST conform to the AES algorithm.
+        /// </summary>
+        AES,
+        /// <summary>
+        /// RC2. MUST conform to [RFC2268].
+        /// </summary>
+        RC2,
+        /// <summary>
+        /// RC4. 
+        /// </summary>
+        RC4,
+        /// <summary>
+        /// MUST conform to the DES algorithm.
+        /// </summary>
+        DES,
+        /// <summary>
+        /// MUST conform to the [DRAFT-DESX] algorithm.
+        /// </summary>
+        DESX,
+        /// <summary>
+        /// 3DES. MUST conform to the [RFC1851] algorithm. 
+        /// </summary>
+        TRIPLE_DES,
+        /// 3DES_112 MUST conform to the [RFC1851] algorithm. 
+        TRIPLE_DES_112        
+    }
+    internal enum eChainingMode
+    {
+        /// <summary>
+        /// Cipher block chaining (CBC).
+        /// </summary>
+        ChainingModeCBC,
+        /// <summary>
+        /// Cipher feedback chaining (CFB), with 8-bit window.
+        /// </summary>
+        ChainingModeCFB
+    }
+    /// <summary>
+    /// Hashalgorithm
+    /// </summary>
+    internal enum eHashAlogorithm
+    {
+        /// <summary>
+        /// Sha 1-MUST conform to [RFC4634]
+        /// </summary>
+        SHA1,
+        /// <summary>
+        /// Sha 256-MUST conform to [RFC4634]
+        /// </summary>
+        SHA256,
+        /// <summary>
+        /// Sha 384-MUST conform to [RFC4634]
+        /// </summary>
+        SHA384,
+        /// <summary>
+        /// Sha 512-MUST conform to [RFC4634]
+        /// </summary>
+        SHA512,
+        /// <summary>
+        /// MD5
+        /// </summary>
+        MD5,
+        /// <summary>
+        /// MD4
+        /// </summary>
+        MD4,
+        /// <summary>
+        /// MD2
+        /// </summary>
+        MD2,
+        /// <summary>
+        /// RIPEMD-128 MUST conform to [ISO/IEC 10118]
+        /// </summary>
+        RIPEMD128,
+        /// <summary>
+        /// RIPEMD-160 MUST conform to [ISO/IEC 10118]
+        /// </summary>
+        RIPEMD160,
+        /// <summary>
+        /// WHIRLPOOL MUST conform to [ISO/IEC 10118]
+        /// </summary>
+        WHIRLPOOL
+    }
+    /// <summary>
+    /// Handels the agile encryption
+    /// </summary>
+    internal class EncryptionInfoAgile : EncryptionInfo
+    {
+        XmlNamespaceManager _nsm;
+        public EncryptionInfoAgile()
+        {
+            var nt = new NameTable();
+            _nsm = new XmlNamespaceManager(nt);
+            _nsm.AddNamespace("d", "http://schemas.microsoft.com/office/2006/encryption");
+            _nsm.AddNamespace("c", "http://schemas.microsoft.com/office/2006/keyEncryptor/certificate");
+            _nsm.AddNamespace("p", "http://schemas.microsoft.com/office/2006/keyEncryptor/password");
+        }
+        internal class EncryptionKeyData : XmlHelper
+        {
+            public EncryptionKeyData(XmlNamespaceManager nsm, XmlNode topNode) :
+                base(nsm, topNode)
+            {
+
+            }
+            internal byte[] SaltValue
+            {
+                get
+                {
+                    var s = GetXmlNodeString("@saltValue");
+                    if (!string.IsNullOrEmpty(s))
+                    {
+                        return Convert.FromBase64String(s);
+                    }
+                    return null;
+                }
+                set
+                {
+                    SetXmlNodeString("@saltValue", Convert.ToBase64String(value));
+                }
+            }
+            internal eHashAlogorithm HashAlgorithm
+            {
+                get
+                {
+                    return GetHashAlgorithm(GetXmlNodeString("@hashAlgorithm"));
+                }
+                set
+                {
+                    SetXmlNodeString("@hashAlgorithm", GetHashAlgorithmString(value));
+                }
+            }
+
+            private eHashAlogorithm GetHashAlgorithm(string v)
+            {
+                switch (v)
+                {
+                    case "RIPEMD-128":
+                        return eHashAlogorithm.RIPEMD128;
+                    case "RIPEMD-160":
+                        return eHashAlogorithm.RIPEMD160;
+                    case "SHA-1":
+                        return eHashAlogorithm.SHA1;
+                    default:
+                        try
+                        {
+                            return (eHashAlogorithm)Enum.Parse(typeof(eHashAlogorithm),v);
+                        }
+                        catch
+                        {
+                            throw (new InvalidDataException("Invalid Hash algorithm"));
+                        }
+                }
+            }
+
+            private string GetHashAlgorithmString(eHashAlogorithm value)
+            {
+                switch (value)
+                {
+                    case eHashAlogorithm.RIPEMD128:
+                        return "RIPEMD-128";
+                    case eHashAlogorithm.RIPEMD160:
+                        return "RIPEMD-160";
+                    case eHashAlogorithm.SHA1:
+                        return "SHA-1";
+                    default: 
+                        return value.ToString();
+                }
+            }
+            internal eChainingMode ChiptherChaining
+            {
+                get
+                {
+                    var v=GetXmlNodeString("@cipherChaining");
+                    try
+                    {
+                        return (eChainingMode)Enum.Parse(typeof(eChainingMode), v);
+                    }
+                    catch
+                    {
+                        throw (new InvalidDataException("Invalid chaining mode"));
+                    }
+                }
+                set
+                {
+                    SetXmlNodeString("@cipherChaining", value.ToString());
+                }
+            }
+            internal eCipherAlgorithm CipherAlgorithm
+            {
+                get
+                {
+                    return GetCipherAlgorithm(GetXmlNodeString("@cipherAlgorithm"));
+                }
+                set
+                {
+                    SetXmlNodeString("@cipherAlgorithm", GetCipherAlgorithmString(value));
+                }
+            }
+
+            private eCipherAlgorithm GetCipherAlgorithm(string v)
+            {
+                switch (v)
+                {
+                    case "3DES":
+                        return eCipherAlgorithm.TRIPLE_DES;
+                    case "3DES_112":
+                        return eCipherAlgorithm.TRIPLE_DES_112;
+                    default:
+                        try
+                        {
+                            return (eCipherAlgorithm)Enum.Parse(typeof(eCipherAlgorithm), v);
+                        }
+                        catch
+                        {
+                            throw (new InvalidDataException("Invalid Hash algorithm"));
+                        }
+                }
+            }
+
+            private string GetCipherAlgorithmString(eCipherAlgorithm alg)
+            {
+                switch (alg)
+                {
+                    case eCipherAlgorithm.TRIPLE_DES:
+                        return "3DES";
+                    case eCipherAlgorithm.TRIPLE_DES_112:
+                        return "3DES_112";                    
+                    default:
+                        return alg.ToString();
+                }
+            }
+            internal int HashSize
+            {
+                get
+                {
+                    return GetXmlNodeInt("@hashSize");
+                }
+                set
+                {
+                    SetXmlNodeString("@hashSize", value.ToString());
+                }
+            }
+            internal int KeyBits
+            {
+                get
+                {
+                    return GetXmlNodeInt("@keyBits");
+                }
+                set
+                {
+                    SetXmlNodeString("@keyBits", value.ToString());
+                }
+            }
+            internal int BlockSize
+            {
+                get
+                {
+                    return GetXmlNodeInt("@blockSize");
+                }
+                set
+                {
+                    SetXmlNodeString("@blockSize", value.ToString());
+                }
+            }
+            internal int SaltSize
+            {
+                get
+                {
+                    return GetXmlNodeInt("@saltSize");
+                }
+                set
+                {
+                    SetXmlNodeString("@saltSize", value.ToString());
+                }
+            }
+        }
+        internal class EncryptionDataIntegrity : XmlHelper
+        {
+            public EncryptionDataIntegrity(XmlNamespaceManager nsm, XmlNode topNode) :
+                base(nsm, topNode)
+            {
+
+            }
+            internal byte[] EncryptedHmacValue
+            {
+                get
+                {
+                    var s = GetXmlNodeString("@encryptedHmacValue");
+                    if (!string.IsNullOrEmpty(s))
+                    {
+                        return Convert.FromBase64String(s);
+                    }
+                    return null;
+                }
+                set
+                {
+                    SetXmlNodeString("@encryptedHmacValue", Convert.ToBase64String(value));
+                }
+            }
+            internal byte[] EncryptedHmacKey
+            {
+                get
+                {
+                    var s = GetXmlNodeString("@encryptedHmacKey");
+                    if (!string.IsNullOrEmpty(s))
+                    {
+                        return Convert.FromBase64String(s);
+                    }
+                    return null;
+                }
+                set
+                {
+                    SetXmlNodeString("@encryptedHmacKey", Convert.ToBase64String(value));
+                }
+            }
+        }
+        internal class EncryptionKeyEncryptor : EncryptionKeyData
+        {
+            public EncryptionKeyEncryptor(XmlNamespaceManager nsm, XmlNode topNode) :
+                base(nsm, topNode)
+            {
+
+            }
+            internal byte[] EncryptedKeyValue
+            {
+                get
+                {
+                    var s = GetXmlNodeString("@encryptedKeyValue");
+                    if (!string.IsNullOrEmpty(s))
+                    {
+                        return Convert.FromBase64String(s);
+                    }
+                    return null;
+                }
+                set
+                {
+                    SetXmlNodeString("@encryptedKeyValue", Convert.ToBase64String(value));
+                }
+            }
+            internal byte[] EncryptedVerifierHash
+            {
+                get
+                {
+                    var s = GetXmlNodeString("@encryptedVerifierHashValue");
+                    if (!string.IsNullOrEmpty(s))
+                    {
+                        return Convert.FromBase64String(s);
+                    }
+                    return null;
+
+                }
+                set
+                {
+                    SetXmlNodeString("@encryptedVerifierHashValue", Convert.ToBase64String(value));
+                }
+            }
+            internal byte[] EncryptedVerifierHashInput
+            {
+                get
+                {
+                    var s = GetXmlNodeString("@encryptedVerifierHashInput");
+                    if (!string.IsNullOrEmpty(s))
+                    {
+                        return Convert.FromBase64String(s);
+                    }
+                    return null;
+                }
+                set
+                {
+                    SetXmlNodeString("@encryptedVerifierHashInput", Convert.ToBase64String(value));
+                }
+            }
+            internal byte[] VerifierHashInput { get; set; }
+            internal byte[] VerifierHash { get; set; }
+            internal byte[] KeyValue { get; set; }
+            internal int SpinCount
+            {
+                get
+                {
+                    return GetXmlNodeInt("@spinCount");
+                }
+                set
+                {
+                    SetXmlNodeString("@spinCount", value.ToString());
+                }
+            }
+        }
+        /*
+        <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+           <encryption xmlns="http://schemas.microsoft.com/office/2006/encryption" xmlns:p="http://schemas.microsoft.com/office/2006/keyEncryptor/password" xmlns:c="http://schemas.microsoft.com/office/2006/keyEncryptor/certificate">
+               <keyData saltSize="16" blockSize="16" keyBits="256" hashSize="64" cipherAlgorithm="AES" cipherChaining="ChainingModeCBC" hashAlgorithm="SHA512" saltValue="pa+hrJ3s1zrY6hmVuSa5JQ==" />
+               <dataIntegrity encryptedHmacKey="nd8i4sEKjsMjVN2gLo91oFN2e7bhMpWKDCAUBEpz4GW6NcE3hBXDobLksZvQGwLrPj0SUVzQA8VuDMyjMAfVCA==" encryptedHmacValue="O6oegHpQVz2uO7Om4oZijSi4kzLiiMZGIjfZlq/EFFO6PZbKitenBqe2or1REaxaI7gO/JmtJzZ1ViucqTaw4g==" />
+               <keyEncryptors>
+                   <keyEncryptor uri="http://schemas.microsoft.com/office/2006/keyEncryptor/password">
+                      <p:encryptedKey spinCount="100000" saltSize="16" blockSize="16" keyBits="256" hashSize="64" cipherAlgorithm="AES" cipherChaining="ChainingModeCBC" hashAlgorithm="SHA512" saltValue="u2BNFAuHYn3M/WRja3/uPg==" encryptedVerifierHashInput="M0V+fRolJMRgFyI9w+AVxQ==" encryptedVerifierHashValue="V/6l9pFH7AaXFqEbsnFBfHe7gMOqFeRwaNMjc7D3LNdw6KgZzOOQlt5sE8/oG7GPVBDGfoQMTxjQydVPVy4qng==" encryptedKeyValue="B0/rbSQRiIKG5CQDH6AKYSybdXzxgKAfX1f+S5k7mNE=" />
+                   </keyEncryptor></keyEncryptors></encryption>
+        */
+        
+        /***
+         * <?xml version="1.0" encoding="UTF-8" standalone="true"?>
+            <encryption xmlns:c="http://schemas.microsoft.com/office/2006/keyEncryptor/certificate" xmlns:p="http://schemas.microsoft.com/office/2006/keyEncryptor/password" xmlns="http://schemas.microsoft.com/office/2006/encryption">
+         *      <keyData saltValue="XmTB/XBGJSbwd/GTKzQv5A==" hashAlgorithm="SHA512" cipherChaining="ChainingModeCBC" cipherAlgorithm="AES" hashSize="64" keyBits="256" blockSize="16" saltSize="16"/>
+         *      <dataIntegrity encryptedHmacValue="WWw3Bb2dbcNPMnl9f1o7rO0u7sclWGKTXqBA6rRzKsP2KzWS5T0LxY9qFoC6QE67t/t+FNNtMDdMtE3D1xvT8w==" encryptedHmacKey="p/dVdlJY5Kj0k3jI1HRjqtk4s0Y4HmDAsc8nqZgfxNS7DopAsS3LU/2p3CYoIRObHsnHTAtbueH08DFCYGZURg=="/>
+         *          <keyEncryptors>
+         *              <keyEncryptor uri="http://schemas.microsoft.com/office/2006/keyEncryptor/password">
+         *                  <p:encryptedKey saltValue="EeBtY0QftyOkLztCl7NF0g==" hashAlgorithm="SHA512" cipherChaining="ChainingModeCBC" cipherAlgorithm="AES" hashSize="64" keyBits="256" blockSize="16" saltSize="16" encryptedKeyValue="Z7AO8vHnnPZEb1VqyZLJ6JFc3Mq3E322XPxWXS21fbU=" encryptedVerifierHashValue="G7BxbKnZanldvtsbu51mP9J3f9Wr5vCfCpvWSh5eIJff7Sr3J2DzH1/9aKj9uIpqFQIsLohpRk+oBYDcX7hRgw==" encryptedVerifierHashInput="851eszl5y5rdU1RnTjEWHw==" spinCount="100000"/>
+         *              </keyEncryptor>
+         *      </keyEncryptors>
+         *      </encryption
+         * ***/
+        internal EncryptionDataIntegrity DataIntegrity { get; set; }
+        internal EncryptionKeyData KeyData { get; set; }
+        internal List<EncryptionKeyEncryptor> KeyEncryptors
+        {
+            get;
+            private set;
+        }
+
+        internal XmlDocument Xml {get;set;}
+        internal override void Read(byte[] data)
+        {
+            var byXml = new byte[data.Length - 8];
+            Array.Copy(data, 8, byXml, 0, data.Length - 8);
+            var xml = Encoding.UTF8.GetString(byXml);
+            ReadFromXml(xml);
+        }
+        internal void ReadFromXml(string xml)
+        {
+            Xml = new XmlDocument();
+            XmlHelper.LoadXmlSafe(Xml, xml, Encoding.UTF8);
+            var node = Xml.SelectSingleNode("/d:encryption/d:keyData", _nsm);
+            KeyData = new EncryptionKeyData(_nsm, node);
+            node = Xml.SelectSingleNode("/d:encryption/d:dataIntegrity", _nsm);
+            DataIntegrity = new EncryptionDataIntegrity(_nsm, node);
+            KeyEncryptors = new List<EncryptionKeyEncryptor>();
+
+            var list = Xml.SelectNodes("/d:encryption/d:keyEncryptors/d:keyEncryptor/p:encryptedKey", _nsm);
+            if (list != null)
+            {
+                foreach (XmlNode n in list)
+                {
+                    KeyEncryptors.Add(new EncryptionKeyEncryptor(_nsm, n));
+                }
+            }
+
+        }
+    }
+    /// <summary>
+    /// Handles the EncryptionInfo stream
+    /// </summary>
+    internal class EncryptionInfoBinary : EncryptionInfo
+    {
+
+
+        internal Flags Flags;
+        internal uint HeaderSize;
+        internal EncryptionHeader Header;
+        internal EncryptionVerifier Verifier;
+        internal override void Read(byte[] data)
+        {
+            Flags = (Flags)BitConverter.ToInt32(data, 4);
+            HeaderSize = (uint)BitConverter.ToInt32(data, 8);
+
+            /**** EncryptionHeader ****/
+            Header = new EncryptionHeader();
+            Header.Flags = (Flags)BitConverter.ToInt32(data, 12);
+            Header.SizeExtra = BitConverter.ToInt32(data, 16);
+            Header.AlgID = (AlgorithmID)BitConverter.ToInt32(data, 20);
+            Header.AlgIDHash = (AlgorithmHashID)BitConverter.ToInt32(data, 24);
+            Header.KeySize = BitConverter.ToInt32(data, 28);
+            Header.ProviderType = (ProviderType)BitConverter.ToInt32(data, 32);
+            Header.Reserved1 = BitConverter.ToInt32(data, 36);
+            Header.Reserved2 = BitConverter.ToInt32(data, 40);
+
+            byte[] text = new byte[(int)HeaderSize - 34];
+            Array.Copy(data, 44, text, 0, (int)HeaderSize - 34);
+            Header.CSPName = UTF8Encoding.Unicode.GetString(text);
+
+            int pos = (int)HeaderSize + 12;
+
+            /**** EncryptionVerifier ****/
+            Verifier = new EncryptionVerifier();
+            Verifier.SaltSize = (uint)BitConverter.ToInt32(data, pos);
+            Verifier.Salt = new byte[Verifier.SaltSize];
+
+            Array.Copy(data, pos + 4, Verifier.Salt, 0, Verifier.SaltSize);
+
+            Verifier.EncryptedVerifier = new byte[16];
+            Array.Copy(data, pos + 20, Verifier.EncryptedVerifier, 0, 16);
+
+            Verifier.VerifierHashSize = (uint)BitConverter.ToInt32(data, pos + 36);
+            Verifier.EncryptedVerifierHash = new byte[Verifier.VerifierHashSize];
+            Array.Copy(data, pos + 40, Verifier.EncryptedVerifierHash, 0, Verifier.VerifierHashSize);
+        }
+        internal byte[] WriteBinary()
+        {
+            MemoryStream ms = new MemoryStream();
+            BinaryWriter bw = new BinaryWriter(ms);
+
+            bw.Write(MajorVersion);
+            bw.Write(MinorVersion);
+            bw.Write((int)Flags);
+            byte[] header = Header.WriteBinary();
+            bw.Write((uint)header.Length);
+            bw.Write(header);
+            bw.Write(Verifier.WriteBinary());
+
+            bw.Flush();
+            return ms.ToArray();
+        }
+
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Encryption/EncryptionVerifier.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Encryption/EncryptionVerifier.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Encryption/EncryptionVerifier.cs	(revision 12707)
@@ -0,0 +1,64 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		    Added       		        2013-01-05
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.Encryption
+{
+    /// <summary>
+    /// Encryption verifier inside the EncryptionInfo stream
+    /// </summary>
+    internal class EncryptionVerifier
+    {
+        internal uint SaltSize;              // An unsigned integer that specifies the size of the Salt field. It MUST be 0x00000010.
+        internal byte[] Salt;                //(16 bytes): An array of bytes that specifies the salt value used during password hash generation. It MUST NOT be the same data used for the verifier stored encrypted in the EncryptedVerifier field.
+        internal byte[] EncryptedVerifier;   //(16 bytes): MUST be the randomly generated Verifier value encrypted using the algorithm chosen by the implementation.
+        internal uint VerifierHashSize;      //(4 bytes): An unsigned integer that specifies the number of bytes needed to contain the hash of the data used to generate the EncryptedVerifier field.
+        internal byte[] EncryptedVerifierHash; //(variable): An array of bytes that contains the encrypted form of the hash of the randomly generated Verifier value. The length of the array MUST be the size of the encryption block size multiplied by the number of blocks needed to encrypt the hash of the Verifier. If the encryption algorithm is RC4, the length MUST be 20 bytes. If the encryption algorithm is AES, the length MUST be 32 bytes.
+        internal byte[] WriteBinary()
+        {
+            MemoryStream ms = new MemoryStream();
+            BinaryWriter bw = new BinaryWriter(ms);
+
+            bw.Write(SaltSize);
+            bw.Write(Salt);
+            bw.Write(EncryptedVerifier);
+            bw.Write(0x14);                 //Sha1 is 20 bytes  (Encrypted is 32)
+            bw.Write(EncryptedVerifierHash);
+
+            bw.Flush();
+            return ms.ToArray();
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelAddress.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelAddress.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelAddress.cs	(revision 12707)
@@ -0,0 +1,1399 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Jan Källman		Added		18-MAR-2010
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Text;
+using System.Text.RegularExpressions;
+
+namespace OfficeOpenXml
+{
+    public class ExcelTableAddress
+    {
+        public string Name { get; set; }
+        public string ColumnSpan { get; set; }
+        public bool IsAll { get; set; }
+        public bool IsHeader { get; set; }
+        public bool IsData { get; set; }
+        public bool IsTotals { get; set; }
+        public bool IsThisRow { get; set; }
+    }
+    /// <summary>
+    /// A range address
+    /// </summary>
+    /// <remarks>Examples of addresses are "A1" "B1:C2" "A:A" "1:1" "A1:E2,G3:G5" </remarks>
+    public class ExcelAddressBase : ExcelCellBase
+    {
+        internal protected int _fromRow=-1, _toRow, _fromCol, _toCol;
+        protected internal bool _fromRowFixed, _fromColFixed, _toRowFixed, _toColFixed;
+        internal protected string _wb;
+        internal protected string _ws;
+        internal protected string _address;
+        internal protected event EventHandler AddressChange;
+
+        internal enum eAddressCollition
+        {
+            No,
+            Partly,
+            Inside,
+            Equal
+        }        
+        internal enum eShiftType
+        {
+            Right,
+            Down,
+            EntireRow,
+            EntireColumn
+        }
+        #region "Constructors"
+        internal ExcelAddressBase()
+        {
+        }
+        /// <summary>
+        /// Creates an Address object
+        /// </summary>
+        /// <param name="fromRow">start row</param>
+        /// <param name="fromCol">start column</param>
+        /// <param name="toRow">End row</param>
+        /// <param name="toColumn">End column</param>
+        public ExcelAddressBase(int fromRow, int fromCol, int toRow, int toColumn)
+        {
+            _fromRow = fromRow;
+            _toRow = toRow;
+            _fromCol = fromCol;
+            _toCol = toColumn;
+            Validate();
+
+            _address = GetAddress(_fromRow, _fromCol, _toRow, _toCol);
+        }
+        /// <summary>
+        /// Creates an Address object
+        /// </summary>
+        /// <param name="fromRow">start row</param>
+        /// <param name="fromCol">start column</param>
+        /// <param name="toRow">End row</param>
+        /// <param name="toColumn">End column</param>
+        /// <param name="fromRowFixed">start row fixed</param>
+        /// <param name="fromColFixed">start column fixed</param>
+        /// <param name="toRowFixed">End row fixed</param>
+        /// <param name="toColFixed">End column fixed</param>
+        public ExcelAddressBase(int fromRow, int fromCol, int toRow, int toColumn, bool fromRowFixed, bool fromColFixed, bool toRowFixed, bool toColFixed)
+        {
+            _fromRow = fromRow;
+            _toRow = toRow;
+            _fromCol = fromCol;
+            _toCol = toColumn;
+            _fromRowFixed = fromRowFixed;
+            _fromColFixed = fromColFixed;
+            _toRowFixed = toRowFixed;
+            _toColFixed = toColFixed;
+            Validate();
+
+            _address = GetAddress(_fromRow, _fromCol, _toRow, _toCol, _fromRowFixed, fromColFixed, _toRowFixed, _toColFixed );
+        }
+        /// <summary>
+        /// Creates an Address object
+        /// </summary>
+        /// <remarks>Examples of addresses are "A1" "B1:C2" "A:A" "1:1" "A1:E2,G3:G5" </remarks>
+        /// <param name="address">The Excel Address</param>
+        public ExcelAddressBase(string address)
+        {
+            SetAddress(address);
+        }
+        /// <summary>
+        /// Creates an Address object
+        /// </summary>
+        /// <remarks>Examples of addresses are "A1" "B1:C2" "A:A" "1:1" "A1:E2,G3:G5" </remarks>
+        /// <param name="address">The Excel Address</param>
+        /// <param name="pck">Reference to the package to find information about tables and names</param>
+        /// <param name="referenceAddress">The address</param>
+        public ExcelAddressBase(string address, ExcelPackage pck, ExcelAddressBase referenceAddress)
+        {
+            SetAddress(address);
+            SetRCFromTable(pck, referenceAddress);
+        }
+
+        internal void SetRCFromTable(ExcelPackage pck, ExcelAddressBase referenceAddress)
+        {
+            if (string.IsNullOrEmpty(_wb) && Table != null)
+            {
+                foreach (var ws in pck.Workbook.Worksheets)
+                {
+                    foreach (var t in ws.Tables)
+                    {
+                        if (t.Name.Equals(Table.Name, StringComparison.InvariantCultureIgnoreCase))
+                        {
+                            _ws = ws.Name;
+                            if (Table.IsAll)
+                            {
+                                _fromRow = t.Address._fromRow;
+                                _toRow = t.Address._toRow;
+                            }
+                            else
+                            {
+                                if (Table.IsThisRow)
+                                {
+                                    if (referenceAddress == null)
+                                    {
+                                        _fromRow = -1;
+                                        _toRow = -1;
+                                    }
+                                    else
+                                    {
+                                        _fromRow = referenceAddress._fromRow;
+                                        _toRow = _fromRow;
+                                    }
+                                }
+                                else if (Table.IsHeader && Table.IsData)
+                                {
+                                    _fromRow = t.Address._fromRow;
+                                    _toRow = t.ShowTotal ? t.Address._toRow - 1 : t.Address._toRow;
+                                }
+                                else if (Table.IsData && Table.IsTotals)
+                                {
+                                    _fromRow = t.ShowHeader ? t.Address._fromRow + 1 : t.Address._fromRow;
+                                    _toRow = t.Address._toRow;
+                                }
+                                else if (Table.IsHeader)
+                                {
+                                    _fromRow = t.ShowHeader ? t.Address._fromRow : -1;
+                                    _toRow = t.ShowHeader ? t.Address._fromRow : -1;
+                                }
+                                else if (Table.IsTotals)
+                                {
+                                    _fromRow = t.ShowTotal ? t.Address._toRow : -1;
+                                    _toRow = t.ShowTotal ? t.Address._toRow : -1;
+                                }
+                                else
+                                {
+                                    _fromRow = t.ShowHeader ? t.Address._fromRow + 1 : t.Address._fromRow;
+                                    _toRow = t.ShowTotal ? t.Address._toRow - 1 : t.Address._toRow;
+                                }
+                            }
+
+                            if (string.IsNullOrEmpty(Table.ColumnSpan))
+                            {
+                                _fromCol = t.Address._fromCol;
+                                _toCol = t.Address._toCol;
+                                return;
+                            }
+                            else
+                            {
+                                var col = t.Address._fromCol;
+                                var cols = Table.ColumnSpan.Split(':');
+                                foreach (var c in t.Columns)
+                                {
+                                    if (_fromCol <= 0 && cols[0].Equals(c.Name, StringComparison.InvariantCultureIgnoreCase))   //Issue15063 Add invariant igore case
+                                    {
+                                        _fromCol = col;
+                                        if (cols.Length == 1)
+                                        {
+                                            _toCol = _fromCol;
+                                            return;
+                                        }
+                                    }
+                                    else if (cols.Length > 1 && _fromCol > 0 && cols[1].Equals(c.Name, StringComparison.InvariantCultureIgnoreCase)) //Issue15063 Add invariant igore case
+                                    {
+                                        _toCol = col;
+                                        return;
+                                    }
+
+                                    col++;
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+        
+        /// <summary>
+        /// Address is an defined name
+        /// </summary>
+        /// <param name="address">the name</param>
+        /// <param name="isName">Should always be true</param>
+        internal ExcelAddressBase(string address, bool isName)
+        {
+            if (isName)
+            {
+                _address = address;
+                _fromRow = -1;
+                _fromCol = -1;
+                _toRow = -1;
+                _toCol = -1;
+                _start = null;
+                _end = null;
+            }
+            else
+            {
+                SetAddress(address);
+            }
+        }
+
+        protected internal void SetAddress(string address)
+        {
+            if(address.StartsWith("'"))
+            {
+                int pos = address.IndexOf("'", 1);
+                while (pos < address.Length && address[pos + 1] == '\'')
+                {
+                    pos = address.IndexOf("'", pos+2);
+                }
+                var wbws = address.Substring(1,pos-1).Replace("''","'");
+                SetWbWs(wbws);
+                _address = address.Substring(pos + 2);
+            }
+            else if (address.StartsWith("[")) //Remove any external reference
+            {
+                SetWbWs(address);
+            }
+            else
+            {
+                _address = address;
+            }
+            if(_address.IndexOfAny(new char[] {',','!', '['}) > -1)
+            {
+                //Advanced address. Including Sheet or multi or table.
+                ExtractAddress(_address);
+            }
+            else
+            {
+                //Simple address
+                GetRowColFromAddress(_address, out _fromRow, out _fromCol, out _toRow, out  _toCol, out _fromRowFixed, out _fromColFixed,  out _toRowFixed, out _toColFixed);
+                _addresses = null;
+                _start = null;
+                _end = null;
+            }
+            _address = address;
+            Validate();
+        }
+        internal void ChangeAddress()
+        {
+            if (AddressChange != null)
+            {
+                AddressChange(this, new EventArgs());
+            }
+        }
+        private void SetWbWs(string address)
+        {
+            int pos;
+            if (address[0] == '[')
+            {
+                pos = address.IndexOf("]");
+                _wb = address.Substring(1, pos - 1);                
+                _ws = address.Substring(pos + 1);
+            }
+            else
+            {
+                _wb = "";
+                _ws = address;
+            }
+            pos = _ws.IndexOf("!");
+            if (pos > -1)
+            {
+                _address = _ws.Substring(pos + 1);
+                _ws = _ws.Substring(0, pos);
+            }
+        }
+        internal void ChangeWorksheet(string wsName, string newWs)
+        {
+            if (_ws == wsName) _ws = newWs;
+            var fullAddress = GetAddress();
+            
+            if (Addresses != null)
+            {
+                foreach (var a in Addresses)
+                {
+                    if (a._ws == wsName)
+                    {
+                        a._ws = newWs;
+                        fullAddress += "," + a.GetAddress();
+                    }
+                    else
+                    {
+                        fullAddress += "," + a._address;
+                    }
+                }
+            }
+            _address = fullAddress;
+        }
+
+        private string GetAddress()
+        {
+            var adr = "";
+            if (string.IsNullOrEmpty(_wb))
+            {
+                adr = "[" + _wb + "]";
+            }
+
+            if (string.IsNullOrEmpty(_ws))
+            {
+                adr += string.Format("'{0}'!", _ws);
+            }
+            adr += GetAddress(_fromRow, _fromCol, _toRow, _toCol);
+            return adr;
+        }
+
+        ExcelCellAddress _start = null;
+        #endregion
+        /// <summary>
+        /// Gets the row and column of the top left cell.
+        /// </summary>
+        /// <value>The start row column.</value>
+        public ExcelCellAddress Start
+        {
+            get
+            {
+                if (_start == null)
+                {
+                    _start = new ExcelCellAddress(_fromRow, _fromCol);
+                }
+                return _start;
+            }
+        }
+        ExcelCellAddress _end = null;
+        /// <summary>
+        /// Gets the row and column of the bottom right cell.
+        /// </summary>
+        /// <value>The end row column.</value>
+        public ExcelCellAddress End
+        {
+            get
+            {
+                if (_end == null)
+                {
+                    _end = new ExcelCellAddress(_toRow, _toCol);
+                }
+                return _end;
+            }
+        }
+        ExcelTableAddress _table=null;
+        public ExcelTableAddress Table
+        {
+            get
+            {
+                return _table;
+            }
+        }
+
+        /// <summary>
+        /// The address for the range
+        /// </summary>
+        public virtual string Address
+        {
+            get
+            {
+                return _address;
+            }
+        }        
+        /// <summary>
+        /// If the address is a defined name
+        /// </summary>
+        public bool IsName
+        {
+            get
+            {
+                return _fromRow < 0;
+            }
+        }
+        /// <summary>
+        /// Returns the address text
+        /// </summary>
+        /// <returns></returns>
+        public override string ToString()
+        {
+            return _address;
+        }
+        string _firstAddress;
+        /// <summary>
+        /// returns the first address if the address is a multi address.
+        /// A1:A2,B1:B2 returns A1:A2
+        /// </summary>
+        internal string FirstAddress
+        {
+            get
+            {
+                if (string.IsNullOrEmpty(_firstAddress))
+                {
+                    return _address;
+                }
+                else
+                {
+                    return _firstAddress;
+                }
+            }
+        }
+        internal string AddressSpaceSeparated
+        {
+            get
+            {
+                return _address.Replace(',', ' '); //Conditional formatting and a few other places use space as separator for mulit addresses.
+            }
+        }
+        /// <summary>
+        /// Validate the address
+        /// </summary>
+        protected void Validate()
+        {
+            if (_fromRow > _toRow || _fromCol > _toCol)
+            {
+                throw new ArgumentOutOfRangeException("Start cell Address must be less or equal to End cell address");
+            }
+        }
+        internal string WorkSheet
+        {
+            get
+            {
+                return _ws;
+            }
+        }
+        internal protected List<ExcelAddress> _addresses = null;
+        internal virtual List<ExcelAddress> Addresses
+        {
+            get
+            {
+                return _addresses;
+            }
+        }
+
+        private bool ExtractAddress(string fullAddress)
+        {
+            var brackPos=new Stack<int>();
+            var bracketParts=new List<string>();
+            string first="", second="";
+            bool isText=false, hasSheet=false;
+            try
+            {
+                if (fullAddress == "#REF!")
+                {
+                    SetAddress(ref fullAddress, ref second, ref hasSheet);
+                    return true;
+                }
+                for (int i = 0; i < fullAddress.Length; i++)
+                {
+                    var c = fullAddress[i];
+                    if (c == '\'')
+                    {
+                        if (isText && i + 1 < fullAddress.Length && fullAddress[i] == '\'')
+                        {
+                            if (hasSheet)
+                            {
+                                second += c;
+                            }
+                            else
+                            {
+                                first += c;
+                            }
+                        }
+                        isText = !isText;
+                    }
+                    else
+                    {
+                        if (brackPos.Count > 0)
+                        {
+                            if (c == '[' && !isText)
+                            {
+                                brackPos.Push(i);
+                            }
+                            else if (c == ']' && !isText)
+                            {
+                                if (brackPos.Count > 0)
+                                {
+                                    var from = brackPos.Pop();
+                                    bracketParts.Add(fullAddress.Substring(from + 1, i - from - 1));
+
+                                    if (brackPos.Count == 0)
+                                    {
+                                        HandleBrackets(first, second, bracketParts);
+                                    }
+                                }
+                                else
+                                {
+                                    //Invalid address!
+                                    return false;
+                                }
+                            }
+                        }
+                        else if (c == '[' && !isText)
+                        {
+                            brackPos.Push(i);
+                        }
+                        else if (c == '!' && !isText && !first.EndsWith("#REF") && !second.EndsWith("#REF"))
+                        {
+                            hasSheet = true;
+                        }
+                        else if (c == ',' && !isText)
+                        {
+                            SetAddress(ref first, ref second, ref hasSheet);
+                        }
+                        else
+                        {
+                            if (hasSheet)
+                            {
+                                second += c;
+                            }
+                            else
+                            {
+                                first += c;
+                            }
+                        }
+                    }
+                }
+                if (Table == null)
+                {
+                    SetAddress(ref first, ref second, ref hasSheet);
+                }
+                return true;
+            }
+            catch
+            {
+                return false;
+            }
+        }
+
+        private void HandleBrackets(string first, string second, List<string> bracketParts)
+        {
+            if(!string.IsNullOrEmpty(first))
+            {
+                _table = new ExcelTableAddress();
+                Table.Name = first;
+                foreach (var s in bracketParts)
+                {
+                    if(s.IndexOf("[")<0)
+                    {
+                        switch(s.ToLower(CultureInfo.InvariantCulture))                
+                        {
+                            case "#all":
+                                _table.IsAll = true;
+                                break;
+                            case "#headers":
+                               _table.IsHeader = true;
+                                break;
+                            case "#data":
+                                _table.IsData = true;
+                                break;
+                            case "#totals":
+                                _table.IsTotals = true;
+                                break;
+                            case "#this row":
+                                _table.IsThisRow = true;
+                                break;
+                            default:
+                                if(string.IsNullOrEmpty(_table.ColumnSpan))
+                                {
+                                    _table.ColumnSpan=s;
+                                }
+                                else
+                                {
+                                    _table.ColumnSpan += ":" + s;
+                                }
+                                break;
+                        }                
+                    }
+                }
+            }
+        }
+        #region Address manipulation methods
+        internal eAddressCollition Collide(ExcelAddressBase address)
+        {
+            if (address.WorkSheet != WorkSheet && address.WorkSheet!=null)
+            {
+                return eAddressCollition.No;
+            }
+
+            if (address._fromRow > _toRow || address._fromCol > _toCol
+                ||
+                _fromRow > address._toRow || _fromCol > address._toCol)
+            {
+                return eAddressCollition.No;
+            }
+            else if (address._fromRow == _fromRow && address._fromCol == _fromCol &&
+                    address._toRow == _toRow && address._toCol == _toCol)
+            {
+                return eAddressCollition.Equal;
+            }
+            else if (address._fromRow >= _fromRow && address._toRow <= _toRow &&
+                     address._fromCol >= _fromCol && address._toCol <= _toCol)
+            {
+                return eAddressCollition.Inside;
+            }
+            else
+                return eAddressCollition.Partly;
+        }
+        internal ExcelAddressBase AddRow(int row, int rows, bool setFixed=false)
+        {
+            if (row > _toRow)
+            {
+                return this;
+            }
+            else if (row <= _fromRow)
+            {
+                return new ExcelAddressBase((setFixed && _fromRowFixed ? _fromRow : _fromRow + rows), _fromCol, (setFixed && _toRowFixed ? _toRow : _toRow + rows), _toCol, _fromRowFixed, _fromColFixed, _toRowFixed, _toColFixed);
+            }
+            else
+            {
+                return new ExcelAddressBase(_fromRow, _fromCol, (setFixed && _toRowFixed ? _toRow : _toRow + rows), _toCol, _fromRowFixed, _fromColFixed, _toRowFixed, _toColFixed);
+            }
+        }
+        internal ExcelAddressBase DeleteRow(int row, int rows, bool setFixed = false)
+        {
+            if (row > _toRow) //After
+            {
+                return this;
+            }            
+            else if (row+rows <= _fromRow) //Before
+            {
+                return new ExcelAddressBase((setFixed && _fromRowFixed ? _fromRow : _fromRow - rows), _fromCol, (setFixed && _toRowFixed ? _toRow : _toRow - rows), _toCol, _fromRowFixed, _fromColFixed, _toRowFixed, _toColFixed);
+            }
+            else if (row <= _fromRow && row + rows > _toRow) //Inside
+            {
+                return null;
+            }
+            else  //Partly
+            {
+                if (row <= _fromRow)
+                {
+                    return new ExcelAddressBase(row, _fromCol, (setFixed && _toRowFixed ? _toRow : _toRow - rows), _toCol, _fromRowFixed, _fromColFixed, _toRowFixed, _toColFixed);
+                }
+                else
+                {
+                    return new ExcelAddressBase(_fromRow, _fromCol, (setFixed && _toRowFixed ? _toRow : _toRow - rows < row ? row - 1 : _toRow - rows), _toCol, _fromRowFixed, _fromColFixed, _toRowFixed, _toColFixed);
+                }
+            }
+        }
+        internal ExcelAddressBase AddColumn(int col, int cols, bool setFixed = false)
+        {
+            if (col > _toCol)
+            {
+                return this;
+            }
+            else if (col <= _fromCol)
+            {
+                return new ExcelAddressBase(_fromRow, (setFixed && _fromColFixed ? _fromCol : _fromCol + cols), _toRow, (setFixed && _toColFixed ? _toCol : _toCol + cols), _fromRowFixed, _fromColFixed, _toRowFixed, _toColFixed);
+            }
+            else
+            {
+                return new ExcelAddressBase(_fromRow, _fromCol, _toRow, (setFixed && _toColFixed ? _toCol : _toCol + cols), _fromRowFixed, _fromColFixed, _toRowFixed, _toColFixed);
+            }
+        }
+        internal ExcelAddressBase DeleteColumn(int col, int cols, bool setFixed = false)
+        {
+            if (col > _toCol) //After
+            {
+                return this;
+            }
+            else if (col + cols <= _fromCol) //Before
+            {
+                return new ExcelAddressBase(_fromRow, (setFixed && _fromColFixed ? _fromCol : _fromCol - cols), _toRow, (setFixed && _toColFixed ? _toCol :_toCol - cols), _fromRowFixed, _fromColFixed, _toRowFixed, _toColFixed);
+            }
+            else if (col <= _fromCol && col + cols > _toCol) //Inside
+            {
+                return null;
+            }
+            else  //Partly
+            {
+                if (col <= _fromCol)
+                {
+                    return new ExcelAddressBase(_fromRow, col, _toRow, (setFixed && _toColFixed ? _toCol : _toCol - cols), _fromRowFixed, _fromColFixed, _toRowFixed, _toColFixed);
+                }
+                else
+                {
+                    return new ExcelAddressBase(_fromRow, _fromCol, _toRow, (setFixed && _toColFixed ? _toCol :_toCol - cols < col ? col - 1 : _toCol - cols), _fromRowFixed, _fromColFixed, _toRowFixed, _toColFixed);
+                }
+            }
+        }
+        internal ExcelAddressBase Insert(ExcelAddressBase address, eShiftType Shift/*, out ExcelAddressBase topAddress, out ExcelAddressBase leftAddress, out ExcelAddressBase rightAddress, out ExcelAddressBase bottomAddress*/)
+        {
+            //Before or after, no change
+            //if ((_toRow > address._fromRow && _toCol > address.column) || 
+            //    (_fromRow > address._toRow && column > address._toCol))
+            if(_toRow < address._fromRow || _toCol < address._fromCol || (_fromRow > address._toRow && _fromCol > address._toCol))
+            {
+                //topAddress = null;
+                //leftAddress = null;
+                //rightAddress = null;
+                //bottomAddress = null;
+                return this;
+            }
+
+            int rows = address.Rows;
+            int cols = address.Columns;
+            string retAddress = "";
+            if (Shift==eShiftType.Right)
+            {
+                if (address._fromRow > _fromRow)
+                {
+                    retAddress = GetAddress(_fromRow, _fromCol, address._fromRow, _toCol, _fromRowFixed, _fromColFixed, _toRowFixed, _toColFixed);
+                }
+                if(address._fromCol > _fromCol)
+                {
+                    retAddress = GetAddress(_fromRow < address._fromRow ? _fromRow : address._fromRow, _fromCol, address._fromRow, _toCol, _fromRowFixed, _fromColFixed, _toRowFixed, _toColFixed);
+                }
+            }
+            if (_toRow < address._fromRow)
+            {
+                if (_fromRow < address._fromRow)
+                {
+
+                }
+                else
+                {
+                }
+            }
+            return null;
+        }
+        #endregion
+        private void SetAddress(ref string first, ref string second, ref bool hasSheet)
+        {
+            string ws, address;
+            if (hasSheet)
+            {
+                ws = first;
+                address = second;
+                first = "";
+                second = "";
+            }
+            else
+            {
+                address = first;
+                ws = "";
+                first = "";
+            }
+            hasSheet = false;
+            if (string.IsNullOrEmpty(_firstAddress))
+            {
+                if(string.IsNullOrEmpty(_ws) || !string.IsNullOrEmpty(ws)) _ws = ws;
+                _firstAddress = address;
+                GetRowColFromAddress(address, out _fromRow, out _fromCol, out _toRow, out  _toCol, out _fromRowFixed, out _fromColFixed, out _toRowFixed, out _toColFixed);
+            }
+            else
+            {
+                if (_addresses == null) _addresses = new List<ExcelAddress>();
+                _addresses.Add(new ExcelAddress(_ws, address));
+            }
+        }
+        internal enum AddressType
+        {
+            Invalid,
+            InternalAddress,
+            ExternalAddress,
+            InternalName,
+            ExternalName,
+            Formula
+        }
+
+        internal static AddressType IsValid(string Address)
+        {
+            double d;
+            if (Address == "#REF!")
+            {
+                return AddressType.Invalid;
+            }
+            else if(double.TryParse(Address, NumberStyles.Any, CultureInfo.InvariantCulture, out d)) //A double, no valid address
+            {
+                return AddressType.Invalid;
+            }
+            else if (IsFormula(Address))
+            {
+                return AddressType.Formula;
+            }
+            else
+            {
+                string wb, ws, intAddress;
+                if(SplitAddress(Address, out wb, out ws, out intAddress))
+                {
+                    if(intAddress.Contains("[")) //Table reference
+                    {
+                        return string.IsNullOrEmpty(wb) ? AddressType.InternalAddress : AddressType.ExternalAddress;
+                    }
+                    else if(intAddress.Contains(","))
+                    {
+                        intAddress=intAddress.Substring(0, intAddress.IndexOf(','));
+                    }
+                    if(IsAddress(intAddress))
+                    {
+                        return string.IsNullOrEmpty(wb) ? AddressType.InternalAddress : AddressType.ExternalAddress;
+                    }
+                    else
+                    {
+                        return string.IsNullOrEmpty(wb) ? AddressType.InternalName : AddressType.ExternalName;
+                    }
+                }
+                else
+                {
+                    return AddressType.Invalid;
+                }
+
+                //if(string.IsNullOrEmpty(wb));
+
+            }
+            //ExcelAddress a = new ExcelAddress(Address);
+            //if (Address.IndexOf('!') > 0)
+            //{                
+            //    string[] split = Address.Split('!');
+            //    if (split.Length == 2)
+            //    {
+            //        ws = split[0];
+            //        Address = split[1];
+            //    }
+            //    else if (split.Length == 3 && split[1] == "#REF" && split[2] == "")
+            //    {
+            //        ws = split[0];
+            //        Address = "#REF!";
+            //        if (ws.StartsWith("[") && ws.IndexOf("]") > 1)
+            //        {
+            //            return AddressType.ExternalAddress;
+            //        }
+            //        else
+            //        {
+            //            return AddressType.InternalAddress;
+            //        }
+            //    }
+            //    else
+            //    {
+            //        return AddressType.Invalid;
+            //    }            
+            //}
+            //int _fromRow, column, _toRow, _toCol;
+            //if (ExcelAddressBase.GetRowColFromAddress(Address, out _fromRow, out column, out _toRow, out _toCol))
+            //{
+            //    if (_fromRow > 0 && column > 0 && _toRow <= ExcelPackage.MaxRows && _toCol <= ExcelPackage.MaxColumns)
+            //    {
+            //        if (ws.StartsWith("[") && ws.IndexOf("]") > 1)
+            //        {
+            //            return AddressType.ExternalAddress;
+            //        }
+            //        else
+            //        {
+            //            return AddressType.InternalAddress;
+            //        }
+            //    }
+            //    else
+            //    {
+            //        return AddressType.Invalid;
+            //    }
+            //}
+            //else
+            //{
+            //    if(IsValidName(Address))
+            //    {
+            //        if (ws.StartsWith("[") && ws.IndexOf("]") > 1)
+            //        {
+            //            return AddressType.ExternalName;
+            //        }
+            //        else
+            //        {
+            //            return AddressType.InternalName;
+            //        }
+            //    }
+            //    else
+            //    {
+            //        return AddressType.Invalid;
+            //    }
+            //}
+
+        }
+
+        private static bool IsAddress(string intAddress)
+        {
+            if(string.IsNullOrEmpty(intAddress)) return false;            
+            var cells = intAddress.Split(':');
+            int fromRow,toRow, fromCol, toCol;
+
+            if(!GetRowCol(cells[0], out fromRow, out fromCol, false))
+            {
+                return false;
+            }
+            if (cells.Length > 1)
+            {
+                if (!GetRowCol(cells[1], out toRow, out toCol, false))
+                {
+                    return false;
+                }
+            }
+            else
+            {
+                toRow = fromRow;
+                toCol = fromCol;
+            }
+            if( fromRow <= toRow && 
+                fromCol <= toCol && 
+                fromCol > -1 && 
+                toCol <= ExcelPackage.MaxColumns && 
+                fromRow > -1 && 
+                toRow <= ExcelPackage.MaxRows)
+            {
+                return true;
+            }
+            else
+            {
+                return false;
+            }
+        }
+
+        private static bool SplitAddress(string Address, out string wb, out string ws, out string intAddress)
+        {
+            wb = "";
+            ws = "";
+            intAddress = "";
+            var text = "";
+            bool isText = false;
+            var brackPos=-1;
+            for (int i = 0; i < Address.Length; i++)
+            {
+                if (Address[i] == '\'')
+                {
+                    isText = !isText;
+                    if(i>0 && Address[i-1]=='\'')
+                    {
+                        text += "'";
+                    }
+                }
+                else
+                {
+                    if(Address[i]=='!' && !isText)
+                    {
+                        if (text.Length>0 && text[0] == '[')
+                        {
+                            wb = text.Substring(1, text.IndexOf("]") - 1);
+                            ws = text.Substring(text.IndexOf("]") + 1);
+                        }
+                        else
+                        {
+                            ws=text;
+                        }
+                        intAddress=Address.Substring(i+1);
+                        return true;
+                    }
+                    else
+                    {
+                        if(Address[i]=='[' && !isText)
+                        {
+                            if (i > 0) //Table reference return full address;
+                            {
+                                intAddress=Address;
+                                return true;
+                            }
+                            brackPos=i;
+                        }
+                        else if(Address[i]==']' && !isText)
+                        {
+                            if (brackPos > -1)
+                            {
+                                wb = text;
+                                text = "";
+                            }
+                            else
+                            {
+                                return false;
+                            }
+                        }
+                        else
+                        {
+                            text+=Address[i];
+                        }
+                    }
+                }
+            }
+            intAddress = text;
+            return true;
+        }
+
+        private static bool IsFormula(string address)
+        {
+            var isText = false;
+            for (int i = 0; i < address.Length; i++)
+            {
+                if (address[i] == '\'')
+                {
+                    isText = !isText;
+                }
+                else
+                {
+                    if (isText==false  && address.Substring(i, 1).IndexOfAny(new char[] { '(', ')', '+', '-', '*', '/', '.', '=', '^', '&', '%', '\"' }) > -1)
+                    {
+                        return true;
+                    }
+                }
+            }
+            return false;
+        }
+
+        private static bool IsValidName(string address)
+        {
+            if (Regex.IsMatch(address, "[^0-9./*-+,½!\"@#£%&/{}()\\[\\]=?`^~':;<>|][^/*-+,½!\"@#£%&/{}()\\[\\]=?`^~':;<>|]*"))
+            {
+                return true;
+            }
+            else
+            {
+                return false;
+            }
+        }
+
+        public int Rows 
+        {
+            get
+            {
+                return _toRow - _fromRow+1;
+            }
+        }
+        public int Columns
+        {
+            get
+            {
+                return _toCol - _fromCol + 1;
+            }
+        }
+
+        internal bool IsMultiCell()
+        {
+            return (_fromRow < _fromCol || _fromCol < _toCol);
+        }
+        internal static String GetWorkbookPart(string address)
+        {
+            var ix = 0;
+            if (address[0] == '[')
+            {
+                ix = address.IndexOf(']') + 1;
+                if (ix > 0)
+                {
+                    return address.Substring(1, ix - 2);
+                }
+            }
+            return "";
+        }
+        internal static string GetWorksheetPart(string address, string defaultWorkSheet)
+        {
+            int ix=0;
+            return GetWorksheetPart(address, defaultWorkSheet, ref ix);
+        }
+        internal static string GetWorksheetPart(string address, string defaultWorkSheet, ref int endIx)
+        {
+            if(address=="") return defaultWorkSheet;
+            var ix = 0;
+            if (address[0] == '[')
+            {
+                ix = address.IndexOf(']')+1;
+            }
+            if (ix > 0 && ix < address.Length)
+            {
+                if (address[ix] == '\'')
+                {
+                    return GetString(address, ix, out endIx);
+                }
+                else
+                {
+                    var ixEnd = address.IndexOf('!',ix);
+                    if(ixEnd>ix)
+                    {
+                        return address.Substring(ix, ixEnd-ix);
+                    }
+                    else
+                    {
+                        return defaultWorkSheet;
+                    }
+                }
+            }
+            else
+            {
+                return defaultWorkSheet;
+            }
+        }
+        internal static string GetAddressPart(string address)
+        {
+            var ix=0;
+            GetWorksheetPart(address, "", ref ix);
+            if(ix<address.Length)
+            {
+                if (address[ix] == '!')
+                {
+                    return address.Substring(ix + 1);
+                }
+                else
+                {
+                    return "";
+                }
+            }
+            else
+            {
+                return "";
+            }
+
+        }
+        internal static void SplitAddress(string fullAddress, out string wb, out string ws, out string address, string defaultWorksheet="")
+        {
+            wb = GetWorkbookPart(fullAddress);
+            int ix=0;
+            ws = GetWorksheetPart(fullAddress, defaultWorksheet, ref ix);
+            if (ix < fullAddress.Length)
+            {
+                if (fullAddress[ix] == '!')
+                {
+                    address = fullAddress.Substring(ix + 1);
+                }
+                else
+                {
+                    address = fullAddress.Substring(ix);
+                }
+            }
+            else
+            {
+                address="";
+            }
+        }
+        private static string GetString(string address, int ix, out int endIx)
+        {
+            var strIx = address.IndexOf("''");
+            var prevStrIx = ix;
+            while(strIx > -1) 
+            {
+                prevStrIx = strIx;
+                strIx = address.IndexOf("''");
+            }
+            endIx = address.IndexOf("'");
+            return address.Substring(ix, endIx - ix).Replace("''","'");
+        }
+
+        internal bool IsValidRowCol()
+        {
+            return !(_fromRow > _toRow  ||
+                   _fromCol > _toCol ||
+                   _fromRow < 1 ||
+                   _fromCol < 1 ||
+                   _toRow > ExcelPackage.MaxRows ||
+                   _toCol > ExcelPackage.MaxColumns);
+        }
+    }
+    /// <summary>
+    /// Range address with the address property readonly
+    /// </summary>
+    public class ExcelAddress : ExcelAddressBase
+    {
+        internal ExcelAddress()
+            : base()
+        {
+
+        }
+
+        public ExcelAddress(int fromRow, int fromCol, int toRow, int toColumn)
+            : base(fromRow, fromCol, toRow, toColumn)
+        {
+            _ws = "";
+        }
+        public ExcelAddress(string address)
+            : base(address)
+        {
+        }
+        
+        internal ExcelAddress(string ws, string address)
+            : base(address)
+        {
+            if (string.IsNullOrEmpty(_ws)) _ws = ws;
+        }
+        internal ExcelAddress(string ws, string address, bool isName)
+            : base(address, isName)
+        {
+            if (string.IsNullOrEmpty(_ws)) _ws = ws;
+        }
+
+        public ExcelAddress(string Address, ExcelPackage package, ExcelAddressBase referenceAddress) :
+            base(Address, package, referenceAddress)
+        {
+
+        }
+        /// <summary>
+        /// The address for the range
+        /// </summary>
+        /// <remarks>Examples of addresses are "A1" "B1:C2" "A:A" "1:1" "A1:E2,G3:G5" </remarks>
+        public new string Address
+        {
+            get
+            {
+                if (string.IsNullOrEmpty(_address) && _fromRow>0)
+                {
+                    _address = GetAddress(_fromRow, _fromCol, _toRow, _toCol);
+                }
+                return _address;
+            }
+            set
+            {                
+                SetAddress(value);
+                base.ChangeAddress();
+            }
+        }
+    }
+    public class ExcelFormulaAddress : ExcelAddressBase
+    {
+        bool _fromRowFixed, _toRowFixed, _fromColFixed, _toColFixed;
+        internal ExcelFormulaAddress()
+            : base()
+        {
+        }
+
+        public ExcelFormulaAddress(int fromRow, int fromCol, int toRow, int toColumn)
+            : base(fromRow, fromCol, toRow, toColumn)
+        {
+            _ws = "";
+        }
+        public ExcelFormulaAddress(string address)
+            : base(address)
+        {
+            SetFixed();
+        }
+        
+        internal ExcelFormulaAddress(string ws, string address)
+            : base(address)
+        {
+            if (string.IsNullOrEmpty(_ws)) _ws = ws;
+            SetFixed();
+        }
+        internal ExcelFormulaAddress(string ws, string address, bool isName)
+            : base(address, isName)
+        {
+            if (string.IsNullOrEmpty(_ws)) _ws = ws;
+            if(!isName)
+                SetFixed();
+        }
+
+        private void SetFixed()
+        {
+            if (Address.IndexOf("[") >= 0) return;
+            var address=FirstAddress;
+            if(_fromRow==_toRow && _fromCol==_toCol)
+            {
+                GetFixed(address, out _fromRowFixed, out _fromColFixed);
+            }
+            else
+            {
+                var cells = address.Split(':');
+                GetFixed(cells[0], out _fromRowFixed, out _fromColFixed);
+                GetFixed(cells[1], out _toRowFixed, out _toColFixed);
+            }
+        }
+
+        private void GetFixed(string address, out bool rowFixed, out bool colFixed)
+        {            
+            rowFixed=colFixed=false;
+            var ix=address.IndexOf('$');
+            while(ix>-1)
+            {
+                ix++;
+                if(ix < address.Length)
+                {
+                    if(address[ix]>='0' && address[ix]<='9')
+                    {
+                        rowFixed=true;
+                        break;
+                    }
+                    else
+                    {
+                        colFixed=true;
+                    }
+                }
+                ix = address.IndexOf('$', ix);
+            }
+        }
+        /// <summary>
+        /// The address for the range
+        /// </summary>
+        /// <remarks>Examples of addresses are "A1" "B1:C2" "A:A" "1:1" "A1:E2,G3:G5" </remarks>
+        public new string Address
+        {
+            get
+            {
+                if (string.IsNullOrEmpty(_address) && _fromRow>0)
+                {
+                    _address = GetAddress(_fromRow, _fromCol, _toRow, _toCol, _fromRowFixed, _toRowFixed, _fromColFixed, _toColFixed);
+                }
+                return _address;
+            }
+            set
+            {                
+                SetAddress(value);
+                base.ChangeAddress();
+                SetFixed();
+            }
+        }
+        internal new List<ExcelFormulaAddress> _addresses;
+        public new List<ExcelFormulaAddress> Addresses
+        {
+            get
+            {
+                if (_addresses == null)
+                {
+                    _addresses = new List<ExcelFormulaAddress>();
+                }
+                return _addresses;
+
+            }
+        }
+        internal string GetOffset(int row, int column)
+        {
+            int fromRow = _fromRow, fromCol = _fromCol, toRow = _toRow, tocol = _toCol;
+            var isMulti = (fromRow != toRow || fromCol != tocol);
+            if (!_fromRowFixed)
+            {
+                fromRow += row;
+            }
+            if (!_fromColFixed)
+            {
+                fromCol += column;
+            }
+            if (isMulti)
+            {
+                if (!_toRowFixed)
+                {
+                    toRow += row;
+                }
+                if (!_toColFixed)
+                {
+                    tocol += column;
+                }
+            }
+            else
+            {
+                toRow = fromRow;
+                tocol = fromCol;
+            }
+            string a = GetAddress(fromRow, fromCol, toRow, tocol, _fromRowFixed, _fromColFixed, _toRowFixed, _toColFixed);
+            if (Addresses != null)
+            {
+                foreach (var sa in Addresses)
+                {
+                    a+="," + sa.GetOffset(row, column);
+                }
+            }
+            return a;
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelBackgroundImage.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelBackgroundImage.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelBackgroundImage.cs	(revision 12707)
@@ -0,0 +1,163 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Jan Källman		Added		10-SEP-2009
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Xml;
+using System.Drawing;
+using System.IO;
+using OfficeOpenXml.Drawing;
+using OfficeOpenXml.Packaging;
+using OfficeOpenXml.Utils;
+namespace OfficeOpenXml
+{
+    /// <summary>
+    /// An image that fills the background of the worksheet.
+    /// </summary>
+    public class ExcelBackgroundImage : XmlHelper
+    {
+        ExcelWorksheet _workSheet;
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="nsm"></param>
+        /// <param name="topNode">The topnode of the worksheet</param>
+        /// <param name="workSheet">Worksheet reference</param>
+        internal  ExcelBackgroundImage(XmlNamespaceManager nsm, XmlNode topNode, ExcelWorksheet workSheet) :
+            base(nsm, topNode)
+        {
+            _workSheet = workSheet;
+        }
+        
+        const string BACKGROUNDPIC_PATH = "d:picture/@r:id";
+        /// <summary>
+        /// The background image of the worksheet. 
+        /// The image will be saved internally as a jpg.
+        /// </summary>
+        public Image Image
+        {
+            get
+            {
+                string relID = GetXmlNodeString(BACKGROUNDPIC_PATH);
+                if (!string.IsNullOrEmpty(relID))
+                {
+                    var rel = _workSheet.Part.GetRelationship(relID);
+                    var imagePart = _workSheet.Part.Package.GetPart(UriHelper.ResolvePartUri(rel.SourceUri, rel.TargetUri));
+                    return Image.FromStream(imagePart.GetStream());
+                }
+                return null;
+            }
+            set
+            {
+                DeletePrevImage();
+                if (value == null)
+                {
+                    DeleteAllNode(BACKGROUNDPIC_PATH);
+                }
+                else
+                {
+                    ImageConverter ic = new ImageConverter();
+                    byte[] img = (byte[])ic.ConvertTo(value, typeof(byte[]));
+                    var ii = _workSheet.Workbook._package.AddImage(img);
+                    var rel = _workSheet.Part.CreateRelationship(ii.Uri, Packaging.TargetMode.Internal, ExcelPackage.schemaRelationships + "/image");
+                    SetXmlNodeString(BACKGROUNDPIC_PATH, rel.Id);
+                }
+            }
+        }
+        /// <summary>
+        /// Set the picture from an image file. 
+        /// The image file will be saved as a blob, so make sure Excel supports the image format.
+        /// </summary>
+        /// <param name="PictureFile">The image file.</param>
+        public void SetFromFile(FileInfo PictureFile)
+        {
+            DeletePrevImage();
+
+            Image img;
+            try
+            {
+                img = Image.FromFile(PictureFile.FullName);
+            }
+            catch (Exception ex)
+            {
+                throw (new InvalidDataException("File is not a supported image-file or is corrupt", ex));
+            }
+
+            ImageConverter ic = new ImageConverter();
+            string contentType = ExcelPicture.GetContentType(PictureFile.Extension);
+            var imageURI = XmlHelper.GetNewUri(_workSheet._package.Package, "/xl/media/" + PictureFile.Name.Substring(0, PictureFile.Name.Length - PictureFile.Extension.Length) + "{0}" + PictureFile.Extension);
+
+            byte[] fileBytes = (byte[])ic.ConvertTo(img, typeof(byte[]));
+            var ii = _workSheet.Workbook._package.AddImage(fileBytes, imageURI, contentType);
+
+
+            if (_workSheet.Part.Package.PartExists(imageURI) && ii.RefCount==1) //The file exists with another content, overwrite it.
+            {
+                //Remove the part if it exists
+                _workSheet.Part.Package.DeletePart(imageURI);
+            }
+
+            var imagePart = _workSheet.Part.Package.CreatePart(imageURI, contentType, CompressionLevel.None);
+            //Save the picture to package.
+
+            var strm = imagePart.GetStream(FileMode.Create, FileAccess.Write);
+            strm.Write(fileBytes, 0, fileBytes.Length);
+
+            var rel = _workSheet.Part.CreateRelationship(imageURI, Packaging.TargetMode.Internal, ExcelPackage.schemaRelationships + "/image");
+            SetXmlNodeString(BACKGROUNDPIC_PATH, rel.Id);
+        }
+        private void DeletePrevImage()
+        {
+            var relID = GetXmlNodeString(BACKGROUNDPIC_PATH);
+            if (relID != "")
+            {
+                var ic = new ImageConverter();
+                byte[] img = (byte[])ic.ConvertTo(Image, typeof(byte[]));
+                var ii = _workSheet.Workbook._package.GetImageInfo(img);
+
+                //Delete the relation
+                _workSheet.Part.DeleteRelationship(relID);
+                
+                //Delete the image if there are no other references.
+                if (ii != null && ii.RefCount == 1)
+                {
+                    if (_workSheet.Part.Package.PartExists(ii.Uri))
+                    {
+                        _workSheet.Part.Package.DeletePart(ii.Uri);
+                    }
+                }
+                
+            }
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelCellAddress.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelCellAddress.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelCellAddress.cs	(revision 12707)
@@ -0,0 +1,155 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ *  Starnuto Di Topo & Jan Källman  Initial Release		        2010-03-14
+ * Jan Källman		License changed GPL-->LGPL 2011-12-27
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace OfficeOpenXml
+{
+    /// <summary>
+    /// A single cell address 
+    /// </summary>
+    public class ExcelCellAddress
+    {
+        public ExcelCellAddress()
+            : this(1, 1)
+        {
+
+        }
+
+        private int _row;
+        private int _column;
+        private string _address;
+        /// <summary>
+        /// Initializes a new instance of the ExcelCellAddress class.
+        /// </summary>
+        /// <param name="row">The row.</param>
+        /// <param name="column">The column.</param>
+        public ExcelCellAddress(int row, int column)
+        {
+            this.Row = row;
+            this.Column = column;
+        }
+        /// <summary>
+        /// Initializes a new instance of the ExcelCellAddress class.
+        /// </summary>
+        ///<param name="address">The address</param>
+        public ExcelCellAddress(string address)
+        {
+            this.Address = address; 
+        }
+        /// <summary>
+        /// Row
+        /// </summary>
+        public int Row
+        {
+            get
+            {
+                return this._row;
+            }
+            private set
+            {
+                if (value <= 0)
+                {
+                    throw new ArgumentOutOfRangeException("value", "Row cannot be less than 1.");
+                }
+                this._row = value;
+                if(_column>0) 
+                    _address = ExcelCellBase.GetAddress(_row, _column);
+                else
+                    _address = "#REF!";
+            }
+        }
+        /// <summary>
+        /// Column
+        /// </summary>
+        public int Column
+        {
+            get
+            {
+                return this._column;
+            }
+            private set
+            {
+                if (value <= 0)
+                {
+                    throw new ArgumentOutOfRangeException("value", "Column cannot be less than 1.");
+                }
+                this._column = value;
+                if (_row > 0)
+                    _address = ExcelCellBase.GetAddress(_row, _column);
+                else
+                    _address = "#REF!";
+            }
+        }
+        /// <summary>
+        /// Celladdress
+        /// </summary>
+        public string Address
+        {
+            get
+            {
+                return _address;
+            }
+            internal set
+            {
+                _address = value;
+                ExcelCellBase.GetRowColFromAddress(_address, out _row, out _column);
+            }
+        }
+        /// <summary>
+        /// If the address is an invalid reference (#REF!)
+        /// </summary>
+        public bool IsRef
+        {
+            get
+            {
+                return _row <= 0;
+            }
+        }
+
+        /// <summary>
+        /// Returns the letter corresponding to the supplied 1-based column index.
+        /// </summary>
+        /// <param name="column">Index of the column (1-based)</param>
+        /// <returns>The corresponding letter, like A for 1.</returns>
+        public static string GetColumnLetter(int column)
+        {
+            if (column > ExcelPackage.MaxColumns || column < 1)
+            {
+                throw new InvalidOperationException("Invalid 1-based column index: " + column + ". Valid range is 1 to " + ExcelPackage.MaxColumns);
+            }
+            return ExcelCellBase.GetColumnLetter(column);
+        }
+    }
+}
+
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelCellBase.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelCellBase.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelCellBase.cs	(revision 12707)
@@ -0,0 +1,905 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Jan Källman		Initial Release		        2009-10-01
+ * Jan Källman		License changed GPL-->LGPL 2011-12-27
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Text;
+using OfficeOpenXml.Style;
+using System.Text.RegularExpressions;
+using OfficeOpenXml.FormulaParsing.LexicalAnalysis;
+using System.Linq;
+using OfficeOpenXml.FormulaParsing.Excel.Functions;
+using OfficeOpenXml.FormulaParsing;
+namespace OfficeOpenXml
+{
+    /// <summary>
+    /// Base class containing cell address manipulating methods.
+    /// </summary>
+    public abstract class ExcelCellBase
+    {
+        #region "public functions"
+        /// <summary>
+        /// Get the sheet, row and column from the CellID
+        /// </summary>
+        /// <param name="cellID"></param>
+        /// <param name="sheet"></param>
+        /// <param name="row"></param>
+        /// <param name="col"></param>
+        static internal void SplitCellID(ulong cellID, out int sheet, out int row, out int col)
+        {
+            sheet = (int)(cellID % 0x8000);
+            col = ((int)(cellID >> 15) & 0x3FF);
+            row = ((int)(cellID >> 29));
+        }
+        /// <summary>
+        /// Get the cellID for the cell. 
+        /// </summary>
+        /// <param name="SheetID"></param>
+        /// <param name="row"></param>
+        /// <param name="col"></param>
+        /// <returns></returns>
+        internal static ulong GetCellID(int SheetID, int row, int col)
+        {
+            return ((ulong)SheetID) + (((ulong)col) << 15) + (((ulong)row) << 29);
+        }
+        #endregion
+        #region "Formula Functions"
+        private delegate string dlgTransl(string part, int row, int col, int rowIncr, int colIncr);
+        #region R1C1 Functions"
+        /// <summary>
+        /// Translates a R1C1 to an absolut address/Formula
+        /// </summary>
+        /// <param name="value">Address</param>
+        /// <param name="row">Current row</param>
+        /// <param name="col">Current column</param>
+        /// <returns>The RC address</returns>
+        public static string TranslateFromR1C1(string value, int row, int col)
+        {
+            return Translate(value, ToAbs, row, col, -1, -1);
+        }
+        /// <summary>
+        /// Translates a absolut address to R1C1 Format
+        /// </summary>
+        /// <param name="value">R1C1 Address</param>
+        /// <param name="row">Current row</param>
+        /// <param name="col">Current column</param>
+        /// <returns>The absolut address/Formula</returns>
+        public static string TranslateToR1C1(string value, int row, int col)
+        {
+            return Translate(value, ToR1C1, row, col, -1, -1);
+        }
+        /// <summary>
+        /// Translates betweein R1C1 or absolut addresses
+        /// </summary>
+        /// <param name="value">The addresss/function</param>
+        /// <param name="addressTranslator">The translating function</param>
+        /// <param name="row"></param>
+        /// <param name="col"></param>
+        /// <param name="rowIncr"></param>
+        /// <param name="colIncr"></param>
+        /// <returns></returns>
+        private static string Translate(string value, dlgTransl addressTranslator, int row, int col, int rowIncr, int colIncr)
+        {
+            if (value == "")
+                return "";
+            bool isText = false;
+            string ret = "";
+            string part = "";
+            char prevTQ = (char)0;
+            for (int pos = 0; pos < value.Length; pos++)
+            {
+                char c = value[pos];
+                if (c == '"' || c=='\'')
+                {
+                    if (isText == false && part != "" && prevTQ==c)
+                    {
+                        ret += addressTranslator(part, row, col, rowIncr, colIncr);
+                        part = "";
+                        prevTQ = (char)0;
+                    }
+                    prevTQ = c;
+                    isText = !isText;
+                    ret += c;
+                }
+                else if (isText)
+                {
+                    ret += c;
+                }
+                else
+                {
+                    if ((c == '-' || c == '+' || c == '*' || c == '/' ||
+                        c == '=' || c == '^' || c == ',' || c == ':' ||
+                        c == '<' || c == '>' || c == '(' || c == ')' || c == '!' ||
+                        c == ' ' || c == '&' || c == '%') &&
+                        (pos == 0 || value[pos - 1] != '[')) //Last part to allow for R1C1 style [-x]
+                    {
+                        ret += addressTranslator(part, row, col, rowIncr, colIncr) + c;
+                        part = "";
+                    }
+                    else
+                    {
+                        part += c;
+                    }
+                }
+            }
+            if (part != "")
+            {
+                ret += addressTranslator(part, row, col, rowIncr, colIncr);
+            }
+            return ret;
+        }
+        /// <summary>
+        /// Translate to R1C1
+        /// </summary>
+        /// <param name="part">the value to be translated</param>
+        /// <param name="row"></param>
+        /// <param name="col"></param>
+        /// <param name="rowIncr"></param>
+        /// <param name="colIncr"></param>
+        /// <returns></returns>
+        private static string ToR1C1(string part, int row, int col, int rowIncr, int colIncr)
+        {
+            int addrRow, addrCol;
+            string Ret = "R";
+            if (GetRowCol(part, out addrRow, out addrCol, false))
+            {
+                if (addrRow == 0 || addrCol == 0)
+                {
+                    return part;
+                }
+                if (part.IndexOf('$', 1) > 0)
+                {
+                    Ret += addrRow.ToString();
+                }
+                else if (addrRow - row != 0)
+                {
+                    Ret += string.Format("[{0}]", addrRow - row);
+                }
+
+                if (part.StartsWith("$"))
+                {
+                    return Ret + "C" + addrCol;
+                }
+                else if (addrCol - col != 0)
+                {
+                    return Ret + "C" + string.Format("[{0}]", addrCol - col);
+                }
+                else
+                {
+                    return Ret + "C";
+                }
+            }
+            else
+            {
+                return part;
+            }
+        }
+        /// <summary>
+        /// Translates to absolute address
+        /// </summary>
+        /// <param name="part"></param>
+        /// <param name="row"></param>
+        /// <param name="col"></param> 
+        /// <param name="rowIncr"></param>
+        /// <param name="colIncr"></param>
+        /// <returns></returns>
+        private static string ToAbs(string part, int row, int col, int rowIncr, int colIncr)
+        {
+            string check = part.ToUpper(CultureInfo.InvariantCulture);
+
+            int rStart = check.IndexOf("R");
+            if (rStart != 0)
+                return part;
+            if (part.Length == 1) //R
+            {
+                return GetAddress(row, col);
+            }
+
+            int cStart = check.IndexOf("C");
+            bool absoluteRow, absoluteCol;
+            if (cStart == -1)
+            {
+                int RNum = GetRC(part, row, out absoluteRow);
+                if (RNum > int.MinValue)
+                {
+                    return GetAddress(RNum, absoluteRow, col, false);
+                }
+                else
+                {
+                    return part;
+                }
+            }
+            else
+            {
+                int RNum = GetRC(part.Substring(1, cStart - 1), row, out absoluteRow);
+                int CNum = GetRC(part.Substring(cStart + 1, part.Length - cStart - 1), col, out absoluteCol);
+                if (RNum > int.MinValue && CNum > int.MinValue)
+                {
+                    return GetAddress(RNum, absoluteRow, CNum, absoluteCol);
+                }
+                else
+                {
+                    return part;
+                }
+            }
+        }
+        /// <summary>
+        /// Adds or subtracts a row or column to an address
+        /// </summary>
+        /// <param name="Address"></param>
+        /// <param name="row"></param>
+        /// <param name="col"></param>
+        /// <param name="rowIncr"></param>
+        /// <param name="colIncr"></param>
+        /// <returns></returns>
+        private static string AddToRowColumnTranslator(string Address, int row, int col, int rowIncr, int colIncr)
+        {
+            int fromRow, fromCol;
+            if (Address == "#REF!")
+            {
+                return Address;
+            }
+            if (GetRowCol(Address, out fromRow, out fromCol, false))
+            {
+                if (fromRow == 0 || fromCol == 0)
+                {
+                    return Address;
+                }
+                if (rowIncr != 0 && row != 0 && fromRow >= row && Address.IndexOf('$', 1) == -1)
+                {
+                    if (fromRow < row - rowIncr)
+                    {
+                        return "#REF!";
+                    }
+
+                    fromRow = fromRow + rowIncr;
+                }
+
+                if (colIncr != 0 && col != 0 && fromCol >= col && Address.StartsWith("$") == false)
+                {
+                    if (fromCol < col - colIncr)
+                    {
+                        return "#REF!";
+                    }
+
+                    fromCol = fromCol + colIncr;
+                }
+
+                Address = GetAddress(fromRow, Address.IndexOf('$', 1) > -1, fromCol, Address.StartsWith("$"));
+            }
+            return Address;
+        }
+
+        /// <summary>
+        /// Returns with brackets if the value is negative
+        /// </summary>
+        /// <param name="v">The value</param>
+        /// <returns></returns>
+        private static string GetRCFmt(int v)
+        {
+            return (v < 0 ? string.Format("[{0}]", v) : v > 0 ? v.ToString() : "");
+        }
+        /// <summary>
+        /// Get the offset value for RC format
+        /// </summary>
+        /// <param name="value"></param>
+        /// <param name="OffsetValue"></param>
+        /// <param name="fixedAddr"></param>
+        /// <returns></returns>
+        private static int GetRC(string value, int OffsetValue, out bool fixedAddr)
+        {
+            if (value == "")
+            {
+                fixedAddr = false;
+                return OffsetValue;
+            }
+            int num;
+            if (value[0] == '[' && value[value.Length - 1] == ']') //Offset?                
+            {
+                fixedAddr = false;
+                if (int.TryParse(value.Substring(1, value.Length - 2), out num))
+                {
+                    return (OffsetValue + num);
+                }
+                else
+                {
+                    return int.MinValue;
+                }
+            }
+            else
+            {
+                fixedAddr = true;
+                if (int.TryParse(value, out num))
+                {
+                    return num;
+                }
+                else
+                {
+                    return int.MinValue;
+                }
+            }
+        }
+        #endregion
+        #region "Address Functions"
+        #region GetColumnLetter
+        /// <summary>
+        /// Returns the character representation of the numbered column
+        /// </summary>
+        /// <param name="iColumnNumber">The number of the column</param>
+        /// <returns>The letter representing the column</returns>
+        protected internal static string GetColumnLetter(int iColumnNumber)
+        {
+            return GetColumnLetter(iColumnNumber, false);
+        }
+        protected internal static string GetColumnLetter(int iColumnNumber, bool fixedCol)
+        {
+
+            if (iColumnNumber < 1)
+            {
+                //throw new Exception("Column number is out of range");
+                return "#REF!";
+            }
+
+            string sCol = "";
+            do
+            {
+                sCol = ((char)('A' + ((iColumnNumber - 1) % 26))) + sCol;
+                iColumnNumber = (iColumnNumber - ((iColumnNumber - 1) % 26)) / 26;
+            }
+            while (iColumnNumber > 0);
+            return fixedCol ? "$" + sCol : sCol;
+        }
+        #endregion
+
+        internal static bool GetRowColFromAddress(string CellAddress, out int FromRow, out int FromColumn, out int ToRow, out int ToColumn)
+        {
+            bool fixedFromRow, fixedFromColumn, fixedToRow, fixedToColumn;
+            return GetRowColFromAddress(CellAddress, out FromRow, out FromColumn, out ToRow, out ToColumn, out fixedFromRow, out fixedFromColumn, out fixedToRow, out fixedToColumn);
+        }
+        /// <summary>
+        /// Get the row/columns for a Cell-address
+        /// </summary>
+        /// <param name="CellAddress">The address</param>
+        /// <param name="FromRow">Returns the to column</param>
+        /// <param name="FromColumn">Returns the from column</param>
+        /// <param name="ToRow">Returns the to row</param>
+        /// <param name="ToColumn">Returns the from row</param>
+        /// <param name="fixedFromRow">Is the from row fixed?</param>
+        /// <param name="fixedFromColumn">Is the from column fixed?</param>
+        /// <param name="fixedToRow">Is the to row fixed?</param>
+        /// <param name="fixedToColumn">Is the to column fixed?</param>
+        /// <returns></returns>
+        internal static bool GetRowColFromAddress(string CellAddress, out int FromRow, out int FromColumn, out int ToRow, out int ToColumn, out bool fixedFromRow, out bool fixedFromColumn, out bool fixedToRow, out bool fixedToColumn)
+        {
+            bool ret;
+            if (CellAddress.IndexOf('[') > 0) //External reference or reference to Table or Pivottable.
+            {
+                FromRow = -1;
+                FromColumn = -1;
+                ToRow = -1;
+                ToColumn = -1;
+                fixedFromRow = false;
+                fixedFromColumn = false;
+                fixedToRow= false;
+                fixedToColumn = false;
+                return false;
+            }
+
+            CellAddress = CellAddress.ToUpper(CultureInfo.InvariantCulture);
+            //This one can be removed when the worksheet Select format is fixed
+            if (CellAddress.IndexOf(' ') > 0)
+            {
+                CellAddress = CellAddress.Substring(0, CellAddress.IndexOf(' '));
+            }
+
+            if (CellAddress.IndexOf(':') < 0)
+            {
+                ret = GetRowColFromAddress(CellAddress, out FromRow, out FromColumn, out fixedFromRow, out fixedFromColumn);
+                ToColumn = FromColumn;
+                ToRow = FromRow;
+                fixedToRow = fixedFromRow;
+                fixedToColumn = fixedFromColumn;
+            }
+            else
+            {
+                string[] cells = CellAddress.Split(':');
+                ret = GetRowColFromAddress(cells[0], out FromRow, out FromColumn, out fixedFromRow, out fixedFromColumn);
+                if (ret)
+                    ret = GetRowColFromAddress(cells[1], out ToRow, out ToColumn, out fixedToRow, out fixedToColumn);
+                else
+                {
+                    GetRowColFromAddress(cells[1], out ToRow, out ToColumn, out fixedToRow, out fixedToColumn);
+                }
+
+                if (FromColumn <= 0)
+                    FromColumn = 1;
+                if (FromRow <= 0)
+                    FromRow = 1;
+                if (ToColumn <= 0)
+                    ToColumn = ExcelPackage.MaxColumns;
+                if (ToRow <= 0)
+                    ToRow = ExcelPackage.MaxRows;
+            }
+            return ret;
+        }
+        /// <summary>
+        /// Get the row/column for n Cell-address
+        /// </summary>
+        /// <param name="CellAddress">The address</param>
+        /// <param name="Row">Returns Tthe row</param>
+        /// <param name="Column">Returns the column</param>
+        /// <returns>true if valid</returns>
+        internal static bool GetRowColFromAddress(string CellAddress, out int Row, out int Column)
+        {
+            return GetRowCol(CellAddress, out Row, out Column, true);
+        }
+        internal static bool GetRowColFromAddress(string CellAddress, out int row, out int col, out bool fixedRow, out bool fixedCol)
+        {
+            return GetRowCol(CellAddress, out row, out col, true, out fixedRow, out fixedCol);
+        }
+
+        /// <summary>
+        /// Get the row/column for a Cell-address
+        /// </summary>
+        /// <param name="address">the address</param>
+        /// <param name="row">returns the row</param>
+        /// <param name="col">returns the column</param>
+        /// <param name="throwException">throw exception if invalid, otherwise returns false</param>
+        /// <returns></returns>
+        internal static bool GetRowCol(string address, out int row, out int col, bool throwException)
+        {
+            bool fixedRow, fixedCol;
+            return GetRowCol(address, out row, out col, throwException, out fixedRow, out fixedCol);
+        }
+        internal static bool GetRowCol(string address, out int row, out int col, bool throwException, out bool fixedRow, out bool fixedCol) {
+            bool colPart = true;
+            int colStartIx = 0;
+            int colLength = 0;
+            col = 0;
+            row = 0;
+            fixedRow = false;
+            fixedCol = false;
+
+            if (address.EndsWith("#REF!"))
+            {
+                row = 0;
+                col = 0;
+                return true;
+            }
+
+            int sheetMarkerIndex = address.IndexOf('!');
+            if (sheetMarkerIndex >= 0)
+            {
+                colStartIx = sheetMarkerIndex + 1;
+            }
+
+            for (int i = colStartIx; i < address.Length; i++)
+            {
+                char c = address[i];
+                if (colPart && ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')) && colLength <= 3)
+                {
+                    col *= 26;
+                    col += ((int)c) - 64;
+                    colLength++;
+                }
+                else if (c >= '0' && c <= '9')
+                {
+                    row *= 10;
+                    row += ((int)c) - 48;
+                    colPart = false;
+                }
+                else if (c == '$')
+                {
+                    if (i == colStartIx)
+                    {
+                        colStartIx++;
+                        fixedCol = true;
+                    }
+                    else
+                    {
+                        colPart = false;
+                        fixedRow = true;
+                    }
+                }
+                else if (c == ':')
+                {
+                    break;
+                }
+                else
+                {
+                    row = 0;
+                    col = 0;
+                    if (throwException)
+                    {
+                        throw (new Exception(string.Format("Invalid Address format {0}", address)));
+                    }
+                    else
+                    {
+                        return false;
+                    }
+                }
+            }
+            return row != 0 || col != 0;
+        }
+
+        private static int GetColumn(string sCol)
+        {
+            int col = 0;
+            int len = sCol.Length - 1;
+            for (int i = len; i >= 0; i--)
+            {
+                col += (((int)sCol[i]) - 64) * (int)(Math.Pow(26, len - i));
+            }
+            return col;
+        }
+        #region GetAddress
+        /// <summary>
+        /// Returns the AlphaNumeric representation that Excel expects for a Cell Address
+        /// </summary>
+        /// <param name="Row">The number of the row</param>
+        /// <param name="Column">The number of the column in the worksheet</param>
+        /// <returns>The cell address in the format A1</returns>
+        public static string GetAddress(int Row, int Column)
+        {
+            return GetAddress(Row, Column,false);
+        }
+        /// <summary>
+        /// Returns the AlphaNumeric representation that Excel expects for a Cell Address
+        /// </summary>
+        /// <param name="Row">The number of the row</param>
+        /// <param name="Column">The number of the column in the worksheet</param>
+        /// <param name="AbsoluteRow">Absolute row</param>
+        /// <param name="AbsoluteCol">Absolute column</param>
+        /// <returns>The cell address in the format A1</returns>
+        public static string GetAddress(int Row, bool AbsoluteRow, int Column, bool AbsoluteCol)
+        {
+            return ( AbsoluteCol ? "$" : "") + GetColumnLetter(Column) + ( AbsoluteRow ? "$" : "") + Row.ToString();
+        }
+        /// <summary>
+        /// Returns the AlphaNumeric representation that Excel expects for a Cell Address
+        /// </summary>
+        /// <param name="Row">The number of the row</param>
+        /// <param name="Column">The number of the column in the worksheet</param>
+        /// <param name="Absolute">Get an absolute address ($A$1)</param>
+        /// <returns>The cell address in the format A1</returns>
+        public static string GetAddress(int Row, int Column, bool Absolute)
+        {
+            if (Row == 0 || Column == 0)
+            {
+                return "#REF!";
+            }
+            if (Absolute)
+            {
+                return ("$" + GetColumnLetter(Column) + "$" + Row.ToString());
+            }
+            else
+            {
+                return (GetColumnLetter(Column) + Row.ToString());
+            }
+        }
+        /// <summary>
+        /// Returns the AlphaNumeric representation that Excel expects for a Cell Address
+        /// </summary>
+        /// <param name="FromRow">From row number</param>
+        /// <param name="FromColumn">From column number</param>
+        /// <param name="ToRow">To row number</param>
+        /// <param name="ToColumn">From column number</param>
+        /// <returns>The cell address in the format A1</returns>
+        public static string GetAddress(int FromRow, int FromColumn, int ToRow, int ToColumn)
+        {
+            return GetAddress(FromRow, FromColumn, ToRow, ToColumn, false);
+        }
+        /// <summary>
+        /// Returns the AlphaNumeric representation that Excel expects for a Cell Address
+        /// </summary>
+        /// <param name="FromRow">From row number</param>
+        /// <param name="FromColumn">From column number</param>
+        /// <param name="ToRow">To row number</param>
+        /// <param name="ToColumn">From column number</param>
+        /// <param name="Absolute">if true address is absolute (like $A$1)</param>
+        /// <returns>The cell address in the format A1</returns>
+        public static string GetAddress(int FromRow, int FromColumn, int ToRow, int ToColumn, bool Absolute)
+        {
+            if (FromRow == ToRow && FromColumn == ToColumn)
+            {
+                return GetAddress(FromRow, FromColumn, Absolute);
+            }
+            else
+            {
+                if (FromRow == 1 && ToRow == ExcelPackage.MaxRows)
+                {
+                    var absChar = Absolute ? "$" : "";
+                    return absChar + GetColumnLetter(FromColumn) + ":" + absChar + GetColumnLetter(ToColumn);
+                }
+                else if(FromColumn==1 && ToColumn==ExcelPackage.MaxColumns)
+                {
+                    var absChar = Absolute ? "$" : "";
+                    return absChar + FromRow.ToString() + ":" + absChar + ToRow.ToString();
+                }
+                else
+                {
+                    return GetAddress(FromRow, FromColumn, Absolute) + ":" + GetAddress(ToRow, ToColumn, Absolute);
+                }
+            }
+        }
+        /// <summary>
+        /// Returns the AlphaNumeric representation that Excel expects for a Cell Address
+        /// </summary>
+        /// <param name="FromRow">From row number</param>
+        /// <param name="FromColumn">From column number</param>
+        /// <param name="ToRow">To row number</param>
+        /// <param name="ToColumn">From column number</param>
+        /// <param name="FixedFromColumn"></param>
+        /// <param name="FixedFromRow"></param>
+        /// <param name="FixedToColumn"></param>
+        /// <param name="FixedToRow"></param>
+        /// <returns>The cell address in the format A1</returns>
+        public static string GetAddress(int FromRow, int FromColumn, int ToRow, int ToColumn, bool FixedFromRow, bool FixedFromColumn, bool FixedToRow, bool  FixedToColumn)
+        {
+            if (FromRow == ToRow && FromColumn == ToColumn)
+            {
+                return GetAddress(FromRow, FixedFromRow, FromColumn, FixedFromColumn);
+            }
+            else
+            {
+                if (FromRow == 1 && ToRow == ExcelPackage.MaxRows)
+                {
+                    return GetColumnLetter(FromColumn, FixedFromColumn) + ":" + GetColumnLetter(ToColumn, FixedToColumn);
+                }
+                else if (FromColumn == 1 && ToColumn == ExcelPackage.MaxColumns)
+                {                    
+                    return (FixedFromRow ? "$":"") + FromRow.ToString() + ":" + (FixedToRow ? "$":"") + ToRow.ToString();
+                }
+                else
+                {
+                    return GetAddress(FromRow, FixedFromRow, FromColumn, FixedFromColumn) + ":" + GetAddress(ToRow, FixedToRow, ToColumn, FixedToColumn);
+                }
+            }
+        }
+        /// <summary>
+        /// Get the full address including the worksheet name
+        /// </summary>
+        /// <param name="worksheetName">The name of the worksheet</param>
+        /// <param name="address">The address</param>
+        /// <returns>The full address</returns>
+        public static string GetFullAddress(string worksheetName, string address)
+        {
+            return GetFullAddress(worksheetName, address, true);
+        }
+        internal static string GetFullAddress(string worksheetName, string address, bool fullRowCol)
+        {
+               if (address.IndexOf("!") == -1 || address=="#REF!")
+               {
+                   if (fullRowCol)
+                   {
+                       string[] cells = address.Split(':');
+                       if (cells.Length > 0)
+                       {
+                           address = string.Format("'{0}'!{1}", worksheetName, cells[0]);
+                           if (cells.Length > 1)
+                           {
+                               address += string.Format(":{0}", cells[1]);
+                           }
+                       }
+                   }
+                   else
+                   {
+                       var a = new ExcelAddressBase(address);
+                       if ((a._fromRow == 1 && a._toRow == ExcelPackage.MaxRows) || (a._fromCol == 1 && a._toCol == ExcelPackage.MaxColumns))
+                       {
+                           address = string.Format("'{0}'!{1}{2}:{3}{4}", worksheetName, ExcelAddress.GetColumnLetter(a._fromCol), a._fromRow, ExcelAddress.GetColumnLetter(a._toCol), a._toRow);
+                       }
+                       else
+                       {
+                           address=GetFullAddress(worksheetName, address, true);
+                       }
+                   }
+               }
+               return address;
+        }
+        #endregion
+        #region IsValidCellAddress
+        public static bool IsValidAddress(string address)
+        {
+            address = address.ToUpper(CultureInfo.InvariantCulture);
+            string r1 = "", c1 = "", r2 = "", c2 = "";
+            bool isSecond = false;
+            for (int i = 0; i < address.Length; i++)
+            {
+                if (address[i] >= 'A' && address[i] <= 'Z')
+                {
+                    if (isSecond == false)
+                    {
+                        if (r1 != "") return false;
+                        c1 += address[i];
+                        if (c1.Length > 3) return false;
+                    }
+                    else
+                    {
+                        if (r2 != "") return false;
+                        c2 += address[i];
+                        if (c2.Length > 3) return false;
+                    }
+                }
+                else if (address[i] >= '0' && address[i] <= '9')
+                {
+                    if (isSecond == false)
+                    {
+                        r1 += address[i];
+                        if (r1.Length > 7) return false;
+                    }
+                    else
+                    {
+                        r2 += address[i];
+                        if (r2.Length > 7) return false;
+                    }
+                }
+                else if (address[i] == ':')
+                {
+                    isSecond=true;
+                }
+                else if (address[i] == '$')
+                {
+                    if (i == address.Length - 1 || address[i + 1] == ':')
+                    {
+                        return false;
+                    }
+                }
+                else
+                {
+                    return false;
+                }
+            }
+
+            if (r1!="" && c1!="" && r2 == "" && c2 == "")   //Single Cell
+            {
+                return (GetColumn(c1)<=ExcelPackage.MaxColumns && int.Parse(r1)<=ExcelPackage.MaxRows);   
+            }
+            else if (r1 != "" && r2 != "" && c1 != "" && c2 != "") //Range
+            {
+                var iR2 = int.Parse(r2);
+                var iC2 = GetColumn(c2);
+
+                return GetColumn(c1) <= iC2 && int.Parse(r1) <= iR2 &&
+                    iC2 <= ExcelPackage.MaxColumns && iR2 <= ExcelPackage.MaxRows;
+                                                    
+            }
+            else if (r1 == "" && r2 == "" && c1 != "" && c2 != "") //Full Column
+            {                
+                var c2n=GetColumn(c2);
+                return (GetColumn(c1) <= c2n && c2n <= ExcelPackage.MaxColumns);
+            }
+            else if (r1 != "" && r2 != "" && c1 == "" && c2 == "")
+            {
+                var iR2 = int.Parse(r2);
+
+                return int.Parse(r1) <= iR2 && iR2 <= ExcelPackage.MaxRows;
+            }
+            else
+            {
+                return false;
+            }
+        }
+        /// <summary>
+        /// Checks that a cell address (e.g. A5) is valid.
+        /// </summary>
+        /// <param name="cellAddress">The alphanumeric cell address</param>
+        /// <returns>True if the cell address is valid</returns>
+        public static bool IsValidCellAddress(string cellAddress)
+        {
+            bool result = false;
+            try
+            {
+                int row, col;
+                if (GetRowColFromAddress(cellAddress, out row, out col))
+                {
+                    if (row > 0 && col > 0 && row <= ExcelPackage.MaxRows && col <= ExcelPackage.MaxColumns)
+                        result = true;
+                    else
+                        result = false;
+                }
+            }
+            catch { }
+            return result;
+        }
+        #endregion
+        #region UpdateFormulaReferences
+        /// <summary>
+        /// Updates the Excel formula so that all the cellAddresses are incremented by the row and column increments
+        /// if they fall after the afterRow and afterColumn.
+        /// Supports inserting rows and columns into existing templates.
+        /// </summary>
+        /// <param name="Formula">The Excel formula</param>
+        /// <param name="rowIncrement">The amount to increment the cell reference by</param>
+        /// <param name="colIncrement">The amount to increment the cell reference by</param>
+        /// <param name="afterRow">Only change rows after this row</param>
+        /// <param name="afterColumn">Only change columns after this column</param>
+        /// <returns></returns>
+        internal static string UpdateFormulaReferences(string Formula, int rowIncrement, int colIncrement, int afterRow, int afterColumn, bool setFixed=false)
+        {
+            //return Translate(Formula, AddToRowColumnTranslator, afterRow, afterColumn, rowIncrement, colIncrement);
+            var d=new Dictionary<string, object>();
+            try
+            {
+                var sct = new SourceCodeTokenizer(FunctionNameProvider.Empty, NameValueProvider.Empty);
+                var tokens = sct.Tokenize(Formula);
+                String f = "";
+                foreach (var t in tokens)
+                {
+                    if (t.TokenType == TokenType.ExcelAddress)
+                    {
+                        var a = new ExcelAddressBase(t.Value);                        
+                        if (rowIncrement > 0)
+                        {
+                            a = a.AddRow(afterRow, rowIncrement, setFixed);
+                        }
+                        else if (rowIncrement < 0)
+                        {
+                            a = a.DeleteRow(afterRow, -rowIncrement, setFixed);
+                        }
+                        if (colIncrement > 0)
+                        {
+                            a = a.AddColumn(afterColumn, colIncrement, setFixed);
+                        }
+                        else if (colIncrement < 0)
+                        {
+                            a = a.DeleteColumn(afterColumn, -colIncrement, setFixed);
+                        }
+                        if (a == null || !a.IsValidRowCol())
+                        {
+                            f += "#REF!";
+                        }
+                        else
+                        {
+                            f += a.Address;
+                        }
+
+
+                    }
+                    else
+                    {
+                        f += t.Value;
+                    }
+                }
+                return f;
+            }
+            catch //Invalid formula, skip updateing addresses
+            {
+                return Formula;
+            }
+        }
+
+        #endregion
+        #endregion
+        #endregion
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelColumn.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelColumn.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelColumn.cs	(revision 12707)
@@ -0,0 +1,361 @@
+/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Jan Källman		Initial Release		        2009-10-01
+ * Jan Källman		License changed GPL-->LGPL 2011-12-27
+ *******************************************************************************/
+using System;
+using System.Xml;
+using OfficeOpenXml.Style;
+namespace OfficeOpenXml
+{
+    /// <summary>
+	/// Represents one or more columns within the worksheet
+	/// </summary>
+	public class ExcelColumn : IRangeID
+	{
+		private ExcelWorksheet _worksheet;
+		private XmlElement _colElement = null;
+
+		#region ExcelColumn Constructor
+		/// <summary>
+		/// Creates a new instance of the ExcelColumn class.  
+		/// For internal use only!
+		/// </summary>
+		/// <param name="Worksheet"></param>
+		/// <param name="col"></param>
+		protected internal ExcelColumn(ExcelWorksheet Worksheet, int col)
+        {
+            _worksheet = Worksheet;
+            _columnMin = col;
+            _columnMax = col;
+            _width = _worksheet.DefaultColWidth;
+        }
+		#endregion
+        internal int _columnMin;		
+		/// <summary>
+		/// Sets the first column the definition refers to.
+		/// </summary>
+		public int ColumnMin 
+		{
+            get { return _columnMin; }
+			//set { _columnMin=value; } 
+		}
+
+        internal int _columnMax;
+        /// <summary>
+		/// Sets the last column the definition refers to.
+		/// </summary>
+        public int ColumnMax 
+		{ 
+            get { return _columnMax; }
+			set 
+            {
+                if (value < _columnMin && value > ExcelPackage.MaxColumns)
+                {
+                    throw new Exception("ColumnMax out of range");
+                }
+
+                var cse = new CellsStoreEnumerator<object>(_worksheet._values, 0, 0, 0, ExcelPackage.MaxColumns);
+                while(cse.Next())
+                {
+                    var c = cse.Value as ExcelColumn;
+                    if (cse.Column > _columnMin && c.ColumnMax <= value && cse.Column!=_columnMin)
+                    {
+                        throw new Exception(string.Format("ColumnMax can not span over existing column {0}.",c.ColumnMin));
+                    }
+                }
+                _columnMax = value; 
+            } 
+		}
+        /// <summary>
+        /// Internal range id for the column
+        /// </summary>
+        internal ulong ColumnID
+        {
+            get
+            {
+                return ExcelColumn.GetColumnID(_worksheet.SheetID, ColumnMin);
+            }
+        }
+		#region ExcelColumn Hidden
+		/// <summary>
+		/// Allows the column to be hidden in the worksheet
+		/// </summary>
+        internal bool _hidden=false;
+        public bool Hidden
+		{
+			get
+			{
+                return _hidden;
+			}
+			set
+			{
+                if (_worksheet._package.DoAdjustDrawings)
+                {
+                    var pos = _worksheet.Drawings.GetDrawingWidths();
+                    _hidden = value;
+                    _worksheet.Drawings.AdjustWidth(pos);
+                }
+                else
+                {
+                    _hidden = value;
+                }
+			}
+		}
+		#endregion
+
+		#region ExcelColumn Width
+        internal double VisualWidth
+        {
+            get
+            {
+                if (_hidden || (Collapsed && OutlineLevel>0))
+                {
+                    return 0;
+                }
+                else
+                {
+                    return _width;
+                }
+            }
+        }
+        internal double _width;
+        /// <summary>
+        /// Sets the width of the column in the worksheet
+        /// </summary>
+        public double Width
+		{
+			get
+			{
+                return _width;
+			}
+			set	
+            {
+                if (_worksheet._package.DoAdjustDrawings)
+                {
+                    var pos = _worksheet.Drawings.GetDrawingWidths();
+                    _width = value;
+                    _worksheet.Drawings.AdjustWidth(pos);
+                }
+                else
+                {
+                    _width = value;
+                }
+
+                if (_hidden && value!=0)
+                {
+                    _hidden = false;
+                }
+            }
+		}
+        /// <summary>
+        /// If set to true a column automaticlly resize(grow wider) when a user inputs numbers in a cell. 
+        /// </summary>
+        public bool BestFit
+        {
+            get;
+            set;
+        }
+        /// <summary>
+        /// If the column is collapsed in outline mode
+        /// </summary>
+        public bool Collapsed { get; set; }
+        /// <summary>
+        /// Outline level. Zero if no outline
+        /// </summary>
+        public int OutlineLevel { get; set; }
+        /// <summary>
+        /// Phonetic
+        /// </summary>
+        public bool Phonetic { get; set; }
+        #endregion
+
+		#region ExcelColumn Style
+        /// <summary>
+        /// The Style applied to the whole column. Only effects cells with no individual style set. 
+        /// Use Range object if you want to set specific styles.
+        /// </summary>
+        public ExcelStyle Style
+        {
+            get
+            {
+                string letter = ExcelCellBase.GetColumnLetter(ColumnMin);
+                string endLetter = ExcelCellBase.GetColumnLetter(ColumnMax);
+                return _worksheet.Workbook.Styles.GetStyleObject(StyleID, _worksheet.PositionID, letter + ":" + endLetter);
+            }
+        }
+        internal string _styleName="";
+        /// <summary>
+		/// Sets the style for the entire column using a style name.
+		/// </summary>
+		public string StyleName
+		{
+            get
+            {
+                return _styleName;
+            }
+            set
+            {
+                StyleID = _worksheet.Workbook.Styles.GetStyleIdFromName(value);
+                _styleName = value;
+            }
+		}
+        //internal int _styleID = 0;
+        /// <summary>
+        /// Sets the style for the entire column using the style ID.  
+        /// </summary>
+        public int StyleID
+        {
+            get
+            {
+                return _worksheet._styles.GetValue(0, ColumnMin);
+            }
+            set
+            {
+                _worksheet._styles.SetValue(0, ColumnMin, value);
+            }
+        }
+        /// <summary>
+        /// Adds a manual page break after the column.
+        /// </summary>
+        public bool PageBreak
+        {
+            get;
+            set;
+        }
+        public bool Merged
+        {
+            get
+            {
+                return _worksheet.MergedCells[ColumnMin, 0] != null;
+            }
+            set
+            {
+                _worksheet.MergedCells.Add(new ExcelAddressBase(1, ColumnMin, ExcelPackage.MaxRows, ColumnMax), true);
+            }
+        }
+        #endregion
+
+		/// <summary>
+		/// Returns the range of columns covered by the column definition.
+		/// </summary>
+		/// <returns>A string describing the range of columns covered by the column definition.</returns>
+		public override string ToString()
+		{
+			return string.Format("Column Range: {0} to {1}", _colElement.GetAttribute("min"), _colElement.GetAttribute("min"));
+		}
+        /// <summary>
+        /// Set the column width from the content of the range. The minimum width is the value of the ExcelWorksheet.defaultColumnWidth property.
+        /// Note: Cells containing formulas are ignored since EPPlus don't have a calculation engine.
+        ///       Wrapped and merged cells are also ignored.
+        /// </summary>
+        public void AutoFit()
+        {
+            _worksheet.Cells[1, _columnMin, ExcelPackage.MaxRows, _columnMax].AutoFitColumns();
+        }
+
+        /// <summary>
+        /// Set the column width from the content.
+        /// Note: Cells containing formulas are ignored since EPPlus don't have a calculation engine.
+        ///       Wrapped and merged cells are also ignored.
+        /// </summary>
+        /// <param name="MinimumWidth">Minimum column width</param>
+        public void AutoFit(double MinimumWidth)
+        {
+            _worksheet.Cells[1, _columnMin, ExcelPackage.MaxRows, _columnMax].AutoFitColumns(MinimumWidth);
+        }
+
+        /// <summary>
+        /// Set the column width from the content.
+        /// Note: Cells containing formulas are ignored since EPPlus don't have a calculation engine.
+        ///       Wrapped and merged cells are also ignored.
+        /// </summary>
+        /// <param name="MinimumWidth">Minimum column width</param>
+        /// <param name="MaximumWidth">Maximum column width</param>
+        public void AutoFit(double MinimumWidth, double MaximumWidth)
+        {
+            _worksheet.Cells[1, _columnMin, ExcelPackage.MaxRows, _columnMax].AutoFitColumns(MinimumWidth, MaximumWidth);
+        }
+
+        /// <summary>
+        /// Get the internal RangeID
+        /// </summary>
+        /// <param name="sheetID">Sheet no</param>
+        /// <param name="column">Column</param>
+        /// <returns></returns>
+        internal static ulong GetColumnID(int sheetID, int column)
+        {
+            return ((ulong)sheetID) + (((ulong)column) << 15);
+        }
+
+        #region IRangeID Members
+
+        ulong IRangeID.RangeID
+        {
+            get
+            {
+                return ColumnID;
+            }
+            set
+            {
+                int prevColMin = _columnMin;
+                _columnMin = ((int)(value >> 15) & 0x3FF);
+                _columnMax += prevColMin - ColumnMin;
+                //Todo:More Validation
+                if (_columnMax > ExcelPackage.MaxColumns) _columnMax = ExcelPackage.MaxColumns;
+            }
+        }
+
+        #endregion
+
+        /// <summary>
+        /// Copies the current column to a new worksheet
+        /// </summary>
+        /// <param name="added">The worksheet where the copy will be created</param>
+        internal ExcelColumn Clone(ExcelWorksheet added)
+        {
+            return Clone(added, ColumnMin);
+        }
+        internal ExcelColumn Clone(ExcelWorksheet added, int col)
+        {
+            ExcelColumn newCol = added.Column(col);
+                newCol.ColumnMax = ColumnMax;
+                newCol.BestFit = BestFit;
+                newCol.Collapsed = Collapsed;
+                newCol.OutlineLevel = OutlineLevel;
+                newCol.PageBreak = PageBreak;
+                newCol.Phonetic = Phonetic;
+                newCol._styleName = _styleName;
+                newCol.StyleID = StyleID;
+                newCol.Width = Width;
+                newCol.Hidden = Hidden;
+                return newCol;
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelComment.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelComment.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelComment.cs	(revision 12707)
@@ -0,0 +1,151 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Jan Källman		Initial Release		     
+ * Jan Källman		License changed GPL-->LGPL 2011-12-27
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.Style;
+using System.Xml;
+using OfficeOpenXml.Drawing;
+using OfficeOpenXml.Drawing.Vml;
+
+namespace OfficeOpenXml
+{
+    /// <summary>
+    /// An Excel Cell Comment
+    /// </summary>
+    public class ExcelComment : ExcelVmlDrawingComment
+    {
+        internal XmlHelper _commentHelper;
+        private string _text;
+        internal ExcelComment(XmlNamespaceManager ns, XmlNode commentTopNode, ExcelRangeBase cell)
+            : base(null, cell, cell.Worksheet.VmlDrawingsComments.NameSpaceManager)
+        {
+            //_commentHelper = new XmlHelper(ns, commentTopNode);
+            _commentHelper = XmlHelperFactory.Create(ns, commentTopNode);
+            var textElem=commentTopNode.SelectSingleNode("d:text", ns);
+            if (textElem == null)
+            {
+                textElem = commentTopNode.OwnerDocument.CreateElement("text", ExcelPackage.schemaMain);
+                commentTopNode.AppendChild(textElem);
+            }
+            if (!cell.Worksheet._vmlDrawings.ContainsKey(ExcelAddress.GetCellID(cell.Worksheet.SheetID, cell.Start.Row, cell.Start.Column)))
+            {
+                cell.Worksheet._vmlDrawings.Add(cell);
+            }
+
+            TopNode = cell.Worksheet.VmlDrawingsComments[ExcelCellBase.GetCellID(cell.Worksheet.SheetID, cell.Start.Row, cell.Start.Column)].TopNode;
+            RichText = new ExcelRichTextCollection(ns,textElem);
+            var tNode = textElem.SelectSingleNode("d:t", ns);
+            if (tNode != null)
+            {
+                _text = tNode.InnerText;
+            }
+        }
+        const string AUTHORS_PATH = "d:comments/d:authors";
+        const string AUTHOR_PATH = "d:comments/d:authors/d:author";
+        /// <summary>
+        /// Author
+        /// </summary>
+        public string Author
+        {
+            get
+            {
+                int authorRef = _commentHelper.GetXmlNodeInt("@authorId");
+                return _commentHelper.TopNode.OwnerDocument.SelectSingleNode(string.Format("{0}[{1}]", AUTHOR_PATH, authorRef+1), _commentHelper.NameSpaceManager).InnerText;
+            }
+            set
+            {
+                int authorRef = GetAuthor(value);
+                _commentHelper.SetXmlNodeString("@authorId", authorRef.ToString());
+            }
+        }
+        private int GetAuthor(string value)
+        {
+            int authorRef = 0;
+            bool found = false;
+            foreach (XmlElement node in _commentHelper.TopNode.OwnerDocument.SelectNodes(AUTHOR_PATH, _commentHelper.NameSpaceManager))
+            {
+                if (node.InnerText == value)
+                {
+                    found = true;
+                    break;
+                }
+                authorRef++;
+            }
+            if (!found)
+            {
+                var elem = _commentHelper.TopNode.OwnerDocument.CreateElement("d", "author", ExcelPackage.schemaMain);
+                _commentHelper.TopNode.OwnerDocument.SelectSingleNode(AUTHORS_PATH, _commentHelper.NameSpaceManager).AppendChild(elem);
+                elem.InnerText = value;
+            }
+            return authorRef;
+        }
+        /// <summary>
+        /// The comment text 
+        /// </summary>
+        public string Text
+        {
+            get
+            {
+                if(!string.IsNullOrEmpty(RichText.Text)) return RichText.Text;
+                return _text;
+            }
+            set
+            {
+                RichText.Text = value;
+            }
+        }
+        /// <summary>
+        /// Sets the font of the first richtext item.
+        /// </summary>
+        public ExcelRichText Font
+        {
+            get
+            {
+                if (RichText.Count > 0)
+                {
+                    return RichText[0];
+                }
+                return null;
+            }
+        }
+        /// <summary>
+        /// Richtext collection
+        /// </summary>
+        public ExcelRichTextCollection RichText 
+        { 
+           get; 
+           set; 
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelCommentCollection.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelCommentCollection.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelCommentCollection.cs	(revision 12707)
@@ -0,0 +1,238 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Jan Källman		License changed GPL-->LGPL 2011-12-27
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Xml;
+using System.Collections;
+using OfficeOpenXml.Utils;
+namespace OfficeOpenXml
+{
+    /// <summary>
+    /// Collection of Excelcomment objects
+    /// </summary>  
+    public class ExcelCommentCollection : IEnumerable, IDisposable
+    {
+        internal RangeCollection _comments;
+        internal ExcelCommentCollection(ExcelPackage pck, ExcelWorksheet ws, XmlNamespaceManager ns)
+        {
+            CommentXml = new XmlDocument();
+            CommentXml.PreserveWhitespace = false;
+            NameSpaceManager=ns;
+            Worksheet=ws;
+            CreateXml(pck);
+            AddCommentsFromXml();
+        }
+        private void CreateXml(ExcelPackage pck)
+        {
+            var commentParts = Worksheet.Part.GetRelationshipsByType(ExcelPackage.schemaComment);
+            bool isLoaded=false;
+            CommentXml=new XmlDocument();
+            foreach(var commentPart in commentParts)
+            {
+                Uri = UriHelper.ResolvePartUri(commentPart.SourceUri, commentPart.TargetUri);
+                Part = pck.Package.GetPart(Uri);
+                XmlHelper.LoadXmlSafe(CommentXml, Part.GetStream()); 
+                RelId = commentPart.Id;
+                isLoaded=true;
+            }
+            //Create a new document
+            if(!isLoaded)
+            {
+                CommentXml.LoadXml("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?><comments xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\"><authors /><commentList /></comments>");
+                Uri = null;
+            }
+        }
+        private void AddCommentsFromXml()
+        {
+            var lst = new List<IRangeID>();
+            foreach (XmlElement node in CommentXml.SelectNodes("//d:commentList/d:comment", NameSpaceManager))
+            {
+                var comment = new ExcelComment(NameSpaceManager, node, new ExcelRangeBase(Worksheet, node.GetAttribute("ref")));
+                lst.Add(comment);
+            }
+            _comments = new RangeCollection(lst);
+        }
+        /// <summary>
+        /// Access to the comment xml document
+        /// </summary>
+        public XmlDocument CommentXml { get; set; }
+        internal Uri Uri { get; set; }
+        internal string RelId { get; set; }
+        internal XmlNamespaceManager NameSpaceManager { get; set; }
+        internal Packaging.ZipPackagePart Part
+        {
+            get;
+            set;
+        }
+        /// <summary>
+        /// A reference to the worksheet object
+        /// </summary>
+        public ExcelWorksheet Worksheet
+        {
+            get;
+            set;
+        }
+        /// <summary>
+        /// Number of comments in the collection
+        /// </summary>
+        public int Count
+        {
+            get
+            {
+                return _comments.Count;
+            }
+        }
+        /// <summary>
+        /// Indexer for the comments collection
+        /// </summary>
+        /// <param name="Index">The index</param>
+        /// <returns>The comment</returns>
+        public ExcelComment this[int Index]
+        {
+            get
+            {
+                if (Index < 0 || Index >= _comments.Count)
+                {
+                    throw(new ArgumentOutOfRangeException("Comment index out of range"));
+                }
+                return _comments[Index] as ExcelComment;
+            }
+        }
+        /// <summary>
+        /// Indexer for the comments collection
+        /// </summary>
+        /// <param name="cell">The cell</param>
+        /// <returns>The comment</returns>
+        public ExcelComment this[ExcelCellAddress cell]
+        {
+            get
+            {
+                ulong cellID=ExcelCellBase.GetCellID(Worksheet.SheetID, cell.Row, cell.Column);
+                if (_comments.IndexOf(cellID) >= 0)
+                {
+                    return _comments[cellID] as ExcelComment;
+                }
+                else
+                {
+                    return null;
+                }
+            }
+        }
+        /// <summary>
+        /// Adds a comment to the top left cell of the range
+        /// </summary>
+        /// <param name="cell">The cell</param>
+        /// <param name="Text">The comment text</param>
+        /// <param name="author">Author</param>
+        /// <returns>The comment</returns>
+        public ExcelComment Add(ExcelRangeBase cell, string Text, string author)
+        {            
+            var elem = CommentXml.CreateElement("comment", ExcelPackage.schemaMain);
+            int ix=_comments.IndexOf(ExcelAddress.GetCellID(Worksheet.SheetID, cell._fromRow, cell._fromCol));
+            //Make sure the nodes come on order.
+            if (ix < 0 && (~ix < _comments.Count))
+            {
+                ix = ~ix;
+                var preComment = _comments[ix] as ExcelComment;
+                preComment._commentHelper.TopNode.ParentNode.InsertBefore(elem, preComment._commentHelper.TopNode);
+            }
+            else
+            {
+                CommentXml.SelectSingleNode("d:comments/d:commentList", NameSpaceManager).AppendChild(elem);
+            }
+            elem.SetAttribute("ref", cell.Start.Address);
+            ExcelComment comment = new ExcelComment(NameSpaceManager, elem , cell);
+            comment.RichText.Add(Text);
+            if(author!="") 
+            {
+                comment.Author=author;
+            }
+            _comments.Add(comment);
+            //Check if a value exists otherwise add one so it is saved when the cells collection is iterated
+            if (!Worksheet._values.Exists(cell._fromRow, cell._fromCol))
+            {
+                Worksheet._values.SetValue(cell._fromRow, cell._fromCol, null);
+            }
+            return comment;
+        }
+        /// <summary>
+        /// Removes the comment
+        /// </summary>
+        /// <param name="comment">The comment to remove</param>
+        public void Remove(ExcelComment comment)
+        {
+            ulong id = ExcelAddress.GetCellID(Worksheet.SheetID, comment.Range._fromRow, comment.Range._fromCol);
+            int ix=_comments.IndexOf(id);
+            if (ix >= 0 && comment == _comments[ix])
+            {
+                comment.TopNode.ParentNode.RemoveChild(comment.TopNode); //Remove VML
+                comment._commentHelper.TopNode.ParentNode.RemoveChild(comment._commentHelper.TopNode); //Remove Comment
+
+                Worksheet.VmlDrawingsComments._drawings.Delete(id);
+                _comments.Delete(id);
+            }
+            else
+            {
+                throw (new ArgumentException("Comment does not exist in the worksheet"));
+            }
+        }
+
+        void IDisposable.Dispose() 
+        { 
+            if (_comments != null) 
+                ((IDisposable)_comments).Dispose(); 
+        } 
+        /// <summary>
+        /// Removes the comment at the specified position
+        /// </summary>
+        /// <param name="Index">The index</param>
+        public void RemoveAt(int Index)
+        {
+            Remove(this[Index]);
+        }
+        #region IEnumerable Members
+
+        IEnumerator IEnumerable.GetEnumerator()
+        {
+            return _comments;
+        }
+        #endregion
+
+        internal void Clear()
+        {
+            while(Count>0)
+            {
+                RemoveAt(0);
+            }
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelEncryption.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelEncryption.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelEncryption.cs	(revision 12707)
@@ -0,0 +1,175 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ ***************************************************************************************
+ * This class is created with the help of the MS-OFFCRYPTO PDF documentation... http://msdn.microsoft.com/en-us/library/cc313071(office.12).aspx
+ * Decrypytion library for Office Open XML files(Lyquidity) and Sminks very nice example 
+ * on "Reading compound documents in c#" on Stackoverflow. Many thanks!
+ ***************************************************************************************
+ *  
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Jan Källman		Added		10-AUG-2010
+ * Jan Källman		License changed GPL-->LGPL 2011-12-27
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace OfficeOpenXml
+{
+    /// <summary>
+    /// Encryption Algorithm
+    /// </summary>
+    public enum EncryptionAlgorithm
+    {
+        /// <summary>
+        /// 128-bit AES. Default
+        /// </summary>
+        AES128,
+        /// <summary>
+        /// 192-bit AES.
+        /// </summary>
+        AES192,
+        /// <summary>
+        /// 256-bit AES. 
+        /// </summary>
+        AES256
+    }
+    /// <summary>
+    /// The major version of the Encryption 
+    /// </summary>
+    public enum EncryptionVersion
+    {
+        /// <summary>
+        /// Standard Encryption.
+        /// Used in Excel 2007 and previous version with compatibility pack.
+        /// <remarks>Default AES 128 with SHA-1 as the hash algorithm. Spincount is hardcoded to 50000</remarks>
+        /// </summary>
+        Standard,
+        /// <summary>
+        /// Agile Encryption.
+        /// Used in Excel 2010-
+        /// Default.
+        /// </summary>
+        Agile
+    }
+    /// <summary>
+    /// How and if the workbook is encrypted
+    ///<seealso cref="ExcelProtection"/> 
+    ///<seealso cref="ExcelSheetProtection"/> 
+    /// </summary>
+    public class ExcelEncryption
+    {
+        /// <summary>
+        /// Constructor
+        /// <remarks>Default AES 256 with SHA-512 as the hash algorithm. Spincount is set to 100000</remarks>
+        /// </summary>
+        internal ExcelEncryption()
+        {
+            Algorithm = EncryptionAlgorithm.AES256;
+        }
+        /// <summary>
+        /// Constructor
+        /// </summary>
+        /// <param name="encryptionAlgorithm">Algorithm used to encrypt the package. Default is AES128</param>
+        internal ExcelEncryption(EncryptionAlgorithm encryptionAlgorithm)
+        {
+            Algorithm = encryptionAlgorithm;
+        }        
+        bool _isEncrypted = false;
+        /// <summary>
+        /// Is the package encrypted
+        /// </summary>
+        public bool IsEncrypted 
+        {
+            get
+            {
+                return _isEncrypted;
+            }
+            set
+            {
+                _isEncrypted = value;
+                if (_isEncrypted)
+                {
+                    if (_password == null) _password = "";
+                }
+                else
+                {
+                    _password = null;
+                }
+            }
+        }
+        string _password=null;
+        /// <summary>
+        /// The password used to encrypt the workbook.
+        /// </summary>
+        public string Password 
+        {
+            get
+            {
+                return _password;
+            }
+            set
+            {
+                _password = value;
+                _isEncrypted = (value != null);
+            }
+        }
+        /// <summary>
+        /// Algorithm used for encrypting the package. Default is AES 128-bit for standard and AES 256 for agile
+        /// </summary>
+        public EncryptionAlgorithm Algorithm { get; set; }
+        private EncryptionVersion _version = EncryptionVersion.Agile;
+        /// <summary>
+        /// The version of the encryption.        
+        /// </summary>
+        public EncryptionVersion Version
+        {
+            get
+            {
+                return _version;
+            }
+            set
+            {
+                if (value != Version)
+                {
+                    if (value == EncryptionVersion.Agile)
+                    {
+                        Algorithm = EncryptionAlgorithm.AES256;
+                    }
+                    else
+                    {
+                        Algorithm = EncryptionAlgorithm.AES128;
+                    }
+                    _version = value;
+                }
+            }
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelHeaderFooter.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelHeaderFooter.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelHeaderFooter.cs	(revision 12707)
@@ -0,0 +1,547 @@
+/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Jan Källman		                Initial Release		        2009-10-01
+ * Jan Källman                      Total rewrite               2010-03-01
+ * Jan Källman		License changed GPL-->LGPL 2011-12-27
+ * *******************************************************************************/
+using System;
+using System.Xml;
+using System.Text.RegularExpressions;
+using System.Drawing;
+using System.Collections.Generic;
+using OfficeOpenXml.Drawing.Vml;
+using System.IO;
+using OfficeOpenXml.Drawing;
+using OfficeOpenXml.Utils;
+namespace OfficeOpenXml
+{    
+    /// <summary>
+    /// How a picture will be aligned in the header/footer
+    /// </summary>
+    public enum PictureAlignment
+    {
+        /// <summary>
+        /// The picture will be added to the left aligned text
+        /// </summary>
+        Left,
+        /// <summary>
+        /// The picture will be added to the centered text
+        /// </summary>
+        Centered,
+        /// <summary>
+        /// The picture will be added to the right aligned text
+        /// </summary>
+        Right
+    }
+    #region class ExcelHeaderFooterText
+	/// <summary>
+    /// Print header and footer 
+    /// </summary>
+	public class ExcelHeaderFooterText
+	{
+        ExcelWorksheet _ws;
+        string _hf;
+        internal ExcelHeaderFooterText(XmlNode TextNode, ExcelWorksheet ws, string hf)
+        {
+            _ws = ws;
+            _hf = hf;
+            if (TextNode == null || string.IsNullOrEmpty(TextNode.InnerText)) return;
+            string text = TextNode.InnerText;
+            string code = text.Substring(0, 2);  
+            int startPos=2;
+            for (int pos=startPos;pos<text.Length-2;pos++)
+            {
+                string newCode = text.Substring(pos, 2);
+                if (newCode == "&C" || newCode == "&R")
+                {
+                    SetText(code, text.Substring(startPos, pos-startPos));
+                    startPos = pos+2;
+                    pos = startPos;
+                    code = newCode;
+                }
+            }
+            SetText(code, text.Substring(startPos, text.Length - startPos));
+        }
+        private void SetText(string code, string text)
+        {
+            switch (code)
+            {
+                case "&L":
+                    LeftAlignedText=text;
+                    break;
+                case "&C":
+                    CenteredText=text;
+                    break;
+                default:
+                    RightAlignedText=text;
+                    break;
+            }
+        }
+		/// <summary>
+		/// Get/set the text to appear on the left hand side of the header (or footer) on the worksheet.
+		/// </summary>
+		public string LeftAlignedText = null;
+		/// <summary>
+        /// Get/set the text to appear in the center of the header (or footer) on the worksheet.
+		/// </summary>
+		public string CenteredText = null;
+		/// <summary>
+        /// Get/set the text to appear on the right hand side of the header (or footer) on the worksheet.
+		/// </summary>
+		public string RightAlignedText = null;
+        /// <summary>
+        /// Inserts a picture at the end of the text in the header or footer
+        /// </summary>
+        /// <param name="Picture">The image object containing the Picture</param>
+        /// <param name="Alignment">Alignment. The image object will be inserted at the end of the Text.</param>
+        public ExcelVmlDrawingPicture InsertPicture(Image Picture, PictureAlignment Alignment)
+        {
+            string id = ValidateImage(Alignment);
+            
+            //Add the image
+            ImageConverter ic = new ImageConverter();
+            byte[] img = (byte[])ic.ConvertTo(Picture, typeof(byte[]));
+            var ii = _ws.Workbook._package.AddImage(img);
+
+            return AddImage(Picture, id, ii);
+        }
+        /// <summary>
+        /// Inserts a picture at the end of the text in the header or footer
+        /// </summary>
+        /// <param name="PictureFile">The image object containing the Picture</param>
+        /// <param name="Alignment">Alignment. The image object will be inserted at the end of the Text.</param>
+        public ExcelVmlDrawingPicture InsertPicture(FileInfo PictureFile, PictureAlignment Alignment)
+        {
+            string id = ValidateImage(Alignment);
+
+            Image Picture;
+            try
+            {
+                if (!PictureFile.Exists)
+                {
+                    throw (new FileNotFoundException(string.Format("{0} is missing", PictureFile.FullName)));
+                }
+                Picture = Image.FromFile(PictureFile.FullName);
+            }
+            catch (Exception ex)
+            {
+                throw (new InvalidDataException("File is not a supported image-file or is corrupt", ex));
+            }
+
+            ImageConverter ic = new ImageConverter();
+            string contentType = ExcelPicture.GetContentType(PictureFile.Extension);
+            var uriPic = XmlHelper.GetNewUri(_ws._package.Package, "/xl/media/"+PictureFile.Name.Substring(0, PictureFile.Name.Length-PictureFile.Extension.Length) + "{0}" + PictureFile.Extension);
+            byte[] imgBytes = (byte[])ic.ConvertTo(Picture, typeof(byte[]));
+            var ii = _ws.Workbook._package.AddImage(imgBytes, uriPic, contentType);
+
+            return AddImage(Picture, id, ii);
+        }
+
+        private ExcelVmlDrawingPicture AddImage(Image Picture, string id, ExcelPackage.ImageInfo ii)
+        {
+            double width = Picture.Width * 72 / Picture.HorizontalResolution,      //Pixel --> Points
+                   height = Picture.Height * 72 / Picture.VerticalResolution;      //Pixel --> Points
+            //Add VML-drawing            
+            return _ws.HeaderFooter.Pictures.Add(id, ii.Uri, "", width, height);
+        }
+        private string ValidateImage(PictureAlignment Alignment)
+        {
+            string id = string.Concat(Alignment.ToString()[0], _hf);
+            foreach (ExcelVmlDrawingPicture image in _ws.HeaderFooter.Pictures)
+            {
+                if (image.Id == id)
+                {
+                    throw (new InvalidOperationException("A picture already exists in this section"));
+                }
+            }
+            //Add the image placeholder to the end of the text
+            switch (Alignment)
+            {
+                case PictureAlignment.Left:
+                    LeftAlignedText += ExcelHeaderFooter.Image;
+                    break;
+                case PictureAlignment.Centered:
+                    CenteredText += ExcelHeaderFooter.Image;
+                    break;
+                default:
+                    RightAlignedText += ExcelHeaderFooter.Image;
+                    break;
+            }
+            return id;
+        }
+	}
+	#endregion
+
+	#region ExcelHeaderFooter
+	/// <summary>
+	/// Represents the Header and Footer on an Excel Worksheet
+	/// </summary>
+	public sealed class ExcelHeaderFooter : XmlHelper
+	{
+		#region Static Properties
+		/// <summary>
+        /// The code for "current page #"
+		/// </summary>
+		public const string PageNumber = @"&P";
+		/// <summary>
+        /// The code for "total pages"
+		/// </summary>
+		public const string NumberOfPages = @"&N";
+        /// <summary>
+        /// The code for "text font color"
+        /// RGB Color is specified as RRGGBB
+        /// Theme Color is specified as TTSNN where TT is the theme color Id, S is either "+" or "-" of the tint/shade value, NN is the tint/shade value.
+        /// </summary>
+        public const string FontColor = @"&K";
+		/// <summary>
+        /// The code for "sheet tab name"
+		/// </summary>
+		public const string SheetName = @"&A";
+		/// <summary>
+        /// The code for "this workbook's file path"
+		/// </summary>
+		public const string FilePath = @"&Z";
+		/// <summary>
+        /// The code for "this workbook's file name"
+		/// </summary>
+		public const string FileName = @"&F";
+		/// <summary>
+        /// The code for "date"
+		/// </summary>
+		public const string CurrentDate = @"&D";
+		/// <summary>
+        /// The code for "time"
+		/// </summary>
+		public const string CurrentTime = @"&T";
+        /// <summary>
+        /// The code for "picture as background"
+        /// </summary>
+        public const string Image = @"&G";
+        /// <summary>
+        /// The code for "outline style"
+        /// </summary>
+        public const string OutlineStyle = @"&O";
+        /// <summary>
+        /// The code for "shadow style"
+        /// </summary>
+        public const string ShadowStyle = @"&H";
+		#endregion
+
+		#region ExcelHeaderFooter Private Properties
+		internal ExcelHeaderFooterText _oddHeader;
+        internal ExcelHeaderFooterText _oddFooter;
+		internal ExcelHeaderFooterText _evenHeader;
+        internal ExcelHeaderFooterText _evenFooter;
+        internal ExcelHeaderFooterText _firstHeader;
+        internal ExcelHeaderFooterText _firstFooter;
+        private ExcelWorksheet _ws;
+        #endregion
+
+		#region ExcelHeaderFooter Constructor
+		/// <summary>
+		/// ExcelHeaderFooter Constructor
+		/// </summary>
+		/// <param name="nameSpaceManager"></param>
+        /// <param name="topNode"></param>
+        /// <param name="ws">The worksheet</param>
+		internal ExcelHeaderFooter(XmlNamespaceManager nameSpaceManager, XmlNode topNode, ExcelWorksheet ws) :
+            base(nameSpaceManager, topNode)
+		{
+            _ws = ws;
+            SchemaNodeOrder = new string[] { "headerFooter", "oddHeader", "oddFooter", "evenHeader", "evenFooter", "firstHeader", "firstFooter" };
+		}
+		#endregion
+
+		#region alignWithMargins
+        const string alignWithMarginsPath="@alignWithMargins";
+        /// <summary>
+		/// Gets/sets the alignWithMargins attribute
+		/// </summary>
+		public bool AlignWithMargins
+		{
+			get
+			{
+                return GetXmlNodeBool(alignWithMarginsPath);
+			}
+			set
+			{
+                SetXmlNodeString(alignWithMarginsPath, value ? "1" : "0");
+			}
+		}
+		#endregion
+
+        #region differentOddEven
+        const string differentOddEvenPath = "@differentOddEven";
+        /// <summary>
+		/// Gets/sets the flag that tells Excel to display different headers and footers on odd and even pages.
+		/// </summary>
+		public bool differentOddEven
+		{
+			get
+			{
+                return GetXmlNodeBool(differentOddEvenPath);
+			}
+			set
+			{
+                SetXmlNodeString(differentOddEvenPath, value ? "1" : "0");
+			}
+		}
+		#endregion
+
+		#region differentFirst
+        const string differentFirstPath = "@differentFirst";
+
+		/// <summary>
+		/// Gets/sets the flag that tells Excel to display different headers and footers on the first page of the worksheet.
+		/// </summary>
+		public bool differentFirst
+		{
+			get
+			{
+                return GetXmlNodeBool(differentFirstPath);
+			}
+			set
+			{
+                SetXmlNodeString(differentFirstPath, value ? "1" : "0");
+			}
+		}
+		#endregion
+
+		#region ExcelHeaderFooter Public Properties
+		/// <summary>
+		/// Provides access to the header on odd numbered pages of the document.
+		/// If you want the same header on both odd and even pages, then only set values in this ExcelHeaderFooterText class.
+		/// </summary>
+		public ExcelHeaderFooterText OddHeader 
+        { 
+            get 
+            {
+                if (_oddHeader == null)
+                {
+                    _oddHeader = new ExcelHeaderFooterText(TopNode.SelectSingleNode("d:oddHeader", NameSpaceManager), _ws, "H");
+                }
+                return _oddHeader; } 
+        }
+		/// <summary>
+		/// Provides access to the footer on odd numbered pages of the document.
+		/// If you want the same footer on both odd and even pages, then only set values in this ExcelHeaderFooterText class.
+		/// </summary>
+		public ExcelHeaderFooterText OddFooter 
+        { 
+            get 
+            {
+                if (_oddFooter == null)
+                {
+                    _oddFooter = new ExcelHeaderFooterText(TopNode.SelectSingleNode("d:oddFooter", NameSpaceManager), _ws, "F"); ;
+                }
+                return _oddFooter; 
+            } 
+        }
+		// evenHeader and evenFooter set differentOddEven = true
+		/// <summary>
+		/// Provides access to the header on even numbered pages of the document.
+		/// </summary>
+		public ExcelHeaderFooterText EvenHeader 
+        { 
+            get 
+            {
+                if (_evenHeader == null)
+                {
+                    _evenHeader = new ExcelHeaderFooterText(TopNode.SelectSingleNode("d:evenHeader", NameSpaceManager), _ws, "HEVEN");
+                    differentOddEven = true;
+                }
+                return _evenHeader; 
+            } 
+        }
+		/// <summary>
+		/// Provides access to the footer on even numbered pages of the document.
+		/// </summary>
+		public ExcelHeaderFooterText EvenFooter
+        { 
+            get 
+            {
+                if (_evenFooter == null)
+                {
+                    _evenFooter = new ExcelHeaderFooterText(TopNode.SelectSingleNode("d:evenFooter", NameSpaceManager), _ws, "FEVEN");
+                    differentOddEven = true;
+                }
+                return _evenFooter ; 
+            } 
+        }
+		/// <summary>
+		/// Provides access to the header on the first page of the document.
+		/// </summary>
+		public ExcelHeaderFooterText FirstHeader
+        { 
+            get 
+            {
+                if (_firstHeader == null)
+                {
+                    _firstHeader = new ExcelHeaderFooterText(TopNode.SelectSingleNode("d:firstHeader", NameSpaceManager), _ws, "HFIRST"); 
+                     differentFirst = true;
+                }
+                return _firstHeader; 
+            } 
+        }
+		/// <summary>
+		/// Provides access to the footer on the first page of the document.
+		/// </summary>
+		public ExcelHeaderFooterText FirstFooter
+        { 
+            get 
+            {
+                if (_firstFooter == null)
+                {
+                    _firstFooter = new ExcelHeaderFooterText(TopNode.SelectSingleNode("d:firstFooter", NameSpaceManager), _ws, "FFIRST"); 
+                    differentFirst = true;
+                }
+                return _firstFooter; 
+            } 
+        }
+        private ExcelVmlDrawingPictureCollection _vmlDrawingsHF = null;
+        /// <summary>
+        /// Vml drawings. Underlaying object for Header footer images
+        /// </summary>
+        public ExcelVmlDrawingPictureCollection Pictures
+        {
+            get
+            {
+                if (_vmlDrawingsHF == null)
+                {
+                    var vmlNode = _ws.WorksheetXml.SelectSingleNode("d:worksheet/d:legacyDrawingHF/@r:id", NameSpaceManager);
+                    if (vmlNode == null)
+                    {
+                        _vmlDrawingsHF = new ExcelVmlDrawingPictureCollection(_ws._package, _ws, null);
+                    }
+                    else
+                    {
+                        if (_ws.Part.RelationshipExists(vmlNode.Value))
+                        {
+                            var rel = _ws.Part.GetRelationship(vmlNode.Value);
+                            var vmlUri = UriHelper.ResolvePartUri(rel.SourceUri, rel.TargetUri);
+
+                            _vmlDrawingsHF = new ExcelVmlDrawingPictureCollection(_ws._package, _ws, vmlUri);
+                            _vmlDrawingsHF.RelId = rel.Id;
+                        }
+                    }
+                }
+                return _vmlDrawingsHF;
+            }
+        }
+		#endregion
+		#region Save  //  ExcelHeaderFooter
+		/// <summary>
+		/// Saves the header and footer information to the worksheet XML
+		/// </summary>
+		internal void Save()
+		{
+			if (_oddHeader != null)
+			{
+                SetXmlNodeString("d:oddHeader", GetText(OddHeader));
+			}
+			if (_oddFooter != null)
+			{
+                SetXmlNodeString("d:oddFooter", GetText(OddFooter));
+			}
+
+			// only set evenHeader and evenFooter 
+			if (differentOddEven)
+			{
+				if (_evenHeader != null)
+				{
+                    SetXmlNodeString("d:evenHeader", GetText(EvenHeader));
+				}
+				if (_evenFooter != null)
+				{
+                    SetXmlNodeString("d:evenFooter", GetText(EvenFooter));
+				}
+			}
+
+			// only set firstHeader and firstFooter
+			if (differentFirst)
+			{
+				if (_firstHeader != null)
+				{
+                    SetXmlNodeString("d:firstHeader", GetText(FirstHeader));
+				}
+				if (_firstFooter != null)
+				{
+                    SetXmlNodeString("d:firstFooter", GetText(FirstFooter));
+				}
+			}
+		}
+        internal void SaveHeaderFooterImages()
+        {
+            if (_vmlDrawingsHF != null)
+            {
+                if (_vmlDrawingsHF.Count == 0)
+                {
+                    if (_vmlDrawingsHF.Uri != null)
+                    {
+                        _ws.Part.DeleteRelationship(_vmlDrawingsHF.RelId);
+                        _ws._package.Package.DeletePart(_vmlDrawingsHF.Uri);
+                    }
+                }
+                else
+                {
+                    if (_vmlDrawingsHF.Uri == null)
+                    {
+                        _vmlDrawingsHF.Uri = XmlHelper.GetNewUri(_ws._package.Package, @"/xl/drawings/vmlDrawing{0}.vml");
+                    }
+                    if (_vmlDrawingsHF.Part == null)
+                    {
+                        _vmlDrawingsHF.Part = _ws._package.Package.CreatePart(_vmlDrawingsHF.Uri, "application/vnd.openxmlformats-officedocument.vmlDrawing", _ws._package.Compression);
+                        var rel = _ws.Part.CreateRelationship(UriHelper.GetRelativeUri(_ws.WorksheetUri, _vmlDrawingsHF.Uri), Packaging.TargetMode.Internal, ExcelPackage.schemaRelationships + "/vmlDrawing");
+                        _ws.SetHFLegacyDrawingRel(rel.Id);
+                        _vmlDrawingsHF.RelId = rel.Id;
+                        foreach (ExcelVmlDrawingPicture draw in _vmlDrawingsHF)
+                        {
+                            rel = _vmlDrawingsHF.Part.CreateRelationship(UriHelper.GetRelativeUri(_vmlDrawingsHF.Uri, draw.ImageUri), Packaging.TargetMode.Internal, ExcelPackage.schemaRelationships + "/image");
+                            draw.RelId = rel.Id;
+                        }
+                    }
+                    _vmlDrawingsHF.VmlDrawingXml.Save(_vmlDrawingsHF.Part.GetStream());
+                }
+            }
+        }
+		private string GetText(ExcelHeaderFooterText headerFooter)
+		{
+			string ret = "";
+			if (headerFooter.LeftAlignedText != null)
+				ret += "&L" + headerFooter.LeftAlignedText;
+			if (headerFooter.CenteredText != null)
+				ret += "&C" + headerFooter.CenteredText;
+			if (headerFooter.RightAlignedText != null)
+				ret += "&R" + headerFooter.RightAlignedText;
+			return ret;
+		}
+		#endregion
+	}
+	#endregion
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelHyperLink.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelHyperLink.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelHyperLink.cs	(revision 12707)
@@ -0,0 +1,167 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		Added this class		        2010-01-24
+ * Jan Källman		License changed GPL-->LGPL 2011-12-27
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace OfficeOpenXml
+{
+    /// <summary>
+    /// HyperlinkClass
+    /// </summary>
+    public class ExcelHyperLink : Uri
+    {
+        /// <summary>
+        /// A new hyperlink with the specified URI
+        /// </summary>
+        /// <param name="uriString">The URI</param>
+        public ExcelHyperLink(string uriString) :
+            base(uriString)
+        {
+            OriginalUri = (Uri)this;
+        }
+        /// <summary>
+        /// A new hyperlink with the specified URI. This syntax is obsolete
+        /// </summary>
+        /// <param name="uriString">The URI</param>
+        /// <param name="dontEscape"></param>
+        [Obsolete("base constructor 'System.Uri.Uri(string, bool)' is obsolete: 'The constructor has been deprecated. Please use new ExcelHyperLink(string). The dontEscape parameter is deprecated and is always false.")]
+        public ExcelHyperLink(string uriString, bool dontEscape) :
+            base(uriString, dontEscape)
+        {
+            OriginalUri = (Uri)this;
+        }
+        /// <summary>
+        /// A new hyperlink with the specified URI and kind
+        /// </summary>
+        /// <param name="uriString">The URI</param>
+        /// <param name="uriKind">Kind (absolute/relative or indeterminate)</param>
+        public ExcelHyperLink(string uriString, UriKind uriKind) :
+            base(uriString, uriKind)
+        {
+            OriginalUri = (Uri)this;
+        }
+        /// <summary>
+        /// Sheet internal reference
+        /// </summary>
+        /// <param name="referenceAddress">Address</param>
+        /// <param name="display">Displayed text</param>
+        public ExcelHyperLink(string referenceAddress, string display) :
+            base("xl://internal")   //URI is not used on internal links so put a dummy uri here.
+        {
+            _referenceAddress = referenceAddress;
+            _display = display;
+        }
+        string _referenceAddress = null;
+        /// <summary>
+        /// The Excel address for internal links.
+        /// </summary>
+        public string ReferenceAddress
+        {
+            get
+            {
+                return _referenceAddress;
+            }
+            set
+            {
+                _referenceAddress = value;
+            }
+        }
+        string _display = "";
+        /// <summary>
+        /// Displayed text
+        /// </summary>
+        public string Display
+        {
+            get
+            {
+                return _display;
+            }
+            set
+            {
+                _display = value;
+            }
+        }
+        /// <summary>
+        /// Tooltip
+        /// </summary>
+        public string ToolTip
+        {
+            get;
+            set;
+        }
+        int _colSpann = 0;
+        /// <summary>
+        /// If the hyperlink spans multiple columns
+        /// </summary>
+        public int ColSpann
+        {
+            get
+            {
+                return _colSpann;
+            }
+            set
+            {
+                _colSpann = value;
+            }
+        }
+        int _rowSpann = 0;
+        /// <summary>
+        /// If the hyperlink spans multiple rows
+        /// </summary>
+        public int RowSpann
+        {
+            get
+            {
+                return _rowSpann;
+            }
+            set
+            {
+                _rowSpann = value;
+            }
+        }
+        /// <summary>
+        /// Used to handle non absolute URI's. 
+        /// Is used if IsAblsoluteUri is true. The base URI will have a dummy value of xl://nonAbsolute.
+        /// </summary>
+        public Uri OriginalUri
+        {
+            get;
+            internal set;
+        }
+        internal string RId
+        {
+            get;
+            set;
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelNamedRange.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelNamedRange.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelNamedRange.cs	(revision 12707)
@@ -0,0 +1,122 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		Added this class		        2010-01-28
+ * Jan Källman		License changed GPL-->LGPL 2011-12-27
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace OfficeOpenXml
+{
+    /// <summary>
+    /// A named range. 
+    /// </summary>
+    public sealed class ExcelNamedRange : ExcelRangeBase 
+    {
+        ExcelWorksheet _sheet;
+        /// <summary>
+        /// A named range
+        /// </summary>
+        /// <param name="name">The name</param>
+        /// <param name="nameSheet">The sheet containing the name. null if its a global name</param>
+        /// <param name="sheet">Sheet where the address points</param>
+        /// <param name="address">The address</param>
+        /// <param name="index">The index in the collection</param>
+        public ExcelNamedRange(string name, ExcelWorksheet nameSheet , ExcelWorksheet sheet, string address, int index) :
+            base(sheet, address)
+        {
+            Name = name;
+            _sheet = nameSheet;
+            Index = index;
+
+        }
+        internal ExcelNamedRange(string name,ExcelWorkbook wb, ExcelWorksheet nameSheet, int index) :
+            base(wb, nameSheet, name, true)
+        {
+            Name = name;
+            _sheet = nameSheet;
+            Index = index;
+        }
+
+        /// <summary>
+        /// Name of the range
+        /// </summary>
+        public string Name
+        {
+            get;
+            internal set;
+        }
+        /// <summary>
+        /// Is the named range local for the sheet 
+        /// </summary>
+        public int LocalSheetId
+        {
+            get
+            {
+                if (_sheet == null)
+                {
+                    return -1;
+                }
+                else
+                {
+                    return _sheet.PositionID-1;
+                }
+            }
+        }
+        internal int Index
+        {
+            get;
+            set;
+        }
+        /// <summary>
+        /// Is the name hidden
+        /// </summary>
+        public bool IsNameHidden
+        {
+            get;
+            set;
+        }
+        /// <summary>
+        /// A comment for the Name
+        /// </summary>
+        public string NameComment
+        {
+            get;
+            set;
+        }
+        internal object NameValue { get; set; }
+        internal string NameFormula { get; set; }
+        public override string ToString()
+        {
+            return Name;
+        }
+
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelNamedRangeCollection.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelNamedRangeCollection.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelNamedRangeCollection.cs	(revision 12707)
@@ -0,0 +1,222 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		Added this class		        2010-01-28
+ * Jan Källman		License changed GPL-->LGPL 2011-12-27
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Collections;
+
+namespace OfficeOpenXml
+{
+    /// <summary>
+    /// Collection for named ranges
+    /// </summary>
+    public class ExcelNamedRangeCollection : IEnumerable<ExcelNamedRange>
+    {
+        internal ExcelWorksheet _ws;
+        internal ExcelWorkbook _wb;
+        internal ExcelNamedRangeCollection(ExcelWorkbook wb)
+        {
+            _wb = wb;
+            _ws = null;
+        }
+        internal ExcelNamedRangeCollection(ExcelWorkbook wb, ExcelWorksheet ws)
+        {
+            _wb = wb;
+            _ws = ws;
+        }
+        List<ExcelNamedRange> _list = new List<ExcelNamedRange>();
+        Dictionary<string, int> _dic = new Dictionary<string, int>(StringComparer.InvariantCultureIgnoreCase);
+        /// <summary>
+        /// Add a new named range
+        /// </summary>
+        /// <param name="Name">The name</param>
+        /// <param name="Range">The range</param>
+        /// <returns></returns>
+        public ExcelNamedRange Add(string Name, ExcelRangeBase Range)
+        {
+            ExcelNamedRange item;
+            if (Range.IsName)
+            {
+
+                item = new ExcelNamedRange(Name, _wb,_ws, _dic.Count);
+            }
+            else
+            {
+                item = new ExcelNamedRange(Name, _ws, Range.Worksheet, Range.Address, _dic.Count);
+            }
+
+            AddName(Name, item);
+
+            return item;
+        }
+
+        private void AddName(string Name, ExcelNamedRange item)
+        {
+            _dic.Add(Name, _list.Count);
+            _list.Add(item);
+        }
+        /// <summary>
+        /// Add a defined name referencing value
+        /// </summary>
+        /// <param name="Name"></param>
+        /// <param name="value"></param>
+        /// <returns></returns>
+        public ExcelNamedRange AddValue(string Name, object value)
+        {
+            var item = new ExcelNamedRange(Name,_wb, _ws, _dic.Count);
+            item.NameValue = value;
+            AddName(Name, item);
+            return item;
+        }
+
+        /// <summary>
+        /// Add a defined name referencing a formula -- the method name contains a typo.
+        /// This method is obsolete and will be removed in the future.
+        /// Use <see cref="AddFormula"/>
+        /// </summary>
+        /// <param name="Name"></param>
+        /// <param name="Formula"></param>
+        /// <returns></returns>
+        [Obsolete("Call AddFormula() instead.  See Issue Tracker Id #14687")]
+        public ExcelNamedRange AddFormla(string Name, string Formula)
+        {
+            return  this.AddFormula(Name, Formula);
+        }
+
+        /// <summary>
+        /// Add a defined name referencing a formula
+        /// </summary>
+        /// <param name="Name"></param>
+        /// <param name="Formula"></param>
+        /// <returns></returns>
+        public ExcelNamedRange AddFormula(string Name, string Formula)
+        {
+            var item = new ExcelNamedRange(Name, _wb, _ws, _dic.Count);
+            item.NameFormula = Formula;
+            AddName(Name, item);
+            return item;
+        }
+        /// <summary>
+        /// Remove a defined name from the collection
+        /// </summary>
+        /// <param name="Name">The name</param>
+        public void Remove(string Name)
+        {
+            if(_dic.ContainsKey(Name))
+            {
+                var ix = _dic[Name];
+
+                for (int i = ix+1; i < _list.Count; i++)
+                {
+                    _dic.Remove(_list[i].Name);
+                    _list[i].Index--;
+                    _dic.Add(_list[i].Name, _list[i].Index);
+                }
+                _dic.Remove(Name);
+                _list.RemoveAt(ix);
+            }
+        }
+        /// <summary>
+        /// Checks collection for the presence of a key
+        /// </summary>
+        /// <param name="key">key to search for</param>
+        /// <returns>true if the key is in the collection</returns>
+        public bool ContainsKey(string key)
+        {
+            return _dic.ContainsKey(key);
+        }
+        /// <summary>
+        /// The current number of items in the collection
+        /// </summary>
+        public int Count
+        {
+            get
+            {
+                return _dic.Count;
+            }
+        }
+        /// <summary>
+        /// Name indexer
+        /// </summary>
+        /// <param name="Name">The name (key) for a Named range</param>
+        /// <returns>a reference to the range</returns>
+        /// <remarks>
+        /// Throws a KeyNotFoundException if the key is not in the collection.
+        /// </remarks>
+        public ExcelNamedRange this[string Name]
+        {
+            get
+            {
+                return _list[_dic[Name]];
+            }
+        }
+        public ExcelNamedRange this[int Index]
+        {
+            get
+            {
+                return _list[Index];
+            }
+        }
+
+        #region "IEnumerable"
+        #region IEnumerable<ExcelNamedRange> Members
+        /// <summary>
+        /// Implement interface method IEnumerator&lt;ExcelNamedRange&gt; GetEnumerator()
+        /// </summary>
+        /// <returns></returns>
+        public IEnumerator<ExcelNamedRange> GetEnumerator()
+        {
+            return _list.GetEnumerator();
+        }
+        #endregion
+        #region IEnumerable Members
+        /// <summary>
+        /// Implement interface method IEnumeratable GetEnumerator()
+        /// </summary>
+        /// <returns></returns>
+        IEnumerator IEnumerable.GetEnumerator()
+        {
+            return _list.GetEnumerator();
+        }
+
+        #endregion
+        #endregion
+
+        internal void Clear()
+        {
+            while(Count>0)
+            {
+                Remove(_list[0].Name);
+            }
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelPackage.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelPackage.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelPackage.cs	(revision 12707)
@@ -0,0 +1,1199 @@
+/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		                Initial Release		        2009-10-01
+ * Starnuto Di Topo & Jan Källman   Added stream constructors 
+ *                                  and Load method Save as 
+ *                                  stream                      2010-03-14
+ * Jan Källman		License changed GPL-->LGPL 2011-12-27
+ *******************************************************************************/
+using System;
+using System.Xml;
+using System.IO;
+using System.Collections.Generic;
+using System.Security.Cryptography;
+using OfficeOpenXml.Drawing;
+using OfficeOpenXml.Utils;
+using OfficeOpenXml.Packaging.Ionic.Zlib;
+using OfficeOpenXml.FormulaParsing;
+using OfficeOpenXml.Encryption;
+namespace OfficeOpenXml
+{
+    /// <summary>
+    /// Maps to DotNetZips CompressionLevel enum
+    /// </summary>
+    public enum CompressionLevel
+    {
+        Level0 = 0,
+        None = 0,
+        Level1 = 1,
+        BestSpeed = 1,
+        Level2 = 2,
+        Level3 = 3,
+        Level4 = 4,
+        Level5 = 5,
+        Level6 = 6,
+        Default = 6,
+        Level7 = 7,
+        Level8 = 8,
+        BestCompression = 9,
+        Level9 = 9,
+    }
+    /// <summary>
+    /// Represents an Excel 2007/2010 XLSX file package.  
+    /// This is the top-level object to access all parts of the document.
+    /// <code>
+	///     FileInfo newFile = new FileInfo(outputDir.FullName + @"\sample1.xlsx");
+	/// 	if (newFile.Exists)
+	/// 	{
+	/// 		newFile.Delete();  // ensures we create a new workbook
+	/// 		newFile = new FileInfo(outputDir.FullName + @"\sample1.xlsx");
+	/// 	}
+	/// 	using (ExcelPackage package = new ExcelPackage(newFile))
+    ///     {
+    ///         // add a new worksheet to the empty workbook
+    ///         ExcelWorksheet worksheet = package.Workbook.Worksheets.Add("Inventory");
+    ///         //Add the headers
+    ///         worksheet.Cells[1, 1].Value = "ID";
+    ///         worksheet.Cells[1, 2].Value = "Product";
+    ///         worksheet.Cells[1, 3].Value = "Quantity";
+    ///         worksheet.Cells[1, 4].Value = "Price";
+    ///         worksheet.Cells[1, 5].Value = "Value";
+    ///
+    ///         //Add some items...
+    ///         worksheet.Cells["A2"].Value = "12001";
+    ///         worksheet.Cells["B2"].Value = "Nails";
+    ///         worksheet.Cells["C2"].Value = 37;
+    ///         worksheet.Cells["D2"].Value = 3.99;
+    ///
+    ///         worksheet.Cells["A3"].Value = "12002";
+    ///         worksheet.Cells["B3"].Value = "Hammer";
+    ///         worksheet.Cells["C3"].Value = 5;
+    ///         worksheet.Cells["D3"].Value = 12.10;
+    ///
+    ///         worksheet.Cells["A4"].Value = "12003";
+    ///         worksheet.Cells["B4"].Value = "Saw";
+    ///         worksheet.Cells["C4"].Value = 12;
+    ///         worksheet.Cells["D4"].Value = 15.37;
+    ///
+    ///         //Add a formula for the value-column
+    ///         worksheet.Cells["E2:E4"].Formula = "C2*D2";
+    ///
+    ///            //Ok now format the values;
+    ///         using (var range = worksheet.Cells[1, 1, 1, 5]) 
+    ///          {
+    ///             range.Style.Font.Bold = true;
+    ///             range.Style.Fill.PatternType = ExcelFillStyle.Solid;
+    ///             range.Style.Fill.BackgroundColor.SetColor(Color.DarkBlue);
+    ///             range.Style.Font.Color.SetColor(Color.White);
+    ///         }
+    ///
+    ///         worksheet.Cells["A5:E5"].Style.Border.Top.Style = ExcelBorderStyle.Thin;
+    ///         worksheet.Cells["A5:E5"].Style.Font.Bold = true;
+    ///
+    ///         worksheet.Cells[5, 3, 5, 5].Formula = string.Format("SUBTOTAL(9,{0})", new ExcelAddress(2,3,4,3).Address);
+    ///         worksheet.Cells["C2:C5"].Style.Numberformat.Format = "#,##0";
+    ///         worksheet.Cells["D2:E5"].Style.Numberformat.Format = "#,##0.00";
+    ///
+    ///         //Create an autofilter for the range
+    ///         worksheet.Cells["A1:E4"].AutoFilter = true;
+    ///
+    ///         worksheet.Cells["A1:E5"].AutoFitColumns(0);
+    ///
+    ///         // lets set the header text 
+    ///         worksheet.HeaderFooter.oddHeader.CenteredText = "&amp;24&amp;U&amp;\"Arial,Regular Bold\" Inventory";
+    ///         // add the page number to the footer plus the total number of pages
+    ///         worksheet.HeaderFooter.oddFooter.RightAlignedText =
+    ///         string.Format("Page {0} of {1}", ExcelHeaderFooter.PageNumber, ExcelHeaderFooter.NumberOfPages);
+    ///         // add the sheet name to the footer
+    ///         worksheet.HeaderFooter.oddFooter.CenteredText = ExcelHeaderFooter.SheetName;
+    ///         // add the file path to the footer
+    ///         worksheet.HeaderFooter.oddFooter.LeftAlignedText = ExcelHeaderFooter.FilePath + ExcelHeaderFooter.FileName;
+    ///
+    ///         worksheet.PrinterSettings.RepeatRows = worksheet.Cells["1:2"];
+    ///         worksheet.PrinterSettings.RepeatColumns = worksheet.Cells["A:G"];
+    ///
+    ///          // Change the sheet view to show it in page layout mode
+    ///           worksheet.View.PageLayoutView = true;
+    ///
+    ///         // set some document properties
+    ///         package.Workbook.Properties.Title = "Invertory";
+    ///         package.Workbook.Properties.Author = "Jan Källman";
+    ///         package.Workbook.Properties.Comments = "This sample demonstrates how to create an Excel 2007 workbook using EPPlus";
+    ///
+    ///         // set some extended property values
+    ///         package.Workbook.Properties.Company = "AdventureWorks Inc.";
+    ///
+    ///         // set some custom property values
+    ///         package.Workbook.Properties.SetCustomPropertyValue("Checked by", "Jan Källman");
+    ///         package.Workbook.Properties.SetCustomPropertyValue("AssemblyName", "EPPlus");
+    ///
+    ///         // save our new workbook and we are done!
+    ///         package.Save();
+    ///
+    ///       }
+    ///
+    ///       return newFile.FullName;
+    /// </code>
+    /// More samples can be found at  <a href="http://epplus.codeplex.com/">http://epplus.codeplex.com/</a>
+    /// </summary>
+	public sealed class ExcelPackage : IDisposable
+	{
+        internal const bool preserveWhitespace=false;
+        Stream _stream = null;
+        private bool _isExternalStream=false;
+        internal class ImageInfo
+        {
+            internal string Hash { get; set; }
+            internal Uri Uri{get;set;}
+            internal int RefCount { get; set; }
+            internal Packaging.ZipPackagePart Part { get; set; }
+        }
+        internal Dictionary<string, ImageInfo> _images = new Dictionary<string, ImageInfo>();
+		#region Properties
+		/// <summary>
+		/// Extention Schema types
+		/// </summary>
+        internal const string schemaXmlExtension = "application/xml";
+        internal const string schemaRelsExtension = "application/vnd.openxmlformats-package.relationships+xml";
+        /// <summary>
+		/// Main Xml schema name
+		/// </summary>
+		internal const string schemaMain = @"http://schemas.openxmlformats.org/spreadsheetml/2006/main";
+		/// <summary>
+		/// Relationship schema name
+		/// </summary>
+		internal const string schemaRelationships = @"http://schemas.openxmlformats.org/officeDocument/2006/relationships";
+                                                                              
+        internal const string schemaDrawings = @"http://schemas.openxmlformats.org/drawingml/2006/main";
+        internal const string schemaSheetDrawings = @"http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing";
+        internal const string schemaMarkupCompatibility = @"http://schemas.openxmlformats.org/markup-compatibility/2006";
+
+        internal const string schemaMicrosoftVml = @"urn:schemas-microsoft-com:vml";
+        internal const string schemaMicrosoftOffice = "urn:schemas-microsoft-com:office:office";
+        internal const string schemaMicrosoftExcel = "urn:schemas-microsoft-com:office:excel";
+
+        internal const string schemaChart = @"http://schemas.openxmlformats.org/drawingml/2006/chart";                                                        
+        internal const string schemaHyperlink = @"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink";
+        internal const string schemaComment = @"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments";
+        internal const string schemaImage = @"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image";
+        //Office properties
+        internal const string schemaCore = @"http://schemas.openxmlformats.org/package/2006/metadata/core-properties";
+        internal const string schemaExtended = @"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties";
+        internal const string schemaCustom = @"http://schemas.openxmlformats.org/officeDocument/2006/custom-properties";
+        internal const string schemaDc = @"http://purl.org/dc/elements/1.1/";
+        internal const string schemaDcTerms = @"http://purl.org/dc/terms/";
+        internal const string schemaDcmiType = @"http://purl.org/dc/dcmitype/";
+        internal const string schemaXsi = @"http://www.w3.org/2001/XMLSchema-instance";
+        internal const string schemaVt = @"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes";
+
+        //Pivottables
+        internal const string schemaPivotTable = @"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotTable+xml";
+        internal const string schemaPivotCacheDefinition = @"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheDefinition+xml";
+        internal const string schemaPivotCacheRecords = @"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheRecords+xml";
+
+        //VBA
+        internal const string schemaVBA = @"application/vnd.ms-office.vbaProject";
+        internal const string schemaVBASignature = @"application/vnd.ms-office.vbaProjectSignature";
+
+        internal const string contentTypeWorkbookDefault = @"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml";
+        internal const string contentTypeWorkbookMacroEnabled = "application/vnd.ms-excel.sheet.macroEnabled.main+xml";
+        internal const string contentTypeSharedString = @"application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml";
+        //Package reference
+        private Packaging.ZipPackage _package;
+		internal ExcelWorkbook _workbook;
+        /// <summary>
+        /// Maximum number of columns in a worksheet (16384). 
+        /// </summary>
+        public const int MaxColumns = 16384;
+        /// <summary>
+        /// Maximum number of rows in a worksheet (1048576). 
+        /// </summary>
+        public const int MaxRows = 1048576;
+		#endregion
+
+		#region ExcelPackage Constructors
+        /// <summary>
+        /// Create a new instance of the ExcelPackage. Output is accessed through the Stream property.
+        /// </summary>
+        public ExcelPackage()
+        {
+            Init();
+            ConstructNewFile(null);
+        }
+        /// <summary>
+		/// Create a new instance of the ExcelPackage class based on a existing file or creates a new file. 
+		/// </summary>
+		/// <param name="newFile">If newFile exists, it is opened.  Otherwise it is created from scratch.</param>
+        public ExcelPackage(FileInfo newFile)
+		{
+            Init();
+            File = newFile;
+            ConstructNewFile(null);
+        }
+        /// <summary>
+        /// Create a new instance of the ExcelPackage class based on a existing file or creates a new file. 
+        /// </summary>
+        /// <param name="newFile">If newFile exists, it is opened.  Otherwise it is created from scratch.</param>
+        /// <param name="password">Password for an encrypted package</param>
+        public ExcelPackage(FileInfo newFile, string password)
+        {
+            Init();
+            File = newFile;
+            ConstructNewFile(password);
+        }
+		/// <summary>
+		/// Create a new instance of the ExcelPackage class based on a existing template.
+		/// If newFile exists, it will be overwritten when the Save method is called
+		/// </summary>
+		/// <param name="newFile">The name of the Excel file to be created</param>
+		/// <param name="template">The name of the Excel template to use as the basis of the new Excel file</param>
+		public ExcelPackage(FileInfo newFile, FileInfo template)
+		{
+            Init();
+            File = newFile;
+            CreateFromTemplate(template, null);
+		}
+        /// <summary>
+        /// Create a new instance of the ExcelPackage class based on a existing template.
+        /// If newFile exists, it will be overwritten when the Save method is called
+        /// </summary>
+        /// <param name="newFile">The name of the Excel file to be created</param>
+        /// <param name="template">The name of the Excel template to use as the basis of the new Excel file</param>
+        /// <param name="password">Password to decrypted the template</param>
+        public ExcelPackage(FileInfo newFile, FileInfo template, string password)
+        {
+            Init();
+            File = newFile;
+            CreateFromTemplate(template, password);
+        }
+        /// <summary>
+        /// Create a new instance of the ExcelPackage class based on a existing template.
+        /// </summary>
+        /// <param name="template">The name of the Excel template to use as the basis of the new Excel file</param>
+        /// <param name="useStream">if true use a stream. If false create a file in the temp dir with a random name</param>
+        public ExcelPackage(FileInfo template, bool useStream)
+        {
+            Init();
+            CreateFromTemplate(template, null);
+            if (useStream == false)
+            {
+                File = new FileInfo(Path.GetTempPath() + Guid.NewGuid().ToString() + ".xlsx");
+            }
+        }
+        /// <summary>
+        /// Create a new instance of the ExcelPackage class based on a existing template.
+        /// </summary>
+        /// <param name="template">The name of the Excel template to use as the basis of the new Excel file</param>
+        /// <param name="useStream">if true use a stream. If false create a file in the temp dir with a random name</param>
+        /// <param name="password">Password to decrypted the template</param>
+        public ExcelPackage(FileInfo template, bool useStream, string password)
+        {
+            Init();
+            CreateFromTemplate(template, password);
+            if (useStream == false)
+            {
+                File = new FileInfo(Path.GetTempPath() + Guid.NewGuid().ToString() + ".xlsx");
+            }
+        }
+        /// <summary>
+        /// Create a new instance of the ExcelPackage class based on a stream
+        /// </summary>
+        /// <param name="newStream">The stream object can be empty or contain a package. The stream must be Read/Write</param>
+        public ExcelPackage(Stream newStream) 
+        {
+            Init();
+            if (newStream.Length == 0)
+            {
+                _stream = newStream;
+                _isExternalStream = true;
+                ConstructNewFile(null);
+            }
+            else
+            {                
+                Load(newStream);
+            }
+        }
+        /// <summary>
+        /// Create a new instance of the ExcelPackage class based on a stream
+        /// </summary>
+        /// <param name="newStream">The stream object can be empty or contain a package. The stream must be Read/Write</param>
+        /// <param name="Password">The password to decrypt the document</param>
+        public ExcelPackage(Stream newStream, string Password)
+        {
+            if (!(newStream.CanRead && newStream.CanWrite))
+            {
+                throw new Exception("The stream must be read/write");
+            }
+
+            Init();
+            if (newStream.Length > 0)
+            {
+                Load(newStream,Password);
+            }
+            else
+            {
+                _stream = newStream;
+                _isExternalStream = true;
+                //_package = Package.Open(_stream, FileMode.Create, FileAccess.ReadWrite); TODO:Remove
+                _package = new Packaging.ZipPackage(_stream);
+                CreateBlankWb();
+            }
+        }
+        /// <summary>
+        /// Create a new instance of the ExcelPackage class based on a stream
+        /// </summary>
+        /// <param name="newStream">The output stream. Must be an empty read/write stream.</param>
+        /// <param name="templateStream">This stream is copied to the output stream at load</param>
+        public ExcelPackage(Stream newStream, Stream templateStream)
+        {
+            if (newStream.Length > 0)
+            {
+                throw(new Exception("The output stream must be empty. Length > 0"));
+            }
+            else if (!(newStream.CanRead && newStream.CanWrite))
+            {
+                throw new Exception("The stream must be read/write");
+            }
+            Init();
+            Load(templateStream, newStream, null);
+        }
+        /// <summary>
+        /// Create a new instance of the ExcelPackage class based on a stream
+        /// </summary>
+        /// <param name="newStream">The output stream. Must be an empty read/write stream.</param>
+        /// <param name="templateStream">This stream is copied to the output stream at load</param>
+        /// <param name="Password">Password to decrypted the template</param>
+        public ExcelPackage(Stream newStream, Stream templateStream, string Password)
+        {
+            if (newStream.Length > 0)
+            {
+                throw (new Exception("The output stream must be empty. Length > 0"));
+            }
+            else if (!(newStream.CanRead && newStream.CanWrite))
+            {
+                throw new Exception("The stream must be read/write");
+            }
+            Init();
+            Load(templateStream, newStream, Password);
+        }
+        #endregion
+        internal ImageInfo AddImage(byte[] image)
+        {
+            return AddImage(image, null, "");
+        }
+        internal ImageInfo AddImage(byte[] image, Uri uri, string contentType)
+        {
+            var hashProvider = new SHA1CryptoServiceProvider();
+            var hash = BitConverter.ToString(hashProvider.ComputeHash(image)).Replace("-","");
+            lock (_images)
+            {
+                if (_images.ContainsKey(hash))
+                {
+                    _images[hash].RefCount++;
+                }
+                else
+                {
+                    Packaging.ZipPackagePart imagePart;
+                    if (uri == null)
+                    {
+                        uri = GetNewUri(Package, "/xl/media/image{0}.jpg");
+                        imagePart = Package.CreatePart(uri, "image/jpeg", CompressionLevel.None);
+                    }
+                    else
+                    {
+                        imagePart = Package.CreatePart(uri, contentType, CompressionLevel.None);
+                    }
+                    var stream = imagePart.GetStream(FileMode.Create, FileAccess.Write);
+                    stream.Write(image, 0, image.GetLength(0));
+
+                    _images.Add(hash, new ImageInfo() { Uri = uri, RefCount = 1, Hash = hash, Part = imagePart });
+                }
+            }
+            return _images[hash];
+        }
+        internal ImageInfo LoadImage(byte[] image, Uri uri, Packaging.ZipPackagePart imagePart)
+        {
+            var hashProvider = new SHA1CryptoServiceProvider();
+            var hash = BitConverter.ToString(hashProvider.ComputeHash(image)).Replace("-", "");
+            if (_images.ContainsKey(hash))
+            {
+                _images[hash].RefCount++;
+            }
+            else
+            {
+                _images.Add(hash, new ImageInfo() { Uri = uri, RefCount = 1, Hash = hash, Part = imagePart });
+            }
+            return _images[hash];
+        }
+        internal void RemoveImage(string hash)
+        {
+            lock (_images)
+            {
+                if (_images.ContainsKey(hash))
+                {
+                    var ii = _images[hash];
+                    ii.RefCount--;
+                    if (ii.RefCount == 0)
+                    {
+                        Package.DeletePart(ii.Uri);
+                        _images.Remove(hash);
+                    }
+                }
+            }
+        }
+        internal ImageInfo GetImageInfo(byte[] image)
+        {
+            var hashProvider = new SHA1CryptoServiceProvider();
+            var hash = BitConverter.ToString(hashProvider.ComputeHash(image)).Replace("-","");
+
+            if (_images.ContainsKey(hash))
+            {
+                return _images[hash];
+            }
+            else
+            {
+                return null;
+            }
+        }
+        private Uri GetNewUri(Packaging.ZipPackage package, string sUri)
+        {
+            int id = 1;
+            Uri uri;
+            do
+            {
+                uri = new Uri(string.Format(sUri, id++), UriKind.Relative);
+            }
+            while (package.PartExists(uri));
+            return uri;
+        }
+        /// <summary>
+        /// Init values here
+        /// </summary>
+        private void Init()
+        {
+            DoAdjustDrawings = true;
+        }
+        /// <summary>
+        /// Create a new file from a template
+        /// </summary>
+        /// <param name="template">An existing xlsx file to use as a template</param>
+        /// <param name="password">The password to decrypt the package.</param>
+        /// <returns></returns>
+        private void CreateFromTemplate(FileInfo template, string password)
+        {
+            if (template != null) template.Refresh();
+            if (template.Exists)
+            {
+                if(_stream==null) _stream=new MemoryStream();
+                var ms = new MemoryStream();
+                if (password != null)
+                {
+#if !MONO
+                    Encryption.IsEncrypted = true;
+                    Encryption.Password = password;
+                    var encrHandler = new EncryptedPackageHandler();
+                    ms = encrHandler.DecryptPackage(template, Encryption);
+                    encrHandler = null;
+#endif
+#if MONO
+	                throw (new NotImplementedException("No support for Encrypted packages in Mono"));
+#endif
+	                //throw (new NotImplementedException("No support for Encrypted packages in this version"));
+                }
+                else
+                {
+                    byte[] b = System.IO.File.ReadAllBytes(template.FullName);
+                    ms.Write(b, 0, b.Length);
+                }
+                try
+                {
+                    //_package = Package.Open(_stream, FileMode.Open, FileAccess.ReadWrite);
+                    _package = new Packaging.ZipPackage(ms);
+                }
+                catch (Exception ex)
+                {
+#if !MONO
+                    if (password == null && CompoundDocument.IsStorageFile(template.FullName)==0)
+                    {
+                        throw new Exception("Can not open the package. Package is an OLE compound document. If this is an encrypted package, please supply the password", ex);
+                    }
+                    else
+                    {
+                        throw;
+                    }
+#endif
+#if MONO
+                    throw;
+#endif
+                }
+            }
+            else
+                throw new Exception("Passed invalid TemplatePath to Excel Template");
+            //return newFile;
+        }
+        private void ConstructNewFile(string password)
+        {
+            var ms = new MemoryStream();
+            if (_stream == null) _stream = new MemoryStream();
+            if (File != null) File.Refresh();
+            if (File != null && File.Exists)
+            {
+                if (password != null)
+                {
+#if !MONO
+                    var encrHandler = new EncryptedPackageHandler();
+                    Encryption.IsEncrypted = true;
+                    Encryption.Password = password;
+                    ms = encrHandler.DecryptPackage(File, Encryption);
+                    encrHandler = null;
+#endif
+#if MONO
+                    throw new NotImplementedException("No support for Encrypted packages in Mono");
+#endif
+                }
+                else
+                {
+                    byte[] b = System.IO.File.ReadAllBytes(File.FullName);
+                    ms.Write(b, 0, b.Length);
+                }
+                try
+                {
+                    //_package = Package.Open(_stream, FileMode.Open, FileAccess.ReadWrite);
+                    _package = new Packaging.ZipPackage(ms);
+                }
+                catch (Exception ex)
+               {
+#if !MONO
+                    if (password == null && CompoundDocument.IsStorageFile(File.FullName)==0)
+                    {
+                        throw new Exception("Can not open the package. Package is an OLE compound document. If this is an encrypted package, please supply the password", ex);
+                    }
+                    else
+                    {
+                        throw;
+                    }
+#endif
+#if MONO
+                    throw;
+#endif
+                }
+            }
+            else
+            {
+                //_package = Package.Open(_stream, FileMode.Create, FileAccess.ReadWrite);
+                _package = new Packaging.ZipPackage(ms);
+                CreateBlankWb();
+            }
+        }
+
+        private void CreateBlankWb()
+        {
+            XmlDocument workbook = Workbook.WorkbookXml; // this will create the workbook xml in the package
+            // create the relationship to the main part
+            _package.CreateRelationship(UriHelper.GetRelativeUri(new Uri("/xl", UriKind.Relative), Workbook.WorkbookUri), Packaging.TargetMode.Internal, schemaRelationships + "/officeDocument");
+        }
+
+		/// <summary>
+		/// Returns a reference to the package
+		/// </summary>
+		public Packaging.ZipPackage Package { get { return (_package); } }
+        ExcelEncryption _encryption=null;
+        /// <summary>
+        /// Information how and if the package is encrypted
+        /// </summary>
+        public ExcelEncryption Encryption
+        {
+            get
+            {
+                if (_encryption == null)
+                {
+                    _encryption = new ExcelEncryption();
+                }
+                return _encryption;
+            }
+        }
+		/// <summary>
+		/// Returns a reference to the workbook component within the package.
+		/// All worksheets and cells can be accessed through the workbook.
+		/// </summary>
+		public ExcelWorkbook Workbook
+		{
+			get
+			{
+                if (_workbook == null)
+                {
+                    var nsm = CreateDefaultNSM();
+
+                    _workbook = new ExcelWorkbook(this, nsm);
+
+                    _workbook.GetExternalReferences();
+                    _workbook.GetDefinedNames();
+
+                }
+                return (_workbook);
+			}
+		}
+        /// <summary>
+        /// Automaticlly adjust drawing size when column width/row height are adjusted, depending on the drawings editBy property.
+        /// Default True
+        /// </summary>
+        public bool DoAdjustDrawings
+        {
+            get;
+            set;
+        }
+        private XmlNamespaceManager CreateDefaultNSM()
+        {
+            //  Create a NamespaceManager to handle the default namespace, 
+            //  and create a prefix for the default namespace:
+            NameTable nt = new NameTable();
+            var ns = new XmlNamespaceManager(nt);
+            ns.AddNamespace(string.Empty, ExcelPackage.schemaMain);
+            ns.AddNamespace("d", ExcelPackage.schemaMain);
+            ns.AddNamespace("r", ExcelPackage.schemaRelationships);
+            ns.AddNamespace("c", ExcelPackage.schemaChart);
+            ns.AddNamespace("vt", schemaVt);
+            // extended properties (app.xml)
+            ns.AddNamespace("xp", schemaExtended);
+            // custom properties
+            ns.AddNamespace("ctp", schemaCustom);
+            // core properties
+            ns.AddNamespace("cp", schemaCore);
+            // core property namespaces 
+            ns.AddNamespace("dc", schemaDc);
+            ns.AddNamespace("dcterms", schemaDcTerms);
+            ns.AddNamespace("dcmitype", schemaDcmiType);
+            ns.AddNamespace("xsi", schemaXsi);
+            return ns;
+        }
+		
+		#region SavePart
+		/// <summary>
+		/// Saves the XmlDocument into the package at the specified Uri.
+		/// </summary>
+		/// <param name="uri">The Uri of the component</param>
+		/// <param name="xmlDoc">The XmlDocument to save</param>
+		internal void SavePart(Uri uri, XmlDocument xmlDoc)
+		{
+            Packaging.ZipPackagePart part = _package.GetPart(uri);
+			xmlDoc.Save(part.GetStream(FileMode.Create, FileAccess.Write));
+		}
+        /// <summary>
+		/// Saves the XmlDocument into the package at the specified Uri.
+		/// </summary>
+		/// <param name="uri">The Uri of the component</param>
+		/// <param name="xmlDoc">The XmlDocument to save</param>
+        internal void SaveWorkbook(Uri uri, XmlDocument xmlDoc)
+		{
+            Packaging.ZipPackagePart part = _package.GetPart(uri);
+            if(Workbook.VbaProject==null)
+            {
+                if (part.ContentType != contentTypeWorkbookDefault)
+                {
+                    part = _package.CreatePart(uri, contentTypeWorkbookDefault, Compression);
+                }
+            }
+            else
+            {
+                if (part.ContentType != contentTypeWorkbookMacroEnabled)
+                {
+                    var rels = part.GetRelationships();
+                    _package.DeletePart(uri);
+                    part = Package.CreatePart(uri, contentTypeWorkbookMacroEnabled);
+                    foreach (var rel in rels)
+                    {
+                        Package.DeleteRelationship(rel.Id);
+                        part.CreateRelationship(rel.TargetUri, rel.TargetMode, rel.RelationshipType);
+                    }
+                }
+            }
+			xmlDoc.Save(part.GetStream(FileMode.Create, FileAccess.Write));
+		}
+
+        #endregion
+
+		#region Dispose
+		/// <summary>
+		/// Closes the package.
+		/// </summary>
+		public void Dispose()
+		{
+            if(_package != null)
+            {
+                if (_isExternalStream==false && Stream != null && (Stream.CanRead || Stream.CanWrite))
+                {
+                    Stream.Close();
+                }
+                _package.Close();
+                if(_isExternalStream==false) ((IDisposable)_stream).Dispose();
+                if(_workbook != null)
+                {
+                    _workbook.Dispose();
+                }
+                _package = null;
+                _images = null;
+                _file = null;
+                _workbook = null;
+                _stream = null;
+                _workbook = null;
+            }
+		}
+		#endregion
+
+		#region Save  // ExcelPackage save
+        /// <summary>
+        /// Saves all the components back into the package.
+        /// This method recursively calls the Save method on all sub-components.
+        /// We close the package after the save is done.
+        /// </summary>
+        public void Save()
+        {
+            try
+            {
+                Workbook.Save();
+                if (File == null)
+                {
+                    if(Encryption.IsEncrypted)
+                    {
+#if !MONO
+                        var ms = new MemoryStream();
+                        _package.Save(ms);
+                        byte[] file = ms.ToArray();
+                        EncryptedPackageHandler eph = new EncryptedPackageHandler();
+                        var msEnc = eph.EncryptPackage(file, Encryption);
+                        CopyStream(msEnc, ref _stream);
+#endif
+#if MONO
+                        throw new NotSupportedException("Encryption is not supported under Mono.");
+#endif
+                    }
+                    else
+                    {
+                        _package.Save(_stream);
+                    }
+                    _stream.Flush();
+                    _package.Close();
+                }
+                else
+                {
+                    if (System.IO.File.Exists(File.FullName))
+                    {
+                        try
+                        {
+                            System.IO.File.Delete(File.FullName);
+                        }
+                        catch (Exception ex)
+                        {
+                            throw (new Exception(string.Format("Error overwriting file {0}", File.FullName), ex));
+                        }
+                    }
+
+                    _package.Save(_stream);
+                    _package.Close();
+                    if (Stream is MemoryStream)
+                    {
+                        var fi = new FileStream(File.FullName, FileMode.Create);
+                        //EncryptPackage
+                        if (Encryption.IsEncrypted)
+                        {
+#if !MONO
+                            byte[] file = ((MemoryStream)Stream).ToArray();
+                            EncryptedPackageHandler eph = new EncryptedPackageHandler();
+                            var ms = eph.EncryptPackage(file, Encryption);
+
+                            fi.Write(ms.GetBuffer(), 0, (int)ms.Length);
+#endif
+#if MONO
+                            throw new NotSupportedException("Encryption is not supported under Mono.");
+#endif
+                        }
+                        else
+                        {                            
+                            fi.Write(((MemoryStream)Stream).GetBuffer(), 0, (int)Stream.Length);
+                        }
+                        fi.Close();
+                    }
+                    else
+                    {
+                        System.IO.File.WriteAllBytes(File.FullName, GetAsByteArray(false));
+                    }
+                }
+            }
+            catch (Exception ex)
+            {
+                if (File == null)
+                {
+                    throw;
+                }
+                else
+                {
+                    throw (new InvalidOperationException(string.Format("Error saving file {0}", File.FullName), ex));
+                }
+            }
+        }
+        /// <summary>
+        /// Saves all the components back into the package.
+        /// This method recursively calls the Save method on all sub-components.
+        /// The package is closed after it ha
+        /// d to encrypt the workbook with. 
+        /// </summary>
+        /// <param name="password">This parameter overrides the Workbook.Encryption.Password.</param>
+        public void Save(string password)
+		{
+            Encryption.Password = password;
+            Save();
+        }
+        /// <summary>
+        /// Saves the workbook to a new file
+        /// The package is closed after it has been saved        
+        /// </summary>
+        /// <param name="file">The file location</param>
+        public void SaveAs(FileInfo file)
+        {
+            File = file;
+            Save();
+        }
+        /// <summary>
+        /// Saves the workbook to a new file
+        /// The package is closed after it has been saved
+        /// </summary>
+        /// <param name="file">The file</param>
+        /// <param name="password">The password to encrypt the workbook with. 
+        /// This parameter overrides the Encryption.Password.</param>
+        public void SaveAs(FileInfo file, string password)
+        {
+            File = file;
+            Encryption.Password = password;
+            Save();
+        }
+        /// <summary>
+        /// Copies the Package to the Outstream
+        /// The package is closed after it has been saved
+        /// </summary>
+        /// <param name="OutputStream">The stream to copy the package to</param>
+        public void SaveAs(Stream OutputStream)
+        {
+            File = null;
+            Save();
+
+            if (OutputStream != _stream)
+            {
+                if (Encryption.IsEncrypted)
+                {
+#if !MONO
+                    //Encrypt Workbook
+                    Byte[] file = new byte[Stream.Length];
+                    long pos = Stream.Position;
+                    Stream.Seek(0, SeekOrigin.Begin);
+                    Stream.Read(file, 0, (int) Stream.Length);
+                    EncryptedPackageHandler eph = new EncryptedPackageHandler();
+                    var ms = eph.EncryptPackage(file, Encryption);
+                    CopyStream(ms, ref OutputStream);
+#endif
+#if MONO
+                throw new NotSupportedException("Encryption is not supported under Mono.");
+#endif
+                }
+                else
+                {
+                    CopyStream(_stream, ref OutputStream);
+                }
+            }
+        }
+        /// <summary>
+        /// Copies the Package to the Outstream
+        /// The package is closed after it has been saved
+        /// </summary>
+        /// <param name="OutputStream">The stream to copy the package to</param>
+        /// <param name="password">The password to encrypt the workbook with. 
+        /// This parameter overrides the Encryption.Password.</param>
+        public void SaveAs(Stream OutputStream, string password)
+        {
+            Encryption.Password = password;
+            SaveAs(OutputStream);
+        }
+        FileInfo _file = null;
+
+        /// <summary>
+        /// The output file. Null if no file is used
+        /// </summary>
+        public FileInfo File
+        {
+            get
+            {
+                return _file;
+            }
+            set
+            {
+                _file = value;
+            }
+        }
+        /// <summary>
+        /// The output stream. This stream is the not the encrypted package.
+        /// To get the encrypted package use the SaveAs(stream) method.
+        /// </summary>
+        public Stream Stream
+        {
+            get
+            {
+                return _stream;
+            }
+        }
+		#endregion
+        /// <summary>
+        /// Compression option for the package
+        /// </summary>        
+        public CompressionLevel Compression 
+        { 
+            get
+            {
+                return Package.Compression;
+            }
+            set
+            {
+                Package.Compression = value;
+            }
+        }
+		#region GetXmlFromUri
+		/// <summary>
+		/// Get the XmlDocument from an URI
+		/// </summary>
+		/// <param name="uri">The Uri to the part</param>
+		/// <returns>The XmlDocument</returns>
+		internal XmlDocument GetXmlFromUri(Uri uri)
+		{
+			XmlDocument xml = new XmlDocument();
+			Packaging.ZipPackagePart part = _package.GetPart(uri);
+            XmlHelper.LoadXmlSafe(xml, part.GetStream()); 
+			return (xml);
+		}
+		#endregion
+
+        /// <summary>
+        /// Saves and returns the Excel files as a bytearray.
+        /// Note that the package is closed upon save
+        /// </summary>
+        /// <example>      
+        /// Example how to return a document from a Webserver...
+        /// <code> 
+        ///  ExcelPackage package=new ExcelPackage();
+        ///  /**** ... Create the document ****/
+        ///  Byte[] bin = package.GetAsByteArray();
+        ///  Response.ContentType = "Application/vnd.ms-Excel";
+        ///  Response.AddHeader("content-disposition", "attachment;  filename=TheFile.xlsx");
+		///  Response.BinaryWrite(bin);
+        /// </code>
+        /// </example>
+        /// <returns></returns>
+        public byte[] GetAsByteArray()
+        {
+           return GetAsByteArray(true);
+        }
+        /// <summary>
+        /// Saves and returns the Excel files as a bytearray
+        /// Note that the package is closed upon save
+        /// </summary>
+        /// <example>      
+        /// Example how to return a document from a Webserver...
+        /// <code> 
+        ///  ExcelPackage package=new ExcelPackage();
+        ///  /**** ... Create the document ****/
+        ///  Byte[] bin = package.GetAsByteArray();
+        ///  Response.ContentType = "Application/vnd.ms-Excel";
+        ///  Response.AddHeader("content-disposition", "attachment;  filename=TheFile.xlsx");
+        ///  Response.BinaryWrite(bin);
+        /// </code>
+        /// </example>
+        /// <param name="password">The password to encrypt the workbook with. 
+        /// This parameter overrides the Encryption.Password.</param>
+        /// <returns></returns>
+        public byte[] GetAsByteArray(string password)
+        {
+            if (password != null)
+            {
+                Encryption.Password = password;
+            }
+            return GetAsByteArray(true);
+        }
+        internal byte[] GetAsByteArray(bool save)
+        {
+            if (save)
+            {
+                Workbook.Save();
+                _package.Close();
+                _package.Save(_stream);
+            }
+            Byte[] byRet = new byte[Stream.Length];
+            long pos = Stream.Position;            
+            Stream.Seek(0, SeekOrigin.Begin);
+            Stream.Read(byRet, 0, (int)Stream.Length);
+
+            //Encrypt Workbook?
+            if (Encryption.IsEncrypted)
+            {
+#if !MONO
+                EncryptedPackageHandler eph=new EncryptedPackageHandler();
+                var ms = eph.EncryptPackage(byRet, Encryption);
+                byRet = ms.ToArray();
+#endif
+            }
+
+            Stream.Seek(pos, SeekOrigin.Begin);
+            Stream.Close();
+            return byRet;
+        }
+        /// <summary>
+        /// Loads the specified package data from a stream.
+        /// </summary>
+        /// <param name="input">The input.</param>
+        public void Load(Stream input)
+        {
+            Load(input, new MemoryStream(), null);
+        }
+        /// <summary>
+        /// Loads the specified package data from a stream.
+        /// </summary>
+        /// <param name="input">The input.</param>
+        /// <param name="Password">The password to decrypt the document</param>
+        public void Load(Stream input, string Password)
+        {
+            Load(input, new MemoryStream(), Password);
+        }
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="input"></param>
+        /// <param name="output"></param>
+        /// <param name="Password"></param>
+        private void Load(Stream input, Stream output, string Password)
+        {
+            //Release some resources:
+            if (this._package != null)
+            {
+                this._package.Close();
+                this._package = null;
+            }
+            if (this._stream != null)
+            {
+                this._stream.Close();
+                this._stream.Dispose();
+                this._stream = null;
+            }
+            _isExternalStream = true;
+            if (input.Length == 0) // Template is blank, Construct new
+            {
+                _stream = output;
+                ConstructNewFile(Password);
+            }
+            else
+            {
+                Stream ms;
+                this._stream = output;
+                if (Password != null)
+                {
+#if !MONO
+                    Stream encrStream = new MemoryStream();
+                    CopyStream(input, ref encrStream);
+                    EncryptedPackageHandler eph = new EncryptedPackageHandler();
+                    Encryption.Password = Password;
+                    ms = eph.DecryptPackage((MemoryStream)encrStream, Encryption);
+#endif
+#if MONO
+                    throw new NotSupportedException("Encryption is not supported under Mono.");
+#endif
+                }
+                else
+                {
+                    ms = new MemoryStream();
+                    CopyStream(input, ref ms);
+                }
+
+                try
+                {
+                    //this._package = Package.Open(this._stream, FileMode.Open, FileAccess.ReadWrite);
+                    _package = new Packaging.ZipPackage(ms);
+                }
+                catch (Exception ex)
+                {
+#if !MONO
+                    EncryptedPackageHandler eph = new EncryptedPackageHandler();
+                    if (Password == null && CompoundDocument.IsStorageILockBytes(CompoundDocument.GetLockbyte((MemoryStream)_stream)) == 0)
+                    {
+                        throw new Exception("Can not open the package. Package is an OLE compound document. If this is an encrypted package, please supply the password", ex);
+                    }
+                    else
+                    {
+                        throw;
+                    }
+#endif
+#if MONO
+                    throw;
+#endif
+                }
+            }            
+            //Clear the workbook so that it gets reinitialized next time
+            this._workbook = null;
+        }
+        static object _lock=new object();
+        /// <summary>
+        /// Copies the input stream to the output stream.
+        /// </summary>
+        /// <param name="inputStream">The input stream.</param>
+        /// <param name="outputStream">The output stream.</param>
+        internal static void CopyStream(Stream inputStream, ref Stream outputStream)
+        {
+            if (!inputStream.CanRead)
+            {
+                throw (new Exception("Can not read from inputstream"));
+            }
+            if (!outputStream.CanWrite)
+            {
+                throw (new Exception("Can not write to outputstream"));
+            }
+            if (inputStream.CanSeek)
+            {
+                inputStream.Seek(0, SeekOrigin.Begin);
+            }
+
+                const int bufferLength = 8096;
+                var buffer = new Byte[bufferLength];
+                lock (_lock)
+                {
+                    int bytesRead = inputStream.Read(buffer, 0, bufferLength);
+                    // write the required bytes
+                    while (bytesRead > 0)
+                    {
+                        outputStream.Write(buffer, 0, bytesRead);
+                        bytesRead = inputStream.Read(buffer, 0, bufferLength);
+                    }
+                    outputStream.Flush();
+            }
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelPrinterSettings.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelPrinterSettings.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelPrinterSettings.cs	(revision 12707)
@@ -0,0 +1,843 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		                Initial Release		        2009-10-01
+ * Jan Källman		                License changed GPL-->LGPL 2011-12-27
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Xml;
+using System.Globalization;
+
+namespace OfficeOpenXml
+{
+    #region "Enums"
+    /// <summary>
+    /// Printer orientation
+    /// </summary>
+    public enum eOrientation
+    {
+        /// <summary>
+        /// Portrait orientation
+        /// </summary>
+        Portrait,
+        /// <summary>
+        /// Landscape orientation
+        /// </summary>
+        Landscape
+    }
+    /// <summary>
+    /// Papersize
+    /// </summary>
+    public enum ePaperSize
+    {
+        /// <summary>
+        /// Letter paper (8.5 in. by 11 in.)
+        /// </summary>
+        Letter= 1,      
+        /// <summary>
+        /// Letter small paper (8.5 in. by 11 in.)
+        /// </summary>
+        LetterSmall=2,  
+        /// <summary>
+        /// // Tabloid paper (11 in. by 17 in.)
+        /// </summary>
+        Tabloid=3,      
+        /// <summary>
+        /// Ledger paper (17 in. by 11 in.)
+        /// </summary>
+        Ledger=4,       
+        /// <summary>
+        /// Legal paper (8.5 in. by 14 in.)
+        /// </summary>
+        Legal=5,         
+        /// <summary>
+        /// Statement paper (5.5 in. by 8.5 in.)
+        /// </summary>
+        Statement=6,    
+        /// <summary>
+        /// Executive paper (7.25 in. by 10.5 in.)
+        /// </summary>
+        Executive=7,     
+        /// <summary>
+        /// A3 paper (297 mm by 420 mm)
+        /// </summary>
+        A3=8,           
+        /// <summary>
+        /// A4 paper (210 mm by 297 mm)
+        /// </summary>
+        A4=9,            
+        /// <summary>
+        /// A4 small paper (210 mm by 297 mm)
+        /// </summary>
+        A4Small=10,      
+        /// <summary>
+        /// A5 paper (148 mm by 210 mm)
+        /// </summary>
+        A5=11,           
+        /// <summary>
+        /// B4 paper (250 mm by 353 mm)
+        /// </summary>
+        B4=12,            
+        /// <summary>
+        /// B5 paper (176 mm by 250 mm)
+        /// </summary>
+        B5=13,            
+        /// <summary>
+        /// Folio paper (8.5 in. by 13 in.)
+        /// </summary>
+        Folio=14,         
+        /// <summary>
+        /// Quarto paper (215 mm by 275 mm)
+        /// </summary>
+        Quarto=15,        
+        /// <summary>
+        /// Standard paper (10 in. by 14 in.)
+        /// </summary>
+        Standard10_14=16, 
+        /// <summary>
+        /// Standard paper (11 in. by 17 in.)
+        /// </summary>
+        Standard11_17=17,  
+        /// <summary>
+        /// Note paper (8.5 in. by 11 in.)
+        /// </summary>
+        Note=18,           
+        /// <summary>
+        /// #9 envelope (3.875 in. by 8.875 in.)
+        /// </summary>
+        Envelope9=19,      
+        /// <summary>
+        /// #10 envelope (4.125 in. by 9.5 in.)
+        /// </summary>
+        Envelope10=20,     
+        /// <summary>
+        /// #11 envelope (4.5 in. by 10.375 in.)
+        /// </summary>
+        Envelope11=21,     
+        /// <summary>
+        /// #12 envelope (4.75 in. by 11 in.)
+        /// </summary>
+        Envelope12=22,     
+        /// <summary>
+        /// #14 envelope (5 in. by 11.5 in.)
+        /// </summary>
+        Envelope14=23,     
+        /// <summary>
+        /// C paper (17 in. by 22 in.)
+        /// </summary>
+        C=24,              
+        /// <summary>
+        /// D paper (22 in. by 34 in.)
+        /// </summary>
+        D=25,               
+        /// <summary>
+        /// E paper (34 in. by 44 in.)
+        /// </summary>
+        E=26,               
+        /// <summary>
+        /// DL envelope (110 mm by 220 mm)
+        /// </summary>
+        DLEnvelope = 27,
+        /// <summary>
+        /// C5 envelope (162 mm by 229 mm)
+        /// </summary>
+        C5Envelope = 28,
+        /// <summary>
+        /// C3 envelope (324 mm by 458 mm)
+        /// </summary>
+        C3Envelope = 29, 
+        /// <summary>
+        /// C4 envelope (229 mm by 324 mm)
+        /// </summary>
+        C4Envelope = 30, 
+        /// <summary>
+        /// C6 envelope (114 mm by 162 mm)
+        /// </summary>
+        C6Envelope = 31, 
+        /// <summary>
+        /// C65 envelope (114 mm by 229 mm)
+        /// </summary>
+        C65Envelope = 32, 
+        /// <summary>
+        /// B4 envelope (250 mm by 353 mm)
+        /// </summary>
+        B4Envelope= 33, 
+        /// <summary>
+        /// B5 envelope (176 mm by 250 mm)
+        /// </summary>
+        B5Envelope= 34, 
+        /// <summary>
+        /// B6 envelope (176 mm by 125 mm)
+        /// </summary>
+        B6Envelope = 35, 
+        /// <summary>
+        /// Italy envelope (110 mm by 230 mm)
+        /// </summary>
+        ItalyEnvelope = 36, 
+        /// <summary>
+        /// Monarch envelope (3.875 in. by 7.5 in.).
+        /// </summary>
+        MonarchEnvelope = 37, 
+        /// <summary>
+        /// 6 3/4 envelope (3.625 in. by 6.5 in.)
+        /// </summary>
+        Six3_4Envelope = 38,
+        /// <summary>
+        /// US standard fanfold (14.875 in. by 11 in.)
+        /// </summary>
+        USStandard=39, 
+        /// <summary>
+        /// German standard fanfold (8.5 in. by 12 in.)
+        /// </summary>
+        GermanStandard=40, 
+        /// <summary>
+        /// German legal fanfold (8.5 in. by 13 in.)
+        /// </summary>
+        GermanLegal=41, 
+        /// <summary>
+        /// ISO B4 (250 mm by 353 mm)
+        /// </summary>
+        ISOB4=42,
+        /// <summary>
+        ///  Japanese double postcard (200 mm by 148 mm)
+        /// </summary>
+        JapaneseDoublePostcard=43,
+        /// <summary>
+        /// Standard paper (9 in. by 11 in.)
+        /// </summary>
+        Standard9=44, 
+        /// <summary>
+        /// Standard paper (10 in. by 11 in.)
+        /// </summary>
+        Standard10=45, 
+        /// <summary>
+        /// Standard paper (15 in. by 11 in.)
+        /// </summary>
+        Standard15=46, 
+        /// <summary>
+        /// Invite envelope (220 mm by 220 mm)
+        /// </summary>
+        InviteEnvelope = 47, 
+        /// <summary>
+        /// Letter extra paper (9.275 in. by 12 in.)
+        /// </summary>
+        LetterExtra=50,
+        /// <summary>
+        /// Legal extra paper (9.275 in. by 15 in.)
+        /// </summary>
+        LegalExtra=51, 
+        /// <summary>
+        /// Tabloid extra paper (11.69 in. by 18 in.)
+        /// </summary>
+        TabloidExtra=52,
+        /// <summary>
+        /// A4 extra paper (236 mm by 322 mm)
+        /// </summary>
+        A4Extra=53, 
+        /// <summary>
+        /// Letter transverse paper (8.275 in. by 11 in.)
+        /// </summary>
+        LetterTransverse=54, 
+        /// <summary>
+        /// A4 transverse paper (210 mm by 297 mm)
+        /// </summary>
+        A4Transverse=55, 
+        /// <summary>
+        /// Letter extra transverse paper (9.275 in. by 12 in.)
+        /// </summary>
+        LetterExtraTransverse=56, 
+        /// <summary>
+        /// SuperA/SuperA/A4 paper (227 mm by 356 mm)
+        /// </summary>
+        SuperA=57, 
+        /// <summary>
+        /// SuperB/SuperB/A3 paper (305 mm by 487 mm)
+        /// </summary>
+        SuperB=58, 
+        /// <summary>
+        /// Letter plus paper (8.5 in. by 12.69 in.)
+        /// </summary>
+        LetterPlus=59, 
+        /// <summary>
+        /// A4 plus paper (210 mm by 330 mm)
+        /// </summary>
+        A4Plus=60, 
+        /// <summary>
+        /// A5 transverse paper (148 mm by 210 mm)
+        /// </summary>
+        A5Transverse=61, 
+        /// <summary>
+        /// JIS B5 transverse paper (182 mm by 257 mm)
+        /// </summary>
+        JISB5Transverse=62, 
+        /// <summary>
+        /// A3 extra paper (322 mm by 445 mm)
+        /// </summary>
+        A3Extra=63, 
+        /// <summary>
+        /// A5 extra paper (174 mm by 235 mm)
+        /// </summary>
+        A5Extra=64, 
+        /// <summary>
+        /// ISO B5 extra paper (201 mm by 276 mm)
+        /// </summary>
+        ISOB5=65, 
+        /// <summary>
+        /// A2 paper (420 mm by 594 mm)
+        /// </summary>
+        A2=66, 
+        /// <summary>
+        /// A3 transverse paper (297 mm by 420 mm)
+        /// </summary>
+        A3Transverse=67, 
+        /// <summary>
+        /// A3 extra transverse paper (322 mm by 445 mm*/
+        /// </summary>
+        A3ExtraTransverse = 68
+    }
+    /// <summary>
+    /// Specifies printed page order
+    /// </summary>
+    public enum ePageOrder
+    {
+
+        /// <summary>
+        /// Order pages vertically first, then move horizontally.
+        /// </summary>
+        DownThenOver,
+        /// <summary>
+        /// Order pages horizontally first, then move vertically
+        /// </summary>
+        OverThenDown
+    }
+    #endregion
+    /// <summary>
+    /// Printer settings
+    /// </summary>
+    public sealed class ExcelPrinterSettings : XmlHelper
+    {
+        ExcelWorksheet _ws;
+        bool _marginsCreated = false;
+
+        internal ExcelPrinterSettings(XmlNamespaceManager ns, XmlNode topNode,ExcelWorksheet ws) :
+            base(ns, topNode)
+        {
+            _ws = ws;
+            SchemaNodeOrder = ws.SchemaNodeOrder;
+        }
+        const string _leftMarginPath = "d:pageMargins/@left";
+        /// <summary>
+        /// Left margin in inches
+        /// </summary>
+        public decimal LeftMargin 
+        {
+            get
+            {
+                return GetXmlNodeDecimal(_leftMarginPath);
+            }
+            set
+            {
+               CreateMargins();
+               SetXmlNodeString(_leftMarginPath, value.ToString(CultureInfo.InvariantCulture));
+            }
+        }
+        const string _rightMarginPath = "d:pageMargins/@right";
+        /// <summary>
+        /// Right margin in inches
+        /// </summary>
+        public decimal RightMargin 
+        {
+            get
+            {
+                return GetXmlNodeDecimal(_rightMarginPath);
+            }
+            set
+            {
+                CreateMargins();
+                SetXmlNodeString(_rightMarginPath, value.ToString(CultureInfo.InvariantCulture));
+            }
+        }
+        const string _topMarginPath = "d:pageMargins/@top";
+        /// <summary>
+        /// Top margin in inches
+        /// </summary>
+        public decimal TopMargin 
+        {
+            get
+            {
+                return GetXmlNodeDecimal(_topMarginPath);
+            }
+            set
+            {
+                CreateMargins();
+                SetXmlNodeString(_topMarginPath, value.ToString(CultureInfo.InvariantCulture));
+            }
+        }
+        const string _bottomMarginPath = "d:pageMargins/@bottom";
+        /// <summary>
+        /// Bottom margin in inches
+        /// </summary>
+        public decimal BottomMargin 
+        {
+            get
+            {
+                return GetXmlNodeDecimal(_bottomMarginPath);
+            }
+            set
+            {
+                CreateMargins();
+                SetXmlNodeString(_bottomMarginPath, value.ToString(CultureInfo.InvariantCulture));
+            }
+        }
+        const string _headerMarginPath = "d:pageMargins/@header";
+        /// <summary>
+        /// Header margin in inches
+        /// </summary>
+        public decimal HeaderMargin 
+        {
+            get
+            {
+                return GetXmlNodeDecimal(_headerMarginPath);
+            }
+            set
+            {
+                CreateMargins();
+                SetXmlNodeString(_headerMarginPath, value.ToString(CultureInfo.InvariantCulture));
+            }
+        }
+        const string _footerMarginPath = "d:pageMargins/@footer";
+        /// <summary>
+        /// Footer margin in inches
+        /// </summary>
+        public decimal FooterMargin 
+        {
+            get
+            {
+                return GetXmlNodeDecimal(_footerMarginPath);
+            }
+            set
+            {
+                CreateMargins();
+                SetXmlNodeString(_footerMarginPath, value.ToString(CultureInfo.InvariantCulture));
+            }
+        }
+        const string _orientationPath = "d:pageSetup/@orientation";
+        /// <summary>
+        /// Orientation 
+        /// Portrait or Landscape
+        /// </summary>
+        public eOrientation Orientation
+        {
+            get
+            {
+                return (eOrientation)Enum.Parse(typeof(eOrientation), GetXmlNodeString(_orientationPath), true);
+            }
+            set
+            {
+                SetXmlNodeString(_orientationPath, value.ToString().ToLower(CultureInfo.InvariantCulture));
+            }
+        }
+        const string _fitToWidthPath = "d:pageSetup/@fitToWidth";
+        /// <summary>
+        /// Fit to Width in pages. 
+        /// Set FitToPage to true when using this one. 
+        /// 0 is automatic
+        /// </summary>
+        public int FitToWidth
+        {
+            get
+            {
+                return GetXmlNodeInt(_fitToWidthPath);
+            }
+            set
+            {
+                SetXmlNodeString(_fitToWidthPath, value.ToString());
+            }
+        }
+        const string _fitToHeightPath = "d:pageSetup/@fitToHeight";
+        /// <summary>
+        /// Fit to height in pages. 
+        /// Set FitToPage to true when using this one. 
+        /// 0 is automatic
+        /// </summary>
+        public int FitToHeight
+        {
+            get
+            {
+                return GetXmlNodeInt(_fitToHeightPath);
+            }
+            set
+            {
+                SetXmlNodeString(_fitToHeightPath, value.ToString());
+            }
+        }
+        const string _scalePath = "d:pageSetup/@scale";
+        /// <summary>
+        /// Print scale
+        /// </summary>
+        public int Scale
+        {
+            get
+            {
+                return GetXmlNodeInt(_scalePath);
+            }
+            set
+            {
+                SetXmlNodeString(_scalePath, value.ToString());
+            }
+        }
+        const string _fitToPagePath = "d:sheetPr/d:pageSetUpPr/@fitToPage";
+        /// <summary>
+        /// Fit To Page.
+        /// </summary>
+        public bool FitToPage
+        {
+            get
+            {
+                return GetXmlNodeBool(_fitToPagePath);
+            }
+            set
+            {
+                SetXmlNodeString(_fitToPagePath, value ? "1" : "0");
+            }
+        }
+        const string _headersPath = "d:printOptions/@headings";
+        /// <summary>
+        /// Print headings (column letter and row numbers)
+        /// </summary>
+        public bool ShowHeaders
+        {
+            get
+            {
+                return GetXmlNodeBool(_headersPath, false);
+            }
+            set
+            {
+                SetXmlNodeBool(_headersPath, value, false);
+            }
+        }
+        /// <summary>
+        /// Print titles
+        /// Rows to be repeated after each pagebreak.
+        /// The address must be a full row address (ex. 1:1)
+        /// </summary>
+        public ExcelAddress RepeatRows
+        {
+            get
+            {
+                if (_ws.Names.ContainsKey("_xlnm.Print_Titles"))
+                {
+                    ExcelRangeBase r = _ws.Names["_xlnm.Print_Titles"] as ExcelRangeBase;
+                    if (r.Start.Column == 1 && r.End.Column == ExcelPackage.MaxColumns)
+                    {
+                        return new ExcelAddress(r.FirstAddress);
+                    }
+                    else if (r._addresses != null && r.Addresses[0].Start.Column == 1 && r.Addresses[0].End.Column == ExcelPackage.MaxColumns)
+                    {
+                        return r._addresses[0];
+                    }
+                    else
+                    {
+                        return null;
+                    }
+                }
+                else
+                {
+                    return null;
+                }
+            }
+            set
+            {
+
+                //Must span entire columns
+                if (!(value.Start.Column == 1 && value.End.Column == ExcelPackage.MaxColumns))
+                {
+                    throw new InvalidOperationException("Address must span full columns only (for ex. Address=\"A:A\" for the first column).");
+                }
+
+                var vertAddr = RepeatColumns;
+                string addr;
+                if (vertAddr == null)
+                {
+                    addr = value.Address;
+                }
+                else
+                {
+                    addr = vertAddr.Address + "," + value.Address;
+                }
+
+                if (_ws.Names.ContainsKey("_xlnm.Print_Titles"))
+                {
+                    _ws.Names["_xlnm.Print_Titles"].Address = addr;
+                }
+                else
+                {
+                    _ws.Names.Add("_xlnm.Print_Titles", new ExcelRangeBase(_ws, addr));
+                }
+            }
+        }
+        /// <summary>
+        /// Print titles
+        /// Columns to be repeated after each pagebreak.
+        /// The address must be a full column address (ex. A:A)
+        /// </summary>
+        public ExcelAddress RepeatColumns
+        {
+            get
+            {
+                if (_ws.Names.ContainsKey("_xlnm.Print_Titles"))
+                {
+                    ExcelRangeBase r = _ws.Names["_xlnm.Print_Titles"] as ExcelRangeBase;
+                    if (r.Start.Row == 1 && r.End.Row == ExcelPackage.MaxRows)
+                    {
+                        return new ExcelAddress(r.FirstAddress);
+                    }
+                    else if (r._addresses != null && (r._addresses[0].Start.Row == 1 && r._addresses[0].End.Row == ExcelPackage.MaxRows))
+                    {
+                        return r._addresses[0];
+                    }
+                    else
+                    {
+                        return null;
+                    }
+                }
+                else
+                {
+                    return null;
+                }
+            }
+            set
+            {
+                //Must span entire rows
+                if (!(value.Start.Row == 1 && value.End.Row== ExcelPackage.MaxRows))
+                {
+                    throw new InvalidOperationException("Address must span rows only (for ex. Address=\"1:1\" for the first row).");
+                }
+
+                var horAddr = RepeatRows;
+                string addr;
+                if (horAddr == null)
+                {
+                    addr = value.Address;
+                }
+                else
+                {
+                    addr = value.Address + "," + horAddr.Address;
+                }
+
+                if (_ws.Names.ContainsKey("_xlnm.Print_Titles"))
+                {
+                    _ws.Names["_xlnm.Print_Titles"].Address = addr;
+                }
+                else
+                {
+                    _ws.Names.Add("_xlnm.Print_Titles", new ExcelRangeBase(_ws, addr));
+                }
+            }
+        }
+        /// <summary>
+        /// The printarea.
+        /// Null if no print area is set.
+        /// </summary>
+        public ExcelRangeBase PrintArea 
+        {
+            get
+            {
+                if (_ws.Names.ContainsKey("_xlnm.Print_Area"))
+                {
+                    return _ws.Names["_xlnm.Print_Area"];
+                }
+                else
+                {
+                    return null;
+                }
+            }
+            set
+            {
+                if (value == null)
+                {
+                    _ws.Names.Remove("_xlnm.Print_Area");
+                }
+                else if (_ws.Names.ContainsKey("_xlnm.Print_Area"))
+                {
+                    _ws.Names["_xlnm.Print_Area"].Address = value.Address;
+                }
+                else
+                {
+                    _ws.Names.Add("_xlnm.Print_Area", value);
+                }
+            }
+        }
+        const string _gridLinesPath = "d:printOptions/@gridLines";
+        /// <summary>
+        /// Print gridlines 
+        /// </summary>
+        public bool ShowGridLines
+        {
+            get
+            {
+                return GetXmlNodeBool(_gridLinesPath, false);
+            }
+            set
+            {
+                SetXmlNodeBool(_gridLinesPath, value, false);
+            }
+        }
+        const string _horizontalCenteredPath = "d:printOptions/@horizontalCentered";
+        /// <summary>
+        /// Horizontal centered when printing 
+        /// </summary>w
+        public bool HorizontalCentered
+        {
+            get
+            {
+                return GetXmlNodeBool(_horizontalCenteredPath, false);
+            }
+            set
+            {
+                SetXmlNodeBool(_horizontalCenteredPath, value, false);
+            }
+        }
+        const string _verticalCenteredPath = "d:printOptions/@verticalCentered";
+        /// <summary>
+        /// Vertical centered when printing 
+        /// </summary>
+        public bool VerticalCentered
+        {
+            get
+            {
+                return GetXmlNodeBool(_verticalCenteredPath, false);
+            }
+            set
+            {
+                SetXmlNodeBool(_verticalCenteredPath, value, false);
+            }
+        }
+        const string _pageOrderPath = "d:pageSetup/@pageOrder";        
+        /// <summary>
+        /// Specifies printed page order
+        /// </summary>
+        public ePageOrder PageOrder
+        {
+            get
+            {
+                if (GetXmlNodeString(_pageOrderPath) == "overThenDown")
+                {
+                    return ePageOrder.OverThenDown;
+                }
+                else
+                {
+                    return ePageOrder.DownThenOver;
+                }
+            }
+            set
+            {
+                if (value == ePageOrder.OverThenDown)
+                {
+                    SetXmlNodeString(_pageOrderPath, "overThenDown");
+                }
+                else
+                {
+                    DeleteNode(_pageOrderPath);
+                }
+            }
+        }
+        const string _blackAndWhitePath = "d:pageSetup/@blackAndWhite";
+        /// <summary>
+        /// Print black and white
+        /// </summary>
+        public bool BlackAndWhite
+        {
+            get
+            {
+                return GetXmlNodeBool(_blackAndWhitePath, false);
+            }
+            set
+            {
+                SetXmlNodeBool(_blackAndWhitePath, value, false);
+            }
+        }
+        const string _draftPath = "d:pageSetup/@draft";
+        /// <summary>
+        /// Print a draft
+        /// </summary>
+        public bool Draft
+        {
+            get
+            {
+                return GetXmlNodeBool(_draftPath, false);
+            }
+            set
+            {
+                SetXmlNodeBool(_draftPath, value, false);
+            }
+        }
+        const string _paperSizePath = "d:pageSetup/@paperSize";
+        /// <summary>
+        /// Paper size 
+        /// </summary>
+        public ePaperSize PaperSize 
+        {
+            get
+            {
+                string s = GetXmlNodeString(_paperSizePath);
+                if (s != "")
+                {
+                    return (ePaperSize)int.Parse(s);
+                }
+                else
+                {
+                    return ePaperSize.Letter;
+                    
+                }
+            }
+            set
+            {
+                SetXmlNodeString(_paperSizePath, ((int)value).ToString());
+            }
+        }
+        /// <summary>
+        /// All or none of the margin attributes must exist. Create all att ones.
+        /// </summary>
+        private void CreateMargins()
+        {
+            if (_marginsCreated==false && TopNode.SelectSingleNode(_leftMarginPath, NameSpaceManager) == null) 
+            {
+                _marginsCreated=true;
+                LeftMargin = 0.7087M;
+                RightMargin = 0.7087M;
+                TopMargin = 0.7480M;
+                BottomMargin = 0.7480M;
+                HeaderMargin = 0.315M;
+                FooterMargin = 0.315M;
+            }
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelProtectedRange.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelProtectedRange.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelProtectedRange.cs	(revision 12707)
@@ -0,0 +1,194 @@
+﻿using OfficeOpenXml.Utils;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Security.Cryptography;
+using System.Text;
+using System.Xml;
+
+namespace OfficeOpenXml
+{
+    /// <summary>
+    /// Algorithm for password hash
+    /// </summary>
+    internal enum eProtectedRangeAlgorithm
+    {
+        /// <summary>
+        /// Specifies that the MD2 algorithm, as defined by RFC 1319, shall be used.
+        /// </summary>
+        MD2,
+        /// <summary>
+        /// Specifies that the MD4 algorithm, as defined by RFC 1319, shall be used.
+        /// </summary>
+        MD4,
+        /// <summary>
+        /// Specifies that the MD5 algorithm, as defined by RFC 1319, shall be used.
+        /// </summary>
+        MD5,
+        /// <summary>
+        /// Specifies that the RIPEMD-128 algorithm, as defined by RFC 1319, shall be used.
+        /// </summary>
+        RIPEMD128,
+        /// <summary>
+        /// Specifies that the RIPEMD-160 algorithm, as defined by ISO/IEC10118-3:2004 shall be used.
+        /// </summary>
+        RIPEMD160, 
+        /// <summary>
+        /// Specifies that the SHA-1 algorithm, as defined by ISO/IEC 10118-3:2004 shall be used.
+        /// </summary>
+        SHA1,
+        /// <summary>
+        /// Specifies that the SHA-256 algorithm, as defined by ISO/IEC10118-3:2004 shall be used.
+        /// </summary>
+        SHA256, 
+        /// <summary>
+        /// Specifies that the SHA-384 algorithm, as defined by ISO/IEC 10118-3:2004 shall be used.
+        /// </summary>
+        SHA384,
+        /// <summary>
+        /// Specifies that the SHA-512 algorithm, as defined by ISO/IEC10118-3:2004 shall be used.
+        /// </summary>
+        SHA512, 
+        /// <summary>
+        /// Specifies that the WHIRLPOOL algorithm, as defined by ISO/IEC 10118-3:2004 shall be used.
+        /// </summary>
+        WHIRLPOOL
+    }
+    public class ExcelProtectedRange : XmlHelper
+    {
+        public string Name
+        {
+            get
+            {
+                return GetXmlNodeString("@name");
+            }
+            set
+            {
+                SetXmlNodeString("@name",value);
+            }
+        }
+        ExcelAddress _address=null;
+        public ExcelAddress Address 
+        { 
+            get
+            {
+                if(_address==null)
+                {
+                    _address=new ExcelAddress(GetXmlNodeString("@sqref"));
+                }
+                return _address;
+            }
+            set
+            {
+                SetXmlNodeString("@sqref", SqRefUtility.ToSqRefAddress(value.Address));
+                _address=value;
+            }
+        }
+
+        internal ExcelProtectedRange(string name, ExcelAddress address, XmlNamespaceManager ns, XmlNode topNode) :
+            base(ns,topNode)
+        {
+            Name = name;
+            Address = address;
+        }
+        /// <summary>
+        /// Sets the password for the range
+        /// </summary>
+        /// <param name="password"></param>
+        public void SetPassword(string password)
+        {
+            var byPwd = Encoding.Unicode.GetBytes(password);
+            var rnd = RandomNumberGenerator.Create();
+            var bySalt=new byte[16];
+            rnd.GetBytes(bySalt);
+            
+            //Default SHA512 and 10000 spins
+            Algorithm=eProtectedRangeAlgorithm.SHA512;
+            SpinCount = SpinCount < 100000 ? 100000 : SpinCount;
+            
+            //Combine salt and password and calculate the initial hash
+            var hp=new SHA512CryptoServiceProvider();
+            var buffer=new byte[byPwd.Length + bySalt.Length];
+            Array.Copy(bySalt, buffer, bySalt.Length);
+            Array.Copy(byPwd, 0, buffer, 16, byPwd.Length);
+            var hash = hp.ComputeHash(buffer);
+
+            //Now iterate the number of spinns.
+            for (var i = 0; i < SpinCount; i++)
+            {
+                buffer=new byte[hash.Length+4];
+                Array.Copy(hash, buffer, hash.Length);
+                Array.Copy(BitConverter.GetBytes(i), 0, buffer, hash.Length, 4);
+                hash = hp.ComputeHash(buffer);
+            }
+            Salt = Convert.ToBase64String(bySalt);
+            Hash = Convert.ToBase64String(hash);            
+        }
+        public string SecurityDescriptor
+        {
+            get
+            {
+                return GetXmlNodeString("@securityDescriptor");
+            }
+            set
+            {
+                SetXmlNodeString("@securityDescriptor",value);
+            }
+        }
+        internal int SpinCount
+        {
+            get
+            {
+                return GetXmlNodeInt("@spinCount");
+            }
+            set
+            {
+                SetXmlNodeString("@spinCount",value.ToString(CultureInfo.InvariantCulture));
+            }
+        }
+        internal string Salt
+        {
+            get
+            {
+                return GetXmlNodeString("@saltValue");
+            }
+            set
+            {
+                SetXmlNodeString("@saltValue", value);
+            }
+        }
+        internal string Hash
+        {
+            get
+            {
+                return GetXmlNodeString("@hashValue");
+            }
+            set
+            {
+                SetXmlNodeString("@hashValue", value);
+            }
+        }
+        internal eProtectedRangeAlgorithm Algorithm
+        {
+            get
+            {
+                var v=GetXmlNodeString("@algorithmName");
+                return (eProtectedRangeAlgorithm)Enum.Parse(typeof(eProtectedRangeAlgorithm), v.Replace("-", ""));
+            }
+            set
+            {
+                var v = value.ToString();
+                if(v.StartsWith("SHA"))
+                {
+                    v=v.Insert(3,"-");
+                }
+                else if(v.StartsWith("RIPEMD"))
+                {
+                    v=v.Insert(6,"-");
+                }
+                SetXmlNodeString("@algorithmName", v);
+            }
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelProtectedRangeCollection.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelProtectedRangeCollection.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelProtectedRangeCollection.cs	(revision 12707)
@@ -0,0 +1,94 @@
+﻿using OfficeOpenXml.Utils;
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Text;
+using System.Xml;
+
+namespace OfficeOpenXml
+{
+    public class ExcelProtectedRangeCollection : XmlHelper, IEnumerable<ExcelProtectedRange>
+    {
+        internal ExcelProtectedRangeCollection(XmlNamespaceManager nsm, XmlNode topNode, ExcelWorksheet ws)
+            : base(nsm, topNode)
+        {
+            foreach (XmlNode protectedRangeNode in topNode.SelectNodes("d:protectedRanges/d:protectedRange", nsm))
+            {
+                if (!(protectedRangeNode is XmlElement))
+                    continue;
+                _baseList.Add(new ExcelProtectedRange(protectedRangeNode.Attributes["name"].Value, new ExcelAddress(SqRefUtility.FromSqRefAddress(protectedRangeNode.Attributes["sqref"].Value)), nsm, topNode));
+            }
+        }
+
+        private List<ExcelProtectedRange> _baseList = new List<ExcelProtectedRange>();
+
+        public ExcelProtectedRange Add(string name, ExcelAddress address)
+        {
+            if (!ExistNode("d:protectedRanges"))
+                CreateNode("d:protectedRanges");
+            
+            var newNode = CreateNode("d:protectedRanges/d:protectedRange");
+            var item = new ExcelProtectedRange(name, address, base.NameSpaceManager, newNode);
+            _baseList.Add(item);
+            return item;
+        }
+
+        public void Clear()
+        {
+            DeleteNode("d:protectedRanges");
+            _baseList.Clear();
+        }
+
+        public bool Contains(ExcelProtectedRange item)
+        {
+            return _baseList.Contains(item);
+        }
+
+        public void CopyTo(ExcelProtectedRange[] array, int arrayIndex)
+        {
+            _baseList.CopyTo(array, arrayIndex);
+        }
+
+        public int Count
+        {
+            get { return _baseList.Count; }
+        }
+
+        public bool Remove(ExcelProtectedRange item)
+        {
+            DeleteAllNode("d:protectedRanges/d:protectedRange[@name='" + item.Name + "' and @sqref='" + item.Address.Address + "']");
+            if (_baseList.Count == 0)
+                DeleteNode("d:protectedRanges");
+            return _baseList.Remove(item);
+        }
+
+        public int IndexOf(ExcelProtectedRange item)
+        {
+            return _baseList.IndexOf(item);
+        }
+
+        public void RemoveAt(int index)
+        {
+            _baseList.RemoveAt(index);
+        }
+
+        public ExcelProtectedRange this[int index]
+        {
+            get
+            {
+                return _baseList[index];
+            }
+        }
+
+        IEnumerator<ExcelProtectedRange> IEnumerable<ExcelProtectedRange>.GetEnumerator()
+        {
+            return _baseList.GetEnumerator();
+        }
+
+        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
+        {
+            return _baseList.GetEnumerator();
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelProtection.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelProtection.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelProtection.cs	(revision 12707)
@@ -0,0 +1,115 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		    Added		10-AUG-2010
+ * Jan Källman		    License changed GPL-->LGPL 2011-12-27
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Xml;
+using OfficeOpenXml.Utils;
+using OfficeOpenXml.Encryption;
+namespace OfficeOpenXml
+{
+    /// <summary>
+    /// Sets protection on the workbook level
+    ///<seealso cref="ExcelEncryption"/> 
+    ///<seealso cref="ExcelSheetProtection"/> 
+    /// </summary>
+    public class ExcelProtection : XmlHelper
+    {
+        internal ExcelProtection(XmlNamespaceManager ns, XmlNode topNode, ExcelWorkbook wb) :
+            base(ns, topNode)
+        {
+            SchemaNodeOrder = wb.SchemaNodeOrder;
+        }
+        const string workbookPasswordPath = "d:workbookProtection/@workbookPassword";
+        /// <summary>
+        /// Sets a password for the workbook. This does not encrypt the workbook. 
+        /// </summary>
+        /// <param name="Password">The password. </param>
+        public void SetPassword(string Password)
+        {
+            if(string.IsNullOrEmpty(Password))
+            {
+                DeleteNode(workbookPasswordPath);
+            }
+            else
+            {
+                SetXmlNodeString(workbookPasswordPath, ((int)EncryptedPackageHandler.CalculatePasswordHash(Password)).ToString("x"));
+            }
+        }
+        const string lockStructurePath = "d:workbookProtection/@lockStructure";
+        /// <summary>
+        /// Locks the structure,which prevents users from adding or deleting worksheets or from displaying hidden worksheets.
+        /// </summary>
+        public bool LockStructure
+        {
+            get
+            {
+                return GetXmlNodeBool(lockStructurePath, false);
+            }
+            set
+            {
+                SetXmlNodeBool(lockStructurePath, value,  false);
+            }
+        }
+        const string lockWindowsPath = "d:workbookProtection/@lockWindows";
+        /// <summary>
+        /// Locks the position of the workbook window.
+        /// </summary>
+        public bool LockWindows
+        {
+            get
+            {
+                return GetXmlNodeBool(lockWindowsPath, false);
+            }
+            set
+            {
+                SetXmlNodeBool(lockWindowsPath, value, false);
+            }
+        }
+        const string lockRevisionPath = "d:workbookProtection/@lockRevision";
+
+        /// <summary>
+        /// Lock the workbook for revision
+        /// </summary>
+        public bool LockRevision
+        {
+            get
+            {
+                return GetXmlNodeBool(lockRevisionPath, false);
+            }
+            set
+            {
+                SetXmlNodeBool(lockRevisionPath, value, false);
+            }
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelRange.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelRange.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelRange.cs	(revision 12707)
@@ -0,0 +1,167 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		    Initial Release		        2009-10-01
+ * Jan Källman		    License changed GPL-->LGPL 2011-12-27
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+using OfficeOpenXml.Style;
+using System.Data;
+namespace OfficeOpenXml
+{
+    /// <summary>
+    /// A range of cells. 
+    /// </summary>
+    public class ExcelRange : ExcelRangeBase
+    {
+        #region "Constructors"
+        internal ExcelRange(ExcelWorksheet sheet) : 
+            base(sheet)
+        {
+
+        }
+        internal ExcelRange(ExcelWorksheet sheet, string address)
+            : base(sheet, address)
+        {
+
+        }
+        internal ExcelRange(ExcelWorksheet sheet, int fromRow, int fromCol, int toRow, int toCol)
+            : base(sheet)
+        {
+            _fromRow = fromRow;
+            _fromCol = fromCol;
+            _toRow = toRow;
+            _toCol = toCol;
+        }
+        #endregion
+        #region "Indexers"
+        /// <summary>
+        /// Access the range using an address
+        /// </summary>
+        /// <param name="Address">The address</param>
+        /// <returns>A range object</returns>
+        public ExcelRange this[string Address]
+        {
+            get
+            {
+                if (_worksheet.Names.ContainsKey(Address))
+                {
+                    if (_worksheet.Names[Address].IsName)
+                    {
+                        return null;
+                    }
+                    else
+                    {
+                        base.Address = _worksheet.Names[Address].Address;
+                    }
+                }
+                else
+                {
+                    base.Address = Address;
+                }
+                return this;
+            }
+        }
+
+        private ExcelRange GetTableAddess(ExcelWorksheet _worksheet, string address)
+        {
+            int ixStart = address.IndexOf('[');
+            if (ixStart == 0) //External Address
+            {
+                int ixEnd = address.IndexOf(']',ixStart+1);
+                if (ixStart >= 0 & ixEnd >= 0)
+                {
+                    var external = address.Substring(ixStart + 1, ixEnd - 1);
+                    //if (Worksheet.Workbook._externalReferences.Count < external)
+                    //{
+                    //foreach(var 
+                    //}
+                }
+            }
+            return null;
+        }
+        /// <summary>
+        /// Access a single cell
+        /// </summary>
+        /// <param name="Row">The row</param>
+        /// <param name="Col">The column</param>
+        /// <returns>A range object</returns>
+        public ExcelRange this[int Row, int Col]
+        {
+            get
+            {
+                ValidateRowCol(Row, Col);
+
+                _fromCol = Col;
+                _fromRow = Row;
+                _toCol = Col;
+                _toRow = Row;
+                base.Address = GetAddress(_fromRow, _fromCol);
+                return this;
+            }
+        }
+        /// <summary>
+        /// Access a range of cells
+        /// </summary>
+        /// <param name="FromRow">Start row</param>
+        /// <param name="FromCol">Start column</param>
+        /// <param name="ToRow">End Row</param>
+        /// <param name="ToCol">End Column</param>
+        /// <returns></returns>
+        public ExcelRange this[int FromRow, int FromCol, int ToRow, int ToCol]
+        {
+            get
+            {
+                ValidateRowCol(FromRow, FromCol);
+                ValidateRowCol(ToRow, ToCol);
+
+                _fromCol = FromCol;
+                _fromRow = FromRow;
+                _toCol = ToCol;
+                _toRow = ToRow;
+                base.Address = GetAddress(_fromRow, _fromCol, _toRow, _toCol);
+                return this;
+            }
+        }
+        #endregion
+        private static void ValidateRowCol(int Row, int Col)
+        {
+            if (Row < 1 || Row > ExcelPackage.MaxRows)
+            {
+                throw (new ArgumentException("Row out of range"));
+            }
+            if (Col < 1 || Col > ExcelPackage.MaxColumns)
+            {
+                throw (new ArgumentException("Column out of range"));
+            }
+        }
+
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelRangeBase.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelRangeBase.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelRangeBase.cs	(revision 12707)
@@ -0,0 +1,2879 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		    Initial Release		        2010-01-28
+ * Jan Källman		    License changed GPL-->LGPL  2011-12-27
+ * Eyal Seagull		    Conditional Formatting      2012-04-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Text;
+using System.Data;
+using OfficeOpenXml.FormulaParsing;
+using OfficeOpenXml.Style;
+using System.Xml;
+using System.Drawing;
+using System.Globalization;
+using System.Collections;
+using OfficeOpenXml.Table;
+using System.Text.RegularExpressions;
+using System.IO;
+using System.Linq;
+using OfficeOpenXml.DataValidation;
+using OfficeOpenXml.DataValidation.Contracts;
+using System.Reflection;
+using OfficeOpenXml.Style.XmlAccess;
+using System.Security;
+using OfficeOpenXml.ConditionalFormatting;
+using OfficeOpenXml.ConditionalFormatting.Contracts;
+using OfficeOpenXml.FormulaParsing.LexicalAnalysis;
+namespace OfficeOpenXml
+{	
+    /// <summary>
+	/// A range of cells 
+	/// </summary>
+	public class ExcelRangeBase : ExcelAddress, IExcelCell, IEnumerable<ExcelRangeBase>
+	{
+		/// <summary>
+		/// Reference to the worksheet
+		/// </summary>
+		protected ExcelWorksheet _worksheet;
+		internal ExcelWorkbook _workbook = null;
+		private delegate void _changeProp(_setValue method, object value);
+		private delegate void _setValue(object value, int row, int col);
+		private _changeProp _changePropMethod;
+		private int _styleID;
+        private class CopiedCell
+        {
+            internal int Row { get; set; }
+            internal int Column { get; set; }
+            internal object Value { get; set; }
+            internal string Type { get; set; }
+            internal object Formula { get; set; }
+            internal int? StyleID { get; set; }
+            internal Uri HyperLink { get; set; }
+            internal ExcelComment Comment { get; set; }
+            internal Byte Flag { get; set; }
+        }
+        //private class CopiedFlag
+        //{
+        //    internal int Row { get; set; }
+        //    internal int Column { get; set; }
+        //    internal Byte Flag { get; set; }
+        //}
+        #region Constructors
+		internal ExcelRangeBase(ExcelWorksheet xlWorksheet)
+		{
+			_worksheet = xlWorksheet;
+			_ws = _worksheet.Name;
+            _workbook = _worksheet.Workbook;
+            this.AddressChange += new EventHandler(ExcelRangeBase_AddressChange);
+			SetDelegate();
+		}
+
+        void ExcelRangeBase_AddressChange(object sender, EventArgs e)
+        {
+            if (Table != null)
+            {
+                SetRCFromTable(_workbook._package, null);
+            }
+            SetDelegate();
+        }
+		internal ExcelRangeBase(ExcelWorksheet xlWorksheet, string address) :
+			base(xlWorksheet == null ? "" : xlWorksheet.Name, address)
+		{
+			_worksheet = xlWorksheet;
+            _workbook = _worksheet.Workbook;
+            base.SetRCFromTable(_worksheet._package, null);
+			if (string.IsNullOrEmpty(_ws)) _ws = _worksheet == null ? "" : _worksheet.Name;
+            this.AddressChange += new EventHandler(ExcelRangeBase_AddressChange);
+            SetDelegate();
+		}
+		internal ExcelRangeBase(ExcelWorkbook wb, ExcelWorksheet xlWorksheet, string address, bool isName) :
+			base(xlWorksheet == null ? "" : xlWorksheet.Name, address, isName)
+		{
+            SetRCFromTable(wb._package, null);
+            _worksheet = xlWorksheet;
+			_workbook = wb;
+			if (string.IsNullOrEmpty(_ws)) _ws = (xlWorksheet == null ? null : xlWorksheet.Name);
+            this.AddressChange += new EventHandler(ExcelRangeBase_AddressChange);
+            SetDelegate();
+		}
+        ~ExcelRangeBase()
+        {
+            this.AddressChange -= new EventHandler(ExcelRangeBase_AddressChange);
+        }
+		#endregion
+		#region Set Value Delegates
+        private void SetDelegate()
+		{
+			if (_fromRow == -1)
+			{
+				_changePropMethod = SetUnknown;
+			}
+			//Single cell
+			else if (_fromRow == _toRow && _fromCol == _toCol && Addresses == null)
+			{
+				_changePropMethod = SetSingle;
+			}
+			//Range (ex A1:A2)
+			else if (Addresses == null)
+			{
+				_changePropMethod = SetRange;
+			}
+			//Multi Range (ex A1:A2,C1:C2)
+			else
+			{
+				_changePropMethod = SetMultiRange;
+			}
+		}
+        /// <summary>
+		/// We dont know the address yet. Set the delegate first time a property is set.
+		/// </summary>
+		/// <param name="valueMethod"></param>
+		/// <param name="value"></param>
+		private void SetUnknown(_setValue valueMethod, object value)
+		{
+			//Address is not set use, selected range
+			if (_fromRow == -1)
+			{
+				SetToSelectedRange();
+			}
+			SetDelegate();
+			_changePropMethod(valueMethod, value);
+		}
+		/// <summary>
+		/// Set a single cell
+		/// </summary>
+		/// <param name="valueMethod"></param>
+		/// <param name="value"></param>
+		private void SetSingle(_setValue valueMethod, object value)
+		{
+			valueMethod(value, _fromRow, _fromCol);
+		}
+		/// <summary>
+		/// Set a range
+		/// </summary>
+		/// <param name="valueMethod"></param>
+		/// <param name="value"></param>
+		private void SetRange(_setValue valueMethod, object value)
+		{
+			SetValueAddress(this, valueMethod, value);
+		}
+		/// <summary>
+		/// Set a multirange (A1:A2,C1:C2)
+		/// </summary>
+		/// <param name="valueMethod"></param>
+		/// <param name="value"></param>
+		private void SetMultiRange(_setValue valueMethod, object value)
+		{
+			SetValueAddress(this, valueMethod, value);
+			foreach (var address in Addresses)
+			{
+				SetValueAddress(address, valueMethod, value);
+			}
+		}
+		/// <summary>
+		/// Set the property for an address
+		/// </summary>
+		/// <param name="address"></param>
+		/// <param name="valueMethod"></param>
+		/// <param name="value"></param>
+		private void SetValueAddress(ExcelAddress address, _setValue valueMethod, object value)
+		{
+			IsRangeValid("");
+			if (_fromRow == 1 && _fromCol == 1 && _toRow == ExcelPackage.MaxRows && _toCol == ExcelPackage.MaxColumns)  //Full sheet (ex ws.Cells.Value=0). Set value for A1 only to avoid hanging 
+			{
+				throw (new ArgumentException("Can't reference all cells. Please use the indexer to set the range"));
+			}
+			else
+			{
+				for (int col = address.Start.Column; col <= address.End.Column; col++)
+				{
+					for (int row = address.Start.Row; row <= address.End.Row; row++)
+					{
+						valueMethod(value, row, col);
+					}
+				}
+			}
+		}
+		#endregion
+		#region Set property methods
+		private void Set_StyleID(object value, int row, int col)
+		{
+            _worksheet._styles.SetValue(row, col, (int)value);
+		}
+		private void Set_StyleName(object value, int row, int col)
+		{
+			//_worksheet.Cell(row, col).SetNewStyleName(value.ToString(), _styleID);
+            _worksheet._styles.SetValue(row, col, _styleID);
+		}
+		private void Set_Value(object value, int row, int col)
+		{
+			//ExcelCell c = _worksheet.Cell(row, col);
+            var sfi = _worksheet._formulas.GetValue(row, col);
+            if (sfi is int)
+            {
+                SplitFormulas(_worksheet.Cells[row, col]);                
+            }
+            if (sfi != null) _worksheet._formulas.SetValue(row, col, string.Empty);
+			_worksheet._values.SetValue(row, col, value);
+		}
+		private void Set_Formula(object value, int row, int col)
+		{
+			//ExcelCell c = _worksheet.Cell(row, col);
+            var f = _worksheet._formulas.GetValue(row, col);
+            if (f is int && (int)f >= 0) SplitFormulas(_worksheet.Cells[row, col]);
+
+			string formula = (value == null ? string.Empty : value.ToString());
+			if (formula == string.Empty)
+			{
+                _worksheet._formulas.SetValue(row, col, string.Empty);
+			}
+			else
+			{
+				if (formula[0] == '=') value = formula.Substring(1, formula.Length - 1); // remove any starting equalsign.
+                _worksheet._formulas.SetValue(row, col, formula);
+                _worksheet._values.SetValue(row, col, null);
+            }
+		}
+		/// <summary>
+		/// Handles shared formulas
+		/// </summary>
+		/// <param name="value">The  formula</param>
+		/// <param name="address">The address of the formula</param>
+		/// <param name="IsArray">If the forumla is an array formula.</param>
+		private void Set_SharedFormula(string value, ExcelAddress address, bool IsArray)
+		{
+			if (_fromRow == 1 && _fromCol == 1 && _toRow == ExcelPackage.MaxRows && _toCol == ExcelPackage.MaxColumns)  //Full sheet (ex ws.Cells.Value=0). Set value for A1 only to avoid hanging 
+			{
+				throw (new InvalidOperationException("Can't set a formula for the entire worksheet"));
+			}
+			else if (address.Start.Row == address.End.Row && address.Start.Column == address.End.Column && !IsArray)             //is it really a shared formula? Arrayformulas can be one cell only
+			{
+				//Nope, single cell. Set the formula
+				Set_Formula(value, address.Start.Row, address.Start.Column);
+				return;
+			}
+			//RemoveFormuls(address);
+			CheckAndSplitSharedFormula(address);
+			ExcelWorksheet.Formulas f = new ExcelWorksheet.Formulas(SourceCodeTokenizer.Default);
+			f.Formula = value;
+			f.Index = _worksheet.GetMaxShareFunctionIndex(IsArray);
+			f.Address = address.FirstAddress;
+			f.StartCol = address.Start.Column;
+			f.StartRow = address.Start.Row;
+			f.IsArray = IsArray;
+
+			_worksheet._sharedFormulas.Add(f.Index, f);
+            //_worksheet.Cell(address.Start.Row, address.Start.Column).SharedFormulaID = f.Index;
+            //_worksheet.Cell(address.Start.Row, address.Start.Column).Formula = value;
+
+			for (int col = address.Start.Column; col <= address.End.Column; col++)
+			{
+				for (int row = address.Start.Row; row <= address.End.Row; row++)
+				{
+					//_worksheet.Cell(row, col).SharedFormulaID = f.Index;
+                    _worksheet._formulas.SetValue(row, col, f.Index);
+                    _worksheet._values.SetValue(row, col, null);
+				}
+			}
+		}
+		private void Set_HyperLink(object value, int row, int col)
+		{
+			//_worksheet.Cell(row, col).Hyperlink = value as Uri;
+            if (value is Uri)
+            {
+                _worksheet._hyperLinks.SetValue(row, col, (Uri)value);
+
+                if (value is ExcelHyperLink)
+                {
+                    _worksheet._values.SetValue(row, col, ((ExcelHyperLink)value).Display);
+                }
+                else
+                {
+                   _worksheet._values.SetValue(row, col, ((Uri)value).OriginalString);
+                }                    
+            }
+            else
+            {
+                _worksheet._hyperLinks.SetValue(row, col, (Uri)null);
+                _worksheet._values.SetValue(row, col, (Uri)null);
+            }
+        }
+		private void Set_IsRichText(object value, int row, int col)
+		{
+			//_worksheet.Cell(row, col).IsRichText = (bool)value;
+            _worksheet._flags.SetFlagValue(row, col, (bool)value, CellFlags.RichText);
+		}
+		private void Exists_Comment(object value, int row, int col)
+		{
+			ulong cellID = GetCellID(_worksheet.SheetID, row, col);
+			if (_worksheet.Comments._comments.ContainsKey(cellID))
+			{
+				throw (new InvalidOperationException(string.Format("Cell {0} already contain a comment.", new ExcelCellAddress(row, col).Address)));
+			}
+
+		}
+		private void Set_Comment(object value, int row, int col)
+		{
+			string[] v = (string[])value;
+			Worksheet.Comments.Add(new ExcelRangeBase(_worksheet, GetAddress(_fromRow, _fromCol)), v[0], v[1]);
+			//   _worksheet.Cell(row, col).Comment = comment;
+		}
+		#endregion
+		private void SetToSelectedRange()
+		{
+			if (_worksheet.View.SelectedRange == "")
+			{
+				Address = "A1";
+			}
+			else
+			{
+				Address = _worksheet.View.SelectedRange;
+			}
+		}
+		private void IsRangeValid(string type)
+		{
+			if (_fromRow <= 0)
+			{
+				if (_address == "")
+				{
+					SetToSelectedRange();
+				}
+				else
+				{
+					if (type == "")
+					{
+						throw (new InvalidOperationException(string.Format("Range is not valid for this operation: {0}", _address)));
+					}
+					else
+					{
+						throw (new InvalidOperationException(string.Format("Range is not valid for {0} : {1}", type, _address)));
+					}
+				}
+			}
+		}
+		#region Public Properties
+		/// <summary>
+		/// The styleobject for the range.
+		/// </summary>
+		public ExcelStyle Style
+		{
+			get
+			{
+				IsRangeValid("styling");
+                int s=0;
+                if(!_worksheet._styles.Exists(_fromRow,_fromCol, ref s)) //Cell exists
+                {
+                    if(!_worksheet._styles.Exists(_fromRow,0, ref s)) //No, check Row style
+                    {
+                        var c = Worksheet.GetColumn(_fromCol);
+                        if (c == null)
+                        {
+                            s = 0;
+                        }
+                        else
+                        {
+                            s = c.StyleID;   
+                        }                        
+                    }
+                }
+				return _worksheet.Workbook.Styles.GetStyleObject(s, _worksheet.PositionID, Address);
+			}
+		}
+		/// <summary>
+		/// The named style
+		/// </summary>
+		public string StyleName
+		{
+			get
+			{
+				IsRangeValid("styling");
+				int  xfId;
+                if (_fromRow == 1 && _toRow == ExcelPackage.MaxRows)
+                {
+                    xfId=GetColumnStyle(_fromCol);
+                }
+                else if (_fromCol == 1 && _toCol == ExcelPackage.MaxColumns)
+                {
+                    xfId = 0;
+                    if (!_worksheet._styles.Exists(_fromRow, 0, ref xfId))
+                    {
+                        xfId = GetColumnStyle(_fromCol);
+                    }
+                }
+                else
+                {
+                    xfId = 0;
+                    if(!_worksheet._styles.Exists(_fromRow, _fromCol, ref xfId))
+                    {
+                        if (!_worksheet._styles.Exists(_fromRow, 0, ref xfId))
+                        {
+                            xfId = GetColumnStyle(_fromCol);
+                        }
+                    }
+                }
+                int nsID;
+                if (xfId <= 0)
+                {
+                    nsID=Style.Styles.CellXfs[0].XfId;
+                }
+                else
+                {
+                    nsID=Style.Styles.CellXfs[xfId].XfId;
+                }
+                foreach (var ns in Style.Styles.NamedStyles)
+                {
+                    if (ns.StyleXfId == nsID)
+                    {
+                        return ns.Name;
+                    }
+                }
+                
+                return "";
+			}
+			set
+			{
+				_styleID = _worksheet.Workbook.Styles.GetStyleIdFromName(value);
+                int col = _fromCol;
+                if (_fromRow == 1 && _toRow == ExcelPackage.MaxRows)    //Full column
+				{
+					ExcelColumn column;
+					//Get the startcolumn
+					//ulong colID = ExcelColumn.GetColumnID(_worksheet.SheetID, column);
+                    var c = _worksheet.GetValue(0, _fromCol);
+                    if (c==null)
+					{
+                        column = _worksheet.Column(_fromCol);
+                        //if (_worksheet._values.PrevCell(ref row, ref col))
+                        //{
+                        //    var prevCol = (ExcelColumn)_worksheet._values.GetValue(row, col);
+                        //    column = prevCol.Clone(_worksheet, column);
+                        //    prevCol.ColumnMax = column - 1;
+                        //}
+					}
+					else
+					{
+                        column = (ExcelColumn)c;
+					}
+
+                    column.StyleName = value;
+                    column.StyleID = _styleID;
+
+                    //var index = _worksheet._columns.IndexOf(colID);
+                    var cols = new CellsStoreEnumerator<object>(_worksheet._values, 0, _fromCol + 1, 0, _toCol);
+                    if (cols.Next())
+                    {
+                        col = _fromCol;
+                        while (column.ColumnMin <= _toCol)
+                        {
+                            if (column.ColumnMax > _toCol)
+                            {
+                                var newCol = _worksheet.CopyColumn(column, _toCol + 1, column.ColumnMax);
+                                column.ColumnMax = _toCol;
+                            }
+
+                            column._styleName = value;
+                            column.StyleID = _styleID;
+
+                            if (cols.Value == null)
+                            {
+                                break;
+                            }
+                            else
+                            {
+                                var nextCol = (ExcelColumn)cols.Value;
+                                if(column.ColumnMax < nextCol.ColumnMax-1)
+                                {
+                                    column.ColumnMax = nextCol.ColumnMax - 1;
+                                }
+                                column = nextCol;
+                                cols.Next();
+                            }
+                        }
+                    }
+                    if (column.ColumnMax < _toCol)
+                    {
+                        column.ColumnMax = _toCol;
+                    }
+                    //if (column.ColumnMin == column)
+                    //{
+                    //    column.ColumnMax = _toCol;
+                    //}
+                    //else if (column._columnMax < _toCol)
+                    //{
+                    //    var newCol = _worksheet.Column(column._columnMax + 1) as ExcelColumn;
+                    //    newCol._columnMax = _toCol;
+
+                    //    newCol._styleID = _styleID;
+                    //    newCol._styleName = value;
+                    //}
+                    if (_fromCol == 1 && _toCol == ExcelPackage.MaxColumns) //FullRow
+                    {
+                        var rows = new CellsStoreEnumerator<object>(_worksheet._values, 1, 0, ExcelPackage.MaxRows, 0);
+                        rows.Next();
+                        while(rows.Value!=null)
+                        {
+                            _worksheet._styles.SetValue(rows.Row, 0, _styleID);
+                            if (!rows.Next())
+                            {
+                                break;
+                            }
+                        }
+                    }
+				}
+                else if (_fromCol == 1 && _toCol == ExcelPackage.MaxColumns) //FullRow
+                {
+                    for (int r = _fromRow; r <= _toRow; r++)
+                    {
+                        _worksheet.Row(r)._styleName = value;
+                        _worksheet.Row(r).StyleID = _styleID;
+                    }
+                }
+
+                if (!((_fromRow == 1 && _toRow == ExcelPackage.MaxRows) || (_fromCol == 1 && _toCol == ExcelPackage.MaxColumns))) //Cell specific
+                {
+                    for (int c = _fromCol; c <= _toCol; c++)
+                    {
+                        for (int r = _fromRow; r <= _toRow; r++)
+                        {
+                            _worksheet._styles.SetValue(r, c, _styleID);
+                        }
+                    }
+                }
+                else //Only set name on created cells. (uncreated cells is set on full row or full column).
+                {
+                    var cells = new CellsStoreEnumerator<object>(_worksheet._values, _fromRow, _fromCol, _toRow, _toCol);
+                    while (cells.Next())
+                    {
+                        _worksheet._styles.SetValue(cells.Row, cells.Column, _styleID);
+                    }
+                }
+                //_changePropMethod(Set_StyleName, value);
+			}
+		}
+
+        private int GetColumnStyle(int col)
+        {
+            object c=null;
+            if (_worksheet._values.Exists(0, col, ref c))
+            {
+                return (c as ExcelColumn).StyleID;
+            }
+            else
+            {
+                int row = 0;
+                if (_worksheet._values.PrevCell(ref row, ref col))
+                {
+                    var column=_worksheet._values.GetValue(row,col) as ExcelColumn;
+                    if(column.ColumnMax>=col)
+                    {
+                        return _worksheet._styles.GetValue(row, col);
+                    }
+                }
+            }
+            return 0;
+        }
+		/// <summary>
+		/// The style ID. 
+		/// It is not recomended to use this one. Use Named styles as an alternative.
+		/// If you do, make sure that you use the Style.UpdateXml() method to update any new styles added to the workbook.
+		/// </summary>
+		public int StyleID
+		{
+			get
+			{
+                int s=0;
+                if(!_worksheet._styles.Exists(_fromRow, _fromCol, ref s))
+                {
+                    if (!_worksheet._styles.Exists(_fromRow, 0, ref s))
+                    {
+                        s = _worksheet._styles.GetValue(0, _fromCol);
+                    }
+                }
+                return s;
+			}
+			set
+			{
+				_changePropMethod(Set_StyleID, value);
+			}
+		}
+		/// <summary>
+		/// Set the range to a specific value
+		/// </summary>
+		public object Value
+		{
+			get
+			{
+				if (IsName)
+				{
+					if (_worksheet == null)
+					{
+						return _workbook._names[_address].NameValue;
+					}
+					else
+					{
+						return _worksheet.Names[_address].NameValue; 
+					}
+				}
+				else
+				{
+					if (_fromRow == _toRow && _fromCol == _toCol)
+					{
+						return _worksheet.GetValue(_fromRow, _fromCol);
+					}
+					else
+					{
+						return GetValueArray();
+					}
+				}
+			}
+			set
+			{
+				if (IsName)
+				{
+					if (_worksheet == null)
+					{
+						_workbook._names[_address].NameValue = value;
+					}
+					else
+					{
+						_worksheet.Names[_address].NameValue = value;
+					}
+				}
+				else
+				{
+					_changePropMethod(Set_Value, value);
+				}
+			}
+		}
+
+        private bool IsInfinityValue(object value)
+        {
+            double? valueAsDouble = value as double?;
+
+            if(valueAsDouble.HasValue && 
+                (double.IsNegativeInfinity(valueAsDouble.Value) || double.IsPositiveInfinity(valueAsDouble.Value)))
+            {
+                return true;
+            }
+
+            return false;
+        }
+
+		private object GetValueArray()
+		{
+			ExcelAddressBase addr;
+			if (_fromRow == 1 && _fromCol == 1 && _toRow == ExcelPackage.MaxRows && _toCol == ExcelPackage.MaxColumns)
+			{
+				addr = _worksheet.Dimension;
+				if (addr == null) return null;
+			}
+			else
+			{
+				addr = this;
+			}
+			object[,] v = new object[addr._toRow - addr._fromRow + 1, addr._toCol - addr._fromCol + 1];
+
+			for (int col = addr._fromCol; col <= addr._toCol; col++)
+			{
+				for (int row = addr._fromRow; row <= addr._toRow; row++)
+				{
+					if (_worksheet._values.Exists(row,col))
+					{
+						if (IsRichText)
+						{
+							v[row - addr._fromRow, col - addr._fromCol] = GetRichText(row, col).Text;
+						}
+						else
+						{
+							v[row - addr._fromRow, col - addr._fromCol] = _worksheet._values.GetValue(row, col);
+						}
+					}
+				}
+			}
+			return v;
+		}
+		private ExcelAddressBase GetAddressDim(ExcelRangeBase addr)
+		{
+			int fromRow, fromCol, toRow, toCol;
+			var d = _worksheet.Dimension;
+			fromRow = addr._fromRow < d._fromRow ? d._fromRow : addr._fromRow;
+			fromCol = addr._fromCol < d._fromCol ? d._fromCol : addr._fromCol;
+
+			toRow = addr._toRow > d._toRow ? d._toRow : addr._toRow;
+			toCol = addr._toCol > d._toCol ? d._toCol : addr._toCol;
+
+			if (addr._fromCol == fromRow && addr._fromCol == addr._fromCol && addr._toRow == toRow && addr._toCol == _toCol)
+			{
+				return addr;
+			}
+			else
+			{
+				if (_fromRow > _toRow || _fromCol > _toCol)
+				{
+					return null;
+				}
+				else
+				{
+					return new ExcelAddressBase(fromRow, fromCol, toRow, toCol);
+				}
+			}
+		}
+
+		private object GetSingleValue()
+		{
+			if (IsRichText)
+			{
+				return RichText.Text;
+			}
+			else
+			{
+				return _worksheet._values.GetValue(_fromRow, _fromCol);
+			}
+		}
+		/// <summary>
+		/// Returns the formatted value.
+		/// </summary>
+		public string Text
+		{
+			get
+			{
+				return GetFormattedText(false);
+			}
+		}
+		/// <summary>
+		/// Set the column width from the content of the range. The minimum width is the value of the ExcelWorksheet.defaultColumnWidth property.
+		/// Note: Cells containing formulas are ignored since EPPlus don't have a calculation engine.
+		/// Wrapped and merged cells are also ignored.
+		/// </summary>
+		public void AutoFitColumns()
+		{
+			AutoFitColumns(_worksheet.DefaultColWidth);
+		}
+
+		/// <summary>
+		/// Set the column width from the content of the range.
+		/// Note: Cells containing formulas are ignored if no calculation is made.
+		///       Wrapped and merged cells are also ignored.
+		/// </summary>
+        /// <remarks>This method will not work if you run in an environment that does not support GDI</remarks>
+		/// <param name="MinimumWidth">Minimum column width</param>
+		public void AutoFitColumns(double MinimumWidth)
+		{
+		    AutoFitColumns(MinimumWidth, double.MaxValue);
+		}
+
+	    /// <summary>
+	    /// Set the column width from the content of the range.
+        /// Note: Cells containing formulas are ignored if no calculation is made.
+        ///       Wrapped and merged cells are also ignored.
+	    /// </summary>
+	    /// <param name="MinimumWidth">Minimum column width</param>
+	    /// <param name="MaximumWidth">Maximum column width</param>
+	    public void AutoFitColumns(double MinimumWidth, double MaximumWidth)
+		{
+            if (_worksheet.Dimension == null)
+            {
+                return;
+            }
+            if (_fromCol < 1 || _fromRow < 1)
+			{
+				SetToSelectedRange();
+			}
+            var fontCache = new Dictionary<int, Font>();
+
+	        bool doAdjust = _worksheet._package.DoAdjustDrawings;
+			_worksheet._package.DoAdjustDrawings = false;
+			var drawWidths = _worksheet.Drawings.GetDrawingWidths();
+
+			var fromCol = _fromCol > _worksheet.Dimension._fromCol ? _fromCol : _worksheet.Dimension._fromCol;
+			var toCol = _toCol < _worksheet.Dimension._toCol ? _toCol : _worksheet.Dimension._toCol;
+			if (Addresses == null)
+			{
+				SetMinWidth(MinimumWidth, fromCol, toCol);
+			}
+			else
+			{
+				foreach (var addr in Addresses)
+				{
+					fromCol = addr._fromCol > _worksheet.Dimension._fromCol ? addr._fromCol : _worksheet.Dimension._fromCol;
+					toCol = addr._toCol < _worksheet.Dimension._toCol ? addr._toCol : _worksheet.Dimension._toCol;
+                    SetMinWidth(MinimumWidth, fromCol, toCol);
+                }
+			}
+
+			//Get any autofilter to widen these columns
+			var afAddr = new List<ExcelAddressBase>();
+			if (_worksheet.AutoFilterAddress != null)
+			{
+				afAddr.Add(new ExcelAddressBase(    _worksheet.AutoFilterAddress._fromRow,
+													_worksheet.AutoFilterAddress._fromCol,
+													_worksheet.AutoFilterAddress._fromRow,
+													_worksheet.AutoFilterAddress._toCol));
+				afAddr[afAddr.Count - 1]._ws = WorkSheet;
+			}
+			foreach (var tbl in _worksheet.Tables)
+			{
+				if (tbl.AutoFilterAddress != null)
+				{
+					afAddr.Add(new ExcelAddressBase(tbl.AutoFilterAddress._fromRow,
+																			tbl.AutoFilterAddress._fromCol,
+																			tbl.AutoFilterAddress._fromRow,
+																			tbl.AutoFilterAddress._toCol));
+					afAddr[afAddr.Count - 1]._ws = WorkSheet;
+				}
+			}
+
+			var styles = _worksheet.Workbook.Styles;
+			var nf = styles.Fonts[styles.CellXfs[0].FontId];
+			var fs = FontStyle.Regular;
+			if (nf.Bold) fs |= FontStyle.Bold;
+			if (nf.UnderLine) fs |= FontStyle.Underline;
+			if (nf.Italic) fs |= FontStyle.Italic;
+			if (nf.Strike) fs |= FontStyle.Strikeout;
+			var nfont = new Font(nf.Name, nf.Size, fs);
+            
+			using (var b = new Bitmap(1, 1))
+			{
+				using (var g = Graphics.FromImage(b))
+				{
+					var normalSize = (float)Math.Truncate(g.MeasureString("00", nfont).Width - g.MeasureString("0", nfont).Width);
+					g.PageUnit = GraphicsUnit.Pixel;
+					foreach (var cell in this)
+					{
+						if (cell.Merge == true || cell.Style.WrapText) continue;
+						var fntID = styles.CellXfs[cell.StyleID].FontId;
+					    Font f;
+					    if (fontCache.ContainsKey(fntID))
+						{
+							f = fontCache[fntID];
+						}
+						else
+						{
+							var fnt = styles.Fonts[fntID];
+							fs = FontStyle.Regular;
+							if (fnt.Bold) fs |= FontStyle.Bold;
+							if (fnt.UnderLine) fs |= FontStyle.Underline;
+							if (fnt.Italic) fs |= FontStyle.Italic;
+							if (fnt.Strike) fs |= FontStyle.Strikeout;
+							f = new Font(fnt.Name, fnt.Size, fs);
+							fontCache.Add(fntID, f);
+						}
+
+						//Truncate(({pixels}-5)/{Maximum Digit Width} * 100+0.5)/100
+
+                        var size = g.MeasureString(cell.TextForWidth, f);
+                        double width;
+                        double r = styles.CellXfs[cell.StyleID].TextRotation;
+                        if (r <= 0 )
+                        {
+                            width = (size.Width + 5) / normalSize;
+                        }
+                        else
+                        {
+                            r = (r <= 90 ? r : r - 90);
+                            width = (((size.Width - size.Height) * Math.Abs(System.Math.Cos(System.Math.PI * r / 180.0)) + size.Height) + 5) / normalSize;
+                        }
+
+						foreach (var a in afAddr)
+						{
+							if (a.Collide(cell) != eAddressCollition.No)
+							{
+								width += 2.25;
+								break;
+							}
+						}
+
+						if (width > _worksheet.Column(cell._fromCol).Width)
+						{
+							_worksheet.Column(cell._fromCol).Width = width > MaximumWidth ? MaximumWidth : width;
+						}
+					}
+				}
+			}
+			_worksheet.Drawings.AdjustWidth(drawWidths);
+			_worksheet._package.DoAdjustDrawings = doAdjust;
+		}
+
+        private void SetMinWidth(double minimumWidth, int fromCol, int toCol)
+        {
+            var iterator = new CellsStoreEnumerator<object>(_worksheet._values, 0, fromCol, 0, toCol);
+            var prevCol = fromCol;
+            foreach (ExcelColumn col in iterator)
+            {
+                col.Width = minimumWidth;
+                if (_worksheet.DefaultColWidth > minimumWidth && col.ColumnMin > prevCol)
+                {
+                    var newCol = _worksheet.Column(prevCol);
+                    newCol.ColumnMax = col.ColumnMin - 1;
+                    newCol.Width = minimumWidth;
+                }
+                prevCol = col.ColumnMax + 1;
+            }
+            if (_worksheet.DefaultColWidth > minimumWidth && prevCol<toCol)
+            {
+                var newCol = _worksheet.Column(prevCol);
+                newCol.ColumnMax = toCol;
+                newCol.Width = minimumWidth;
+            }
+        }
+
+        internal string TextForWidth
+		{
+			get
+			{
+				return GetFormattedText(true);
+			}
+		}
+		private string GetFormattedText(bool forWidthCalc)
+		{
+			object v = Value;
+			if (v == null) return "";
+			var styles = Worksheet.Workbook.Styles;
+			var nfID = styles.CellXfs[StyleID].NumberFormatId;
+			ExcelNumberFormatXml.ExcelFormatTranslator nf = null;
+			for (int i = 0; i < styles.NumberFormats.Count; i++)
+			{
+				if (nfID == styles.NumberFormats[i].NumFmtId)
+				{
+					nf = styles.NumberFormats[i].FormatTranslator;
+					break;
+				}
+			}
+
+			string format, textFormat;
+			if (forWidthCalc)
+			{
+				format = nf.NetFormatForWidth;
+				textFormat = nf.NetTextFormatForWidth;
+			}
+			else
+			{
+				format = nf.NetFormat;
+				textFormat = nf.NetTextFormat;
+			}
+
+            return FormatValue(v, nf, format, textFormat);
+		}
+
+        internal static string FormatValue(object v, ExcelNumberFormatXml.ExcelFormatTranslator nf, string format, string textFormat)
+        {
+			if (v is decimal || v.GetType().IsPrimitive)
+			{
+				double d;
+				try
+				{
+					d = Convert.ToDouble(v);
+				}
+				catch
+				{
+					return "";
+				}
+
+				if (nf.DataType == ExcelNumberFormatXml.eFormatType.Number)
+				{
+					if (string.IsNullOrEmpty(nf.FractionFormat))
+					{
+						return d.ToString(format, nf.Culture);
+					}
+					else
+					{
+						return nf.FormatFraction(d);
+					}
+				}
+				else if (nf.DataType == ExcelNumberFormatXml.eFormatType.DateTime)
+				{
+					var date = DateTime.FromOADate(d);
+					return date.ToString(format, nf.Culture);
+				}
+			}
+			else if (v is DateTime)
+			{
+				if (nf.DataType == ExcelNumberFormatXml.eFormatType.DateTime)
+				{
+					return ((DateTime)v).ToString(format, nf.Culture);
+				}
+				else
+				{
+					double d = ((DateTime)v).ToOADate();
+					if (string.IsNullOrEmpty(nf.FractionFormat))
+					{
+						return d.ToString(format, nf.Culture);
+					}
+					else
+					{
+						return nf.FormatFraction(d);
+					}
+				}
+			}
+			else if (v is TimeSpan)
+			{
+				if (nf.DataType == ExcelNumberFormatXml.eFormatType.DateTime)
+				{
+					return new DateTime(((TimeSpan)v).Ticks).ToString(format, nf.Culture);
+				}
+				else
+				{
+					double d = (new DateTime(((TimeSpan)v).Ticks)).ToOADate();
+					if (string.IsNullOrEmpty(nf.FractionFormat))
+					{
+						return d.ToString(format, nf.Culture);
+					}
+					else
+					{
+						return nf.FormatFraction(d);
+					}
+				}
+			}
+			else
+			{
+				if (textFormat == "")
+				{
+					return v.ToString();
+				}
+				else
+				{
+					return string.Format(textFormat, v);
+				}
+			}
+			return v.ToString();
+}
+		/// <summary>
+		/// Gets or sets a formula for a range.
+		/// </summary>
+		public string Formula
+		{
+			get
+			{
+				if (IsName)
+				{
+					if (_worksheet == null)
+					{
+						return _workbook._names[_address].NameFormula;
+					}
+					else
+					{
+						return _worksheet.Names[_address].NameFormula;
+					}
+				}
+				else
+				{
+					return _worksheet.GetFormula(_fromRow, _fromCol);                    
+				}
+			}
+			set
+			{
+				if (IsName)
+				{
+					if (_worksheet == null)
+					{
+						_workbook._names[_address].NameFormula = value;
+					}
+					else
+					{
+						_worksheet.Names[_address].NameFormula = value;
+					}
+				}
+				else
+				{
+					if(value==null || value.Trim()=="")
+                    {
+                        //Set the cells to null
+                        Value = null;
+                    }                    
+                    else if (_fromRow == _toRow && _fromCol == _toCol)
+					{
+						Set_Formula(value, _fromRow, _fromCol);
+					}
+					else
+					{
+						Set_SharedFormula(value, this, false);
+						if (Addresses != null)
+						{
+							foreach (var address in Addresses)
+							{
+								Set_SharedFormula(value, address, false);
+							}
+						}
+					}
+				}
+			}
+		}
+		/// <summary>
+		/// Gets or Set a formula in R1C1 format.
+		/// </summary>
+		public string FormulaR1C1
+		{
+			get
+			{
+				IsRangeValid("FormulaR1C1");
+				return _worksheet.GetFormulaR1C1(_fromRow, _fromCol);
+			}
+			set
+			{
+				IsRangeValid("FormulaR1C1");
+                if (value.Length > 0 && value[0] == '=') value = value.Substring(1, value.Length - 1); // remove any starting equalsign.
+
+                if (value == null || value.Trim() == "")
+                {
+                    //Set the cells to null
+                    _worksheet.Cells[ExcelCellBase.TranslateFromR1C1(value, _fromRow, _fromCol)].Value = null;    
+                }
+				else if (Addresses == null)
+				{
+					Set_SharedFormula(ExcelCellBase.TranslateFromR1C1(value, _fromRow, _fromCol), this, false);
+				}
+				else
+				{
+					Set_SharedFormula(ExcelCellBase.TranslateFromR1C1(value, _fromRow, _fromCol), new ExcelAddress(WorkSheet, FirstAddress), false);
+					foreach (var address in Addresses)
+					{
+						Set_SharedFormula(ExcelCellBase.TranslateFromR1C1(value, address.Start.Row, address.Start.Column), address, false);
+					}
+				}
+			}
+		}
+		/// <summary>
+		/// Set the hyperlink property for a range of cells
+		/// </summary>
+		public Uri Hyperlink
+		{
+			get
+			{
+				IsRangeValid("formulaR1C1");
+				return _worksheet._hyperLinks.GetValue(_fromRow, _fromCol);
+			}
+			set
+			{
+				_changePropMethod(Set_HyperLink, value);
+			}
+		}
+		/// <summary>
+		/// If the cells in the range are merged.
+		/// </summary>
+		public bool Merge
+		{
+			get
+			{
+				IsRangeValid("merging");
+				for (int col = _fromCol; col <= _toCol; col++)
+				{
+					for (int row = _fromRow; row <= _toRow; row++)
+					{
+                        if(_worksheet.MergedCells[row, col]==null)
+                        {
+                            return false;
+                        }
+                        //if (!_worksheet._flags.GetFlagValue(row, col, CellFlags.Merged))
+                        //{
+                        //    return false;
+                        //}
+					}
+				}
+				return true;
+			}
+			set
+			{
+				IsRangeValid("merging");
+				//SetMerge(value, FirstAddress);
+			    if (value)
+			    {
+			        _worksheet.MergedCells.Add(new ExcelAddressBase(FirstAddress), true);
+			        if (Addresses != null)
+			        {
+			            foreach (var address in Addresses)
+			            {
+			                _worksheet.MergedCells.Add(address, true);
+			                //SetMerge(value, address._address);
+			            }
+			        }
+			    }
+			    else
+			    {
+			        _worksheet.MergedCells.Delete(this);
+                    if (Addresses != null)
+			        {
+			            foreach (var address in Addresses)
+			            {
+                            _worksheet.MergedCells.Delete(address); ;
+			            }
+			        }
+			        
+			    }
+			}
+		}
+
+        //private void SetMerge(bool value, string address)
+        //{
+        //    if (!value)
+        //    {
+        //        if (_worksheet.MergedCells.List.Contains(address))
+        //        {
+        //            SetCellMerge(false, address);
+        //            _worksheet.MergedCells.List.Remove(address);
+        //        }
+        //        else if (!CheckMergeDiff(false, address))
+        //        {
+        //            throw (new Exception("Range is not fully merged.Specify the exact range"));
+        //        }
+        //    }
+        //    else
+        //    {
+        //        if (CheckMergeDiff(false, address))
+        //        {
+        //            SetCellMerge(true, address);
+        //            _worksheet.MergedCells.List.Add(address);
+        //        }
+        //        else
+        //        {
+        //            if (!_worksheet.MergedCells.List.Contains(address))
+        //            {
+        //                throw (new Exception("Cells are already merged"));
+        //            }
+        //        }
+        //    }
+        //}
+		/// <summary>
+		/// Set an autofilter for the range
+		/// </summary>
+		public bool AutoFilter
+		{
+			get
+			{
+				IsRangeValid("autofilter");
+				ExcelAddressBase address = _worksheet.AutoFilterAddress;
+				if (address == null) return false;
+				if (_fromRow >= address.Start.Row
+						&&
+						_toRow <= address.End.Row
+						&&
+						_fromCol >= address.Start.Column
+						&&
+						_toCol <= address.End.Column)
+				{
+					return true;
+				}
+				return false;
+			}
+			set
+			{
+				IsRangeValid("autofilter");
+				_worksheet.AutoFilterAddress = this;
+				if (_worksheet.Names.ContainsKey("_xlnm._FilterDatabase"))
+				{
+					_worksheet.Names.Remove("_xlnm._FilterDatabase");
+				}
+				var result = _worksheet.Names.Add("_xlnm._FilterDatabase", this);
+				result.IsNameHidden = true;
+			}
+		}
+		/// <summary>
+		/// If the value is in richtext format.
+		/// </summary>
+		public bool IsRichText
+		{
+			get
+			{
+				IsRangeValid("richtext");
+				return _worksheet._flags.GetFlagValue(_fromRow, _fromCol,CellFlags.RichText);
+			}
+			set
+			{
+				_changePropMethod(Set_IsRichText, value);
+			}
+		}
+		/// <summary>
+		/// Is the range a part of an Arrayformula
+		/// </summary>
+		public bool IsArrayFormula
+		{
+			get
+			{
+				IsRangeValid("arrayformulas");
+                return _worksheet._flags.GetFlagValue(_fromRow, _fromCol, CellFlags.ArrayFormula);
+			}
+		}
+		ExcelRichTextCollection _rtc = null;
+		/// <summary>
+		/// Cell value is richtext formated. 
+		/// </summary>
+		public ExcelRichTextCollection RichText
+		{
+			get
+			{
+				IsRangeValid("richtext");
+				if (_rtc == null)
+				{
+					_rtc = GetRichText(_fromRow, _fromCol);
+				}
+				return _rtc;
+			}
+		}
+
+		private ExcelRichTextCollection GetRichText(int row, int col)
+		{
+			XmlDocument xml = new XmlDocument();
+            var v = _worksheet._values.GetValue(row, col);
+            var isRt = _worksheet._flags.GetFlagValue(row, col, CellFlags.RichText);
+            if (v != null)
+			{
+				if (isRt)
+				{
+                    XmlHelper.LoadXmlSafe(xml, "<d:si xmlns:d=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" >" + v.ToString() + "</d:si>", Encoding.UTF8);
+				}
+				else
+				{
+					xml.LoadXml("<d:si xmlns:d=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" ><d:r><d:t>" + SecurityElement.Escape(v.ToString()) + "</d:t></d:r></d:si>");
+				}
+			}
+			else
+			{
+				xml.LoadXml("<d:si xmlns:d=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" />");
+			}
+			var rtc = new ExcelRichTextCollection(_worksheet.NameSpaceManager, xml.SelectSingleNode("d:si", _worksheet.NameSpaceManager), this);
+            if (rtc.Count == 1 && isRt == false)
+			{
+				IsRichText = true;
+                var s = _worksheet._styles.GetValue(row, col);
+                //var fnt = cell.Style.Font;
+                var fnt = _worksheet.Workbook.Styles.GetStyleObject(s, _worksheet.PositionID, ExcelAddressBase.GetAddress(row, col)).Font;
+				rtc[0].PreserveSpace = true;
+				rtc[0].Bold = fnt.Bold;
+				rtc[0].FontName = fnt.Name;
+				rtc[0].Italic = fnt.Italic;
+				rtc[0].Size = fnt.Size;
+				rtc[0].UnderLine = fnt.UnderLine;
+
+				int hex;
+				if (fnt.Color.Rgb != "" && int.TryParse(fnt.Color.Rgb, NumberStyles.HexNumber, null, out hex))
+				{
+					rtc[0].Color = Color.FromArgb(hex);
+				}
+
+			}
+			return rtc;
+		}
+		/// <summary>
+		/// returns the comment object of the first cell in the range
+		/// </summary>
+		public ExcelComment Comment
+		{
+			get
+			{
+				IsRangeValid("comments");
+				ulong cellID = GetCellID(_worksheet.SheetID, _fromRow, _fromCol);
+				if (_worksheet.Comments._comments.ContainsKey(cellID))
+				{
+					return _worksheet._comments._comments[cellID] as ExcelComment;
+				}
+				return null;
+			}
+		}
+		/// <summary>
+		/// WorkSheet object 
+		/// </summary>
+		public ExcelWorksheet Worksheet
+		{
+			get
+			{
+				return _worksheet;
+			}
+		}
+		/// <summary>
+		/// Address including sheetname
+		/// </summary>
+		public string FullAddress
+		{
+			get
+			{
+				string fullAddress = GetFullAddress(_worksheet.Name, _address);
+				if (Addresses != null)
+				{
+					foreach (var a in Addresses)
+					{
+						fullAddress += "," + GetFullAddress(_worksheet.Name, a.Address); ;
+					}
+				}
+				return fullAddress;
+			}
+		}
+		/// <summary>
+		/// Address including sheetname
+		/// </summary>
+		public string FullAddressAbsolute
+		{
+			get
+			{
+				string wbwsRef = string.IsNullOrEmpty(base._wb) ? base._ws : "[" + base._wb.Replace("'", "''") + "]" + _ws;
+				string fullAddress = GetFullAddress(wbwsRef, GetAddress(_fromRow, _fromCol, _toRow, _toCol, true));
+				if (Addresses != null)
+				{
+					foreach (var a in Addresses)
+					{
+						fullAddress += "," + GetFullAddress(wbwsRef, GetAddress(a.Start.Row, a.Start.Column, a.End.Row, a.End.Column, true)); ;
+					}
+				}
+				return fullAddress;
+			}
+		}
+        /// <summary>
+        /// Address including sheetname
+        /// </summary>
+        internal string FullAddressAbsoluteNoFullRowCol
+        {
+            get
+            {
+                string wbwsRef = string.IsNullOrEmpty(base._wb) ? base._ws : "[" + base._wb.Replace("'", "''") + "]" + _ws;
+                string fullAddress = GetFullAddress(wbwsRef, GetAddress(_fromRow, _fromCol, _toRow, _toCol, true), false);
+                if (Addresses != null)
+                {
+                    foreach (var a in Addresses)
+                    {
+                        fullAddress += "," + GetFullAddress(wbwsRef, GetAddress(a.Start.Row, a.Start.Column, a.End.Row, a.End.Column, true),false); ;
+                    }
+                }
+                return fullAddress;
+            }
+        }
+		#endregion
+		#region Private Methods
+        ///// <summary>
+        ///// Check if the range is partly merged
+        ///// </summary>
+        ///// <param name="startValue">the starting value</param>
+        ///// <param name="address">the address</param>
+        ///// <returns></returns>
+        //private bool CheckMergeDiff(bool startValue, string address)
+        //{
+        //    ExcelAddress a = new ExcelAddress(address);
+        //    for (int col = a.column; col <= a._toCol; col++)
+        //    {
+        //        for (int row = a._fromRow; row <= a._toRow; row++)
+        //        {
+        //            if (_worksheet._flags.GetFlagValue(row, col, CellFlags.Merged) != startValue)
+        //            {
+        //                return false;
+        //            }
+        //        }
+        //    }
+        //    return true;
+        //}
+        ///// <summary>
+        ///// Set the merge flag for the range
+        ///// </summary>
+        ///// <param name="value"></param>
+        ///// <param name="address"></param>
+        //internal void SetCellMerge(bool value, string address)
+        //{
+        //    ExcelAddress a = new ExcelAddress(address);
+        //    for (int col = a.column; col <= a._toCol; col++)
+        //    {
+        //        for (int row = a._fromRow; row <= a._toRow; row++)
+        //        {
+        //            _worksheet._flags.SetFlagValue(row, col,value,CellFlags.Merged);
+        //        }
+        //    }
+        //}
+		/// <summary>
+		/// Set the value without altering the richtext property
+		/// </summary>
+		/// <param name="value">the value</param>
+		internal void SetValueRichText(object value)
+		{
+			if (_fromRow == 1 && _fromCol == 1 && _toRow == ExcelPackage.MaxRows && _toCol == ExcelPackage.MaxColumns)  //Full sheet (ex ws.Cells.Value=0). Set value for A1 only to avoid hanging 
+			{
+				//_worksheet.Cell(1, 1).SetValueRichText(value);
+                SetValue(value, 1, 1);
+			}
+			else
+			{
+				for (int col = _fromCol; col <= _toCol; col++)
+				{
+					for (int row = _fromRow; row <= _toRow; row++)
+					{
+						//_worksheet.Cell(row, col).SetValueRichText(value);
+                        SetValue(value, row,col);
+					}
+				}
+			}
+		}
+
+        private void SetValue(object value, int row, int col)
+        {
+            _worksheet.SetValue(row, col, value);
+           // if (value is string) _worksheet._types.SetValue(row, col, "S"); else _worksheet._types.SetValue(row, col, "");
+            _worksheet._formulas.SetValue(row, col, "");
+        }
+		/// <summary>
+		/// Removes a shared formula
+		/// </summary>
+        //private void RemoveFormuls(ExcelAddress address)
+        //{
+        //    List<int> removed = new List<int>();
+        //    int fFromRow, fFromCol, fToRow, fToCol;
+        //    foreach (int index in _worksheet._sharedFormulas.Keys)
+        //    {
+        //        ExcelWorksheet.Formulas f = _worksheet._sharedFormulas[index];
+        //        ExcelCellBase.GetRowColFromAddress(f.Address, out fFromRow, out fFromCol, out fToRow, out fToCol);
+        //        if (((fFromCol >= address.Start.Column && fFromCol <= address.End.Column) ||
+        //             (fToCol >= address.Start.Column && fToCol <= address.End.Column)) &&
+        //             ((fFromRow >= address.Start.Row && fFromRow <= address.End.Row) ||
+        //             (fToRow >= address.Start.Row && fToRow <= address.End.Row)))
+        //        {
+        //            for (int col = fFromCol; col <= fToCol; col++)
+        //            {
+        //                for (int row = fFromRow; row <= fToRow; row++)
+        //                {
+        //                    _worksheet._formulas.SetValue(row, col, int.MinValue);
+        //                }
+        //            }
+        //            removed.Add(index);
+        //        }
+        //    }
+        //    foreach (int index in removed)
+        //    {
+        //        _worksheet._sharedFormulas.Remove(index);
+        //    }
+        //}
+		internal void SetSharedFormulaID(int id)
+		{
+			for (int col = _fromCol; col <= _toCol; col++)
+			{
+				for (int row = _fromRow; row <= _toRow; row++)
+				{
+                    _worksheet._formulas.SetValue(row, col, id);
+				}
+			}
+		}
+		private void CheckAndSplitSharedFormula(ExcelAddressBase address)
+		{
+            for (int col = address._fromCol; col <= address._toCol; col++)
+			{
+                for (int row = address._fromRow; row <= address._toRow; row++)
+				{
+                    var f = _worksheet._formulas.GetValue(row, col);
+                    if (f is int && (int)f >= 0)
+					{
+						SplitFormulas(address);
+						return;
+					}
+				}
+			}
+		}
+
+		private void SplitFormulas(ExcelAddressBase address)
+		{
+			List<int> formulas = new List<int>();
+            for (int col = address._fromCol; col <= address._toCol; col++)
+			{
+                for (int row = address._fromRow; row <= address._toRow; row++)
+				{
+					var f = _worksheet._formulas.GetValue(row, col);
+                    if (f is int)
+                    {
+                        int id = (int)f;
+                        if (id >= 0 && !formulas.Contains(id))
+                        {
+                            if (_worksheet._sharedFormulas[id].IsArray &&
+                                    Collide(_worksheet.Cells[_worksheet._sharedFormulas[id].Address]) == eAddressCollition.Partly) // If the formula is an array formula and its on the inside the overwriting range throw an exception
+                            {
+                                throw (new InvalidOperationException("Can not overwrite a part of an array-formula"));
+                            }
+                            formulas.Add(id);
+                        }
+                    }                    
+				}
+			}
+
+			foreach (int ix in formulas)
+			{
+                SplitFormula(address, ix);
+			}
+        
+            ////Delete any formula references inside the refered range
+            //_worksheet._formulas.Delete(address._fromRow, address._toRow, address._toRow - address._fromRow + 1, address._toCol - address.column + 1);
+        }
+
+		private void SplitFormula(ExcelAddressBase address, int ix)
+		{
+			var f = _worksheet._sharedFormulas[ix];
+			var fRange = _worksheet.Cells[f.Address];
+            var collide = address.Collide(fRange);
+
+            //The formula is inside the currenct range, remove it
+			if (collide == eAddressCollition.Equal || collide == eAddressCollition.Inside)
+			{
+				_worksheet._sharedFormulas.Remove(ix);
+                return;
+				//fRange.SetSharedFormulaID(int.MinValue); 
+			}
+            var firstCellCollide = address.Collide(new ExcelAddressBase(fRange._fromRow, fRange._fromCol, fRange._fromRow, fRange._fromCol));
+            if (collide == eAddressCollition.Partly && (firstCellCollide == eAddressCollition.Inside || firstCellCollide == eAddressCollition.Equal)) //Do we need to split? Only if the functions first row is inside the new range.
+            {
+                //The formula partly collides with the current range
+                bool fIsSet = false;
+                string formulaR1C1 = fRange.FormulaR1C1;
+                //Top Range
+                if (fRange._fromRow < _fromRow)
+                {
+                    f.Address = ExcelCellBase.GetAddress(fRange._fromRow, fRange._fromCol, _fromRow - 1, fRange._toCol);
+                    fIsSet = true;
+                }
+                //Left Range
+                if (fRange._fromCol < address._fromCol)
+                {
+                    if (fIsSet)
+                    {
+                        f = new ExcelWorksheet.Formulas(SourceCodeTokenizer.Default);
+                        f.Index = _worksheet.GetMaxShareFunctionIndex(false);
+                        f.StartCol = fRange._fromCol;
+                        f.IsArray = false;
+                        _worksheet._sharedFormulas.Add(f.Index, f);
+                    }
+                    else
+                    {
+                        fIsSet = true;
+                    }
+                    if (fRange._fromRow < address._fromRow)
+                        f.StartRow = address._fromRow;
+                    else
+                    {
+                        f.StartRow = fRange._fromRow;
+                    }
+                    if (fRange._toRow < address._toRow)
+                    {
+                        f.Address = ExcelCellBase.GetAddress(f.StartRow, f.StartCol,
+                                fRange._toRow, address._fromCol - 1);
+                    }
+                    else
+                    {
+                        f.Address = ExcelCellBase.GetAddress(f.StartRow, f.StartCol,
+                             address._toRow, address._fromCol - 1);
+                    }
+                    f.Formula = TranslateFromR1C1(formulaR1C1, f.StartRow, f.StartCol);
+                    _worksheet.Cells[f.Address].SetSharedFormulaID(f.Index);
+                }
+                //Right Range
+                if (fRange._toCol > address._toCol)
+                {
+                    if (fIsSet)
+                    {
+                        f = new ExcelWorksheet.Formulas(SourceCodeTokenizer.Default);
+                        f.Index = _worksheet.GetMaxShareFunctionIndex(false);
+                        f.IsArray = false;
+                        _worksheet._sharedFormulas.Add(f.Index, f);
+                    }
+                    else
+                    {
+                        fIsSet = true;
+                    }
+                    f.StartCol = address._toCol + 1;
+                    if (address._fromRow < fRange._fromRow)
+                        f.StartRow = fRange._fromRow;
+                    else
+                    {
+                        f.StartRow = address._fromRow;
+                    }
+
+                    if (fRange._toRow < address._toRow)
+                    {
+                        f.Address = ExcelCellBase.GetAddress(f.StartRow, f.StartCol,
+                                fRange._toRow, fRange._toCol);
+                    }
+                    else
+                    {
+                        f.Address = ExcelCellBase.GetAddress(f.StartRow, f.StartCol,
+                                address._toRow, fRange._toCol);
+                    }
+                    f.Formula = TranslateFromR1C1(formulaR1C1, f.StartRow, f.StartCol);
+                    _worksheet.Cells[f.Address].SetSharedFormulaID(f.Index);
+                }
+                //Bottom Range
+                if (fRange._toRow > address._toRow)
+                {
+                    if (fIsSet)
+                    {
+                        f = new ExcelWorksheet.Formulas(SourceCodeTokenizer.Default);
+                        f.Index = _worksheet.GetMaxShareFunctionIndex(false);
+                        f.IsArray = false;
+                        _worksheet._sharedFormulas.Add(f.Index, f);
+                    }
+
+                    f.StartCol = fRange._fromCol;
+                    f.StartRow = _toRow + 1;
+
+                    f.Formula = TranslateFromR1C1(formulaR1C1, f.StartRow, f.StartCol);
+
+                    f.Address = ExcelCellBase.GetAddress(f.StartRow, f.StartCol,
+                            fRange._toRow, fRange._toCol);
+                    _worksheet.Cells[f.Address].SetSharedFormulaID(f.Index);
+
+                }
+            }
+		}
+		private object ConvertData(ExcelTextFormat Format, string v, int col, bool isText)
+		{
+			if (isText && (Format.DataTypes == null || Format.DataTypes.Length < col)) return v;
+
+			double d;
+			DateTime dt;
+			if (Format.DataTypes == null || Format.DataTypes.Length <= col || Format.DataTypes[col] == eDataTypes.Unknown)
+			{
+				string v2 = v.EndsWith("%") ? v.Substring(0, v.Length - 1) : v;
+				if (double.TryParse(v2, NumberStyles.Any, Format.Culture, out d))
+				{
+					if (v2 == v)
+					{
+						return d;
+					}
+					else
+					{
+						return d / 100;
+					}
+				}
+				if (DateTime.TryParse(v, Format.Culture, DateTimeStyles.None, out dt))
+				{
+					return dt;
+				}
+				else
+				{
+					return v;
+				}
+			}
+			else
+			{
+				switch (Format.DataTypes[col])
+				{
+					case eDataTypes.Number:
+						if (double.TryParse(v, NumberStyles.Any, Format.Culture, out d))
+						{
+							return d;
+						}
+						else
+						{
+							return v;
+						}
+					case eDataTypes.DateTime:
+						if (DateTime.TryParse(v, Format.Culture, DateTimeStyles.None, out dt))
+						{
+							return dt;
+						}
+						else
+						{
+							return v;
+						}
+					case eDataTypes.Percent:
+						string v2 = v.EndsWith("%") ? v.Substring(0, v.Length - 1) : v;
+						if (double.TryParse(v2, NumberStyles.Any, Format.Culture, out d))
+						{
+							return d / 100;
+						}
+						else
+						{
+							return v;
+						}
+
+					default:
+						return v;
+
+				}
+			}
+		}
+		#endregion
+		#region Public Methods
+		#region ConditionalFormatting
+		/// <summary>
+		/// Conditional Formatting for this range.
+		/// </summary>
+		public IRangeConditionalFormatting ConditionalFormatting
+		{
+			get
+			{
+				return new RangeConditionalFormatting(_worksheet, new ExcelAddress(Address));
+			}
+		}
+		#endregion
+		#region DataValidation
+		/// <summary>
+		/// Data validation for this range.
+		/// </summary>
+		public IRangeDataValidation DataValidation
+		{
+			get
+			{
+                return new RangeDataValidation(_worksheet, Address);
+			}
+		}
+		#endregion
+        #region LoadFromDataReader
+	    /// <summary>
+	    /// Load the data from the datareader starting from the top left cell of the range
+	    /// </summary>
+	    /// <param name="Reader">The datareader to loadfrom</param>
+	    /// <param name="PrintHeaders">Print the column caption property (if set) or the columnname property if not, on first row</param>
+	    /// <param name="TableName">The name of the table</param>
+	    /// <param name="TableStyle">The table style to apply to the data</param>
+	    /// <returns>The filled range</returns>
+	    public ExcelRangeBase LoadFromDataReader(IDataReader Reader, bool PrintHeaders, string TableName, TableStyles TableStyle = TableStyles.None)
+	    {
+	        var r = LoadFromDataReader(Reader, PrintHeaders);
+
+            int rows = r.Rows - 1;
+	        if (rows >= 0 && r.Columns > 0)
+	        {
+	            var tbl = _worksheet.Tables.Add(new ExcelAddressBase(_fromRow, _fromCol, _fromRow + (rows <= 0 ? 1 : rows), _fromCol + r.Columns - 1), TableName);
+	            tbl.ShowHeader = PrintHeaders;
+	            tbl.TableStyle = TableStyle;
+	        }
+	        return r;
+	    }
+
+	    /// <summary>
+	    /// Load the data from the datareader starting from the top left cell of the range
+	    /// </summary>
+	    /// <param name="Reader">The datareader to load from</param>
+	    /// <param name="PrintHeaders">Print the caption property (if set) or the columnname property if not, on first row</param>
+	    /// <returns>The filled range</returns>
+	    public ExcelRangeBase LoadFromDataReader(IDataReader Reader, bool PrintHeaders)
+	    {
+	        if (Reader == null)
+	        {
+	            throw (new ArgumentNullException("Reader", "Reader can't be null"));
+	        }
+	        int fieldCount = Reader.FieldCount;
+	  
+	        int col = _fromCol, row = _fromRow;
+	        if (PrintHeaders)
+	        {
+	            for (int i = 0; i < fieldCount; i++)
+	            {
+	                // If no caption is set, the ColumnName property is called implicitly.
+	                _worksheet._values.SetValue(row, col++, Reader.GetName(i));
+	            }
+	            row++;
+	            col = _fromCol;
+	        }
+	        while(Reader.Read())
+	        {
+	            for (int i = 0; i < fieldCount; i++)
+	            {
+	                _worksheet._values.SetValue(row, col++, Reader.GetValue(i));
+	            }
+	            row++;
+	            col = _fromCol;
+	        }
+	        return _worksheet.Cells[_fromRow, _fromCol, row - 1, _fromCol + fieldCount - 1];
+	    }
+	    #endregion
+		#region LoadFromDataTable
+		/// <summary>
+		/// Load the data from the datatable starting from the top left cell of the range
+		/// </summary>
+		/// <param name="Table">The datatable to load</param>
+		/// <param name="PrintHeaders">Print the column caption property (if set) or the columnname property if not, on first row</param>
+		/// <param name="TableStyle">The table style to apply to the data</param>
+		/// <returns>The filled range</returns>
+		public ExcelRangeBase LoadFromDataTable(DataTable Table, bool PrintHeaders, TableStyles TableStyle)
+		{
+			var r = LoadFromDataTable(Table, PrintHeaders);
+
+            int rows = (Table.Rows.Count == 0 ? 1 : Table.Rows.Count) + (PrintHeaders ? 1 : 0);
+            if (rows >= 0 && Table.Columns.Count>0)
+			{
+                var tbl = _worksheet.Tables.Add(new ExcelAddressBase(_fromRow, _fromCol, _fromRow + rows - 1, _fromCol + Table.Columns.Count-1), Table.TableName);
+				tbl.ShowHeader = PrintHeaders;
+				tbl.TableStyle = TableStyle;
+			}
+		    return r;
+		}
+		/// <summary>
+		/// Load the data from the datatable starting from the top left cell of the range
+		/// </summary>
+		/// <param name="Table">The datatable to load</param>
+		/// <param name="PrintHeaders">Print the caption property (if set) or the columnname property if not, on first row</param>
+		/// <returns>The filled range</returns>
+		public ExcelRangeBase LoadFromDataTable(DataTable Table, bool PrintHeaders)
+		{
+			if (Table == null)
+			{
+				throw (new ArgumentNullException("Table can't be null"));
+			}
+
+			int col = _fromCol, row = _fromRow;
+			if (PrintHeaders)
+			{
+				foreach (DataColumn dc in Table.Columns)
+				{
+                    // If no caption is set, the ColumnName property is called implicitly.
+					_worksheet._values.SetValue(row, col++, dc.Caption);
+				}
+				row++;
+				col = _fromCol;
+			}
+			foreach (DataRow dr in Table.Rows)
+			{
+				foreach (object value in dr.ItemArray)
+				{
+                    if (value != null && value != DBNull.Value && !string.IsNullOrEmpty(value.ToString()))
+                    {
+                        _worksheet._values.SetValue(row, col++, value);
+                    }
+                    else
+                    {
+                        col++;
+                    }
+                }
+				row++;
+				col = _fromCol;
+			}
+            return _worksheet.Cells[_fromRow, _fromCol, (row == _fromRow ? _fromRow : row - 1), _fromCol + Table.Columns.Count - 1];
+		}
+		#endregion
+		#region LoadFromArrays
+		/// <summary>
+		/// Loads data from the collection of arrays of objects into the range, starting from
+		/// the top-left cell.
+		/// </summary>
+		/// <param name="Data">The data.</param>
+		public ExcelRangeBase LoadFromArrays(IEnumerable<object[]> Data)
+		{
+			//thanx to Abdullin for the code contribution
+			if (Data == null) throw new ArgumentNullException("data");
+
+			int column = _fromCol, row = _fromRow;
+
+			foreach (var rowData in Data)
+			{
+				column = _fromCol;
+				foreach (var cellData in rowData)
+				{
+					_worksheet._values.SetValue(row, column, cellData);
+					column += 1;
+				}
+				row += 1;
+			}
+			return _worksheet.Cells[_fromRow, _fromCol, row - 1, column - 1];
+		}
+		#endregion
+		#region LoadFromCollection
+		/// <summary>
+		/// Load a collection into a the worksheet starting from the top left row of the range.
+		/// </summary>
+		/// <typeparam name="T">The datatype in the collection</typeparam>
+		/// <param name="Collection">The collection to load</param>
+		/// <returns>The filled range</returns>
+		public ExcelRangeBase LoadFromCollection<T>(IEnumerable<T> Collection)
+		{
+			return LoadFromCollection<T>(Collection, false, TableStyles.None, BindingFlags.Public | BindingFlags.Instance, null);
+		}
+		/// <summary>
+		/// Load a collection of T into the worksheet starting from the top left row of the range.
+		/// Default option will load all public instance properties of T
+		/// </summary>
+		/// <typeparam name="T">The datatype in the collection</typeparam>
+		/// <param name="Collection">The collection to load</param>
+        /// <param name="PrintHeaders">Print the property names on the first row. If the property is decorated with a <see cref="DisplayNameAttribute"/> or a <see cref="DescriptionAttribute"/> that attribute will be used instead of the reflected member name.</param>
+		/// <returns>The filled range</returns>
+		public ExcelRangeBase LoadFromCollection<T>(IEnumerable<T> Collection, bool PrintHeaders)
+		{
+			return LoadFromCollection<T>(Collection, PrintHeaders, TableStyles.None, BindingFlags.Public | BindingFlags.Instance, null);
+		}
+		/// <summary>
+		/// Load a collection of T into the worksheet starting from the top left row of the range.
+		/// Default option will load all public instance properties of T
+		/// </summary>
+		/// <typeparam name="T">The datatype in the collection</typeparam>
+		/// <param name="Collection">The collection to load</param>
+        /// <param name="PrintHeaders">Print the property names on the first row. If the property is decorated with a <see cref="DisplayNameAttribute"/> or a <see cref="DescriptionAttribute"/> that attribute will be used instead of the reflected member name.</param>
+		/// <param name="TableStyle">Will create a table with this style. If set to TableStyles.None no table will be created</param>
+		/// <returns>The filled range</returns>
+		public ExcelRangeBase LoadFromCollection<T>(IEnumerable<T> Collection, bool PrintHeaders, TableStyles TableStyle)
+		{
+			return LoadFromCollection<T>(Collection, PrintHeaders, TableStyle, BindingFlags.Public | BindingFlags.Instance, null);
+		}
+		/// <summary>
+		/// Load a collection into the worksheet starting from the top left row of the range.
+		/// </summary>
+		/// <typeparam name="T">The datatype in the collection</typeparam>
+		/// <param name="Collection">The collection to load</param>
+		/// <param name="PrintHeaders">Print the property names on the first row. Any underscore in the property name will be converted to a space. If the property is decorated with a <see cref="DisplayNameAttribute"/> or a <see cref="DescriptionAttribute"/> that attribute will be used instead of the reflected member name.</param>
+		/// <param name="TableStyle">Will create a table with this style. If set to TableStyles.None no table will be created</param>
+		/// <param name="memberFlags">Property flags to use</param>
+		/// <param name="Members">The properties to output. Must be of type T</param>
+		/// <returns>The filled range</returns>
+		public ExcelRangeBase LoadFromCollection<T>(IEnumerable<T> Collection, bool PrintHeaders, TableStyles TableStyle, BindingFlags memberFlags, MemberInfo[] Members)
+		{
+			var type = typeof(T);
+			if (Members == null)
+			{
+				Members = type.GetProperties(memberFlags);
+			}
+			else
+			{
+				foreach (var t in Members)
+				{
+                    if (t.DeclaringType!=null && t.DeclaringType != type && !t.DeclaringType.IsSubclassOf(type))
+					{
+						throw new InvalidCastException("Supplied properties in parameter Properties must be of the same type as T (or an assignable type from T");
+					}
+				}
+			}
+
+			int col = _fromCol, row = _fromRow;
+			if (Members.Length > 0 && PrintHeaders)
+			{
+				foreach (var t in Members)
+				{
+                    var descriptionAttribute = t.GetCustomAttributes(typeof(DescriptionAttribute), false).FirstOrDefault() as DescriptionAttribute;
+				    var header = string.Empty;
+                    if (descriptionAttribute != null)
+                    {
+                        header = descriptionAttribute.Description;
+                    }
+                    else
+                    {
+                        var displayNameAttribute =
+                            t.GetCustomAttributes(typeof (DisplayNameAttribute), false).FirstOrDefault() as
+                            DisplayNameAttribute;
+                        if (displayNameAttribute != null)
+                        {
+                            header = displayNameAttribute.DisplayName;
+                        }
+                        else
+                        {
+                            header = t.Name.Replace('_', ' ');
+                        }
+                    }
+                    _worksheet._values.SetValue(row, col++, header);
+				}
+				row++;
+			}
+
+			if (Members.Length == 0)
+			{
+				foreach (var item in Collection)
+				{
+					_worksheet.Cells[row++, col].Value = item;
+				}
+			}
+			else
+			{
+				foreach (var item in Collection)
+				{
+					col = _fromCol;
+                    if (item is string || item is decimal || item is DateTime || item.GetType().IsPrimitive)
+                    {
+                        _worksheet.Cells[row, col++].Value = item;
+                    }
+                    else
+                    {
+                        foreach (var t in Members)
+                        {
+                            if (t is PropertyInfo)
+                            {
+                                _worksheet.Cells[row, col++].Value = ((PropertyInfo)t).GetValue(item, null);
+                            }
+                            else if (t is FieldInfo)
+                            {
+                                _worksheet.Cells[row, col++].Value = ((FieldInfo)t).GetValue(item);
+                            }
+                            else if (t is MethodInfo)
+                            {
+                                _worksheet.Cells[row, col++].Value = ((MethodInfo)t).Invoke(item, null);
+                            }
+                        }
+                    }
+					row++;
+				}
+			}
+
+            if (_fromRow == row-1 && PrintHeaders)
+            {
+                row++;
+            }
+
+            var r = _worksheet.Cells[_fromRow, _fromCol, row - 1, Members.Length==0 ? col : col - 1];
+
+			if (TableStyle != TableStyles.None)
+			{
+				var tbl = _worksheet.Tables.Add(r, "");
+				tbl.ShowHeader = PrintHeaders;
+				tbl.TableStyle = TableStyle;
+			}
+			return r;
+		}
+		#endregion
+		#region LoadFromText
+		/// <summary>
+		/// Loads a CSV text into a range starting from the top left cell.
+		/// Default settings is Comma separation
+		/// </summary>
+		/// <param name="Text">The Text</param>
+		/// <returns>The range containing the data</returns>
+		public ExcelRangeBase LoadFromText(string Text)
+		{
+			return LoadFromText(Text, new ExcelTextFormat());
+		}
+		/// <summary>
+		/// Loads a CSV text into a range starting from the top left cell.
+		/// </summary>
+		/// <param name="Text">The Text</param>
+		/// <param name="Format">Information how to load the text</param>
+		/// <returns>The range containing the data</returns>
+		public ExcelRangeBase LoadFromText(string Text, ExcelTextFormat Format)
+		{
+            if (string.IsNullOrEmpty(Text))
+            {
+                var r = _worksheet.Cells[_fromRow, _fromCol];
+                r.Value = "";
+                return r;
+            }
+            
+            if (Format == null) Format = new ExcelTextFormat();
+
+            string[] lines = Regex.Split(Text, Format.EOL);
+			int row = _fromRow;
+			int col = _fromCol;
+			int maxCol = col;
+			int lineNo = 1;
+			foreach (string line in lines)
+			{
+				if (lineNo > Format.SkipLinesBeginning && lineNo <= lines.Length - Format.SkipLinesEnd)
+				{
+					col = _fromCol;
+					string v = "";
+					bool isText = false, isQualifier = false;
+					int QCount = 0;
+					foreach (char c in line)
+					{
+						if (Format.TextQualifier != 0 && c == Format.TextQualifier)
+						{
+							if (!isText && v != "")
+							{
+								throw (new Exception(string.Format("Invalid Text Qualifier in line : {0}", line)));
+							}
+							isQualifier = !isQualifier;
+							QCount += 1;
+							isText = true;
+						}
+						else
+						{
+                            if (QCount > 1 && !string.IsNullOrEmpty(v))
+							{
+								v += new string(Format.TextQualifier, QCount / 2);
+							}
+                            else if(QCount>2 && string.IsNullOrEmpty(v))
+                            {
+                                v += new string(Format.TextQualifier, (QCount-1) / 2);
+                            }
+
+							if (isQualifier)
+							{
+								v += c;
+							}
+							else
+							{
+								if (c == Format.Delimiter)
+								{
+										_worksheet.SetValue(row, col, ConvertData(Format, v, col - _fromCol, isText));
+									v = "";
+									isText = false;
+									col++;
+								}
+								else
+								{
+									if (QCount % 2 == 1)
+									{
+										throw (new Exception(string.Format("Text delimiter is not closed in line : {0}", line)));
+									}
+									v += c;
+								}
+							}
+							QCount = 0;
+						}
+					}
+					if (QCount > 1)
+					{
+						v += new string(Format.TextQualifier, QCount / 2);
+					}
+
+						_worksheet._values.SetValue(row, col, ConvertData(Format, v, col - _fromCol, isText));
+					if (col > maxCol) maxCol = col;
+					row++;
+				}
+				lineNo++;
+			}
+			return _worksheet.Cells[_fromRow, _fromCol, row - 1, maxCol];
+		}
+		/// <summary>
+		/// Loads a CSV text into a range starting from the top left cell.
+		/// </summary>
+		/// <param name="Text">The Text</param>
+		/// <param name="Format">Information how to load the text</param>
+		/// <param name="TableStyle">Create a table with this style</param>
+		/// <param name="FirstRowIsHeader">Use the first row as header</param>
+		/// <returns></returns>
+		public ExcelRangeBase LoadFromText(string Text, ExcelTextFormat Format, TableStyles TableStyle, bool FirstRowIsHeader)
+		{
+			var r = LoadFromText(Text, Format);
+
+			var tbl = _worksheet.Tables.Add(r, "");
+			tbl.ShowHeader = FirstRowIsHeader;
+			tbl.TableStyle = TableStyle;
+
+			return r;
+		}
+		/// <summary>
+		/// Loads a CSV file into a range starting from the top left cell.
+		/// </summary>
+		/// <param name="TextFile">The Textfile</param>
+		/// <returns></returns>
+		public ExcelRangeBase LoadFromText(FileInfo TextFile)
+		{
+			return LoadFromText(File.ReadAllText(TextFile.FullName, Encoding.ASCII));
+		}
+		/// <summary>
+		/// Loads a CSV file into a range starting from the top left cell.
+		/// </summary>
+		/// <param name="TextFile">The Textfile</param>
+		/// <param name="Format">Information how to load the text</param>
+		/// <returns></returns>
+		public ExcelRangeBase LoadFromText(FileInfo TextFile, ExcelTextFormat Format)
+		{
+			return LoadFromText(File.ReadAllText(TextFile.FullName, Format.Encoding), Format);
+		}
+		/// <summary>
+		/// Loads a CSV file into a range starting from the top left cell.
+		/// </summary>
+		/// <param name="TextFile">The Textfile</param>
+		/// <param name="Format">Information how to load the text</param>
+		/// <param name="TableStyle">Create a table with this style</param>
+		/// <param name="FirstRowIsHeader">Use the first row as header</param>
+		/// <returns></returns>
+		public ExcelRangeBase LoadFromText(FileInfo TextFile, ExcelTextFormat Format, TableStyles TableStyle, bool FirstRowIsHeader)
+		{
+			return LoadFromText(File.ReadAllText(TextFile.FullName, Format.Encoding), Format, TableStyle, FirstRowIsHeader);
+		}
+		#endregion
+		#region GetValue
+		/// <summary>
+		/// Get the strongly typed value of the cell.
+		/// </summary>
+		/// <typeparam name="T">The type</typeparam>
+		/// <returns>The value. If the value can't be converted to the specified type, the default value will be returned</returns>
+		public T GetValue<T>()
+		{
+			return _worksheet.GetTypedValue<T>(Value);
+		}
+		#endregion
+		/// <summary>
+		/// Get a range with an offset from the top left cell.
+		/// The new range has the same dimensions as the current range
+		/// </summary>
+		/// <param name="RowOffset">Row Offset</param>
+		/// <param name="ColumnOffset">Column Offset</param>
+		/// <returns></returns>
+		public ExcelRangeBase Offset(int RowOffset, int ColumnOffset)
+		{
+			if (_fromRow + RowOffset < 1 || _fromCol + ColumnOffset < 1 || _fromRow + RowOffset > ExcelPackage.MaxRows || _fromCol + ColumnOffset > ExcelPackage.MaxColumns)
+			{
+				throw (new ArgumentOutOfRangeException("Offset value out of range"));
+			}
+			string address = GetAddress(_fromRow + RowOffset, _fromCol + ColumnOffset, _toRow + RowOffset, _toCol + ColumnOffset);
+			return new ExcelRangeBase(_worksheet, address);
+		}
+		/// <summary>
+		/// Get a range with an offset from the top left cell.
+		/// </summary>
+		/// <param name="RowOffset">Row Offset</param>
+		/// <param name="ColumnOffset">Column Offset</param>
+		/// <param name="NumberOfRows">Number of rows. Minimum 1</param>
+		/// <param name="NumberOfColumns">Number of colums. Minimum 1</param>
+		/// <returns></returns>
+		public ExcelRangeBase Offset(int RowOffset, int ColumnOffset, int NumberOfRows, int NumberOfColumns)
+		{
+			if (NumberOfRows < 1 || NumberOfColumns < 1)
+			{
+				throw (new Exception("Number of rows/columns must be greater than 0"));
+			}
+			NumberOfRows--;
+			NumberOfColumns--;
+			if (_fromRow + RowOffset < 1 || _fromCol + ColumnOffset < 1 || _fromRow + RowOffset > ExcelPackage.MaxRows || _fromCol + ColumnOffset > ExcelPackage.MaxColumns ||
+				 _fromRow + RowOffset + NumberOfRows < 1 || _fromCol + ColumnOffset + NumberOfColumns < 1 || _fromRow + RowOffset + NumberOfRows > ExcelPackage.MaxRows || _fromCol + ColumnOffset + NumberOfColumns > ExcelPackage.MaxColumns)
+			{
+				throw (new ArgumentOutOfRangeException("Offset value out of range"));
+			}
+			string address = GetAddress(_fromRow + RowOffset, _fromCol + ColumnOffset, _fromRow + RowOffset + NumberOfRows, _fromCol + ColumnOffset + NumberOfColumns);
+			return new ExcelRangeBase(_worksheet, address);
+		}
+		/// <summary>
+		/// Adds a new comment for the range.
+		/// If this range contains more than one cell, the top left comment is returned by the method.
+		/// </summary>
+		/// <param name="Text"></param>
+		/// <param name="Author"></param>
+		/// <returns>A reference comment of the top left cell</returns>
+		public ExcelComment AddComment(string Text, string Author)
+		{
+			//Check if any comments exists in the range and throw an exception
+			_changePropMethod(Exists_Comment, null);
+			//Create the comments
+			_changePropMethod(Set_Comment, new string[] { Text, Author });
+
+			return _worksheet.Comments[new ExcelCellAddress(_fromRow, _fromCol)];
+		}
+
+        ///// <summary>
+        ///// Copies the range of cells to an other range
+        ///// </summary>
+        ///// <param name="Destination">The start cell where the range will be copied.</param>
+        public void Copy(ExcelRangeBase Destination)
+        {
+            bool sameWorkbook = Destination._worksheet.Workbook == _worksheet.Workbook;
+            ExcelStyles sourceStyles = _worksheet.Workbook.Styles,
+                        styles = Destination._worksheet.Workbook.Styles;
+            Dictionary<int, int> styleCashe = new Dictionary<int, int>();
+
+            //Delete all existing cells; 
+            int toRow = _toRow - _fromRow + 1,
+                toCol = _toCol - _fromCol + 1;
+
+            string s = "";
+            int i=0;
+            object o = null;
+            byte flag=0;
+            Uri hl = null;
+            ExcelComment comment=null;
+
+            var cse = new CellsStoreEnumerator<object>(_worksheet._values, _fromRow, _fromCol, _toRow, _toCol);
+            var copiedValue = new List<CopiedCell>();
+            while (cse.Next())
+            {
+                var row=cse.Row;
+                var col = cse.Column;       //Issue 15070
+                var cell = new CopiedCell
+                {
+                    Row = Destination._fromRow + (row - _fromRow),
+                    Column = Destination._fromCol + (col - _fromCol),
+                    Value=cse.Value
+                };
+
+                //Destination._worksheet._values.SetValue(row, col, cse.Value);
+
+                if (_worksheet._types.Exists(row, col, ref s))
+                {
+                    //Destination._worksheet._types.SetValue(row, col,s);
+                    cell.Type=s;
+                }
+
+                if (_worksheet._formulas.Exists(row, col, ref o))
+                {
+                    if (o is int)
+                    {
+                       // Destination._worksheet._formulas.SetValue(row, col, _worksheet.GetFormula(cse.Row, cse.Column));    //Shared formulas, set the formula per cell to simplify
+                        cell.Formula=_worksheet.GetFormula(cse.Row, cse.Column);
+                    }
+                    else
+                    {
+                        //Destination._worksheet._formulas.SetValue(row, col, o);
+                        cell.Formula=o;
+                    }
+                }
+                if(_worksheet._styles.Exists(row, col, ref i))
+                {
+                    if (sameWorkbook)
+                    {
+                        //Destination._worksheet._styles.SetValue(row, col, i);
+                        cell.StyleID=i;
+                    }
+                    else
+                    {
+                        if (styleCashe.ContainsKey(i))
+                        {
+                            i = styleCashe[i];
+                        }
+                        else
+                        {
+                            var oldStyleID = i;
+                            i = styles.CloneStyle(sourceStyles, i);
+                            styleCashe.Add(oldStyleID, i);
+                        }
+                        //Destination._worksheet._styles.SetValue(row, col, i);
+                        cell.StyleID=i;
+                    }
+                }
+                
+                if (_worksheet._hyperLinks.Exists(row, col, ref hl))
+                {
+                    //Destination._worksheet._hyperLinks.SetValue(row, col, hl);
+                    cell.HyperLink=hl;
+                }
+
+                if(_worksheet._commentsStore.Exists(row, col, ref comment))
+                {
+                    cell.Comment=comment;
+                }
+
+                if (_worksheet._flags.Exists(row, col, ref flag))
+                {
+                    cell.Flag = flag;
+                }
+                copiedValue.Add(cell);
+            }
+
+            //Copy styles with no cell value
+            var cses = new CellsStoreEnumerator<int>(_worksheet._styles, _fromRow, _fromCol, _toRow, _toCol);
+            while (cses.Next())
+            {
+                if (!_worksheet._values.Exists(cses.Row, cses.Column))
+                {
+                    var row = Destination._fromRow + (cses.Row - _fromRow);
+                    var col = Destination._fromCol + (cses.Column - _fromCol);
+                    var cell = new CopiedCell
+                    {
+                        Row = row,
+                        Column = col,
+                        Value = null
+                    };
+
+                    i = cses.Value;
+                    if (sameWorkbook)
+                    {
+                        cell.StyleID = i;
+                    }
+                    else
+                    {
+                        if (styleCashe.ContainsKey(i))
+                        {
+                            i = styleCashe[i];
+                        }
+                        else
+                        {
+                            var oldStyleID = i;
+                            i = styles.CloneStyle(sourceStyles, i);
+                            styleCashe.Add(oldStyleID, i);
+                        }
+                        //Destination._worksheet._styles.SetValue(row, col, i);
+                        cell.StyleID = i;
+                    }
+                    copiedValue.Add(cell);
+                }
+            }
+            var copiedMergedCells = new Dictionary<int, ExcelAddress>();
+            //Merged cells
+            var csem = new CellsStoreEnumerator<int>(_worksheet.MergedCells._cells, _fromRow, _fromCol, _toRow, _toCol);
+            while (csem.Next())
+            {
+                if(!copiedMergedCells.ContainsKey(csem.Value))
+                {
+                    var adr = new ExcelAddress(_worksheet.Name, _worksheet.MergedCells.List[csem.Value]);
+                    if(this.Collide(adr)==eAddressCollition.Inside)
+                    {                        
+                        copiedMergedCells.Add(csem.Value, new ExcelAddress(
+                            Destination._fromRow + (adr.Start.Row - _fromRow),
+                            Destination._fromCol + (adr.Start.Column - _fromCol),
+                            Destination._toRow + (adr.End.Row - _fromRow),
+                            Destination._toCol + (adr.End.Column - _fromCol)));
+                    }
+                    else
+                    {
+                        //Partial merge of the address ignore.
+                        copiedMergedCells.Add(csem.Value, null);
+                    }
+                }
+            }
+
+            Destination._worksheet.MergedCells.Delete(new ExcelAddressBase(Destination._fromRow, Destination._fromCol, Destination._fromRow+toRow, Destination._fromCol+toCol));
+
+            Destination._worksheet._values.Clear(Destination._fromRow, Destination._fromCol, toRow, toCol);
+            Destination._worksheet._formulas.Clear(Destination._fromRow, Destination._fromCol, toRow, toCol);
+            Destination._worksheet._styles.Clear(Destination._fromRow, Destination._fromCol, toRow, toCol);
+            Destination._worksheet._types.Clear(Destination._fromRow, Destination._fromCol, toRow, toCol);
+            Destination._worksheet._hyperLinks.Clear(Destination._fromRow, Destination._fromCol, toRow, toCol);
+            Destination._worksheet._flags.Clear(Destination._fromRow, Destination._fromCol, toRow, toCol);
+            Destination._worksheet._commentsStore.Clear(Destination._fromRow, Destination._fromCol, toRow, toCol);
+           
+            foreach(var cell in copiedValue)
+            {
+                Destination._worksheet._values.SetValue(cell.Row, cell.Column, cell.Value);
+
+                if(cell.Type!=null)
+                {
+                    Destination._worksheet._types.SetValue(cell.Row, cell.Column, cell.Type);
+                }
+
+                if(cell.StyleID!=null)
+                {
+                    Destination._worksheet._styles.SetValue(cell.Row, cell.Column, cell.StyleID.Value);
+                }
+
+                if(cell.Formula!=null)
+                {
+                    cell.Formula = UpdateFormulaReferences(cell.Formula.ToString(), Destination._fromRow - _fromRow, Destination._fromCol - _fromCol, 0, 0, true);
+                    Destination._worksheet._formulas.SetValue(cell.Row, cell.Column, cell.Formula);
+                }
+                if(cell.HyperLink!=null)
+                {
+                    Destination._worksheet._hyperLinks.SetValue(cell.Row, cell.Column, cell.HyperLink);
+                }
+
+                if (cell.Comment != null)
+                {
+                    //Destination._worksheet._commentsStore.SetValue(cell.Row, cell.Column, cell.Comment);
+                }
+            }
+
+            //Add merged cells
+            foreach(var m in copiedMergedCells.Values)
+            {
+                if(m!=null)
+                {
+                    Destination._worksheet.MergedCells.Add(m, true);
+                }
+            }
+
+
+            //Clone the cell
+                //var copiedCell = (_worksheet._cells[GetCellID(_worksheet.SheetID, cell._fromRow, cell.column)] as ExcelCell);
+
+                //var newCell = copiedCell.Clone(Destination._worksheet,
+                //        Destination._fromRow + (copiedCell.Row - _fromRow),
+                //        Destination.column + (copiedCell.Column - column));
+
+        //        newCell.MergeId = _worksheet.GetMergeCellId(copiedCell.Row, copiedCell.Column);
+
+
+        //        if (!string.IsNullOrEmpty(newCell.Formula))
+        //        {
+        //            newCell.Formula = ExcelCell.UpdateFormulaReferences(newCell.Formula, newCell.Row - copiedCell.Row, (newCell.Column - copiedCell.Column), 1, 1);
+        //        }
+
+        //        //If its not the same workbook we must copy the styles to the new workbook.
+        //        if (!sameWorkbook)
+        //        {
+        //            if (styleCashe.ContainsKey(cell.StyleID))
+        //            {
+        //                newCell.StyleID = styleCashe[cell.StyleID];
+        //            }
+        //            else
+        //            {
+        //                newCell.StyleID = styles.CloneStyle(sourceStyles, cell.StyleID);
+        //                styleCashe.Add(cell.StyleID, newCell.StyleID);
+        //            }
+        //        }
+        //        newCells.Add(newCell);
+        //        if (newCell.Merge) mergedCells.Add(newCell.CellID, newCell);
+        //    }
+
+        //    //Now clear the destination.
+        //    Destination.Offset(0, 0, (_toRow - _fromRow) + 1, (_toCol - column) + 1).Clear();
+
+        //    //And last add the new cells to the worksheet
+        //    foreach (var cell in newCells)
+        //    {
+        //        Destination.Worksheet._cells.Add(cell);
+        //    }
+        //    //Add merged cells
+        //    if (mergedCells.Count > 0)
+        //    {
+        //        List<ExcelAddressBase> mergedAddresses = new List<ExcelAddressBase>();
+        //        foreach (var cell in mergedCells.Values)
+        //        {
+        //            if (!IsAdded(cell, mergedAddresses))
+        //            {
+        //                int startRow = cell.Row, startCol = cell.Column, endRow = cell.Row, endCol = cell.Column + 1;
+        //                while (mergedCells.ContainsKey(ExcelCell.GetCellID(Destination.Worksheet.SheetID, endRow, endCol)))
+        //                {
+        //                    ExcelCell next = mergedCells[ExcelCell.GetCellID(Destination.Worksheet.SheetID, endRow, endCol)];
+        //                    if (cell.MergeId != next.MergeId)
+        //                    {
+        //                        break;
+        //                    }
+        //                    endCol++;
+        //                }
+
+        //                while (IsMerged(mergedCells, Destination.Worksheet, endRow, startCol, endCol - 1, cell))
+        //                {
+        //                    endRow++;
+        //                }
+
+        //                mergedAddresses.Add(new ExcelAddressBase(startRow, startCol, endRow - 1, endCol - 1));
+        //            }
+        //        }
+        //        Destination.Worksheet.MergedCells.List.AddRange((from r in mergedAddresses select r.Address));
+        //    }
+        //}
+
+        //private bool IsAdded(ExcelCell cell, List<ExcelAddressBase> mergedAddresses)
+        //{
+        //    foreach (var address in mergedAddresses)
+        //    {
+        //        if (address.Collide(new ExcelAddressBase(cell.CellAddress)) == eAddressCollition.Inside)
+        //        {
+        //            return true;
+        //        }
+        //    }
+        //    return false;
+        //}
+
+        //private bool IsMerged(Dictionary<ulong, ExcelCell> mergedCells, ExcelWorksheet worksheet, int row, int startCol, int endCol, ExcelCell cell)
+        //{
+        //    for (int col = startCol; col <= endCol; col++)
+        //    {
+        //        if (!mergedCells.ContainsKey(ExcelCell.GetCellID(worksheet.SheetID, row, col)))
+        //        {
+        //            return false;
+        //        }
+        //        else
+        //        {
+        //            ExcelCell next = mergedCells[ExcelCell.GetCellID(worksheet.SheetID, row, col)];
+        //            if (cell.MergeId != next.MergeId)
+        //            {
+        //                return false;
+        //            }
+        //        }
+        //    }
+        //    return true;
+        }
+
+		/// <summary>
+		/// Clear all cells
+		/// </summary>
+		public void Clear()
+		{
+			Delete(this, false);
+		}
+		/// <summary>
+		/// Creates an array-formula.
+		/// </summary>
+		/// <param name="ArrayFormula">The formula</param>
+		public void CreateArrayFormula(string ArrayFormula)
+		{
+			if (Addresses != null)
+			{
+				throw (new Exception("An Arrayformula can not have more than one address"));
+			}
+			Set_SharedFormula(ArrayFormula, this, true);
+		}
+        //private void Delete(ExcelAddressBase Range)
+        //{
+        //    Delete(Range, true);
+        //}
+        internal void Delete(ExcelAddressBase Range, bool shift)
+		{
+            //DeleteCheckMergedCells(Range);
+            _worksheet.MergedCells.Delete(Range);
+			//First find the start cell
+            var rows=Range._toRow-Range._fromRow+1;
+            var cols=Range._toCol - Range._fromCol+1;
+            
+            _worksheet._values.Delete(Range._fromRow, Range._fromCol, rows, cols, shift);
+            _worksheet._types.Delete(Range._fromRow, Range._fromCol, rows, cols, shift);
+            _worksheet._styles.Delete(Range._fromRow, Range._fromCol, rows, cols, shift);
+            _worksheet._formulas.Delete(Range._fromRow, Range._fromCol, rows, cols, shift);
+            _worksheet._hyperLinks.Delete(Range._fromRow, Range._fromCol, rows, cols, shift);
+            _worksheet._flags.Delete(Range._fromRow, Range._fromCol, rows, cols, shift);
+            _worksheet._commentsStore.Delete(Range._fromRow, Range._fromCol, rows, cols, shift);
+
+            //if(shift)
+            //{
+            //    _worksheet.AdjustFormulasRow(Range._fromRow, rows);
+            //}
+
+			//Delete multi addresses as well
+			if (Addresses != null)
+			{
+				foreach (var sub in Addresses)
+				{
+					Delete(sub, shift);
+				}
+            }
+        }
+
+        private void DeleteCheckMergedCells(ExcelAddressBase Range)
+        {
+            var removeItems = new List<string>();
+            foreach (var addr in Worksheet.MergedCells)
+            {
+                var addrCol = Range.Collide(new ExcelAddress(Range.WorkSheet, addr));
+                if (addrCol != eAddressCollition.No)
+                {
+                    if (addrCol == eAddressCollition.Inside)
+                    {
+                        removeItems.Add(addr);
+                    }
+                    else
+                    {
+                        throw (new InvalidOperationException("Can't remove/overwrite a part of cells that are merged"));
+                    }
+                }
+            }
+            foreach (var item in removeItems)
+            {
+                Worksheet.MergedCells.Remove(item);
+			}
+		}
+		#endregion
+		#region IDisposable Members
+
+		public void Dispose()
+		{
+			//_worksheet = null;            
+		}
+
+		#endregion
+		#region "Enumerator"
+        //int _index;
+        //ulong _toCellId;
+        //int _enumAddressIx;
+        CellsStoreEnumerator<object> cellEnum;
+		public IEnumerator<ExcelRangeBase> GetEnumerator()
+		{
+            return new ExcelRangeBaseEnumerator(this);
+		}
+
+		IEnumerator IEnumerable.GetEnumerator()
+		{
+            return new ExcelRangeBaseEnumerator(this);
+		}
+
+		/// <summary>
+		/// The current range when enumerating
+		/// </summary>
+        public class ExcelRangeBaseEnumerator : IEnumerator<ExcelRangeBase> {
+            private CellsStoreEnumerator<object> _cellEnum;
+            private int _enumAddressIx = -1;
+            private ExcelRangeBase _range;
+            private ExcelRangeBase _current;
+
+            /// <summary>
+            /// The current range when enumerating
+            /// </summary>
+            public ExcelRangeBase Current {
+                get {
+                    return _current;
+                }
+            }
+
+            /// <summary>
+            /// The current range when enumerating
+            /// </summary>
+            object IEnumerator.Current {
+                get {
+                    return _current;
+                }
+            }
+
+            public ExcelRangeBaseEnumerator(ExcelRangeBase range) {
+                this._range = range;
+                Reset();
+            }
+            public bool MoveNext() {
+                if (_cellEnum.Next()) {
+                    _current._fromCol = _cellEnum.Column;
+                    _current._fromRow = _cellEnum.Row;
+                    _current._toCol = _cellEnum.Column;
+                    _current._toRow = _cellEnum.Row;
+                    _current.Address = GetAddress(_current._fromRow, _current._fromCol);
+                    return true;
+                }
+                else if (_range._addresses != null) {
+                    _enumAddressIx++;
+                    if (_enumAddressIx < _range._addresses.Count) {
+                        _cellEnum = new CellsStoreEnumerator<object>(_range._worksheet._values,
+                            _range._addresses[_enumAddressIx]._fromRow,
+                            _range._addresses[_enumAddressIx]._fromCol,
+                            _range._addresses[_enumAddressIx]._toRow,
+                            _range._addresses[_enumAddressIx]._toCol);
+                        return MoveNext();
+                    }
+                    else {
+                        return false;
+                    }
+                }
+                return false;
+            }
+
+            public void Reset() {
+                _enumAddressIx = -1;
+                _cellEnum = new CellsStoreEnumerator<object>(_range._worksheet._values, _range._fromRow, _range._fromCol, _range._toRow, _range._toCol);
+                _current = new ExcelRangeBase(_range._worksheet, ExcelAddressBase.GetAddress(_cellEnum.Row, _cellEnum.Column));
+            }
+
+            public void Dispose() {
+                if (_cellEnum != null) {
+                    _cellEnum.Dispose();
+                    _cellEnum = null;
+                }
+            }
+
+        }
+
+        //private void GetNextIndexEnum(int fromRow, int fromCol, int toRow, int toCol)
+        //{
+        //    if (_index >= _worksheet._cells.Count) return;
+        //    ExcelCell cell = _worksheet._cells[_index] as ExcelCell;
+        //    while (cell.Column > toCol || cell.Column < fromCol)
+        //    {
+        //        if (cell.Column < fromCol)
+        //        {
+        //            _index = _worksheet._cells.IndexOf(ExcelAddress.GetCellID(_worksheet.SheetID, cell.Row, fromCol));
+        //        }
+        //        else
+        //        {
+        //            _index = _worksheet._cells.IndexOf(ExcelAddress.GetCellID(_worksheet.SheetID, cell.Row + 1, fromCol));
+        //        }
+
+        //        if (_index < 0)
+        //        {
+        //            _index = ~_index;
+        //        }
+        //        if (_index >= _worksheet._cells.Count || _worksheet._cells[_index].RangeID > _toCellId)
+        //        {
+        //            break;
+        //        }
+        //        cell = _worksheet._cells[_index] as ExcelCell;
+        //    }
+        //}
+
+        //private void GetStartIndexEnum(int fromRow, int fromCol, int toRow, int toCol)
+        //{
+        //    _index = _worksheet._cells.IndexOf(ExcelCellBase.GetCellID(_worksheet.SheetID, fromRow, fromCol));
+        //    _toCellId = ExcelCellBase.GetCellID(_worksheet.SheetID, toRow, toCol);
+        //    if (_index < 0)
+        //    {
+        //        _index = ~_index;
+        //    }
+        //    _index--;
+        //}
+    #endregion
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelRow.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelRow.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelRow.cs	(revision 12707)
@@ -0,0 +1,393 @@
+/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		    Initial Release		        2009-10-01
+ * Jan Källman		    License changed GPL-->LGPL 2011-12-27
+ *******************************************************************************/
+
+using System;
+using System.Xml;
+using OfficeOpenXml.Style;
+namespace OfficeOpenXml
+{
+	internal class RowInternal
+    {
+        internal double Height=-1;
+        internal bool Hidden;
+        internal bool Collapsed;        
+        internal short OutlineLevel;
+        internal bool PageBreak;
+        internal bool Phonetic;
+        internal bool CustomHeight;
+        internal int MergeID;
+        internal RowInternal Clone()
+        {
+            return new RowInternal()
+            {
+                Height=Height,
+                Hidden=Hidden,
+                Collapsed=Collapsed,
+                OutlineLevel=OutlineLevel,
+                PageBreak=PageBreak,
+                Phonetic=Phonetic,
+                CustomHeight=CustomHeight,
+                MergeID=MergeID
+            };
+        }
+    }
+    /// <summary>
+	/// Represents an individual row in the spreadsheet.
+	/// </summary>
+	public class ExcelRow : IRangeID
+	{
+		private ExcelWorksheet _worksheet;
+		private XmlElement _rowElement = null;
+        /// <summary>
+        /// Internal RowID.
+        /// </summary>
+        [Obsolete]
+        public ulong RowID 
+        {
+            get
+            {
+                return GetRowID(_worksheet.SheetID, Row);
+            }
+        }
+		#region ExcelRow Constructor
+		/// <summary>
+		/// Creates a new instance of the ExcelRow class. 
+		/// For internal use only!
+		/// </summary>
+		/// <param name="Worksheet">The parent worksheet</param>
+		/// <param name="row">The row number</param>
+		internal ExcelRow(ExcelWorksheet Worksheet, int row)
+		{
+			_worksheet = Worksheet;
+            Row = row;
+		}
+		#endregion
+
+		/// <summary>
+		/// Provides access to the node representing the row.
+		/// </summary>
+		internal XmlNode Node { get { return (_rowElement); } }
+
+		#region ExcelRow Hidden
+        /// <summary>
+		/// Allows the row to be hidden in the worksheet
+		/// </summary>
+		public bool Hidden
+        {
+            get
+            {
+                var r=(RowInternal)_worksheet._values.GetValue(Row, 0);
+                if (r == null)
+                {
+                    return false;
+                }
+                else
+                {
+                    return r.Hidden;
+                }
+            }
+            set
+            {
+                var r = GetRowInternal();
+                r.Hidden=value;
+            }
+        }        
+		#endregion
+
+		#region ExcelRow Height
+        /// <summary>
+		/// Sets the height of the row
+		/// </summary>
+		public double Height
+        {
+			get
+			{
+                var r = (RowInternal)_worksheet._values.GetValue(Row, 0);
+                if (r == null || r.Height<0)
+                {
+                    return _worksheet.DefaultRowHeight;
+                }
+                else
+                {
+                    return r.Height;
+                }
+            }
+            set
+            {
+                var r = GetRowInternal();
+                if (_worksheet._package.DoAdjustDrawings)
+                {
+                    var pos = _worksheet.Drawings.GetDrawingWidths();
+                    r.Height = value;
+                    _worksheet.Drawings.AdjustHeight(pos);
+                }
+                else
+                {
+                    r.Height = value;
+                }
+                
+                if (r.Hidden && value != 0)
+                {
+                    Hidden = false;
+                }
+                r.CustomHeight = (value != _worksheet.DefaultRowHeight);
+            }
+        }
+        /// <summary>
+        /// Set to true if You don't want the row to Autosize
+        /// </summary>
+        public bool CustomHeight 
+        {
+            get
+            {
+                var r = (RowInternal)_worksheet._values.GetValue(Row, 0);
+                if (r == null)
+                {
+                    return false;
+                }
+                else
+                {
+                    return r.CustomHeight;
+                }
+            }
+            set
+            {
+                var r = GetRowInternal();
+                r.CustomHeight = value;
+            }
+        }
+		#endregion
+
+        internal string _styleName = "";
+        /// <summary>
+        /// Sets the style for the entire column using a style name.
+        /// </summary>
+        public string StyleName
+        {
+            get
+            {
+                return _styleName;
+            }
+            set
+            {
+                StyleID = _worksheet.Workbook.Styles.GetStyleIdFromName(value);
+                _styleName = value;
+            }
+        }
+        /// <summary>
+        /// Sets the style for the entire row using the style ID.  
+        /// </summary>
+        public int StyleID
+        {
+            get
+            {
+                return _worksheet._styles.GetValue(Row, 0);
+            }
+            set
+            {
+                _worksheet._styles.SetValue(Row, 0, value);
+            }
+        }
+
+        /// <summary>
+        /// Rownumber
+        /// </summary>
+        public int Row
+        {
+            get;
+            set;
+        }
+        /// <summary>
+        /// If outline level is set this tells that the row is collapsed
+        /// </summary>
+        public bool Collapsed
+        {
+            get
+            {
+                var r=(RowInternal)_worksheet._values.GetValue(Row, 0);
+                if (r == null)
+                {
+                    return false;
+                }
+                else
+                {
+                    return r.Collapsed;
+                }
+            }
+            set
+            {
+                var r = GetRowInternal();
+                r.Collapsed = value;
+            }
+        }
+        /// <summary>
+        /// Outline level.
+        /// </summary>
+        public int OutlineLevel
+        {
+            get
+            {
+                var r=(RowInternal)_worksheet._values.GetValue(Row, 0);
+                if (r == null)
+                {
+                    return 0;
+                }
+                else
+                {
+                    return r.OutlineLevel;
+                }
+            }
+            set
+            {
+                var r = GetRowInternal();
+                r.OutlineLevel=(short)value;
+            }
+        }
+
+        private  RowInternal GetRowInternal()
+        {
+            var r = (RowInternal)_worksheet._values.GetValue(Row, 0);
+            if (r == null)
+            {
+                r = new RowInternal();
+                _worksheet._values.SetValue(Row, 0, r);
+            }
+            return r;
+        }        
+        /// <summary>
+        /// Show phonetic Information
+        /// </summary>
+        public bool Phonetic 
+        {
+            get
+            {
+                var r = (RowInternal)_worksheet._values.GetValue(Row, 0);
+                if (r == null)
+                {
+                    return false;
+                }
+                else
+                {
+                    return r.Phonetic;
+                }
+            }
+            set
+            {
+                var r = GetRowInternal();
+                r.Phonetic = value;
+            }
+        }
+        /// <summary>
+        /// The Style applied to the whole row. Only effekt cells with no individual style set. 
+        /// Use ExcelRange object if you want to set specific styles.
+        /// </summary>
+        public ExcelStyle Style
+        {
+            get
+            {
+                return _worksheet.Workbook.Styles.GetStyleObject(StyleID,_worksheet.PositionID ,Row.ToString()+":"+Row.ToString());                
+            }
+        }
+        /// <summary>
+        /// Adds a manual page break after the row.
+        /// </summary>
+        public bool PageBreak
+        {
+            get
+            {
+                var r = (RowInternal)_worksheet._values.GetValue(Row, 0);
+                if (r == null)
+                {
+                    return false;
+                }
+                else
+                {
+                    return r.PageBreak;
+                }
+            }
+            set
+            {
+                var r = GetRowInternal();
+                r.PageBreak = value;
+            }
+        }
+        public bool Merged
+        {
+            get
+            {
+                return _worksheet.MergedCells[Row, 0] != null;
+            }
+            set
+            {
+                _worksheet.MergedCells.Add(new ExcelAddressBase(Row, 1, Row, ExcelPackage.MaxColumns), true);
+            }
+        }
+        internal static ulong GetRowID(int sheetID, int row)
+        {
+            return ((ulong)sheetID) + (((ulong)row) << 29);
+
+        }
+        
+        #region IRangeID Members
+
+        [Obsolete]
+        ulong IRangeID.RangeID
+        {
+            get
+            {
+                return RowID; 
+            }
+            set
+            {
+                Row = ((int)(value >> 29));
+            }
+        }
+
+        #endregion
+        /// <summary>
+        /// Copies the current row to a new worksheet
+        /// </summary>
+        /// <param name="added">The worksheet where the copy will be created</param>
+        internal void Clone(ExcelWorksheet added)
+        {
+            ExcelRow newRow = added.Row(Row);
+            newRow.Collapsed = Collapsed;
+            newRow.Height = Height;
+            newRow.Hidden = Hidden;
+            newRow.OutlineLevel = OutlineLevel;
+            newRow.PageBreak = PageBreak;
+            newRow.Phonetic = Phonetic;
+            newRow._styleName = _styleName;
+            newRow.StyleID = StyleID;
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelSheetProtection.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelSheetProtection.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelSheetProtection.cs	(revision 12707)
@@ -0,0 +1,333 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		    Initial Release		        2010-03-14
+ * Jan Källman		    License changed GPL-->LGPL 2011-12-27
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Xml;
+using System.Security.Cryptography;
+using OfficeOpenXml.Utils;
+using OfficeOpenXml.Encryption;
+
+namespace OfficeOpenXml
+{
+    /// <summary>
+    /// Sheet protection
+    ///<seealso cref="ExcelEncryption"/> 
+    ///<seealso cref="ExcelProtection"/> 
+    /// </summary>
+    public sealed class ExcelSheetProtection : XmlHelper
+    {
+        internal ExcelSheetProtection (XmlNamespaceManager nsm, XmlNode topNode,ExcelWorksheet ws) :
+            base(nsm, topNode)
+        {
+            SchemaNodeOrder = ws.SchemaNodeOrder;
+        }        
+        private const string _isProtectedPath="d:sheetProtection/@sheet";
+        /// <summary>
+        /// If the worksheet is protected.
+        /// </summary>
+        public bool IsProtected
+        {
+            get
+            {
+                return GetXmlNodeBool(_isProtectedPath, false);
+            }
+            set
+            {
+                SetXmlNodeBool(_isProtectedPath, value, false);
+                if (value)
+                {
+                    AllowEditObject = true;
+                    AllowEditScenarios = true;
+                }
+                else
+                {
+                    DeleteAllNode(_isProtectedPath); //delete the whole sheetprotection node
+                }
+            }
+        }
+        private const string _allowSelectLockedCellsPath = "d:sheetProtection/@selectLockedCells";
+        /// <summary>
+        /// Allow users to select locked cells
+        /// </summary>
+        public bool AllowSelectLockedCells
+        {
+            get
+            {
+                return !GetXmlNodeBool(_allowSelectLockedCellsPath, false);
+            }
+            set
+            {
+                SetXmlNodeBool(_allowSelectLockedCellsPath, !value, false);
+            }
+        }
+        private const string _allowSelectUnlockedCellsPath = "d:sheetProtection/@selectUnlockedCells";
+        /// <summary>
+        /// Allow users to select unlocked cells
+        /// </summary>
+        public bool AllowSelectUnlockedCells
+        {
+            get
+            {
+                return !GetXmlNodeBool(_allowSelectUnlockedCellsPath, false);
+            }
+            set
+            {
+                SetXmlNodeBool(_allowSelectUnlockedCellsPath, !value, false);
+            }
+        }        
+        private const string _allowObjectPath="d:sheetProtection/@objects";
+        /// <summary>
+        /// Allow users to edit objects
+        /// </summary>
+        public bool AllowEditObject
+        {
+            get
+            {
+                return !GetXmlNodeBool(_allowObjectPath, false);
+            }
+            set
+            {
+                SetXmlNodeBool(_allowObjectPath, !value, false);
+            }
+        }
+        private const string _allowScenariosPath="d:sheetProtection/@scenarios";
+        /// <summary>
+        /// Allow users to edit senarios
+        /// </summary>
+        public bool AllowEditScenarios
+        {
+            get
+            {
+                return !GetXmlNodeBool(_allowScenariosPath, false);
+            }
+            set
+            {
+                SetXmlNodeBool(_allowScenariosPath, !value, false);
+            }
+        }
+        private const string _allowFormatCellsPath="d:sheetProtection/@formatCells";
+        /// <summary>
+        /// Allow users to format cells
+        /// </summary>
+        public bool AllowFormatCells 
+        {
+            get
+            {
+                return !GetXmlNodeBool(_allowFormatCellsPath, true);
+            }
+            set
+            {
+                SetXmlNodeBool(_allowFormatCellsPath, !value, true );
+            }
+        }
+        private const string _allowFormatColumnsPath = "d:sheetProtection/@formatColumns";
+        /// <summary>
+        /// Allow users to Format columns
+        /// </summary>
+        public bool AllowFormatColumns
+        {
+            get
+            {
+                return !GetXmlNodeBool(_allowFormatColumnsPath, true);
+            }
+            set
+            {
+                SetXmlNodeBool(_allowFormatColumnsPath, !value, true);
+            }
+        }
+        private const string _allowFormatRowsPath = "d:sheetProtection/@formatRows";
+        /// <summary>
+        /// Allow users to Format rows
+        /// </summary>
+        public bool AllowFormatRows
+        {
+            get
+            {
+                return !GetXmlNodeBool(_allowFormatRowsPath, true);
+            }
+            set
+            {
+                SetXmlNodeBool(_allowFormatRowsPath, !value, true);
+            }
+        }
+
+        private const string _allowInsertColumnsPath = "d:sheetProtection/@insertColumns";
+        /// <summary>
+        /// Allow users to insert columns
+        /// </summary>
+        public bool AllowInsertColumns
+        {
+            get
+            {
+                return !GetXmlNodeBool(_allowInsertColumnsPath, true);
+            }
+            set
+            {
+                SetXmlNodeBool(_allowInsertColumnsPath, !value, true);
+            }
+        }
+
+        private const string _allowInsertRowsPath = "d:sheetProtection/@insertRows";
+        /// <summary>
+        /// Allow users to Format rows
+        /// </summary>
+        public bool AllowInsertRows
+        {
+            get
+            {
+                return !GetXmlNodeBool(_allowInsertRowsPath, true);
+            }
+            set
+            {
+                SetXmlNodeBool(_allowInsertRowsPath, !value, true);
+            }
+        }
+        private const string _allowInsertHyperlinksPath = "d:sheetProtection/@insertHyperlinks";
+        /// <summary>
+        /// Allow users to insert hyperlinks
+        /// </summary>
+        public bool AllowInsertHyperlinks
+        {
+            get
+            {
+                return !GetXmlNodeBool(_allowInsertHyperlinksPath, true);
+            }
+            set
+            {
+                SetXmlNodeBool(_allowInsertHyperlinksPath, !value, true);
+            }
+        }
+        private const string _allowDeleteColumns = "d:sheetProtection/@deleteColumns";
+        /// <summary>
+        /// Allow users to delete columns
+        /// </summary>
+        public bool AllowDeleteColumns
+        {
+            get
+            {
+                return !GetXmlNodeBool(_allowDeleteColumns, true);
+            }
+            set
+            {
+                SetXmlNodeBool(_allowDeleteColumns, !value, true);
+            }
+        }
+        private const string _allowDeleteRowsPath = "d:sheetProtection/@deleteRows";
+        /// <summary>
+        /// Allow users to delete rows
+        /// </summary>
+        public bool AllowDeleteRows
+        {
+            get
+            {
+                return !GetXmlNodeBool(_allowDeleteRowsPath, true);
+            }
+            set
+            {
+                SetXmlNodeBool(_allowDeleteRowsPath, !value, true);
+            }
+        }
+
+        private const string _allowSortPath = "d:sheetProtection/@sort";
+        /// <summary>
+        /// Allow users to sort a range
+        /// </summary>
+        public bool AllowSort
+        {
+            get
+            {
+                return !GetXmlNodeBool(_allowSortPath, true);
+            }
+            set
+            {
+                SetXmlNodeBool(_allowSortPath, !value, true);
+            }
+        }
+
+        private const string _allowAutoFilterPath = "d:sheetProtection/@autoFilter";
+        /// <summary>
+        /// Allow users to use autofilters
+        /// </summary>
+        public bool AllowAutoFilter
+        {
+            get
+            {
+                return !GetXmlNodeBool(_allowAutoFilterPath, true);
+            }
+            set
+            {
+                SetXmlNodeBool(_allowAutoFilterPath, !value, true);
+            }
+        }
+        private const string _allowPivotTablesPath = "d:sheetProtection/@pivotTables";
+        /// <summary>
+        /// Allow users to use pivottables
+        /// </summary>
+        public bool AllowPivotTables
+        {
+            get
+            {
+                return !GetXmlNodeBool(_allowPivotTablesPath, true);
+            }
+            set
+            {
+                SetXmlNodeBool(_allowPivotTablesPath, !value, true);
+            }
+        }
+
+        private const string _passwordPath = "d:sheetProtection/@password";
+        /// <summary>
+        /// Sets a password for the sheet.
+        /// </summary>
+        /// <param name="Password"></param>
+        public void SetPassword(string Password)
+        {
+            if (IsProtected == false) IsProtected = true;
+
+            Password = Password.Trim();
+            if (Password == "")
+            {
+                var node = TopNode.SelectSingleNode(_passwordPath, NameSpaceManager);
+                if (node != null)
+                {
+                    (node as XmlAttribute).OwnerElement.Attributes.Remove(node as XmlAttribute);
+                }
+                return;
+            }
+
+            int hash = EncryptedPackageHandler.CalculatePasswordHash(Password);
+            SetXmlNodeString(_passwordPath, ((int)hash).ToString("x"));
+        }
+
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelStyleCollection.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelStyleCollection.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelStyleCollection.cs	(revision 12707)
@@ -0,0 +1,144 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		    Initial Release		        2009-10-01
+ * Jan Källman		    License changed GPL-->LGPL 2011-12-27
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Text;
+using System.Xml;
+using System.Linq;
+namespace OfficeOpenXml
+{
+    /// <summary>
+    /// Base collection class for styles.
+    /// </summary>
+    /// <typeparam name="T">The style type</typeparam>
+    public class ExcelStyleCollection<T> : IEnumerable<T>
+    {
+        public ExcelStyleCollection()
+        {
+            _setNextIdManual = false;
+        }
+        bool _setNextIdManual;
+        public ExcelStyleCollection(bool SetNextIdManual)
+        {
+            _setNextIdManual = SetNextIdManual;
+        }
+        public XmlNode TopNode { get; set; }
+        internal List<T> _list = new List<T>();
+        Dictionary<string, int> _dic = new Dictionary<string, int>(StringComparer.InvariantCultureIgnoreCase);
+        internal int NextId=0;
+        #region IEnumerable<T> Members
+
+        public IEnumerator<T> GetEnumerator()
+        {
+            return _list.GetEnumerator();
+        }
+
+        #endregion
+        #region IEnumerable Members
+
+        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
+        {
+            return _list.GetEnumerator();
+        }
+        #endregion
+        public T this[int PositionID]
+        {
+            get
+            {
+                return _list[PositionID];
+            }
+        }
+        public int Count
+        {
+            get
+            {
+                return _list.Count;
+            }
+        }
+        //internal int Add(T item)
+        //{
+        //    _list.Add(item);
+        //    if (_setNextIdManual) NextId++;
+        //    return _list.Count-1;
+        //}
+        internal int Add(string key, T item)
+        {
+            _list.Add(item);
+            if (!_dic.ContainsKey(key.ToLower(CultureInfo.InvariantCulture))) _dic.Add(key.ToLower(CultureInfo.InvariantCulture), _list.Count - 1);
+            if (_setNextIdManual) NextId++;
+            return _list.Count-1;
+        }
+        /// <summary>
+        /// Finds the key 
+        /// </summary>
+        /// <param name="key">the key to be found</param>
+        /// <param name="obj">The found object.</param>
+        /// <returns>True if found</returns>
+        internal bool FindByID(string key, ref T obj)
+        {
+            if (_dic.ContainsKey(key))
+            {
+                obj = _list[_dic[key.ToLower(CultureInfo.InvariantCulture)]];
+                return true;
+            }
+            else
+            {
+                return false;
+            }
+        }
+        /// <summary>
+        /// Find Index
+        /// </summary>
+        /// <param name="key"></param>
+        /// <returns></returns>
+        internal int FindIndexByID(string key)
+        {
+            if (_dic.ContainsKey(key))
+            {
+                return _dic[key];
+            }
+            else
+            {
+                return int.MinValue;
+            }
+        }
+        internal bool ExistsKey(string key)
+        {
+            return _dic.ContainsKey(key);
+        }
+        internal void Sort(Comparison<T> c)
+        {
+            _list.Sort(c);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelStyles.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelStyles.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelStyles.cs	(revision 12707)
@@ -0,0 +1,985 @@
+/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		    Initial Release		        2009-10-01
+ * Jan Källman		    License changed GPL-->LGPL 2011-12-27
+ *******************************************************************************/
+using System;
+using System.Xml;
+using System.Linq;
+using System.Collections.Generic;
+using OfficeOpenXml.FormulaParsing.Excel.Functions.Logical;
+using draw=System.Drawing;
+using OfficeOpenXml.Style;
+using OfficeOpenXml.Style.XmlAccess;
+using OfficeOpenXml.Style.Dxf;
+using OfficeOpenXml.ConditionalFormatting;
+namespace OfficeOpenXml
+{
+	/// <summary>
+	/// Containts all shared cell styles for a workbook
+	/// </summary>
+    public sealed class ExcelStyles : XmlHelper
+    {
+        const string NumberFormatsPath = "d:styleSheet/d:numFmts";
+        const string FontsPath = "d:styleSheet/d:fonts";
+        const string FillsPath = "d:styleSheet/d:fills";
+        const string BordersPath = "d:styleSheet/d:borders";
+        const string CellStyleXfsPath = "d:styleSheet/d:cellStyleXfs";
+        const string CellXfsPath = "d:styleSheet/d:cellXfs";
+        const string CellStylesPath = "d:styleSheet/d:cellStyles";
+        const string dxfsPath = "d:styleSheet/d:dxfs";
+
+        //internal Dictionary<int, ExcelXfs> Styles = new Dictionary<int, ExcelXfs>();
+        XmlDocument _styleXml;
+        ExcelWorkbook _wb;
+        XmlNamespaceManager _nameSpaceManager;
+        internal int _nextDfxNumFmtID = 164;
+        internal ExcelStyles(XmlNamespaceManager NameSpaceManager, XmlDocument xml, ExcelWorkbook wb) :
+            base(NameSpaceManager, xml)
+        {       
+            _styleXml=xml;
+            _wb = wb;
+            _nameSpaceManager = NameSpaceManager;
+            SchemaNodeOrder = new string[] { "numFmts", "fonts", "fills", "borders", "cellStyleXfs", "cellXfs", "cellStyles", "dxfs" };
+            LoadFromDocument();
+        }
+        /// <summary>
+        /// Loads the style XML to memory
+        /// </summary>
+        private void LoadFromDocument()
+        {
+            //NumberFormats
+            ExcelNumberFormatXml.AddBuildIn(NameSpaceManager, NumberFormats);
+            XmlNode numNode = _styleXml.SelectSingleNode(NumberFormatsPath, _nameSpaceManager);
+            if (numNode != null)
+            {
+                foreach (XmlNode n in numNode)
+                {
+                    ExcelNumberFormatXml nf = new ExcelNumberFormatXml(_nameSpaceManager, n);
+                    NumberFormats.Add(nf.Id, nf);
+                    if (nf.NumFmtId >= NumberFormats.NextId) NumberFormats.NextId=nf.NumFmtId+1;
+                }
+            }
+
+            //Fonts
+            XmlNode fontNode = _styleXml.SelectSingleNode(FontsPath, _nameSpaceManager);
+            foreach (XmlNode n in fontNode)
+            {
+                ExcelFontXml f = new ExcelFontXml(_nameSpaceManager, n);
+                Fonts.Add(f.Id, f);
+            }
+
+            //Fills
+            XmlNode fillNode = _styleXml.SelectSingleNode(FillsPath, _nameSpaceManager);
+            foreach (XmlNode n in fillNode)
+            {
+                ExcelFillXml f;
+                if (n.FirstChild != null && n.FirstChild.LocalName == "gradientFill")
+                {
+                    f = new ExcelGradientFillXml(_nameSpaceManager, n);
+                }
+                else
+                {
+                    f = new ExcelFillXml(_nameSpaceManager, n);
+                }
+                Fills.Add(f.Id, f);
+            }
+
+            //Borders
+            XmlNode borderNode = _styleXml.SelectSingleNode(BordersPath, _nameSpaceManager);
+            foreach (XmlNode n in borderNode)
+            {
+                ExcelBorderXml b = new ExcelBorderXml(_nameSpaceManager, n);
+                Borders.Add(b.Id, b);
+            }
+
+            //cellStyleXfs
+            XmlNode styleXfsNode = _styleXml.SelectSingleNode(CellStyleXfsPath, _nameSpaceManager);
+            if (styleXfsNode != null)
+            {
+                foreach (XmlNode n in styleXfsNode)
+                {
+                    ExcelXfs item = new ExcelXfs(_nameSpaceManager, n, this);
+                    CellStyleXfs.Add(item.Id, item);
+                }
+            }
+
+            XmlNode styleNode = _styleXml.SelectSingleNode(CellXfsPath, _nameSpaceManager);
+            for (int i = 0; i < styleNode.ChildNodes.Count; i++)
+            {
+                XmlNode n = styleNode.ChildNodes[i];
+                ExcelXfs item = new ExcelXfs(_nameSpaceManager, n, this);
+                CellXfs.Add(item.Id, item);
+            }
+
+            //cellStyle
+            XmlNode namedStyleNode = _styleXml.SelectSingleNode(CellStylesPath, _nameSpaceManager);
+            if (namedStyleNode != null)
+            {
+                foreach (XmlNode n in namedStyleNode)
+                {
+                    ExcelNamedStyleXml item = new ExcelNamedStyleXml(_nameSpaceManager, n, this);
+                    NamedStyles.Add(item.Name, item);
+                }
+            }
+
+            //dxfsPath
+            XmlNode dxfsNode = _styleXml.SelectSingleNode(dxfsPath, _nameSpaceManager);
+            if (dxfsNode != null)
+            {
+                foreach (XmlNode x in dxfsNode)
+                {
+                    ExcelDxfStyleConditionalFormatting item = new ExcelDxfStyleConditionalFormatting(_nameSpaceManager, x, this);
+                    Dxfs.Add(item.Id, item);
+                }
+            }
+        }
+        internal ExcelStyle GetStyleObject(int Id,int PositionID, string Address)
+        {
+            if (Id < 0) Id = 0;
+            return new ExcelStyle(this, PropertyChange, PositionID, Address, Id);
+        }
+        /// <summary>
+        /// Handels changes of properties on the style objects
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        /// <returns></returns>
+        internal int PropertyChange(StyleBase sender, Style.StyleChangeEventArgs e)
+        {
+            var address = new ExcelAddressBase(e.Address);
+            var ws = _wb.Worksheets[e.PositionID];
+            Dictionary<int, int> styleCashe = new Dictionary<int, int>();
+            //Set single address
+            lock (ws._styles)
+            {
+                SetStyleAddress(sender, e, address, ws, ref styleCashe);
+                if (address.Addresses != null)
+                {
+                    //Handle multiaddresses
+                    foreach (var innerAddress in address.Addresses)
+                    {
+                        SetStyleAddress(sender, e, innerAddress, ws, ref styleCashe);
+                    }
+                }
+            }
+            return 0;
+        }
+
+        private void SetStyleAddress(StyleBase sender, Style.StyleChangeEventArgs e, ExcelAddressBase address, ExcelWorksheet ws, ref Dictionary<int, int> styleCashe)
+        {
+            if (address.Start.Column == 0 || address.Start.Row == 0)
+            {
+                throw (new Exception("error address"));
+            }
+            //Columns
+            else if (address.Start.Row == 1 && address.End.Row == ExcelPackage.MaxRows)
+            {
+                ExcelColumn column;
+                int col = address.Start.Column, row = 0;
+                //Get the startcolumn
+                //ulong colID = ExcelColumn.GetColumnID(ws.SheetID, address.Start.Column);
+                if (!ws._values.Exists(0, address.Start.Column))
+                {
+                    column = ws.Column(address.Start.Column);
+                }
+                else
+                {
+                    column = ws._values.GetValue(0, address.Start.Column) as ExcelColumn;
+                }
+
+
+                //var index = ws._columns.IndexOf(colID);
+                while (column.ColumnMin <= address.End.Column)
+                {
+                    if (column.ColumnMax > address.End.Column)
+                    {
+                        var newCol = ws.CopyColumn(column, address.End.Column + 1, column.ColumnMax);
+                        column.ColumnMax = address.End.Column;
+                    }
+                    var s = ws._styles.GetValue(0, column.ColumnMin);
+                    if (styleCashe.ContainsKey(s))
+                    {
+                        //column.StyleID = styleCashe[s];
+                        ws._styles.SetValue(0, column.ColumnMin, styleCashe[s]);
+                        ws.SetStyle(0, column.ColumnMin, styleCashe[s]);
+                    }
+                    else
+                    {
+                        ExcelXfs st = CellXfs[s];
+                        int newId = st.GetNewID(CellXfs, sender, e.StyleClass, e.StyleProperty, e.Value);
+                        styleCashe.Add(s, newId);
+                        //column.StyleID = newId;
+                        ws.SetStyle(0, column.ColumnMin, newId);
+                    }
+
+                    //index++;
+
+                    if (!ws._values.NextCell(ref row, ref col) || row > 0)
+                    {
+                        column._columnMax = address.End.Column;
+                        break;
+                    }
+                    else
+                    {
+                        column = (ws._values.GetValue(0, col) as ExcelColumn);
+                    }
+                }
+
+                if (column._columnMax < address.End.Column)
+                {
+                    var newCol = ws.Column(column._columnMax + 1) as ExcelColumn;
+                    newCol._columnMax = address.End.Column;
+
+                    var s = ws._styles.GetValue(0, column.ColumnMin);
+                    if (styleCashe.ContainsKey(s))
+                    {
+                        //newCol.StyleID = styleCashe[s];
+                        //ws._styles.SetValue(0, column.ColumnMin, styleCashe[s]);
+                        ws.SetStyle(0, column.ColumnMin, styleCashe[s]);
+                    }
+                    else
+                    {
+                        ExcelXfs st = CellXfs[s];
+                        int newId = st.GetNewID(CellXfs, sender, e.StyleClass, e.StyleProperty, e.Value);
+                        styleCashe.Add(s, newId);
+                        //newCol.StyleID = newId;
+                        ws.SetStyle(0, column.ColumnMin, newId);
+                    }
+
+                    column._columnMax = address.End.Column;
+                }
+
+                //Set for individual cells in the span. We loop all cells here since the cells are sorted with columns first.
+                var cse = new CellsStoreEnumerator<int>(ws._styles, address._fromRow, address._fromCol, address._toRow, address._toCol);
+                while (cse.Next())
+                {
+                    if (cse.Column >= address.Start.Column &&
+                        cse.Column <= address.End.Column)
+                    {
+                        if (styleCashe.ContainsKey(cse.Value))
+                        {
+                            ws.SetStyle(cse.Row, cse.Column, styleCashe[cse.Value]);
+                        }
+                        else
+                        {
+                            ExcelXfs st = CellXfs[cse.Value];
+                            int newId = st.GetNewID(CellXfs, sender, e.StyleClass, e.StyleProperty, e.Value);
+                            styleCashe.Add(cse.Value, newId);
+                            //cse.Value = newId;
+                            ws.SetStyle(cse.Row, cse.Column, newId);
+                        }
+                    }
+                }
+            }
+            //Rows
+            else if (address.Start.Column == 1 && address.End.Column == ExcelPackage.MaxColumns)
+            {
+                for (int rowNum = address.Start.Row; rowNum <= address.End.Row; rowNum++)
+                {
+                    //ExcelRow row = ws.Row(rowNum);
+                    var s = ws._styles.GetValue(rowNum, 0);
+                    if (s == 0)
+                    {
+                        //iteratte all columns and set the row to the style of the last column
+                        var cse = new CellsStoreEnumerator<int>(ws._styles, 0, 1, 0, ExcelPackage.MaxColumns);
+                        while (cse.Next())
+                        {
+                            s = cse.Value;
+                            var c = ws._values.GetValue(cse.Row, cse.Column) as ExcelColumn;
+                            if (c != null && c.ColumnMax < ExcelPackage.MaxColumns)
+                            {
+                                for (int col = c.ColumnMin; col < c.ColumnMax; col++)
+                                {
+                                    if (!ws._styles.Exists(rowNum, col))
+                                    {
+                                        ws._styles.SetValue(rowNum, col, s);
+                                    }
+                                }
+                            }
+                        }
+                        ws.SetStyle(rowNum, 0, s);
+                        cse.Dispose();
+                    }
+                    if (styleCashe.ContainsKey(s))
+                    {
+                        ws.SetStyle(rowNum, 0, styleCashe[s]);
+                        //row.StyleID = styleCashe[s];
+                    }
+                    else
+                    {
+                        ExcelXfs st = CellXfs[s];
+                        int newId = st.GetNewID(CellXfs, sender, e.StyleClass, e.StyleProperty, e.Value);
+                        styleCashe.Add(s, newId);
+                        ws._styles.SetValue(rowNum, 0, newId);
+                        ws.SetStyle(rowNum, 0, newId);
+                    }
+                }
+
+                //Get Start Cell
+                //ulong rowID = ExcelRow.GetRowID(ws.SheetID, address.Start.Row);
+                //int index = ws._cells.IndexOf(rowID);
+
+                //index = ~index;
+                var cse2 = new CellsStoreEnumerator<int>(ws._styles, address._fromRow, address._fromCol, address._toRow, address._toCol);
+                //while (index < ws._cells.Count)
+                while (cse2.Next())
+                {
+                    //var cell = ws._cells[index] as ExcelCell;
+                    //if(cell.Row > address.End.Row)
+                    //{
+                    //    break;
+                    //}
+                    var s = cse2.Value;
+                    if (styleCashe.ContainsKey(s))
+                    {
+                        ws.SetStyle(cse2.Row, cse2.Column, styleCashe[s]);
+                    }
+                    else
+                    {
+                        ExcelXfs st = CellXfs[s];
+                        int newId = st.GetNewID(CellXfs, sender, e.StyleClass, e.StyleProperty, e.Value);
+                        styleCashe.Add(s, newId);
+                        cse2.Value = newId;
+                        ws.SetStyle(cse2.Row, cse2.Column, newId);
+                    }
+                }
+            }
+            else             //Cellrange
+            {
+                //var cse = new CellsStoreEnumerator<int>(ws._styles, address._fromRow, address._fromCol, address._toRow, address._toCol);
+                //while(cse.Next())
+                for (int col = address.Start.Column; col <= address.End.Column; col++)
+                {
+                    for (int row = address.Start.Row; row <= address.End.Row; row++)
+                    {
+                        //ExcelCell cell = ws.Cell(row, col);
+                        //int s = ws._styles.GetValue(row, col);
+                        var s = GetStyleId(ws, row, col);
+                        if (styleCashe.ContainsKey(s))
+                        {
+                            ws.SetStyle(row, col, styleCashe[s]);
+                        }
+                        else
+                        {
+                            ExcelXfs st = CellXfs[s];
+                            int newId = st.GetNewID(CellXfs, sender, e.StyleClass, e.StyleProperty, e.Value);
+                            styleCashe.Add(s, newId);
+                            ws.SetStyle(row, col, newId);
+                        }
+                    }
+                }
+            }
+        }
+
+        internal int GetStyleId(ExcelWorksheet ws, int row, int col)
+        {
+            int v=0;
+            if (ws._styles.Exists(row, col, ref v))
+            {
+                return v;
+            }
+            else
+            {
+                if (ws._styles.Exists(row, 0, ref v)) //First Row
+                {
+                    return v;
+                }
+                else // then column
+                {
+                    if (ws._styles.Exists(0, col, ref v))
+                    {
+                        return v; 
+                    }
+                    else 
+                    {
+                        int r=0,c=col;
+                        if(ws._values.PrevCell(ref r,ref c))
+                        {
+                            var column=ws._values.GetValue(0,c) as ExcelColumn;
+                            if (column != null && column.ColumnMax >= col) //Fixes issue 15174
+                            {
+                                return ws._styles.GetValue(0, c);
+                            }
+                            else
+                            {
+                                return 0;
+                            }
+                        }
+                        else
+                        {
+                            return 0;
+                        }
+                    }
+                        
+                }
+            }
+            
+        }
+        /// <summary>
+        /// Handles property changes on Named styles.
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        /// <returns></returns>
+        internal int NamedStylePropertyChange(StyleBase sender, Style.StyleChangeEventArgs e)
+        {
+
+            int index = NamedStyles.FindIndexByID(e.Address);
+            if (index >= 0)
+            {
+                int newId = CellStyleXfs[NamedStyles[index].StyleXfId].GetNewID(CellStyleXfs, sender, e.StyleClass, e.StyleProperty, e.Value);
+                int prevIx=NamedStyles[index].StyleXfId;
+                NamedStyles[index].StyleXfId = newId;
+                NamedStyles[index].Style.Index = newId;
+
+                NamedStyles[index].XfId = int.MinValue;
+                foreach (var style in CellXfs)
+                {
+                    if (style.XfId == prevIx)
+                    {
+                        style.XfId = newId;
+                    }
+                }
+            }
+            return 0;
+        }
+        public ExcelStyleCollection<ExcelNumberFormatXml> NumberFormats = new ExcelStyleCollection<ExcelNumberFormatXml>();
+        public ExcelStyleCollection<ExcelFontXml> Fonts = new ExcelStyleCollection<ExcelFontXml>();
+        public ExcelStyleCollection<ExcelFillXml> Fills = new ExcelStyleCollection<ExcelFillXml>();
+        public ExcelStyleCollection<ExcelBorderXml> Borders = new ExcelStyleCollection<ExcelBorderXml>();
+        public ExcelStyleCollection<ExcelXfs> CellStyleXfs = new ExcelStyleCollection<ExcelXfs>();
+        public ExcelStyleCollection<ExcelXfs> CellXfs = new ExcelStyleCollection<ExcelXfs>();
+        public ExcelStyleCollection<ExcelNamedStyleXml> NamedStyles = new ExcelStyleCollection<ExcelNamedStyleXml>();
+        public ExcelStyleCollection<ExcelDxfStyleConditionalFormatting> Dxfs = new ExcelStyleCollection<ExcelDxfStyleConditionalFormatting>();
+        
+        internal string Id
+        {
+            get { return ""; }
+        }
+
+        public ExcelNamedStyleXml CreateNamedStyle(string name)
+        {
+            return CreateNamedStyle(name, null);
+        }
+        public ExcelNamedStyleXml CreateNamedStyle(string name, ExcelStyle Template)
+        {
+            if (_wb.Styles.NamedStyles.ExistsKey(name))
+            {
+                throw new Exception(string.Format("Key {0} already exists in collection", name));
+            }
+
+            ExcelNamedStyleXml style;
+            style = new ExcelNamedStyleXml(NameSpaceManager, this);
+            int xfIdCopy, positionID;
+            ExcelStyles styles;
+            if (Template == null)
+            {
+//                style.Style = new ExcelStyle(this, NamedStylePropertyChange, -1, name, 0);
+                xfIdCopy = 0;
+                positionID = -1;
+                styles = this;
+            }
+            else
+            {
+                if (Template.PositionID < 0 && Template.Styles==this)
+                {
+                    xfIdCopy = Template.Index;
+                    positionID=Template.PositionID;
+                    styles = this;
+                    //style.Style = new ExcelStyle(this, NamedStylePropertyChange, Template.PositionID, name, Template.Index);
+                    //style.StyleXfId = Template.Index;
+                }
+                else
+                {
+                    xfIdCopy = Template.XfId;
+                    positionID = -1;
+                    styles = Template.Styles;
+                }
+            }
+            //Clone namedstyle
+            int styleXfId = CloneStyle(styles, xfIdCopy, true);
+            //Close cells style
+            CellStyleXfs[styleXfId].XfId = CellStyleXfs.Count-1;
+            int xfid = CloneStyle(styles, xfIdCopy, false, true); //Always add a new style (We create a new named style here)
+            CellXfs[xfid].XfId = styleXfId;
+            style.Style = new ExcelStyle(this, NamedStylePropertyChange, positionID, name, styleXfId);
+            style.StyleXfId = styleXfId;
+            
+            style.Name = name;
+            int ix =_wb.Styles.NamedStyles.Add(style.Name, style);
+            style.Style.SetIndex(ix);
+            //style.Style.XfId = ix;
+            return style;
+        }
+        public void UpdateXml()
+        {
+            RemoveUnusedStyles();
+
+            //NumberFormat
+            XmlNode nfNode=_styleXml.SelectSingleNode(NumberFormatsPath, _nameSpaceManager);
+            if (nfNode == null)
+            {
+                CreateNode(NumberFormatsPath, true);
+                nfNode = _styleXml.SelectSingleNode(NumberFormatsPath, _nameSpaceManager);
+            }
+            else
+            {
+                nfNode.RemoveAll();                
+            }
+
+            int count = 0;
+            int normalIx = NamedStyles.FindIndexByID("Normal");
+            if (NamedStyles.Count > 0 && normalIx>=0 && NamedStyles[normalIx].Style.Numberformat.NumFmtID >= 164)
+            {
+                ExcelNumberFormatXml nf = NumberFormats[NumberFormats.FindIndexByID(NamedStyles[normalIx].Style.Numberformat.Id)];
+                nfNode.AppendChild(nf.CreateXmlNode(_styleXml.CreateElement("numFmt", ExcelPackage.schemaMain)));
+                nf.newID = count++;
+            }
+            foreach (ExcelNumberFormatXml nf in NumberFormats)
+            {
+                if(!nf.BuildIn /*&& nf.newID<0*/) //Buildin formats are not updated.
+                {
+                    nfNode.AppendChild(nf.CreateXmlNode(_styleXml.CreateElement("numFmt", ExcelPackage.schemaMain)));
+                    nf.newID = count;
+                    count++;
+                }
+            }
+            (nfNode as XmlElement).SetAttribute("count", count.ToString());
+
+            //Font
+            count=0;
+            XmlNode fntNode = _styleXml.SelectSingleNode(FontsPath, _nameSpaceManager);
+            fntNode.RemoveAll();
+
+            //Normal should be first in the collection
+            if (NamedStyles.Count > 0 && normalIx >= 0 && NamedStyles[normalIx].Style.Font.Index > 0)
+            {
+                ExcelFontXml fnt = Fonts[NamedStyles[normalIx].Style.Font.Index];
+                fntNode.AppendChild(fnt.CreateXmlNode(_styleXml.CreateElement("font", ExcelPackage.schemaMain)));
+                fnt.newID = count++;
+            }
+
+            foreach (ExcelFontXml fnt in Fonts)
+            {
+                if (fnt.useCnt > 0/* && fnt.newID<0*/)
+                {
+                    fntNode.AppendChild(fnt.CreateXmlNode(_styleXml.CreateElement("font", ExcelPackage.schemaMain)));
+                    fnt.newID = count;
+                    count++;
+                }
+            }
+            (fntNode as XmlElement).SetAttribute("count", count.ToString());
+
+
+            //Fills
+            count = 0;
+            XmlNode fillsNode = _styleXml.SelectSingleNode(FillsPath, _nameSpaceManager);
+            fillsNode.RemoveAll();
+            Fills[0].useCnt = 1;    //Must exist (none);  
+            Fills[1].useCnt = 1;    //Must exist (gray125);
+            foreach (ExcelFillXml fill in Fills)
+            {
+                if (fill.useCnt > 0)
+                {
+                    fillsNode.AppendChild(fill.CreateXmlNode(_styleXml.CreateElement("fill", ExcelPackage.schemaMain)));
+                    fill.newID = count;
+                    count++;
+                }
+            }
+
+            (fillsNode as XmlElement).SetAttribute("count", count.ToString());
+
+            //Borders
+            count = 0;
+            XmlNode bordersNode = _styleXml.SelectSingleNode(BordersPath, _nameSpaceManager);
+            bordersNode.RemoveAll();
+            Borders[0].useCnt = 1;    //Must exist blank;
+            foreach (ExcelBorderXml border in Borders)
+            {
+                if (border.useCnt > 0)
+                {
+                    bordersNode.AppendChild(border.CreateXmlNode(_styleXml.CreateElement("border", ExcelPackage.schemaMain)));
+                    border.newID = count;
+                    count++;
+                }
+            }
+            (bordersNode as XmlElement).SetAttribute("count", count.ToString());
+
+            XmlNode styleXfsNode = _styleXml.SelectSingleNode(CellStyleXfsPath, _nameSpaceManager);
+            if (styleXfsNode == null && NamedStyles.Count > 0)
+            {
+                CreateNode(CellStyleXfsPath);
+                styleXfsNode = _styleXml.SelectSingleNode(CellStyleXfsPath, _nameSpaceManager);
+            }
+            if (NamedStyles.Count > 0)
+            {
+                styleXfsNode.RemoveAll();
+            }
+            //NamedStyles
+            count = normalIx > -1 ? 1 : 0;  //If we have a normal style, we make sure it's added first.
+
+            XmlNode cellStyleNode = _styleXml.SelectSingleNode(CellStylesPath, _nameSpaceManager);
+            if(cellStyleNode!=null)
+            {
+                cellStyleNode.RemoveAll();
+            }
+            XmlNode cellXfsNode = _styleXml.SelectSingleNode(CellXfsPath, _nameSpaceManager);
+            cellXfsNode.RemoveAll();
+
+            if (NamedStyles.Count > 0 && normalIx >= 0)
+            {
+                NamedStyles[normalIx].newID = 0;
+                AddNamedStyle(0, styleXfsNode, cellXfsNode, NamedStyles[normalIx]);
+            }
+            foreach (ExcelNamedStyleXml style in NamedStyles)
+            {
+                if (!style.Name.Equals("normal", StringComparison.InvariantCultureIgnoreCase))
+                {
+                    AddNamedStyle(count++, styleXfsNode, cellXfsNode, style);
+                }
+                else
+                {
+                    style.newID = 0;
+                }
+                cellStyleNode.AppendChild(style.CreateXmlNode(_styleXml.CreateElement("cellStyle", ExcelPackage.schemaMain)));
+            }
+            if (cellStyleNode!=null) (cellStyleNode as XmlElement).SetAttribute("count", count.ToString());
+            if (styleXfsNode != null) (styleXfsNode as XmlElement).SetAttribute("count", count.ToString());
+
+            //CellStyle
+            int xfix = 0;
+            foreach (ExcelXfs xf in CellXfs)
+            {
+                if (xf.useCnt > 0 && !(normalIx >= 0 && NamedStyles[normalIx].XfId == xfix))
+                {
+                    cellXfsNode.AppendChild(xf.CreateXmlNode(_styleXml.CreateElement("xf", ExcelPackage.schemaMain)));
+                    xf.newID = count;
+                    count++;
+                }
+                xfix++;
+            }
+            (cellXfsNode as XmlElement).SetAttribute("count", count.ToString());
+
+            //Set dxf styling for conditional Formatting
+            XmlNode dxfsNode = _styleXml.SelectSingleNode(dxfsPath, _nameSpaceManager);
+            foreach (var ws in _wb.Worksheets)
+            {
+                if (ws is ExcelChartsheet) continue;
+                foreach (var cf in ws.ConditionalFormatting)
+                {
+                    if (cf.Style.HasValue)
+                    {
+                        int ix = Dxfs.FindIndexByID(cf.Style.Id);
+                        if (ix < 0)
+                        {
+                            ((ExcelConditionalFormattingRule)cf).DxfId = Dxfs.Count;
+                            Dxfs.Add(cf.Style.Id, cf.Style);
+                            var elem = ((XmlDocument)TopNode).CreateElement("d", "dxf", ExcelPackage.schemaMain);
+                            cf.Style.CreateNodes(new XmlHelperInstance(NameSpaceManager, elem), "");
+                            dxfsNode.AppendChild(elem);
+                        }
+                        else
+                        {
+                            ((ExcelConditionalFormattingRule)cf).DxfId = ix;
+                        }
+                    }
+                }
+            }
+            if (dxfsNode != null) (dxfsNode as XmlElement).SetAttribute("count", Dxfs.Count.ToString());
+        }
+
+        private void AddNamedStyle(int id, XmlNode styleXfsNode,XmlNode cellXfsNode, ExcelNamedStyleXml style)
+        {
+            var styleXfs = CellStyleXfs[style.StyleXfId];
+            styleXfsNode.AppendChild(styleXfs.CreateXmlNode(_styleXml.CreateElement("xf", ExcelPackage.schemaMain), true));
+            styleXfs.newID = id;
+            styleXfs.XfId = style.StyleXfId;
+
+            var ix = CellXfs.FindIndexByID(styleXfs.Id);
+            if (ix < 0)
+            {
+                cellXfsNode.AppendChild(styleXfs.CreateXmlNode(_styleXml.CreateElement("xf", ExcelPackage.schemaMain)));
+            }
+            else
+            {
+                if(id<0) CellXfs[ix].XfId = id;
+                cellXfsNode.AppendChild(CellXfs[ix].CreateXmlNode(_styleXml.CreateElement("xf", ExcelPackage.schemaMain)));
+                CellXfs[ix].useCnt = 0;
+                CellXfs[ix].newID = id;
+            }
+
+            if (style.XfId >= 0)
+                style.XfId = CellXfs[style.XfId].newID;
+            else
+                style.XfId = 0;
+        }
+
+        private void RemoveUnusedStyles()
+        {
+            CellXfs[0].useCnt = 1; //First item is allways used.
+            foreach (ExcelWorksheet sheet in _wb.Worksheets)
+            {
+                var cse = new CellsStoreEnumerator<int>(sheet._styles);
+                while(cse.Next())
+                {
+                    var v = cse.Value;
+                    if (v >= 0)
+                    {
+                        CellXfs[v].useCnt++;
+                    }
+                }
+            }
+            foreach (ExcelNamedStyleXml ns in NamedStyles)
+            {
+                CellStyleXfs[ns.StyleXfId].useCnt++;
+            }
+
+            foreach (ExcelXfs xf in CellXfs)
+            {
+                if (xf.useCnt > 0)
+                {
+                    if (xf.FontId >= 0) Fonts[xf.FontId].useCnt++;
+                    if (xf.FillId >= 0) Fills[xf.FillId].useCnt++;
+                    if (xf.BorderId >= 0) Borders[xf.BorderId].useCnt++;
+                }
+            }
+            foreach (ExcelXfs xf in CellStyleXfs)
+            {
+                if (xf.useCnt > 0)
+                {
+                    if (xf.FontId >= 0) Fonts[xf.FontId].useCnt++;
+                    if (xf.FillId >= 0) Fills[xf.FillId].useCnt++;
+                    if (xf.BorderId >= 0) Borders[xf.BorderId].useCnt++;                    
+                }
+            }
+        }
+        internal int GetStyleIdFromName(string Name)
+        {
+            int i = NamedStyles.FindIndexByID(Name);
+            if (i >= 0)
+            {
+                int id = NamedStyles[i].XfId;
+                if (id < 0)
+                {
+                    int styleXfId=NamedStyles[i].StyleXfId;
+                    ExcelXfs newStyle = CellStyleXfs[styleXfId].Copy();
+                    newStyle.XfId = styleXfId;
+                    id = CellXfs.FindIndexByID(newStyle.Id);
+                    if (id < 0)
+                    {
+                        id = CellXfs.Add(newStyle.Id, newStyle);
+                    }
+                    NamedStyles[i].XfId=id;
+                }
+                return id;
+            }
+            else
+            {
+                return 0;
+                //throw(new Exception("Named style does not exist"));        	         
+            }
+        }
+   #region XmlHelpFunctions
+        private int GetXmlNodeInt(XmlNode node)
+        {
+            int i;
+            if (int.TryParse(GetXmlNode(node), out i))
+            {
+                return i;
+            }
+            else
+            {
+                return 0;
+            }
+        }
+        private string GetXmlNode(XmlNode node)
+        {
+            if (node == null)
+            {
+                return "";
+            }
+            if (node.Value != null)
+            {
+                return node.Value;
+            }
+            else
+            {
+                return "";
+            }
+        }
+
+#endregion
+        internal int CloneStyle(ExcelStyles style, int styleID)
+        {
+            return CloneStyle(style, styleID, false, false);
+        }
+        internal int CloneStyle(ExcelStyles style, int styleID, bool isNamedStyle)
+        {
+            return CloneStyle(style, styleID, isNamedStyle, false);
+        }
+        internal int CloneStyle(ExcelStyles style, int styleID, bool isNamedStyle, bool allwaysAdd)
+        {
+            ExcelXfs xfs;
+            lock (style)
+            {
+                if (isNamedStyle)
+                {
+                    xfs = style.CellStyleXfs[styleID];
+                }
+                else
+                {
+                    xfs = style.CellXfs[styleID];
+                }
+                ExcelXfs newXfs = xfs.Copy(this);
+                //Numberformat
+                if (xfs.NumberFormatId > 0)
+                {
+                    //rake36: Two problems here...
+                    //rake36:  1. the first time through when format stays equal to String.Empty, it adds a string.empty to the list of Number Formats
+                    //rake36:  2. when adding a second sheet, if the numberformatid == 164, it finds the 164 added by previous sheets but was using the array index
+                    //rake36:      for the numberformatid
+
+                    string format = string.Empty;
+                    foreach (var fmt in style.NumberFormats)
+                    {
+                        if (fmt.NumFmtId == xfs.NumberFormatId)
+                        {
+                            format = fmt.Format;
+                            break;
+                        }
+                    }
+                    //rake36: Don't add another format if it's blank
+                    if (!String.IsNullOrEmpty(format))
+                    {
+                        int ix = NumberFormats.FindIndexByID(format);
+                        if (ix < 0)
+                        {
+                            var item = new ExcelNumberFormatXml(NameSpaceManager) { Format = format, NumFmtId = NumberFormats.NextId++ };
+                            NumberFormats.Add(format, item);
+                            //rake36: Use the just added format id
+                            newXfs.NumberFormatId = item.NumFmtId;
+                        }
+                        else
+                        {
+                            //rake36: Use the format id defined by the index... not the index itself
+                            newXfs.NumberFormatId = NumberFormats[ix].NumFmtId;
+                        }
+                    }
+                }
+
+                //Font
+                if (xfs.FontId > -1)
+                {
+                    int ix = Fonts.FindIndexByID(xfs.Font.Id);
+                    if (ix < 0)
+                    {
+                        ExcelFontXml item = style.Fonts[xfs.FontId].Copy();
+                        ix = Fonts.Add(xfs.Font.Id, item);
+                    }
+                    newXfs.FontId = ix;
+                }
+
+                //Border
+                if (xfs.BorderId > -1)
+                {
+                    int ix = Borders.FindIndexByID(xfs.Border.Id);
+                    if (ix < 0)
+                    {
+                        ExcelBorderXml item = style.Borders[xfs.BorderId].Copy();
+                        ix = Borders.Add(xfs.Border.Id, item);
+                    }
+                    newXfs.BorderId = ix;
+                }
+
+                //Fill
+                if (xfs.FillId > -1)
+                {
+                    int ix = Fills.FindIndexByID(xfs.Fill.Id);
+                    if (ix < 0)
+                    {
+                        var item = style.Fills[xfs.FillId].Copy();
+                        ix = Fills.Add(xfs.Fill.Id, item);
+                    }
+                    newXfs.FillId = ix;
+                }
+
+                //Named style reference
+                if (xfs.XfId > 0)
+                {
+                    var id = style.CellStyleXfs[xfs.XfId].Id;
+                    var newId = CellStyleXfs.FindIndexByID(id);
+                    if (newId >= 0)
+                    {
+                        newXfs.XfId = newId;
+                    }
+                    else if(style._wb!=_wb && allwaysAdd==false) //Not the same workbook, copy the namedstyle to the workbook or match the id
+                    {
+                        var nsFind = style.NamedStyles.ToDictionary(d => (d.StyleXfId));
+                        if (nsFind.ContainsKey(xfs.XfId))
+                        {
+                            var st = nsFind[xfs.XfId];
+                            if (NamedStyles.ExistsKey(st.Name))
+                            {
+                                newXfs.XfId = NamedStyles.FindIndexByID(st.Name);
+                            }
+                            else
+                            {
+                                var ns = CreateNamedStyle(st.Name, st.Style);
+                                newXfs.XfId = NamedStyles.Count - 1;
+                            }
+                        }
+                    }
+                }
+
+                int index;
+                if (isNamedStyle)
+                {
+                    index = CellStyleXfs.Add(newXfs.Id, newXfs);
+                }
+                else
+                {
+                    if (allwaysAdd)
+                    {
+                        index = CellXfs.Add(newXfs.Id, newXfs);
+                    }
+                    else
+                    {
+                        index = CellXfs.FindIndexByID(newXfs.Id);
+                        if (index < 0)
+                        {
+                            index = CellXfs.Add(newXfs.Id, newXfs);
+                        }
+                    }
+                }
+                return index;
+            }
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelTextFormat.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelTextFormat.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelTextFormat.cs	(revision 12707)
@@ -0,0 +1,131 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		    Initial Release		        2011-01-01
+ * Jan Källman		    License changed GPL-->LGPL 2011-12-27
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Globalization;
+
+namespace OfficeOpenXml
+{
+    /// <summary>
+    /// Discribes a column when reading a text using the ExcelRangeBase.LoadFromText method
+    /// </summary>
+    public enum eDataTypes
+    {
+        /// <summary>
+        /// Let the the import decide.
+        /// </summary>
+        Unknown,
+        /// <summary>
+        /// Always a string.
+        /// </summary>
+        String,
+        /// <summary>
+        /// Try to convert it to a number. If it fails then add it as a string.
+        /// </summary>
+        Number,
+        /// <summary>
+        /// Try to convert it to a date. If it fails then add it as a string.
+        /// </summary>
+        DateTime,
+        /// <summary>
+        /// Try to convert it to a number and divide with 100. 
+        /// Removes any tailing percent sign (%). If it fails then add it as a string.
+        /// </summary>
+        Percent
+    }
+    /// <summary>
+    /// Describes how to split a CSV text. Used by the ExcelRange.LoadFromText method
+    /// </summary>
+    public class ExcelTextFormat
+    {
+        /// <summary>
+        /// Describes how to split a CSV text
+        /// 
+        /// Default values
+        /// <list>
+        /// <listheader><term>Property</term><description>Value</description></listheader>
+        /// <item><term>Delimiter</term><description>,</description></item>
+        /// <item><term>TextQualifier</term><description>None (\0)</description></item>
+        /// <item><term>EOL</term><description>CRLF</description></item>
+        /// <item><term>Culture</term><description>CultureInfo.InvariantCulture</description></item>
+        /// <item><term>DataTypes</term><description>End of line default CRLF</description></item>
+        /// <item><term>SkipLinesBeginning</term><description>0</description></item>
+        /// <item><term>SkipLinesEnd</term><description>0</description></item>
+        /// <item><term>Encoding</term><description>Encoding.ASCII</description></item>
+        /// </list>
+        /// </summary>
+        public ExcelTextFormat()
+        {
+            Delimiter = ',';
+            TextQualifier = '\0';
+            EOL = "\r\n";
+            Culture = CultureInfo.InvariantCulture;
+            DataTypes=null;
+            SkipLinesBeginning = 0;
+            SkipLinesEnd = 0;
+            Encoding=Encoding.ASCII;
+        }
+        /// <summary>
+        /// Delimiter character
+        /// </summary>
+        public char Delimiter { get; set; }
+        /// <summary>
+        /// Text qualifier character 
+        /// </summary>
+        public char TextQualifier {get; set; }
+        /// <summary>
+        /// End of line characters. Default CRLF
+        /// </summary>
+        public string EOL { get; set; }
+        /// <summary>
+        /// Datatypes list for each column (if column is not present Unknown is assumed)
+        /// </summary>
+        public eDataTypes[] DataTypes { get; set; }
+        /// <summary>
+        /// Culture used when parsing. Default CultureInfo.InvariantCulture
+        /// </summary>
+        public CultureInfo Culture {get; set; }
+        /// <summary>
+        /// Number of lines skiped in the begining of the file. Default 0.
+        /// </summary>
+        public int SkipLinesBeginning { get; set; }
+        /// <summary>
+        /// Number of lines skiped at the end of the file. Default 0.
+        /// </summary>
+        public int SkipLinesEnd { get; set; }
+        /// <summary>
+        /// Only used when reading files from disk using a FileInfo object. Default AscII
+        /// </summary>
+        public Encoding Encoding { get; set; }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelWorkbook.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelWorkbook.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelWorkbook.cs	(revision 12707)
@@ -0,0 +1,1088 @@
+/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		    Initial Release		       2011-01-01
+ * Jan Källman		    License changed GPL-->LGPL 2011-12-27
+ * Richard Tallent		Fix escaping of quotes					2012-10-31
+ *******************************************************************************/
+using System;
+using System.Xml;
+using System.IO;
+using System.Collections.Generic;
+using System.Text;
+using System.Security;
+using System.Globalization;
+using System.Text.RegularExpressions;
+using OfficeOpenXml.VBA;
+using System.Drawing;
+using OfficeOpenXml.Utils;
+using System.Windows.Media;
+using System.Windows;
+using Ionic.Zip;
+using OfficeOpenXml.FormulaParsing;
+using OfficeOpenXml.FormulaParsing.Excel.Functions;
+using OfficeOpenXml.FormulaParsing.LexicalAnalysis;
+using OfficeOpenXml.Packaging.Ionic.Zip;
+namespace OfficeOpenXml
+{
+	#region Public Enum ExcelCalcMode
+	/// <summary>
+	/// How the application should calculate formulas in the workbook
+	/// </summary>
+	public enum ExcelCalcMode
+	{
+		/// <summary>
+		/// Indicates that calculations in the workbook are performed automatically when cell values change. 
+		/// The application recalculates those cells that are dependent on other cells that contain changed values. 
+		/// This mode of calculation helps to avoid unnecessary calculations.
+		/// </summary>
+		Automatic,
+		/// <summary>
+		/// Indicates tables be excluded during automatic calculation
+		/// </summary>
+		AutomaticNoTable,
+		/// <summary>
+		/// Indicates that calculations in the workbook be triggered manually by the user. 
+		/// </summary>
+		Manual
+	}
+	#endregion
+
+	/// <summary>
+	/// Represents the Excel workbook and provides access to all the 
+	/// document properties and worksheets within the workbook.
+	/// </summary>
+	public sealed class ExcelWorkbook : XmlHelper, IDisposable
+	{
+		internal class SharedStringItem
+		{
+			internal int pos;
+			internal string Text;
+			internal bool isRichText = false;
+		}
+		#region Private Properties
+		internal ExcelPackage _package;
+		private ExcelWorksheets _worksheets;
+		private OfficeProperties _properties;
+
+		private ExcelStyles _styles;
+		#endregion
+
+		#region ExcelWorkbook Constructor
+		/// <summary>
+		/// Creates a new instance of the ExcelWorkbook class.
+		/// </summary>
+		/// <param name="package">The parent package</param>
+		/// <param name="namespaceManager">NamespaceManager</param>
+		internal ExcelWorkbook(ExcelPackage package, XmlNamespaceManager namespaceManager) :
+			base(namespaceManager)
+		{
+			_package = package;
+			WorkbookUri = new Uri("/xl/workbook.xml", UriKind.Relative);
+			SharedStringsUri = new Uri("/xl/sharedStrings.xml", UriKind.Relative);
+			StylesUri = new Uri("/xl/styles.xml", UriKind.Relative);
+
+			_names = new ExcelNamedRangeCollection(this);
+			_namespaceManager = namespaceManager;
+			TopNode = WorkbookXml.DocumentElement;
+			SchemaNodeOrder = new string[] { "fileVersion", "fileSharing", "workbookPr", "workbookProtection", "bookViews", "sheets", "functionGroups", "functionPrototypes", "externalReferences", "definedNames", "calcPr", "oleSize", "customWorkbookViews", "pivotCaches", "smartTagPr", "smartTagTypes", "webPublishing", "fileRecoveryPr", };
+		    FullCalcOnLoad = true;  //Full calculation on load by default, for both new workbooks and templates.
+			GetSharedStrings();
+		}
+		#endregion
+
+		internal Dictionary<string, SharedStringItem> _sharedStrings = new Dictionary<string, SharedStringItem>(); //Used when reading cells.
+		internal List<SharedStringItem> _sharedStringsList = new List<SharedStringItem>(); //Used when reading cells.
+		internal ExcelNamedRangeCollection _names;
+		internal int _nextDrawingID = 0;
+		internal int _nextTableID = 1;
+		internal int _nextPivotTableID = 1;
+		internal XmlNamespaceManager _namespaceManager;
+        internal FormulaParser _formulaParser = null;
+	    internal FormulaParserManager _parserManager;
+        internal CellStore<List<Token>> _formulaTokens;
+		/// <summary>
+		/// Read shared strings to list
+		/// </summary>
+		private void GetSharedStrings()
+		{
+			if (_package.Package.PartExists(SharedStringsUri))
+			{
+				var xml = _package.GetXmlFromUri(SharedStringsUri);
+				XmlNodeList nl = xml.SelectNodes("//d:sst/d:si", NameSpaceManager);
+				_sharedStringsList = new List<SharedStringItem>();
+				if (nl != null)
+				{
+					foreach (XmlNode node in nl)
+					{
+						XmlNode n = node.SelectSingleNode("d:t", NameSpaceManager);
+						if (n != null)
+						{
+                            _sharedStringsList.Add(new SharedStringItem() { Text = ConvertUtil.ExcelDecodeString(n.InnerText) });
+						}
+						else
+						{
+							_sharedStringsList.Add(new SharedStringItem() { Text = node.InnerXml, isRichText = true });
+						}
+					}
+				}
+                //Delete the shared string part, it will be recreated when the package is saved.
+                foreach (var rel in Part.GetRelationships())
+                {
+                    if (rel.TargetUri.OriginalString.EndsWith("sharedstrings.xml", StringComparison.InvariantCultureIgnoreCase))
+                    {
+                        Part.DeleteRelationship(rel.Id);
+                        break;
+                    }
+                }                
+                _package.Package.DeletePart(SharedStringsUri); //Remove the part, it is recreated when saved.
+			}
+		}
+		internal void GetDefinedNames()
+		{
+			XmlNodeList nl = WorkbookXml.SelectNodes("//d:definedNames/d:definedName", NameSpaceManager);
+			if (nl != null)
+			{
+				foreach (XmlElement elem in nl)
+				{ 
+					string fullAddress = elem.InnerText;
+
+					int localSheetID;
+					ExcelWorksheet nameWorksheet;
+					if(!int.TryParse(elem.GetAttribute("localSheetId"), out localSheetID))
+					{
+						localSheetID = -1;
+						nameWorksheet=null;
+					}
+					else
+					{
+						nameWorksheet=Worksheets[localSheetID + 1];
+					}
+					var addressType = ExcelAddressBase.IsValid(fullAddress);
+					ExcelRangeBase range;
+					ExcelNamedRange namedRange;
+
+					if (fullAddress.IndexOf("[") == 0)
+					{
+						int start = fullAddress.IndexOf("[");
+						int end = fullAddress.IndexOf("]", start);
+						if (start >= 0 && end >= 0)
+						{
+
+							string externalIndex = fullAddress.Substring(start + 1, end - start - 1);
+							int index;
+							if (int.TryParse(externalIndex, out index))
+							{
+								if (index > 0 && index <= _externalReferences.Count)
+								{
+									fullAddress = fullAddress.Substring(0, start) + "[" + _externalReferences[index - 1] + "]" + fullAddress.Substring(end + 1);
+								}
+							}
+						}
+					}
+
+					if (addressType == ExcelAddressBase.AddressType.Invalid || addressType == ExcelAddressBase.AddressType.InternalName || addressType == ExcelAddressBase.AddressType.ExternalName || addressType==ExcelAddressBase.AddressType.Formula || addressType==ExcelAddressBase.AddressType.ExternalAddress)    //A value or a formula
+					{
+						double value;
+						range = new ExcelRangeBase(this, nameWorksheet, elem.GetAttribute("name"), true);
+						if (nameWorksheet == null)
+						{
+							namedRange = _names.Add(elem.GetAttribute("name"), range);
+						}
+						else
+						{
+							namedRange = nameWorksheet.Names.Add(elem.GetAttribute("name"), range);
+						}
+						
+						if (fullAddress.StartsWith("\"")) //String value
+						{
+							namedRange.NameValue = fullAddress.Substring(1,fullAddress.Length-2);
+						}
+						else if (double.TryParse(fullAddress, NumberStyles.Any, CultureInfo.InvariantCulture, out value))
+						{
+							namedRange.NameValue = value;
+						}
+						else
+						{
+                            //if (addressType == ExcelAddressBase.AddressType.ExternalAddress || addressType == ExcelAddressBase.AddressType.ExternalName)
+                            //{
+                            //    var r = new ExcelAddress(fullAddress);
+                            //    namedRange.NameFormula = '\'[' + r._wb
+                            //}
+                            //else
+                            //{
+                                namedRange.NameFormula = fullAddress;
+                            //}
+						}
+					}
+					else
+					{
+						ExcelAddress addr = new ExcelAddress(fullAddress, _package, null);
+						if (localSheetID > -1)
+						{
+							if (string.IsNullOrEmpty(addr._ws))
+							{
+								namedRange = Worksheets[localSheetID + 1].Names.Add(elem.GetAttribute("name"), new ExcelRangeBase(this, Worksheets[localSheetID + 1], fullAddress, false));
+							}
+							else
+							{
+								namedRange = Worksheets[localSheetID + 1].Names.Add(elem.GetAttribute("name"), new ExcelRangeBase(this, Worksheets[addr._ws], fullAddress, false));
+							}
+						}
+						else
+						{
+							var ws = Worksheets[addr._ws];
+							namedRange = _names.Add(elem.GetAttribute("name"), new ExcelRangeBase(this, ws, fullAddress, false));
+						}
+					}
+					if (elem.GetAttribute("hidden") == "1" && namedRange != null) namedRange.IsNameHidden = true;
+					if(!string.IsNullOrEmpty(elem.GetAttribute("comment"))) namedRange.NameComment=elem.GetAttribute("comment");
+				}
+			}
+		}
+		#region Worksheets
+		/// <summary>
+		/// Provides access to all the worksheets in the workbook.
+		/// </summary>
+		public ExcelWorksheets Worksheets
+		{
+			get
+			{
+				if (_worksheets == null)
+				{
+					var sheetsNode = _workbookXml.DocumentElement.SelectSingleNode("d:sheets", _namespaceManager);
+					if (sheetsNode == null)
+					{
+						sheetsNode = CreateNode("d:sheets");
+					}
+					
+					_worksheets = new ExcelWorksheets(_package, _namespaceManager, sheetsNode);
+				}
+				return (_worksheets);
+			}
+		}
+		#endregion
+
+		/// <summary>
+		/// Provides access to named ranges
+		/// </summary>
+		public ExcelNamedRangeCollection Names
+		{
+			get
+			{
+				return _names;
+			}
+		}
+		#region Workbook Properties
+		decimal _standardFontWidth = decimal.MinValue;
+        string _fontID = "";
+        internal FormulaParser FormulaParser
+        {
+            get
+            {
+                if (_formulaParser == null)
+                {
+                    _formulaParser = new FormulaParser(new EpplusExcelDataProvider(_package));
+                }
+                return _formulaParser;
+            }
+        }
+
+	    public FormulaParserManager FormulaParserManager
+	    {
+	        get
+	        {
+	            if (_parserManager == null)
+	            {
+	                _parserManager = new FormulaParserManager(FormulaParser);
+	            }
+	            return _parserManager;
+	        }
+	    }
+
+        /// <summary>
+		/// Max font width for the workbook
+        /// <remarks>This method uses GDI. If you use Asure or another environment that does not support GDI, you have to set this value manually if you don't use the standard Calibri font</remarks>
+		/// </summary>
+		public decimal MaxFontWidth 
+		{
+			get
+			{
+                if (_standardFontWidth == decimal.MinValue || _fontID != Styles.Fonts[0].Id)
+				{
+					var font = Styles.Fonts[0];
+                    try
+                    {
+                        //Font f = new Font(font.Name, font.Size);
+                        _standardFontWidth = 0;
+                        _fontID = font.Id;                        
+                        Typeface tf = new Typeface(new System.Windows.Media.FontFamily(font.Name),
+                                                     (font.Italic) ? FontStyles.Normal : FontStyles.Italic,
+                                                     (font.Bold) ? FontWeights.Bold : FontWeights.Normal,
+                                                     FontStretches.Normal);
+                        for(int i=0;i<10;i++)
+                        {
+                            var ft = new System.Windows.Media.FormattedText("0123456789".Substring(i,1), CultureInfo.InvariantCulture, System.Windows.FlowDirection.LeftToRight, tf, font.Size * (96D / 72D), System.Windows.Media.Brushes.Black);
+                            var width=(int)Math.Round(ft.Width,0);   
+                            if(width>_standardFontWidth)
+                            {
+                                _standardFontWidth = width;
+                            }
+                        }
+                         
+                        //var size = new System.Windows.Size { Width = ft.WidthIncludingTrailingWhitespace, Height = ft.Height };
+
+                        //using (Bitmap b = new Bitmap(1, 1))
+                        //{
+                        //    using (Graphics g = Graphics.FromImage(b))
+                        //    {
+                        //        _standardFontWidth = (decimal)Math.Truncate(g.MeasureString("00", f).Width - g.MeasureString("0", f).Width);
+                        //    }
+                        //}
+                        if (_standardFontWidth <= 0) //No GDI?
+                        {
+                            _standardFontWidth = (int)(font.Size * (2D / 3D)); //Aprox. for Calibri.
+                        }
+                    }
+                    catch   //Error, set default value
+                    {
+                        _standardFontWidth = (int)(font.Size * (2D / 3D)); //Aprox for Calibri.
+                    }
+				}
+				return _standardFontWidth;
+			}
+            set
+            {
+                _standardFontWidth = value;
+            }
+		}
+		ExcelProtection _protection = null;
+		/// <summary>
+		/// Access properties to protect or unprotect a workbook
+		/// </summary>
+		public ExcelProtection Protection
+		{
+			get
+			{
+				if (_protection == null)
+				{
+					_protection = new ExcelProtection(NameSpaceManager, TopNode, this);
+					_protection.SchemaNodeOrder = SchemaNodeOrder;
+				}
+				return _protection;
+			}
+		}        
+		ExcelWorkbookView _view = null;
+		/// <summary>
+		/// Access to workbook view properties
+		/// </summary>
+		public ExcelWorkbookView View
+		{
+			get
+			{
+				if (_view == null)
+				{
+					_view = new ExcelWorkbookView(NameSpaceManager, TopNode, this);
+				}
+				return _view;
+			}
+		}
+        ExcelVbaProject _vba = null;
+        /// <summary>
+        /// A reference to the VBA project.
+        /// Null if no project exists.
+        /// Use Workbook.CreateVBAProject to create a new VBA-Project
+        /// </summary>
+        public ExcelVbaProject VbaProject
+        {
+            get
+            {
+                if (_vba == null)
+                {
+                    if(_package.Package.PartExists(new Uri(ExcelVbaProject.PartUri, UriKind.Relative)))
+                    {
+                        _vba = new ExcelVbaProject(this);
+                    }
+                }
+                return _vba;
+            }
+        }
+
+        /// <summary>
+        /// Create an empty VBA project.
+        /// </summary>
+        public void CreateVBAProject()
+        {
+#if !MONO
+            if (_vba != null || _package.Package.PartExists(new Uri(ExcelVbaProject.PartUri, UriKind.Relative)))
+            {
+                throw (new InvalidOperationException("VBA project already exists."));
+            }
+                        
+            _vba = new ExcelVbaProject(this);
+            _vba.Create();
+#endif
+#if MONO
+            throw new NotSupportedException("Creating a VBA project is not supported under Mono.");
+#endif
+				}
+		/// <summary>
+		/// URI to the workbook inside the package
+		/// </summary>
+		internal Uri WorkbookUri { get; private set; }
+		/// <summary>
+        /// URI to the styles inside the package
+		/// </summary>
+		internal Uri StylesUri { get; private set; }
+		/// <summary>
+        /// URI to the shared strings inside the package
+		/// </summary>
+		internal Uri SharedStringsUri { get; private set; }
+		/// <summary>
+		/// Returns a reference to the workbook's part within the package
+		/// </summary>
+		internal Packaging.ZipPackagePart Part { get { return (_package.Package.GetPart(WorkbookUri)); } }
+		
+		#region WorkbookXml
+		private XmlDocument _workbookXml;
+		/// <summary>
+		/// Provides access to the XML data representing the workbook in the package.
+		/// </summary>
+		public XmlDocument WorkbookXml
+		{
+			get
+			{
+				if (_workbookXml == null)
+				{
+					CreateWorkbookXml(_namespaceManager);
+				}
+				return (_workbookXml);
+			}
+		}
+        const string codeModuleNamePath = "d:workbookPr/@codeName";
+        internal string CodeModuleName
+        {
+            get
+            {
+                return GetXmlNodeString(codeModuleNamePath);
+            }
+            set
+            {
+                SetXmlNodeString(codeModuleNamePath,value);
+            }
+        }
+        internal void CodeNameChange(string value)
+        {
+            CodeModuleName = value;
+        }
+        public VBA.ExcelVBAModule CodeModule
+        {
+            get
+            {
+                if (VbaProject != null)
+                {
+                    return VbaProject.Modules[CodeModuleName];
+                }
+                else
+                {
+                    return null;
+                }
+            }
+        }
+
+        const string date1904Path = "d:workbookPr/@date1904";
+        internal const double date1904Offset = 365.5 * 4;  // offset to fix 1900 and 1904 differences, 4 OLE years
+        /// <summary>
+        /// The date systems used by Microsoft Excel can be based on one of two different dates. By default, a serial number of 1 in Microsoft Excel represents January 1, 1900.
+        /// The default for the serial number 1 can be changed to represent January 2, 1904.
+        /// This option was included in Microsoft Excel for Windows to make it compatible with Excel for the Macintosh, which defaults to January 2, 1904.
+        /// </summary>
+        public bool Date1904
+        {
+            get
+            {
+                return GetXmlNodeBool(date1904Path, false);
+               
+            }
+            set
+            {
+                if (Date1904 != value)
+                {
+                    // Like Excel when the option it's changed update it all cells with Date format
+                    foreach (var item in Worksheets)
+                    {
+                        item.UpdateCellsWithDate1904Setting();
+                    }
+                }
+
+                SetXmlNodeBool(date1904Path, value, false);
+            }
+        }
+     
+       
+		/// <summary>
+		/// Create or read the XML for the workbook.
+		/// </summary>
+		private void CreateWorkbookXml(XmlNamespaceManager namespaceManager)
+		{
+			if (_package.Package.PartExists(WorkbookUri))
+				_workbookXml = _package.GetXmlFromUri(WorkbookUri);
+			else
+			{
+				// create a new workbook part and add to the package
+				Packaging.ZipPackagePart partWorkbook = _package.Package.CreatePart(WorkbookUri, @"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml", _package.Compression);
+
+				// create the workbook
+				_workbookXml = new XmlDocument(namespaceManager.NameTable);                
+				
+				_workbookXml.PreserveWhitespace = ExcelPackage.preserveWhitespace;
+				// create the workbook element
+				XmlElement wbElem = _workbookXml.CreateElement("workbook", ExcelPackage.schemaMain);
+
+				// Add the relationships namespace
+				wbElem.SetAttribute("xmlns:r", ExcelPackage.schemaRelationships);
+
+				_workbookXml.AppendChild(wbElem);
+
+				// create the bookViews and workbooks element
+				XmlElement bookViews = _workbookXml.CreateElement("bookViews", ExcelPackage.schemaMain);
+				wbElem.AppendChild(bookViews);
+				XmlElement workbookView = _workbookXml.CreateElement("workbookView", ExcelPackage.schemaMain);
+				bookViews.AppendChild(workbookView);
+
+				// save it to the package
+				StreamWriter stream = new StreamWriter(partWorkbook.GetStream(FileMode.Create, FileAccess.Write));
+				_workbookXml.Save(stream);
+				//stream.Close();
+				_package.Package.Flush();
+			}
+		}
+		#endregion
+		#region StylesXml
+		private XmlDocument _stylesXml;
+		/// <summary>
+		/// Provides access to the XML data representing the styles in the package. 
+		/// </summary>
+		public XmlDocument StylesXml
+		{
+			get
+			{
+				if (_stylesXml == null)
+				{
+					if (_package.Package.PartExists(StylesUri))
+						_stylesXml = _package.GetXmlFromUri(StylesUri);
+					else
+					{
+						// create a new styles part and add to the package
+						Packaging.ZipPackagePart part = _package.Package.CreatePart(StylesUri, @"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml", _package.Compression);
+						// create the style sheet
+
+						StringBuilder xml = new StringBuilder("<styleSheet xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\">");
+						xml.Append("<numFmts />");
+						xml.Append("<fonts count=\"1\"><font><sz val=\"11\" /><name val=\"Calibri\" /></font></fonts>");
+						xml.Append("<fills><fill><patternFill patternType=\"none\" /></fill><fill><patternFill patternType=\"gray125\" /></fill></fills>");
+						xml.Append("<borders><border><left /><right /><top /><bottom /><diagonal /></border></borders>");
+						xml.Append("<cellStyleXfs count=\"1\"><xf numFmtId=\"0\" fontId=\"0\" /></cellStyleXfs>");
+						xml.Append("<cellXfs count=\"1\"><xf numFmtId=\"0\" fontId=\"0\" xfId=\"0\" /></cellXfs>");
+						xml.Append("<cellStyles><cellStyle name=\"Normal\" xfId=\"0\" builtinId=\"0\" /></cellStyles>");
+                        xml.Append("<dxfs count=\"0\" />");
+                        xml.Append("</styleSheet>");
+						
+						_stylesXml = new XmlDocument();
+						_stylesXml.LoadXml(xml.ToString());
+						
+						//Save it to the package
+						StreamWriter stream = new StreamWriter(part.GetStream(FileMode.Create, FileAccess.Write));
+
+						_stylesXml.Save(stream);
+						//stream.Close();
+						_package.Package.Flush();
+
+						// create the relationship between the workbook and the new shared strings part
+						_package.Workbook.Part.CreateRelationship(UriHelper.GetRelativeUri(WorkbookUri, StylesUri), Packaging.TargetMode.Internal, ExcelPackage.schemaRelationships + "/styles");
+						_package.Package.Flush();
+					}
+				}
+				return (_stylesXml);
+			}
+			set
+			{
+				_stylesXml = value;
+			}
+		}
+		/// <summary>
+		/// Package styles collection. Used internally to access style data.
+		/// </summary>
+		public ExcelStyles Styles
+		{
+			get
+			{
+				if (_styles == null)
+				{
+					_styles = new ExcelStyles(NameSpaceManager, StylesXml, this);
+				}
+				return _styles;
+			}
+		}
+		#endregion
+
+		#region Office Document Properties
+		/// <summary>
+		/// The office document properties
+		/// </summary>
+		public OfficeProperties Properties
+		{
+			get 
+			{
+				if (_properties == null)
+				{
+					//  Create a NamespaceManager to handle the default namespace, 
+					//  and create a prefix for the default namespace:                   
+					_properties = new OfficeProperties(_package, NameSpaceManager);
+				}
+				return _properties;
+			}
+		}
+		#endregion
+
+		#region CalcMode
+		private string CALC_MODE_PATH = "d:calcPr/@calcMode";
+		/// <summary>
+		/// Calculation mode for the workbook.
+		/// </summary>
+		public ExcelCalcMode CalcMode
+		{
+			get
+			{
+				string calcMode = GetXmlNodeString(CALC_MODE_PATH);
+				switch (calcMode)
+				{
+					case "autoNoTable":
+						return ExcelCalcMode.AutomaticNoTable;
+					case "manual":
+						return ExcelCalcMode.Manual;
+					default:
+						return ExcelCalcMode.Automatic;
+                        
+				}
+			}
+			set
+			{
+				switch (value)
+				{
+					case ExcelCalcMode.AutomaticNoTable:
+						SetXmlNodeString(CALC_MODE_PATH, "autoNoTable") ;
+						break;
+					case ExcelCalcMode.Manual:
+						SetXmlNodeString(CALC_MODE_PATH, "manual");
+						break;
+					default:
+						SetXmlNodeString(CALC_MODE_PATH, "auto");
+						break;
+
+				}
+			}
+			#endregion
+		}
+
+        private const string FULL_CALC_ON_LOAD_PATH = "d:calcPr/@fullCalcOnLoad";
+        /// <summary>
+        /// Should Excel do a full calculation after the workbook has been loaded?
+        /// <remarks>This property is always true for both new workbooks and loaded templates(on load). If this is not the wanted behavior set this property to false.</remarks>
+        /// </summary>
+        public bool FullCalcOnLoad
+	    {
+	        get
+	        {
+                return GetXmlNodeBool(FULL_CALC_ON_LOAD_PATH);   
+	        }
+	        set
+	        {
+                SetXmlNodeBool(FULL_CALC_ON_LOAD_PATH, value);
+	        }
+	    }
+		#endregion
+		#region Workbook Private Methods
+			
+		#region Save // Workbook Save
+		/// <summary>
+		/// Saves the workbook and all its components to the package.
+		/// For internal use only!
+		/// </summary>
+		internal void Save()  // Workbook Save
+		{
+			if (Worksheets.Count == 0)
+				throw new InvalidOperationException("The workbook must contain at least one worksheet");
+
+			DeleteCalcChain();
+
+            if (_vba == null && !_package.Package.PartExists(new Uri(ExcelVbaProject.PartUri, UriKind.Relative)))
+            {
+                if (Part.ContentType != ExcelPackage.contentTypeWorkbookDefault)
+                {
+                    Part.ContentType = ExcelPackage.contentTypeWorkbookDefault;
+                }
+            }
+            else
+            {
+                if (Part.ContentType != ExcelPackage.contentTypeWorkbookMacroEnabled)
+                {
+                    Part.ContentType = ExcelPackage.contentTypeWorkbookMacroEnabled;
+                }
+            }
+			
+            UpdateDefinedNamesXml();
+
+			// save the workbook
+			if (_workbookXml != null)
+			{
+				_package.SavePart(WorkbookUri, _workbookXml);
+			}
+
+			// save the properties of the workbook
+			if (_properties != null)
+			{
+				_properties.Save();
+			}
+
+			// save the style sheet
+			Styles.UpdateXml();
+			_package.SavePart(StylesUri, _stylesXml);
+
+			// save all the open worksheets
+			var isProtected = Protection.LockWindows || Protection.LockStructure;
+			foreach (ExcelWorksheet worksheet in Worksheets)
+			{
+				if (isProtected && Protection.LockWindows)
+				{
+					worksheet.View.WindowProtection = true;
+				}
+				worksheet.Save();
+                worksheet.Part.SaveHandler = worksheet.SaveHandler;
+			}
+
+            var part = _package.Package.CreatePart(SharedStringsUri, ExcelPackage.contentTypeSharedString, _package.Compression);
+            part.SaveHandler = SaveSharedStringHandler;
+            Part.CreateRelationship(UriHelper.GetRelativeUri(WorkbookUri, SharedStringsUri), Packaging.TargetMode.Internal, ExcelPackage.schemaRelationships + "/sharedStrings");
+            //UpdateSharedStringsXml();
+			
+			// Data validation
+			ValidateDataValidations();
+
+            //VBA
+            if (_vba!=null)
+            {
+#if !MONO
+                VbaProject.Save();
+#endif
+            }
+
+		}
+		private void DeleteCalcChain()
+		{
+			//Remove the calc chain if it exists.
+			Uri uriCalcChain = new Uri("/xl/calcChain.xml", UriKind.Relative);
+			if (_package.Package.PartExists(uriCalcChain))
+			{
+				Uri calcChain = new Uri("calcChain.xml", UriKind.Relative);
+				foreach (var relationship in _package.Workbook.Part.GetRelationships())
+				{
+					if (relationship.TargetUri == calcChain)
+					{
+						_package.Workbook.Part.DeleteRelationship(relationship.Id);
+						break;
+					}
+				}
+				// delete the calcChain part
+				_package.Package.DeletePart(uriCalcChain);
+			}
+		}
+
+		private void ValidateDataValidations()
+		{
+			foreach (var sheet in _package.Workbook.Worksheets)
+			{
+                if (!(sheet is ExcelChartsheet))
+                {
+                    sheet.DataValidations.ValidateAll();
+                }
+			}
+		}
+
+        private void SaveSharedStringHandler(ZipOutputStream stream, CompressionLevel compressionLevel, string fileName)
+		{
+            //Packaging.ZipPackagePart stringPart;
+            //if (_package.Package.PartExists(SharedStringsUri))
+            //{
+            //    stringPart=_package.Package.GetPart(SharedStringsUri);
+            //}
+            //else
+            //{
+            //    stringPart = _package.Package.CreatePart(SharedStringsUri, @"application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml", _package.Compression);
+                  //Part.CreateRelationship(UriHelper.GetRelativeUri(WorkbookUri, SharedStringsUri), Packaging.TargetMode.Internal, ExcelPackage.schemaRelationships + "/sharedStrings");
+            //}
+
+			//StreamWriter sw = new StreamWriter(stringPart.GetStream(FileMode.Create, FileAccess.Write));
+            //Init Zip
+            stream.CompressionLevel = (OfficeOpenXml.Packaging.Ionic.Zlib.CompressionLevel)compressionLevel;
+            stream.PutNextEntry(fileName);
+
+            var cache = new StringBuilder();            
+            var sw = new StreamWriter(stream);
+            cache.AppendFormat("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?><sst xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" count=\"{0}\" uniqueCount=\"{0}\">", _sharedStrings.Count);
+			foreach (string t in _sharedStrings.Keys)
+			{
+
+				SharedStringItem ssi = _sharedStrings[t];
+				if (ssi.isRichText)
+				{
+                    cache.Append("<si>");
+                    ConvertUtil.ExcelEncodeString(cache, t);
+                    cache.Append("</si>");
+				}
+				else
+				{
+					if (t.Length>0 && (t[0] == ' ' || t[t.Length-1] == ' ' || t.Contains("  ") || t.Contains("\t")))
+					{
+                        cache.Append("<si><t xml:space=\"preserve\">");
+					}
+					else
+					{
+                        cache.Append("<si><t>");
+					}
+                    ConvertUtil.ExcelEncodeString(cache, ConvertUtil.ExcelEscapeString(t));
+                    cache.Append("</t></si>");
+				}
+                if (cache.Length > 0x600000)
+                {
+                    sw.Write(cache.ToString());
+                    cache = new StringBuilder();            
+                }
+			}
+            cache.Append("</sst>");
+            sw.Write(cache.ToString());
+            sw.Flush();
+            Part.CreateRelationship(UriHelper.GetRelativeUri(WorkbookUri, SharedStringsUri), Packaging.TargetMode.Internal, ExcelPackage.schemaRelationships + "/sharedStrings");
+		}
+		private void UpdateDefinedNamesXml()
+		{
+			try
+			{
+                XmlNode top = WorkbookXml.SelectSingleNode("//d:definedNames", NameSpaceManager);
+				if (!ExistsNames())
+				{
+					if (top != null) TopNode.RemoveChild(top);
+					return;
+				}
+				else
+				{
+					if (top == null)
+					{
+						CreateNode("d:definedNames");
+						top = WorkbookXml.SelectSingleNode("//d:definedNames", NameSpaceManager);
+					}
+					else
+					{
+						top.RemoveAll();
+					}
+					foreach (ExcelNamedRange name in _names)
+					{
+
+						XmlElement elem = WorkbookXml.CreateElement("definedName", ExcelPackage.schemaMain);
+						top.AppendChild(elem);
+						elem.SetAttribute("name", name.Name);
+						if (name.IsNameHidden) elem.SetAttribute("hidden", "1");
+						if (!string.IsNullOrEmpty(name.NameComment)) elem.SetAttribute("comment", name.NameComment);
+						SetNameElement(name, elem);
+					}
+				}
+				foreach (ExcelWorksheet ws in _worksheets)
+				{
+                    if (!(ws is ExcelChartsheet))
+                    {
+                        foreach (ExcelNamedRange name in ws.Names)
+                        {
+                            XmlElement elem = WorkbookXml.CreateElement("definedName", ExcelPackage.schemaMain);
+                            top.AppendChild(elem);
+                            elem.SetAttribute("name", name.Name);
+                            elem.SetAttribute("localSheetId", name.LocalSheetId.ToString());
+                            if (name.IsNameHidden) elem.SetAttribute("hidden", "1");
+                            if (!string.IsNullOrEmpty(name.NameComment)) elem.SetAttribute("comment", name.NameComment);
+                            SetNameElement(name, elem);
+                        }
+                    }
+				}
+			}
+			catch (Exception ex)
+			{
+				throw new Exception("Internal error updating named ranges ",ex);
+			}
+		}
+
+		private void SetNameElement(ExcelNamedRange name, XmlElement elem)
+		{
+			if (name.IsName)
+			{
+				if (string.IsNullOrEmpty(name.NameFormula))
+				{
+					if ((name.NameValue.GetType().IsPrimitive || name.NameValue is double || name.NameValue is decimal))
+					{
+						elem.InnerText = Convert.ToDouble(name.NameValue, CultureInfo.InvariantCulture).ToString("R15", CultureInfo.InvariantCulture); 
+					}
+					else if (name.NameValue is DateTime)
+					{
+						elem.InnerText = ((DateTime)name.NameValue).ToOADate().ToString(CultureInfo.InvariantCulture);
+					}
+					else
+					{
+						elem.InnerText = "\"" + name.NameValue.ToString() + "\"";
+					}                                
+				}
+				else
+				{
+					elem.InnerText = name.NameFormula;
+				}
+			}
+			else
+			{
+                elem.InnerText = name.FullAddressAbsolute;
+			}
+		}
+		/// <summary>
+		/// Is their any names in the workbook or in the sheets.
+		/// </summary>
+		/// <returns>?</returns>
+		private bool ExistsNames()
+		{
+			if (_names.Count == 0)
+			{
+				foreach (ExcelWorksheet ws in Worksheets)
+				{
+                    if (ws is ExcelChartsheet) continue;
+                    if(ws.Names.Count>0)
+					{
+						return true;
+					}
+				}
+			}
+			else
+			{
+				return true;
+			}
+			return false;
+		}        
+		#endregion
+
+		#endregion
+		internal bool ExistsTableName(string Name)
+		{
+			foreach (var ws in Worksheets)
+			{
+				if(ws.Tables._tableNames.ContainsKey(Name))
+				{
+					return true;
+				}
+			}
+			return false;
+		}
+		internal bool ExistsPivotTableName(string Name)
+		{
+			foreach (var ws in Worksheets)
+			{
+				if (ws.PivotTables._pivotTableNames.ContainsKey(Name))
+				{
+					return true;
+				}
+			}
+			return false;
+		}
+		internal void AddPivotTable(string cacheID, Uri defUri)
+		{
+			CreateNode("d:pivotCaches");
+
+			XmlElement item = WorkbookXml.CreateElement("pivotCache", ExcelPackage.schemaMain);
+			item.SetAttribute("cacheId", cacheID);
+			var rel = Part.CreateRelationship(UriHelper.ResolvePartUri(WorkbookUri, defUri), Packaging.TargetMode.Internal, ExcelPackage.schemaRelationships + "/pivotCacheDefinition");
+			item.SetAttribute("id", ExcelPackage.schemaRelationships, rel.Id);
+
+			var pivotCaches = WorkbookXml.SelectSingleNode("//d:pivotCaches", NameSpaceManager);
+			pivotCaches.AppendChild(item);
+		}
+		internal List<string> _externalReferences = new List<string>();
+        //internal bool _isCalculated=false;
+		internal void GetExternalReferences()
+		{
+			XmlNodeList nl = WorkbookXml.SelectNodes("//d:externalReferences/d:externalReference", NameSpaceManager);
+			if (nl != null)
+			{
+				foreach (XmlElement elem in nl)
+				{
+					string rID = elem.GetAttribute("r:id");
+					var rel = Part.GetRelationship(rID);
+					var part = _package.Package.GetPart(UriHelper.ResolvePartUri(rel.SourceUri, rel.TargetUri));
+					XmlDocument xmlExtRef = new XmlDocument();
+                    LoadXmlSafe(xmlExtRef, part.GetStream()); 
+
+					XmlElement book=xmlExtRef.SelectSingleNode("//d:externalBook", NameSpaceManager) as XmlElement;
+					if(book!=null)
+					{
+						string rId_ExtRef = book.GetAttribute("r:id");
+						var rel_extRef = part.GetRelationship(rId_ExtRef);
+						if (rel_extRef != null)
+						{
+							_externalReferences.Add(rel_extRef.TargetUri.OriginalString);
+						}
+
+					}
+				}
+			}
+		}
+
+        public void Dispose()
+        {
+            _sharedStrings.Clear();
+            _sharedStringsList.Clear();
+            
+            _sharedStrings = null;
+            _sharedStringsList = null;
+            _vba = null;
+            if (_worksheets != null)
+            {
+                _worksheets.Dispose();
+                _worksheets = null;
+            }
+            _package = null;
+            _properties = null;
+            if (_formulaParser != null)
+            {
+                _formulaParser.Dispose();
+                _formulaParser = null;
+            }   
+        }
+    } // end Workbook
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelWorkbookView.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelWorkbookView.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelWorkbookView.cs	(revision 12707)
@@ -0,0 +1,212 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		    Initial Release		       2011-11-02
+ * Jan Källman		    License changed GPL-->LGPL 2011-12-27
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Text;
+using System.Xml;
+namespace OfficeOpenXml
+{
+    /// <summary>
+    /// Access to workbook view properties
+    /// </summary>
+    public class ExcelWorkbookView : XmlHelper
+    {
+        #region ExcelWorksheetView Constructor
+        /// <summary>
+        /// Creates a new ExcelWorkbookView which provides access to all the 
+        /// view states of the worksheet.
+        /// </summary>
+        /// <param name="ns"></param>
+        /// <param name="node"></param>
+        /// <param name="wb"></param>
+        internal ExcelWorkbookView(XmlNamespaceManager ns, XmlNode node, ExcelWorkbook wb) :
+            base(ns, node)
+		{
+            SchemaNodeOrder = wb.SchemaNodeOrder;
+		}
+		#endregion
+        const string LEFT_PATH="d:bookViews/d:workbookView/@xWindow";
+        /// <summary>
+        /// Position of the upper left corner of the workbook window. In twips.
+        /// </summary>
+        public int Left
+        { 
+            get
+            {
+                return GetXmlNodeInt(LEFT_PATH);
+            }
+            internal set
+            {
+                SetXmlNodeString(LEFT_PATH,value.ToString());
+            }
+        }
+        const string TOP_PATH="d:bookViews/d:workbookView/@yWindow";
+        /// <summary>
+        /// Position of the upper left corner of the workbook window. In twips.
+        /// </summary>
+        public int Top
+        { 
+            get
+            {
+                return GetXmlNodeInt(TOP_PATH);
+            }
+            internal set
+            {
+                SetXmlNodeString(TOP_PATH, value.ToString());
+            }
+        }
+        const string WIDTH_PATH="d:bookViews/d:workbookView/@windowWidth";
+        /// <summary>
+        /// Width of the workbook window. In twips.
+        /// </summary>
+        public int Width
+        { 
+            get
+            {
+                return GetXmlNodeInt(WIDTH_PATH);
+            }
+            internal set
+            {
+                SetXmlNodeString(WIDTH_PATH, value.ToString());
+            }
+        }
+        const string HEIGHT_PATH="d:bookViews/d:workbookView/@windowHeight";
+        /// <summary>
+        /// Height of the workbook window. In twips.
+        /// </summary>
+        public int Height
+        { 
+            get
+            {
+                return GetXmlNodeInt(HEIGHT_PATH);
+            }
+            internal set
+            {
+                SetXmlNodeString(HEIGHT_PATH, value.ToString());
+            }
+        }
+        const string MINIMIZED_PATH="d:bookViews/d:workbookView/@minimized";
+        /// <summary>
+        /// If true the the workbook window is minimized.
+        /// </summary>
+        public bool Minimized
+        {
+            get
+            {
+                return GetXmlNodeBool(MINIMIZED_PATH);
+            }
+            set
+            {
+                SetXmlNodeString(MINIMIZED_PATH, value.ToString());
+            }
+        }
+        const string SHOWVERTICALSCROLL_PATH = "d:bookViews/d:workbookView/@showVerticalScroll";
+        /// <summary>
+        /// Show the vertical scrollbar
+        /// </summary>
+        public bool ShowVerticalScrollBar
+        {
+            get
+            {
+                return GetXmlNodeBool(SHOWVERTICALSCROLL_PATH,true);
+            }
+            set
+            {
+                SetXmlNodeBool(SHOWVERTICALSCROLL_PATH, value, true);
+            }
+        }
+        const string SHOWHORIZONTALSCR_PATH = "d:bookViews/d:workbookView/@showHorizontalScroll";
+        /// <summary>
+        /// Show the horizontal scrollbar
+        /// </summary>
+        public bool ShowHorizontalScrollBar
+        {
+            get
+            {
+                return GetXmlNodeBool(SHOWHORIZONTALSCR_PATH, true);
+            }
+            set
+            {
+                SetXmlNodeBool(SHOWHORIZONTALSCR_PATH, value, true);
+            }
+        }
+        const string SHOWSHEETTABS_PATH = "d:bookViews/d:workbookView/@showSheetTabs";
+        /// <summary>
+        /// Show the sheet tabs
+        /// </summary>
+        public bool ShowSheetTabs
+        {
+            get
+            {
+                return GetXmlNodeBool(SHOWSHEETTABS_PATH, true);
+            }
+            set
+            {
+                SetXmlNodeBool(SHOWSHEETTABS_PATH, value, true);
+            }
+        }
+        /// <summary>
+        /// Set the window position in twips
+        /// </summary>
+        /// <param name="left"></param>
+        /// <param name="top"></param>
+        /// <param name="width"></param>
+        /// <param name="height"></param>
+        public void SetWindowSize(int left, int top, int width, int height)
+        {
+            Left = left;
+            Top = top;
+            Width = width;
+            Height = height;
+        }
+
+        const string ACTIVETAB_PATH = "d:bookViews/d:workbookView/@activeTab";
+        public int ActiveTab 
+        {
+            get
+            {
+                var v=GetXmlNodeInt(ACTIVETAB_PATH);
+                if (v < 0)
+                    return 0;
+                else
+                    return v;
+
+            }
+            set
+            {
+                SetXmlNodeString(ACTIVETAB_PATH, value.ToString(CultureInfo.InvariantCulture));
+            }
+        }
+    }
+}
+    
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelWorksheet.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelWorksheet.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelWorksheet.cs	(revision 12707)
@@ -0,0 +1,4078 @@
+/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		    Initial Release		        2011-11-02
+ * Jan Källman          Total rewrite               2010-03-01
+ * Jan Källman		    License changed GPL-->LGPL  2011-12-27
+ *******************************************************************************/
+using System;
+using System.Xml;
+using System.Collections.Generic;
+using System.IO;
+using System.Configuration;
+using OfficeOpenXml.Drawing;
+using System.Diagnostics;
+using OfficeOpenXml.Style;
+using System.Globalization;
+using System.Text;
+using System.Security;
+using OfficeOpenXml.Drawing.Chart;
+using OfficeOpenXml.Style.XmlAccess;
+using System.Text.RegularExpressions;
+using OfficeOpenXml.Drawing.Vml;
+using OfficeOpenXml.Table;
+using OfficeOpenXml.DataValidation;
+using OfficeOpenXml.Table.PivotTable;
+using System.ComponentModel;
+using System.Drawing;
+using OfficeOpenXml.ConditionalFormatting;
+using OfficeOpenXml.Utils;
+using Ionic.Zip;
+using OfficeOpenXml.FormulaParsing.LexicalAnalysis;
+using OfficeOpenXml.FormulaParsing;
+using OfficeOpenXml.Packaging.Ionic.Zip;
+namespace OfficeOpenXml
+{
+    /// <summary>
+    /// Worksheet hidden enumeration
+    /// </summary>
+    public enum eWorkSheetHidden
+    {
+        /// <summary>
+        /// The worksheet is visible
+        /// </summary>
+        Visible,
+        /// <summary>
+        /// The worksheet is hidden but can be shown by the user via the user interface
+        /// </summary>
+        Hidden,
+        /// <summary>
+        /// The worksheet is hidden and cannot be shown by the user via the user interface
+        /// </summary>
+        VeryHidden
+    }
+    [Flags]
+    internal enum CellFlags
+    {
+        //Merged = 0x1,
+        RichText = 0x2,
+        SharedFormula = 0x4,
+        ArrayFormula = 0x8
+    }
+    /// <summary>
+    /// Represents an Excel Chartsheet and provides access to its properties and methods
+    /// </summary>
+    public class ExcelChartsheet : ExcelWorksheet
+    {
+        //ExcelDrawings draws;
+        public ExcelChartsheet(XmlNamespaceManager ns, ExcelPackage pck, string relID, Uri uriWorksheet, string sheetName, int sheetID, int positionID, eWorkSheetHidden hidden, eChartType chartType) :
+            base(ns, pck, relID, uriWorksheet, sheetName, sheetID, positionID, hidden)
+        {
+            this.Drawings.AddChart("Chart 1", chartType);
+        }
+        public ExcelChartsheet(XmlNamespaceManager ns, ExcelPackage pck, string relID, Uri uriWorksheet, string sheetName, int sheetID, int positionID, eWorkSheetHidden hidden) :
+            base(ns, pck, relID, uriWorksheet, sheetName, sheetID, positionID, hidden)
+        {
+        }
+        public ExcelChart Chart 
+        {
+            get
+            {
+                return (ExcelChart)Drawings[0];
+            }
+        }
+    }
+    /// <summary>
+	/// Represents an Excel worksheet and provides access to its properties and methods
+	/// </summary>
+    public class ExcelWorksheet : XmlHelper, IDisposable
+	{
+        internal class Formulas
+        {
+            public Formulas(ISourceCodeTokenizer tokenizer)
+            {
+                _tokenizer = tokenizer;
+            }
+
+            private ISourceCodeTokenizer _tokenizer;
+            internal int Index { get; set; }
+            internal string Address { get; set; }
+            internal bool IsArray { get; set; }
+            public string Formula { get; set; }
+            public int StartRow { get; set; }
+            public int StartCol { get; set; }
+
+            private IEnumerable<Token> Tokens {get; set;}
+
+            internal string GetFormula(int row, int column, string worksheet)
+            {
+                if (StartRow == row && StartCol == column)
+                {
+                    return Formula;
+                }
+
+                if (Tokens == null)
+                {
+                    Tokens = _tokenizer.Tokenize(Formula, worksheet);
+                }
+                
+                string f = "";
+                foreach (var token in Tokens)
+                {
+                    if (token.TokenType == TokenType.ExcelAddress)
+                    {
+                        var a = new ExcelFormulaAddress(token.Value);
+                        f += a.GetOffset(row - StartRow, column - StartCol);
+                    }
+                    else
+                    {
+                        f += token.Value;
+                    }
+                }
+                return f;
+            }
+        }
+        /// <summary>
+        /// Collection containing merged cell addresses
+        /// </summary>
+        public class MergeCellsCollection : IEnumerable<string>
+        {
+            internal MergeCellsCollection()
+            {
+
+            }
+            internal CellStore<int> _cells = new CellStore<int>();
+            List<string> _list = new List<string>();
+            internal List<string> List { get {return _list;} }
+            public string this[int row, int column]
+            {
+                get
+                {
+                    int ix=-1;
+                    if (_cells.Exists(row, column, ref ix) && ix >= 0 && ix < List.Count)  //Fixes issue 15075
+                    {
+                        return List[ix];
+                    }
+                    else
+                    {
+                        return null;
+                    }
+                }
+            }
+            public string this[int index]
+            {
+                get
+                {
+                    return _list[index];
+                }
+            }
+            internal void Add(ExcelAddressBase address, bool doValidate)
+            {
+                int ix=0;
+
+                //Validate
+                if (doValidate && Validate(address) == false)
+                {
+                    throw(new ArgumentException("Can't merge and already merged range"));
+                }
+                lock(this)
+                {
+                    ix = _list.Count;
+                    _list.Add(address.Address);
+                    SetIndex(address, ix);
+                }
+            }
+
+            private bool Validate(ExcelAddressBase address)
+            {
+                int ix=0;
+                if(_cells.Exists(address._fromRow, address._fromCol, ref ix))
+                {
+                    if (ix>=0 && ix < _list.Count && _list[ix]!=null && address.Address == _list[ix])
+                    {
+                        return true;
+                    }
+                    else
+                    {
+                        return false;
+                    }
+                }
+                
+                var cse = new CellsStoreEnumerator<int>(_cells, address._fromRow, address._fromCol, address._toRow, address._toCol);
+                //cells
+                while(cse.Next())
+                {
+                    return false;
+                }
+                //Entire column
+                cse = new CellsStoreEnumerator<int>(_cells, 0, address._fromCol, 0, address._toCol);
+                while (cse.Next())
+                {
+                    return false;
+                }
+                //Entire row
+                cse = new CellsStoreEnumerator<int>(_cells, address._fromRow, 0, address._toRow, 0);
+                while (cse.Next())
+                {
+                    return false;
+                }
+                return true;
+            }
+
+            internal void SetIndex(ExcelAddressBase address, int ix)
+            {
+                if (address._fromRow == 1 && address._toRow == ExcelPackage.MaxRows) //Entire row
+                {
+                    for (int col = address._fromCol; col <= address._toCol; col++)
+                    {
+                        _cells.SetValue(0, col, ix);
+                    }
+                }
+                else if (address._fromCol == 1 && address._toCol == ExcelPackage.MaxColumns) //Entire row
+                {
+                    for (int row = address._fromRow; row <= address._toRow; row++)
+                    {
+                        _cells.SetValue(row, 0, ix);
+                    }
+                }
+                else
+                {
+                    for (int col = address._fromCol; col <= address._toCol; col++)
+                    {
+                        for (int row = address._fromRow; row <= address._toRow; row++)
+                        {
+                            _cells.SetValue(row, col, ix);
+                        }
+                    }
+                }
+            }
+            public int Count
+            {
+                get
+                {
+                    return _list.Count;
+                }
+            }
+            internal void Remove(string Item)
+            {
+                _list.Remove(Item);
+            }
+            #region IEnumerable<string> Members
+
+            public IEnumerator<string> GetEnumerator()
+            {
+                return _list.GetEnumerator();
+            }
+
+            #endregion
+
+            #region IEnumerable Members
+
+            System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
+            {
+                return _list.GetEnumerator();
+            }
+            
+            #endregion
+            internal void Delete(ExcelAddressBase Destination)
+            {
+                var cse = new CellsStoreEnumerator<int>(_cells, Destination._fromRow, Destination._fromCol, Destination._toRow, Destination._toCol);
+                var used=new HashSet<int>();
+                while(cse.Next())
+                {
+                    var v=cse.Value;
+                    if (!used.Contains(v) && _list[v]!=null)
+                    {
+                        var adr=new ExcelAddressBase(_list[v]);
+                        if (!(Destination.Collide(adr) == ExcelAddressBase.eAddressCollition.Inside || Destination.Collide(adr)==ExcelAddressBase.eAddressCollition.Equal))
+                        {
+                            throw(new InvalidOperationException(string.Format("Can't delete merged cells. A range is partly merged with the deleted range. {0}", adr._address)));
+                        }
+                        used.Add(v);
+                    }
+                }
+
+                _cells.Delete(Destination._fromRow, Destination._fromCol, Destination._toRow - Destination._fromRow + 1, Destination._toCol - Destination._fromCol + 1);
+                foreach(var i in used)
+                {
+                    _list[i] = null;
+                }
+            }
+        }
+        internal CellStore<object> _values;
+        internal CellStore<string> _types;
+        internal CellStore<int> _styles;
+        internal CellStore<object> _formulas;
+        internal FlagCellStore _flags;
+        internal CellStore<List<Token>> _formulaTokens;
+
+        internal CellStore<Uri> _hyperLinks;
+        internal CellStore<ExcelComment> _commentsStore;
+
+        internal Dictionary<int, Formulas> _sharedFormulas = new Dictionary<int, Formulas>();
+        internal int _minCol = ExcelPackage.MaxColumns;
+        internal int _maxCol = 0;
+        #region Worksheet Private Properties
+        internal ExcelPackage _package;
+		private Uri _worksheetUri;
+		private string _name;
+		private int _sheetID;
+        private int _positionID;
+		private string _relationshipID;
+		private XmlDocument _worksheetXml;
+        internal ExcelWorksheetView _sheetView;
+		internal ExcelHeaderFooter _headerFooter;
+        #endregion
+        #region ExcelWorksheet Constructor
+        /// <summary>
+        /// A worksheet
+        /// </summary>
+        /// <param name="ns">Namespacemanager</param>
+        /// <param name="excelPackage">Package</param>
+        /// <param name="relID">Relationship ID</param>
+        /// <param name="uriWorksheet">URI</param>
+        /// <param name="sheetName">Name of the sheet</param>
+        /// <param name="sheetID">Sheet id</param>
+        /// <param name="positionID">Position</param>
+        /// <param name="hide">hide</param>
+        public ExcelWorksheet(XmlNamespaceManager ns, ExcelPackage excelPackage, string relID, 
+                              Uri uriWorksheet, string sheetName, int sheetID, int positionID,
+                              eWorkSheetHidden hide) :
+            base(ns, null)
+        {
+            SchemaNodeOrder = new string[] { "sheetPr", "tabColor", "outlinePr", "pageSetUpPr", "dimension", "sheetViews", "sheetFormatPr", "cols", "sheetData", "sheetProtection", "protectedRanges","scenarios", "autoFilter", "sortState", "dataConsolidate", "customSheetViews", "customSheetViews", "mergeCells", "phoneticPr", "conditionalFormatting", "dataValidations", "hyperlinks", "printOptions", "pageMargins", "pageSetup", "headerFooter", "linePrint", "rowBreaks", "colBreaks", "customProperties", "cellWatches", "ignoredErrors", "smartTags", "drawing", "legacyDrawing", "legacyDrawingHF", "picture", "oleObjects", "activeXControls", "webPublishItems", "tableParts" , "extLst" };
+            _package = excelPackage;   
+            _relationshipID = relID;
+            _worksheetUri = uriWorksheet;
+            _name = sheetName;
+            _sheetID = sheetID;
+            _positionID = positionID;
+            Hidden = hide;
+           
+            /**** Cellstore ****/
+            _values=new CellStore<object>();
+            _types = new CellStore<string>();
+            _styles = new CellStore<int>();
+            _formulas = new CellStore<object>();
+            _flags = new FlagCellStore();
+            _commentsStore = new CellStore<ExcelComment>();
+            _hyperLinks = new CellStore<Uri>();
+            
+            _names = new ExcelNamedRangeCollection(Workbook,this);
+            CreateXml();
+            TopNode = _worksheetXml.DocumentElement;
+        }
+
+        #endregion
+        /// <summary>
+        /// The Uri to the worksheet within the package
+        /// </summary>
+        internal Uri WorksheetUri { get { return (_worksheetUri); } }
+        /// <summary>
+        /// The Zip.ZipPackagePart for the worksheet within the package
+        /// </summary>
+        internal Packaging.ZipPackagePart Part { get { return (_package.Package.GetPart(WorksheetUri)); } }
+        /// <summary>
+        /// The ID for the worksheet's relationship with the workbook in the package
+        /// </summary>
+        internal string RelationshipID { get { return (_relationshipID); } }
+        /// <summary>
+        /// The unique identifier for the worksheet.
+        /// </summary>
+        internal int SheetID { get { return (_sheetID); } }
+        /// <summary>
+        /// The position of the worksheet.
+        /// </summary>
+        internal int PositionID { get { return (_positionID); } set { _positionID = value; } }
+		#region Worksheet Public Properties
+    	/// <summary>
+        /// The index in the worksheets collection
+        /// </summary>
+        public int Index { get { return (_positionID); } }
+        /// <summary>
+        /// Address for autofilter
+        /// <seealso cref="ExcelRangeBase.AutoFilter" />        
+        /// </summary>
+        public ExcelAddressBase AutoFilterAddress
+        {
+            get
+            {
+                CheckSheetType();
+                string address = GetXmlNodeString("d:autoFilter/@ref");
+                if (address == "")
+                {
+                    return null;
+                }
+                else
+                {
+                    return new ExcelAddressBase(address);
+                }
+            }
+            internal set
+            {
+                CheckSheetType();
+                SetXmlNodeString("d:autoFilter/@ref", value.Address);
+            }
+        }
+
+        internal void CheckSheetType()
+        {
+            if (this is ExcelChartsheet)
+            {
+                throw (new NotSupportedException("This property or method is not supported for a Chartsheet"));
+            }
+        }
+
+		/// <summary>
+		/// Returns a ExcelWorksheetView object that allows you to set the view state properties of the worksheet
+		/// </summary>
+		public ExcelWorksheetView View
+		{
+			get
+			{
+				if (_sheetView == null)
+				{
+                    XmlNode node = TopNode.SelectSingleNode("d:sheetViews/d:sheetView", NameSpaceManager);
+                    if (node == null)
+                    {
+                        CreateNode("d:sheetViews/d:sheetView"); //this one shouls always exist. but check anyway
+                        node = TopNode.SelectSingleNode("d:sheetViews/d:sheetView", NameSpaceManager);
+                    }
+                    _sheetView = new ExcelWorksheetView(NameSpaceManager, node, this);
+				}
+				return (_sheetView);
+			}
+		}
+
+		/// <summary>
+		/// The worksheet's display name as it appears on the tab
+		/// </summary>
+		public string Name
+		{
+			get { return (_name); }
+			set
+			{
+                if (value == _name) return;
+                value=_package.Workbook.Worksheets.ValidateFixSheetName(value);
+                foreach(var ws in Workbook.Worksheets)
+                {
+                    if(ws.PositionID!=PositionID && ws.Name.Equals(value,StringComparison.InvariantCultureIgnoreCase))
+                    {
+                        throw (new ArgumentException("Worksheet name must be unique"));
+                    }
+                }
+                _package.Workbook.SetXmlNodeString(string.Format("d:sheets/d:sheet[@sheetId={0}]/@name", _sheetID), value);
+                ChangeNames(value);
+
+                _name = value;
+            }
+		}
+
+        private void ChangeNames(string value)
+        {
+            //Renames name in this Worksheet;
+            foreach (var n in Workbook.Names)
+            {
+                if (string.IsNullOrEmpty(n.NameFormula) && n.NameValue==null)
+                {
+                    n.ChangeWorksheet(_name, value);
+                }
+            }
+            foreach (var ws in Workbook.Worksheets)
+            {
+                if (!(ws is ExcelChartsheet))
+                {
+                    foreach (var n in ws.Names)
+                    {
+                        if (string.IsNullOrEmpty(n.NameFormula) && n.NameValue == null)
+                        {
+                            n.ChangeWorksheet(_name, value);
+                        }
+                    }
+                }
+            }
+        }
+        internal ExcelNamedRangeCollection _names;
+        /// <summary>
+        /// Provides access to named ranges
+        /// </summary>
+        public ExcelNamedRangeCollection Names 
+        {
+            get
+            {
+                CheckSheetType();
+                return _names;
+            }
+        }
+		/// <summary>
+		/// Indicates if the worksheet is hidden in the workbook
+		/// </summary>
+		public eWorkSheetHidden Hidden
+		{
+			get 
+            {
+                string state=_package.Workbook.GetXmlNodeString(string.Format("d:sheets/d:sheet[@sheetId={0}]/@state", _sheetID));
+                if (state == "hidden")
+                {
+                    return eWorkSheetHidden.Hidden;
+                }
+                else if (state == "veryHidden")
+                {
+                    return eWorkSheetHidden.VeryHidden;
+                }
+                return eWorkSheetHidden.Visible;
+            }
+			set
+			{
+                    if (value == eWorkSheetHidden.Visible)
+                    {
+                        _package.Workbook.DeleteNode(string.Format("d:sheets/d:sheet[@sheetId={0}]/@state", _sheetID));
+                    }
+                    else
+                    {
+                        string v;
+                        v=value.ToString();                        
+                        v=v.Substring(0,1).ToLower(CultureInfo.InvariantCulture)+v.Substring(1);
+                        _package.Workbook.SetXmlNodeString(string.Format("d:sheets/d:sheet[@sheetId={0}]/@state", _sheetID),v );
+                    }
+		    }
+		}
+        double _defaultRowHeight = double.NaN;
+        /// <summary>
+		/// Get/set the default height of all rows in the worksheet
+		/// </summary>
+        public double DefaultRowHeight
+		{
+			get 
+			{
+                CheckSheetType();
+                if (double.IsNaN(_defaultRowHeight))
+                {
+                    _defaultRowHeight = GetXmlNodeDouble("d:sheetFormatPr/@defaultRowHeight");
+                    if(double.IsNaN(_defaultRowHeight))
+                    {
+                        _defaultRowHeight = 15; // Excel default height
+                    }
+                }
+				return _defaultRowHeight;
+			}
+			set
+			{
+                CheckSheetType();
+                _defaultRowHeight = value;
+                SetXmlNodeString("d:sheetFormatPr/@defaultRowHeight", value.ToString(CultureInfo.InvariantCulture));
+                SetXmlNodeBool("d:sheetFormatPr/@customHeight", value != 15);
+
+                if (double.IsNaN(GetXmlNodeDouble("d:sheetFormatPr/@defaultColWidth")))
+                {
+                    DefaultColWidth = 9.140625;
+                }
+			}
+		}
+        /// <summary>
+        /// Get/set the default width of all rows in the worksheet
+        /// </summary>
+        public double DefaultColWidth
+        {
+            get
+            {
+                CheckSheetType();
+                double ret = GetXmlNodeDouble("d:sheetFormatPr/@defaultColWidth");
+                if (double.IsNaN(ret))
+                {
+                    ret = 9.140625; // Excel's default width
+                }
+                return ret;
+            }
+            set
+            {
+                CheckSheetType();
+                SetXmlNodeString("d:sheetFormatPr/@defaultColWidth", value.ToString(CultureInfo.InvariantCulture));
+
+                if (double.IsNaN(GetXmlNodeDouble("d:sheetFormatPr/@defaultRowHeight")))
+                {
+                    DefaultRowHeight = 15;
+                }
+            }
+        }
+        /** <outlinePr applyStyles="1" summaryBelow="0" summaryRight="0" /> **/
+        const string outLineSummaryBelowPath = "d:sheetPr/d:outlinePr/@summaryBelow";
+        /// <summary>
+        /// Summary rows below details 
+        /// </summary>
+        public bool OutLineSummaryBelow
+        { 
+            get
+            {
+                CheckSheetType();
+                return GetXmlNodeBool(outLineSummaryBelowPath);
+            }
+            set
+            {
+                CheckSheetType();
+                SetXmlNodeString(outLineSummaryBelowPath, value ? "1" : "0");
+            }
+        }
+        const string outLineSummaryRightPath = "d:sheetPr/d:outlinePr/@summaryRight";
+        /// <summary>
+        /// Summary rows to right of details
+        /// </summary>
+        public bool OutLineSummaryRight
+        {
+            get
+            {
+                CheckSheetType();
+                return GetXmlNodeBool(outLineSummaryRightPath);
+            }
+            set
+            {
+                CheckSheetType();
+                SetXmlNodeString(outLineSummaryRightPath, value ? "1" : "0");
+            }
+        }
+        const string outLineApplyStylePath = "d:sheetPr/d:outlinePr/@applyStyles";
+        /// <summary>
+        /// Automatic styles
+        /// </summary>
+        public bool OutLineApplyStyle
+        {
+            get
+            {
+                CheckSheetType();
+                return GetXmlNodeBool(outLineApplyStylePath);
+            }
+            set
+            {
+                CheckSheetType();
+                SetXmlNodeString(outLineApplyStylePath, value ? "1" : "0");
+            }
+        }
+        const string tabColorPath = "d:sheetPr/d:tabColor/@rgb";
+        /// <summary>
+        /// Color of the sheet tab
+        /// </summary>
+        public Color TabColor
+        {
+            get
+            {
+                string col = GetXmlNodeString(tabColorPath);
+                if (col == "")
+                {
+                    return Color.Empty;
+                }
+                else
+                {
+                    return Color.FromArgb(int.Parse(col, System.Globalization.NumberStyles.AllowHexSpecifier));
+                }
+            }
+            set
+            {
+                SetXmlNodeString(tabColorPath, value.ToArgb().ToString("X"));
+            }
+        }
+        const string codeModuleNamePath = "d:sheetPr/@codeName";
+        internal string CodeModuleName
+        {
+            get
+            {
+                return GetXmlNodeString(codeModuleNamePath);
+            }
+            set
+            {
+                SetXmlNodeString(codeModuleNamePath, value);
+            }
+        }
+        internal void CodeNameChange(string value)
+        {
+            CodeModuleName = value;
+        }
+        public VBA.ExcelVBAModule CodeModule
+        {
+            get
+            {
+                if (_package.Workbook.VbaProject != null)
+                {
+                    return _package.Workbook.VbaProject.Modules[CodeModuleName];
+                }
+                else
+                {
+                    return null;
+                }
+            }
+        }
+        #region WorksheetXml
+		/// <summary>
+		/// The XML document holding the worksheet data.
+        /// All column, row, cell, pagebreak, merged cell and hyperlink-data are loaded into memory and removed from the document when loading the document.        
+		/// </summary>
+		public XmlDocument WorksheetXml
+		{
+			get
+			{
+				return (_worksheetXml);
+			}
+		}
+        internal ExcelVmlDrawingCommentCollection _vmlDrawings = null;
+        /// <summary>
+        /// Vml drawings. underlaying object for comments
+        /// </summary>
+        internal ExcelVmlDrawingCommentCollection VmlDrawingsComments
+        {
+            get
+            {
+                if (_vmlDrawings == null)
+                {
+                    CreateVmlCollection();
+                }
+                return _vmlDrawings;
+            }
+        }
+        internal ExcelCommentCollection _comments = null;
+        /// <summary>
+        /// Collection of comments
+        /// </summary>
+        public ExcelCommentCollection Comments
+        {
+            get
+            {
+                CheckSheetType();
+                if (_comments == null)
+                {
+                    CreateVmlCollection();
+                    _comments = new ExcelCommentCollection(_package, this, NameSpaceManager);
+                }
+                return _comments;
+            }
+        }
+        private void CreateVmlCollection()
+        {
+            var vmlNode = _worksheetXml.DocumentElement.SelectSingleNode("d:legacyDrawing/@r:id", NameSpaceManager);
+            if (vmlNode == null)
+            {
+                _vmlDrawings = new ExcelVmlDrawingCommentCollection(_package, this, null);
+            }
+            else
+            {
+                if (Part.RelationshipExists(vmlNode.Value))
+                {
+                    var rel = Part.GetRelationship(vmlNode.Value);
+                    var vmlUri = UriHelper.ResolvePartUri(rel.SourceUri, rel.TargetUri);
+
+                    _vmlDrawings = new ExcelVmlDrawingCommentCollection(_package, this, vmlUri);
+                    _vmlDrawings.RelId = rel.Id;
+                }
+            }
+        }
+
+        private void CreateXml()
+        {
+            _worksheetXml = new XmlDocument();
+            _worksheetXml.PreserveWhitespace = ExcelPackage.preserveWhitespace;
+            Packaging.ZipPackagePart packPart = _package.Package.GetPart(WorksheetUri);
+            string xml = "";
+
+            // First Columns, rows, cells, mergecells, hyperlinks and pagebreakes are loaded from a xmlstream to optimize speed...
+            bool doAdjust = _package.DoAdjustDrawings;
+            _package.DoAdjustDrawings = false;
+            Stream stream = packPart.GetStream();
+
+            XmlTextReader xr = new XmlTextReader(stream);
+            xr.ProhibitDtd = true;
+            xr.WhitespaceHandling = WhitespaceHandling.None;
+            LoadColumns(xr);    //columnXml
+            long start = stream.Position;
+            LoadCells(xr);
+            var nextElementLength = GetAttributeLength(xr);
+            long end = stream.Position - nextElementLength;
+            LoadMergeCells(xr);
+            LoadHyperLinks(xr);
+            LoadRowPageBreakes(xr);
+            LoadColPageBreakes(xr);
+            //...then the rest of the Xml is extracted and loaded into the WorksheetXml document.
+            stream.Seek(0, SeekOrigin.Begin);
+            Encoding encoding;
+            xml = GetWorkSheetXml(stream, start, end, out encoding);
+
+            //first char is invalid sometimes?? 
+            if (xml[0] != '<')
+                LoadXmlSafe(_worksheetXml, xml.Substring(1, xml.Length - 1), encoding);
+            else
+                LoadXmlSafe(_worksheetXml, xml, encoding);
+
+            _package.DoAdjustDrawings = doAdjust;
+            ClearNodes();
+        }
+        /// <summary>
+        /// Get the lenth of the attributes
+        /// Conditional formatting attributes can be extremly long som get length of the attributes to finetune position.
+        /// </summary>
+        /// <param name="xr"></param>
+        /// <returns></returns>
+        private int GetAttributeLength(XmlTextReader xr)
+        {
+            if (xr.NodeType != XmlNodeType.Element) return 0;
+            var length = 0;
+            
+            for (int i = 0; i < xr.AttributeCount; i++)
+            {
+                var a=xr.GetAttribute(i);
+                length += string.IsNullOrEmpty(a) ? 0 : a.Length;
+            }
+            return length;
+        }
+        private void LoadRowPageBreakes(XmlTextReader xr)
+        {
+            if(!ReadUntil(xr, "rowBreaks","colBreaks")) return;
+            while (xr.Read())
+            {
+                if (xr.LocalName == "brk")
+                {
+                    if (xr.NodeType == XmlNodeType.Element)
+                    {
+                        int id;
+                        if (int.TryParse(xr.GetAttribute("id"), out id))
+                        {
+                            Row(id).PageBreak = true;
+                        }   
+                    }
+                }
+                else
+                {
+                    break;
+                }
+            }
+        }
+        private void LoadColPageBreakes(XmlTextReader xr)
+        {
+            if (!ReadUntil(xr, "colBreaks")) return;
+            while (xr.Read())
+            {
+                if (xr.LocalName == "brk")
+                {
+                    if (xr.NodeType == XmlNodeType.Element)
+                    {
+                        int id;
+                        if (int.TryParse(xr.GetAttribute("id"), out id))
+                        {
+                            Column(id).PageBreak = true;
+                        }
+                    }
+                }
+                else
+                {
+                    break;
+                }
+            }
+        }
+
+        private void ClearNodes()
+        {
+            if (_worksheetXml.SelectSingleNode("//d:cols", NameSpaceManager)!=null)
+            {
+                _worksheetXml.SelectSingleNode("//d:cols", NameSpaceManager).RemoveAll();
+            }
+            if (_worksheetXml.SelectSingleNode("//d:mergeCells", NameSpaceManager) != null)
+            {
+                _worksheetXml.SelectSingleNode("//d:mergeCells", NameSpaceManager).RemoveAll();
+            }
+            if (_worksheetXml.SelectSingleNode("//d:hyperlinks", NameSpaceManager) != null)
+            {
+                _worksheetXml.SelectSingleNode("//d:hyperlinks", NameSpaceManager).RemoveAll();
+            }
+            if (_worksheetXml.SelectSingleNode("//d:rowBreaks", NameSpaceManager) != null)
+            {
+                _worksheetXml.SelectSingleNode("//d:rowBreaks", NameSpaceManager).RemoveAll();
+            }
+            if (_worksheetXml.SelectSingleNode("//d:colBreaks", NameSpaceManager) != null)
+            {
+                _worksheetXml.SelectSingleNode("//d:colBreaks", NameSpaceManager).RemoveAll();
+            }
+        }
+        const int BLOCKSIZE=8192;
+        private string GetWorkSheetXml(Stream stream, long start, long end, out Encoding encoding)
+        {
+            StreamReader sr = new StreamReader(stream);
+            int length = 0;
+            char[] block;
+            int pos;
+            StringBuilder sb = new StringBuilder();            
+            Match startmMatch, endMatch;
+            do
+            {
+                int size = stream.Length < BLOCKSIZE ? (int)stream.Length : BLOCKSIZE;
+                block = new char[size];
+                pos = sr.ReadBlock(block, 0, size);                  
+                sb.Append(block,0,pos);
+                length += size;
+            }
+            while (length < start + 20 && length < end);
+            startmMatch = Regex.Match(sb.ToString(), string.Format("(<[^>]*{0}[^>]*>)", "sheetData"));
+            if (!startmMatch.Success) //Not found
+            {
+                encoding = sr.CurrentEncoding;
+                return sb.ToString();
+            }
+            else
+            {
+                string s = sb.ToString();
+                string xml = s.Substring(0, startmMatch.Index); 
+                if(startmMatch.Value.EndsWith("/>"))
+                {
+                    xml += s.Substring(startmMatch.Index, s.Length - startmMatch.Index);
+                }
+                else
+                {
+                    if (sr.Peek() != -1)
+                    {
+                        /**** Fixes issue 14788. Fix by Philip Garrett ****/
+                        long endSeekStart = end;
+
+                        while (endSeekStart >= 0)
+                        {
+                            endSeekStart = Math.Max(endSeekStart - BLOCKSIZE, 0);
+                            int size = (int)(end - endSeekStart);
+                            stream.Seek(endSeekStart, SeekOrigin.Begin);
+                            block = new char[size];
+                            sr = new StreamReader(stream);
+                            pos = sr.ReadBlock(block, 0, size);
+                            sb = new StringBuilder();
+                            sb.Append(block, 0, pos);
+                            s = sb.ToString();
+                            endMatch = Regex.Match(s, string.Format("(</[^>]*{0}[^>]*>)", "sheetData"));
+                            if (endMatch.Success)
+                            {
+                                break;
+                            }
+                        }
+                    }
+                    endMatch = Regex.Match(s, string.Format("(</[^>]*{0}[^>]*>)", "sheetData"));
+                    xml += "<sheetData/>" + s.Substring(endMatch.Index + endMatch.Length, s.Length - (endMatch.Index + endMatch.Length));
+                }
+                if (sr.Peek() > -1)
+                {
+                    xml += sr.ReadToEnd();
+                }
+                
+                encoding = sr.CurrentEncoding;
+                return xml;
+            }
+        }
+        private void GetBlockPos(string xml, string tag, ref int start, ref int end)
+        {
+            Match startmMatch, endMatch;
+            startmMatch = Regex.Match(xml.Substring(start), string.Format("(<[^>]*{0}[^>]*>)", tag)); //"<[a-zA-Z:]*" + tag + "[?]*>");
+
+            if (!startmMatch.Success) //Not found
+            {
+                start = -1;
+                end = -1;
+                return;
+            }
+            var startPos=startmMatch.Index+start;
+            if(startmMatch.Value.Substring(startmMatch.Value.Length-2,1)=="/")
+            {
+                end = startPos + startmMatch.Length;
+            }
+            else
+            {
+                endMatch = Regex.Match(xml.Substring(start), string.Format("(</[^>]*{0}[^>]*>)", tag));
+                if (endMatch.Success)
+                {
+                    end = endMatch.Index + endMatch.Length + start;
+                }
+            }
+            start = startPos;
+        }
+        private bool ReadUntil(XmlTextReader xr,params string[] tagName)
+        {
+            if (xr.EOF) return false;
+            while (!Array.Exists(tagName, tag => xr.LocalName.EndsWith(tag)))
+            {
+                xr.Read();
+                if (xr.EOF) return false;
+            }
+            return (xr.LocalName.EndsWith(tagName[0]));
+        }
+        private void LoadColumns (XmlTextReader xr)//(string xml)
+        {
+            var colList = new List<IRangeID>();
+            if (ReadUntil(xr, "cols", "sheetData"))
+            {
+            //if (xml != "")
+            //{
+                //var xr=new XmlTextReader(new StringReader(xml));
+                while(xr.Read())
+                {
+                    if (xr.NodeType == XmlNodeType.Whitespace) continue;
+                    if (xr.LocalName != "col") break;
+                    if (xr.NodeType == XmlNodeType.Element)
+                    {
+                        int min = int.Parse(xr.GetAttribute("min"));
+
+                        ExcelColumn col = new ExcelColumn(this, min);
+
+                        col.ColumnMax = int.Parse(xr.GetAttribute("max"));
+                        col.Width = xr.GetAttribute("width") == null ? 0 : double.Parse(xr.GetAttribute("width"), CultureInfo.InvariantCulture);
+                            col.BestFit = xr.GetAttribute("bestFit") != null && xr.GetAttribute("bestFit") == "1" ? true : false;
+                            col.Collapsed = xr.GetAttribute("collapsed") != null && xr.GetAttribute("collapsed") == "1" ? true : false;
+                            col.Phonetic = xr.GetAttribute("phonetic") != null && xr.GetAttribute("phonetic") == "1" ? true : false;
+                        col.OutlineLevel = (short)(xr.GetAttribute("outlineLevel") == null ? 0 : int.Parse(xr.GetAttribute("outlineLevel"), CultureInfo.InvariantCulture));
+                            col.Hidden = xr.GetAttribute("hidden") != null && xr.GetAttribute("hidden") == "1" ? true : false;
+                        _values.SetValue(0, min, col);
+                    
+                        int style;
+                        if (!(xr.GetAttribute("style") == null || !int.TryParse(xr.GetAttribute("style"), out style)))
+                        {
+                            _styles.SetValue(0, min, style);
+                        }
+                    }
+                }
+            }
+        }
+        /// <summary>
+        /// Read until the node is found. If not found the xmlreader is reseted.
+        /// </summary>
+        /// <param name="xr">The reader</param>
+        /// <param name="nodeText">Text to search for</param>
+        /// <param name="altNode">Alternative text to search for</param>
+        /// <returns></returns>
+        private static bool ReadXmlReaderUntil(XmlTextReader xr, string nodeText, string altNode)
+        {
+            do
+            {
+                if (xr.LocalName == nodeText || xr.LocalName == altNode) return true;
+            }
+            while(xr.Read());
+            xr.Close();
+            return false;
+        }
+        /// <summary>
+        /// Load Hyperlinks
+        /// </summary>
+        /// <param name="xr">The reader</param>
+        private void LoadHyperLinks(XmlTextReader xr)
+        {
+            if (!ReadUntil(xr, "hyperlinks", "rowBreaks", "colBreaks")) return;
+            while (xr.Read())
+            {
+                if (xr.LocalName == "hyperlink")
+                {
+                    int fromRow, fromCol, toRow, toCol;
+                    ExcelCellBase.GetRowColFromAddress(xr.GetAttribute("ref"), out fromRow, out fromCol, out toRow, out toCol);
+                    ExcelHyperLink hl = null;
+                    if (xr.GetAttribute("id", ExcelPackage.schemaRelationships) != null)
+                    {
+                        var rId = xr.GetAttribute("id", ExcelPackage.schemaRelationships);
+                        var uri = Part.GetRelationship(rId).TargetUri;
+                        if (uri.IsAbsoluteUri)
+                        {
+                            try
+                            {
+                                hl = new ExcelHyperLink(uri.AbsoluteUri);
+                            }
+                            catch
+                            {
+                                hl = new ExcelHyperLink(uri.OriginalString, UriKind.Absolute);
+                            }
+                        }
+                        else
+                        {
+                            hl = new ExcelHyperLink(uri.OriginalString, UriKind.Relative);
+                        }
+                        hl.RId = rId;
+                        Part.DeleteRelationship(rId); //Delete the relationship, it is recreated when we save the package.
+                    }
+                    else if (xr.GetAttribute("location") != null)
+                    {
+                        hl = new ExcelHyperLink(xr.GetAttribute("location"), xr.GetAttribute("display"));
+                        hl.RowSpann = toRow - fromRow;
+                        hl.ColSpann = toCol - fromCol;
+                    }
+
+                    string tt = xr.GetAttribute("tooltip");
+                    if (!string.IsNullOrEmpty(tt))
+                    {
+                        hl.ToolTip = tt;
+                    }
+                    _hyperLinks.SetValue(fromRow, fromCol, hl);
+                }
+                else
+                {
+                    break;
+                }
+            }
+        }
+        /// <summary>
+        /// Load cells
+        /// </summary>
+        /// <param name="xr">The reader</param>
+        private void LoadCells(XmlTextReader xr)
+        {
+            //var cellList=new List<IRangeID>();
+            //var rowList = new List<IRangeID>();
+            //var formulaList = new List<IRangeID>();
+            ReadUntil(xr, "sheetData", "mergeCells", "hyperlinks", "rowBreaks", "colBreaks");
+            ExcelAddressBase address=null;
+            string type="";
+            int style=0;
+            int row = 0;
+            int col = 0;
+            xr.Read();
+            
+            while (!xr.EOF)
+            {
+                while (xr.NodeType == XmlNodeType.EndElement)
+                {
+                    xr.Read();
+                    continue;
+                }                
+                if (xr.LocalName == "row")
+                {
+                    var r = xr.GetAttribute("r");
+                    if (r == null)
+                    {
+                        row++;
+                    }
+                    else
+                    {
+                        row = Convert.ToInt32(r);
+                    }
+
+                    if (DoAddRow(xr))
+                    {
+                        _values.SetValue(row, 0, AddRow(xr, row));
+                        if(xr.GetAttribute("s") != null)
+                        {
+                            _styles.SetValue(row, 0, int.Parse(xr.GetAttribute("s"), CultureInfo.InvariantCulture));
+                        }
+                    }
+                    xr.Read();
+                }
+                else if (xr.LocalName == "c")
+                {
+                    //if (cell != null) cellList.Add(cell);
+                    //cell = new ExcelCell(this, xr.GetAttribute("r"));
+                    var r = xr.GetAttribute("r");
+                    if (r == null)
+                    {
+                        //Handle cells with no reference
+                        col++;
+                        address = new ExcelAddressBase(row, col, row, col);
+                    }
+                    else
+                    {
+                        address = new ExcelAddressBase(r);
+                        col = address._fromCol;
+                    }
+
+                    
+                    //Datetype
+                    if (xr.GetAttribute("t") != null)
+                    {
+                        type=xr.GetAttribute("t");
+                        _types.SetValue(address._fromRow, address._fromCol, type); 
+                    }
+                    else
+                    {
+                        type="";
+                    }
+                    //Style
+                    if(xr.GetAttribute("s") != null)
+                    {
+                        style=int.Parse(xr.GetAttribute("s"));
+                        _styles.SetValue(address._fromRow, address._fromCol, style);
+                        _values.SetValue(address._fromRow, address._fromCol, null); //TODO:Better Performance ??
+                    }
+                    else
+                    {
+                        style = 0;
+                    }
+                    xr.Read();
+                }
+                else if (xr.LocalName == "v")
+                {
+                    SetValueFromXml(xr, type, style, address._fromRow, address._fromCol);
+                    
+                    xr.Read();
+                }
+                else if (xr.LocalName == "f")
+                {
+                    string t = xr.GetAttribute("t");
+                    if (t == null)
+                    {
+                        _formulas.SetValue(address._fromRow, address._fromCol, xr.ReadElementContentAsString());
+                        _values.SetValue(address._fromRow, address._fromCol, null);
+                        //formulaList.Add(cell);
+                    }
+                    else if (t == "shared")
+                    {
+
+                        string si = xr.GetAttribute("si");
+                        if (si != null)
+                        {
+                            var sfIndex = int.Parse(si);
+                            _formulas.SetValue(address._fromRow, address._fromCol, sfIndex);
+                            _values.SetValue(address._fromRow, address._fromCol, null);
+                            string fAddress = xr.GetAttribute("ref");
+                            string formula = xr.ReadElementContentAsString();
+                            if (formula != "")
+                            {
+                                _sharedFormulas.Add(sfIndex, new Formulas(SourceCodeTokenizer.Default) { Index = sfIndex, Formula = formula, Address = fAddress, StartRow = address._fromRow, StartCol = address._fromCol });
+                            }
+                        }
+                        else
+                        {
+                            xr.Read();  //Something is wrong in the sheet, read next
+                        }
+                    }
+                    else if (t == "array") //TODO: Array functions are not support yet. Read the formula for the start cell only.
+                    {
+                        string aAddress = xr.GetAttribute("ref");
+                        string formula = xr.ReadElementContentAsString();
+                        var afIndex = GetMaxShareFunctionIndex(true);
+                        _formulas.SetValue(address._fromRow, address._fromCol, afIndex);
+                        _values.SetValue(address._fromRow, address._fromCol, null);
+                        _sharedFormulas.Add(afIndex, new Formulas(SourceCodeTokenizer.Default) { Index = afIndex, Formula = formula, Address = aAddress, StartRow = address._fromRow, StartCol = address._fromCol, IsArray = true });
+                    }
+                    else // ??? some other type
+                    {
+                        xr.Read();  //Something is wrong in the sheet, read next
+                    }
+
+                }
+                else if (xr.LocalName == "is")   //Inline string
+                {
+                    xr.Read();
+                    if (xr.LocalName == "t")
+                    {
+                        _values.SetValue(address._fromRow, address._fromCol, xr.ReadInnerXml());
+                        //cell._value = xr.ReadInnerXml();
+                    }
+                    else
+                    {
+                        _values.SetValue(address._fromRow, address._fromCol, xr.ReadOuterXml());
+                        _types.SetValue(address._fromRow, address._fromCol, "rt");
+                        _flags.SetFlagValue(address._fromRow, address._fromCol, true, CellFlags.RichText);
+                        //cell.IsRichText = true;
+                    }
+                }
+                else
+                {
+                    break;
+                }
+            }
+            //if (cell != null) cellList.Add(cell);
+
+            //_cells = new RangeCollection(cellList);
+            //_rows = new RangeCollection(rowList);
+            //_formulaCells = new RangeCollection(formulaList);
+        }
+
+        private bool DoAddRow(XmlTextReader xr)
+        {
+            var c = xr.GetAttribute("r")==null ? 0:1;
+            if (xr.GetAttribute("spans") != null)
+            {
+                c++;
+            }
+            return xr.AttributeCount > c;
+        }
+        /// <summary>
+        /// Load merged cells
+        /// </summary>
+        /// <param name="xr"></param>
+        private void LoadMergeCells(XmlTextReader xr)
+        {
+            if(ReadUntil(xr, "mergeCells", "hyperlinks", "rowBreaks", "colBreaks") && !xr.EOF)
+            {
+                while (xr.Read())
+                {                    
+                    if (xr.LocalName != "mergeCell") break;
+                    if (xr.NodeType == XmlNodeType.Element)
+                    {
+                        string address = xr.GetAttribute("ref");
+                        //int fromRow, fromCol, toRow, toCol;
+                        //ExcelCellBase.GetRowColFromAddress(address, out fromRow, out fromCol, out toRow, out toCol);
+                        //for (int row = fromRow; row <= toRow; row++)
+                        //{
+                        //    for (int col = fromCol; col <= toCol; col++)
+                        //    {
+                        //        _flags.SetFlagValue(row, col, true,CellFlags.Merged);
+                        //    }
+                        //}
+                        //_mergedCells.List.Add(address);
+                        _mergedCells.Add(new ExcelAddress(address), false);
+                    }
+                }
+            }
+        }
+        /// <summary>
+        /// Update merged cells
+        /// </summary>
+        /// <param name="sw">The writer</param>
+        private void UpdateMergedCells(StreamWriter sw)
+        {
+            sw.Write("<mergeCells>");
+            foreach (string address in _mergedCells)
+            {
+                sw.Write("<mergeCell ref=\"{0}\" />", address);
+            }
+            sw.Write("</mergeCells>");
+        }
+        /// <summary>
+        /// Reads a row from the XML reader
+        /// </summary>
+        /// <param name="xr">The reader</param>
+        /// <param name="row">The row number</param>
+        /// <returns></returns>
+        private RowInternal AddRow(XmlTextReader xr, int row)
+        {
+            return new RowInternal()
+            {
+                Collapsed=(xr.GetAttribute("collapsed") != null && xr.GetAttribute("collapsed")== "1" ? true : false),
+                OutlineLevel = (xr.GetAttribute("outlineLevel") == null ? (short)0 : short.Parse(xr.GetAttribute("outlineLevel"), CultureInfo.InvariantCulture)),
+                Height = (xr.GetAttribute("ht") == null ? -1 : double.Parse(xr.GetAttribute("ht"), CultureInfo.InvariantCulture)),
+                Hidden = (xr.GetAttribute("hidden") != null && xr.GetAttribute("hidden") == "1" ? true : false),
+                Phonetic = xr.GetAttribute("ph") != null && xr.GetAttribute("ph") == "1" ? true : false,
+                CustomHeight = xr.GetAttribute("customHeight") == null ? false : xr.GetAttribute("customHeight")=="1"
+            };
+        }
+
+        private void SetValueFromXml(XmlTextReader xr, string type, int styleID, int row, int col)
+        {
+            //XmlNode vnode = colNode.SelectSingleNode("d:v", NameSpaceManager);
+            //if (vnode == null) return null;
+            if (type == "s")
+            {
+                int ix = xr.ReadElementContentAsInt();
+                _values.SetValue(row, col, _package.Workbook._sharedStringsList[ix].Text);
+                if (_package.Workbook._sharedStringsList[ix].isRichText)
+                {
+                    _flags.SetFlagValue(row, col, true, CellFlags.RichText);
+                }                
+            }
+            else if (type == "str")
+            {
+                _values.SetValue(row, col, ConvertUtil.ExcelDecodeString(xr.ReadElementContentAsString()));
+            }
+            else if (type == "b")
+            {
+                _values.SetValue(row, col, (xr.ReadElementContentAsString()!="0"));
+            }
+            else if (type == "e")
+            {
+                _values.SetValue(row, col, GetErrorType(xr.ReadElementContentAsString()));
+            }
+            else
+            {
+                string v = xr.ReadElementContentAsString();
+                var nf = Workbook.Styles.CellXfs[styleID].NumberFormatId;
+                if ((nf >= 14 && nf <= 22) || (nf >= 45 && nf <= 47))
+                {
+                    double res;
+                    if (double.TryParse(v, NumberStyles.Any, CultureInfo.InvariantCulture, out res))
+                    {
+                        if (Workbook.Date1904)
+                        {
+                            res += ExcelWorkbook.date1904Offset;
+                        }
+                        if (res >= -657435.0 && res < 2958465.9999999)
+                        {
+                            _values.SetValue(row, col, DateTime.FromOADate(res));
+                        }
+                        else
+                        {
+                            _values.SetValue(row, col, "");
+                        } 
+                    }
+                    else
+                    {
+                        _values.SetValue(row, col, "");
+                    }
+                }
+                else
+                {
+                    double d;
+                    if (double.TryParse(v, NumberStyles.Any, CultureInfo.InvariantCulture, out d))
+                    {
+                        _values.SetValue(row, col, d);
+                    }
+                    else
+                    {
+                        _values.SetValue(row, col, double.NaN);
+                    }
+                }
+            }
+        }
+
+        private object GetErrorType(string v)
+        {
+            return ExcelErrorValue.Parse(v.ToUpper(CultureInfo.InvariantCulture));
+            //switch(v.ToUpper())
+            //{
+            //    case "#DIV/0!":
+            //        return new ExcelErrorValue.cre(eErrorType.Div0);
+            //    case "#REF!":
+            //        return new ExcelErrorValue(eErrorType.Ref);
+            //    case "#N/A":
+            //        return new ExcelErrorValue(eErrorType.NA);
+            //    case "#NAME?":
+            //        return new ExcelErrorValue(eErrorType.Name);
+            //    case "#NULL!":
+            //        return new ExcelErrorValue(eErrorType.Null);
+            //    case "#NUM!":
+            //        return new ExcelErrorValue(eErrorType.Num);
+            //    default:
+            //        return new ExcelErrorValue(eErrorType.Value);
+            //}
+        }
+        //private string GetSharedString(int stringID)
+        //{
+        //    string retValue = null;
+        //    XmlNodeList stringNodes = xlPackage.Workbook.SharedStringsXml.SelectNodes(string.Format("//d:si", stringID), NameSpaceManager);
+        //    XmlNode stringNode = stringNodes[stringID];
+        //    if (stringNode != null)
+        //        retValue = stringNode.InnerText;
+        //    return (retValue);
+        //}
+        #endregion
+		#region HeaderFooter
+		/// <summary>
+		/// A reference to the header and footer class which allows you to 
+		/// set the header and footer for all odd, even and first pages of the worksheet
+        /// </summary>
+        /// <remarks>
+        /// To format the text you can use the following format
+        /// <list type="table">
+        /// <listheader><term>Prefix</term><description>Description</description></listheader>
+        /// <item><term>&amp;U</term><description>Underlined</description></item>
+        /// <item><term>&amp;E</term><description>Double Underline</description></item>
+        /// <item><term>&amp;K:xxxxxx</term><description>Color. ex &amp;K:FF0000 for red</description></item>
+        /// <item><term>&amp;"Font,Regular Bold Italic"</term><description>Changes the font. Regular or Bold or Italic or Bold Italic can be used. ex &amp;"Arial,Bold Italic"</description></item>
+        /// <item><term>&amp;nn</term><description>Change font size. nn is an integer. ex &amp;24</description></item>
+        /// <item><term>&amp;G</term><description>Placeholder for images. Images can not be added by the library, but its possible to use in a template.</description></item>
+        /// </list>
+        /// </remarks>
+        public ExcelHeaderFooter HeaderFooter
+		{
+			get
+			{
+				if (_headerFooter == null)
+				{
+                    XmlNode headerFooterNode = TopNode.SelectSingleNode("d:headerFooter", NameSpaceManager);
+                    if (headerFooterNode == null)
+                        headerFooterNode= CreateNode("d:headerFooter");
+                    _headerFooter = new ExcelHeaderFooter(NameSpaceManager, headerFooterNode, this);
+				}                
+				return (_headerFooter);
+			}
+		}
+		#endregion
+
+        #region "PrinterSettings"
+        /// <summary>
+        /// Printer settings
+        /// </summary>
+        public ExcelPrinterSettings PrinterSettings
+        {
+            get
+            {
+                var ps = new ExcelPrinterSettings(NameSpaceManager, TopNode, this);
+                ps.SchemaNodeOrder = SchemaNodeOrder;
+                return ps;
+            }
+        }
+        #endregion
+
+		#endregion // END Worksheet Public Properties
+
+		#region Worksheet Public Methods
+        
+        ///// <summary>
+        ///// Provides access to an individual cell within the worksheet.
+        ///// </summary>
+        ///// <param name="row">The row number in the worksheet</param>
+        ///// <param name="col">The column number in the worksheet</param>
+        ///// <returns></returns>		
+        //internal ExcelCell Cell(int row, int col)
+        //{
+        //    return new ExcelCell(_values, row, col);
+        //}
+         /// <summary>
+         /// Provides access to a range of cells
+        /// </summary>  
+        public ExcelRange Cells
+        {
+            get
+            {
+                CheckSheetType();
+                return new ExcelRange(this, 1, 1, ExcelPackage.MaxRows, ExcelPackage.MaxColumns);
+            }
+        }
+        /// <summary>
+        /// Provides access to the selected range of cells
+        /// </summary>  
+        public ExcelRange SelectedRange
+        {
+            get
+            {
+                CheckSheetType();
+                return new ExcelRange(this, View.SelectedRange);
+            }
+        }
+        MergeCellsCollection _mergedCells = new MergeCellsCollection();
+        /// <summary>
+        /// Addresses to merged ranges
+        /// </summary>
+        public MergeCellsCollection MergedCells
+        {
+            get
+            {
+                CheckSheetType();
+                return _mergedCells;
+            }
+        }
+        /// <summary>
+		/// Provides access to an individual row within the worksheet so you can set its properties.
+		/// </summary>
+		/// <param name="row">The row number in the worksheet</param>
+		/// <returns></returns>
+		public ExcelRow Row(int row)
+		{
+            //ExcelRow r;
+            //ulong id = ExcelRow.GetRowID(_sheetID, row);
+            //TODO: Fixa.
+            //var v = _values.GetValue(row, 0);
+            //if (v!=null)
+            //{
+            //    var ri=(RowInternal)v;
+            //    r = new ExcelRow(this, row)
+            //}
+            //else
+            //{
+                //r = new ExcelRow(this, row);
+                //_values.SetValue(row, 0, r);
+                //_rows.Add(r);
+            //}
+            CheckSheetType();
+            if (row < 1 || row > ExcelPackage.MaxRows)
+            {
+                throw (new ArgumentException("Row number out of bounds"));
+            }
+            return new ExcelRow(this, row);
+            //return r;
+		}
+		/// <summary>
+		/// Provides access to an individual column within the worksheet so you can set its properties.
+		/// </summary>
+		/// <param name="col">The column number in the worksheet</param>
+		/// <returns></returns>
+		public ExcelColumn Column(int col)
+		{            
+            CheckSheetType();
+            if (col < 1 || col > ExcelPackage.MaxColumns)
+            {
+                throw (new ArgumentException("Column number out of bounds"));
+            }
+            var column = _values.GetValue(0, col) as ExcelColumn;
+            if (column!=null)
+            {                
+                
+                if (column.ColumnMin != column.ColumnMax)
+                {
+                    int maxCol = column.ColumnMax;
+                    column.ColumnMax = col;
+                    ExcelColumn copy = CopyColumn(column, col + 1, maxCol);
+                }
+            }
+            else
+            {
+                int r=0, c=col;
+                if (_values.PrevCell(ref r, ref c))
+                {
+                    column = _values.GetValue(0, c) as ExcelColumn;
+                    int maxCol = column.ColumnMax;
+                    if (maxCol >= col)
+                    {
+                        column.ColumnMax = col-1;
+                        if (maxCol > col)
+                        {
+                            ExcelColumn newC = CopyColumn(column, col + 1, maxCol);
+                        }
+                        return CopyColumn(column, col, col);
+                    }
+                }
+                //foreach (ExcelColumn checkColumn in _columns)
+                //{
+                //    if (col > checkColumn.ColumnMin && col <= checkColumn.ColumnMax)
+                //    {
+                //        int maxCol = checkColumn.ColumnMax;
+                //        checkColumn.ColumnMax = col - 1;
+                //        if (maxCol > col)
+                //        {
+                //            ExcelColumn newC = CopyColumn(checkColumn, col + 1, maxCol);
+                //        }
+                //        return CopyColumn(checkColumn, col,col);                        
+                //    }
+                //}
+                column = new ExcelColumn(this, col);
+                _values.SetValue(0, col, column);
+                //_columns.Add(column);
+             }
+            return column;
+		}
+        /// <summary>
+        /// Returns the name of the worksheet
+        /// </summary>
+        /// <returns>The name of the worksheet</returns>
+        public override string ToString()
+        {
+            return Name;
+        }
+        internal ExcelColumn CopyColumn(ExcelColumn c, int col, int maxCol)
+        {
+            ExcelColumn newC = new ExcelColumn(this, col);
+            newC.ColumnMax = maxCol < ExcelPackage.MaxColumns ? maxCol : ExcelPackage.MaxColumns;
+            if (c.StyleName != "")
+                newC.StyleName = c.StyleName;
+            else
+                newC.StyleID = c.StyleID;
+
+            newC._hidden = c.Hidden;
+            newC.OutlineLevel = c.OutlineLevel;
+            newC.Phonetic = c.Phonetic;
+            newC.BestFit = c.BestFit;
+            //_columns.Add(newC);
+            _values.SetValue(0, col, newC);
+            newC.Width = c._width;
+            return newC;
+       }
+        /// <summary>
+        /// Make the current worksheet active.
+        /// </summary>
+        public void Select()
+        {
+            View.TabSelected = true;
+            //Select(Address, true);
+        }
+        /// <summary>
+        /// Selects a range in the worksheet. The active cell is the topmost cell.
+        /// Make the current worksheet active.
+        /// </summary>
+        /// <param name="Address">An address range</param>
+        public void Select(string Address)
+        {
+            Select(Address, true);
+        }
+        /// <summary>
+        /// Selects a range in the worksheet. The actice cell is the topmost cell.
+        /// </summary>
+        /// <param name="Address">A range of cells</param>
+        /// <param name="SelectSheet">Make the sheet active</param>
+        public void Select(string Address, bool SelectSheet)
+        {
+            CheckSheetType();
+            int fromCol, fromRow, toCol, toRow;
+            //Get rows and columns and validate as well
+            ExcelCellBase.GetRowColFromAddress(Address, out fromRow, out fromCol, out toRow, out toCol);
+
+            if (SelectSheet)
+            {
+                View.TabSelected = true;
+            }
+            View.SelectedRange = Address;
+            View.ActiveCell = ExcelCellBase.GetAddress(fromRow, fromCol);            
+        }
+        /// <summary>
+        /// Selects a range in the worksheet. The active cell is the topmost cell of the first address.
+        /// Make the current worksheet active.
+        /// </summary>
+        /// <param name="Address">An address range</param>
+        public void Select(ExcelAddress Address)
+        {
+            CheckSheetType();
+            Select(Address, true);
+        }
+        /// <summary>
+        /// Selects a range in the worksheet. The active cell is the topmost cell of the first address.
+        /// </summary>
+        /// <param name="Address">A range of cells</param>
+        /// <param name="SelectSheet">Make the sheet active</param>
+        public void Select(ExcelAddress Address, bool SelectSheet)
+        {
+
+            CheckSheetType();
+            if (SelectSheet)
+            {
+                View.TabSelected = true;
+            }
+            string selAddress = ExcelCellBase.GetAddress(Address.Start.Row, Address.Start.Column) + ":" + ExcelCellBase.GetAddress(Address.End.Row, Address.End.Column);
+            if (Address.Addresses != null)
+            {
+                foreach (var a in Address.Addresses)
+                {
+                    selAddress += " " + ExcelCellBase.GetAddress(a.Start.Row, a.Start.Column) + ":" + ExcelCellBase.GetAddress(a.End.Row, a.End.Column);
+                }
+            }
+            View.SelectedRange = selAddress;
+            View.ActiveCell = ExcelCellBase.GetAddress(Address.Start.Row, Address.Start.Column);
+        }
+
+		#region InsertRow
+        /// <summary>
+        /// Inserts a new row into the spreadsheet.  Existing rows below the position are 
+        /// shifted down.  All formula are updated to take account of the new row.
+        /// </summary>
+        /// <param name="rowFrom">The position of the new row</param>
+        /// <param name="rows">Number of rows to insert</param>
+        public void InsertRow(int rowFrom, int rows)
+        {
+            InsertRow(rowFrom, rows, 0);
+        }
+        /// <summary>
+		/// Inserts a new row into the spreadsheet.  Existing rows below the position are 
+		/// shifted down.  All formula are updated to take account of the new row.
+		/// </summary>
+        /// <param name="rowFrom">The position of the new row</param>
+        /// <param name="rows">Number of rows to insert.</param>
+        /// <param name="copyStylesFromRow">Copy Styles from this row. Applied to all inserted rows</param>
+		public void  InsertRow(int rowFrom, int rows, int copyStylesFromRow)
+		{
+            CheckSheetType();
+                var d = Dimension;
+
+            if (rowFrom < 1)
+            {
+                throw (new ArgumentOutOfRangeException("rowFrom can't be lesser that 1"));
+            }
+
+            //Check that cells aren't shifted outside the boundries
+            if (d != null && d.End.Row > rowFrom && d.End.Row + rows > ExcelPackage.MaxRows)
+            {
+                throw (new ArgumentOutOfRangeException("Can't insert. Rows will be shifted outside the boundries of the worksheet."));
+            }
+
+            lock (this)
+            {
+                _values.Insert(rowFrom, 0, rows, 0);
+                _formulas.Insert(rowFrom, 0, rows, 0);
+                _styles.Insert(rowFrom, 0, rows, 0);
+                _types.Insert(rowFrom, 0, rows, 0);
+                _commentsStore.Insert(rowFrom, 0, rows, 0);
+                _hyperLinks.Insert(rowFrom, 0, rows, 0);
+                _flags.Insert(rowFrom, 0, rows, 0);
+
+                foreach (var f in _sharedFormulas.Values)
+                {
+                    if (f.StartRow >= rowFrom) f.StartRow += rows;
+                    var a = new ExcelAddressBase(f.Address);
+                    if (a._fromRow >= rowFrom)
+                    {
+                        a._fromRow += rows;
+                        a._toRow += rows;
+                    }
+                    else if (a._toRow >= rowFrom)
+                    {
+                        a._toRow += rows;
+                    }
+                    f.Address = ExcelAddressBase.GetAddress(a._fromRow, a._fromCol, a._toRow, a._toCol);
+                    f.Formula = ExcelCellBase.UpdateFormulaReferences(f.Formula, rows, 0, rowFrom, 0);
+                }
+                var cse = new CellsStoreEnumerator<object>(_formulas);
+                while (cse.Next())
+                {
+                    if (cse.Value is string)
+                    {
+                        cse.Value = ExcelCellBase.UpdateFormulaReferences(cse.Value.ToString(), rows, 0, rowFrom, 0);
+                    }
+                }
+
+                FixMergedCellsRow(rowFrom, rows, false);
+                if (copyStylesFromRow > 0)
+                {
+                    var cseS = new CellsStoreEnumerator<int>(_styles, copyStylesFromRow, 0, copyStylesFromRow, ExcelPackage.MaxColumns); //Fixes issue 15068 , 15090
+                    while(cseS.Next())
+                    {
+                        for (var r = 0; r < rows; r++)
+                        {
+                            _styles.SetValue(rowFrom + r, cseS.Column, cseS.Value);
+                        }
+                    }
+                }
+                foreach (var tbl in Tables)
+                {
+                    tbl.Address = tbl.Address.AddRow(rowFrom, rows);
+                }
+            }
+        }
+        /// <summary>
+        /// Inserts a new column into the spreadsheet.  Existing columns below the position are 
+        /// shifted down.  All formula are updated to take account of the new column.
+        /// </summary>
+        /// <param name="columnFrom">The position of the new column</param>
+        /// <param name="columns">Number of columns to insert</param>        
+        public void InsertColumn(int columnFrom, int columns)
+        {
+            InsertColumn(columnFrom, columns, 0);
+        }
+        ///<summary>
+        /// Inserts a new column into the spreadsheet.  Existing column to the left are 
+        /// shifted.  All formula are updated to take account of the new column.
+        /// </summary>
+        /// <param name="columnFrom">The position of the new column</param>
+        /// <param name="columns">Number of columns to insert.</param>
+        /// <param name="copyStylesFromColumn">Copy Styles from this column. Applied to all inserted columns</param>
+        public void InsertColumn(int columnFrom, int columns, int copyStylesFromColumn)
+        {
+            CheckSheetType();
+            var d = Dimension;
+
+            if (columnFrom < 1)
+            {
+                throw (new ArgumentOutOfRangeException("columnFrom can't be lesser that 1"));
+            }            
+            //Check that cells aren't shifted outside the boundries
+            if (d != null && d.End.Column > columnFrom && d.End.Column + columns > ExcelPackage.MaxColumns)
+            {
+                throw (new ArgumentOutOfRangeException("Can't insert. Columns will be shifted outside the boundries of the worksheet."));
+            }
+
+            lock (this)
+            {
+                _values.Insert(0, columnFrom, 0, columns);
+                _formulas.Insert(0, columnFrom, 0, columns);
+                _styles.Insert(0, columnFrom, 0, columns);
+                _types.Insert(0, columnFrom, 0, columns);
+                _commentsStore.Insert(0, columnFrom, 0, columns);
+                _hyperLinks.Insert(0, columnFrom, 0, columns);
+                _flags.Insert(0, columnFrom, 0, columns);
+
+                foreach (var f in _sharedFormulas.Values)
+                {
+                    if (f.StartCol >= columnFrom) f.StartCol += columns;
+                    var a = new ExcelAddressBase(f.Address);
+                    if (a._fromCol >= columnFrom)
+                    {
+                        a._fromCol += columns;
+                        a._toCol += columns;
+                    }
+                    else if (a._toCol >= columnFrom)
+                    {
+                        a._toCol += columns;
+                    }
+                    f.Address = ExcelAddressBase.GetAddress(a._fromRow, a._fromCol, a._toRow, a._toCol);
+                    f.Formula = ExcelCellBase.UpdateFormulaReferences(f.Formula, 0, columns, 0, columnFrom);
+                }
+
+                var cse = new CellsStoreEnumerator<object>(_formulas);
+                while (cse.Next())
+                {
+                    if (cse.Value is string)
+                    {
+                        cse.Value = ExcelCellBase.UpdateFormulaReferences(cse.Value.ToString(), 0, columns, 0, columnFrom);
+                    }
+                }
+
+                FixMergedCellsColumn(columnFrom, columns, false);
+
+                var csec = new CellsStoreEnumerator<object>(_values, 0, 1, 0, ExcelPackage.MaxColumns);
+                var lst = new List<ExcelColumn>();
+                foreach (var col in csec)
+                {
+                    if (col is ExcelColumn)
+                    {
+                        lst.Add((ExcelColumn)col);
+                    }
+                }
+
+                for (int i = lst.Count-1; i >= 0; i--)
+                {
+                    var c = lst[i];
+                    if (c._columnMin >= columnFrom)
+                    {
+                        if (c._columnMin + columns <= ExcelPackage.MaxColumns)
+                        {
+                            c._columnMin += columns;
+                        }
+                        else
+                        {
+                            c._columnMin = ExcelPackage.MaxColumns;
+                        }
+                        
+                        if (c._columnMax + columns <= ExcelPackage.MaxColumns)
+                        {
+                            c._columnMax += columns;
+                        }
+                        else
+                        {
+                            c._columnMax = ExcelPackage.MaxColumns;
+                        }
+                    }
+                    else if (c._columnMax >= columnFrom)
+                    {
+                        var cc = c._columnMax - columnFrom;
+                        c._columnMax = columnFrom - 1;
+                        CopyColumn(c, columnFrom + columns, columnFrom + columns + cc);
+                    }                    
+                }
+
+
+                if (copyStylesFromColumn > 0)
+                {
+                    for (var c = 0; c < columns; c++)
+                    {
+                        var col = this.Column(columnFrom + c);
+                        col.StyleID = this.Column(copyStylesFromColumn).StyleID;
+                    }
+                }
+                //Adjust tables
+                foreach (var tbl in Tables)
+                {
+                    if (columnFrom > tbl.Address.Start.Column && columnFrom <= tbl.Address.End.Column)
+                    {
+                        InsertTableColumns(columnFrom, columns, tbl);
+                    }
+
+                    tbl.Address=tbl.Address.AddColumn(columnFrom, columns);
+                }
+            }
+        }
+
+        private static void InsertTableColumns(int columnFrom, int columns, ExcelTable tbl)
+        {
+            var node = tbl.Columns[0].TopNode.ParentNode;
+            var ix = columnFrom - tbl.Address.Start.Column - 1;
+            var insPos = node.ChildNodes[ix];
+            ix += 2;
+            for (int i = 0; i < columns; i++)
+            {
+                var name =
+                    tbl.Columns.GetUniqueName(string.Format("Column{0}",
+                        (ix++).ToString(CultureInfo.InvariantCulture)));
+                XmlElement tableColumn =
+                    (XmlElement) tbl.TableXml.CreateNode(XmlNodeType.Element, "tableColumn", ExcelPackage.schemaMain);
+                tableColumn.SetAttribute("id", (tbl.Columns.Count + i + 1).ToString(CultureInfo.InvariantCulture));
+                tableColumn.SetAttribute("name", name);
+                insPos = node.InsertAfter(tableColumn, insPos);
+            } //Create tbl Column
+            tbl._cols = new ExcelTableColumnCollection(tbl);
+        }
+
+        /// <summary>
+        /// Adds a value to the row of merged cells to fix for inserts or deletes
+        /// </summary>
+        /// <param name="row"></param>
+        /// <param name="rows"></param> 
+        /// <param name="delete"></param>
+        private void FixMergedCellsRow(int row, int rows, bool delete)
+        {
+            List<int> removeIndex = new List<int>();
+            for (int i = 0; i < _mergedCells.Count; i++)
+            {
+                if (!string.IsNullOrEmpty( _mergedCells[i]))
+                {
+                    ExcelAddressBase addr = new ExcelAddressBase(_mergedCells[i]), newAddr;
+                    if (delete)
+                    {
+                        newAddr = addr.DeleteRow(row, rows);
+                        _mergedCells._cells.Delete(row, 0, rows, 0);
+                        if (newAddr == null)
+                        {
+                            removeIndex.Add(i);
+                            continue;
+                        }
+                    }
+                    else
+                    {
+                        newAddr = addr.AddRow(row, rows);
+                        if (newAddr.Address != addr.Address)
+                        {
+                            _mergedCells._cells.Insert(row, 0, rows, 0);
+                            _mergedCells.SetIndex(newAddr, i);
+                        }
+                    }
+
+                    if (newAddr.Address != addr.Address)
+                    {
+                        _mergedCells.List[i] = newAddr._address;
+                    }
+                }
+            }
+            for (int i = removeIndex.Count - 1; i >= 0; i--)
+            {
+                _mergedCells.List.RemoveAt(removeIndex[i]);
+            }
+        }
+        /// <summary>
+        /// Adds a value to the row of merged cells to fix for inserts or deletes
+        /// </summary>
+        /// <param name="column"></param>
+        /// <param name="columns"></param>
+        /// <param name="delete"></param>
+        private void FixMergedCellsColumn(int column, int columns, bool delete)
+        {
+            List<int> removeIndex = new List<int>();
+            for (int i = 0; i < _mergedCells.Count; i++)
+            {
+                if (!string.IsNullOrEmpty(_mergedCells[i]))
+                {
+                    ExcelAddressBase addr = new ExcelAddressBase(_mergedCells[i]), newAddr;
+                    if (delete)
+                    {
+                        newAddr = addr.DeleteColumn(column, columns);
+                        _mergedCells._cells.Delete(0, column, 0, columns);
+                        if (newAddr == null)
+                        {
+                            removeIndex.Add(i);
+                            continue;
+                        }
+                    }
+                    else
+                    {
+                        newAddr = addr.AddColumn(column, columns);
+                        if (newAddr.Address != addr.Address)
+                        {
+                            _mergedCells._cells.Insert(0, column, 0, columns);
+                            _mergedCells.SetIndex(newAddr, i);
+                        }
+                    }
+
+                    if (newAddr.Address != addr.Address)
+                    {
+                        _mergedCells.List[i] = newAddr._address;
+                    }
+                }
+            }
+            for (int i = removeIndex.Count - 1; i >= 0; i--)
+            {
+                _mergedCells.List.RemoveAt(removeIndex[i]);
+            }
+        }
+        private void FixSharedFormulasRows(int position, int rows)
+        {
+            List<Formulas> added = new List<Formulas>();
+            List<Formulas> deleted = new List<Formulas>();
+
+            foreach (int id in _sharedFormulas.Keys)
+            {
+                var f = _sharedFormulas[id];
+                int fromCol, fromRow, toCol, toRow;
+
+                ExcelCellBase.GetRowColFromAddress(f.Address, out fromRow, out fromCol, out toRow, out toCol);
+                if (position >= fromRow && position+(Math.Abs(rows)) <= toRow) //Insert/delete is whithin the share formula address
+                {
+                    if (rows > 0) //Insert
+                    {
+                        f.Address = ExcelCellBase.GetAddress(fromRow, fromCol) + ":" + ExcelCellBase.GetAddress(position - 1, toCol);
+                        if (toRow != fromRow)
+                        {
+                            Formulas newF = new Formulas(SourceCodeTokenizer.Default);
+                            newF.StartCol = f.StartCol;
+                            newF.StartRow = position + rows;
+                            newF.Address = ExcelCellBase.GetAddress(position + rows, fromCol) + ":" + ExcelCellBase.GetAddress(toRow + rows, toCol);
+                            newF.Formula = ExcelCellBase.TranslateFromR1C1(ExcelCellBase.TranslateToR1C1(f.Formula, f.StartRow, f.StartCol), position, f.StartCol);
+                            added.Add(newF);
+                        }
+                    }
+                    else
+                    {
+                        if (fromRow - rows < toRow)
+                        {
+                            f.Address = ExcelCellBase.GetAddress(fromRow, fromCol, toRow+rows, toCol);
+                        }
+                        else
+                        {
+                            f.Address = ExcelCellBase.GetAddress(fromRow, fromCol) + ":" + ExcelCellBase.GetAddress(toRow + rows, toCol);
+                        }
+                    }
+                }
+                else if (position <= toRow)
+                {
+                    if (rows > 0) //Insert before shift down
+                    {
+                        f.StartRow += rows;
+                        //f.Formula = ExcelCell.UpdateFormulaReferences(f.Formula, rows, 0, position, 0); //Recalc the cells positions
+                        f.Address = ExcelCellBase.GetAddress(fromRow + rows, fromCol) + ":" + ExcelCellBase.GetAddress(toRow + rows, toCol);
+                    }
+                    else
+                    {
+                        //Cells[f.Address].SetSharedFormulaID(int.MinValue);
+                        if (position <= fromRow && position + Math.Abs(rows) > toRow)  //Delete the formula 
+                        {
+                            deleted.Add(f);
+                        }
+                        else
+                        {
+                            toRow = toRow + rows < position - 1 ? position - 1 : toRow + rows;
+                            if (position <= fromRow)
+                            {
+                                fromRow = fromRow + rows < position ? position : fromRow + rows;
+                            }
+
+                            f.Address = ExcelCellBase.GetAddress(fromRow, fromCol, toRow, toCol);
+                            Cells[f.Address].SetSharedFormulaID(f.Index);
+                            //f.StartRow = fromRow;
+
+                            //f.Formula = ExcelCell.UpdateFormulaReferences(f.Formula, rows, 0, position, 0);
+                       
+                        }
+                    }
+                }
+            }
+
+            AddFormulas(added, position, rows);
+
+            //Remove formulas
+            foreach (Formulas f in deleted)
+            {
+                _sharedFormulas.Remove(f.Index);
+            }
+
+            //Fix Formulas
+            added = new List<Formulas>();
+            foreach (int id in _sharedFormulas.Keys)
+            {
+                var f = _sharedFormulas[id];
+                UpdateSharedFormulaRow(ref f, position, rows, ref added);
+            }
+            AddFormulas(added, position, rows);
+        }
+
+        private void AddFormulas(List<Formulas> added, int position, int rows)
+        {
+            //Add new formulas
+            foreach (Formulas f in added)
+            {
+                f.Index = GetMaxShareFunctionIndex(false);
+                _sharedFormulas.Add(f.Index, f);
+                Cells[f.Address].SetSharedFormulaID(f.Index);
+            }
+        }
+
+        private void UpdateSharedFormulaRow(ref Formulas formula, int startRow, int rows, ref List<Formulas> newFormulas)
+        {
+            int fromRow,fromCol, toRow, toCol;
+            int newFormulasCount = newFormulas.Count;
+            ExcelCellBase.GetRowColFromAddress(formula.Address, out fromRow, out fromCol, out toRow, out toCol);
+            //int refSplits = Regex.Split(formula.Formula, "#REF!").GetUpperBound(0);
+            string formualR1C1;
+            if (rows > 0 || fromRow <= startRow)
+            {
+                formualR1C1 = ExcelRangeBase.TranslateToR1C1(formula.Formula, formula.StartRow, formula.StartCol);
+                formula.Formula = ExcelRangeBase.TranslateFromR1C1(formualR1C1, fromRow, formula.StartCol);
+            }
+            else
+            {
+                formualR1C1 = ExcelRangeBase.TranslateToR1C1(formula.Formula, formula.StartRow-rows, formula.StartCol);
+                formula.Formula = ExcelRangeBase.TranslateFromR1C1(formualR1C1, formula.StartRow, formula.StartCol);
+            }
+            //bool isRef = false;
+            //Formulas restFormula=formula;
+            string prevFormualR1C1 = formualR1C1;
+            for (int row = fromRow; row <= toRow; row++)
+            {
+                for (int col = fromCol; col <= toCol; col++)
+                {
+                    string newFormula;
+                    string currentFormulaR1C1;
+                    if (rows > 0 || row < startRow)
+                    {
+                        newFormula = ExcelCellBase.UpdateFormulaReferences(ExcelCellBase.TranslateFromR1C1(formualR1C1, row, col), rows, 0, startRow, 0);
+                        currentFormulaR1C1 = ExcelRangeBase.TranslateToR1C1(newFormula, row, col);
+                    }
+                    else
+                    {
+                        newFormula = ExcelCellBase.UpdateFormulaReferences(ExcelCellBase.TranslateFromR1C1(formualR1C1, row-rows, col), rows, 0, startRow, 0);
+                        currentFormulaR1C1 = ExcelRangeBase.TranslateToR1C1(newFormula, row, col);
+                    }
+                    if (currentFormulaR1C1 != prevFormualR1C1) //newFormula.Contains("#REF!"))
+                    {
+                        //if (refSplits == 0 || Regex.Split(newFormula, "#REF!").GetUpperBound(0) != refSplits)
+                        //{
+                        //isRef = true;
+                        if (row == fromRow && col == fromCol)
+                        {
+                            formula.Formula = newFormula;
+                        }
+                        else
+                        {
+                            if (newFormulas.Count == newFormulasCount)
+                            {
+                                formula.Address = ExcelCellBase.GetAddress(formula.StartRow, formula.StartCol, row - 1, col);
+                            }
+                            else
+                            {
+                                newFormulas[newFormulas.Count - 1].Address = ExcelCellBase.GetAddress(newFormulas[newFormulas.Count - 1].StartRow, newFormulas[newFormulas.Count - 1].StartCol, row - 1, col);
+                            }
+                            var refFormula = new Formulas(SourceCodeTokenizer.Default);
+                            refFormula.Formula = newFormula;
+                            refFormula.StartRow = row;
+                            refFormula.StartCol = col;
+                            newFormulas.Add(refFormula);
+
+                            //restFormula = null;
+                            prevFormualR1C1 = currentFormulaR1C1;
+                        }
+                    }
+                    //    }
+                    //    else
+                    //    {
+                    //        isRef = false;
+                    //    }
+                    //}
+                    //else
+                    //{
+                    //    isRef = false;
+                    //}
+                    //if (restFormula==null)
+                    //{
+                        //if (newFormulas.Count == newFormulasCount)
+                        //{
+                        //    formula.Address = ExcelCellBase.GetAddress(formula.StartRow, formula.StartCol, row - 1, col);
+                        //}
+                        //else
+                        //{
+//                            newFormulas[newFormulas.Count - 1].Address = ExcelCellBase.GetAddress(newFormulas[newFormulas.Count - 1].StartRow, newFormulas[0].StartCol, row - 1, col);
+                        //}
+
+                        //restFormula = new Formulas();
+                        //restFormula.Formula = newFormula;
+                        //restFormula.StartRow = row;
+                        //restFormula.StartCol = col;
+                        //newFormulas.Add(restFormula);
+                    //}
+                }
+            }
+            if (rows < 0 && formula.StartRow > startRow)
+            {
+                if (formula.StartRow + rows < startRow)
+                {
+                    formula.StartRow = startRow;
+                }
+                else
+                {
+                    formula.StartRow += rows;
+                }
+            }
+            if (newFormulas.Count > newFormulasCount)
+            {
+                newFormulas[newFormulas.Count - 1].Address = ExcelCellBase.GetAddress(newFormulas[newFormulas.Count - 1].StartRow, newFormulas[newFormulas.Count - 1].StartCol, toRow, toCol);
+            }
+        }
+        #endregion
+
+        #region DeleteRow
+        /// <summary>
+        /// Delete the specified row from the worksheet.
+        /// </summary>
+        /// <param name="row">A row to be deleted</param>
+        public void DeleteRow(int row)
+        {
+            DeleteRow(row, 1);
+        }
+        /// <summary>
+        /// Delete the specified row from the worksheet.
+        /// </summary>
+        /// <param name="rowFrom">The start row</param>
+        /// <param name="rows">Number of rows to delete</param>
+        public void DeleteRow(int rowFrom, int rows)
+        {
+            CheckSheetType();
+            if (rowFrom < 1 || rowFrom + rows > ExcelPackage.MaxRows)
+            {
+                throw(new ArgumentException("Row out of range. Spans from 1 to " + ExcelPackage.MaxRows.ToString(CultureInfo.InvariantCulture)));
+            }
+            lock (this)
+            {
+                _values.Delete(rowFrom, 1, rows, ExcelPackage.MaxColumns);
+                _types.Delete(rowFrom, 1, rows, ExcelPackage.MaxColumns);
+                _formulas.Delete(rowFrom, 1, rows, ExcelPackage.MaxColumns);
+                _styles.Delete(rowFrom, 1, rows, ExcelPackage.MaxColumns);
+                _flags.Delete(rowFrom, 1, rows, ExcelPackage.MaxColumns);
+                _commentsStore.Delete(rowFrom, 1, rows, ExcelPackage.MaxColumns);
+                _hyperLinks.Delete(rowFrom, 1, rows, ExcelPackage.MaxColumns);
+
+                AdjustFormulasRow(rowFrom, rows);
+                FixMergedCellsRow(rowFrom, rows, true);
+
+                foreach (var tbl in Tables)
+                {
+                    tbl.Address = tbl.Address.DeleteRow(rowFrom, rows);
+                }
+            }
+        }
+        /// <summary>
+        /// Delete the specified column from the worksheet.
+        /// </summary>
+        /// <param name="column">The column to be deleted</param>
+        public void DeleteColumn(int column)
+        {
+            DeleteColumn(column,1);
+        }
+        /// <summary>
+        /// Delete the specified column from the worksheet.
+        /// </summary>
+        /// <param name="columnFrom">The start column</param>
+        /// <param name="columns">Number of columns to delete</param>
+        public void DeleteColumn(int columnFrom, int columns)
+        {
+            if (columnFrom < 1 || columnFrom + columns > ExcelPackage.MaxColumns)
+            {
+                throw (new ArgumentException("Column out of range. Spans from 1 to " + ExcelPackage.MaxColumns.ToString(CultureInfo.InvariantCulture)));
+            }
+            lock (this)
+            {
+                var col = _values.GetValue(0, columnFrom) as ExcelColumn;
+                if (col == null)
+                {
+                    var r = 0; 
+                    var c = columnFrom;
+                    if(_values.PrevCell(ref r,ref c))
+                    {
+                        col = _values.GetValue(0, c) as ExcelColumn;
+                        if(col._columnMax >= columnFrom)
+                        {
+                            col.ColumnMax=columnFrom-1;
+                        }
+                    }
+                }
+
+                _values.Delete(1, columnFrom, ExcelPackage.MaxRows, columns);
+                _types.Delete(1, columnFrom, ExcelPackage.MaxRows, columns);
+                _formulas.Delete(1, columnFrom, ExcelPackage.MaxRows, columns);
+                _styles.Delete(1, columnFrom, ExcelPackage.MaxRows, columns);
+                _flags.Delete(1, columnFrom, ExcelPackage.MaxRows, columns);
+                _commentsStore.Delete(1, columnFrom, ExcelPackage.MaxRows, columns);
+                _hyperLinks.Delete(1, columnFrom, ExcelPackage.MaxRows, columns);
+
+                AdjustFormulasColumn(columnFrom, columns);
+                FixMergedCellsColumn(columnFrom, columns, true);
+
+                var csec = new CellsStoreEnumerator<object>(_values, 0, columnFrom, 0, ExcelPackage.MaxColumns);
+                foreach (var column in csec)    
+                {
+                    if (column is ExcelColumn)
+                    {
+                        var c = (ExcelColumn)column;
+                        if (c._columnMin >= columnFrom)
+                        {
+                            c._columnMin -= columns;
+                            c._columnMax -= columns;
+                        }
+                    }
+                }
+
+                foreach (var tbl in Tables)
+                {
+                    if (columnFrom >= tbl.Address.Start.Column && columnFrom <= tbl.Address.End.Column)
+                    {
+                        var node = tbl.Columns[0].TopNode.ParentNode;
+                        var ix = columnFrom - tbl.Address.Start.Column;
+                        for (int i = 0; i < columns; i++)
+                        {
+                            if (node.ChildNodes.Count > ix)
+                            {
+                                node.RemoveChild(node.ChildNodes[ix]);
+                            }
+                        } 
+                        tbl._cols = new ExcelTableColumnCollection(tbl);
+                    }
+
+                    tbl.Address = tbl.Address.DeleteColumn(columnFrom, columns);
+                }
+            }
+        }
+        internal void AdjustFormulasRow(int rowFrom, int rows)
+        {
+            var delSF = new List<int>();
+            foreach (var sf in _sharedFormulas.Values)
+            {
+                var a = new ExcelAddress(sf.Address).DeleteRow(rowFrom, rows);
+                if (a==null)
+                {
+                    delSF.Add(sf.Index);
+                }
+                else
+                {
+                    sf.Address = a.Address;
+                    if (sf.StartRow > rowFrom)
+                    {
+                        var r = Math.Min(sf.StartRow - rowFrom, rows);
+                        sf.Formula = ExcelCellBase.UpdateFormulaReferences(sf.Formula, -r, 0, rowFrom, 0);
+                        sf.StartRow -= r;
+                    }
+                }
+            }
+            foreach (var ix in delSF)
+            {
+                _sharedFormulas.Remove(ix);
+            }
+            delSF = null;
+            var cse = new CellsStoreEnumerator<object>(_formulas, 1, 1, ExcelPackage.MaxRows, ExcelPackage.MaxColumns);
+            while (cse.Next())
+            {
+                if (cse.Value is string)
+                {
+                    cse.Value = ExcelCellBase.UpdateFormulaReferences(cse.Value.ToString(), -rows, 0, rowFrom, 0);
+                }
+            }
+        }
+        internal void AdjustFormulasColumn(int columnFrom, int columns)
+        {
+            var delSF = new List<int>();
+            foreach (var sf in _sharedFormulas.Values)
+            {
+                var a = new ExcelAddress(sf.Address).DeleteColumn(columnFrom, columns);
+                if (a == null)
+                {
+                    delSF.Add(sf.Index);
+                }
+                else
+                {
+                    sf.Address = a.Address;
+                    //sf.Formula = ExcelCellBase.UpdateFormulaReferences(sf.Formula, 0, -columns, 0, columnFrom);
+                    if (sf.StartCol > columnFrom)
+                    {
+                        var c = Math.Min(sf.StartCol - columnFrom, columns);
+                        sf.Formula = ExcelCellBase.UpdateFormulaReferences(sf.Formula, 0, -c, 0, 1);
+                        sf.StartCol-= c;
+                    }
+
+                    //sf.Address = a.Address;
+                    //sf.Formula = ExcelCellBase.UpdateFormulaReferences(sf.Formula, 0,-columns,0, columnFrom);
+                    //if (sf.StartCol >= columnFrom)
+                    //{
+                    //    sf.StartCol -= sf.StartCol;
+                    //}
+                }
+            }
+            foreach (var ix in delSF)
+            {
+                _sharedFormulas.Remove(ix);
+            }
+            delSF = null;
+            var cse = new CellsStoreEnumerator<object>(_formulas, 1, 1,  ExcelPackage.MaxRows, ExcelPackage.MaxColumns);
+            while (cse.Next())
+            {
+                if (cse.Value is string)
+                {
+                    cse.Value = ExcelCellBase.UpdateFormulaReferences(cse.Value.ToString(), 0, -columns, 0, columnFrom);
+                }
+            }
+        }
+        /// <summary>
+        /// Deletes the specified row from the worksheet.
+        /// </summary>
+        /// <param name="rowFrom">The number of the start row to be deleted</param>
+        /// <param name="rows">Number of rows to delete</param>
+        /// <param name="shiftOtherRowsUp">Not used. Rows are always shifted</param>
+        public void DeleteRow(int rowFrom, int rows, bool shiftOtherRowsUp)
+		{
+            DeleteRow(rowFrom, rows);
+        }
+		#endregion
+        /// <summary>
+        /// Get the cell value from thw worksheet
+        /// </summary>
+        /// <param name="Row">The row number</param>
+        /// <param name="Column">The row number</param>
+        /// <returns>The value</returns>
+        public object GetValue(int Row, int Column)
+        {
+            CheckSheetType();
+            //ulong cellID = ExcelCellBase.GetCellID(SheetID, Row, Column);
+            var v = _values.GetValue(Row, Column);
+            if (v!=null)
+            {
+                //var cell = ((ExcelCell)_cells[cellID]);
+                if (_flags.GetFlagValue(Row, Column, CellFlags.RichText))
+                {
+                    return (object)Cells[Row, Column].RichText.Text;
+                }
+                else
+                {
+                    return v;
+                }
+            }
+            else
+            {
+                return null;
+            }
+        }
+
+        /// <summary>
+        /// Get a strongly typed cell value from the worksheet
+        /// </summary>
+        /// <typeparam name="T">The type</typeparam>
+        /// <param name="Row">The row number</param>
+        /// <param name="Column">The row number</param>
+        /// <returns>The value. If the value can't be converted to the specified type, the default value will be returned</returns>
+        public T GetValue<T>(int Row, int Column)
+        {
+            CheckSheetType();
+            //ulong cellID=ExcelCellBase.GetCellID(SheetID, Row, Column);
+            var v = _values.GetValue(Row, Column);           
+            if (v==null)
+            {
+                return default(T);
+            }
+
+            //var cell=((ExcelCell)_cells[cellID]);
+            if (_flags.GetFlagValue(Row, Column, CellFlags.RichText))
+            {
+                return (T)(object)Cells[Row, Column].RichText.Text;
+            }
+            else
+            {
+                return GetTypedValue<T>(v);
+            }
+        }
+        //Thanks to Michael Tran for parts of this method
+        internal T GetTypedValue<T>(object v)
+        {
+            if (v == null)
+            {
+                return default(T);
+            }
+            Type fromType = v.GetType();
+            Type toType = typeof(T);
+            if (fromType == toType)
+            {
+                return (T)v;
+            }
+            var cnv = TypeDescriptor.GetConverter(fromType);
+            if (toType == typeof(DateTime))    //Handle dates
+            {
+                if (fromType == typeof(TimeSpan))
+                {
+                    return ((T)(object)(new DateTime(((TimeSpan)v).Ticks)));
+                }
+                else if (fromType == typeof(string))
+                {
+                    DateTime dt;
+                    if (DateTime.TryParse(v.ToString(), out dt))
+                    {
+                        return (T)(object)(dt);
+                    }
+                    else
+                    {
+                        return default(T);
+                    }
+
+                }
+                else
+                {
+                    if (cnv.CanConvertTo(typeof(double)))
+                    {
+                        return (T)(object)(DateTime.FromOADate((double)cnv.ConvertTo(v, typeof(double))));
+                    }
+                    else
+                    {
+                        return default(T);
+                    }
+                }
+            }
+            else if (toType == typeof(TimeSpan))    //Handle timespan
+            {
+                if (fromType == typeof(DateTime))
+                {
+                    return ((T)(object)(new TimeSpan(((DateTime)v).Ticks)));
+                }
+                else if (fromType == typeof(string))
+                {
+                    TimeSpan ts;
+                    if (TimeSpan.TryParse(v.ToString(), out ts))
+                    {
+                        return (T)(object)(ts); 
+                    }
+                    else
+                    {
+                        return default(T);
+                    }
+                }
+                else
+                {
+                    if (cnv.CanConvertTo(typeof(double)))
+                    {
+
+                        return (T)(object)(new TimeSpan(DateTime.FromOADate((double)cnv.ConvertTo(v, typeof(double))).Ticks));
+                    }
+                    else
+                    {
+                        try
+                        {
+                            // Issue 14682 -- "GetValue<decimal>() won't convert strings"
+                            // As suggested, after all special cases, all .NET to do it's 
+                            // preferred conversion rather than simply returning the default
+                            return (T)Convert.ChangeType(v, typeof(T));
+                        }
+                        catch (Exception)
+                        {
+                            // This was the previous behaviour -- no conversion is available.
+                            return default(T);
+                        }
+                    }
+                }
+            }
+            else
+            {
+                if (cnv.CanConvertTo(toType))
+                {
+                    return (T)cnv.ConvertTo(v, typeof(T));
+                }
+                else
+                {
+                    if (toType.IsGenericType && toType.GetGenericTypeDefinition().Equals(typeof(Nullable<>)))
+                    {
+                        toType = Nullable.GetUnderlyingType(toType);
+                        if (cnv.CanConvertTo(toType))
+                        {
+                            return (T)cnv.ConvertTo(v, typeof(T));
+                        }
+                    }
+
+                    if(fromType==typeof(double) && toType==typeof(decimal))
+                    {
+                        return (T)(object)Convert.ToDecimal(v);
+                    }
+                    else if (fromType == typeof(decimal) && toType == typeof(double))
+                    {
+                        return (T)(object)Convert.ToDouble(v);
+                    }
+                    else
+                    {
+                        return default(T);
+                    }
+                }
+            }
+        }
+        /// <summary>
+        /// Set the value of a cell
+        /// </summary>
+        /// <param name="Row">The row number</param>
+        /// <param name="Column">The column number</param>
+        /// <param name="Value">The value</param>
+        public void SetValue(int Row, int Column, object Value)
+        {
+            CheckSheetType();
+            if (Row < 1 || Column < 1 || Row > ExcelPackage.MaxRows && Column > ExcelPackage.MaxColumns)
+            {
+                throw new ArgumentOutOfRangeException("Row or Column out of range");
+            }            
+            _values.SetValue(Row, Column, Value);
+        }
+        /// <summary>
+        /// Set the value of a cell
+        /// </summary>
+        /// <param name="Address">The Excel address</param>
+        /// <param name="Value">The value</param>
+        public void SetValue(string Address, object Value)
+        {
+            CheckSheetType();
+            int row, col;
+            ExcelAddressBase.GetRowCol(Address, out row, out col, true);
+            if (row < 1 || col < 1 || row > ExcelPackage.MaxRows && col > ExcelPackage.MaxColumns)
+            {
+                throw new ArgumentOutOfRangeException("Address is invalid or out of range");
+            }
+            _values.SetValue(row, col, Value);           
+        }
+
+        #region MergeCellId
+
+        /// <summary>
+        /// Get MergeCell Index No
+        /// </summary>
+        /// <param name="row"></param>
+        /// <param name="column"></param>
+        /// <returns></returns>
+        public int GetMergeCellId(int row, int column)
+        {
+            for (int i = 0; i < _mergedCells.Count; i++)
+            {
+               if(!string.IsNullOrEmpty( _mergedCells[i]))
+               {
+                    ExcelRange range = Cells[_mergedCells[i]];
+
+                    if (range.Start.Row <= row && row <= range.End.Row)
+                    {
+                        if (range.Start.Column <= column && column <= range.End.Column)
+                        {
+                            return i + 1;
+                        }
+                    }
+                }
+            }
+            return 0;
+        }
+
+        #endregion
+		#endregion // END Worksheet Public Methods
+
+		#region Worksheet Private Methods
+
+		#region Worksheet Save
+        internal void Save()
+        {
+                DeletePrinterSettings();
+
+                if (_worksheetXml != null)
+                {
+
+                    if (!(this is ExcelChartsheet))
+                    {
+                        // save the header & footer (if defined)
+                        if (_headerFooter != null)
+                            HeaderFooter.Save();
+
+                        var d = Dimension;
+                        if (d == null)
+                        {
+                            this.DeleteAllNode("d:dimension/@ref");
+                        }
+                        else
+                        {
+                            this.SetXmlNodeString("d:dimension/@ref", d.Address);
+                        }
+
+
+                        if (Drawings.Count == 0)
+                        {
+                            //Remove node if no drawings exists.
+                            DeleteNode("d:drawing");
+                        }
+
+                        SaveComments();
+                        HeaderFooter.SaveHeaderFooterImages();
+                        SaveTables();
+                        SavePivotTables();
+                    }
+                }
+
+                if (Drawings.UriDrawing!=null)
+                {
+                    if (Drawings.Count == 0)
+                    {                                            
+                        Part.DeleteRelationship(Drawings._drawingRelation.Id);
+                        _package.Package.DeletePart(Drawings.UriDrawing);                    
+                    }
+                    else
+                    {
+                        Packaging.ZipPackagePart partPack = Drawings.Part;
+                        Drawings.DrawingXml.Save(partPack.GetStream(FileMode.Create, FileAccess.Write));
+                        foreach (ExcelDrawing d in Drawings)
+                        {
+                            if (d is ExcelChart)
+                            {
+                                ExcelChart c = (ExcelChart)d;
+                                c.ChartXml.Save(c.Part.GetStream(FileMode.Create, FileAccess.Write));
+                            }
+                        }
+                    }
+                }
+        }
+        internal void SaveHandler(ZipOutputStream stream, CompressionLevel compressionLevel, string fileName)
+        {
+                    //Init Zip
+                    stream.CodecBufferSize = 8096;
+                    stream.CompressionLevel = (OfficeOpenXml.Packaging.Ionic.Zlib.CompressionLevel)compressionLevel;
+                    stream.PutNextEntry(fileName);
+
+                    
+                    SaveXml(stream);
+        }
+
+        
+
+        ///// <summary>
+        ///// Saves the worksheet to the package.
+        ///// </summary>
+        //internal void Save()  // Worksheet Save
+        //{
+        //    DeletePrinterSettings();
+
+        //    if (_worksheetXml != null)
+        //    {
+                
+        //        // save the header & footer (if defined)
+        //        if (_headerFooter != null)
+        //            HeaderFooter.Save();
+
+        //        var d = Dimension;
+        //        if (d == null)
+        //        {
+        //            this.DeleteAllNode("d:dimension/@ref");
+        //        }
+        //        else
+        //        {
+        //            this.SetXmlNodeString("d:dimension/@ref", d.Address);
+        //        }
+                
+
+        //        if (_drawings != null && _drawings.Count == 0)
+        //        {
+        //            //Remove node if no drawings exists.
+        //            DeleteNode("d:drawing");
+        //        }
+
+        //        SaveComments();
+        //        HeaderFooter.SaveHeaderFooterImages();
+        //        SaveTables();
+        //        SavePivotTables();
+        //        SaveXml();
+        //    }
+            
+        //    if (Drawings.UriDrawing!=null)
+        //    {
+        //        if (Drawings.Count == 0)
+        //        {                    
+        //            Part.DeleteRelationship(Drawings._drawingRelation.Id);
+        //            _package.Package.DeletePart(Drawings.UriDrawing);                    
+        //        }
+        //        else
+        //        {
+        //            Packaging.ZipPackagePart partPack = Drawings.Part;
+        //            Drawings.DrawingXml.Save(partPack.GetStream(FileMode.Create, FileAccess.Write));
+        //            foreach (ExcelDrawing d in Drawings)
+        //            {
+        //                if (d is ExcelChart)
+        //                {
+        //                    ExcelChart c = (ExcelChart)d;
+        //                    c.ChartXml.Save(c.Part.GetStream(FileMode.Create, FileAccess.Write));
+        //                }
+        //            }
+        //        }
+        //    }
+        //}
+
+        /// <summary>
+        /// Delete the printersettings relationship and part.
+        /// </summary>
+        private void DeletePrinterSettings()
+        {
+            //Delete the relationship from the pageSetup tag
+            XmlAttribute attr = (XmlAttribute)WorksheetXml.SelectSingleNode("//d:pageSetup/@r:id", NameSpaceManager);
+            if (attr != null)
+            {
+                string relID = attr.Value;
+                //First delete the attribute from the XML
+                attr.OwnerElement.Attributes.Remove(attr);
+                if(Part.RelationshipExists(relID))
+                {
+                    var rel = Part.GetRelationship(relID);
+                    Uri printerSettingsUri = UriHelper.ResolvePartUri(rel.SourceUri, rel.TargetUri);
+                    Part.DeleteRelationship(rel.Id);
+
+                    //Delete the part from the package
+                    if(_package.Package.PartExists(printerSettingsUri))
+                    {
+                        _package.Package.DeletePart(printerSettingsUri);
+                    }
+                }
+            }
+        }
+        private void SaveComments()
+        {
+            if (_comments != null)
+            {
+                if (_comments.Count == 0)
+                {
+                    if (_comments.Uri != null)
+                    {
+                        Part.DeleteRelationship(_comments.RelId);
+                        _package.Package.DeletePart(_comments.Uri);                        
+                    }
+                    RemoveLegacyDrawingRel(VmlDrawingsComments.RelId);
+                }
+                else
+                {
+                    if (_comments.Uri == null)
+                    {
+                        _comments.Uri=new Uri(string.Format(@"/xl/comments{0}.xml", SheetID), UriKind.Relative);                        
+                    }
+                    if(_comments.Part==null)
+                    {
+                        _comments.Part = _package.Package.CreatePart(_comments.Uri, "application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml", _package.Compression);
+                        var rel = Part.CreateRelationship(UriHelper.GetRelativeUri(WorksheetUri, _comments.Uri), Packaging.TargetMode.Internal, ExcelPackage.schemaRelationships+"/comments");
+                    }
+                    _comments.CommentXml.Save(_comments.Part.GetStream(FileMode.Create));
+                }
+            }
+
+            if (_vmlDrawings != null)
+            {
+                if (_vmlDrawings.Count == 0)
+                {
+                    if (_vmlDrawings.Uri != null)
+                    {
+                        Part.DeleteRelationship(_vmlDrawings.RelId);
+                        _package.Package.DeletePart(_vmlDrawings.Uri);
+                    }
+                }
+                else
+                {
+                    if (_vmlDrawings.Uri == null)
+                    {
+                        _vmlDrawings.Uri = XmlHelper.GetNewUri(_package.Package, @"/xl/drawings/vmlDrawing{0}.vml");
+                    }
+                    if (_vmlDrawings.Part == null)
+                    {
+                        _vmlDrawings.Part = _package.Package.CreatePart(_vmlDrawings.Uri, "application/vnd.openxmlformats-officedocument.vmlDrawing", _package.Compression);
+                        var rel = Part.CreateRelationship(UriHelper.GetRelativeUri(WorksheetUri, _vmlDrawings.Uri), Packaging.TargetMode.Internal, ExcelPackage.schemaRelationships + "/vmlDrawing");
+                        SetXmlNodeString("d:legacyDrawing/@r:id", rel.Id);
+                        _vmlDrawings.RelId = rel.Id;
+                    }
+                    _vmlDrawings.VmlDrawingXml.Save(_vmlDrawings.Part.GetStream());
+                }
+            }
+        }
+        /// <summary>
+        /// Save all table data
+        /// </summary>
+        private void SaveTables()
+        {
+            foreach (var tbl in Tables)
+            {
+                if (tbl.ShowHeader || tbl.ShowTotal)
+                {
+                    int colNum = tbl.Address._fromCol;
+                    var colVal = new HashSet<string>();
+                    foreach (var col in tbl.Columns)
+                    {                        
+                        var n=col.Name.ToLower(CultureInfo.InvariantCulture);
+                        if(colVal.Contains(n))
+                        {
+                            throw(new InvalidDataException(string.Format("Table {0} Column {1} does not have a unique name.", tbl.Name, col.Name)));
+                        }
+                        colVal.Add(n);
+                        if (tbl.ShowHeader)
+                        {
+                            _values.SetValue(tbl.Address._fromRow, colNum, col.Name);
+                        }
+                        if (tbl.ShowTotal)
+                        {
+                            SetTableTotalFunction(tbl, col, colNum);
+                        }
+                        if (!string.IsNullOrEmpty(col.CalculatedColumnFormula))
+                        {
+                            int fromRow = tbl.ShowHeader ? tbl.Address._fromRow + 1 : tbl.Address._fromRow;
+                            int toRow = tbl.ShowTotal ? tbl.Address._toRow - 1 : tbl.Address._toRow;
+                            for (int row = fromRow; row <= toRow; row++)
+                            {
+                                //Cell(row, colNum).Formula = col.CalculatedColumnFormula;
+                                SetFormula(row, colNum, col.CalculatedColumnFormula);
+                            }                            
+                        }
+                        colNum++;
+                    }
+                }                
+                if (tbl.Part == null)
+                {
+                    tbl.TableUri = GetNewUri(_package.Package, @"/xl/tables/table{0}.xml", tbl.Id);
+                    tbl.Part = _package.Package.CreatePart(tbl.TableUri, "application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml", Workbook._package.Compression);
+                    var stream = tbl.Part.GetStream(FileMode.Create);
+                    tbl.TableXml.Save(stream);
+                    var rel = Part.CreateRelationship(UriHelper.GetRelativeUri(WorksheetUri, tbl.TableUri), Packaging.TargetMode.Internal, ExcelPackage.schemaRelationships + "/table");
+                    tbl.RelationshipID = rel.Id;
+
+                    CreateNode("d:tableParts");
+                    XmlNode tbls = TopNode.SelectSingleNode("d:tableParts",NameSpaceManager);
+
+                    var tblNode = tbls.OwnerDocument.CreateElement("tablePart",ExcelPackage.schemaMain);
+                    tbls.AppendChild(tblNode);
+                    tblNode.SetAttribute("id",ExcelPackage.schemaRelationships, rel.Id);
+                }
+                else
+                {
+                    var stream = tbl.Part.GetStream(FileMode.Create);
+                    tbl.TableXml.Save(stream);
+                }
+            }
+        }
+
+        internal void SetTableTotalFunction(ExcelTable tbl, ExcelTableColumn col, int colNum=-1)
+        {
+            if (tbl.ShowTotal == false) return;
+            if (colNum == -1)
+            {
+                for (int i = 0; i < tbl.Columns.Count; i++)
+                {
+                    if (tbl.Columns[i].Name == col.Name)
+                    {
+                        colNum = tbl.Address._fromCol + i;
+                    }
+                }
+            }
+            if (col.TotalsRowFunction == RowFunctions.Custom)
+            {
+                SetFormula(tbl.Address._toRow, colNum, col.TotalsRowFormula);
+            }
+            else if (col.TotalsRowFunction != RowFunctions.None)
+            {
+                switch (col.TotalsRowFunction)
+                {
+                    case RowFunctions.Average:
+                        SetFormula(tbl.Address._toRow, colNum, GetTotalFunction(col, "101"));
+                        break;
+                    case RowFunctions.Count:
+                        SetFormula(tbl.Address._toRow, colNum, GetTotalFunction(col, "102"));
+                        break;
+                    case RowFunctions.CountNums:
+                        SetFormula(tbl.Address._toRow, colNum, GetTotalFunction(col, "103"));
+                        break;
+                    case RowFunctions.Max:
+                        SetFormula(tbl.Address._toRow, colNum, GetTotalFunction(col, "104"));
+                        break;
+                    case RowFunctions.Min:
+                        SetFormula(tbl.Address._toRow, colNum, GetTotalFunction(col, "105"));
+                        break;
+                    case RowFunctions.StdDev:
+                        SetFormula(tbl.Address._toRow, colNum, GetTotalFunction(col, "107"));
+                        break;
+                    case RowFunctions.Var:
+                        SetFormula(tbl.Address._toRow, colNum, GetTotalFunction(col, "110"));
+                        break;
+                    case RowFunctions.Sum:
+                        SetFormula(tbl.Address._toRow, colNum, GetTotalFunction(col, "109"));
+                        break;
+                    default:
+                        throw (new Exception("Unknown RowFunction enum"));
+                }
+            }
+            else
+            {
+                _values.SetValue(tbl.Address._toRow, colNum, col.TotalsRowLabel);
+
+            }
+        }
+
+        internal void SetFormula(int row, int col, object value)
+        {
+            _formulas.SetValue(row, col, value);
+            if (!_values.Exists(row, col)) _values.SetValue(row, col, null);
+        }
+        internal void SetStyle(int row, int col, int value)
+        {
+            _styles.SetValue(row, col, value);
+            if(!_values.Exists(row,col)) _values.SetValue(row, col, null);
+        }
+        
+        private void SavePivotTables()
+        {
+            foreach (var pt in PivotTables)
+            {
+                if (pt.DataFields.Count > 1)
+                {
+                    XmlElement parentNode;
+                    if(pt.DataOnRows==true)
+                    {
+                        parentNode =  pt.PivotTableXml.SelectSingleNode("//d:rowFields", pt.NameSpaceManager) as XmlElement;
+                        if (parentNode == null)
+                        {
+                            pt.CreateNode("d:rowFields");
+                            parentNode = pt.PivotTableXml.SelectSingleNode("//d:rowFields", pt.NameSpaceManager) as XmlElement;
+                        }
+                    }
+                    else
+                    {
+                        parentNode =  pt.PivotTableXml.SelectSingleNode("//d:colFields", pt.NameSpaceManager) as XmlElement;
+                        if (parentNode == null)
+                        {
+                            pt.CreateNode("d:colFields");
+                            parentNode = pt.PivotTableXml.SelectSingleNode("//d:colFields", pt.NameSpaceManager) as XmlElement;
+                        }
+                    }
+
+                    if (parentNode.SelectSingleNode("d:field[@ x= \"-2\"]", pt.NameSpaceManager) == null)
+                    {
+                        XmlElement fieldNode = pt.PivotTableXml.CreateElement("field", ExcelPackage.schemaMain);
+                        fieldNode.SetAttribute("x", "-2");
+                        parentNode.AppendChild(fieldNode);
+                    }
+                }
+                pt.PivotTableXml.Save(pt.Part.GetStream(FileMode.Create));
+                pt.CacheDefinition.CacheDefinitionXml.Save(pt.CacheDefinition.Part.GetStream(FileMode.Create));
+            }
+        }
+        private static string GetTotalFunction(ExcelTableColumn col,string FunctionNum)
+        {
+            return string.Format("SUBTOTAL({0},{1}[{2}])", FunctionNum, col._tbl.Name, col.Name);
+        }
+        private void SaveXml(Stream stream)
+        {
+            //Create the nodes if they do not exist.
+            StreamWriter sw = new StreamWriter(stream, System.Text.Encoding.UTF8, 65536);
+            if (this is ExcelChartsheet)
+            {
+                sw.Write(_worksheetXml.OuterXml);
+            }
+            else
+            {
+                CreateNode("d:cols");
+                CreateNode("d:sheetData");
+                CreateNode("d:mergeCells");
+                CreateNode("d:hyperlinks");
+                CreateNode("d:rowBreaks");
+                CreateNode("d:colBreaks");
+
+                //StreamWriter sw=new StreamWriter(Part.GetStream(FileMode.Create, FileAccess.Write));
+                var xml = _worksheetXml.OuterXml;
+                int colStart = 0, colEnd = 0;
+                GetBlockPos(xml, "cols", ref colStart, ref colEnd);
+
+                sw.Write(xml.Substring(0, colStart));
+                var colBreaks = new List<int>();
+                //if (_columns.Count > 0)
+                //{
+                UpdateColumnData(sw);
+                //}
+
+                int cellStart = colEnd, cellEnd = colEnd;
+                GetBlockPos(xml, "sheetData", ref cellStart, ref cellEnd);
+
+                sw.Write(xml.Substring(colEnd, cellStart - colEnd));
+                var rowBreaks = new List<int>();
+                UpdateRowCellData(sw);
+
+                int mergeStart = cellEnd, mergeEnd = cellEnd;
+
+                GetBlockPos(xml, "mergeCells", ref mergeStart, ref mergeEnd);
+                sw.Write(xml.Substring(cellEnd, mergeStart - cellEnd));
+
+                CleanupMergedCells(_mergedCells);
+                if (_mergedCells.Count > 0)
+                {
+                    UpdateMergedCells(sw);
+                }
+
+                int hyperStart = mergeEnd, hyperEnd = mergeEnd;
+                GetBlockPos(xml, "hyperlinks", ref hyperStart, ref hyperEnd);
+                sw.Write(xml.Substring(mergeEnd, hyperStart - mergeEnd));
+                //if (_hyperLinkCells.Count > 0)
+                //{
+                UpdateHyperLinks(sw);
+                // }
+
+                int rowBreakStart = hyperEnd, rowBreakEnd = hyperEnd;
+                GetBlockPos(xml, "rowBreaks", ref rowBreakStart, ref rowBreakEnd);
+                sw.Write(xml.Substring(hyperEnd, rowBreakStart - hyperEnd));
+                //if (rowBreaks.Count > 0)
+                //{
+                UpdateRowBreaks(sw);
+                //}
+
+                int colBreakStart = rowBreakEnd, colBreakEnd = rowBreakEnd;
+                GetBlockPos(xml, "colBreaks", ref colBreakStart, ref colBreakEnd);
+                sw.Write(xml.Substring(rowBreakEnd, colBreakStart - rowBreakEnd));
+                //if (colBreaks.Count > 0)
+                //{
+                UpdateColBreaks(sw);
+                //}
+                sw.Write(xml.Substring(colBreakEnd, xml.Length - colBreakEnd));
+            }
+            sw.Flush();
+            //sw.Close();
+        }
+
+        private void CleanupMergedCells(MergeCellsCollection _mergedCells)
+        {
+            int i=0;
+            while (i < _mergedCells.List.Count)
+            {
+                if (_mergedCells[i] == null)
+                {
+                    _mergedCells.List.RemoveAt(i);
+                }
+                else
+                {
+                    i++;
+                }
+            }
+        }
+        private void UpdateColBreaks(StreamWriter sw)
+        {
+            StringBuilder breaks = new StringBuilder();
+            int count = 0;
+            var cse = new CellsStoreEnumerator<object>(_values, 0, 0, 0, ExcelPackage.MaxColumns);
+            //foreach (ExcelColumn col in _columns)
+            while(cse.Next())
+            {
+                var col=cse.Value as ExcelColumn;
+                if (col != null && col.PageBreak)
+                {
+                    breaks.AppendFormat("<brk id=\"{0}\" max=\"16383\" man=\"1\" />", cse.Column);
+                    count++;
+                }
+            }
+            if (count > 0)
+            {
+                sw.Write(string.Format("<colBreaks count=\"{0}\" manualBreakCount=\"{0}\">{1}</colBreaks>", count, breaks.ToString()));
+            }
+        }
+
+        private void UpdateRowBreaks(StreamWriter sw)
+        {
+            StringBuilder breaks=new StringBuilder();
+            int count = 0;
+            var cse = new CellsStoreEnumerator<object>(_values, 0, 0, ExcelPackage.MaxRows, 0);
+            //foreach(ExcelRow row in _rows)            
+            while(cse.Next())
+            {
+                var row=cse.Value as RowInternal;
+                if (row != null && row.PageBreak)
+                {
+                    breaks.AppendFormat("<brk id=\"{0}\" max=\"1048575\" man=\"1\" />", cse.Row);
+                    count++;
+                }
+            }
+            if (count>0)
+            {
+                sw.Write(string.Format("<rowBreaks count=\"{0}\" manualBreakCount=\"{0}\">{1}</rowBreaks>", count, breaks.ToString()));                
+            }
+        }
+        /// <summary>
+        /// Inserts the cols collection into the XML document
+        /// </summary>
+        private void UpdateColumnData(StreamWriter sw)
+        {
+            //ExcelColumn prevCol = null;   //commented out 11/1-12 JK 
+            //foreach (ExcelColumn col in _columns)
+            //{                
+            //    if (prevCol != null)
+            //    {
+            //        if(prevCol.ColumnMax != col.ColumnMin-1)
+            //        {
+            //            prevCol._columnMax=col.ColumnMin-1;
+            //        }
+            //    }
+            //    prevCol = col;
+            //}
+            var cse = new CellsStoreEnumerator<object>(_values, 0, 1, 0, ExcelPackage.MaxColumns);
+            //sw.Write("<cols>");
+            //foreach (ExcelColumn col in _columns)
+            bool first = true;
+            while(cse.Next())
+            {
+                if (first)
+                {
+                    sw.Write("<cols>");
+                    first = false;
+                }
+                var col = cse.Value as ExcelColumn;
+                ExcelStyleCollection<ExcelXfs> cellXfs = _package.Workbook.Styles.CellXfs;
+
+                sw.Write("<col min=\"{0}\" max=\"{1}\"", col.ColumnMin, col.ColumnMax);
+                if (col.Hidden == true)
+                {
+                    //sbXml.Append(" width=\"0\" hidden=\"1\" customWidth=\"1\"");
+                    sw.Write(" hidden=\"1\"");
+                }
+                else if (col.BestFit)
+                {
+                    sw.Write(" bestFit=\"1\"");
+                }
+                sw.Write(string.Format(CultureInfo.InvariantCulture, " width=\"{0}\" customWidth=\"1\"", col.Width));
+                if (col.OutlineLevel > 0)
+                {                    
+                    sw.Write(" outlineLevel=\"{0}\" ", col.OutlineLevel);
+                    if (col.Collapsed)
+                    {
+                        if (col.Hidden)
+                        {
+                            sw.Write(" collapsed=\"1\"");
+                        }
+                        else
+                        {
+                            sw.Write(" collapsed=\"1\" hidden=\"1\""); //Always hidden
+                        }
+                    }
+                }
+                if (col.Phonetic)
+                {
+                    sw.Write(" phonetic=\"1\"");
+                }
+
+                var styleID = col.StyleID >= 0 ? cellXfs[col.StyleID].newID : col.StyleID;
+                if (styleID > 0)
+                {
+                    sw.Write(" style=\"{0}\"", styleID);
+                }
+                sw.Write(" />");
+
+                //if (col.PageBreak)
+                //{
+                //    colBreaks.Add(col.ColumnMin);
+                //}
+            }
+            if (!first)
+            {
+                sw.Write("</cols>");
+            }
+        }
+        /// <summary>
+        /// Insert row and cells into the XML document
+        /// </summary>
+        private void UpdateRowCellData(StreamWriter sw)
+        {
+            ExcelStyleCollection<ExcelXfs> cellXfs = _package.Workbook.Styles.CellXfs;
+            
+            int row = -1;
+
+            StringBuilder sbXml = new StringBuilder();
+            var ss = _package.Workbook._sharedStrings;
+            var styles = _package.Workbook.Styles;
+            var cache = new StringBuilder();
+            cache.Append("<sheetData>");
+            
+            //Set a value for cells with style and no value set.
+            var cseStyle = new CellsStoreEnumerator<int>(_styles, 0, 0, ExcelPackage.MaxRows, ExcelPackage.MaxColumns);
+            foreach (var s in cseStyle)
+            {
+                if(!_values.Exists(cseStyle.Row, cseStyle.Column))
+                {
+                    _values.SetValue(cseStyle.Row, cseStyle.Column, null);
+                }
+            }
+
+            var cse = new CellsStoreEnumerator<object>(_values, 1, 0, ExcelPackage.MaxRows, ExcelPackage.MaxColumns);
+            //foreach (IRangeID r in _cells)
+            while(cse.Next())
+            {
+                if (cse.Column>0)
+                {
+                    int styleID = cellXfs[styles.GetStyleId(this, cse.Row, cse.Column)].newID;
+                    //Add the row element if it's a new row
+                    if (cse.Row != row)
+                    {
+                        WriteRow(cache, cellXfs, row, cse.Row);
+                        row = cse.Row;
+                    }
+                    object v = cse.Value;
+                    object formula = _formulas.GetValue(cse.Row, cse.Column);
+                    if (formula is int)
+                    {
+                        int sfId = (int)formula;
+                        var f = _sharedFormulas[(int)sfId];
+                        if (f.Address.IndexOf(':') > 0)
+                        {
+                            if (f.StartCol == cse.Column && f.StartRow == cse.Row)
+                            {
+                                if (f.IsArray)
+                                {
+                                    cache.AppendFormat("<c r=\"{0}\" s=\"{1}\"{5}><f ref=\"{2}\" t=\"array\">{3}</f>{4}</c>", cse.CellAddress, styleID < 0 ? 0 : styleID, f.Address, SecurityElement.Escape(f.Formula), GetFormulaValue(v), GetCellType(v,true));
+                                }
+                                else
+                                {
+                                    cache.AppendFormat("<c r=\"{0}\" s=\"{1}\"{6}><f ref=\"{2}\" t=\"shared\"  si=\"{3}\">{4}</f>{5}</c>", cse.CellAddress, styleID < 0 ? 0 : styleID, f.Address, sfId, SecurityElement.Escape(f.Formula), GetFormulaValue(v), GetCellType(v,true));
+                                }
+
+                            }
+                            else if (f.IsArray)
+                            {
+                                cache.AppendFormat("<c r=\"{0}\" s=\"{1}\" />", cse.CellAddress, styleID < 0 ? 0 : styleID);
+                            }
+                            else
+                            {
+                                cache.AppendFormat("<c r=\"{0}\" s=\"{1}\"{4}><f t=\"shared\" si=\"{2}\" />{3}</c>", cse.CellAddress, styleID < 0 ? 0 : styleID, sfId, GetFormulaValue(v), GetCellType(v,true));
+                            }
+                        }
+                        else
+                        {
+                            // We can also have a single cell array formula
+                            if(f.IsArray)
+                            {
+                                cache.AppendFormat("<c r=\"{0}\" s=\"{1}\"{5}><f ref=\"{2}\" t=\"array\">{3}</f>{4}</c>", cse.CellAddress, styleID < 0 ? 0 : styleID, string.Format("{0}:{1}", f.Address, f.Address), SecurityElement.Escape(f.Formula), GetFormulaValue(v), GetCellType(v,true));
+                            }
+                            else
+                            {
+                                cache.AppendFormat("<c r=\"{0}\" s=\"{1}\">", f.Address, styleID < 0 ? 0 : styleID);
+                                cache.AppendFormat("<f>{0}</f>{1}</c>", SecurityElement.Escape(f.Formula), GetFormulaValue(v));
+                            }
+                        }
+                    }
+                    else if (formula!=null && formula.ToString()!="")
+                    {
+                        cache.AppendFormat("<c r=\"{0}\" s=\"{1}\"{2}>", cse.CellAddress, styleID < 0 ? 0 : styleID, GetCellType(v,true));
+                        cache.AppendFormat("<f>{0}</f>{1}</c>", SecurityElement.Escape(formula.ToString()), GetFormulaValue(v));
+                    }
+                    else
+                    {
+                        if (v == null && styleID > 0)
+                        {
+                            cache.AppendFormat("<c r=\"{0}\" s=\"{1}\" />", cse.CellAddress, styleID < 0 ? 0 : styleID);
+                        }
+                        else if(v != null)
+                        {
+                            if ((v.GetType().IsPrimitive || v is double || v is decimal || v is DateTime || v is TimeSpan))
+                            {
+                                //string sv = GetValueForXml(v);
+                                cache.AppendFormat("<c r=\"{0}\" s=\"{1}\" {2}>", cse.CellAddress, styleID < 0 ? 0 : styleID, GetCellType(v));
+                                cache.AppendFormat("{0}</c>", GetFormulaValue(v));
+                            }
+                            else
+                            {
+                                int ix;
+                                if (!ss.ContainsKey(v.ToString()))
+                                {
+                                    ix = ss.Count;
+                                    ss.Add(v.ToString(), new ExcelWorkbook.SharedStringItem() { isRichText = _flags.GetFlagValue(cse.Row,cse.Column,CellFlags.RichText), pos = ix });
+                                }
+                                else
+                                {
+                                    ix = ss[v.ToString()].pos;
+                                }
+                                cache.AppendFormat("<c r=\"{0}\" s=\"{1}\" t=\"s\">", cse.CellAddress, styleID < 0 ? 0 : styleID);
+                                cache.AppendFormat("<v>{0}</v></c>", ix);
+                            }
+                        }
+                    }
+                    ////Update hyperlinks.
+                   //if (cell.Hyperlink != null)
+                    //{
+                    //    _hyperLinkCells.Add(cell.CellID);
+                    //}
+                }
+                else  //ExcelRow
+                {
+                    //int newRow=((ExcelRow)cse.Value).Row;
+                    WriteRow(cache, cellXfs, row, cse.Row);
+                    row = cse.Row;
+                }
+                if (cache.Length > 0x600000)
+                {
+                    sw.Write(cache.ToString());
+                    cache = new StringBuilder();
+                }
+            }
+
+            if (row != -1) cache.Append("</row>");
+            cache.Append("</sheetData>");
+            sw.Write(cache.ToString());
+            sw.Flush();
+        }
+
+        private object GetFormulaValue(object v)
+        {
+            //if (_package.Workbook._isCalculated)
+            //{                    
+            if (v != null && v.ToString()!="")
+            {
+                return "<v>" + SecurityElement.Escape(GetValueForXml(v)) + "</v>"; //Fixes issue 15071
+            }            
+            else
+            {
+                return "";
+            }
+        }
+
+        private string GetCellType(object v, bool allowStr=false)
+        {
+            if (v is bool)
+            {
+                return " t=\"b\"";
+            }
+            else if ((v is double && double.IsInfinity((double)v)) || v is ExcelErrorValue)
+            {
+                return " t=\"e\"";
+            }
+            else if(allowStr && v!=null && !(v.GetType().IsPrimitive || v is double || v is decimal || v is DateTime || v is TimeSpan))
+            {
+                return " t=\"str\"";
+            }
+            else
+            {
+                return "";
+            }
+        }
+
+        private string GetValueForXml(object v)
+        {
+            string s;
+            try
+            {
+                if (v is DateTime)
+                {
+                    double sdv = ((DateTime)v).ToOADate();
+
+                    if (Workbook.Date1904)
+                    {
+                        sdv -= ExcelWorkbook.date1904Offset;
+                    }
+
+                    s = sdv.ToString(CultureInfo.InvariantCulture);
+                }
+                else if (v is TimeSpan)
+                {
+                    s = new DateTime(((TimeSpan)v).Ticks).ToOADate().ToString(CultureInfo.InvariantCulture); ;
+                }
+                else if(v.GetType().IsPrimitive || v is double || v is decimal)
+                {
+                    if (v is double && double.IsNaN((double)v))
+                    {
+                        s = "";
+                    }
+                    else if (v is double && double.IsInfinity((double)v))
+                    {
+                        s = "#NUM!";
+                    }
+                    else
+                    {
+                        s = Convert.ToDouble(v, CultureInfo.InvariantCulture).ToString("R15", CultureInfo.InvariantCulture);
+                    }
+                }
+                else
+                {
+                    s = v.ToString();
+                }
+            }
+
+            catch
+            {
+                s = "0";
+            }
+            return s;
+        }
+        private void WriteRow(StringBuilder cache, ExcelStyleCollection<ExcelXfs> cellXfs, int prevRow, int row)
+        {
+            if (prevRow != -1) cache.Append("</row>");
+            //ulong rowID = ExcelRow.GetRowID(SheetID, row);
+            cache.AppendFormat("<row r=\"{0}\" ", row);
+            RowInternal currRow = _values.GetValue(row, 0) as RowInternal;
+            if (currRow != null)
+            {
+
+                if (currRow.Hidden == true)
+                {
+                    cache.Append("ht=\"0\" hidden=\"1\" ");
+                }
+                else if (currRow.Height != DefaultRowHeight && currRow.Height>=0)
+                {
+                    cache.AppendFormat(string.Format(CultureInfo.InvariantCulture, "ht=\"{0}\" ", currRow.Height));
+                    if (currRow.CustomHeight)
+                    {
+                        cache.Append("customHeight=\"1\" ");
+                    }
+                }
+
+                if (currRow.OutlineLevel > 0)
+                {
+                    cache.AppendFormat("outlineLevel =\"{0}\" ", currRow.OutlineLevel);
+                    if (currRow.Collapsed)
+                    {
+                        if (currRow.Hidden)
+                        {
+                            cache.Append(" collapsed=\"1\" ");
+                        }
+                        else
+                        {
+                            cache.Append(" collapsed=\"1\" hidden=\"1\" "); //Always hidden
+                        }
+                    }
+                }
+                if (currRow.Phonetic)
+                {
+                    cache.Append("ph=\"1\" ");
+                }
+            }
+            var s = _styles.GetValue(row, 0);
+            if (s > 0)
+            {
+                cache.AppendFormat("s=\"{0}\" customFormat=\"1\"", cellXfs[s].newID);
+            }
+            cache.Append(">");
+        }
+        private void WriteRow(StreamWriter sw, ExcelStyleCollection<ExcelXfs> cellXfs, int prevRow, int row)
+        {
+            if (prevRow != -1) sw.Write("</row>");
+            //ulong rowID = ExcelRow.GetRowID(SheetID, row);
+            sw.Write("<row r=\"{0}\" ", row);
+            RowInternal currRow = _values.GetValue(row, 0) as RowInternal;
+            if (currRow!=null)
+            {
+                
+                if (currRow.Hidden == true)
+                {
+                    sw.Write("ht=\"0\" hidden=\"1\" ");
+                }
+                else if (currRow.Height != DefaultRowHeight)
+                {
+                    sw.Write(string.Format(CultureInfo.InvariantCulture, "ht=\"{0}\" ", currRow.Height));
+                    if (currRow.CustomHeight)
+                    {
+                        sw.Write("customHeight=\"1\" ");
+                    }
+                }
+
+                if (currRow.OutlineLevel > 0)
+                {
+                    sw.Write("outlineLevel =\"{0}\" ", currRow.OutlineLevel);
+                    if (currRow.Collapsed)
+                    {
+                        if (currRow.Hidden)
+                        {
+                            sw.Write(" collapsed=\"1\" ");
+                        }
+                        else
+                        {
+                            sw.Write(" collapsed=\"1\" hidden=\"1\" "); //Always hidden
+                        }
+                    }
+                }
+                if (currRow.Phonetic)
+                {
+                    sw.Write("ph=\"1\" ");
+                }
+            }
+            var s = _styles.GetValue(row, 0);
+            if (s > 0)
+            {
+                sw.Write("s=\"{0}\" customFormat=\"1\"", cellXfs[s].newID);
+            }
+            sw.Write(">");
+        }
+
+        /// <summary>
+        /// Update xml with hyperlinks 
+        /// </summary>
+        /// <param name="sw">The stream</param>
+        private void UpdateHyperLinks(StreamWriter sw)
+        {
+                Dictionary<string, string> hyps = new Dictionary<string, string>();
+                var cse = new CellsStoreEnumerator<Uri>(_hyperLinks);
+                bool first = true;
+                //foreach (ulong cell in _hyperLinks)
+                while(cse.Next())
+                {
+                    if (first)
+                    {
+                        sw.Write("<hyperlinks>");
+                        first = false;
+                    }
+                    //int row, col;
+                    var uri = _hyperLinks.GetValue(cse.Row, cse.Column);
+                    //ExcelCell cell = _cells[cellId] as ExcelCell;
+                    if (uri is ExcelHyperLink && !string.IsNullOrEmpty((uri as ExcelHyperLink).ReferenceAddress))
+                    {
+                        ExcelHyperLink hl = uri as ExcelHyperLink;
+                        sw.Write("<hyperlink ref=\"{0}\" location=\"{1}\" {2}{3}/>",
+                                Cells[cse.Row, cse.Column, cse.Row + hl.RowSpann, cse.Column + hl.ColSpann].Address, 
+                                ExcelCellBase.GetFullAddress(SecurityElement.Escape(Name), SecurityElement.Escape(hl.ReferenceAddress)),
+                                    string.IsNullOrEmpty(hl.Display) ? "" : "display=\"" + SecurityElement.Escape(hl.Display) + "\" ",
+                                    string.IsNullOrEmpty(hl.ToolTip) ? "" : "tooltip=\"" + SecurityElement.Escape(hl.ToolTip) + "\" ");
+                    }
+                    else if( uri!=null)
+                    {
+                        string id;
+                        Uri hyp;
+                        if (uri is ExcelHyperLink)
+                        {
+                            hyp = ((ExcelHyperLink)uri).OriginalUri;
+                        }
+                        else
+                        {
+                            hyp = uri;
+                        }
+                        if (hyps.ContainsKey(hyp.OriginalString))
+                        {
+                            id = hyps[hyp.OriginalString];
+                        }
+                        else
+                        {
+                            var relationship = Part.CreateRelationship(hyp, Packaging.TargetMode.External, ExcelPackage.schemaHyperlink);
+                            if (uri is ExcelHyperLink)
+                            {
+                                ExcelHyperLink hl = uri as ExcelHyperLink;
+                                sw.Write("<hyperlink ref=\"{0}\" {2}{3}r:id=\"{1}\" />", ExcelCellBase.GetAddress(cse.Row, cse.Column), relationship.Id,                                
+                                    string.IsNullOrEmpty(hl.Display) ? "" : "display=\"" + SecurityElement.Escape(hl.Display) + "\" ",
+                                    string.IsNullOrEmpty(hl.ToolTip) ? "" : "tooltip=\"" + SecurityElement.Escape(hl.ToolTip) + "\" ");
+                            }
+                            else
+                            {
+                                sw.Write("<hyperlink ref=\"{0}\" r:id=\"{1}\" />", ExcelCellBase.GetAddress(cse.Row, cse.Column), relationship.Id);
+                            }
+                            id = relationship.Id;
+                        }
+                        //cell.HyperLinkRId = id;
+                    }
+                }
+                if (!first)
+                {
+                    sw.Write("</hyperlinks>");
+                }
+        }
+        /// <summary>
+        /// Create the hyperlinks node in the XML
+        /// </summary>
+        /// <returns></returns>
+        private XmlNode CreateHyperLinkCollection()
+        {
+            XmlElement hl=_worksheetXml.CreateElement("hyperlinks",ExcelPackage.schemaMain);
+            XmlNode prevNode = _worksheetXml.SelectSingleNode("//d:conditionalFormatting", NameSpaceManager);
+            if (prevNode == null)
+            {
+                prevNode = _worksheetXml.SelectSingleNode("//d:mergeCells", NameSpaceManager);
+                if (prevNode == null)
+                {
+                    prevNode = _worksheetXml.SelectSingleNode("//d:sheetData", NameSpaceManager);
+                }
+            }
+            return _worksheetXml.DocumentElement.InsertAfter(hl, prevNode);
+        }
+        /// <summary>
+        /// Dimension address for the worksheet. 
+        /// Top left cell to Bottom right.
+        /// If the worksheet has no cells, null is returned
+        /// </summary>
+        public ExcelAddressBase Dimension
+        {
+            get
+            {
+                CheckSheetType();
+                int fromRow, fromCol, toRow, toCol;
+                if (_values.GetDimension(out fromRow, out fromCol, out toRow, out toCol))
+                {
+                    var addr = new ExcelAddressBase(fromRow, fromCol, toRow, toCol);
+                    addr._ws = Name;
+                    return addr;
+                }
+                else
+                {
+                    return null;
+                }
+            }
+        }
+        ExcelSheetProtection _protection=null;
+        /// <summary>
+        /// Access to sheet protection properties
+        /// </summary>
+        public ExcelSheetProtection Protection
+        {
+            get
+            {
+                if (_protection == null)
+                {
+                    _protection = new ExcelSheetProtection(NameSpaceManager, TopNode, this);
+                }
+                return _protection;
+            }
+        }
+
+        private ExcelProtectedRangeCollection _protectedRanges;
+        public ExcelProtectedRangeCollection ProtectedRanges
+        {
+            get
+            {
+                if (_protectedRanges == null)
+                    _protectedRanges = new ExcelProtectedRangeCollection(NameSpaceManager, TopNode, this);
+                return _protectedRanges;
+            }
+        }
+
+        #region Drawing
+        ExcelDrawings _drawings = null;
+        /// <summary>
+        /// Collection of drawing-objects like shapes, images and charts
+        /// </summary>
+        public ExcelDrawings Drawings
+        {
+            get
+            {
+                if (_drawings == null)
+                {
+                    _drawings = new ExcelDrawings(_package, this);
+                }
+                return _drawings;
+            }
+        }
+        #endregion
+        ExcelTableCollection _tables = null;
+        /// <summary>
+        /// Tables defined in the worksheet.
+        /// </summary>
+        public ExcelTableCollection Tables
+        {
+            get
+            {
+                CheckSheetType();
+                if (_tables == null)
+                {
+                    _tables = new ExcelTableCollection(this);
+                }
+                return _tables;
+            }
+        }
+        ExcelPivotTableCollection _pivotTables = null;
+        /// <summary>
+        /// Pivottables defined in the worksheet.
+        /// </summary>
+        public ExcelPivotTableCollection PivotTables
+        {
+            get
+            {
+                CheckSheetType();
+                if (_pivotTables == null)
+                {
+                    _pivotTables = new ExcelPivotTableCollection(this);
+                }
+                return _pivotTables;
+            }
+        }
+        private ExcelConditionalFormattingCollection _conditionalFormatting = null;
+        /// <summary>
+        /// ConditionalFormatting defined in the worksheet. Use the Add methods to create ConditionalFormatting and add them to the worksheet. Then
+        /// set the properties on the instance returned.
+        /// </summary>
+        /// <seealso cref="ExcelConditionalFormattingCollection"/>
+        public ExcelConditionalFormattingCollection ConditionalFormatting
+        {
+            get
+            {
+                CheckSheetType();
+                if (_conditionalFormatting == null)
+                {
+                    _conditionalFormatting = new ExcelConditionalFormattingCollection(this);
+                }
+                return _conditionalFormatting;
+            }
+        }
+        private ExcelDataValidationCollection _dataValidation = null;
+        /// <summary>
+        /// DataValidation defined in the worksheet. Use the Add methods to create DataValidations and add them to the worksheet. Then
+        /// set the properties on the instance returned.
+        /// </summary>
+        /// <seealso cref="ExcelDataValidationCollection"/>
+        public ExcelDataValidationCollection DataValidations
+        {
+            get
+            {
+                CheckSheetType();
+                if (_dataValidation == null)
+                {
+                    _dataValidation = new ExcelDataValidationCollection(this);
+                }
+                return _dataValidation;
+            }
+        }
+        ExcelBackgroundImage _backgroundImage = null;
+        /// <summary>
+        /// An image displayed as the background of the worksheet.
+        /// </summary>
+        public ExcelBackgroundImage BackgroundImage
+        {
+            get
+            {
+                if (_backgroundImage == null)
+                {
+                    _backgroundImage = new ExcelBackgroundImage(NameSpaceManager, TopNode, this);
+                }
+                return _backgroundImage;
+            }
+        }
+        /// <summary>
+		/// Returns the style ID given a style name.  
+		/// The style ID will be created if not found, but only if the style name exists!
+		/// </summary>
+		/// <param name="StyleName"></param>
+		/// <returns></returns>
+		internal int GetStyleID(string StyleName)
+		{
+			ExcelNamedStyleXml namedStyle=null;
+            Workbook.Styles.NamedStyles.FindByID(StyleName, ref namedStyle);
+            if (namedStyle.XfId == int.MinValue)
+            {
+                namedStyle.XfId=Workbook.Styles.CellXfs.FindIndexByID(namedStyle.Style.Id);
+            }
+            return namedStyle.XfId;
+		}
+        /// <summary>
+        /// The workbook object
+        /// </summary>
+        public ExcelWorkbook Workbook
+        {
+            get
+            {
+                return _package.Workbook;
+            }
+        }
+		#endregion
+        #endregion  // END Worksheet Private Methods
+
+        /// <summary>
+        /// Get the next ID from a shared formula or an Array formula
+        /// Sharedforumlas will have an id from 0-x. Array formula ids start from 0x4000001-. 
+        /// </summary>
+        /// <param name="isArray">If the formula is an array formula</param>
+        /// <returns></returns>
+        internal int GetMaxShareFunctionIndex(bool isArray)
+        {
+            int i=_sharedFormulas.Count + 1;
+            if (isArray)
+                i |= 0x40000000;
+
+            while(_sharedFormulas.ContainsKey(i))
+            {
+                i++;
+            }
+            return i;
+        }
+        internal void SetHFLegacyDrawingRel(string relID)
+        {
+            SetXmlNodeString("d:legacyDrawingHF/@r:id", relID);
+        }
+        internal void RemoveLegacyDrawingRel(string relID)
+        {
+            var n = WorksheetXml.DocumentElement.SelectSingleNode(string.Format("d:legacyDrawing[@r:id=\"{0}\"]", relID), NameSpaceManager);
+            if (n != null)
+            {
+                n.ParentNode.RemoveChild(n);
+            }
+        }
+
+        internal void UpdateCellsWithDate1904Setting()
+        {
+            var cse = new CellsStoreEnumerator<object>(_values);
+            var offset = Workbook.Date1904 ? -ExcelWorkbook.date1904Offset : ExcelWorkbook.date1904Offset;
+            while(cse.MoveNext())
+            {
+                if (cse.Value is DateTime)
+                {
+                    try
+                    {
+                        double sdv = ((DateTime)cse.Value).ToOADate();
+                        sdv += offset;
+
+                        cse.Value = DateTime.FromOADate(sdv);
+                    }
+                    catch
+                    {
+                    }
+                }
+            }
+        }
+        internal string GetFormula(int row, int col)
+        {
+            var v = _formulas.GetValue(row, col);
+            if (v is int)
+            {
+                return _sharedFormulas[(int)v].GetFormula(row,col, Name);
+            }
+            else if (v != null)
+            {
+                return v.ToString();
+            }
+            else
+            {
+                return "";
+            }
+        }
+        internal string GetFormulaR1C1(int row, int col)
+        {
+            var v = _formulas.GetValue(row, col);
+            if (v is int)
+            {
+                var sf = _sharedFormulas[(int)v];
+                return ExcelCellBase.TranslateToR1C1(sf.Formula, sf.StartRow, sf.StartCol);
+            }
+            else if (v != null)
+            {
+                return ExcelCellBase.TranslateToR1C1(v.ToString(), row, col);
+            }
+            else
+            {
+                return "";
+            }
+        }
+
+        private void DisposeInternal(IDisposable candidateDisposable)
+        {
+            if (candidateDisposable != null)
+            {
+                candidateDisposable.Dispose();
+            }
+        }
+
+
+        public void Dispose()
+        {
+            DisposeInternal(_values);
+            DisposeInternal(_formulas);
+            DisposeInternal(_flags);
+            DisposeInternal(_hyperLinks);
+            DisposeInternal(_styles);
+            DisposeInternal(_types);
+            DisposeInternal(_commentsStore);
+            DisposeInternal(_formulaTokens);
+
+            _values = null;
+            _formulas = null;
+            _flags = null;
+            _hyperLinks = null;
+            _styles = null;
+            _types = null;
+            _commentsStore = null;
+            _formulaTokens = null;
+
+            _package = null;
+            _pivotTables = null;
+            _protection = null;
+            if(_sharedFormulas != null) _sharedFormulas.Clear();
+            _sharedFormulas = null;
+            _sheetView = null;
+            _tables = null;
+            _vmlDrawings = null;
+            _conditionalFormatting = null;
+            _dataValidation = null;
+            _drawings = null;
+        }
+
+        /// <summary>
+        /// Get the ExcelColumn for column (span ColumnMin and ColumnMax)
+        /// </summary>
+        /// <param name="column"></param>
+        /// <returns></returns>
+        internal ExcelColumn GetColumn(int column)
+        {
+            var c = _values.GetValue(0, column) as ExcelColumn;
+            if (c == null)
+            {
+                int row = 0, col = column;
+                if (_values.PrevCell(ref row, ref col))
+                {
+                    c = _values.GetValue(0, col) as ExcelColumn;
+                    if (c != null && c.ColumnMax >= column)
+                    {
+                        return c;
+                    }
+                    return null;
+                }
+            }
+            return c;
+
+        }
+    }  // END class Worksheet
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelWorksheetView.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelWorksheetView.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelWorksheetView.cs	(revision 12707)
@@ -0,0 +1,467 @@
+/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		    Initial Release		       2009-10-01
+ * Jan Källman		    License changed GPL-->LGPL 2011-12-27
+ *******************************************************************************/
+using System;
+using System.Xml;
+
+namespace OfficeOpenXml
+{
+	/// <summary>
+	/// Represents the different view states of the worksheet
+	/// </summary>
+	public class ExcelWorksheetView : XmlHelper
+	{
+        /// <summary>
+        /// The worksheet panes after a freeze or split.
+        /// </summary>
+        public class ExcelWorksheetPanes : XmlHelper
+        {
+            XmlElement _selectionNode = null;
+            internal ExcelWorksheetPanes(XmlNamespaceManager ns, XmlNode topNode) :
+                base(ns, topNode)
+            {
+                if(topNode.Name=="selection")
+                {
+                    _selectionNode=topNode as XmlElement;
+                }
+            }
+
+            const string _activeCellPath = "@activeCell";
+            /// <summary>
+            /// Set the active cell. Must be set within the SelectedRange.
+            /// </summary>
+            public string ActiveCell
+            {
+                get
+                {
+                    string address = GetXmlNodeString(_activeCellPath);
+                    if (address == "")
+                    {
+                        return "A1";
+                    }
+                    return address;
+                }
+                set
+                {
+                    int fromCol, fromRow, toCol, toRow;
+                    if(_selectionNode==null) CreateSelectionElement();
+                    ExcelCellBase.GetRowColFromAddress(value, out fromRow, out fromCol, out toRow, out toCol);
+                    SetXmlNodeString(_activeCellPath, value);
+                    if (((XmlElement)TopNode).GetAttribute("sqref") == "")
+                    {
+
+                        SelectedRange = ExcelCellBase.GetAddress(fromRow, fromCol);
+                    }
+                    else
+                    {
+                        //TODO:Add fix for out of range here
+                    }
+                }
+            }
+
+            private void CreateSelectionElement()
+            {
+ 	            _selectionNode=TopNode.OwnerDocument.CreateElement("selection", ExcelPackage.schemaMain);
+                TopNode.AppendChild(_selectionNode);
+                TopNode=_selectionNode;             
+            }
+            const string _selectionRangePath = "@sqref";
+            /// <summary>
+            /// Selected Cells.Used in combination with ActiveCell
+            /// </summary>        
+            public string SelectedRange
+            {
+                get
+                {
+                    string address = GetXmlNodeString(_selectionRangePath);
+                    if (address == "")
+                    {
+                        return "A1";
+                    }
+                    return address;
+                }
+                set
+                {
+                    int fromCol, fromRow, toCol, toRow;
+                    if(_selectionNode==null) CreateSelectionElement();
+                    ExcelCellBase.GetRowColFromAddress(value, out fromRow, out fromCol, out toRow, out toCol);
+                    SetXmlNodeString(_selectionRangePath, value);
+                    if (((XmlElement)TopNode).GetAttribute("activeCell") == "")
+                    {
+
+                        ActiveCell = ExcelCellBase.GetAddress(fromRow, fromCol);
+                    }
+                    else
+                    {
+                        //TODO:Add fix for out of range here
+                    }
+                }
+            }
+        }
+		private ExcelWorksheet _worksheet;
+
+		#region ExcelWorksheetView Constructor
+		/// <summary>
+		/// Creates a new ExcelWorksheetView which provides access to all the view states of the worksheet.
+		/// </summary>
+        /// <param name="ns"></param>
+        /// <param name="node"></param>
+        /// <param name="xlWorksheet"></param>
+		internal ExcelWorksheetView(XmlNamespaceManager ns, XmlNode node,  ExcelWorksheet xlWorksheet) :
+            base(ns, node)
+		{
+            _worksheet = xlWorksheet;
+            SchemaNodeOrder = new string[] { "sheetViews", "sheetView", "pane", "selection" };
+            Panes = LoadPanes(); 
+		}
+
+		#endregion
+        private ExcelWorksheetPanes[] LoadPanes()
+        {
+            XmlNodeList nodes = TopNode.SelectNodes("//d:selection", NameSpaceManager);
+            if(nodes.Count==0)
+            {
+                return new ExcelWorksheetPanes[] { new ExcelWorksheetPanes(NameSpaceManager, TopNode) };
+            }
+            else
+            {
+                ExcelWorksheetPanes[] panes = new ExcelWorksheetPanes[nodes.Count];
+                int i=0;
+                foreach(XmlElement elem in nodes)
+                {
+                    panes[i++] = new ExcelWorksheetPanes(NameSpaceManager, elem);
+                }
+                return panes;
+            }
+        }
+		#region SheetViewElement
+		/// <summary>
+		/// Returns a reference to the sheetView element
+		/// </summary>
+		protected internal XmlElement SheetViewElement
+		{
+			get 
+			{
+				return (XmlElement)TopNode;
+			}
+		}
+		#endregion
+		#region TabSelected
+        private XmlElement _selectionNode = null;
+        private XmlElement SelectionNode
+        {
+            get
+            {
+                _selectionNode = SheetViewElement.SelectSingleNode("//d:selection", _worksheet.NameSpaceManager) as XmlElement;
+                if (_selectionNode == null)
+                {
+                    _selectionNode = _worksheet.WorksheetXml.CreateElement("selection", ExcelPackage.schemaMain);
+                    SheetViewElement.AppendChild(_selectionNode);
+                }
+                return _selectionNode;
+            }
+        }
+        #endregion
+        #region Public Methods & Properties
+        /// <summary>
+        /// The active cell.
+        /// </summary>
+        public string ActiveCell
+        {
+            get
+            {
+                return Panes[Panes.GetUpperBound(0)].ActiveCell;
+            }
+            set 
+            {
+                Panes[Panes.GetUpperBound(0)].ActiveCell = value;
+            }
+        }
+        /// <summary>
+        /// Selected Cells in the worksheet.Used in combination with ActiveCell
+        /// </summary>
+        public string SelectedRange
+        {
+            get
+            {
+                return Panes[Panes.GetUpperBound(0)].SelectedRange;
+            }
+            set
+            {
+                Panes[Panes.GetUpperBound(0)].SelectedRange = value;
+            }
+        }
+        /// <summary>
+        /// Indicates if the worksheet is selected within the workbook
+        /// </summary>
+        public bool TabSelected
+        {
+            get
+            {
+                return GetXmlNodeBool("@tabSelected");
+            }
+            set
+            {
+                if (value)
+                {
+                    //    // ensure no other worksheet has its tabSelected attribute set to 1
+                    foreach (ExcelWorksheet sheet in _worksheet._package.Workbook.Worksheets)
+                        sheet.View.TabSelected = false;
+
+                    SheetViewElement.SetAttribute("tabSelected", "1");
+                    XmlElement bookView = _worksheet.Workbook.WorkbookXml.SelectSingleNode("//d:workbookView", _worksheet.NameSpaceManager) as XmlElement;
+                    if (bookView != null)
+                    {
+                        bookView.SetAttribute("activeTab", (_worksheet.PositionID - 1).ToString());
+                    }
+                }
+                else
+                    SetXmlNodeString("@tabSelected", "0");
+
+            }
+        }
+
+		/// <summary>
+		/// Sets the view mode of the worksheet to pagelayout
+		/// </summary>
+		public bool PageLayoutView
+		{
+			get
+			{
+                return GetXmlNodeString("@view") == "pageLayout";
+			}
+			set
+			{
+                if (value)
+                    SetXmlNodeString("@view", "pageLayout");
+                else
+                    SheetViewElement.RemoveAttribute("view");
+			}
+		}
+        /// <summary>
+        /// Sets the view mode of the worksheet to pagebreak
+        /// </summary>
+        public bool PageBreakView
+        {
+            get
+            {
+                return GetXmlNodeString("@view") == "pageBreakPreview";
+            }
+            set
+            {
+                if (value)
+                    SetXmlNodeString("@view", "pageBreakPreview");
+                else
+                    SheetViewElement.RemoveAttribute("view");
+            }
+        }
+        /// <summary>
+        /// Show gridlines in the worksheet
+        /// </summary>
+        public bool ShowGridLines 
+        {
+            get
+            {
+                return GetXmlNodeBool("@showGridLines");
+            }
+            set
+            {
+                SetXmlNodeString("@showGridLines", value ? "1" : "0");
+            }
+        }
+        /// <summary>
+        /// Show the Column/Row headers (containg column letters and row numbers)
+        /// </summary>
+        public bool ShowHeaders
+        {
+            get
+            {
+                return GetXmlNodeBool("@showRowColHeaders");
+            }
+            set
+            {
+                SetXmlNodeString("@showRowColHeaders", value ? "1" : "0");
+            }
+        }
+        /// <summary>
+        /// Window zoom magnification for current view representing percent values.
+        /// </summary>
+        public int ZoomScale
+        {
+            get
+            {
+                return GetXmlNodeInt("@zoomScale");
+            }
+            set
+            {
+                if (value < 10 || value > 400)
+                {
+                    throw new ArgumentOutOfRangeException("Zoome scale out of range (10-400)");
+                }
+                SetXmlNodeString("@zoomScale", value.ToString());
+            }
+        }
+        /// <summary>
+        /// Flag indicating whether the sheet is in 'right to left' display mode. When in this mode,Column A is on the far right, Column B ;is one column left of Column A, and so on. Also,information in cells is displayed in the Right to Left format.
+        /// </summary>
+        public bool RightToLeft
+        {
+            get
+            {
+                return GetXmlNodeBool("@rightToLeft");
+            }
+            set
+            {
+                SetXmlNodeString("@rightToLeft", value == true ? "1" : "0");
+            }
+        }
+        internal bool WindowProtection 
+        {
+            get
+            {
+                return GetXmlNodeBool("@windowProtection",false);
+            }
+            set
+            {
+                SetXmlNodeBool("@windowProtection",value,false);
+            }
+        }
+        /// <summary>
+        /// Reference to the panes
+        /// </summary>
+        public ExcelWorksheetPanes[] Panes
+        {
+            get;
+            internal set;
+        }
+        string _paneNodePath = "d:pane";
+        string _selectionNodePath = "d:selection";
+        /// <summary>
+        /// Freeze the columns/rows to left and above the cell
+        /// </summary>
+        /// <param name="Row"></param>
+        /// <param name="Column"></param>
+        public void FreezePanes(int Row, int Column)
+        {
+            //TODO:fix this method to handle splits as well.
+            if (Row == 1 && Column == 1) UnFreezePanes();
+            string sqRef = SelectedRange, activeCell = ActiveCell;
+            
+            XmlElement paneNode = TopNode.SelectSingleNode(_paneNodePath, NameSpaceManager) as XmlElement;
+            if (paneNode == null)
+            {
+                CreateNode(_paneNodePath);
+                paneNode = TopNode.SelectSingleNode(_paneNodePath, NameSpaceManager) as XmlElement;
+            }
+            paneNode.RemoveAll();   //Clear all attributes
+            if (Column > 1) paneNode.SetAttribute("xSplit", (Column - 1).ToString());
+            if (Row > 1) paneNode.SetAttribute("ySplit", (Row - 1).ToString());
+            paneNode.SetAttribute("topLeftCell", ExcelCellBase.GetAddress(Row, Column));
+            paneNode.SetAttribute("state", "frozen");
+
+            RemoveSelection();
+
+            if (Row > 1 && Column==1)
+            {
+                paneNode.SetAttribute("activePane", "bottomLeft");
+                XmlElement sel=TopNode.OwnerDocument.CreateElement("selection", ExcelPackage.schemaMain);
+                sel.SetAttribute("pane", "bottomLeft");
+                if (activeCell != "") sel.SetAttribute("activeCell", activeCell);
+                if (sqRef != "") sel.SetAttribute("sqref", sqRef);
+                sel.SetAttribute("sqref", sqRef);
+                TopNode.InsertAfter(sel, paneNode);
+            }
+            else if (Column > 1 && Row == 1)
+            {
+                paneNode.SetAttribute("activePane", "topRight");
+                XmlElement sel = TopNode.OwnerDocument.CreateElement("selection", ExcelPackage.schemaMain);
+                sel.SetAttribute("pane", "topRight");
+                if (activeCell != "") sel.SetAttribute("activeCell", activeCell);
+                if (sqRef != "") sel.SetAttribute("sqref", sqRef);
+                TopNode.InsertAfter(sel, paneNode);
+            }
+            else
+            {
+                paneNode.SetAttribute("activePane", "bottomRight");
+                XmlElement sel1 = TopNode.OwnerDocument.CreateElement("selection", ExcelPackage.schemaMain);
+                sel1.SetAttribute("pane", "topRight");
+                string cell = ExcelCellBase.GetAddress(1, Column);
+                sel1.SetAttribute("activeCell", cell);
+                sel1.SetAttribute("sqref", cell);
+                paneNode.ParentNode.InsertAfter(sel1, paneNode);
+
+                XmlElement sel2 = TopNode.OwnerDocument.CreateElement("selection", ExcelPackage.schemaMain);
+                cell = ExcelCellBase.GetAddress(Row, 1);
+                sel2.SetAttribute("pane", "bottomLeft");
+                sel2.SetAttribute("activeCell", cell);
+                sel2.SetAttribute("sqref", cell);
+                sel1.ParentNode.InsertAfter(sel2, sel1);
+
+                XmlElement sel3 = TopNode.OwnerDocument.CreateElement("selection", ExcelPackage.schemaMain);
+                sel3.SetAttribute("pane", "bottomRight");
+                if(activeCell!="") sel3.SetAttribute("activeCell", activeCell);                
+                if(sqRef!="") sel3.SetAttribute("sqref", sqRef);
+                sel2.ParentNode.InsertAfter(sel3, sel2);
+
+            }
+            Panes=LoadPanes();
+        }
+        private void RemoveSelection()
+        {
+            //Find selection nodes and remove them            
+            XmlNodeList selections = TopNode.SelectNodes(_selectionNodePath, NameSpaceManager);
+            foreach (XmlNode sel in selections)
+            {
+                sel.ParentNode.RemoveChild(sel);
+            }
+        }
+        /// <summary>
+        /// Unlock all rows and columns to scroll freely
+        /// /// </summary>
+        public void UnFreezePanes()
+        {
+            string sqRef = SelectedRange, activeCell = ActiveCell;
+
+            XmlElement paneNode = TopNode.SelectSingleNode(_paneNodePath, NameSpaceManager) as XmlElement;
+            if (paneNode != null)
+            {
+                paneNode.ParentNode.RemoveChild(paneNode);
+            }
+            RemoveSelection();
+
+            Panes=LoadPanes();
+
+            SelectedRange = sqRef;
+            ActiveCell = activeCell;
+        }
+        #endregion
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelWorksheets.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelWorksheets.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/ExcelWorksheets.cs	(revision 12707)
@@ -0,0 +1,1235 @@
+/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		    Initial Release		       2009-10-01
+ * Jan Källman		    License changed GPL-->LGPL 2011-12-27
+ *******************************************************************************/
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Security.Cryptography.Xml;
+using System.Text;
+using System.Xml;
+using System.IO;
+using System.Linq;
+using OfficeOpenXml.Style;
+using OfficeOpenXml.Drawing;
+using OfficeOpenXml.Drawing.Chart;
+using OfficeOpenXml.Style.XmlAccess;
+using OfficeOpenXml.Drawing.Vml;
+using OfficeOpenXml.Packaging.Ionic.Zlib;
+using OfficeOpenXml.Utils;
+using OfficeOpenXml.VBA;
+namespace OfficeOpenXml
+{
+	/// <summary>
+	/// The collection of worksheets for the workbook
+	/// </summary>
+	public class ExcelWorksheets : XmlHelper, IEnumerable<ExcelWorksheet>, IDisposable
+	{
+		#region Private Properties
+        private ExcelPackage _pck;
+        private Dictionary<int, ExcelWorksheet> _worksheets;
+		private XmlNamespaceManager _namespaceManager;
+		#endregion
+		#region ExcelWorksheets Constructor
+		internal ExcelWorksheets(ExcelPackage pck, XmlNamespaceManager nsm, XmlNode topNode) :
+            base(nsm, topNode)
+		{
+			_pck = pck;
+            _namespaceManager = nsm;
+			_worksheets = new Dictionary<int, ExcelWorksheet>();
+			int positionID = 1;
+
+            foreach (XmlNode sheetNode in topNode.ChildNodes)
+			{
+                if (sheetNode.NodeType == XmlNodeType.Element)
+                {
+                    string name = sheetNode.Attributes["name"].Value;
+                    //Get the relationship id
+                    string relId = sheetNode.Attributes["r:id"].Value;
+                    int sheetID = Convert.ToInt32(sheetNode.Attributes["sheetId"].Value);
+
+                    //Hidden property
+                    eWorkSheetHidden hidden = eWorkSheetHidden.Visible;
+                    XmlNode attr = sheetNode.Attributes["state"];
+                    if (attr != null)
+                        hidden = TranslateHidden(attr.Value);
+
+                    var sheetRelation = pck.Workbook.Part.GetRelationship(relId);
+                    Uri uriWorksheet = UriHelper.ResolvePartUri(pck.Workbook.WorkbookUri, sheetRelation.TargetUri);
+
+                    //add the worksheet
+                    if (sheetRelation.RelationshipType.EndsWith("chartsheet"))
+                    {
+                        _worksheets.Add(positionID, new ExcelChartsheet(_namespaceManager, _pck, relId, uriWorksheet, name, sheetID, positionID, hidden));
+                    }
+                    else
+                    {
+                        _worksheets.Add(positionID, new ExcelWorksheet(_namespaceManager, _pck, relId, uriWorksheet, name, sheetID, positionID, hidden));
+                    }
+                    positionID++;
+                }
+			}
+		}
+
+        private eWorkSheetHidden TranslateHidden(string value)
+        {
+            switch (value)
+            {
+                case "hidden":
+                    return eWorkSheetHidden.Hidden;
+                case "veryHidden":
+                    return eWorkSheetHidden.VeryHidden;
+                default:
+                    return eWorkSheetHidden.Visible;
+            }
+        }
+		#endregion
+		#region ExcelWorksheets Public Properties
+		/// <summary>
+		/// Returns the number of worksheets in the workbook
+		/// </summary>
+		public int Count
+		{
+			get { return (_worksheets.Count); }
+		}
+		#endregion
+        private const string ERR_DUP_WORKSHEET = "A worksheet with this name already exists in the workbook";
+        internal const string WORKSHEET_CONTENTTYPE = @"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml";
+        internal const string CHARTSHEET_CONTENTTYPE = @"application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml";
+		#region ExcelWorksheets Public Methods
+		/// <summary>
+        /// Foreach support
+		/// </summary>
+		/// <returns>An enumerator</returns>
+		public IEnumerator<ExcelWorksheet> GetEnumerator()
+		{
+			return (_worksheets.Values.GetEnumerator());
+        }
+        #region IEnumerable Members
+
+        IEnumerator IEnumerable.GetEnumerator()
+        {
+            return (_worksheets.Values.GetEnumerator());
+        }
+
+        #endregion
+		#region Add Worksheet
+		/// <summary>
+		/// Adds a new blank worksheet.
+		/// </summary>
+		/// <param name="Name">The name of the workbook</param>
+		public ExcelWorksheet Add(string Name)
+		{
+            ExcelWorksheet worksheet = AddSheet(Name,false, null);
+			return worksheet;
+		}
+        private ExcelWorksheet AddSheet(string Name, bool isChart, eChartType? chartType)
+        {
+            int sheetID;
+            Uri uriWorksheet;
+            lock (_worksheets)
+            {
+                Name = ValidateFixSheetName(Name);
+                if (GetByName(Name) != null)
+                {
+                    throw (new InvalidOperationException(ERR_DUP_WORKSHEET + " : " + Name));
+                }
+                GetSheetURI(ref Name, out sheetID, out uriWorksheet, isChart);
+                Packaging.ZipPackagePart worksheetPart = _pck.Package.CreatePart(uriWorksheet, isChart ? CHARTSHEET_CONTENTTYPE : WORKSHEET_CONTENTTYPE, _pck.Compression);
+
+                //Create the new, empty worksheet and save it to the package
+                StreamWriter streamWorksheet = new StreamWriter(worksheetPart.GetStream(FileMode.Create, FileAccess.Write));
+                XmlDocument worksheetXml = CreateNewWorksheet(isChart);
+                worksheetXml.Save(streamWorksheet);
+                _pck.Package.Flush();
+
+                string rel = CreateWorkbookRel(Name, sheetID, uriWorksheet, isChart);
+
+                int positionID = _worksheets.Count + 1;
+                ExcelWorksheet worksheet;
+                if (isChart)
+                {
+                    worksheet = new ExcelChartsheet(_namespaceManager, _pck, rel, uriWorksheet, Name, sheetID, positionID, eWorkSheetHidden.Visible, (eChartType)chartType);
+                }
+                else
+                {
+                    worksheet = new ExcelWorksheet(_namespaceManager, _pck, rel, uriWorksheet, Name, sheetID, positionID, eWorkSheetHidden.Visible);
+                }
+
+                _worksheets.Add(positionID, worksheet);
+#if !MONO
+                if (_pck.Workbook.VbaProject != null)
+                {
+                    var name = _pck.Workbook.VbaProject.GetModuleNameFromWorksheet(worksheet);
+                    _pck.Workbook.VbaProject.Modules.Add(new ExcelVBAModule(worksheet.CodeNameChange) { Name = name, Code = "", Attributes = _pck.Workbook.VbaProject.GetDocumentAttributes(Name, "0{00020820-0000-0000-C000-000000000046}"), Type = eModuleType.Document, HelpContext = 0 });
+                    worksheet.CodeModuleName = name;
+
+                }
+#endif
+                return worksheet;
+            }
+        }
+        /// <summary>
+        /// Adds a copy of a worksheet
+        /// </summary>
+        /// <param name="Name">The name of the workbook</param>
+        /// <param name="Copy">The worksheet to be copied</param>
+        public ExcelWorksheet Add(string Name, ExcelWorksheet Copy)
+        {
+            lock (_worksheets)
+            {
+                int sheetID;
+                Uri uriWorksheet;
+                if (Copy is ExcelChartsheet)
+                {
+                    throw (new ArgumentException("Can not copy a chartsheet"));
+                }
+                if (GetByName(Name) != null)
+                {
+                    throw (new InvalidOperationException(ERR_DUP_WORKSHEET));
+                }
+
+                GetSheetURI(ref Name, out sheetID, out uriWorksheet, false);
+
+                //Create a copy of the worksheet XML
+                Packaging.ZipPackagePart worksheetPart = _pck.Package.CreatePart(uriWorksheet, WORKSHEET_CONTENTTYPE, _pck.Compression);
+                StreamWriter streamWorksheet = new StreamWriter(worksheetPart.GetStream(FileMode.Create, FileAccess.Write));
+                XmlDocument worksheetXml = new XmlDocument();
+                worksheetXml.LoadXml(Copy.WorksheetXml.OuterXml);
+                worksheetXml.Save(streamWorksheet);
+                //streamWorksheet.Close();
+                _pck.Package.Flush();
+
+
+                //Create a relation to the workbook
+                string relID = CreateWorkbookRel(Name, sheetID, uriWorksheet, false);
+                ExcelWorksheet added = new ExcelWorksheet(_namespaceManager, _pck, relID, uriWorksheet, Name, sheetID, _worksheets.Count + 1, eWorkSheetHidden.Visible);
+
+                //Copy comments
+                if (Copy.Comments.Count > 0)
+                {
+                    CopyComment(Copy, added);
+                }
+                else if (Copy.VmlDrawingsComments.Count > 0)    //Vml drawings are copied as part of the comments. 
+                {
+                    CopyVmlDrawing(Copy, added);
+                }
+
+                //Copy HeaderFooter
+                CopyHeaderFooterPictures(Copy, added);
+
+                //Copy all relationships 
+                //CopyRelationShips(Copy, added);
+                if (Copy.Drawings.Count > 0)
+                {
+                    CopyDrawing(Copy, added);
+                }
+                if (Copy.Tables.Count > 0)
+                {
+                    CopyTable(Copy, added);
+                }
+                if (Copy.PivotTables.Count > 0)
+                {
+                    CopyPivotTable(Copy, added);
+                }
+                if (Copy.Names.Count > 0)
+                {
+                    CopySheetNames(Copy, added);
+                }
+
+                //Copy all cells
+                CloneCells(Copy, added);
+
+                //Copy the VBA code
+#if !MONO
+                if (_pck.Workbook.VbaProject != null)
+                {
+                    var name = _pck.Workbook.VbaProject.GetModuleNameFromWorksheet(added);
+                    _pck.Workbook.VbaProject.Modules.Add(new ExcelVBAModule(added.CodeNameChange) { Name = name, Code = Copy.CodeModule.Code, Attributes = _pck.Workbook.VbaProject.GetDocumentAttributes(Name, "0{00020820-0000-0000-C000-000000000046}"), Type = eModuleType.Document, HelpContext = 0 });
+                    Copy.CodeModuleName = name;
+                }
+#endif
+
+                _worksheets.Add(_worksheets.Count + 1, added);
+
+                //Remove any relation to printersettings.
+                XmlNode pageSetup = added.WorksheetXml.SelectSingleNode("//d:pageSetup", _namespaceManager);
+                if (pageSetup != null)
+                {
+                    XmlAttribute attr = (XmlAttribute)pageSetup.Attributes.GetNamedItem("id", ExcelPackage.schemaRelationships);
+                    if (attr != null)
+                    {
+                        relID = attr.Value;
+                        // first delete the attribute from the XML
+                        pageSetup.Attributes.Remove(attr);
+                    }
+                }
+                return added;
+            }
+        }
+        public ExcelChartsheet AddChart(string Name, eChartType chartType)
+        {
+            return (ExcelChartsheet)AddSheet(Name, true, chartType);
+        }
+        private void CopySheetNames(ExcelWorksheet Copy, ExcelWorksheet added)
+        {
+            foreach (var name in Copy.Names)
+            {
+                ExcelNamedRange newName;
+                if (!name.IsName)
+                {
+                    if (name.WorkSheet == Copy.Name)
+                    {
+                        newName = added.Names.Add(name.Name, added.Cells[name.FirstAddress]);
+                    }
+                    else
+                    {
+                        newName = added.Names.Add(name.Name, added.Workbook.Worksheets[name.WorkSheet].Cells[name.FirstAddress]);
+                    }
+                }
+                else if (!string.IsNullOrEmpty(name.NameFormula))
+                {
+                    newName=added.Names.AddFormula(name.Name, name.Formula);
+                }
+                else
+                {
+                    newName=added.Names.AddValue(name.Name, name.Value);
+                }
+               newName.NameComment = name.NameComment;
+            }
+        }
+
+        private void CopyTable(ExcelWorksheet Copy, ExcelWorksheet added)
+        {
+            string prevName = "";
+            //First copy the table XML
+            foreach (var tbl in Copy.Tables)
+            {
+                string xml=tbl.TableXml.OuterXml;
+                int Id = _pck.Workbook._nextTableID++;
+                string name;
+                if (prevName == "")
+                {
+                    name = Copy.Tables.GetNewTableName();
+                }
+                else
+                {
+                    int ix = int.Parse(prevName.Substring(5)) + 1;
+                    name = string.Format("Table{0}", ix);
+                    while (_pck.Workbook.ExistsPivotTableName(name))
+                    {
+                        name = string.Format("Table{0}", ++ix);
+                    }
+                }
+                prevName = name;
+                XmlDocument xmlDoc = new XmlDocument();
+                xmlDoc.LoadXml(xml);
+                xmlDoc.SelectSingleNode("//d:table/@id", tbl.NameSpaceManager).Value = Id.ToString();
+                xmlDoc.SelectSingleNode("//d:table/@name", tbl.NameSpaceManager).Value = name;
+                xmlDoc.SelectSingleNode("//d:table/@displayName", tbl.NameSpaceManager).Value = name;
+                xml = xmlDoc.OuterXml;
+
+                var uriTbl = new Uri(string.Format("/xl/tables/table{0}.xml", Id), UriKind.Relative);
+                var part = _pck.Package.CreatePart(uriTbl, "application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml", _pck.Compression);
+                StreamWriter streamTbl = new StreamWriter(part.GetStream(FileMode.Create, FileAccess.Write));
+                streamTbl.Write(xml);
+                //streamTbl.Close();
+                streamTbl.Flush();
+
+                //create the relationship and add the ID to the worksheet xml.
+                var rel = added.Part.CreateRelationship(UriHelper.GetRelativeUri(added.WorksheetUri,uriTbl), Packaging.TargetMode.Internal, ExcelPackage.schemaRelationships + "/table");
+
+                if (tbl.RelationshipID == null)
+                {
+                    var topNode = added.WorksheetXml.SelectSingleNode("//d:tableParts", tbl.NameSpaceManager);
+                    if (topNode == null)
+                    {
+                        added.CreateNode("d:tableParts");
+                        topNode = added.WorksheetXml.SelectSingleNode("//d:tableParts", tbl.NameSpaceManager);
+                    }
+                    XmlElement elem = added.WorksheetXml.CreateElement("tablePart", ExcelPackage.schemaMain);
+                    topNode.AppendChild(elem);
+                    elem.SetAttribute("id",ExcelPackage.schemaRelationships, rel.Id);
+                }
+                else
+                {
+                    XmlAttribute relAtt;
+                    relAtt = added.WorksheetXml.SelectSingleNode(string.Format("//d:tableParts/d:tablePart/@r:id[.='{0}']", tbl.RelationshipID), tbl.NameSpaceManager) as XmlAttribute;
+                    relAtt.Value = rel.Id;
+                }
+            }
+        }
+        private void CopyPivotTable(ExcelWorksheet Copy, ExcelWorksheet added)
+        {
+            string prevName = "";
+            foreach (var tbl in Copy.PivotTables)
+            {
+                string xml = tbl.PivotTableXml.OuterXml;
+                int Id = _pck.Workbook._nextPivotTableID++;
+
+                string name;
+                if (prevName == "")
+                {
+                    name = Copy.PivotTables.GetNewTableName();
+                }
+                else
+                {
+                    int ix=int.Parse(prevName.Substring(10))+1;
+                    name = string.Format("PivotTable{0}", ix);
+                    while (_pck.Workbook.ExistsPivotTableName(name))
+                    {
+                        name = string.Format("PivotTable{0}", ++ix);
+                    }
+                }
+                prevName=name;
+                XmlDocument xmlDoc = new XmlDocument();
+                //TODO: Fix save pivottable here
+                //Copy.Save();    //Save the worksheet first
+                xmlDoc.LoadXml(xml);
+                //xmlDoc.SelectSingleNode("//d:table/@id", tbl.NameSpaceManager).Value = Id.ToString();
+                xmlDoc.SelectSingleNode("//d:pivotTableDefinition/@name", tbl.NameSpaceManager).Value = name;
+                xml = xmlDoc.OuterXml;
+
+                var uriTbl = new Uri(string.Format("/xl/pivotTables/pivotTable{0}.xml", Id), UriKind.Relative);
+                var partTbl = _pck.Package.CreatePart(uriTbl, ExcelPackage.schemaPivotTable , _pck.Compression);
+                StreamWriter streamTbl = new StreamWriter(partTbl.GetStream(FileMode.Create, FileAccess.Write));
+                streamTbl.Write(xml);
+                //streamTbl.Close();
+                streamTbl.Flush();
+
+                xml = tbl.CacheDefinition.CacheDefinitionXml.OuterXml;                
+                var uriCd = new Uri(string.Format("/xl/pivotCache/pivotcachedefinition{0}.xml", Id), UriKind.Relative);
+                while (_pck.Package.PartExists(uriCd))
+                {
+                    uriCd = new Uri(string.Format("/xl/pivotCache/pivotcachedefinition{0}.xml", ++Id), UriKind.Relative);
+                }
+
+                var partCd = _pck.Package.CreatePart(uriCd, ExcelPackage.schemaPivotCacheDefinition, _pck.Compression);
+                StreamWriter streamCd = new StreamWriter(partCd.GetStream(FileMode.Create, FileAccess.Write));
+                streamCd.Write(xml);
+                streamCd.Flush();
+
+                xml = "<pivotCacheRecords xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" count=\"0\" />";
+                var uriRec = new Uri(string.Format("/xl/pivotCache/pivotrecords{0}.xml", Id), UriKind.Relative);
+                while (_pck.Package.PartExists(uriRec))
+                {
+                    uriRec = new Uri(string.Format("/xl/pivotCache/pivotrecords{0}.xml", ++Id), UriKind.Relative);
+                }
+                var partRec = _pck.Package.CreatePart(uriRec, ExcelPackage.schemaPivotCacheRecords, _pck.Compression);
+                StreamWriter streamRec = new StreamWriter(partRec.GetStream(FileMode.Create, FileAccess.Write));
+                streamRec.Write(xml);
+                streamRec.Flush();
+
+                //create the relationship and add the ID to the worksheet xml.
+                added.Part.CreateRelationship(UriHelper.ResolvePartUri(added.WorksheetUri, uriTbl), Packaging.TargetMode.Internal, ExcelPackage.schemaRelationships + "/pivotTable");
+                partTbl.CreateRelationship(UriHelper.ResolvePartUri(tbl.Relationship.SourceUri, uriCd), tbl.CacheDefinition.Relationship.TargetMode, tbl.CacheDefinition.Relationship.RelationshipType);
+                partCd.CreateRelationship(UriHelper.ResolvePartUri(uriCd, uriRec), Packaging.TargetMode.Internal, ExcelPackage.schemaRelationships + "/pivotCacheRecords");
+            }
+        }
+        private void CopyHeaderFooterPictures(ExcelWorksheet Copy, ExcelWorksheet added)
+        {
+            if (Copy._headerFooter == null) return;
+            //Copy the texts
+            CopyText(Copy.HeaderFooter._oddHeader, added.HeaderFooter.OddHeader);
+            CopyText(Copy.HeaderFooter._oddFooter, added.HeaderFooter.OddFooter);
+            CopyText(Copy.HeaderFooter._evenHeader, added.HeaderFooter.EvenHeader);
+            CopyText(Copy.HeaderFooter._evenFooter, added.HeaderFooter.EvenFooter);
+            CopyText(Copy.HeaderFooter._firstHeader, added.HeaderFooter.FirstHeader);
+            CopyText(Copy.HeaderFooter._firstFooter, added.HeaderFooter.FirstFooter);
+            
+            //Copy any images;
+            if (Copy.HeaderFooter.Pictures.Count > 0)
+            {
+                Uri source = Copy.HeaderFooter.Pictures.Uri;
+                Uri dest = XmlHelper.GetNewUri(_pck.Package, @"/xl/drawings/vmlDrawing{0}.vml");
+                
+                //var part = _pck.Package.CreatePart(dest, "application/vnd.openxmlformats-officedocument.vmlDrawing", _pck.Compression);
+                foreach (ExcelVmlDrawingPicture pic in Copy.HeaderFooter.Pictures)
+                {
+                    var item = added.HeaderFooter.Pictures.Add(pic.Id, pic.ImageUri, pic.Title, pic.Width, pic.Height);
+                    foreach (XmlAttribute att in pic.TopNode.Attributes)
+                    {
+                        (item.TopNode as XmlElement).SetAttribute(att.Name, att.Value);
+                    }
+                    item.TopNode.InnerXml = pic.TopNode.InnerXml;
+                }
+            }
+        }
+
+        private void CopyText(ExcelHeaderFooterText from, ExcelHeaderFooterText to)
+        {
+            if (from == null) return;
+            to.LeftAlignedText=from.LeftAlignedText;
+            to.CenteredText = from.CenteredText;
+            to.RightAlignedText = from.RightAlignedText;
+        }
+        private void CloneCells(ExcelWorksheet Copy, ExcelWorksheet added)
+        {
+            bool sameWorkbook=(Copy.Workbook == _pck.Workbook);
+
+            bool doAdjust = _pck.DoAdjustDrawings;
+            _pck.DoAdjustDrawings = false;
+            added.MergedCells.List.AddRange(Copy.MergedCells.List);
+            //Formulas
+            //foreach (IRangeID f in Copy._formulaCells)
+            //{
+            //    added._formulaCells.Add(f);
+            //}
+            //Shared Formulas
+            foreach (int key in Copy._sharedFormulas.Keys)
+            {
+                added._sharedFormulas.Add(key, Copy._sharedFormulas[key]);
+            }
+            
+            Dictionary<int, int> styleCashe = new Dictionary<int, int>();
+            //Cells
+            int row,col;
+            var val = new CellsStoreEnumerator<object>(Copy._values);
+            //object f=null;
+            //foreach (var addr in val)
+            while(val.Next())
+            {                
+                //row=(int)addr>>32;
+                //col=(int)addr&32;
+                row = val.Row;
+                col = val.Column;
+                //added._cells.Add(cell.Clone(added));
+                int styleID=0;
+                if (row == 0) //Column
+                {
+                    var c = Copy._values.GetValue(row, col) as ExcelColumn;
+                    if (c != null)
+                    {
+                        var clone = c.Clone(added, c.ColumnMin);
+                        clone.StyleID = c.StyleID;
+                        added._values.SetValue(row, col, clone);
+                        styleID = c.StyleID;
+                    }
+                }
+                else if (col == 0) //Row
+                {
+                    var r=Copy.Row(row);
+                    if (r != null)
+                    {
+                        r.Clone(added);
+                        styleID = r.StyleID;
+                        //added._values.SetValue(row, col, r.Clone(added));                                                
+                    }
+                    
+                }
+                else
+                {
+                   styleID = CopyValues(Copy, added, row, col);
+                }
+                if (!sameWorkbook)
+                {
+                    if (styleCashe.ContainsKey(styleID))
+                    {
+                        added._styles.SetValue(row, col, styleCashe[styleID]);
+                    }
+                    else
+                    {
+                        var s = added.Workbook.Styles.CloneStyle(Copy.Workbook.Styles, styleID);
+                        styleCashe.Add(styleID, s);
+                        added._styles.SetValue(row, col, s);
+                    }
+                }
+            }
+            added._package.DoAdjustDrawings = doAdjust;
+        }
+
+        private int CopyValues(ExcelWorksheet Copy, ExcelWorksheet added, int row, int col)
+        {
+            added._values.SetValue(row, col, Copy._values.GetValue(row, col));
+            var t = Copy._types.GetValue(row, col);
+            if (t != null)
+            {
+                added._types.SetValue(row, col, t);
+            }
+            byte fl=0;
+            if (Copy._flags.Exists(row,col,ref fl))
+            {
+                added._flags.SetValue(row, col, fl);
+            }
+
+            var v = Copy._formulas.GetValue(row, col);
+            if (v != null)
+            {
+                added.SetFormula(row, col, v);
+            }
+            var s = Copy._styles.GetValue(row, col);
+            if (s != 0)
+            {
+                added._styles.SetValue(row, col, s);
+            }
+            var f = Copy._formulas.GetValue(row, col);
+            if (f != null)
+            {
+                added._formulas.SetValue(row, col, f);
+            }
+            return s;
+        }
+
+        private void CopyComment(ExcelWorksheet Copy, ExcelWorksheet workSheet)
+        {            
+            //First copy the drawing XML
+            string xml = Copy.Comments.CommentXml.InnerXml;
+            var uriComment = new Uri(string.Format("/xl/comments{0}.xml", workSheet.SheetID), UriKind.Relative);
+            if (_pck.Package.PartExists(uriComment))
+            {
+                uriComment = XmlHelper.GetNewUri(_pck.Package, "/xl/drawings/vmldrawing{0}.vml");
+            }
+
+            var part = _pck.Package.CreatePart(uriComment, "application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml", _pck.Compression);
+
+            StreamWriter streamDrawing = new StreamWriter(part.GetStream(FileMode.Create, FileAccess.Write));
+            streamDrawing.Write(xml);
+            //streamDrawing.Close();
+            streamDrawing.Flush();
+
+            //Add the relationship ID to the worksheet xml.
+            var commentRelation = workSheet.Part.CreateRelationship(UriHelper.GetRelativeUri(workSheet.WorksheetUri,uriComment), Packaging.TargetMode.Internal, ExcelPackage.schemaRelationships + "/comments");
+
+            xml = Copy.VmlDrawingsComments.VmlDrawingXml.InnerXml;
+
+            var uriVml = new Uri(string.Format("/xl/drawings/vmldrawing{0}.vml", workSheet.SheetID), UriKind.Relative);
+            if (_pck.Package.PartExists(uriVml))
+            {
+                uriVml = XmlHelper.GetNewUri(_pck.Package, "/xl/drawings/vmldrawing{0}.vml");
+            }
+
+            var vmlPart = _pck.Package.CreatePart(uriVml, "application/vnd.openxmlformats-officedocument.vmlDrawing", _pck.Compression);
+            StreamWriter streamVml = new StreamWriter(vmlPart.GetStream(FileMode.Create, FileAccess.Write));
+            streamVml.Write(xml);
+            //streamVml.Close();
+            streamVml.Flush();
+
+            var newVmlRel = workSheet.Part.CreateRelationship(UriHelper.GetRelativeUri(workSheet.WorksheetUri,uriVml), Packaging.TargetMode.Internal, ExcelPackage.schemaRelationships + "/vmlDrawing");
+
+            //Add the relationship ID to the worksheet xml.
+            XmlElement e = workSheet.WorksheetXml.SelectSingleNode("//d:legacyDrawing", _namespaceManager) as XmlElement;
+            if (e == null)
+            {
+                workSheet.CreateNode("d:legacyDrawing");
+                e = workSheet.WorksheetXml.SelectSingleNode("//d:legacyDrawing", _namespaceManager) as XmlElement;
+            }
+
+            e.SetAttribute("id", ExcelPackage.schemaRelationships, newVmlRel.Id);
+        }
+        private void CopyDrawing(ExcelWorksheet Copy, ExcelWorksheet workSheet/*, PackageRelationship r*/)
+        {
+            
+            //Check if the worksheet has drawings
+            //if(_xlPackage.Package.PartExists(r.TargetUri))
+            //{
+                //First copy the drawing XML                
+                string xml = Copy.Drawings.DrawingXml.OuterXml;            
+                var uriDraw=new Uri(string.Format("/xl/drawings/drawing{0}.xml", workSheet.SheetID),  UriKind.Relative);
+                var part= _pck.Package.CreatePart(uriDraw,"application/vnd.openxmlformats-officedocument.drawing+xml", _pck.Compression);
+                StreamWriter streamDrawing = new StreamWriter(part.GetStream(FileMode.Create, FileAccess.Write));
+                streamDrawing.Write(xml);
+                //streamDrawing.Close();
+                streamDrawing.Flush();
+
+                XmlDocument drawXml = new XmlDocument();
+                drawXml.LoadXml(xml);
+                //Add the relationship ID to the worksheet xml.
+                var drawRelation = workSheet.Part.CreateRelationship(UriHelper.GetRelativeUri(workSheet.WorksheetUri,uriDraw), Packaging.TargetMode.Internal, ExcelPackage.schemaRelationships + "/drawing");
+                XmlElement e = workSheet.WorksheetXml.SelectSingleNode("//d:drawing", _namespaceManager) as XmlElement;
+                e.SetAttribute("id",ExcelPackage.schemaRelationships, drawRelation.Id);
+
+                foreach (ExcelDrawing draw in Copy.Drawings)
+                {
+                    if (draw is ExcelChart)
+                    {
+                        ExcelChart chart = draw as ExcelChart;
+                        xml = chart.ChartXml.InnerXml;
+
+                        var UriChart = XmlHelper.GetNewUri(_pck.Package, "/xl/charts/chart{0}.xml");
+                        var chartPart = _pck.Package.CreatePart(UriChart, "application/vnd.openxmlformats-officedocument.drawingml.chart+xml", _pck.Compression);
+                        StreamWriter streamChart = new StreamWriter(chartPart.GetStream(FileMode.Create, FileAccess.Write));
+                        streamChart.Write(xml);
+                        //streamChart.Close();
+                        streamChart.Flush();
+                        //Now create the new relationship to the copied chart xml
+                        var prevRelID=draw.TopNode.SelectSingleNode("xdr:graphicFrame/a:graphic/a:graphicData/c:chart/@r:id", Copy.Drawings.NameSpaceManager).Value;
+                        var rel = part.CreateRelationship(UriHelper.GetRelativeUri(uriDraw,UriChart), Packaging.TargetMode.Internal, ExcelPackage.schemaRelationships + "/chart");
+                        XmlAttribute relAtt = drawXml.SelectSingleNode(string.Format("//c:chart/@r:id[.='{0}']", prevRelID), Copy.Drawings.NameSpaceManager) as XmlAttribute;
+                        relAtt.Value=rel.Id;
+                    }
+                    else if (draw is ExcelPicture)
+                    {
+                        ExcelPicture pic = draw as ExcelPicture;
+                        var uri = pic.UriPic;
+                        if(!workSheet.Workbook._package.Package.PartExists(uri))
+                        {
+                            var picPart = workSheet.Workbook._package.Package.CreatePart(uri, pic.ContentType, CompressionLevel.None);
+                            pic.Image.Save(picPart.GetStream(FileMode.Create, FileAccess.Write), pic.ImageFormat);
+                        }
+
+                        var prevRelID = draw.TopNode.SelectSingleNode("xdr:pic/xdr:blipFill/a:blip/@r:embed", Copy.Drawings.NameSpaceManager).Value;
+                        var rel = part.CreateRelationship(UriHelper.GetRelativeUri(workSheet.WorksheetUri, uri), Packaging.TargetMode.Internal, ExcelPackage.schemaRelationships + "/image");
+                        XmlAttribute relAtt = drawXml.SelectSingleNode(string.Format("//xdr:pic/xdr:blipFill/a:blip/@r:embed[.='{0}']", prevRelID), Copy.Drawings.NameSpaceManager) as XmlAttribute;
+                        relAtt.Value = rel.Id;
+                    }
+                }
+                //rewrite the drawing xml with the new relID's
+                streamDrawing = new StreamWriter(part.GetStream(FileMode.Create, FileAccess.Write));
+                streamDrawing.Write(drawXml.OuterXml);
+               // streamDrawing.Close();
+                streamDrawing.Flush();
+
+            //}
+        }
+
+		private void CopyVmlDrawing(ExcelWorksheet origSheet, ExcelWorksheet newSheet)
+		{
+			var xml = origSheet.VmlDrawingsComments.VmlDrawingXml.OuterXml;
+			var vmlUri = new Uri(string.Format("/xl/drawings/vmlDrawing{0}.vml", newSheet.SheetID), UriKind.Relative);
+			var part = _pck.Package.CreatePart(vmlUri, "application/vnd.openxmlformats-officedocument.vmlDrawing", _pck.Compression);
+			using (var streamDrawing = new StreamWriter(part.GetStream(FileMode.Create, FileAccess.Write)))
+			{
+				streamDrawing.Write(xml);
+                streamDrawing.Flush();
+            }
+			
+            //Add the relationship ID to the worksheet xml.
+			var vmlRelation = newSheet.Part.CreateRelationship(UriHelper.GetRelativeUri(newSheet.WorksheetUri,vmlUri), Packaging.TargetMode.Internal, ExcelPackage.schemaRelationships + "/vmlDrawing");
+			var e = newSheet.WorksheetXml.SelectSingleNode("//d:legacyDrawing", _namespaceManager) as XmlElement;
+			if (e == null)
+			{
+				e = newSheet.WorksheetXml.CreateNode(XmlNodeType.Entity, "//d:legacyDrawing", _namespaceManager.LookupNamespace("d")) as XmlElement;
+			}
+			if (e != null)
+			{
+				e.SetAttribute("id", ExcelPackage.schemaRelationships, vmlRelation.Id);
+			}
+		}
+
+		string CreateWorkbookRel(string Name, int sheetID, Uri uriWorksheet, bool isChart)
+        {
+            //Create the relationship between the workbook and the new worksheet
+            var rel = _pck.Workbook.Part.CreateRelationship(UriHelper.GetRelativeUri(_pck.Workbook.WorkbookUri, uriWorksheet), Packaging.TargetMode.Internal, ExcelPackage.schemaRelationships + "/" + (isChart ? "chartsheet" : "worksheet"));
+            _pck.Package.Flush();
+
+            //Create the new sheet node
+            XmlElement worksheetNode = _pck.Workbook.WorkbookXml.CreateElement("sheet", ExcelPackage.schemaMain);
+            worksheetNode.SetAttribute("name", Name);
+            worksheetNode.SetAttribute("sheetId", sheetID.ToString());
+            worksheetNode.SetAttribute("id", ExcelPackage.schemaRelationships, rel.Id);
+
+            TopNode.AppendChild(worksheetNode);
+            return rel.Id;
+        }
+        private void GetSheetURI(ref string Name, out int sheetID, out Uri uriWorksheet, bool isChart)
+        {
+            Name = ValidateFixSheetName(Name);
+
+            //First find maximum existing sheetID
+            sheetID = 0;
+            foreach(var ws in this)
+            {                
+                if (ws.SheetID > sheetID)
+                {
+                    sheetID = ws.SheetID;
+                }
+            }
+            // we now have the max existing values, so add one
+            sheetID++;
+
+            // add the new worksheet to the package
+            if (isChart)
+            {
+                uriWorksheet = new Uri("/xl/chartsheets/chartsheet" + sheetID.ToString() + ".xml", UriKind.Relative);
+            }
+            else
+            {
+                uriWorksheet = new Uri("/xl/worksheets/sheet" + sheetID.ToString() + ".xml", UriKind.Relative);
+            }
+        }
+
+        internal string ValidateFixSheetName(string Name)
+        {
+            //remove invalid characters
+            if (ValidateName(Name))
+            {
+                if (Name.IndexOf(':') > -1) Name = Name.Replace(":", " ");
+                if (Name.IndexOf('/') > -1) Name = Name.Replace("/", " ");
+                if (Name.IndexOf('\\') > -1) Name = Name.Replace("\\", " ");
+                if (Name.IndexOf('?') > -1) Name = Name.Replace("?", " ");
+                if (Name.IndexOf('[') > -1) Name = Name.Replace("[", " ");
+                if (Name.IndexOf(']') > -1) Name = Name.Replace("]", " ");
+            }
+
+            if (Name.Trim() == "")
+            {
+                throw new ArgumentException("The worksheet can not have an empty name");
+            }
+            if (Name.Length > 31) Name = Name.Substring(0, 31);   //A sheet can have max 31 char's            
+            return Name;
+        }
+        /// <summary>
+        /// Validate the sheetname
+        /// </summary>
+        /// <param name="Name">The Name</param>
+        /// <returns>True if valid</returns>
+        private bool ValidateName(string Name)
+        {
+            return System.Text.RegularExpressions.Regex.IsMatch(Name, @":|\?|/|\\|\[|\]");
+        }
+
+		/// <summary>
+		/// Creates the XML document representing a new empty worksheet
+		/// </summary>
+		/// <returns></returns>
+		internal XmlDocument CreateNewWorksheet(bool isChart)
+		{
+			XmlDocument xmlDoc = new XmlDocument();
+            XmlElement elemWs = xmlDoc.CreateElement(isChart ? "chartsheet" : "worksheet", ExcelPackage.schemaMain);
+            elemWs.SetAttribute("xmlns:r", ExcelPackage.schemaRelationships);
+            xmlDoc.AppendChild(elemWs);
+
+
+            if (isChart)
+            {
+                XmlElement elemSheetPr = xmlDoc.CreateElement("sheetPr", ExcelPackage.schemaMain);
+                elemWs.AppendChild(elemSheetPr);
+
+                XmlElement elemSheetViews = xmlDoc.CreateElement("sheetViews", ExcelPackage.schemaMain);
+                elemWs.AppendChild(elemSheetViews);
+
+                XmlElement elemSheetView = xmlDoc.CreateElement("sheetView", ExcelPackage.schemaMain);
+                elemSheetView.SetAttribute("workbookViewId", "0");
+                elemSheetView.SetAttribute("zoomToFit", "1");
+
+                elemSheetViews.AppendChild(elemSheetView);
+            }
+            else
+            {
+                XmlElement elemSheetViews = xmlDoc.CreateElement("sheetViews", ExcelPackage.schemaMain);
+                elemWs.AppendChild(elemSheetViews);
+
+                XmlElement elemSheetView = xmlDoc.CreateElement("sheetView", ExcelPackage.schemaMain);
+                elemSheetView.SetAttribute("workbookViewId", "0");
+                elemSheetViews.AppendChild(elemSheetView);
+
+                XmlElement elemSheetFormatPr = xmlDoc.CreateElement("sheetFormatPr", ExcelPackage.schemaMain);
+                elemSheetFormatPr.SetAttribute("defaultRowHeight", "15");
+                elemWs.AppendChild(elemSheetFormatPr);
+
+                XmlElement elemSheetData = xmlDoc.CreateElement("sheetData", ExcelPackage.schemaMain);
+                elemWs.AppendChild(elemSheetData);
+            }
+            return xmlDoc;
+		}
+		#endregion
+		#region Delete Worksheet
+		/// <summary>
+		/// Deletes a worksheet from the collection
+		/// </summary>
+		/// <param name="Index">The position of the worksheet in the workbook</param>
+		public void Delete(int Index)
+		{
+			/*
+            * Hack to prefetch all the drawings,
+            * so that all the images are referenced, 
+            * to prevent the deletion of the image file, 
+            * when referenced more than once
+            */
+            foreach (var ws in _worksheets)
+            {
+                var drawings = ws.Value.Drawings; 
+            }			
+            
+            ExcelWorksheet worksheet = _worksheets[Index];
+            if (worksheet.Drawings.Count > 0)
+            {
+                worksheet.Drawings.ClearDrawings();
+            }
+
+            //Remove all comments
+            if (!(worksheet is ExcelChartsheet) && worksheet.Comments.Count > 0)
+            {
+                worksheet.Comments.Clear();
+            }
+                        
+		    //Delete any parts still with relations to the Worksheet.
+            DeleteRelationsAndParts(worksheet.Part);
+
+
+            //Delete the worksheet part and relation from the package 
+			_pck.Workbook.Part.DeleteRelationship(worksheet.RelationshipID);
+
+            //Delete worksheet from the workbook XML
+			XmlNode sheetsNode = _pck.Workbook.WorkbookXml.SelectSingleNode("//d:workbook/d:sheets", _namespaceManager);
+			if (sheetsNode != null)
+			{
+				XmlNode sheetNode = sheetsNode.SelectSingleNode(string.Format("./d:sheet[@sheetId={0}]", worksheet.SheetID), _namespaceManager);
+				if (sheetNode != null)
+				{
+					sheetsNode.RemoveChild(sheetNode);
+				}
+			}
+			_worksheets.Remove(Index);
+            if (_pck.Workbook.VbaProject != null)
+            {
+                _pck.Workbook.VbaProject.Modules.Remove(worksheet.CodeModule);
+            }
+			ReindexWorksheetDictionary();
+            //If the active sheet is deleted, set the first tab as active.
+            if (_pck.Workbook.View.ActiveTab >= _pck.Workbook.Worksheets.Count)
+            {
+                _pck.Workbook.View.ActiveTab = _pck.Workbook.View.ActiveTab-1;
+            }
+            if (_pck.Workbook.View.ActiveTab == worksheet.SheetID)
+            {
+                _pck.Workbook.Worksheets[1].View.TabSelected = true;
+            }
+            worksheet = null;
+        }
+
+        private void DeleteRelationsAndParts(Packaging.ZipPackagePart part)
+        {
+            var rels = part.GetRelationships().ToList();
+            for(int i=0;i<rels.Count;i++)
+            {
+                var rel = rels[i];
+                DeleteRelationsAndParts(_pck.Package.GetPart(UriHelper.ResolvePartUri(rel.SourceUri, rel.TargetUri)));
+                part.DeleteRelationship(rel.Id);
+            }            
+            _pck.Package.DeletePart(part.Uri);
+        }
+
+		/// <summary>
+		/// Deletes a worksheet from the collection
+		/// </summary>
+		/// <param name="name">The name of the worksheet in the workbook</param>
+		public void Delete(string name)
+		{
+			var sheet = this[name];
+			if (sheet == null)
+			{
+				throw new ArgumentException(string.Format("Could not find worksheet to delete '{0}'", name));
+			}
+			Delete(sheet.PositionID);
+		}
+		/// <summary>
+        /// Delete a worksheet from the collection
+        /// </summary>
+        /// <param name="Worksheet">The worksheet to delete</param>
+        public void Delete(ExcelWorksheet Worksheet)
+		{
+            if (Worksheet.PositionID <= _worksheets.Count && Worksheet == _worksheets[Worksheet.PositionID])
+            {
+                Delete(Worksheet.PositionID);
+            }
+            else
+            {
+                throw (new ArgumentException("Worksheet is not in the collection."));
+            }
+        }
+        #endregion
+		private void ReindexWorksheetDictionary()
+		{
+			var index = 1;
+			var worksheets = new Dictionary<int, ExcelWorksheet>();
+			foreach (var entry in _worksheets)
+			{
+				entry.Value.PositionID = index;
+				worksheets.Add(index++, entry.Value);
+			}
+			_worksheets = worksheets;
+		}
+
+		/// <summary>
+		/// Returns the worksheet at the specified position.  
+		/// </summary>
+		/// <param name="PositionID">The position of the worksheet. 1-base</param>
+		/// <returns></returns>
+		public ExcelWorksheet this[int PositionID]
+		{
+			get
+			{
+			    if (_worksheets.ContainsKey(PositionID))
+			    {
+			        return _worksheets[PositionID];
+			    }
+			    else
+			    {
+			        throw (new IndexOutOfRangeException("Worksheet position out of range."));
+			    }
+			}
+		}
+
+		/// <summary>
+		/// Returns the worksheet matching the specified name
+		/// </summary>
+		/// <param name="Name">The name of the worksheet</param>
+		/// <returns></returns>
+		public ExcelWorksheet this[string Name]
+		{
+			get
+			{
+                return GetByName(Name);
+			}
+		}
+		/// <summary>
+		/// Copies the named worksheet and creates a new worksheet in the same workbook
+		/// </summary>
+		/// <param name="Name">The name of the existing worksheet</param>
+		/// <param name="NewName">The name of the new worksheet to create</param>
+		/// <returns>The new copy added to the end of the worksheets collection</returns>
+		public ExcelWorksheet Copy(string Name, string NewName)
+		{
+            ExcelWorksheet Copy = this[Name];
+            if (Copy == null)
+                throw new ArgumentException(string.Format("Copy worksheet error: Could not find worksheet to copy '{0}'", Name));
+
+            ExcelWorksheet added = Add(NewName, Copy);
+            return added;
+        }
+		#endregion
+        internal ExcelWorksheet GetBySheetID(int localSheetID)
+        {
+            foreach (ExcelWorksheet ws in this)
+            {
+                if (ws.SheetID == localSheetID)
+                {
+                    return ws;
+                }
+            }
+            return null;
+        }
+        private ExcelWorksheet GetByName(string Name)
+        {
+            if (string.IsNullOrEmpty(Name)) return null;
+            ExcelWorksheet xlWorksheet = null;
+            foreach (ExcelWorksheet worksheet in _worksheets.Values)
+            {
+                if (worksheet.Name.Equals(Name, StringComparison.InvariantCultureIgnoreCase))
+                    xlWorksheet = worksheet;
+            }
+            return (xlWorksheet);
+        }
+		#region MoveBefore and MoveAfter Methods
+		/// <summary>
+		/// Moves the source worksheet to the position before the target worksheet
+		/// </summary>
+		/// <param name="sourceName">The name of the source worksheet</param>
+		/// <param name="targetName">The name of the target worksheet</param>
+		public void MoveBefore(string sourceName, string targetName)
+		{
+			Move(sourceName, targetName, false);
+		}
+
+		/// <summary>
+		/// Moves the source worksheet to the position before the target worksheet
+		/// </summary>
+		/// <param name="sourcePositionId">The id of the source worksheet</param>
+		/// <param name="targetPositionId">The id of the target worksheet</param>
+		public void MoveBefore(int sourcePositionId, int targetPositionId)
+		{
+			Move(sourcePositionId, targetPositionId, false);
+		}
+
+		/// <summary>
+		/// Moves the source worksheet to the position after the target worksheet
+		/// </summary>
+		/// <param name="sourceName">The name of the source worksheet</param>
+		/// <param name="targetName">The name of the target worksheet</param>
+		public void MoveAfter(string sourceName, string targetName)
+		{
+			Move(sourceName, targetName, true);
+		}
+
+		/// <summary>
+		/// Moves the source worksheet to the position after the target worksheet
+		/// </summary>
+		/// <param name="sourcePositionId">The id of the source worksheet</param>
+		/// <param name="targetPositionId">The id of the target worksheet</param>
+		public void MoveAfter(int sourcePositionId, int targetPositionId)
+		{
+			Move(sourcePositionId, targetPositionId, true);
+		}
+
+		/// <summary>
+		/// 
+		/// </summary>
+		/// <param name="sourceName"></param>
+		public void MoveToStart(string sourceName)
+		{
+			var sourceSheet = this[sourceName];
+			if (sourceSheet == null)
+			{
+				throw new Exception(string.Format("Move worksheet error: Could not find worksheet to move '{0}'", sourceName));
+			}
+			Move(sourceSheet.PositionID, 1, false);
+		}
+
+		/// <summary>
+		/// 
+		/// </summary>
+		/// <param name="sourcePositionId"></param>
+		public void MoveToStart(int sourcePositionId)
+		{
+			Move(sourcePositionId, 1, false);
+		}
+
+		/// <summary>
+		/// 
+		/// </summary>
+		/// <param name="sourceName"></param>
+		public void MoveToEnd(string sourceName)
+		{
+			var sourceSheet = this[sourceName];
+			if (sourceSheet == null)
+			{
+				throw new Exception(string.Format("Move worksheet error: Could not find worksheet to move '{0}'", sourceName));
+			}
+			Move(sourceSheet.PositionID, _worksheets.Count, true);
+		}
+
+		/// <summary>
+		/// 
+		/// </summary>
+		/// <param name="sourcePositionId"></param>
+		public void MoveToEnd(int sourcePositionId)
+		{
+			Move(sourcePositionId, _worksheets.Count, true);
+		}
+
+		private void Move(string sourceName, string targetName, bool placeAfter)
+		{
+			var sourceSheet = this[sourceName];
+			if (sourceSheet == null)
+			{
+				throw new Exception(string.Format("Move worksheet error: Could not find worksheet to move '{0}'", sourceName));
+			}
+			var targetSheet = this[targetName];
+			if (targetSheet == null)
+			{
+				throw new Exception(string.Format("Move worksheet error: Could not find worksheet to move '{0}'", targetName));
+			}
+			Move(sourceSheet.PositionID, targetSheet.PositionID, placeAfter);
+		}
+
+		private void Move(int sourcePositionId, int targetPositionId, bool placeAfter)
+		{
+            // Bugfix: if source and target are the same worksheet the following code will create a duplicate
+            //         which will cause a corrupt workbook. /swmal 2014-05-10
+		    if (sourcePositionId == targetPositionId) return;
+
+            lock (_worksheets)
+            {
+                var sourceSheet = this[sourcePositionId];
+                if (sourceSheet == null)
+                {
+                    throw new Exception(string.Format("Move worksheet error: Could not find worksheet at position '{0}'", sourcePositionId));
+                }
+                var targetSheet = this[targetPositionId];
+                if (targetSheet == null)
+                {
+                    throw new Exception(string.Format("Move worksheet error: Could not find worksheet at position '{0}'", targetPositionId));
+                }
+                if (sourcePositionId == targetPositionId && _worksheets.Count < 2)
+                {
+                    return;		//--- no reason to attempt to re-arrange a single item with itself
+                }
+
+                var index = 1;
+                var newOrder = new Dictionary<int, ExcelWorksheet>();
+                foreach (var entry in _worksheets)
+                {
+                    if (entry.Key == targetPositionId)
+                    {
+                        if (!placeAfter)
+                        {
+                            sourceSheet.PositionID = index;
+                            newOrder.Add(index++, sourceSheet);
+                        }
+
+                        entry.Value.PositionID = index;
+                        newOrder.Add(index++, entry.Value);
+
+                        if (placeAfter)
+                        {
+                            sourceSheet.PositionID = index;
+                            newOrder.Add(index++, sourceSheet);
+                        }
+                    }
+                    else if (entry.Key == sourcePositionId)
+                    {
+                        //--- do nothing
+                    }
+                    else
+                    {
+                        entry.Value.PositionID = index;
+                        newOrder.Add(index++, entry.Value);
+                    }
+                }
+                _worksheets = newOrder;
+
+                MoveSheetXmlNode(sourceSheet, targetSheet, placeAfter);
+            }
+		}
+
+		private void MoveSheetXmlNode(ExcelWorksheet sourceSheet, ExcelWorksheet targetSheet, bool placeAfter)
+		{
+            lock (TopNode.OwnerDocument)
+            {
+                var sourceNode = TopNode.SelectSingleNode(string.Format("d:sheet[@sheetId = '{0}']", sourceSheet.SheetID), _namespaceManager);
+                var targetNode = TopNode.SelectSingleNode(string.Format("d:sheet[@sheetId = '{0}']", targetSheet.SheetID), _namespaceManager);
+                if (sourceNode == null || targetNode == null)
+                {
+                    throw new Exception("Source SheetId and Target SheetId must be valid");
+                }
+                if (placeAfter)
+                {
+                    TopNode.InsertAfter(sourceNode, targetNode);
+                }
+                else
+                {
+                    TopNode.InsertBefore(sourceNode, targetNode);
+                }
+            }
+		}
+
+		#endregion
+        public void Dispose()
+        {            
+             foreach (var sheet in this._worksheets.Values) 
+             { 
+                 ((IDisposable)sheet).Dispose(); 
+             } 
+             _worksheets = null;
+             _pck = null;            
+        }
+    } // end class Worksheets
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/CalculateExtentions.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/CalculateExtentions.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/CalculateExtentions.cs	(revision 12707)
@@ -0,0 +1,204 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman                      Added                       2012-03-04  
+ *******************************************************************************/
+
+using System.Threading;
+using OfficeOpenXml.FormulaParsing.LexicalAnalysis;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing;
+using OfficeOpenXml.FormulaParsing.Exceptions;
+namespace OfficeOpenXml
+{
+    public static class CalculationExtension
+    {
+        public static void Calculate(this ExcelWorkbook workbook)
+        {
+            Calculate(workbook, new ExcelCalculationOption(){AllowCirculareReferences=false});
+        }
+        public static void Calculate(this ExcelWorkbook workbook, ExcelCalculationOption options)
+        {
+            Init(workbook);
+
+            var dc = DependencyChainFactory.Create(workbook, options);
+            workbook.FormulaParser.InitNewCalc();
+            if (workbook.FormulaParser.Logger != null)
+            {
+                var msg = string.Format("Starting... number of cells to parse: {0}", dc.list.Count);
+                workbook.FormulaParser.Logger.Log(msg);
+            }
+
+            //TODO: Remove when tests are done. Outputs the dc to a text file. 
+            //var fileDc = new System.IO.StreamWriter("c:\\temp\\dc.txt");
+                        
+            //for (int i = 0; i < dc.list.Count; i++)
+            //{
+            //    fileDc.WriteLine(i.ToString() + "," + dc.list[i].Column.ToString() + "," + dc.list[i].Row.ToString() + "," + (dc.list[i].ws==null ? "" : dc.list[i].ws.Name) + "," + dc.list[i].Formula);
+            //}
+            //fileDc.Close();
+            //fileDc = new System.IO.StreamWriter("c:\\temp\\dcorder.txt");
+            //for (int i = 0; i < dc.CalcOrder.Count; i++)
+            //{
+            //    fileDc.WriteLine(dc.CalcOrder[i].ToString());
+            //}
+            //fileDc.Close();
+            //fileDc = null;
+
+            //TODO: Add calculation here
+
+            CalcChain(workbook, workbook.FormulaParser, dc);
+
+            //workbook._isCalculated = true;
+        }
+        public static void Calculate(this ExcelWorksheet worksheet)
+        {
+            Calculate(worksheet, new ExcelCalculationOption());
+        }
+        public static void Calculate(this ExcelWorksheet worksheet, ExcelCalculationOption options)
+        {
+            Init(worksheet.Workbook);
+            //worksheet.Workbook._formulaParser = null; TODO:Cant reset. Don't work with userdefined or overrided worksheet functions            
+            var dc = DependencyChainFactory.Create(worksheet, options);
+            var parser = worksheet.Workbook.FormulaParser;
+            parser.InitNewCalc();
+            if (parser.Logger != null)
+            {
+                var msg = string.Format("Starting... number of cells to parse: {0}", dc.list.Count);
+                parser.Logger.Log(msg);
+            }
+            CalcChain(worksheet.Workbook, parser, dc);
+        }
+        public static void Calculate(this ExcelRangeBase range)
+        {
+            Calculate(range, new ExcelCalculationOption());
+        }
+        public static void Calculate(this ExcelRangeBase range, ExcelCalculationOption options)
+        {
+            Init(range._workbook);
+            var parser = range._workbook.FormulaParser;
+            parser.InitNewCalc();
+            var dc = DependencyChainFactory.Create(range, options);
+            CalcChain(range._workbook, parser, dc);
+        }
+        public static object Calculate(this ExcelWorksheet worksheet, string Formula)
+        {
+            return Calculate(worksheet, Formula, new ExcelCalculationOption());
+        }
+        public static object Calculate(this ExcelWorksheet worksheet, string Formula, ExcelCalculationOption options)
+        {
+            try
+            {
+                worksheet.CheckSheetType();
+                if(string.IsNullOrEmpty(Formula.Trim())) return null;
+                Init(worksheet.Workbook);
+                var parser = worksheet.Workbook.FormulaParser;
+                parser.InitNewCalc();
+                if (Formula[0] == '=') Formula = Formula.Substring(1); //Remove any starting equal sign
+                var dc = DependencyChainFactory.Create(worksheet, Formula, options);
+                var f = dc.list[0];
+                dc.CalcOrder.RemoveAt(dc.CalcOrder.Count - 1);
+
+                CalcChain(worksheet.Workbook, parser, dc);
+
+                return parser.ParseCell(f.Tokens, worksheet.Name, -1, -1);
+            }
+            catch (Exception ex)
+            {
+                return new ExcelErrorValueException(ex.Message, ExcelErrorValue.Create(eErrorType.Value));
+            }
+        }
+        private static void CalcChain(ExcelWorkbook wb, FormulaParser parser, DependencyChain dc)
+        {
+            var debug = parser.Logger != null;
+            foreach (var ix in dc.CalcOrder)
+            {
+                var item = dc.list[ix];
+                try
+                {
+                    var ws = wb.Worksheets.GetBySheetID(item.SheetID);
+                    var v = parser.ParseCell(item.Tokens, ws == null ? "" : ws.Name, item.Row, item.Column);
+                    SetValue(wb, item, v);
+                    if (debug)
+                    {
+                        parser.Logger.LogCellCounted();
+                    }
+                    Thread.Sleep(0);
+                }
+                catch (FormatException fe)
+                {
+                    throw (fe);
+                }
+                catch (Exception e)
+                {
+                    var error = ExcelErrorValue.Parse(ExcelErrorValue.Values.Value);
+                    SetValue(wb, item, error);
+                }
+            }
+        }
+        private static void Init(ExcelWorkbook workbook)
+        {
+            workbook._formulaTokens = new CellStore<List<Token>>();;
+            foreach (var ws in workbook.Worksheets)
+            {
+                if (!(ws is ExcelChartsheet))
+                {
+                    if (ws._formulaTokens != null)
+                    {
+                        ws._formulaTokens.Dispose();
+                    }
+                    ws._formulaTokens = new CellStore<List<Token>>();
+                }
+            }
+        }
+
+        private static void SetValue(ExcelWorkbook workbook, FormulaCell item, object v)
+        {
+            if (item.Column == 0)
+            {
+                if (item.SheetID <= 0)
+                {
+                    workbook.Names[item.Row].NameValue = v;
+                }
+                else
+                {
+                    var sh = workbook.Worksheets.GetBySheetID(item.SheetID);
+                    sh.Names[item.Row].NameValue = v;
+                }
+            }
+            else
+            {
+                var sheet = workbook.Worksheets.GetBySheetID(item.SheetID);
+                sheet._values.SetValue(item.Row, item.Column, v);
+            }
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/DependencyChain/DependencyChain.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/DependencyChain/DependencyChain.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/DependencyChain/DependencyChain.cs	(revision 12707)
@@ -0,0 +1,17 @@
+using System.Collections.Generic;
+
+namespace OfficeOpenXml.FormulaParsing
+{
+    internal class DependencyChain
+    {
+        internal List<FormulaCell> list = new List<FormulaCell>();
+        internal Dictionary<ulong, int> index = new Dictionary<ulong, int>();
+        internal List<int> CalcOrder = new List<int>();
+        internal void Add(FormulaCell f)
+        {
+            list.Add(f);
+            f.Index = list.Count - 1;
+            index.Add(ExcelCellBase.GetCellID(f.SheetID, f.Row, f.Column), f.Index);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/DependencyChain/DependenyChainFactory.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/DependencyChain/DependenyChainFactory.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/DependencyChain/DependenyChainFactory.cs	(revision 12707)
@@ -0,0 +1,366 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman                      Added                       2012-03-04  
+ *******************************************************************************/
+using OfficeOpenXml.FormulaParsing.LexicalAnalysis;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing;
+using OfficeOpenXml.FormulaParsing.Exceptions;
+
+namespace OfficeOpenXml.FormulaParsing
+{
+    internal static class DependencyChainFactory
+    {
+        internal static DependencyChain Create(ExcelWorkbook wb, ExcelCalculationOption options)
+        {
+            var depChain = new DependencyChain();
+            foreach (var ws in wb.Worksheets)
+            {
+                if (!(ws is ExcelChartsheet))
+                {
+                    GetChain(depChain, wb.FormulaParser.Lexer, ws.Cells, options);
+                    GetWorksheetNames(ws, depChain, options);
+                }
+            }
+            foreach (var name in wb.Names)
+            {
+                if (name.NameValue==null)
+                {
+                    GetChain(depChain, wb.FormulaParser.Lexer, name, options);
+                }
+            }
+            return depChain;
+        }
+
+        internal static DependencyChain Create(ExcelWorksheet ws, ExcelCalculationOption options)
+        {
+            ws.CheckSheetType();
+            var depChain = new DependencyChain();
+
+            GetChain(depChain, ws.Workbook.FormulaParser.Lexer, ws.Cells, options);
+
+            GetWorksheetNames(ws, depChain, options);
+
+            return depChain;
+        }
+        internal static DependencyChain Create(ExcelWorksheet ws, string Formula, ExcelCalculationOption options)
+        {
+            ws.CheckSheetType();
+            var depChain = new DependencyChain();
+
+            GetChain(depChain, ws.Workbook.FormulaParser.Lexer, ws, Formula, options);
+            
+            return depChain;
+        }
+
+        private static void GetWorksheetNames(ExcelWorksheet ws, DependencyChain depChain, ExcelCalculationOption options)
+        {
+            foreach (var name in ws.Names)
+            {
+                if (!string.IsNullOrEmpty(name.NameFormula))
+                {
+                    GetChain(depChain, ws.Workbook.FormulaParser.Lexer, name, options);
+                }
+            }
+        }
+        internal static DependencyChain Create(ExcelRangeBase range, ExcelCalculationOption options)
+        {
+            var depChain = new DependencyChain();
+
+            GetChain(depChain, range.Worksheet.Workbook.FormulaParser.Lexer, range, options);
+
+            return depChain;
+        }
+        private static void GetChain(DependencyChain depChain, ILexer lexer, ExcelNamedRange name, ExcelCalculationOption options)
+        {
+            var ws = name.Worksheet;
+            var id = ExcelCellBase.GetCellID(ws==null?0:ws.SheetID, name.Index, 0);
+            if (!depChain.index.ContainsKey(id))
+            {
+                var f = new FormulaCell() { SheetID = ws == null ? 0 : ws.SheetID, Row = name.Index, Column = 0, Formula=name.NameFormula };
+                if (!string.IsNullOrEmpty(f.Formula))
+                {
+                    f.Tokens = lexer.Tokenize(f.Formula, (ws==null ? null : ws.Name)).ToList();
+                    if (ws == null)
+                    {
+                        name._workbook._formulaTokens.SetValue(name.Index, 0, f.Tokens);
+                    }
+                    else
+                    {
+                        ws._formulaTokens.SetValue(name.Index, 0, f.Tokens);
+                    }
+                    depChain.Add(f);
+                    FollowChain(depChain, lexer,name._workbook, ws, f, options);
+                }
+            }
+        }
+        private static void GetChain(DependencyChain depChain, ILexer lexer, ExcelWorksheet ws, string formula, ExcelCalculationOption options)
+        {
+            var f = new FormulaCell() { SheetID = ws.SheetID, Row = -1, Column = -1 };
+            f.Formula = formula;
+            if (!string.IsNullOrEmpty(f.Formula))
+            {
+                f.Tokens = lexer.Tokenize(f.Formula, ws.Name).ToList();
+                depChain.Add(f);
+                FollowChain(depChain, lexer, ws.Workbook, ws, f, options);
+            }
+        }
+
+        private static void GetChain(DependencyChain depChain, ILexer lexer, ExcelRangeBase Range, ExcelCalculationOption options)
+        {
+            var ws = Range.Worksheet;
+            var fs = new CellsStoreEnumerator<object>(ws._formulas, Range.Start.Row, Range.Start.Column, Range.End.Row, Range.End.Column);
+            while (fs.Next())
+            {
+                if (fs.Value == null || fs.Value.ToString().Trim() == "") continue;
+                var id = ExcelCellBase.GetCellID(ws.SheetID, fs.Row, fs.Column);
+                if (!depChain.index.ContainsKey(id))
+                {
+                    var f = new FormulaCell() { SheetID = ws.SheetID, Row = fs.Row, Column = fs.Column };
+                    if (fs.Value is int)
+                    {
+                        f.Formula = ws._sharedFormulas[(int)fs.Value].GetFormula(fs.Row, fs.Column, ws.Name);
+                    }
+                    else
+                    {
+                        f.Formula = fs.Value.ToString();
+                    }
+                    if (!string.IsNullOrEmpty(f.Formula))
+                    {
+                        f.Tokens = lexer.Tokenize(f.Formula, Range.Worksheet.Name).ToList();
+                        ws._formulaTokens.SetValue(fs.Row, fs.Column, f.Tokens);
+                        depChain.Add(f);
+                        FollowChain(depChain, lexer, ws.Workbook, ws, f, options);
+                    }
+                }
+            }
+        }
+        /// <summary>
+        /// This method follows the calculation chain to get the order of the calculation
+        /// Goto (!) is used internally to prevent stackoverflow on extremly larget dependency trees (that is, many recursive formulas).
+        /// </summary>
+        /// <param name="depChain">The dependency chain object</param>
+        /// <param name="lexer">The formula tokenizer</param>
+        /// <param name="wb">The workbook where the formula comes from</param>
+        /// <param name="ws">The worksheet where the formula comes from</param>
+        /// <param name="f">The cell function object</param>
+        /// <param name="options">Calcultaiton options</param>
+        private static void FollowChain(DependencyChain depChain, ILexer lexer, ExcelWorkbook wb, ExcelWorksheet ws, FormulaCell f, ExcelCalculationOption options)
+        {
+            Stack<FormulaCell> stack = new Stack<FormulaCell>();
+        iterateToken:
+            while (f.tokenIx < f.Tokens.Count)
+            {
+                var t = f.Tokens[f.tokenIx];
+                if (t.TokenType == TokenType.ExcelAddress)
+                {
+                    var adr = new ExcelFormulaAddress(t.Value);
+                    if (adr.Table != null)
+                    {
+                        adr.SetRCFromTable(ws._package, new ExcelAddressBase(f.Row, f.Column, f.Row, f.Column));
+                    }
+
+                    if (adr.WorkSheet == null && adr.Collide(new ExcelAddressBase(f.Row, f.Column, f.Row, f.Column))!=ExcelAddressBase.eAddressCollition.No)
+                    {
+                        throw (new CircularReferenceException(string.Format("Circular Reference in cell {0}", ExcelAddressBase.GetAddress(f.Row, f.Column))));
+                    }
+
+                    if (adr._fromRow > 0 && adr._fromCol > 0)
+                    {                        
+                        if (string.IsNullOrEmpty(adr.WorkSheet))
+                        {
+                            if (f.ws == null)
+                            {
+                                f.ws = ws;
+                            }
+                            else if (f.ws.SheetID != f.SheetID)
+                            {
+                                f.ws = wb.Worksheets.GetBySheetID(f.SheetID);
+                            }
+                        }
+                        else
+                        {
+                            f.ws = wb.Worksheets[adr.WorkSheet];
+                        }
+
+                        if (f.ws != null)
+                        {
+                            f.iterator = new CellsStoreEnumerator<object>(f.ws._formulas, adr.Start.Row, adr.Start.Column, adr.End.Row, adr.End.Column);
+                            goto iterateCells;
+                        }
+                    }
+                }
+                else if (t.TokenType == TokenType.NameValue)
+                {
+                    string adrWb, adrWs, adrName;
+                    ExcelNamedRange name;
+                    ExcelAddressBase.SplitAddress(t.Value, out adrWb, out adrWs, out adrName, f.ws==null ? "" : f.ws.Name);
+                    if (!string.IsNullOrEmpty(adrWs))
+                    {
+                        if (f.ws == null)
+                        {
+                            f.ws = wb.Worksheets[adrWs];
+                        }
+                        if(f.ws.Names.ContainsKey(t.Value))
+                        {
+                            name = f.ws.Names[adrName];
+                        }
+                        else if (wb.Names.ContainsKey(adrName))
+                        {
+                            name = wb.Names[adrName];
+                        }
+                        else
+                        {
+                            name = null;
+                        }
+                        if(name != null) f.ws = name.Worksheet;                        
+                    }
+                    else if (wb.Names.ContainsKey(adrName))
+                    {
+                        name = wb.Names[t.Value];
+                        if (string.IsNullOrEmpty(adrWs))
+                        {
+                            f.ws = name.Worksheet;
+                        }
+                    }
+                    else
+                    {
+                        name = null;
+                    }
+
+                    if (name != null)
+                    {
+        
+                        if (string.IsNullOrEmpty(name.NameFormula))
+                        {
+                            if (name.NameValue == null)
+                            {
+                                f.iterator = new CellsStoreEnumerator<object>(f.ws._formulas, name.Start.Row,
+                                    name.Start.Column, name.End.Row, name.End.Column);
+                                goto iterateCells;
+                            }
+                        }
+                        else
+                        {
+                            var id = ExcelAddressBase.GetCellID(name.LocalSheetId, name.Index, 0);
+
+                            if (!depChain.index.ContainsKey(id))
+                            {
+                                var rf = new FormulaCell() { SheetID = name.LocalSheetId, Row = name.Index, Column = 0 };
+                                rf.Formula = name.NameFormula;
+                                rf.Tokens = name.LocalSheetId == -1 ? lexer.Tokenize(rf.Formula).ToList() : lexer.Tokenize(rf.Formula, wb.Worksheets.GetBySheetID(name.LocalSheetId).Name).ToList();
+                                
+                                depChain.Add(rf);
+                                stack.Push(f);
+                                f = rf;
+                                goto iterateToken;
+                            }
+                            else
+                            {
+                                if (stack.Count > 0)
+                                {
+                                    //Check for circular references
+                                    foreach (var par in stack)
+                                    {
+                                        if (ExcelAddressBase.GetCellID(par.SheetID, par.Row, par.Column) == id)
+                                        {
+                                            throw (new CircularReferenceException(string.Format("Circular Reference in name {0}", name.Name)));
+                                        }
+                                    }
+                                }
+                            }
+                        }
+                    }
+                }
+                f.tokenIx++;
+            }
+            depChain.CalcOrder.Add(f.Index);
+            if (stack.Count > 0)
+            {
+                f = stack.Pop();
+                goto iterateCells;
+            }
+            return;
+        iterateCells:
+
+            while (f.iterator != null && f.iterator.Next())
+            {
+                var v = f.iterator.Value;
+                if (v == null || v.ToString().Trim() == "") continue;
+                var id = ExcelAddressBase.GetCellID(f.ws.SheetID, f.iterator.Row, f.iterator.Column);
+                if (!depChain.index.ContainsKey(id))
+                {
+                    var rf = new FormulaCell() { SheetID = f.ws.SheetID, Row = f.iterator.Row, Column = f.iterator.Column };
+                    if (f.iterator.Value is int)
+                    {
+                        rf.Formula = f.ws._sharedFormulas[(int)v].GetFormula(f.iterator.Row, f.iterator.Column, ws.Name);
+                    }
+                    else
+                    {
+                        rf.Formula = v.ToString();
+                    }
+                    rf.ws = f.ws;
+                    rf.Tokens = lexer.Tokenize(rf.Formula, f.ws.Name).ToList();
+                    ws._formulaTokens.SetValue(rf.Row, rf.Column, rf.Tokens);
+                    depChain.Add(rf);
+                    stack.Push(f);
+                    f = rf;
+                    goto iterateToken;
+                }
+                else
+                {
+                    if (stack.Count > 0)
+                    {
+                        //Check for circular references
+                        foreach (var par in stack)
+                        {
+                            if (ExcelAddressBase.GetCellID(par.ws.SheetID, par.iterator.Row, par.iterator.Column) == id)
+                            {
+                                if (options.AllowCirculareReferences == false)
+                                {
+                                    throw (new CircularReferenceException(string.Format("Circular Reference in cell {0}!{1}", par.ws.Name, ExcelAddress.GetAddress(f.Row, f.Column))));
+                                }
+                                else
+                                {
+                                    f = stack.Pop();
+                                    goto iterateCells;
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+            f.tokenIx++;
+            goto iterateToken;
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/DependencyChain/FormulaCell.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/DependencyChain/FormulaCell.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/DependencyChain/FormulaCell.cs	(revision 12707)
@@ -0,0 +1,43 @@
+/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System.Collections.Generic;
+using OfficeOpenXml.FormulaParsing.LexicalAnalysis;
+
+namespace OfficeOpenXml.FormulaParsing
+{
+    internal class FormulaCell
+    {
+        internal int Index { get; set; }
+        internal int SheetID { get; set; }
+        internal int Row { get; set; }
+        internal int Column { get; set; }
+        internal string Formula { get; set; }
+        internal List<Token> Tokens { get; set; }
+        internal int tokenIx = 0;
+        internal int addressIx = 0;
+        internal CellsStoreEnumerator<object> iterator;
+        internal ExcelWorksheet ws;
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/EpplusExcelDataProvider.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/EpplusExcelDataProvider.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/EpplusExcelDataProvider.cs	(revision 12707)
@@ -0,0 +1,502 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing;
+using OfficeOpenXml.FormulaParsing.ExcelUtilities;
+using OfficeOpenXml.FormulaParsing.Excel.Functions;
+using OfficeOpenXml.FormulaParsing.LexicalAnalysis;
+using OfficeOpenXml.Utils;
+using OfficeOpenXml.Style.XmlAccess;
+
+namespace OfficeOpenXml.FormulaParsing
+{
+    public class EpplusExcelDataProvider : ExcelDataProvider
+    {
+        public class RangeInfo : IRangeInfo
+        {
+            internal ExcelWorksheet _ws;
+            CellsStoreEnumerator<object> _values = null;
+            int _fromRow, _toRow, _fromCol, _toCol;
+            int _cellCount = 0;
+            ExcelAddressBase _address;
+            ICellInfo _cell;
+
+            public RangeInfo(ExcelWorksheet ws, int fromRow, int fromCol, int toRow, int toCol)
+            {
+                _ws = ws;
+                _fromRow = fromRow;
+                _fromCol = fromCol;
+                _toRow = toRow;
+                _toCol = toCol;
+                _address = new ExcelAddressBase(_fromRow, _fromCol, _toRow, _toCol);
+                _address._ws = ws.Name;
+                _values = new CellsStoreEnumerator<object>(ws._values, _fromRow, _fromCol, _toRow, _toCol);
+                _cell = new CellInfo(_ws, _values);
+            }
+
+            public int GetNCells()
+            {
+                return ((_toRow - _fromRow) + 1) * ((_toCol - _fromCol) + 1);
+            }
+
+            public bool IsEmpty
+            {
+                get
+                {
+                    if (_cellCount > 0)
+                    {
+                        return false;
+                    }
+                    else if (_values.Next())
+                    {
+                        _values.Reset();
+                        return false;
+                    }
+                    else
+                    {
+                        return true;
+                    }
+                }
+            }
+            public bool IsMulti
+            {
+                get
+                {
+                    if (_cellCount == 0)
+                    {
+                        if (_values.Next() && _values.Next())
+                        {
+                            _values.Reset();
+                            return true;
+                        }
+                        else
+                        {
+                            _values.Reset();
+                            return false;
+                        }
+                    }
+                    else if (_cellCount > 1)
+                    {
+                        return true;
+                    }
+                    return false;
+                }
+            }
+
+            public ICellInfo Current
+            {
+                get { return _cell; }
+            }
+
+            public ExcelWorksheet Worksheet
+            {
+                get { return _ws; }
+            }
+
+            public void Dispose()
+            {
+                //_values = null;
+                //_ws = null;
+                //_cell = null;
+            }
+
+            object System.Collections.IEnumerator.Current
+            {
+                get
+                {
+                    return this;
+                }
+            }
+
+            public bool MoveNext()
+            {
+                _cellCount++;
+                return _values.MoveNext();
+            }
+
+            public void Reset()
+            {
+                _values.Init();
+            }
+
+
+            public bool NextCell()
+            {
+                _cellCount++;
+                return _values.MoveNext();
+            }
+
+            public IEnumerator<ICellInfo> GetEnumerator()
+            {
+                Reset();
+                return this;
+            }
+
+            System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
+            {
+                return this;
+            }
+            
+            public ExcelAddressBase Address
+            {
+                get { return _address; }
+            }
+
+            public object GetValue(int row, int col)
+            {
+                return _ws.GetValue(row, col);
+            }
+
+            public object GetOffset(int rowOffset, int colOffset)
+            {
+                if (_values.Row < _fromRow || _values.Column < _fromCol)
+                {
+                    return _ws.GetValue(_fromRow + rowOffset, _fromCol + colOffset);
+                }
+                else
+                {
+                    return _ws.GetValue(_values.Row + rowOffset, _values.Column + colOffset);
+                }
+            }
+        }
+
+        public class CellInfo : ICellInfo
+        {
+            ExcelWorksheet _ws;
+            CellsStoreEnumerator<object> _values;
+            internal CellInfo(ExcelWorksheet ws, CellsStoreEnumerator<object> values)
+            {
+                _ws = ws;
+                _values = values;
+            }
+            public string Address
+            {
+                get { return _values.CellAddress; }
+            }
+
+            public int Row
+            {
+                get { return _values.Row; }
+            }
+
+            public int Column
+            {
+                get { return _values.Column; }
+            }
+
+            public string Formula
+            {
+                get 
+                {
+                    return _ws.GetFormula(_values.Row, _values.Column);
+                }
+            }
+
+            public object Value
+            {
+                get { return _values.Value; }
+            }
+            
+            public double ValueDouble
+            {
+                get { return ConvertUtil.GetValueDouble(_values.Value, true); }
+            }
+            public double ValueDoubleLogical
+            {
+                get { return ConvertUtil.GetValueDouble(_values.Value, false); }
+            }
+            public bool IsHiddenRow
+            {
+                get 
+                { 
+                    var row=_ws._values.GetValue(_values.Row, 0) as RowInternal;
+                    if(row != null)
+                    {
+                        return row.Hidden || row.Height==0;
+                    }
+                    else
+                    {
+                        return false;
+                    }
+                }
+            }
+
+            public bool IsExcelError
+            {
+                get { return ExcelErrorValue.Values.IsErrorValue(_values.Value); }
+            }
+
+            public IList<Token> Tokens
+            {
+                get 
+                {
+                    return _ws._formulaTokens.GetValue(_values.Row, _values.Column);
+                }
+            }
+
+        }
+        public class NameInfo : ExcelDataProvider.INameInfo
+        {
+            public ulong Id { get; set; }
+            public string Worksheet { get; set; }
+            public string Name { get; set; }
+            public string Formula { get; set; }
+            public IList<Token> Tokens { get; internal set; }
+            public object Value { get; set; }
+        }
+
+        private readonly ExcelPackage _package;
+        private ExcelWorksheet _currentWorksheet;
+        private RangeAddressFactory _rangeAddressFactory;
+        private Dictionary<ulong, INameInfo> _names=new Dictionary<ulong,INameInfo>();
+
+        public EpplusExcelDataProvider(ExcelPackage package)
+        {
+            _package = package;
+
+            _rangeAddressFactory = new RangeAddressFactory(this);
+        }
+
+        public override ExcelNamedRangeCollection GetWorksheetNames(string worksheet)
+        {
+            var ws=_package.Workbook.Worksheets[worksheet];
+            if (ws != null)
+            {
+                return ws.Names;
+            }
+            else
+            {
+                return null;
+            }
+        }
+
+        public override ExcelNamedRangeCollection GetWorkbookNameValues()
+        {
+            return _package.Workbook.Names;
+        }
+
+        public override IRangeInfo GetRange(string worksheet, int fromRow, int fromCol, int toRow, int toCol)
+        {
+            SetCurrentWorksheet(worksheet);
+            var wsName = string.IsNullOrEmpty(worksheet) ? _currentWorksheet.Name : worksheet;
+            var ws = _package.Workbook.Worksheets[wsName];
+            return new RangeInfo(ws, fromRow, fromCol, toRow, toCol);
+        }
+        public override IRangeInfo GetRange(string worksheet, int row, int column, string address)
+        {
+            var addr = new ExcelAddress(worksheet, address);
+            if (addr.Table != null)
+            {
+                addr.SetRCFromTable(_package, new ExcelAddressBase(row, column, row, column));
+            }
+            //SetCurrentWorksheet(addr.WorkSheet); 
+            var wsName = string.IsNullOrEmpty(addr.WorkSheet) ? _currentWorksheet.Name : addr.WorkSheet;
+            var ws = _package.Workbook.Worksheets[wsName];
+            //return new CellsStoreEnumerator<object>(ws._values, addr._fromRow, addr._fromCol, addr._toRow, addr._toCol);
+            return new RangeInfo(ws, addr._fromRow, addr._fromCol, addr._toRow, addr._toCol);
+        }
+        public override INameInfo GetName(string worksheet, string name)
+        {
+            ExcelNamedRange nameItem;
+            ulong id;            
+            ExcelWorksheet ws;
+            if (string.IsNullOrEmpty(worksheet))
+            {
+                if(_package._workbook.Names.ContainsKey(name))
+                {
+                    nameItem = _package._workbook.Names[name];
+                }
+                else
+                {
+                    return null;
+                }
+                ws = null;
+            }
+            else
+            {
+                ws = _package._workbook.Worksheets[worksheet];
+                if (ws !=null && ws.Names.ContainsKey(name))
+                {
+                    nameItem = ws.Names[name];
+                }
+                else if (_package._workbook.Names.ContainsKey(name))
+                {
+                    nameItem = _package._workbook.Names[name];
+                }
+                else
+                {
+                    return null;
+                }
+            }
+            id = ExcelAddressBase.GetCellID(nameItem.LocalSheetId, nameItem.Index, 0);
+
+            if (_names.ContainsKey(id))
+            {
+                return _names[id];
+            }
+            else
+            {
+                var ni = new NameInfo()
+                {
+                    Id = id,
+                    Name = name,
+                    Worksheet = nameItem.Worksheet==null ? nameItem._ws : nameItem.Worksheet.Name, 
+                    Formula = nameItem.Formula
+                };
+                if (nameItem._fromRow > 0)
+                {
+                    ni.Value = new RangeInfo(nameItem.Worksheet ?? ws, nameItem._fromRow, nameItem._fromCol, nameItem._toRow, nameItem._toCol);
+                }
+                else
+                {
+                    ni.Value = nameItem.Value;
+                }
+                _names.Add(id, ni);
+                return ni;
+            }
+        }
+        public override IEnumerable<object> GetRangeValues(string address)
+        {
+            SetCurrentWorksheet(ExcelAddressInfo.Parse(address));
+            var addr = new ExcelAddress(address);
+            var wsName = string.IsNullOrEmpty(addr.WorkSheet) ? _currentWorksheet.Name : addr.WorkSheet;
+            var ws = _package.Workbook.Worksheets[wsName];
+            return (new CellsStoreEnumerator<object>(ws._values, addr._fromRow, addr._fromCol, addr._toRow, addr._toCol));
+        }
+
+
+        public object GetValue(int row, int column)
+        {
+            return _currentWorksheet._values.GetValue(row, column);
+        }
+
+        public bool IsMerged(int row, int column)
+        {
+            //return _currentWorksheet._flags.GetFlagValue(row, column, CellFlags.Merged);
+            return _currentWorksheet.MergedCells[row, column] != null;
+        }
+
+        public bool IsHidden(int row, int column)
+        {
+            return _currentWorksheet.Column(column).Hidden || _currentWorksheet.Column(column).Width == 0 ||
+                   _currentWorksheet.Row(row).Hidden || _currentWorksheet.Row(column).Height == 0;
+        }
+
+        public override object GetCellValue(string sheetName, int row, int col)
+        {
+            SetCurrentWorksheet(sheetName);
+            return _currentWorksheet._values.GetValue(row, col);
+        }
+
+        public override ExcelCellAddress GetDimensionEnd(string worksheet)
+        {
+            ExcelCellAddress address = null;
+            try
+            {
+                address = _package.Workbook.Worksheets[worksheet].Dimension.End;
+            }
+            catch{}
+            
+            return address;
+        }
+
+        private void SetCurrentWorksheet(ExcelAddressInfo addressInfo)
+        {
+            if (addressInfo.WorksheetIsSpecified)
+            {
+                _currentWorksheet = _package.Workbook.Worksheets[addressInfo.Worksheet];
+            }
+            else if (_currentWorksheet == null)
+            {
+                _currentWorksheet = _package.Workbook.Worksheets.First();
+            }
+        }
+
+        private void SetCurrentWorksheet(string worksheetName)
+        {
+            if (!string.IsNullOrEmpty(worksheetName))
+            {
+                _currentWorksheet = _package.Workbook.Worksheets[worksheetName];    
+            }
+            else
+            {
+                _currentWorksheet = _package.Workbook.Worksheets.First(); 
+            }
+            
+        }
+
+        //public override void SetCellValue(string address, object value)
+        //{
+        //    var addressInfo = ExcelAddressInfo.Parse(address);
+        //    var ra = _rangeAddressFactory.Create(address);
+        //    SetCurrentWorksheet(addressInfo);
+        //    //var valueInfo = (ICalcEngineValueInfo)_currentWorksheet;
+        //    //valueInfo.SetFormulaValue(ra.FromRow + 1, ra.FromCol + 1, value);
+        //    _currentWorksheet.Cells[ra.FromRow + 1, ra.FromCol + 1].Value = value;
+        //}
+
+        public override void Dispose()
+        {
+            _package.Dispose();
+        }
+
+        public override int ExcelMaxColumns
+        {
+            get { return ExcelPackage.MaxColumns; }
+        }
+
+        public override int ExcelMaxRows
+        {
+            get { return ExcelPackage.MaxRows; }
+        }
+
+        public override string GetRangeFormula(string worksheetName, int row, int column)
+        {
+            SetCurrentWorksheet(worksheetName);
+            return _currentWorksheet.GetFormula(row, column);
+        }
+
+        public override object GetRangeValue(string worksheetName, int row, int column)
+        {
+            SetCurrentWorksheet(worksheetName);
+            return _currentWorksheet.GetValue(row, column);
+        }
+        public override string GetFormat(object value, string format)
+        {
+            var styles = _package.Workbook.Styles;
+            ExcelNumberFormatXml.ExcelFormatTranslator ft=null;
+            foreach(var f in styles.NumberFormats)
+            {
+                if(f.Format==format)
+                {
+                    ft=f.FormatTranslator;
+                    break;
+                }
+            }
+            if(ft==null)
+            {
+                ft=new ExcelNumberFormatXml.ExcelFormatTranslator(format, -1);
+            }
+            return ExcelRangeBase.FormatValue(value, ft,format, ft.NetFormat);
+        }
+        public override List<LexicalAnalysis.Token> GetRangeFormulaTokens(string worksheetName, int row, int column)
+        {
+            return _package.Workbook.Worksheets[worksheetName]._formulaTokens.GetValue(row, column);
+        }
+
+        public override bool IsRowHidden(string worksheetName, int row)
+        {
+            var b = _package.Workbook.Worksheets[worksheetName].Row(row).Height == 0 || 
+                    _package.Workbook.Worksheets[worksheetName].Row(row).Hidden;
+
+            return b;
+        }
+
+        public override void Reset()
+        {
+            _names = new Dictionary<ulong, INameInfo>(); //Reset name cache.            
+        }
+    }
+}
+    
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/EpplusExcelDataProvider.cs.orig
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/EpplusExcelDataProvider.cs.orig	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/EpplusExcelDataProvider.cs.orig	(revision 12707)
@@ -0,0 +1,462 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing;
+using OfficeOpenXml.FormulaParsing.ExcelUtilities;
+using OfficeOpenXml.FormulaParsing.Excel.Functions;
+using OfficeOpenXml.FormulaParsing.LexicalAnalysis;
+using OfficeOpenXml.Utils;
+using OfficeOpenXml.Style.XmlAccess;
+
+namespace OfficeOpenXml.FormulaParsing
+{
+    public class EpplusExcelDataProvider : ExcelDataProvider
+    {
+        public class RangeInfo : IRangeInfo
+        {
+            internal ExcelWorksheet _ws;
+            CellsStoreEnumerator<object> _values = null;
+            int _fromRow, _toRow, _fromCol, _toCol;
+            int _cellCount = 0;
+            ExcelAddressBase _address;
+            ICellInfo _cell;
+
+            public RangeInfo(ExcelWorksheet ws, int fromRow, int fromCol, int toRow, int toCol)
+            {
+                _ws = ws;
+                _fromRow = fromRow;
+                _fromCol = fromCol;
+                _toRow = toRow;
+                _toCol = toCol;
+                _address = new ExcelAddressBase(_fromRow, _fromCol, _toRow, _toCol);
+                _values = new CellsStoreEnumerator<object>(ws._values, _fromRow, _fromCol, _toRow, _toCol);
+                _cell = new CellInfo(_ws, _values);
+            }
+
+            public int GetNCells()
+            {
+                return ((_toRow - _fromRow) + 1) * ((_toCol - _fromCol) + 1);
+            }
+
+            public bool IsEmpty
+            {
+                get
+                {
+                    if (_cellCount > 0)
+                    {
+                        return false;
+                    }
+                    else if (_values.Next())
+                    {
+                        _values.Reset();
+                        return false;
+                    }
+                    else
+                    {
+                        return true;
+                    }
+                }
+            }
+            public bool IsMulti
+            {
+                get
+                {
+                    if (_cellCount == 0)
+                    {
+                        if (_values.Next() && _values.Next())
+                        {
+                            _values.Reset();
+                            return true;
+                        }
+                        else
+                        {
+                            _values.Reset();
+                            return false;
+                        }
+                    }
+                    else if (_cellCount > 1)
+                    {
+                        return true;
+                    }
+                    return false;
+                }
+            }
+
+            public ICellInfo Current
+            {
+                get { return _cell; }
+            }
+
+            public void Dispose()
+            {
+                //_values = null;
+                //_ws = null;
+                //_cell = null;
+            }
+
+            object System.Collections.IEnumerator.Current
+            {
+                get
+                {
+                    return this;
+                }
+            }
+
+            public bool MoveNext()
+            {
+                _cellCount++;
+                return _values.MoveNext();
+            }
+
+            public void Reset()
+            {                
+                _values.Init();
+            }
+
+
+            public bool NextCell()
+            {
+                _cellCount++;
+                return _values.MoveNext();
+            }
+
+            public IEnumerator<ICellInfo> GetEnumerator()
+            {
+                Reset();
+                return this;
+            }
+
+            System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
+            {
+                return this;
+            }
+
+
+            public ExcelAddressBase Address
+            {
+                get { return _address; }
+            }
+
+            public object GetValue(int row, int col)
+            {
+                return _ws.GetValue(row, col);
+            }
+
+            public object GetOffset(int rowOffset, int colOffset)
+            {
+                if (_values.Row < _fromRow || _values.Column < _fromCol)
+                {
+                    return _ws.GetValue(_fromCol + rowOffset, _fromCol + colOffset);
+                }
+                else
+                {
+                    return _ws.GetValue(_values.Row + rowOffset, _values.Column + colOffset);
+                }
+            }
+        }
+        public class CellInfo : ICellInfo
+        {
+            ExcelWorksheet _ws;
+            CellsStoreEnumerator<object> _values;
+            internal CellInfo(ExcelWorksheet ws, CellsStoreEnumerator<object> values)
+            {
+                _ws = ws;
+                _values = values;
+            }
+            public string Address
+            {
+                get { return _values.CellAddress; }
+            }
+
+            public int Row
+            {
+                get { return _values.Row; }
+            }
+
+            public int Column
+            {
+                get { return _values.Column; }
+            }
+
+            public string Formula
+            {
+                get 
+                {
+                    return _ws.GetFormula(_values.Row, _values.Column);
+                }
+            }
+
+            public object Value
+            {
+                get { return _values.Value; }
+            }
+            
+            public double ValueDouble
+            {
+                get { return ConvertUtil.GetValueDouble(_values.Value, true); }
+            }
+            public double ValueDoubleLogical
+            {
+                get { return ConvertUtil.GetValueDouble(_values.Value, false); }
+            }
+            public bool IsHiddenRow
+            {
+                get 
+                { 
+                    var row=_ws._values.GetValue(_values.Row, 0) as RowInternal;
+                    if(row != null)
+                    {
+                        return row.Hidden || row.Height==0;
+                    }
+                    else
+                    {
+                        return false;
+                    }
+                }
+            }
+
+            public bool IsExcelError
+            {
+                get { return ExcelErrorValue.Values.IsErrorValue(_values.Value); }
+            }
+
+            public IList<Token> Tokens
+            {
+                get 
+                {
+                    return _ws._formulaTokens.GetValue(_values.Row, _values.Column);
+                }
+            }
+
+        }
+        public class NameInfo : ExcelDataProvider.INameInfo
+        {
+            public ulong Id { get; set; }
+            public string Worksheet { get; set; }
+            public string Name { get; set; }
+            public string Formula { get; set; }
+            public IList<Token> Tokens { get; internal set; }
+            public object Value { get; set; }
+        }
+
+        private readonly ExcelPackage _package;
+        private ExcelWorksheet _currentWorksheet;
+        private RangeAddressFactory _rangeAddressFactory;
+        private Dictionary<ulong, INameInfo> _names=new Dictionary<ulong,INameInfo>();
+
+        public EpplusExcelDataProvider(ExcelPackage package)
+        {
+            _package = package;
+
+            _rangeAddressFactory = new RangeAddressFactory(this);
+        }
+
+        public override ExcelNamedRangeCollection GetWorksheetNames()
+        {
+            return _package.Workbook.Worksheets.First().Names;
+        }
+
+        public override ExcelNamedRangeCollection GetWorkbookNameValues()
+        {
+            return _package.Workbook.Names;
+        }
+        public override IRangeInfo GetRange(string worksheet, int row, int column, string address)
+        {
+            var addr = new ExcelAddress(worksheet, address);
+            if (addr.Table != null)
+            {
+                addr.SetRCFromTable(_package, new ExcelAddressBase(row, column, row, column));
+            }
+            //SetCurrentWorksheet(addr.WorkSheet); 
+            var wsName = string.IsNullOrEmpty(addr.WorkSheet) ? _currentWorksheet.Name : addr.WorkSheet;
+            var ws = _package.Workbook.Worksheets[wsName];
+            //return new CellsStoreEnumerator<object>(ws._values, addr._fromRow, addr._fromCol, addr._toRow, addr._toCol);
+            return new RangeInfo(ws, addr._fromRow, addr._fromCol, addr._toRow, addr._toCol);
+        }
+        public override INameInfo GetName(string worksheet, string name)
+        {
+            ExcelNamedRange nameItem;
+            ulong id;            
+            ExcelWorksheet ws;
+            if (string.IsNullOrEmpty(worksheet))
+            {
+                if(_package._workbook.Names.ContainsKey(name))
+                {
+                    nameItem = _package._workbook.Names[name];
+                }
+                else
+                {
+                    return null;
+                }
+                ws = null;
+            }
+            else
+            {
+                ws = _package._workbook.Worksheets[worksheet];
+                if (ws !=null && ws.Names.ContainsKey(name))
+                {
+                    nameItem = _package._workbook.Names[name];
+                }
+                else if (_package._workbook.Names.ContainsKey(name))
+                {
+                    nameItem = _package._workbook.Names[name];
+                }
+                else
+                {
+                    return null;
+                }
+            }
+            id = ExcelAddressBase.GetCellID(nameItem.LocalSheetId, nameItem.Index, 0);
+
+            if (_names.ContainsKey(id))
+            {
+                return _names[id];
+            }
+            else
+            {
+                var ni = new NameInfo()
+                {
+                    Id = id,
+                    Name = name,
+                    Worksheet = nameItem.Worksheet==null ? nameItem._ws : nameItem.Worksheet.Name, 
+                    Formula = nameItem.Formula
+                };
+                if (nameItem._fromRow > 0)
+                {
+                    ni.Value = new RangeInfo(nameItem.Worksheet ?? ws, nameItem._fromRow, nameItem._fromCol, nameItem._toRow, nameItem._toCol);
+                }
+                else
+                {
+                    ni.Value = nameItem.Value;
+                }
+                _names.Add(id, ni);
+                return ni;
+            }
+        }
+        public override IEnumerable<object> GetRangeValues(string address)
+        {
+            SetCurrentWorksheet(ExcelAddressInfo.Parse(address));
+            var addr = new ExcelAddress(address);
+            var wsName = string.IsNullOrEmpty(addr.WorkSheet) ? _currentWorksheet.Name : addr.WorkSheet;
+            var ws = _package.Workbook.Worksheets[wsName];
+            return (new CellsStoreEnumerator<object>(ws._values, addr._fromRow, addr._fromCol, addr._toRow, addr._toCol));
+        }
+
+
+        public object GetValue(int row, int column)
+        {
+            return _currentWorksheet._values.GetValue(row, column);
+        }
+
+        public bool IsMerged(int row, int column)
+        {
+            return _currentWorksheet._flags.GetFlagValue(row, column, CellFlags.Merged);
+        }
+
+        public bool IsHidden(int row, int column)
+        {
+            return _currentWorksheet.Column(column).Hidden || _currentWorksheet.Column(column).Width == 0 ||
+                   _currentWorksheet.Row(row).Hidden || _currentWorksheet.Row(column).Height == 0;
+        }
+
+        public override object GetCellValue(string sheetName, int row, int col)
+        {
+            SetCurrentWorksheet(sheetName);
+            return _currentWorksheet._values.GetValue(row, col);
+        }
+
+        private void SetCurrentWorksheet(ExcelAddressInfo addressInfo)
+        {
+            if (addressInfo.WorksheetIsSpecified)
+            {
+                _currentWorksheet = _package.Workbook.Worksheets[addressInfo.Worksheet];
+            }
+            else if (_currentWorksheet == null)
+            {
+                _currentWorksheet = _package.Workbook.Worksheets.First();
+            }
+        }
+
+        private void SetCurrentWorksheet(string worksheetName)
+        {
+            if (!string.IsNullOrEmpty(worksheetName))
+            {
+                _currentWorksheet = _package.Workbook.Worksheets[worksheetName];    
+            }
+            else
+            {
+                _currentWorksheet = _package.Workbook.Worksheets.First(); 
+            }
+            
+        }
+
+        //public override void SetCellValue(string address, object value)
+        //{
+        //    var addressInfo = ExcelAddressInfo.Parse(address);
+        //    var ra = _rangeAddressFactory.Create(address);
+        //    SetCurrentWorksheet(addressInfo);
+        //    //var valueInfo = (ICalcEngineValueInfo)_currentWorksheet;
+        //    //valueInfo.SetFormulaValue(ra.FromRow + 1, ra.FromCol + 1, value);
+        //    _currentWorksheet.Cells[ra.FromRow + 1, ra.FromCol + 1].Value = value;
+        //}
+
+        public override void Dispose()
+        {
+            _package.Dispose();
+        }
+
+        public override int ExcelMaxColumns
+        {
+            get { return ExcelPackage.MaxColumns; }
+        }
+
+        public override int ExcelMaxRows
+        {
+            get { return ExcelPackage.MaxRows; }
+        }
+
+        public override string GetRangeFormula(string worksheetName, int row, int column)
+        {
+            SetCurrentWorksheet(worksheetName);
+            return _currentWorksheet.GetFormula(row, column);
+        }
+
+        public override object GetRangeValue(string worksheetName, int row, int column)
+        {
+            SetCurrentWorksheet(worksheetName);
+            return _currentWorksheet.GetValue(row, column);
+        }
+        public override string GetFormat(object value, string format)
+        {
+            var styles = _package.Workbook.Styles;
+            ExcelNumberFormatXml.ExcelFormatTranslator ft=null;
+            foreach(var f in styles.NumberFormats)
+            {
+                if(f.Format==format)
+                {
+                    ft=f.FormatTranslator;
+                    break;
+                }
+            }
+            if(ft==null)
+            {
+                ft=new ExcelNumberFormatXml.ExcelFormatTranslator(format, -1);
+            }
+            return ExcelRangeBase.FormatValue(value, ft,format, ft.NetFormat);
+        }
+        public override List<LexicalAnalysis.Token> GetRangeFormulaTokens(string worksheetName, int row, int column)
+        {
+            return _package.Workbook.Worksheets[worksheetName]._formulaTokens.GetValue(row, column);
+        }
+
+        public override bool IsRowHidden(string worksheetName, int row)
+        {
+            var b = _package.Workbook.Worksheets[worksheetName].Row(row).Height == 0 || 
+                    _package.Workbook.Worksheets[worksheetName].Row(row).Hidden;
+
+            return b;
+        }
+    }
+}
+    
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/EpplusNameValueProvider.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/EpplusNameValueProvider.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/EpplusNameValueProvider.cs	(revision 12707)
@@ -0,0 +1,43 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing;
+
+namespace OfficeOpenXml.FormulaParsing
+{
+    public class EpplusNameValueProvider : INameValueProvider
+    {
+        private ExcelDataProvider _excelDataProvider;
+        private ExcelNamedRangeCollection _values;
+
+        public EpplusNameValueProvider(ExcelDataProvider excelDataProvider)
+        {
+            _excelDataProvider = excelDataProvider;
+            _values = _excelDataProvider.GetWorkbookNameValues();
+        }
+
+        public virtual bool IsNamedValue(string key, string ws)
+        {
+            if(ws!=null)
+            {
+                var wsNames = _excelDataProvider.GetWorksheetNames(ws);
+                if(wsNames!=null && wsNames.ContainsKey(key))
+                {
+                    return true;
+                }
+            }
+            return _values != null && _values.ContainsKey(key);
+        }
+
+        public virtual object GetNamedValue(string key)
+        {
+            return _values[key];
+        }
+
+        public virtual void Reload()
+        {
+            _values = _excelDataProvider.GetWorkbookNameValues();
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/ExcelCellState.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/ExcelCellState.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/ExcelCellState.cs	(revision 12707)
@@ -0,0 +1,45 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing.Excel
+{
+    [Flags]
+    public enum ExcelCellState
+    {
+        HiddenCell = 1,
+        ContainsError = 2,
+        IsResultOfSubtotal = 4
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/ArgumentCollectionUtil.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/ArgumentCollectionUtil.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/ArgumentCollectionUtil.cs	(revision 12707)
@@ -0,0 +1,85 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions
+{
+    public class ArgumentCollectionUtil
+    {
+        private readonly DoubleEnumerableArgConverter _doubleEnumerableArgConverter;
+        private readonly ObjectEnumerableArgConverter _objectEnumerableArgConverter;
+
+        public ArgumentCollectionUtil()
+            : this(new DoubleEnumerableArgConverter(), new ObjectEnumerableArgConverter())
+        {
+
+        }
+
+        public ArgumentCollectionUtil(
+            DoubleEnumerableArgConverter doubleEnumerableArgConverter, 
+            ObjectEnumerableArgConverter objectEnumerableArgConverter)
+        {
+            _doubleEnumerableArgConverter = doubleEnumerableArgConverter;
+            _objectEnumerableArgConverter = objectEnumerableArgConverter;
+        }
+
+        public virtual IEnumerable<double> ArgsToDoubleEnumerable(bool ignoreHidden, bool ignoreErrors, IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            return _doubleEnumerableArgConverter.ConvertArgs(ignoreHidden, ignoreErrors, arguments, context);
+        }
+
+        public virtual IEnumerable<object> ArgsToObjectEnumerable(bool ignoreHidden,
+                                                                  IEnumerable<FunctionArgument> arguments,
+                                                                  ParsingContext context)
+        {
+            return _objectEnumerableArgConverter.ConvertArgs(ignoreHidden, arguments, context);
+        }
+
+        public virtual double CalculateCollection(IEnumerable<FunctionArgument> collection, double result, Func<FunctionArgument, double, double> action)
+        {
+            foreach (var item in collection)
+            {
+                if (item.Value is IEnumerable<FunctionArgument>)
+                {
+                    result = CalculateCollection((IEnumerable<FunctionArgument>)item.Value, result, action);
+                }
+                else
+                {
+                    result = action(item, result);
+                }
+            }
+            return result;
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/ArgumentParser.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/ArgumentParser.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/ArgumentParser.cs	(revision 12707)
@@ -0,0 +1,36 @@
+﻿ /* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions
+{
+    public abstract class ArgumentParser
+    {
+        public abstract object Parse(object obj);
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/ArgumentParserFactory.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/ArgumentParserFactory.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/ArgumentParserFactory.cs	(revision 12707)
@@ -0,0 +1,50 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions
+{
+    public class ArgumentParserFactory
+    {
+        public virtual ArgumentParser CreateArgumentParser(DataType dataType)
+        {
+            switch (dataType)
+            {
+                case DataType.Integer:
+                    return new IntArgumentParser();
+                case DataType.Boolean:
+                    return new BoolArgumentParser();
+                case DataType.Decimal:
+                    return new DoubleArgumentParser();
+                default:
+                    throw new InvalidOperationException("non supported argument parser type " + dataType.ToString());
+            }
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/ArgumentParsers.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/ArgumentParsers.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/ArgumentParsers.cs	(revision 12707)
@@ -0,0 +1,67 @@
+﻿using System;
+/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+using OfficeOpenXml.FormulaParsing.Utilities;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions
+{
+    public class ArgumentParsers
+    {
+        private static object _syncRoot = new object();
+        private readonly Dictionary<DataType, ArgumentParser> _parsers = new Dictionary<DataType, ArgumentParser>();
+        private readonly ArgumentParserFactory _parserFactory;
+
+        public ArgumentParsers()
+            : this(new ArgumentParserFactory())
+        {
+
+        }
+
+        public ArgumentParsers(ArgumentParserFactory factory)
+        {
+            Require.That(factory).Named("argumentParserfactory").IsNotNull();
+            _parserFactory = factory;
+        }
+
+        public ArgumentParser GetParser(DataType dataType)
+        {
+            if (!_parsers.ContainsKey(dataType))
+            {
+                lock (_syncRoot)
+                {
+                    if (!_parsers.ContainsKey(dataType))
+                    {
+                        _parsers.Add(dataType, _parserFactory.CreateArgumentParser(dataType));
+                    }
+                }
+            }
+            return _parsers[dataType];
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/BoolArgumentParser.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/BoolArgumentParser.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/BoolArgumentParser.cs	(revision 12707)
@@ -0,0 +1,53 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.Utilities;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions
+{
+    public class BoolArgumentParser : ArgumentParser
+    {
+        public override object Parse(object obj)
+        {
+            if (obj is ExcelDataProvider.IRangeInfo)
+            {
+                var r = ((ExcelDataProvider.IRangeInfo)obj).FirstOrDefault();
+                obj = (r == null ? null : r.Value);
+            }
+            if (obj == null) return false;
+            if (obj is bool) return (bool)obj;
+            if (obj.IsNumeric()) return Convert.ToBoolean(obj);
+            bool result;
+            if (bool.TryParse(obj.ToString(), out result))
+            {
+                return result;
+            }
+            return result;
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/BuiltInFunctions.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/BuiltInFunctions.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/BuiltInFunctions.cs	(revision 12707)
@@ -0,0 +1,187 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
+using OfficeOpenXml.FormulaParsing.Excel.Functions.Math;
+using OfficeOpenXml.FormulaParsing.Excel.Functions.Logical;
+using OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime;
+using OfficeOpenXml.FormulaParsing.Excel.Functions.Numeric;
+using OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup;
+using OfficeOpenXml.FormulaParsing.Excel.Functions.Information;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions
+{
+    public class BuiltInFunctions : FunctionsModule
+    {
+        public BuiltInFunctions()
+        {
+            // Text
+            Functions["len"] = new Len();
+            Functions["lower"] = new Lower();
+            Functions["upper"] = new Upper();
+            Functions["left"] = new Left();
+            Functions["right"] = new Right();
+            Functions["mid"] = new Mid();
+            Functions["replace"] = new Replace();
+            Functions["rept"] = new Rept();
+            Functions["substitute"] = new Substitute();
+            Functions["concatenate"] = new Concatenate();
+            Functions["char"] = new CharFunction();
+            Functions["exact"] = new Exact();
+            Functions["find"] = new Find();
+            Functions["fixed"] = new Fixed();
+            Functions["proper"] = new Proper();
+            Functions["text"] = new Text.Text();
+            Functions["t"] = new T();
+            Functions["hyperlink"] = new Hyperlink();
+            // Numbers
+            Functions["int"] = new CInt();
+            // Math
+            Functions["abs"] = new Abs();
+            Functions["asin"] = new Asin();
+            Functions["asinh"] = new Asinh();
+            Functions["cos"] = new Cos();
+            Functions["cosh"] = new Cosh();
+            Functions["power"] = new Power();
+            Functions["sign"] = new Sign();
+            Functions["sqrt"] = new Sqrt();
+            Functions["sqrtpi"] = new SqrtPi();
+            Functions["pi"] = new Pi();
+            Functions["product"] = new Product();
+            Functions["ceiling"] = new Ceiling();
+            Functions["count"] = new Count();
+            Functions["counta"] = new CountA();
+            Functions["countblank"] = new CountBlank();
+            Functions["countif"] = new CountIf();
+            Functions["countifs"] = new CountIfs();
+            Functions["fact"] = new Fact();
+            Functions["floor"] = new Floor();
+            Functions["sin"] = new Sin();
+            Functions["sinh"] = new Sinh();
+            Functions["sum"] = new Sum();
+            Functions["sumif"] = new SumIf();
+            Functions["sumifs"] = new SumIfs();
+            Functions["sumproduct"] = new SumProduct();
+            Functions["sumsq"] = new Sumsq();
+            Functions["stdev"] = new Stdev();
+            Functions["stdevp"] = new StdevP();
+            Functions["stdev.s"] = new Stdev();
+            Functions["stdev.p"] = new StdevP();
+            Functions["subtotal"] = new Subtotal();
+            Functions["exp"] = new Exp();
+            Functions["log"] = new Log();
+            Functions["log10"] = new Log10();
+            Functions["ln"] = new Ln();
+            Functions["max"] = new Max();
+            Functions["maxa"] = new Maxa();
+            Functions["median"] = new Median();
+            Functions["min"] = new Min();
+            Functions["mina"] = new Mina();
+            Functions["mod"] = new Mod();
+            Functions["average"] = new Average();
+            Functions["averagea"] = new AverageA();
+            Functions["averageif"] = new AverageIf();
+            Functions["averageifs"] = new AverageIfs();
+            Functions["round"] = new Round();
+            Functions["rounddown"] = new Rounddown();
+            Functions["roundup"] = new Roundup();
+            Functions["rand"] = new Rand();
+            Functions["randbetween"] = new RandBetween();
+            Functions["quotient"] = new Quotient();
+            Functions["trunc"] = new Trunc();
+            Functions["tan"] = new Tan();
+            Functions["tanh"] = new Tanh();
+            Functions["atan"] = new Atan();
+            Functions["atan2"] = new Atan2();
+            Functions["atanh"] = new Atanh();
+            Functions["acos"] = new Acos();
+            Functions["acosh"] = new Acosh();
+            Functions["var"] = new Var();
+            Functions["varp"] = new VarP();
+            Functions["large"] = new Large();
+            Functions["small"] = new Small();
+            Functions["degrees"] = new Degrees();
+            // Information
+            Functions["isblank"] = new IsBlank();
+            Functions["isnumber"] = new IsNumber();
+            Functions["istext"] = new IsText();
+            Functions["isnontext"] = new IsNonText();
+            Functions["iserror"] = new IsError();
+            Functions["iserr"] = new IsErr();
+            Functions["error.type"] = new ErrorType();
+            Functions["iseven"] = new IsEven();
+            Functions["isodd"] = new IsOdd();
+            Functions["islogical"] = new IsLogical();
+            Functions["isna"] = new IsNa();
+            Functions["na"] = new Na();
+            Functions["n"] = new N();
+            // Logical
+            Functions["if"] = new If();
+            Functions["iferror"] = new IfError();
+            Functions["ifna"] = new IfNa();
+            Functions["not"] = new Not();
+            Functions["and"] = new And();
+            Functions["or"] = new Or();
+            Functions["true"] = new True();
+            Functions["false"] = new False();
+            // Reference and lookup
+            Functions["address"] = new Address();
+            Functions["hlookup"] = new HLookup();
+            Functions["vlookup"] = new VLookup();
+            Functions["lookup"] = new Lookup();
+            Functions["match"] = new Match();
+            Functions["row"] = new Row(){SkipArgumentEvaluation = true};
+            Functions["rows"] = new Rows(){SkipArgumentEvaluation = true};
+            Functions["column"] = new Column(){SkipArgumentEvaluation = true};
+            Functions["columns"] = new Columns(){SkipArgumentEvaluation = true};
+            Functions["choose"] = new Choose();
+            Functions["index"] = new Index();
+            Functions["indirect"] = new Indirect();
+            Functions["offset"] = new Offset(){SkipArgumentEvaluation = true};
+            // Date
+            Functions["date"] = new Date();
+            Functions["today"] = new Today();
+            Functions["now"] = new Now();
+            Functions["day"] = new Day();
+            Functions["month"] = new Month();
+            Functions["year"] = new Year();
+            Functions["time"] = new Time();
+            Functions["hour"] = new Hour();
+            Functions["minute"] = new Minute();
+            Functions["second"] = new Second();
+            Functions["weeknum"] = new Weeknum();
+            Functions["weekday"] = new Weekday();
+            Functions["days360"] = new Days360();
+            Functions["yearfrac"] = new Yearfrac();
+            Functions["edate"] = new Edate();
+            Functions["eomonth"] = new Eomonth();
+            Functions["isoweeknum"] = new IsoWeekNum();
+            Functions["workday"] = new Workday();
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/CellStateHelper.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/CellStateHelper.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/CellStateHelper.cs	(revision 12707)
@@ -0,0 +1,52 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Linq;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions
+{
+    internal static class CellStateHelper
+    {
+        private static bool IsSubTotal(ExcelDataProvider.ICellInfo c)
+        {
+            var tokens = c.Tokens;
+            if (tokens == null) return false;
+            return c.Tokens.Any(token => 
+                token.TokenType == LexicalAnalysis.TokenType.Function 
+                && token.Value.Equals("SUBTOTAL", StringComparison.InvariantCultureIgnoreCase)
+                );
+        }
+
+        internal static bool ShouldIgnore(bool ignoreHiddenValues, ExcelDataProvider.ICellInfo c, ParsingContext context)
+        {
+            return (ignoreHiddenValues && c.IsHiddenRow) || (context.Scopes.Current.IsSubtotal && IsSubTotal(c));
+        }
+
+        internal static bool ShouldIgnore(bool ignoreHiddenValues, FunctionArgument arg, ParsingContext context)
+        {
+            return (ignoreHiddenValues && arg.ExcelStateFlagIsSet(ExcelCellState.HiddenCell));
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/CollectionFlattener.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/CollectionFlattener.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/CollectionFlattener.cs	(revision 12707)
@@ -0,0 +1,56 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions
+{
+    public abstract class CollectionFlattener<T>
+    {
+        public virtual IEnumerable<T> FuncArgsToFlatEnumerable(IEnumerable<FunctionArgument> arguments, Action<FunctionArgument, IList<T>> convertFunc)
+        {
+            var argList = new List<T>();
+            FuncArgsToFlatEnumerable(arguments, argList, convertFunc);
+            return argList;
+        }
+
+        private void FuncArgsToFlatEnumerable(IEnumerable<FunctionArgument> arguments, List<T> argList, Action<FunctionArgument, IList<T>> convertFunc)
+        {
+            foreach (var arg in arguments)
+            {
+                if (arg.Value is IEnumerable<FunctionArgument>)
+                {
+                    FuncArgsToFlatEnumerable((IEnumerable<FunctionArgument>)arg.Value, argList, convertFunc);
+                }
+                else
+                {
+                    convertFunc(arg, argList);
+                }
+            }
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/CompileResultValidator.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/CompileResultValidator.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/CompileResultValidator.cs	(revision 12707)
@@ -0,0 +1,46 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-26
+ *******************************************************************************/
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions
+{
+    public abstract class CompileResultValidator
+    {
+        public abstract void Validate(object obj);
+
+        private static CompileResultValidator _empty;
+        public static CompileResultValidator Empty
+        {
+            get { return _empty ?? (_empty = new EmptyCompileResultValidator()); }
+        }
+    }
+
+    internal class EmptyCompileResultValidator : CompileResultValidator
+    {
+        public override void Validate(object obj)
+        {
+            // empty validator - do nothing
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/CompileResultValidators.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/CompileResultValidators.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/CompileResultValidators.cs	(revision 12707)
@@ -0,0 +1,55 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-26
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions
+{
+    public class CompileResultValidators
+    {
+        private readonly Dictionary<DataType, CompileResultValidator> _validators = new Dictionary<DataType, CompileResultValidator>(); 
+
+        private CompileResultValidator CreateOrGet(DataType dataType)
+        {
+            if (_validators.ContainsKey(dataType))
+            {
+                return _validators[dataType];
+            }
+            if (dataType == DataType.Decimal)
+            {
+                return _validators[DataType.Decimal] = new DecimalCompileResultValidator();
+            }
+            return CompileResultValidator.Empty;
+        }
+
+        public CompileResultValidator GetValidator(DataType dataType)
+        {
+            return CreateOrGet(dataType);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DateTime/Date.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DateTime/Date.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DateTime/Date.cs	(revision 12707)
@@ -0,0 +1,48 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime
+{
+    public class Date : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 3);
+            var year = ArgToInt(arguments, 0);
+            var month = ArgToInt(arguments, 1);
+            var day = ArgToInt(arguments, 2);
+            var date = new System.DateTime(year, 1, 1);
+            month -= 1;
+            date = date.AddMonths(month);
+            date = date.AddDays((double)(day - 1));
+            return CreateResult(date.ToOADate(), DataType.Date);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DateTime/DateParsingFunction.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DateTime/DateParsingFunction.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DateTime/DateParsingFunction.cs	(revision 12707)
@@ -0,0 +1,26 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime
+{
+    public abstract class DateParsingFunction : ExcelFunction
+    {
+        protected System.DateTime ParseDate(IEnumerable<FunctionArgument> arguments, object dateObj)
+        {
+            System.DateTime date = System.DateTime.MinValue;
+            if (dateObj is string)
+            {
+                date = System.DateTime.Parse(dateObj.ToString(), CultureInfo.InvariantCulture);
+            }
+            else
+            {
+                var d = ArgToDecimal(arguments, 0);
+                date = System.DateTime.FromOADate(d);
+            }
+            return date;
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DateTime/DateStringParser.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DateTime/DateStringParser.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DateTime/DateStringParser.cs	(revision 12707)
@@ -0,0 +1,35 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime
+{
+    public class DateStringParser
+    {
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DateTime/Day.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DateTime/Day.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DateTime/Day.cs	(revision 12707)
@@ -0,0 +1,44 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime
+{
+    public class Day : DateParsingFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1);
+            var dateObj = GetFirstValue(arguments);
+            var date = ParseDate(arguments, dateObj);
+
+            return CreateResult(date.Day, DataType.Integer);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DateTime/Days360.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DateTime/Days360.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DateTime/Days360.cs	(revision 12707)
@@ -0,0 +1,81 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime
+{
+    public class Days360 : ExcelFunction
+    {
+        private enum Days360Calctype
+        {
+            European,
+            Us
+        }
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 2);
+            var numDate1 = ArgToDecimal(arguments, 0);
+            var numDate2 = ArgToDecimal(arguments, 1);
+            var dt1 = System.DateTime.FromOADate(numDate1);
+            var dt2 = System.DateTime.FromOADate(numDate2);
+
+            var calcType = Days360Calctype.Us;
+            if (arguments.Count() > 2)
+            {
+                var european = ArgToBool(arguments, 2);
+                if(european) calcType = Days360Calctype.European;
+            }
+
+            var startYear = dt1.Year;
+            var startMonth = dt1.Month;
+            var startDay = dt1.Day;
+            var endYear = dt2.Year;
+            var endMonth = dt2.Month;
+            var endDay = dt2.Day;
+
+            if (calcType == Days360Calctype.European)
+            {
+                if (startDay == 31) startDay = 30;
+                if (endDay == 31) endDay = 30;
+            }
+            else
+            {
+                var calendar = new GregorianCalendar();
+                var nDaysInFeb = calendar.IsLeapYear(dt1.Year) ? 29 : 28;
+               
+                 // If the investment is EOM and (Date1 is the last day of February) and (Date2 is the last day of February), then change D2 to 30.
+                if (startMonth == 2 && startDay == nDaysInFeb && endMonth == 2 && endDay == nDaysInFeb)
+                {
+                    endDay = 30;
+                }
+                 // If the investment is EOM and (Date1 is the last day of February), then change D1 to 30.
+                if (startMonth == 2 && startDay == nDaysInFeb)
+                {
+                    startDay = 30;
+                }
+                 // If D2 is 31 and D1 is 30 or 31, then change D2 to 30.
+                if (endDay == 31 && (startDay == 30 || startDay == 31))
+                {
+                    endDay = 30;
+                }
+                 // If D1 is 31, then change D1 to 30.
+                if (startDay == 31)
+                {
+                    startDay = 30;
+                }
+            }
+            var result = (endYear*12*30 + endMonth*30 + endDay) - (startYear*12*30 + startMonth*30 + startDay);
+            return CreateResult(result, DataType.Integer);
+        }
+
+        private int GetNumWholeMonths(System.DateTime dt1, System.DateTime dt2)
+        {
+            var startDate = new System.DateTime(dt1.Year, dt1.Month, 1).AddMonths(1);
+            var endDate = new System.DateTime(dt2.Year, dt2.Month, 1);
+            return ((endDate.Year - startDate.Year)*12) + (endDate.Month - startDate.Month);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DateTime/Edate.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DateTime/Edate.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DateTime/Edate.cs	(revision 12707)
@@ -0,0 +1,21 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime
+{
+    public class Edate : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 2, eErrorType.Value);
+            var dateSerial = ArgToDecimal(arguments, 0);
+            var date = System.DateTime.FromOADate(dateSerial);
+            var nMonthsToAdd = ArgToInt(arguments, 1);
+            var resultDate = date.AddMonths(nMonthsToAdd);
+            return CreateResult(resultDate.ToOADate(), DataType.Date);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DateTime/Eomonth.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DateTime/Eomonth.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DateTime/Eomonth.cs	(revision 12707)
@@ -0,0 +1,20 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime
+{
+    public class Eomonth : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 2);
+            var date = System.DateTime.FromOADate(ArgToDecimal(arguments, 0));
+            var monthsToAdd = ArgToInt(arguments, 1);
+            var resultDate = new System.DateTime(date.Year, date.Month, 1).AddMonths(monthsToAdd + 1).AddDays(-1);
+            return CreateResult(resultDate.ToOADate(), DataType.Date);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DateTime/Hour.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DateTime/Hour.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DateTime/Hour.cs	(revision 12707)
@@ -0,0 +1,46 @@
+﻿
+/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+using System.Globalization;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime
+{
+    public class Hour : DateParsingFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1);
+            var dateObj = arguments.ElementAt(0).Value;
+            var date = ParseDate(arguments, dateObj);
+            return CreateResult(date.Hour, DataType.Integer);
+        }
+
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DateTime/IsoWeekNum.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DateTime/IsoWeekNum.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DateTime/IsoWeekNum.cs	(revision 12707)
@@ -0,0 +1,50 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime
+{
+    public class IsoWeekNum : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1);
+            var dateInt = ArgToInt(arguments, 0);
+            var date = System.DateTime.FromOADate(dateInt);
+            return CreateResult(WeekNumber(date), DataType.Integer);
+        }
+
+        /// <summary>
+        /// This implementation was found on http://stackoverflow.com/questions/1285191/get-week-of-date-from-linq-query
+        /// </summary>
+        /// <param name="fromDate"></param>
+        /// <returns></returns>
+        private int WeekNumber(System.DateTime fromDate)
+        {
+            // Get jan 1st of the year
+            var startOfYear = fromDate.AddDays(-fromDate.Day + 1).AddMonths(-fromDate.Month + 1);
+            // Get dec 31st of the year
+            var endOfYear = startOfYear.AddYears(1).AddDays(-1);
+            // ISO 8601 weeks start with Monday
+            // The first week of a year includes the first Thursday
+            // DayOfWeek returns 0 for sunday up to 6 for saterday
+            int[] iso8601Correction = { 6, 7, 8, 9, 10, 4, 5 };
+            int nds = fromDate.Subtract(startOfYear).Days + iso8601Correction[(int)startOfYear.DayOfWeek];
+            int wk = nds / 7;
+            switch (wk)
+            {
+                case 0:
+                    // Return weeknumber of dec 31st of the previous year
+                    return WeekNumber(startOfYear.AddDays(-1));
+                case 53:
+                    // If dec 31st falls before thursday it is week 01 of next year
+                    if (endOfYear.DayOfWeek < DayOfWeek.Thursday)
+                        return 1;
+                    return wk;
+                default: return wk;
+            }
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DateTime/Minute.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DateTime/Minute.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DateTime/Minute.cs	(revision 12707)
@@ -0,0 +1,52 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime
+{
+    public class Minute : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1);
+            var dateObj = arguments.ElementAt(0).Value;
+            System.DateTime date = System.DateTime.MinValue;
+            if (dateObj is string)
+            {
+                date = System.DateTime.Parse(dateObj.ToString());
+            }
+            else
+            {
+                var d = ArgToDecimal(arguments, 0);
+                date = System.DateTime.FromOADate(d);
+            }
+            return CreateResult(date.Minute, DataType.Integer);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DateTime/Month.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DateTime/Month.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DateTime/Month.cs	(revision 12707)
@@ -0,0 +1,43 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime
+{
+    public class Month : DateParsingFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1);
+            var dateObj = arguments.ElementAt(0).Value;
+            var date = ParseDate(arguments, dateObj);
+            return CreateResult(date.Month, DataType.Integer);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DateTime/Now.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DateTime/Now.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DateTime/Now.cs	(revision 12707)
@@ -0,0 +1,40 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime
+{
+    public class Now : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            return CreateResult(System.DateTime.Now.ToOADate(), DataType.Date);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DateTime/Second.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DateTime/Second.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DateTime/Second.cs	(revision 12707)
@@ -0,0 +1,43 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime
+{
+    public class Second : DateParsingFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1);
+            var dateObj = arguments.ElementAt(0).Value;
+            System.DateTime date = ParseDate(arguments, dateObj);
+            return CreateResult(date.Second, DataType.Integer);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DateTime/Time.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DateTime/Time.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DateTime/Time.cs	(revision 12707)
@@ -0,0 +1,64 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime
+{
+    public class Time : TimeBaseFunction
+    {
+        public Time()
+            : base()
+        {
+
+        }
+
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1);
+            var firstArg = arguments.ElementAt(0).Value.ToString();
+            if(arguments.Count() == 1 && TimeStringParser.CanParse(firstArg))
+            {
+                var result = TimeStringParser.Parse(firstArg);
+                return new CompileResult(result, DataType.Time);
+            }
+            ValidateArguments(arguments, 3);
+            var hour = ArgToInt(arguments, 0);
+            var min = ArgToInt(arguments, 1);
+            var sec = ArgToInt(arguments, 2);
+
+            ThrowArgumentExceptionIf(() => sec < 0 || sec > 59, "Invalid second: " + sec);
+            ThrowArgumentExceptionIf(() => min < 0 || min > 59, "Invalid minute: " + min);
+            ThrowArgumentExceptionIf(() => min < 0 || hour > 23, "Invalid hour: " + hour);
+
+
+            var secondsOfThisTime = (double)(hour * 60 * 60 + min * 60 + sec);
+            return CreateResult(GetTimeSerialNumber(secondsOfThisTime), DataType.Time);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DateTime/TimeBaseFunction.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DateTime/TimeBaseFunction.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DateTime/TimeBaseFunction.cs	(revision 12707)
@@ -0,0 +1,91 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime
+{
+    public abstract class TimeBaseFunction : ExcelFunction
+    {
+        public TimeBaseFunction()
+        {
+            TimeStringParser = new TimeStringParser();
+        }
+
+        protected TimeStringParser TimeStringParser
+        {
+            get;
+            private set;
+        }
+
+        protected double SerialNumber
+        {
+            get;
+            private set;
+        }
+
+        public void ValidateAndInitSerialNumber(IEnumerable<FunctionArgument> arguments)
+        {
+            ValidateArguments(arguments, 1);
+            SerialNumber = (double)ArgToDecimal(arguments, 0);
+        }
+
+        protected double SecondsInADay
+        {
+            get{ return 24 * 60 * 60; }
+        }
+
+        protected double GetTimeSerialNumber(double seconds)
+        {
+            return seconds / SecondsInADay;
+        }
+
+        protected double GetSeconds(double serialNumber)
+        {
+            return serialNumber * SecondsInADay;
+        }
+
+        protected double GetHour(double serialNumber)
+        {
+            var seconds = GetSeconds(serialNumber);
+            return (int)seconds / (60 * 60);
+        }
+
+        protected double GetMinute(double serialNumber)
+        {
+            var seconds = GetSeconds(serialNumber);
+            seconds -= GetHour(serialNumber) * 60 * 60;
+            return (seconds - (seconds % 60)) / 60;
+        }
+
+        protected double GetSecond(double serialNumber)
+        {
+            return GetSeconds(serialNumber) % 60;
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DateTime/TimeStringParser.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DateTime/TimeStringParser.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DateTime/TimeStringParser.cs	(revision 12707)
@@ -0,0 +1,128 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime
+{
+    public class TimeStringParser
+    {
+        private const string RegEx24 = @"^[0-9]{1,2}(\:[0-9]{1,2}){0,2}$";
+        private const string RegEx12 = @"^[0-9]{1,2}(\:[0-9]{1,2}){0,2}( PM| AM)$";
+
+        private double GetSerialNumber(int hour, int minute, int second)
+        {
+            var secondsInADay = 24d * 60d * 60d;
+            return ((double)hour * 60 * 60 + (double)minute * 60 + (double)second) / secondsInADay;
+        }
+
+        private void ValidateValues(int hour, int minute, int second)
+        {
+            if (second < 0 || second > 59)
+            {
+                throw new FormatException("Illegal value for second: " + second);
+            }
+            if (minute < 0 || minute > 59)
+            {
+                throw new FormatException("Illegal value for minute: " + minute);
+            }
+        }
+
+        public virtual double Parse(string input)
+        {
+            return InternalParse(input);
+        }
+
+        public virtual bool CanParse(string input)
+        {
+            System.DateTime dt;
+            return Regex.IsMatch(input, RegEx24) || Regex.IsMatch(input, RegEx12) || System.DateTime.TryParse(input, out dt);
+        }
+
+        private double InternalParse(string input)
+        {
+            if (Regex.IsMatch(input, RegEx24))
+            {
+                return Parse24HourTimeString(input);
+            }
+            if (Regex.IsMatch(input, RegEx12))
+            {
+                return Parse12HourTimeString(input);
+            }
+            System.DateTime dateTime;
+            if (System.DateTime.TryParse(input, out dateTime))
+            {
+                return GetSerialNumber(dateTime.Hour, dateTime.Minute, dateTime.Second);
+            }
+            return -1;
+        }
+
+        private double Parse12HourTimeString(string input)
+        {
+            string dayPart = string.Empty;
+            dayPart = input.Substring(input.Length - 2, 2);
+            int hour;
+            int minute;
+            int second;
+            GetValuesFromString(input, out hour, out minute, out second);
+            if (dayPart == "PM") hour += 12;
+            ValidateValues(hour, minute, second);
+            return GetSerialNumber(hour, minute, second);
+        }
+
+        private double Parse24HourTimeString(string input)
+        {
+            int hour;
+            int minute;
+            int second;
+            GetValuesFromString(input, out hour, out minute, out second);
+            ValidateValues(hour, minute, second);
+            return GetSerialNumber(hour, minute, second);
+        }
+
+        private static void GetValuesFromString(string input, out int hour, out int minute, out int second)
+        {
+            hour = 0;
+            minute = 0;
+            second = 0;
+
+            var items = input.Split(':');
+            hour = int.Parse(items[0]);
+            if (items.Length > 1)
+            {
+                minute = int.Parse(items[1]);
+            }
+            if (items.Length > 2)
+            {
+                var val = items[2];
+                val = Regex.Replace(val, "[^0-9]+$", string.Empty);
+                second = int.Parse(val);
+            }
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DateTime/Today.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DateTime/Today.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DateTime/Today.cs	(revision 12707)
@@ -0,0 +1,40 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime
+{
+    public class Today : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            return CreateResult(System.DateTime.Today.ToOADate(), DataType.Date);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DateTime/Weekday.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DateTime/Weekday.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DateTime/Weekday.cs	(revision 12707)
@@ -0,0 +1,64 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.Exceptions;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime
+{
+    public class Weekday : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1);
+            var serialNumber = ArgToDecimal(arguments, 0);
+            var returnType = arguments.Count() > 1 ? ArgToInt(arguments, 1) : 1;
+            return CreateResult(CalculateDayOfWeek(System.DateTime.FromOADate(serialNumber), returnType), DataType.Integer);
+        }
+
+        private static List<int> _oneBasedStartOnSunday = new List<int> { 1, 2, 3, 4, 5, 6, 7 };
+        private static List<int> _oneBasedStartOnMonday = new List<int> { 7, 1, 2, 3, 4, 5, 6 };
+        private static List<int> _zeroBasedStartOnSunday = new List<int> { 6, 0, 1, 2, 3, 4, 5 };
+
+        private int CalculateDayOfWeek(System.DateTime dateTime, int returnType)
+        {
+            var dayIx = (int)dateTime.DayOfWeek;
+            switch (returnType)
+            {
+                case 1:
+                    return _oneBasedStartOnSunday[dayIx];
+                case 2:
+                    return _oneBasedStartOnMonday[dayIx];
+                case 3:
+                    return _zeroBasedStartOnSunday[dayIx];
+                default:
+                    throw new ExcelErrorValueException(eErrorType.Num);
+            }
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DateTime/Weeknum.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DateTime/Weeknum.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DateTime/Weeknum.cs	(revision 12707)
@@ -0,0 +1,63 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime
+{
+    public class Weeknum : ExcelFunction
+    {
+        public override ExpressionGraph.CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1, eErrorType.Value);
+            var dateSerial = ArgToDecimal(arguments, 0);
+            var date = System.DateTime.FromOADate(dateSerial);
+            var startDay = DayOfWeek.Sunday;
+            if (arguments.Count() > 1)
+            {
+                var argStartDay = ArgToInt(arguments, 1);
+                switch (argStartDay)
+                {
+                    case 1:
+                        startDay = DayOfWeek.Sunday;
+                        break;
+                    case 2:
+                    case 11:
+                        startDay = DayOfWeek.Monday;
+                        break;
+                    case 12:
+                        startDay = DayOfWeek.Tuesday;
+                        break;
+                    case 13:
+                        startDay = DayOfWeek.Wednesday;
+                        break;
+                    case 14:
+                        startDay = DayOfWeek.Thursday;
+                        break;
+                    case 15:
+                        startDay = DayOfWeek.Friday;
+                        break;
+                    case 16:
+                        startDay = DayOfWeek.Saturday;
+                        break;
+                    default:
+                        // Not supported 
+                        ThrowExcelErrorValueException(eErrorType.Num);
+                        break;
+                }
+            }
+            if (DateTimeFormatInfo.CurrentInfo == null)
+            {
+                throw new InvalidOperationException(
+                    "Could not execute Weeknum function because DateTimeFormatInfo.CurrentInfo was null");
+            }
+            var week = DateTimeFormatInfo.CurrentInfo.Calendar.GetWeekOfYear(date, CalendarWeekRule.FirstDay,
+                                                                             startDay);
+            return CreateResult(week, DataType.Integer);
+        }
+        
+        
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DateTime/Workday.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DateTime/Workday.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DateTime/Workday.cs	(revision 12707)
@@ -0,0 +1,88 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+using OfficeOpenXml.Utils;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime
+{
+    public class Workday : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 2);
+            var startDate = System.DateTime.FromOADate(ArgToInt(arguments, 0));
+            var nWorkDays = ArgToInt(arguments, 1);
+            var resultDate = System.DateTime.MinValue;
+            var workdaysCounted = 0;
+            var tmpDate = startDate;
+            // first move forward to the first monday
+            while (tmpDate.DayOfWeek != DayOfWeek.Monday && (nWorkDays - workdaysCounted) > 0)
+            {
+                if (!IsHoliday(tmpDate)) workdaysCounted++;
+                tmpDate = tmpDate.AddDays(1);
+            }
+            // then calculate whole weeks
+            var nWholeWeeks = (nWorkDays - workdaysCounted) / 5;
+            tmpDate = tmpDate.AddDays(nWholeWeeks * 7);
+            workdaysCounted += nWholeWeeks * 5;
+
+            // calculate the rest
+            while (workdaysCounted < nWorkDays)
+            {
+                tmpDate = tmpDate.AddDays(1);
+                if (!IsHoliday(tmpDate)) workdaysCounted++;
+            }
+            resultDate = AdjustResultWithHolidays(tmpDate, arguments);
+            return CreateResult(resultDate.ToOADate(), DataType.Date);
+        }
+
+        private System.DateTime AdjustResultWithHolidays(System.DateTime resultDate,
+                                                         IEnumerable<FunctionArgument> arguments)
+        {
+            if (arguments.Count() == 2) return resultDate;
+            var holidays = arguments.ElementAt(2).Value as IEnumerable<FunctionArgument>;
+            if (holidays != null)
+            {
+                foreach (var arg in holidays)
+                {
+                    if (ConvertUtil.IsNumeric(arg.Value))
+                    {
+                        var dateSerial = ConvertUtil.GetValueDouble(arg.Value);
+                        var holidayDate = System.DateTime.FromOADate(dateSerial);
+                        if (!IsHoliday(holidayDate))
+                        {
+                            resultDate = resultDate.AddDays(1);
+                        }
+                    }
+                }
+            }
+            else
+            {
+                var range = arguments.ElementAt(2).Value as ExcelDataProvider.IRangeInfo;
+                if (range != null)
+                {
+                    foreach (var cell in range)
+                    {
+                        if (ConvertUtil.IsNumeric(cell.Value))
+                        {
+                            var dateSerial = ConvertUtil.GetValueDouble(cell.Value);
+                            var holidayDate = System.DateTime.FromOADate(dateSerial);
+                            if (!IsHoliday(holidayDate))
+                            {
+                                resultDate = resultDate.AddDays(1);
+                            }
+                        }
+                    }
+                }
+            }
+            return resultDate;
+        }
+
+        private bool IsHoliday(System.DateTime date)
+        {
+            return date.DayOfWeek == DayOfWeek.Saturday || date.DayOfWeek == DayOfWeek.Sunday;
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DateTime/Year.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DateTime/Year.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DateTime/Year.cs	(revision 12707)
@@ -0,0 +1,53 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.Excel.Functions.Math;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime
+{
+    public class Year : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1);
+            var dateObj = arguments.ElementAt(0).Value;
+            System.DateTime date = System.DateTime.MinValue;
+            if (dateObj is string)
+            {
+                date = System.DateTime.Parse(dateObj.ToString());
+            }
+            else
+            {
+                var d = ArgToDecimal(arguments, 0);
+                date = System.DateTime.FromOADate(d);
+            }
+            return CreateResult(date.Year, DataType.Integer);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DateTime/Yearfrac.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DateTime/Yearfrac.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DateTime/Yearfrac.cs	(revision 12707)
@@ -0,0 +1,89 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.Exceptions;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime
+{
+    public class Yearfrac : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            var functionArguments = arguments as FunctionArgument[] ?? arguments.ToArray();
+            ValidateArguments(functionArguments, 2);
+            var date1Num = ArgToDecimal(functionArguments, 0);
+            var date2Num = ArgToDecimal(functionArguments, 1);
+            if (date1Num > date2Num) //Switch to make date1 the lowest date
+            {
+                var t = date1Num;
+                date1Num = date2Num;
+                date2Num = t;
+                var fa = functionArguments[1];
+                functionArguments[1] = functionArguments[0];
+                functionArguments[0] = fa;
+            }
+            var date1 = System.DateTime.FromOADate(date1Num);
+            var date2 = System.DateTime.FromOADate(date2Num);
+
+            var basis = 0;
+            if (functionArguments.Count() > 2)
+            {
+                basis = ArgToInt(functionArguments, 2);
+                ThrowExcelErrorValueExceptionIf(() => basis < 0 || basis > 4, eErrorType.Num);
+            }
+            var func = context.Configuration.FunctionRepository.GetFunction("days360");
+            var calendar = new GregorianCalendar();
+            switch (basis)
+            {
+                case 0:
+                    var d360Result = System.Math.Abs(func.Execute(functionArguments, context).ResultNumeric);
+                    // reproducing excels behaviour
+                    if (date1.Month == 2 && date2.Day==31)
+                    {
+                        var daysInFeb = calendar.IsLeapYear(date1.Year) ? 29 : 28;
+                        if (date1.Day == daysInFeb) d360Result++;  
+                    }
+                    return CreateResult(d360Result / 360d, DataType.Decimal);
+                case 1:
+                    return CreateResult(System.Math.Abs((date2 - date1).TotalDays / CalculateAcutalYear(date1, date2)), DataType.Decimal);
+                case 2:
+                    return CreateResult(System.Math.Abs((date2 - date1).TotalDays / 360d), DataType.Decimal);
+                case 3:
+                    return CreateResult(System.Math.Abs((date2 - date1).TotalDays / 365d), DataType.Decimal);
+                case 4:
+                    var args = functionArguments.ToList();
+                    args.Add(new FunctionArgument(true));
+                    double? result = System.Math.Abs(func.Execute(args, context).ResultNumeric / 360d);
+                    return CreateResult(result.Value, DataType.Decimal);
+                default:
+                    return null;
+            }
+        }
+
+        private double CalculateAcutalYear(System.DateTime dt1, System.DateTime dt2)
+        {
+            var calendar = new GregorianCalendar();
+            var perYear = 0d;
+            var nYears = dt2.Year - dt1.Year + 1;
+            for (var y = dt1.Year; y <= dt2.Year; ++y)
+            {
+                perYear += calendar.IsLeapYear(y) ? 366 : 365;
+            }
+            if (new System.DateTime(dt1.Year + 1, dt1.Month, dt1.Day) >= dt2)
+            {
+                nYears = 1;
+                perYear = 365;
+                if (calendar.IsLeapYear(dt1.Year) && dt1.Month <= 2)
+                    perYear = 366;
+                else if (calendar.IsLeapYear(dt2.Year) && dt2.Month > 2)
+                    perYear = 366;
+                else if (dt2.Month == 2 && dt2.Day == 29)
+                    perYear = 366;
+            }
+            return perYear/(double) nYears;  
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DecimalCompileResultValidator.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DecimalCompileResultValidator.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DecimalCompileResultValidator.cs	(revision 12707)
@@ -0,0 +1,45 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-26
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.Exceptions;
+using OfficeOpenXml.Utils;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions
+{
+    public class DecimalCompileResultValidator : CompileResultValidator
+    {
+        public override void Validate(object obj)
+        {
+            var num = ConvertUtil.GetValueDouble(obj);
+            if (double.IsNaN(num) || double.IsInfinity(num))
+            {
+                throw new ExcelErrorValueException(eErrorType.Num);
+            }
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DoubleArgumentParser.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DoubleArgumentParser.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DoubleArgumentParser.cs	(revision 12707)
@@ -0,0 +1,59 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Globalization;
+using OfficeOpenXml.FormulaParsing.Utilities;
+using OfficeOpenXml.FormulaParsing.Exceptions;
+using util=OfficeOpenXml.Utils;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions
+{
+    public class DoubleArgumentParser : ArgumentParser
+    {
+        public override object Parse(object obj)
+        {
+            Require.That(obj).Named("argument").IsNotNull();
+            if (obj is ExcelDataProvider.IRangeInfo)
+            {
+                var r=((ExcelDataProvider.IRangeInfo)obj).FirstOrDefault();
+                return r == null ? 0 : r.ValueDouble;
+            }
+            if (obj is double) return obj;
+            if (obj.IsNumeric()) return util.ConvertUtil.GetValueDouble(obj);
+            var str = obj != null ? obj.ToString() : string.Empty;
+            try
+            {
+                return double.Parse(str,CultureInfo.InvariantCulture);
+            }
+            catch// (Exception e)
+            {
+                throw new ExcelErrorValueException(ExcelErrorValue.Create(eErrorType.Value));
+            }
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DoubleEnumerableArgConverter.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DoubleEnumerableArgConverter.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DoubleEnumerableArgConverter.cs	(revision 12707)
@@ -0,0 +1,89 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.Exceptions;
+using OfficeOpenXml.Utils;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions
+{
+    public class DoubleEnumerableArgConverter : CollectionFlattener<double>
+    {
+        public virtual IEnumerable<double> ConvertArgs(bool ignoreHidden, bool ignoreErrors, IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            return base.FuncArgsToFlatEnumerable(arguments, (arg, argList) =>
+                {
+                    if (arg.IsExcelRange)
+                    {
+                        foreach (var cell in arg.ValueAsRangeInfo)
+                        {
+                            if(!ignoreErrors && cell.IsExcelError) throw new ExcelErrorValueException(ExcelErrorValue.Parse(cell.Value.ToString()));
+                            if (!CellStateHelper.ShouldIgnore(ignoreHidden, cell, context) && ConvertUtil.IsNumeric(cell.Value))
+                            {
+                                argList.Add(cell.ValueDouble);
+                            }       
+                        }
+                    }
+                    else
+                    {
+                        if(!ignoreErrors && arg.ValueIsExcelError) throw new ExcelErrorValueException(arg.ValueAsExcelErrorValue);
+                        if (ConvertUtil.IsNumeric(arg.Value) && !CellStateHelper.ShouldIgnore(ignoreHidden, arg, context))
+                        {
+                            argList.Add(ConvertUtil.GetValueDouble(arg.Value));
+                        }
+                    }
+                });
+        }
+
+        public virtual IEnumerable<double> ConvertArgsIncludingOtherTypes(IEnumerable<FunctionArgument> arguments)
+        {
+            return base.FuncArgsToFlatEnumerable(arguments, (arg, argList) =>
+            {
+                //var cellInfo = arg.Value as EpplusExcelDataProvider.CellInfo;
+                //var value = cellInfo != null ? cellInfo.Value : arg.Value;
+                if (arg.Value is ExcelDataProvider.IRangeInfo)
+                {
+                    foreach (var cell in (ExcelDataProvider.IRangeInfo)arg.Value)
+                    {
+                        argList.Add(cell.ValueDoubleLogical);
+                    }
+                }
+                else
+                {
+                    if (arg.Value is double || arg.Value is int || arg.Value is bool)
+                    {
+                        argList.Add(Convert.ToDouble(arg.Value));
+                    }
+                    else if (arg.Value is string)
+                    {
+                        argList.Add(0d);
+                    }
+                }
+            });
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/ErrorHandlingFunction.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/ErrorHandlingFunction.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/ErrorHandlingFunction.cs	(revision 12707)
@@ -0,0 +1,60 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+using OfficeOpenXml.FormulaParsing.Exceptions;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions
+{
+    /// <summary>
+    /// Base class for functions that handles an error that occurs during the
+    /// normal execution of the function.
+    /// If an exception occurs during the Execute-call that exception will be
+    /// caught by the compiler, then the HandleError-method will be called.
+    /// </summary>
+    public abstract class ErrorHandlingFunction : ExcelFunction
+    {
+        /// <summary>
+        /// Indicates that the function is an ErrorHandlingFunction.
+        /// </summary>
+        public override bool IsErrorHandlingFunction
+        {
+            get
+            {
+                return true;
+            }
+        }
+
+        /// <summary>
+        /// Method that should be implemented to handle the error.
+        /// </summary>
+        /// <param name="errorCode"></param>
+        /// <returns></returns>
+        public abstract CompileResult HandleError(string errorCode);
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/ExcelFunction.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/ExcelFunction.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/ExcelFunction.cs	(revision 12707)
@@ -0,0 +1,453 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+using System.Globalization;
+using OfficeOpenXml.FormulaParsing.Utilities;
+using OfficeOpenXml.FormulaParsing.Exceptions;
+using System.Collections;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions
+{
+    /// <summary>
+    /// Base class for Excel function implementations.
+    /// </summary>
+    public abstract class ExcelFunction
+    {
+        public ExcelFunction()
+            : this(new ArgumentCollectionUtil(), new ArgumentParsers(), new CompileResultValidators())
+        {
+
+        }
+
+        public ExcelFunction(
+            ArgumentCollectionUtil argumentCollectionUtil, 
+            ArgumentParsers argumentParsers,
+            CompileResultValidators compileResultValidators)
+        {
+            _argumentCollectionUtil = argumentCollectionUtil;
+            _argumentParsers = argumentParsers;
+            _compileResultValidators = compileResultValidators;
+        }
+
+        private readonly ArgumentCollectionUtil _argumentCollectionUtil;
+        private readonly ArgumentParsers _argumentParsers;
+        private readonly CompileResultValidators _compileResultValidators;
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="arguments">Arguments to the function, each argument can contain primitive types, lists or <see cref="ExcelDataProvider.IRangeInfo">Excel ranges</see></param>
+        /// <param name="context">The <see cref="ParsingContext"/> contains various data that can be useful in functions.</param>
+        /// <returns>A <see cref="CompileResult"/> containing the calculated value</returns>
+        public abstract CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context);
+
+        /// <summary>
+        /// If overridden, this method is called before Execute is called.
+        /// </summary>
+        /// <param name="context"></param>
+        public virtual void BeforeInvoke(ParsingContext context) { }
+
+        public virtual bool IsLookupFuction 
+        { 
+            get 
+            { 
+                return false; 
+            } 
+        }
+
+        public virtual bool IsErrorHandlingFunction
+        {
+            get
+            {
+                return false;
+            }
+        }
+        
+        /// <summary>
+        /// Used for some Lookupfunctions to indicate that function arguments should
+        /// not be compiled before the function is called.
+        /// </summary>
+        public bool SkipArgumentEvaluation { get; set; }
+        protected object GetFirstValue(IEnumerable<FunctionArgument> val)
+        {
+            var arg = ((IEnumerable<FunctionArgument>)val).FirstOrDefault();
+            if(arg.Value is ExcelDataProvider.IRangeInfo)
+            {
+                //var r=((ExcelDataProvider.IRangeInfo)arg);
+                var r = arg.ValueAsRangeInfo;
+                return r.GetValue(r.Address._fromRow, r.Address._fromCol);
+            }
+            else
+            {
+                return arg==null?null:arg.Value;
+            }
+        }
+        /// <summary>
+        /// This functions validates that the supplied <paramref name="arguments"/> contains at least
+        /// (the value of) <paramref name="minLength"/> elements. If one of the arguments is an
+        /// <see cref="ExcelDataProvider.IRangeInfo">Excel range</see> the number of cells in
+        /// that range will be counted as well.
+        /// </summary>
+        /// <param name="arguments"></param>
+        /// <param name="minLength"></param>
+        /// <param name="errorTypeToThrow">The <see cref="eErrorType"/> of the <see cref="ExcelErrorValueException"/> that will be thrown if <paramref name="minLength"/> is not met.</param>
+        protected void ValidateArguments(IEnumerable<FunctionArgument> arguments, int minLength,
+                                         eErrorType errorTypeToThrow)
+        {
+            Require.That(arguments).Named("arguments").IsNotNull();
+            ThrowExcelErrorValueExceptionIf(() =>
+                {
+                    var nArgs = 0;
+                    if (arguments.Any())
+                    {
+                        foreach (var arg in arguments)
+                        {
+                            nArgs++;
+                            if (nArgs >= minLength) return false;
+                            if (arg.IsExcelRange)
+                            {
+                                nArgs += arg.ValueAsRangeInfo.GetNCells();
+                                if (nArgs >= minLength) return false;
+                            }
+                        }
+                    }
+                    return true;
+                }, errorTypeToThrow);
+        }
+
+        /// <summary>
+        /// This functions validates that the supplied <paramref name="arguments"/> contains at least
+        /// (the value of) <paramref name="minLength"/> elements. If one of the arguments is an
+        /// <see cref="ExcelDataProvider.IRangeInfo">Excel range</see> the number of cells in
+        /// that range will be counted as well.
+        /// </summary>
+        /// <param name="arguments"></param>
+        /// <param name="minLength"></param>
+        /// <exception cref="ArgumentException"></exception>
+        protected void ValidateArguments(IEnumerable<FunctionArgument> arguments, int minLength)
+        {
+            Require.That(arguments).Named("arguments").IsNotNull();
+            ThrowArgumentExceptionIf(() =>
+                {
+                    var nArgs = 0;
+                    if (arguments.Any())
+                    {
+                        foreach (var arg in arguments)
+                        {
+                            nArgs++;
+                            if (nArgs >= minLength) return false;
+                            if (arg.IsExcelRange)
+                            {
+                                nArgs += arg.ValueAsRangeInfo.GetNCells();
+                                if (nArgs >= minLength) return false;
+                            }
+                        }
+                    }
+                    return true;
+                }, "Expecting at least {0} arguments", minLength.ToString());
+        }
+
+        /// <summary>
+        /// Returns the value of the argument att the position of the 0-based
+        /// <paramref name="index"/> as an integer.
+        /// </summary>
+        /// <param name="arguments"></param>
+        /// <param name="index"></param>
+        /// <returns>Value of the argument as an integer.</returns>
+        /// <exception cref="ExcelErrorValueException"></exception>
+        protected int ArgToInt(IEnumerable<FunctionArgument> arguments, int index)
+        {
+            var val = arguments.ElementAt(index).ValueFirst;
+            return (int)_argumentParsers.GetParser(DataType.Integer).Parse(val);
+        }
+
+        /// <summary>
+        /// Returns the value of the argument att the position of the 0-based
+        /// <paramref name="index"/> as a string.
+        /// </summary>
+        /// <param name="arguments"></param>
+        /// <param name="index"></param>
+        /// <returns>Value of the argument as a string.</returns>
+        protected string ArgToString(IEnumerable<FunctionArgument> arguments, int index)
+        {
+            var obj = arguments.ElementAt(index).ValueFirst;
+            return obj != null ? obj.ToString() : string.Empty;
+        }
+
+        /// <summary>
+        /// Returns the value of the argument att the position of the 0-based
+        /// </summary>
+        /// <param name="obj"></param>
+        /// <returns>Value of the argument as a double.</returns>
+        /// <exception cref="ExcelErrorValueException"></exception>
+        protected double ArgToDecimal(object obj)
+        {
+            return (double)_argumentParsers.GetParser(DataType.Decimal).Parse(obj);
+        }
+
+        /// <summary>
+        /// Returns the value of the argument att the position of the 0-based
+        /// <paramref name="index"/> as a <see cref="System.Double"/>.
+        /// </summary>
+        /// <param name="arguments"></param>
+        /// <param name="index"></param>
+        /// <returns>Value of the argument as an integer.</returns>
+        /// <exception cref="ExcelErrorValueException"></exception>
+        protected double ArgToDecimal(IEnumerable<FunctionArgument> arguments, int index)
+        {
+            return ArgToDecimal(arguments.ElementAt(index).Value);
+        }
+
+        protected double Divide(double left, double right)
+        {
+            if (System.Math.Abs(right - 0d) < double.Epsilon)
+            {
+                throw new ExcelErrorValueException(eErrorType.Div0);
+            }
+            return left/right;
+        }
+
+        protected bool IsNumericString(object value)
+        {
+            if (value == null || string.IsNullOrEmpty(value.ToString())) return false;
+            return Regex.IsMatch(value.ToString(), @"^[\d]+(\,[\d])?");
+        }
+
+        /// <summary>
+        /// If the argument is a boolean value its value will be returned.
+        /// If the argument is an integer value, true will be returned if its
+        /// value is not 0, otherwise false.
+        /// </summary>
+        /// <param name="arguments"></param>
+        /// <param name="index"></param>
+        /// <returns></returns>
+        protected bool ArgToBool(IEnumerable<FunctionArgument> arguments, int index)
+        {
+            var obj = arguments.ElementAt(index).Value ?? string.Empty;
+            return (bool)_argumentParsers.GetParser(DataType.Boolean).Parse(obj);
+        }
+
+        /// <summary>
+        /// Throws an <see cref="ArgumentException"/> if <paramref name="condition"/> evaluates to true.
+        /// </summary>
+        /// <param name="condition"></param>
+        /// <param name="message"></param>
+        /// <exception cref="ArgumentException"></exception>
+        protected void ThrowArgumentExceptionIf(Func<bool> condition, string message)
+        {
+            if (condition())
+            {
+                throw new ArgumentException(message);
+            }
+        }
+
+        /// <summary>
+        /// Throws an <see cref="ArgumentException"/> if <paramref name="condition"/> evaluates to true.
+        /// </summary>
+        /// <param name="condition"></param>
+        /// <param name="message"></param>
+        /// <param name="formats">Formats to the message string.</param>
+        protected void ThrowArgumentExceptionIf(Func<bool> condition, string message, params object[] formats)
+        {
+            message = string.Format(message, formats);
+            ThrowArgumentExceptionIf(condition, message);
+        }
+
+        /// <summary>
+        /// Throws an <see cref="ExcelErrorValueException"/> with the given <paramref name="errorType"/> set.
+        /// </summary>
+        /// <param name="errorType"></param>
+        protected void ThrowExcelErrorValueException(eErrorType errorType)
+        {
+            throw new ExcelErrorValueException("An excel function error occurred", ExcelErrorValue.Create(errorType));
+        }
+
+        /// <summary>
+        /// Throws an <see cref="ArgumentException"/> if <paramref name="condition"/> evaluates to true.
+        /// </summary>
+        /// <param name="condition"></param>
+        /// <param name="errorType"></param>
+        /// <exception cref="ExcelErrorValueException"></exception>
+        protected void ThrowExcelErrorValueExceptionIf(Func<bool> condition, eErrorType errorType)
+        {
+            if (condition())
+            {
+                throw new ExcelErrorValueException("An excel function error occurred", ExcelErrorValue.Create(errorType));
+            }
+        }
+
+        protected bool IsNumeric(object val)
+        {
+            if (val == null) return false;
+            return (val.GetType().IsPrimitive || val is double || val is decimal  || val is System.DateTime || val is TimeSpan);
+        }
+
+        //protected virtual bool IsNumber(object obj)
+        //{
+        //    if (obj == null) return false;
+        //    return (obj is int || obj is double || obj is short || obj is decimal || obj is long);
+        //}
+
+        /// <summary>
+        /// Helper method for comparison of two doubles.
+        /// </summary>
+        /// <param name="d1"></param>
+        /// <param name="d2"></param>
+        /// <returns></returns>
+        protected bool AreEqual(double d1, double d2)
+        {
+            return System.Math.Abs(d1 - d2) < double.Epsilon;
+        }
+
+        /// <summary>
+        /// Will return the arguments as an enumerable of doubles.
+        /// </summary>
+        /// <param name="arguments"></param>
+        /// <param name="context"></param>
+        /// <returns></returns>
+        protected virtual IEnumerable<double> ArgsToDoubleEnumerable(IEnumerable<FunctionArgument> arguments,
+                                                                     ParsingContext context)
+        {
+            return ArgsToDoubleEnumerable(false, arguments, context);
+        }
+
+        /// <summary>
+        /// Will return the arguments as an enumerable of doubles.
+        /// </summary>
+        /// <param name="ignoreHiddenCells">If a cell is hidden and this value is true the value of that cell will be ignored</param>
+        /// <param name="ignoreErrors">If a cell contains an error, that error will be ignored if this method is set to true</param>
+        /// <param name="arguments"></param>
+        /// <param name="context"></param>
+        /// <returns></returns>
+        protected virtual IEnumerable<double> ArgsToDoubleEnumerable(bool ignoreHiddenCells, bool ignoreErrors, IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            return _argumentCollectionUtil.ArgsToDoubleEnumerable(ignoreHiddenCells, ignoreErrors, arguments, context);
+        }
+
+        /// <summary>
+        /// Will return the arguments as an enumerable of doubles.
+        /// </summary>
+        /// <param name="ignoreHiddenCells">If a cell is hidden and this value is true the value of that cell will be ignored</param>
+        /// <param name="arguments"></param>
+        /// <param name="context"></param>
+        /// <returns></returns>
+        protected virtual IEnumerable<double> ArgsToDoubleEnumerable(bool ignoreHiddenCells, IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            return ArgsToDoubleEnumerable(ignoreHiddenCells, true, arguments, context);
+        }
+
+        /// <summary>
+        /// Will return the arguments as an enumerable of objects.
+        /// </summary>
+        /// <param name="ignoreHiddenCells">If a cell is hidden and this value is true the value of that cell will be ignored</param>
+        /// <param name="arguments"></param>
+        /// <param name="context"></param>
+        /// <returns></returns>
+        protected virtual IEnumerable<object> ArgsToObjectEnumerable(bool ignoreHiddenCells, IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            return _argumentCollectionUtil.ArgsToObjectEnumerable(ignoreHiddenCells, arguments, context);
+        }
+
+        /// <summary>
+        /// Use this method to create a result to return from Excel functions. 
+        /// </summary>
+        /// <param name="result"></param>
+        /// <param name="dataType"></param>
+        /// <returns></returns>
+        protected CompileResult CreateResult(object result, DataType dataType)
+        {
+            var validator = _compileResultValidators.GetValidator(dataType);
+            validator.Validate(result);
+            return new CompileResult(result, dataType);
+        }
+
+        /// <summary>
+        /// Use this method to apply a function on a collection of arguments. The <paramref name="result"/>
+        /// should be modifyed in the supplied <paramref name="action"/> and will contain the result
+        /// after this operation has been performed.
+        /// </summary>
+        /// <param name="collection"></param>
+        /// <param name="result"></param>
+        /// <param name="action"></param>
+        /// <returns></returns>
+        protected virtual double CalculateCollection(IEnumerable<FunctionArgument> collection, double result, Func<FunctionArgument,double,double> action)
+        {
+            return _argumentCollectionUtil.CalculateCollection(collection, result, action);
+        }
+
+        /// <summary>
+        /// if the supplied <paramref name="arg">argument</paramref> contains an Excel error
+        /// an <see cref="ExcelErrorValueException"/> with that errorcode will be thrown
+        /// </summary>
+        /// <param name="arg"></param>
+        /// <exception cref="ExcelErrorValueException"></exception>
+        protected void CheckForAndHandleExcelError(FunctionArgument arg)
+        {
+            if (arg.ValueIsExcelError)
+            {
+                throw (new ExcelErrorValueException(arg.ValueAsExcelErrorValue));
+            }
+        }
+
+        /// <summary>
+        /// If the supplied <paramref name="cell"/> contains an Excel error
+        /// an <see cref="ExcelErrorValueException"/> with that errorcode will be thrown
+        /// </summary>
+        /// <param name="cell"></param>
+        protected void CheckForAndHandleExcelError(ExcelDataProvider.ICellInfo cell)
+        {
+            if (cell.IsExcelError)
+            {
+                throw (new ExcelErrorValueException(ExcelErrorValue.Parse(cell.Value.ToString())));
+            }
+        }
+
+        protected CompileResult GetResultByObject(object result)
+        {
+            if (IsNumeric(result))
+            {
+                return CreateResult(result, DataType.Decimal);
+            }
+            if (result is string)
+            {
+                return CreateResult(result, DataType.String);
+            }
+            if (ExcelErrorValue.Values.IsErrorValue(result))
+            {
+                return CreateResult(result, DataType.ExcelAddress);
+            }
+            if (result == null)
+            {
+                return CompileResult.Empty;
+            }
+            return CreateResult(result, DataType.Enumerable);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/FunctionArgument.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/FunctionArgument.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/FunctionArgument.cs	(revision 12707)
@@ -0,0 +1,98 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions
+{
+    public class FunctionArgument
+    {
+        public FunctionArgument(object val)
+        {
+            Value = val;
+        }
+
+        private ExcelCellState _excelCellState;
+
+        public void SetExcelStateFlag(ExcelCellState state)
+        {
+            _excelCellState |= state;
+        }
+
+        public bool ExcelStateFlagIsSet(ExcelCellState state)
+        {
+            return (_excelCellState & state) != 0;
+        }
+
+        public object Value { get; private set; }
+
+        public Type Type
+        {
+            get { return Value != null ? Value.GetType() : null; }
+        }
+
+        public bool IsExcelRange
+        {
+            get { return Value != null && Value is EpplusExcelDataProvider.IRangeInfo; }
+        }
+
+        public bool ValueIsExcelError
+        {
+            get { return ExcelErrorValue.Values.IsErrorValue(Value); }
+        }
+
+        public ExcelErrorValue ValueAsExcelErrorValue
+        {
+            get { return ExcelErrorValue.Parse(Value.ToString()); }
+        }
+
+        public EpplusExcelDataProvider.IRangeInfo ValueAsRangeInfo
+        {
+            get { return Value as EpplusExcelDataProvider.IRangeInfo; }
+        }
+        public object ValueFirst
+        {
+            get
+            {
+                if (Value is ExcelDataProvider.INameInfo)
+                {
+                    Value = ((ExcelDataProvider.INameInfo)Value).Value;
+                }
+                var v = Value as ExcelDataProvider.IRangeInfo;
+                if (v==null)
+                {
+                    return Value;
+                }
+                else
+                {
+                    return v.GetValue(v.Address._fromRow, v.Address._fromCol);
+                }
+            }
+        }
+
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/FunctionNameProvider.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/FunctionNameProvider.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/FunctionNameProvider.cs	(revision 12707)
@@ -0,0 +1,50 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.Excel.Functions;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions
+{
+    public class FunctionNameProvider : IFunctionNameProvider
+    {
+        private FunctionNameProvider()
+        {
+
+        }
+
+        public static FunctionNameProvider Empty
+        {
+            get { return new FunctionNameProvider(); }
+        }
+
+        public virtual bool IsFunctionName(string name)
+        {
+            return false;
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/FunctionRepository.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/FunctionRepository.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/FunctionRepository.cs	(revision 12707)
@@ -0,0 +1,122 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.Excel.Functions;
+using OfficeOpenXml.FormulaParsing.Utilities;
+using OfficeOpenXml.FormulaParsing.Exceptions;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions
+{
+    /// <summary>
+    /// This class provides methods for accessing/modifying VBA Functions.
+    /// </summary>
+    public class FunctionRepository : IFunctionNameProvider
+    {
+        private Dictionary<string, ExcelFunction> _functions = new Dictionary<string, ExcelFunction>(StringComparer.InvariantCulture);
+
+        private FunctionRepository()
+        {
+
+        }
+
+        public static FunctionRepository Create()
+        {
+            var repo = new FunctionRepository();
+            repo.LoadModule(new BuiltInFunctions());
+            return repo;
+        }
+
+        /// <summary>
+        /// Loads a module of <see cref="ExcelFunction"/>s to the function repository.
+        /// </summary>
+        /// <param name="module">A <see cref="IFunctionModule"/> that can be used for adding functions</param>
+        public virtual void LoadModule(IFunctionModule module)
+        {
+            foreach (var key in module.Functions.Keys)
+            {
+                var lowerKey = key.ToLower(CultureInfo.InvariantCulture);
+                _functions[lowerKey] = module.Functions[key];
+            }
+        }
+
+        public virtual ExcelFunction GetFunction(string name)
+        {
+            if(!_functions.ContainsKey(name.ToLower(CultureInfo.InvariantCulture)))
+            {
+                //throw new InvalidOperationException("Non supported function: " + name);
+                //throw new ExcelErrorValueException("Non supported function: " + name, ExcelErrorValue.Create(eErrorType.Name));
+                return null;
+            }
+            return _functions[name.ToLower(CultureInfo.InvariantCulture)];
+        }
+
+        /// <summary>
+        /// Removes all functions from the repository
+        /// </summary>
+        public virtual void Clear()
+        {
+            _functions.Clear();
+        }
+
+        /// <summary>
+        /// Returns true if the the supplied <paramref name="name"/> exists in the repository.
+        /// </summary>
+        /// <param name="name"></param>
+        /// <returns></returns>
+        public bool IsFunctionName(string name)
+        {
+            return _functions.ContainsKey(name.ToLower(CultureInfo.InvariantCulture));
+        }
+
+        /// <summary>
+        /// Returns the names of all implemented functions.
+        /// </summary>
+        public IEnumerable<string> FunctionNames
+        {
+            get { return _functions.Keys; }
+        }
+
+        /// <summary>
+        /// Adds or replaces a function.
+        /// </summary>
+        /// <param name="functionName"> Case-insensitive name of the function that should be added or replaced.</param>
+        /// <param name="functionImpl">An implementation of an <see cref="ExcelFunction"/>.</param>
+        public void AddOrReplaceFunction(string functionName, ExcelFunction functionImpl)
+        {
+            Require.That(functionName).Named("functionName").IsNotNullOrEmpty();
+            Require.That(functionImpl).Named("functionImpl").IsNotNull();
+            var fName = functionName.ToLower(CultureInfo.InvariantCulture);
+            if (_functions.ContainsKey(fName))
+            {
+                _functions.Remove(fName);
+            }
+            _functions[fName] = functionImpl;
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/FunctionsModule.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/FunctionsModule.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/FunctionsModule.cs	(revision 12707)
@@ -0,0 +1,44 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions
+{
+    /// <summary>
+    /// Base class 
+    /// </summary>
+    public abstract class FunctionsModule : IFunctionModule
+    {
+        private readonly Dictionary<string, ExcelFunction> _functions = new Dictionary<string, ExcelFunction>();
+
+        public IDictionary<string, ExcelFunction> Functions
+        {
+            get { return _functions; }
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/HiddenValuesHandlingFunction.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/HiddenValuesHandlingFunction.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/HiddenValuesHandlingFunction.cs	(revision 12707)
@@ -0,0 +1,80 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.Exceptions;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions
+{
+    /// <summary>
+    /// Base class for functions that needs to handle cells that is not visible.
+    /// </summary>
+    public abstract class HiddenValuesHandlingFunction : ExcelFunction
+    {
+        /// <summary>
+        /// Set to true or false to indicate whether the function should ignore hidden values.
+        /// </summary>
+        public bool IgnoreHiddenValues
+        {
+            get;
+            set;
+        }
+
+        protected override IEnumerable<double> ArgsToDoubleEnumerable(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            return ArgsToDoubleEnumerable(arguments, context, true);
+        }
+
+        protected IEnumerable<double> ArgsToDoubleEnumerable(IEnumerable<FunctionArgument> arguments, ParsingContext context, bool ignoreErrors)
+        {
+            if (!arguments.Any())
+            {
+                return Enumerable.Empty<double>();
+            }
+            if (IgnoreHiddenValues)
+            {
+                var nonHidden = arguments.Where(x => !x.ExcelStateFlagIsSet(ExcelCellState.HiddenCell));
+                return base.ArgsToDoubleEnumerable(IgnoreHiddenValues, nonHidden, context);
+            }
+            return base.ArgsToDoubleEnumerable(IgnoreHiddenValues, ignoreErrors, arguments, context);
+        }
+
+        protected bool ShouldIgnore(ExcelDataProvider.ICellInfo c, ParsingContext context)
+        {
+            return CellStateHelper.ShouldIgnore(IgnoreHiddenValues, c, context);
+        }
+        protected bool ShouldIgnore(FunctionArgument arg)
+        {
+            if (IgnoreHiddenValues && arg.ExcelStateFlagIsSet(ExcelCellState.HiddenCell))
+            {
+                return true;
+            }
+            return false;
+        }
+
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/IFunctionModule.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/IFunctionModule.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/IFunctionModule.cs	(revision 12707)
@@ -0,0 +1,36 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions
+{
+    public interface IFunctionModule
+    {
+        IDictionary<string, ExcelFunction> Functions { get; }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/IFunctionNameProvider.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/IFunctionNameProvider.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/IFunctionNameProvider.cs	(revision 12707)
@@ -0,0 +1,36 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions
+{
+    public interface IFunctionNameProvider
+    {
+        bool IsFunctionName(string name);
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Information/ErrorType.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Information/ErrorType.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Information/ErrorType.cs	(revision 12707)
@@ -0,0 +1,67 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2015-01-15
+ *******************************************************************************/
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Information
+{
+    public class ErrorType : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1);
+            var error = arguments.ElementAt(0);
+            var isErrorFunc = context.Configuration.FunctionRepository.GetFunction("iserror");
+            var isErrorResult = isErrorFunc.Execute(arguments, context);
+            if (!(bool) isErrorResult.Result)
+            {
+                return CreateResult(ExcelErrorValue.Create(eErrorType.NA), DataType.ExcelError);
+            }
+            var errorType = error.ValueAsExcelErrorValue;
+            int retValue;
+            switch (errorType.Type)
+            {
+                case eErrorType.Null:
+                    return CreateResult(1, DataType.Integer);
+                case eErrorType.Div0:
+                    return CreateResult(2, DataType.Integer);
+                case eErrorType.Value:
+                    return CreateResult(3, DataType.Integer);
+                case eErrorType.Ref:
+                    return CreateResult(4, DataType.Integer);
+                case eErrorType.Name:
+                    return CreateResult(5, DataType.Integer);
+                case eErrorType.Num:
+                    return CreateResult(6, DataType.Integer);
+                case eErrorType.NA:
+                    return CreateResult(7, DataType.Integer);
+            }
+            return CreateResult(ExcelErrorValue.Create(eErrorType.NA), DataType.ExcelError);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Information/IsBlank.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Information/IsBlank.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Information/IsBlank.cs	(revision 12707)
@@ -0,0 +1,64 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Information
+{
+    public class IsBlank : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            if (arguments == null || arguments.Count() == 0)
+            {
+                return CreateResult(true, DataType.Boolean);
+            }
+            var result = true;
+            foreach (var arg in arguments)
+            {
+                if (arg.Value is ExcelDataProvider.IRangeInfo)
+                {                    
+                    var r=(ExcelDataProvider.IRangeInfo)arg.Value;
+                    if (r.GetValue(r.Address._fromRow, r.Address._fromCol) != null)
+                    {
+                        result = false;
+                    }
+                }
+                else
+                {
+                    if (arg.Value != null && (arg.Value.ToString() != string.Empty))
+                    {
+                        result = false;
+                        break;
+                    }
+                }
+            }
+            return CreateResult(result, DataType.Boolean);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Information/IsErr.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Information/IsErr.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Information/IsErr.cs	(revision 12707)
@@ -0,0 +1,43 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Information
+{
+    public class IsErr : ErrorHandlingFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            var isError = new IsError();
+            var result = isError.Execute(arguments, context);
+            if ((bool) result.Result)
+            {
+                var arg = GetFirstValue(arguments);
+                if (arg is ExcelDataProvider.IRangeInfo)
+                {
+                    var r = (ExcelDataProvider.IRangeInfo)arg;
+                    var e=r.GetValue(r.Address._fromRow, r.Address._fromCol) as ExcelErrorValue;
+                    if (e !=null && e.Type==eErrorType.NA)
+                    {
+                        return CreateResult(false, DataType.Boolean);
+                    }
+                }
+                else
+                {
+                    if (arg is ExcelErrorValue && ((ExcelErrorValue)arg).Type==eErrorType.NA)
+                    {
+                        return CreateResult(false, DataType.Boolean);
+                    }
+                }
+            }
+            return result;
+        }
+
+        public override CompileResult HandleError(string errorCode)
+        {
+            return CreateResult(true, DataType.Boolean);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Information/IsError.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Information/IsError.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Information/IsError.cs	(revision 12707)
@@ -0,0 +1,68 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+using OfficeOpenXml.FormulaParsing.Exceptions;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Information
+{
+    public class IsError : ErrorHandlingFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            if (arguments == null || arguments.Count() == 0)
+            {
+                return CreateResult(false, DataType.Boolean);
+            }
+            foreach (var argument in arguments)
+            {
+                if (argument.Value is ExcelDataProvider.IRangeInfo)
+                {
+                    var r = (ExcelDataProvider.IRangeInfo)argument.Value;
+                    if (ExcelErrorValue.Values.IsErrorValue(r.GetValue(r.Address._fromRow, r.Address._fromCol)))
+                    {
+                        return CreateResult(true, DataType.Boolean);
+                    }
+                }
+                else
+                {
+                    if (ExcelErrorValue.Values.IsErrorValue(argument.Value))
+                    {
+                        return CreateResult(true, DataType.Boolean);
+                    }
+                }                
+            }
+            return CreateResult(false, DataType.Boolean);
+        }
+
+        public override CompileResult HandleError(string errorCode)
+        {
+            return CreateResult(true, DataType.Boolean);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Information/IsEven.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Information/IsEven.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Information/IsEven.cs	(revision 12707)
@@ -0,0 +1,24 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+using OfficeOpenXml.Utils;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Information
+{
+    public class IsEven : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1);
+            var arg1 = GetFirstValue(arguments);//arguments.ElementAt(0);
+            if (!ConvertUtil.IsNumeric(arg1))
+            {
+                ThrowExcelErrorValueException(eErrorType.Value);
+            }
+            var number = (int)System.Math.Floor(ConvertUtil.GetValueDouble(arg1));
+            return CreateResult(number % 2 == 0, DataType.Boolean);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Information/IsLogical.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Information/IsLogical.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Information/IsLogical.cs	(revision 12707)
@@ -0,0 +1,19 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Information
+{
+    public class IsLogical : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            var functionArguments = arguments as FunctionArgument[] ?? arguments.ToArray();
+            ValidateArguments(functionArguments, 1);
+            var v = GetFirstValue(arguments);
+            return CreateResult(v is bool, DataType.Boolean);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Information/IsNa.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Information/IsNa.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Information/IsNa.cs	(revision 12707)
@@ -0,0 +1,51 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2015-01-15
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Information
+{
+    public class IsNa : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            if (arguments == null || arguments.Count() == 0)
+            {
+                return CreateResult(false, DataType.Boolean);
+            }
+
+            var v = GetFirstValue(arguments);
+
+            if (v is ExcelErrorValue && ((ExcelErrorValue)v).Type==eErrorType.NA)
+            {
+                return CreateResult(true, DataType.Boolean);
+            }
+            return CreateResult(false, DataType.Boolean);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Information/IsNonText.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Information/IsNonText.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Information/IsNonText.cs	(revision 12707)
@@ -0,0 +1,43 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2015-01-15
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Information
+{
+    public class IsNonText : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1);
+            var firstArg = arguments.ElementAt(0);
+            if (firstArg.Value == null || firstArg.ValueIsExcelError) return CreateResult(false, DataType.Boolean);
+            return CreateResult(!(firstArg.Value is string), DataType.Boolean);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Information/IsNumber.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Information/IsNumber.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Information/IsNumber.cs	(revision 12707)
@@ -0,0 +1,42 @@
+﻿using System;
+/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Information
+{
+    public class IsNumber : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1);
+            var arg = GetFirstValue(arguments);
+            return CreateResult(IsNumeric(arg), DataType.Boolean);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Information/IsOdd.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Information/IsOdd.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Information/IsOdd.cs	(revision 12707)
@@ -0,0 +1,48 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2015-01-15
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+using OfficeOpenXml.Utils;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Information
+{
+    public class IsOdd : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1);
+            var arg1 = GetFirstValue(arguments);//arguments.ElementAt(0);
+            if (!ConvertUtil.IsNumeric(arg1))
+            {
+                ThrowExcelErrorValueException(eErrorType.Value);
+            }
+            var number = (int)System.Math.Floor(ConvertUtil.GetValueDouble(arg1));
+            return CreateResult(number % 2 == 1, DataType.Boolean);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Information/IsText.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Information/IsText.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Information/IsText.cs	(revision 12707)
@@ -0,0 +1,45 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Information
+{
+    public class IsText : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1);
+            if (arguments.Count() == 1 && arguments.ElementAt(0).Value != null)
+            {
+                return CreateResult((GetFirstValue(arguments) is string), DataType.Boolean);
+            }
+            return CreateResult(false, DataType.Boolean);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Information/N.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Information/N.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Information/N.cs	(revision 12707)
@@ -0,0 +1,39 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.Exceptions;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+using OfficeOpenXml.Utils;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Information
+{
+    public class N : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1);
+            var arg = GetFirstValue(arguments);
+            
+            if (arg is bool)
+            {
+                var val = (bool) arg ? 1d : 0d;
+                return CreateResult(val, DataType.Decimal);
+            }
+            else if (IsNumeric(arg))
+            {
+                var val = ConvertUtil.GetValueDouble(arg);
+                return CreateResult(val, DataType.Decimal);
+            }
+            else if (arg is string)
+            {
+                return CreateResult(0d, DataType.Decimal);
+            }
+            else if (arg is ExcelErrorValue)
+            {
+                return CreateResult(arg, DataType.ExcelError);
+            }
+            throw new ExcelErrorValueException(eErrorType.Value);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Information/Na.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Information/Na.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Information/Na.cs	(revision 12707)
@@ -0,0 +1,16 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Information
+{
+    public class Na : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            return CreateResult(ExcelErrorValue.Create(eErrorType.NA), DataType.ExcelError);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/IntArgumentParser.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/IntArgumentParser.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/IntArgumentParser.cs	(revision 12707)
@@ -0,0 +1,61 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.Utilities;
+using OfficeOpenXml.FormulaParsing.Exceptions;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions
+{
+    public class IntArgumentParser : ArgumentParser
+    {
+        public override object Parse(object obj)
+        {
+            Require.That(obj).Named("argument").IsNotNull();
+            int result;
+            if (obj is ExcelDataProvider.IRangeInfo)
+            {
+                var r = ((ExcelDataProvider.IRangeInfo)obj).FirstOrDefault();
+                return r == null ? 0 : Convert.ToInt32(r.ValueDouble);
+            }
+            var objType = obj.GetType();
+            if (objType == typeof(int))
+            {
+                return (int)obj;
+            }
+            if (objType == typeof(double) || objType == typeof(decimal))
+            {
+                return Convert.ToInt32(obj);
+            }
+            if (!int.TryParse(obj.ToString(), out result))
+            {
+                throw new ExcelErrorValueException(ExcelErrorValue.Create(eErrorType.Value));
+            }
+            return result;
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Logical/And.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Logical/And.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Logical/And.cs	(revision 12707)
@@ -0,0 +1,48 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Logical
+{
+    public class And : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1);
+            for (var x = 0; x < arguments.Count(); x++)
+            {
+                if (!ArgToBool(arguments, x))
+                {
+                    return new CompileResult(false, DataType.Boolean);
+                }
+            }
+            return new CompileResult(true, DataType.Boolean);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Logical/False.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Logical/False.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Logical/False.cs	(revision 12707)
@@ -0,0 +1,40 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Logical
+{
+    public class False : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            return CreateResult(false, DataType.Boolean);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Logical/If.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Logical/If.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Logical/If.cs	(revision 12707)
@@ -0,0 +1,45 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Logical
+{
+    public class If : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 3);
+            var condition = ArgToBool(arguments, 0);
+            var firstStatement = arguments.ElementAt(1).Value;
+            var secondStatement = arguments.ElementAt(2).Value;
+            var factory = new CompileResultFactory();
+            return condition ? factory.Create(firstStatement) : factory.Create(secondStatement);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Logical/IfError.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Logical/IfError.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Logical/IfError.cs	(revision 12707)
@@ -0,0 +1,18 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Logical
+{
+    public class IfError : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1);
+            var firstArg = arguments.First();
+            return GetResultByObject(firstArg.Value);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Logical/IfNa.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Logical/IfNa.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Logical/IfNa.cs	(revision 12707)
@@ -0,0 +1,18 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Logical
+{
+    public class IfNa : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1);
+            var firstArg = arguments.First();
+            return GetResultByObject(firstArg.Value);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Logical/Not.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Logical/Not.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Logical/Not.cs	(revision 12707)
@@ -0,0 +1,42 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Logical
+{
+    public class Not : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1);
+            var result = !ArgToBool(arguments, 0);
+            return new CompileResult(result, DataType.Boolean);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Logical/Or.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Logical/Or.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Logical/Or.cs	(revision 12707)
@@ -0,0 +1,48 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Logical
+{
+    public class Or : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1);
+            for (var x = 0; x < arguments.Count(); x++)
+            {
+                if (ArgToBool(arguments, x))
+                {
+                    return new CompileResult(true, DataType.Boolean);
+                }
+            }
+            return new CompileResult(false, DataType.Boolean);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Logical/True.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Logical/True.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Logical/True.cs	(revision 12707)
@@ -0,0 +1,40 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Logical
+{
+    public class True : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            return CreateResult(true, DataType.Boolean);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Abs.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Abs.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Abs.cs	(revision 12707)
@@ -0,0 +1,46 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Math
+{
+    public class Abs : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1);
+            var val = ArgToDecimal(arguments, 0);
+            if (val < 0)
+            {
+                val *= -1;
+            }
+            return CreateResult(val, DataType.Decimal);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Acos.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Acos.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Acos.cs	(revision 12707)
@@ -0,0 +1,42 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2015-01-11
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Math
+{
+    public class Acos : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1);
+            var arg = ArgToDecimal(arguments, 0);
+            return CreateResult(MathHelper.Arccos(arg), DataType.Decimal);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Acosh.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Acosh.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Acosh.cs	(revision 12707)
@@ -0,0 +1,42 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2015-01-11
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Math
+{
+    public class Acosh : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1);
+            var arg = ArgToDecimal(arguments, 0);
+            return CreateResult(MathHelper.HArccos(arg), DataType.Decimal);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Asin.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Asin.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Asin.cs	(revision 12707)
@@ -0,0 +1,42 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2015-01-11
+ *******************************************************************************/
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Math
+{
+    public class Asin : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1);
+            var arg = ArgToDecimal(arguments, 0);
+            return CreateResult(System.Math.Asin(arg), DataType.Decimal);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Asinh.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Asinh.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Asinh.cs	(revision 12707)
@@ -0,0 +1,42 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2015-01-11
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Math
+{
+    public class Asinh : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1);
+            var arg = ArgToDecimal(arguments, 0);
+            return CreateResult(MathHelper.HArcsin(arg), DataType.Decimal);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Atan.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Atan.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Atan.cs	(revision 12707)
@@ -0,0 +1,42 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Math
+{
+    public class Atan : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1);
+            var arg = ArgToDecimal(arguments, 0);
+            return CreateResult(System.Math.Atan(arg), DataType.Decimal);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Atan2.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Atan2.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Atan2.cs	(revision 12707)
@@ -0,0 +1,44 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Math
+{
+    public class Atan2 : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 2);
+            var arg1 = ArgToDecimal(arguments, 0);
+            var arg2 = ArgToDecimal(arguments, 1);
+            // Had to switch order of the arguments to get the same result as in excel /MA
+            return CreateResult(System.Math.Atan2(arg2, arg1), DataType.Decimal);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Atanh.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Atanh.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Atanh.cs	(revision 12707)
@@ -0,0 +1,42 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2015-01-11
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Math
+{
+    public class Atanh : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1);
+            var arg = ArgToDecimal(arguments, 0);
+            return CreateResult(MathHelper.HArctan(arg), DataType.Decimal);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Average.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Average.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Average.cs	(revision 12707)
@@ -0,0 +1,108 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+using OfficeOpenXml.Utils;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Math
+{
+    public class Average : HiddenValuesHandlingFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1, eErrorType.Div0);
+            double nValues = 0d, result = 0d;
+            foreach (var arg in arguments)
+            {
+                Calculate(arg, context, ref result, ref nValues);
+            }
+            return CreateResult(Divide(result, nValues), DataType.Decimal);
+        }
+
+        private void Calculate(FunctionArgument arg, ParsingContext context, ref double retVal, ref double nValues, bool isInArray = false)
+        {
+            if (ShouldIgnore(arg))
+            {
+                return;
+            }
+            if (arg.Value is IEnumerable<FunctionArgument>)
+            {
+                foreach (var item in (IEnumerable<FunctionArgument>)arg.Value)
+                {
+                    Calculate(item, context, ref retVal, ref nValues, true);
+                }
+            }
+            else if (arg.IsExcelRange)
+            {
+                foreach (var c in arg.ValueAsRangeInfo)
+                {
+                    if (ShouldIgnore(c, context)) continue;
+                    CheckForAndHandleExcelError(c);
+                    if (!IsNumeric(c.Value)) continue;
+                    nValues++;
+                    retVal += c.ValueDouble;
+                }
+            }
+            else
+            {
+                var numericValue = GetNumericValue(arg.Value, isInArray);
+                if (numericValue.HasValue)
+                {
+                    nValues++;
+                    retVal += numericValue.Value;
+                }
+                else if ((arg.Value is string) && !ConvertUtil.IsNumericString(arg.Value))
+                {
+                    if (!isInArray)
+                    {
+                        ThrowExcelErrorValueException(eErrorType.Value);
+                    }
+                }
+            }
+            CheckForAndHandleExcelError(arg);
+        }
+
+        private double? GetNumericValue(object obj, bool isInArray)
+        {
+            if (IsNumeric(obj))
+            {
+                return ConvertUtil.GetValueDouble(obj);
+            }
+            else if ((obj is bool) && !isInArray)
+            {
+                return ConvertUtil.GetValueDouble(obj);
+            }
+            else if (ConvertUtil.IsNumericString(obj))
+            {
+                return double.Parse(obj.ToString(), CultureInfo.InvariantCulture);
+            }
+            return default(double?);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/AverageA.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/AverageA.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/AverageA.cs	(revision 12707)
@@ -0,0 +1,124 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2014-01-06
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+using OfficeOpenXml.Utils;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Math
+{
+    public class AverageA : HiddenValuesHandlingFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1, eErrorType.Div0);
+            double nValues = 0d, result = 0d;
+            foreach (var arg in arguments)
+            {
+                Calculate(arg, context, ref result, ref nValues);
+            }
+            return CreateResult(Divide(result, nValues), DataType.Decimal);
+        }
+
+        private void Calculate(FunctionArgument arg, ParsingContext context, ref double retVal, ref double nValues, bool isInArray = false)
+        {
+            if (ShouldIgnore(arg))
+            {
+                return;
+            }
+            if (arg.Value is IEnumerable<FunctionArgument>)
+            {
+                foreach (var item in (IEnumerable<FunctionArgument>)arg.Value)
+                {
+                    Calculate(item, context, ref retVal, ref nValues, true);
+                }
+            }
+            else if (arg.IsExcelRange)
+            {
+                foreach (var c in arg.ValueAsRangeInfo)
+                {
+                    if (ShouldIgnore(c, context)) continue;
+                    CheckForAndHandleExcelError(c);
+                    if (IsNumeric(c.Value))
+                    {
+                        nValues++;
+                        retVal += c.ValueDouble;
+                    }
+                    else if (c.Value is bool)
+                    {
+                        nValues++;
+                        retVal += (bool) c.Value ? 1 : 0;
+                    }
+                    else if (c.Value is string)
+                    {
+                        nValues++;
+                    }
+                }
+            }
+            else
+            {
+                var numericValue = GetNumericValue(arg.Value, isInArray);
+                if (numericValue.HasValue)
+                {
+                    nValues++;
+                    retVal += numericValue.Value;
+                }
+                else if((arg.Value is string) && !ConvertUtil.IsNumericString(arg.Value))
+                {
+                    if (isInArray)
+                    {
+                        nValues++;
+                    }
+                    else
+                    {
+                        ThrowExcelErrorValueException(eErrorType.Value);   
+                    }
+                }
+            }
+            CheckForAndHandleExcelError(arg);
+        }
+
+        private double? GetNumericValue(object obj, bool isInArray)
+        {
+            if (IsNumeric(obj))
+            {
+                return ConvertUtil.GetValueDouble(obj);
+            }
+            else if (obj is bool)
+            {
+                if (isInArray) return default(double?);
+                return ConvertUtil.GetValueDouble(obj);
+            }
+            else if (ConvertUtil.IsNumericString(obj))
+            {
+                return double.Parse(obj.ToString(), CultureInfo.InvariantCulture);
+            }
+            return default(double?);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/AverageIf.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/AverageIf.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/AverageIf.cs	(revision 12707)
@@ -0,0 +1,160 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExcelUtilities;
+using OfficeOpenXml.FormulaParsing.Exceptions;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+using OfficeOpenXml.FormulaParsing.Utilities;
+using OfficeOpenXml.Utils;
+using Require = OfficeOpenXml.FormulaParsing.Utilities.Require;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Math
+{
+    public class AverageIf : HiddenValuesHandlingFunction
+    {
+        private readonly NumericExpressionEvaluator _numericExpressionEvaluator;
+        private readonly WildCardValueMatcher _wildCardValueMatcher;
+
+        public AverageIf()
+            : this(new NumericExpressionEvaluator(), new WildCardValueMatcher())
+        {
+
+        }
+
+        public AverageIf(NumericExpressionEvaluator evaluator, WildCardValueMatcher wildCardValueMatcher)
+        {
+            Require.That(evaluator).Named("evaluator").IsNotNull();
+            Require.That(evaluator).Named("wildCardValueMatcher").IsNotNull();
+            _numericExpressionEvaluator = evaluator;
+            _wildCardValueMatcher = wildCardValueMatcher;
+        }
+
+        private bool Evaluate(object obj, string expression)
+        {
+            double? candidate = default(double?);
+            if (IsNumeric(obj))
+            {
+                candidate = ConvertUtil.GetValueDouble(obj);
+            }
+            if (candidate.HasValue)
+            {
+                return _numericExpressionEvaluator.Evaluate(candidate.Value, expression);
+            }
+            return _wildCardValueMatcher.IsMatch(expression, obj.ToString()) == 0;
+        }
+
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 2);
+            var firstArg = arguments.ElementAt(0);
+            var args = firstArg.Value as IEnumerable<FunctionArgument>;
+            if (args == null && firstArg.IsExcelRange)
+            {
+                args = new List<FunctionArgument>(){ firstArg };
+            }
+            var criteria = arguments.ElementAt(1).Value;
+            ThrowExcelErrorValueExceptionIf(() => criteria == null || criteria.ToString().Length > 255, eErrorType.Value);
+            var retVal = 0d;
+            if (arguments.Count() > 2)
+            {
+                var secondArg = arguments.ElementAt(2);
+                var lookupRange = secondArg.Value as IEnumerable<FunctionArgument>;
+                if (lookupRange == null && secondArg.IsExcelRange)
+                {
+                    lookupRange = new List<FunctionArgument>() {secondArg};
+                }
+                retVal = CalculateWithLookupRange(args, criteria.ToString(), lookupRange, context);
+            }
+            else
+            {
+                retVal = CalculateSingleRange(args, criteria.ToString(), context);
+            }
+            return CreateResult(retVal, DataType.Decimal);
+        }
+
+        private double CalculateWithLookupRange(IEnumerable<FunctionArgument> range, string criteria, IEnumerable<FunctionArgument> sumRange, ParsingContext context)
+        {
+            var retVal = 0d;
+            var nMatches = 0;
+            var flattenedRange = ArgsToObjectEnumerable(false, range, context);
+            var flattenedSumRange = ArgsToDoubleEnumerable(sumRange, context);
+            for (var x = 0; x < flattenedRange.Count(); x++)
+            {
+                var candidate = flattenedSumRange.ElementAt(x);
+                if (Evaluate(flattenedRange.ElementAt(x), criteria))
+                {
+                    nMatches++;
+                    retVal += candidate;
+                }
+            }
+            return Divide(retVal, nMatches);
+        }
+
+        private double CalculateSingleRange(IEnumerable<FunctionArgument> args, string expression, ParsingContext context)
+        {
+            var retVal = 0d;
+            var nMatches = 0;
+            var flattendedRange = ArgsToDoubleEnumerable(args, context);
+            var candidates = flattendedRange as double[] ?? flattendedRange.ToArray();
+            foreach (var candidate in candidates)
+            {
+                if (Evaluate(candidate, expression))
+                {
+                    retVal += candidate;
+                    nMatches++;
+                }
+            }
+            return Divide(retVal, nMatches);
+        }
+
+        private double Calculate(FunctionArgument arg, string expression)
+        {
+            var retVal = 0d;
+            if (ShouldIgnore(arg) || !_numericExpressionEvaluator.Evaluate(arg.Value, expression))
+            {
+                return retVal;
+            }
+            if (IsNumeric(arg.Value))
+            {
+                retVal += ConvertUtil.GetValueDouble(arg.Value);
+            }
+            //else if (arg.Value is System.DateTime)
+            //{
+            //    retVal += Convert.ToDateTime(arg.Value).ToOADate();
+            //}
+            else if (arg.Value is IEnumerable<FunctionArgument>)
+            {
+                foreach (var item in (IEnumerable<FunctionArgument>)arg.Value)
+                {
+                    retVal += Calculate(item, expression);
+                }
+            }
+            return retVal;
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/AverageIfs.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/AverageIfs.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/AverageIfs.cs	(revision 12707)
@@ -0,0 +1,66 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2015-02-01
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Math
+{
+    public class AverageIfs : MultipleRangeCriteriasFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            var functionArguments = arguments as FunctionArgument[] ?? arguments.ToArray();
+            ValidateArguments(functionArguments, 3);
+            var sumRange = ArgsToDoubleEnumerable(true, new List<FunctionArgument> { functionArguments[0] }, context).ToList();
+            var argRanges = new List<ExcelDataProvider.IRangeInfo>();
+            var criterias = new List<object>();
+            for (var ix = 1; ix < 31; ix += 2)
+            {
+                if (functionArguments.Length <= ix) break;
+                var rangeInfo = functionArguments[ix].ValueAsRangeInfo;
+                argRanges.Add(rangeInfo);
+                if (ix > 1)
+                {
+                    ThrowExcelErrorValueExceptionIf(() => rangeInfo.GetNCells() != argRanges[0].GetNCells(), eErrorType.Value);
+                }
+                criterias.Add(functionArguments[ix + 1].Value);
+            }
+            IEnumerable<int> matchIndexes = GetMatchIndexes(argRanges[0], criterias[0]);
+            var enumerable = matchIndexes as IList<int> ?? matchIndexes.ToList();
+            for (var ix = 1; ix < argRanges.Count && enumerable.Any(); ix++)
+            {
+                var indexes = GetMatchIndexes(argRanges[ix], criterias[ix]);
+                matchIndexes = enumerable.Intersect(indexes);
+            }
+
+            var result = matchIndexes.Average(index => sumRange[index]);
+
+            return CreateResult(result, DataType.Decimal);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Ceiling.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Ceiling.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Ceiling.cs	(revision 12707)
@@ -0,0 +1,68 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Math
+{
+    public class Ceiling : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 2);
+            var number = ArgToDecimal(arguments, 0);
+            var significance = ArgToDecimal(arguments, 1);
+            ValidateNumberAndSign(number, significance);
+            if (significance < 1 && significance > 0)
+            {
+                var floor = System.Math.Floor(number);
+                var rest = number - floor;
+                var nSign = (int)(rest / significance) + 1;
+                return CreateResult(floor + (nSign * significance), DataType.Decimal);
+            }
+            else if (significance == 1)
+            {
+                return CreateResult(System.Math.Ceiling(number), DataType.Decimal);
+            }
+            else
+            {
+                var result = number - (number % significance) + significance;
+                return CreateResult(result, DataType.Decimal);
+            }
+        }
+
+        private void ValidateNumberAndSign(double number, double sign)
+        {
+            if (number > 0d && sign < 0)
+            {
+                var values = string.Format("num: {0}, sign: {1}", number, sign);
+                throw new InvalidOperationException("Ceiling cannot handle a negative significance when the number is positive" + values);
+            }
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Cos.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Cos.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Cos.cs	(revision 12707)
@@ -0,0 +1,42 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Math
+{
+    public class Cos : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1);
+            var arg = ArgToDecimal(arguments, 0);
+            return CreateResult(System.Math.Cos(arg), DataType.Decimal);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Cosh.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Cosh.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Cosh.cs	(revision 12707)
@@ -0,0 +1,42 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Math
+{
+    public class Cosh : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1);
+            var arg = ArgToDecimal(arguments, 0);
+            return CreateResult(System.Math.Cosh(arg), DataType.Decimal);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Count.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Count.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Count.cs	(revision 12707)
@@ -0,0 +1,117 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Math
+{
+    public class Count : HiddenValuesHandlingFunction
+    {
+        private enum ItemContext
+        {
+            InRange,
+            InArray,
+            SingleArg
+        }
+
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1);
+            var nItems = 0d;
+            Calculate(arguments, ref nItems, context, ItemContext.SingleArg);
+            return CreateResult(nItems, DataType.Integer);
+        }
+
+        private void Calculate(IEnumerable<FunctionArgument> items, ref double nItems, ParsingContext context, ItemContext itemContext)
+        {
+            foreach (var item in items)
+            {
+                var cs = item.Value as ExcelDataProvider.IRangeInfo;
+                if (cs != null)
+                {
+                    foreach (var c in cs)
+                    {
+                        _CheckForAndHandleExcelError(c, context);
+                        if (ShouldIgnore(c, context) == false && ShouldCount(c.Value, ItemContext.InRange))
+                        {
+                            nItems++;
+                        }
+                    }
+                }
+                else
+                {
+                    var value = item.Value as IEnumerable<FunctionArgument>;
+                    if (value != null)
+                    {
+                        Calculate(value, ref nItems, context, ItemContext.InArray);
+                    }
+                    else
+                    {
+                        _CheckForAndHandleExcelError(item, context);
+                        if (ShouldIgnore(item) == false && ShouldCount(item.Value, itemContext))
+                        {
+                            nItems++;
+                        }
+                    }
+                }
+            }
+        }
+
+        private void _CheckForAndHandleExcelError(FunctionArgument arg, ParsingContext context)
+        {
+            //if (context.Scopes.Current.IsSubtotal)
+            //{
+            //    CheckForAndHandleExcelError(arg);
+            //}
+        }
+
+        private void _CheckForAndHandleExcelError(ExcelDataProvider.ICellInfo cell, ParsingContext context)
+        {
+            //if (context.Scopes.Current.IsSubtotal)
+            //{
+            //    CheckForAndHandleExcelError(cell);
+            //}
+        }
+
+        private bool ShouldCount(object value, ItemContext context)
+        {
+            switch (context)
+            {
+                case ItemContext.SingleArg:
+                    return IsNumeric(value) || IsNumericString(value);
+                case ItemContext.InRange:
+                    return IsNumeric(value);
+                case ItemContext.InArray:
+                    return IsNumeric(value) || IsNumericString(value);
+                default:
+                    throw new ArgumentException("Unknown ItemContext:" + context.ToString());
+            }
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/CountA.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/CountA.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/CountA.cs	(revision 12707)
@@ -0,0 +1,97 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Math
+{
+    public class CountA : HiddenValuesHandlingFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1);
+            var nItems = 0d;
+            Calculate(arguments, context, ref nItems);
+            return CreateResult(nItems, DataType.Integer);
+        }
+
+        private void Calculate(IEnumerable<FunctionArgument> items, ParsingContext context, ref double nItems)
+        {
+            foreach (var item in items)
+            {
+                var cs = item.Value as ExcelDataProvider.IRangeInfo;
+                if (cs != null)
+                {
+                    foreach (var c in cs)
+                    {
+                        _CheckForAndHandleExcelError(c, context);
+                        if (!ShouldIgnore(c, context) && ShouldCount(c.Value))
+                        {
+                            nItems++;
+                        }
+                    }
+                }
+                else if (item.Value is IEnumerable<FunctionArgument>)
+                {
+                    Calculate((IEnumerable<FunctionArgument>)item.Value, context, ref nItems);
+                }
+                else
+                {
+                    _CheckForAndHandleExcelError(item, context);
+                    if (!ShouldIgnore(item) && ShouldCount(item.Value))
+                    {
+                        nItems++;
+                    }
+                }
+
+            }
+        }
+
+        private void _CheckForAndHandleExcelError(FunctionArgument arg, ParsingContext context)
+        {
+            if (context.Scopes.Current.IsSubtotal)
+            {
+                CheckForAndHandleExcelError(arg);
+            }
+        }
+
+        private void _CheckForAndHandleExcelError(ExcelDataProvider.ICellInfo cell, ParsingContext context)
+        {
+            if (context.Scopes.Current.IsSubtotal)
+            {
+                CheckForAndHandleExcelError(cell);
+            }
+        }
+
+        private bool ShouldCount(object value)
+        {
+            if (value == null) return false;
+            return (!string.IsNullOrEmpty(value.ToString()));
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/CountBlank.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/CountBlank.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/CountBlank.cs	(revision 12707)
@@ -0,0 +1,28 @@
+﻿using OfficeOpenXml.FormulaParsing.Excel.Functions.Logical;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Math
+{
+    public class CountBlank : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1);
+            var arg = arguments.First();
+            if(!arg.IsExcelRange)throw new InvalidOperationException("CountBlank only support ranges as arguments");
+            var result = arg.ValueAsRangeInfo.GetNCells();
+            foreach (var cell in arg.ValueAsRangeInfo)
+            {
+                if (!(cell.Value == null || cell.Value == string.Empty))
+                {
+                    result--;
+                }
+            }
+            return CreateResult(result, DataType.Integer);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/CountIf.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/CountIf.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/CountIf.cs	(revision 12707)
@@ -0,0 +1,83 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExcelUtilities;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+using OfficeOpenXml.FormulaParsing.Utilities;
+using OfficeOpenXml.Utils;
+using Require = OfficeOpenXml.FormulaParsing.Utilities.Require;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Math
+{
+    public class CountIf : ExcelFunction
+    {
+        private readonly NumericExpressionEvaluator _numericExpressionEvaluator;
+        private readonly WildCardValueMatcher _wildCardValueMatcher;
+
+        public CountIf()
+            : this(new NumericExpressionEvaluator(), new WildCardValueMatcher())
+        {
+
+        }
+
+        public CountIf(NumericExpressionEvaluator evaluator, WildCardValueMatcher wildCardValueMatcher)
+        {
+            Require.That(evaluator).Named("evaluator").IsNotNull();
+            Require.That(wildCardValueMatcher).Named("wildCardValueMatcher").IsNotNull();
+            _numericExpressionEvaluator = evaluator;
+            _wildCardValueMatcher = wildCardValueMatcher;
+        }
+
+        private bool Evaluate(object obj, string expression)
+        {
+            double? candidate = default(double?);
+            if (IsNumeric(obj))
+            {
+                candidate = ConvertUtil.GetValueDouble(obj);
+            }
+            if (candidate.HasValue)
+            {
+                return _numericExpressionEvaluator.Evaluate(candidate.Value, expression);
+            }
+            return _wildCardValueMatcher.IsMatch(expression, obj.ToString()) == 0;
+        }
+
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            var functionArguments = arguments as FunctionArgument[] ?? arguments.ToArray();
+            ValidateArguments(functionArguments, 2);
+            var range = functionArguments.ElementAt(0);
+            var criteria = ArgToString(functionArguments, 1);
+            double result = 0d;
+            if (range.IsExcelRange)
+            {
+                foreach (var cell in range.ValueAsRangeInfo)
+                {
+                    if (Evaluate(cell.Value, criteria))
+                    {
+                        result++;
+                    }
+                }
+            }
+            else if (range.Value is IEnumerable<FunctionArgument>)
+            {
+                foreach (var arg in (IEnumerable<FunctionArgument>) range.Value)
+                {
+                    if(Evaluate(arg.Value, criteria))
+                    {
+                        result++;
+                    }
+                }
+            }
+            else
+            {
+                if (Evaluate(range.Value, criteria))
+                {
+                    result++;
+                }
+            }
+            return CreateResult(result, DataType.Integer);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/CountIfs.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/CountIfs.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/CountIfs.cs	(revision 12707)
@@ -0,0 +1,69 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2015-01-11
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Xml.XPath;
+using OfficeOpenXml.FormulaParsing.ExcelUtilities;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+using OfficeOpenXml.FormulaParsing.Utilities;
+using OfficeOpenXml.Utils;
+using Require = OfficeOpenXml.FormulaParsing.Utilities.Require;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Math
+{
+    public class CountIfs : MultipleRangeCriteriasFunction
+    {
+
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            var functionArguments = arguments as FunctionArgument[] ?? arguments.ToArray();
+            ValidateArguments(functionArguments, 2);
+            var argRanges = new List<ExcelDataProvider.IRangeInfo>();
+            var criterias = new List<object>();
+            for (var ix = 0; ix < 30; ix +=2)
+            {
+                if (functionArguments.Length <= ix) break;
+                var rangeInfo = functionArguments[ix].ValueAsRangeInfo;
+                argRanges.Add(rangeInfo);
+                if (ix > 0)
+                {
+                    ThrowExcelErrorValueExceptionIf(() => rangeInfo.GetNCells() != argRanges[0].GetNCells(), eErrorType.Value);
+                }
+                criterias.Add(functionArguments[ix+1].Value);
+            }
+            IEnumerable<int> matchIndexes = GetMatchIndexes(argRanges[0], criterias[0]);
+            var enumerable = matchIndexes as IList<int> ?? matchIndexes.ToList();
+            for (var ix = 1; ix < argRanges.Count && enumerable.Any(); ix++)
+            {
+                var indexes = GetMatchIndexes(argRanges[ix], criterias[ix]);
+                matchIndexes = enumerable.Intersect(indexes);
+            }
+            
+            return CreateResult((double)matchIndexes.Count(), DataType.Integer);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Degrees.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Degrees.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Degrees.cs	(revision 12707)
@@ -0,0 +1,19 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Math
+{
+    public class Degrees : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1);
+            var angle = ArgToDecimal(arguments, 0);
+            var result = (angle*180)/System.Math.PI;
+            return CreateResult(result, DataType.Decimal);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Exp.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Exp.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Exp.cs	(revision 12707)
@@ -0,0 +1,42 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Math
+{
+    public class Exp : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1);
+            var number = ArgToDecimal(arguments, 0);
+            return CreateResult(System.Math.Exp(number), DataType.Decimal);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Fact.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Fact.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Fact.cs	(revision 12707)
@@ -0,0 +1,24 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Math
+{
+    public class Fact : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1);
+            var number = ArgToDecimal(arguments, 0);
+            ThrowExcelErrorValueExceptionIf(() => number < 0, eErrorType.NA);
+            var result = 1d;
+            for (var x = 1; x < number; x++)
+            {
+                result *= x;
+            }
+            return CreateResult(result, DataType.Integer);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Floor.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Floor.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Floor.cs	(revision 12707)
@@ -0,0 +1,76 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Math
+{
+    public class Floor : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 2);
+            var number = ArgToDecimal(arguments, 0);
+            var significance = ArgToDecimal(arguments, 1);
+            ValidateNumberAndSign(number, significance);
+            if (significance < 1 && significance > 0)
+            {
+                var floor = System.Math.Floor(number);
+                var rest = number - floor;
+                var nSign = (int)(rest / significance);
+                return CreateResult(floor + (nSign * significance), DataType.Decimal);
+            }
+            else if (significance == 1)
+            {
+                return CreateResult(System.Math.Floor(number), DataType.Decimal);
+            }
+            else
+            {
+                double result;
+                if (number > 1)
+                {
+                    result = number - (number % significance) + significance;
+                }
+                else
+                {
+                    result = number - (number % significance);
+                }
+                return CreateResult(result, DataType.Decimal);
+            }
+        }
+
+        private void ValidateNumberAndSign(double number, double sign)
+        {
+            if (number > 0d && sign < 0)
+            {
+                var values = string.Format("num: {0}, sign: {1}", number, sign);
+                throw new InvalidOperationException("Floor cannot handle a negative significance when the number is positive" + values);
+            }
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Large.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Large.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Large.cs	(revision 12707)
@@ -0,0 +1,22 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Math
+{
+    public class Large : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 2);
+            var args = arguments.ElementAt(0);
+            var index = ArgToInt(arguments, 1) - 1;
+            var values = ArgsToDoubleEnumerable(new List<FunctionArgument> {args}, context);
+            ThrowExcelErrorValueExceptionIf(() => index < 0 || index >= values.Count(), eErrorType.Num);
+            var result = values.OrderByDescending(x => x).ElementAt(index);
+            return CreateResult(result, DataType.Decimal);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Ln.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Ln.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Ln.cs	(revision 12707)
@@ -0,0 +1,18 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Math
+{
+    public class Ln : ExcelFunction
+{
+    public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+    {
+        ValidateArguments(arguments, 1);
+        var arg = ArgToDecimal(arguments, 0);
+        return CreateResult(System.Math.Log(arg, System.Math.E), DataType.Decimal);
+    }
+}
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Log.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Log.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Log.cs	(revision 12707)
@@ -0,0 +1,47 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Math
+{
+    public class Log : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1);
+            var number = ArgToDecimal(arguments, 0);
+            if (arguments.Count() == 1)
+            {
+                return CreateResult(System.Math.Log(number, 10d), DataType.Decimal);
+            }
+            var newBase = ArgToDecimal(arguments, 1);
+            return CreateResult(System.Math.Log(number, newBase), DataType.Decimal);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Log10.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Log10.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Log10.cs	(revision 12707)
@@ -0,0 +1,42 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Math
+{
+    public class Log10 : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1);
+            var number = ArgToDecimal(arguments, 0);
+            return CreateResult(System.Math.Log10(number), DataType.Decimal);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/MathHelper.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/MathHelper.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/MathHelper.cs	(revision 12707)
@@ -0,0 +1,165 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2015-01-11
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using MathObj = System.Math;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Math
+{
+    /// <summary>
+    /// Thanks to the guys in this thread: http://stackoverflow.com/questions/2840798/c-sharp-math-class-question
+    /// </summary>
+    public static class MathHelper
+    {
+        // Secant 
+        public static double Sec(double x)
+        {
+            return 1 / MathObj.Cos(x);
+        }
+
+        // Cosecant
+        public static double Cosec(double x)
+        {
+            return 1 / MathObj.Sin(x);
+        }
+
+        // Cotangent 
+        public static double Cotan(double x)
+        {
+            return 1 / MathObj.Tan(x);
+        }
+
+        // Inverse Sine 
+        public static double Arcsin(double x)
+        {
+            return MathObj.Atan(x / MathObj.Sqrt(-x * x + 1));
+        }
+
+        // Inverse Cosine 
+        public static double Arccos(double x)
+        {
+            return MathObj.Atan(-x / MathObj.Sqrt(-x * x + 1)) + 2 * MathObj.Atan(1);
+        }
+
+
+        // Inverse Secant 
+        public static double Arcsec(double x)
+        {
+            return 2 * MathObj.Atan(1) - MathObj.Atan(MathObj.Sign(x) / MathObj.Sqrt(x * x - 1));
+        }
+
+        // Inverse Cosecant 
+        public static double Arccosec(double x)
+        {
+            return MathObj.Atan(MathObj.Sign(x) / MathObj.Sqrt(x * x - 1));
+        }
+
+        // Inverse Cotangent 
+        public static double Arccotan(double x)
+        {
+            return 2 * MathObj.Atan(1) - MathObj.Atan(x);
+        }
+
+        // Hyperbolic Sine 
+        public static double HSin(double x)
+        {
+            return (MathObj.Exp(x) - MathObj.Exp(-x)) / 2;
+        }
+
+        // Hyperbolic Cosine 
+        public static double HCos(double x)
+        {
+            return (MathObj.Exp(x) + MathObj.Exp(-x)) / 2;
+        }
+
+        // Hyperbolic Tangent 
+        public static double HTan(double x)
+        {
+            return (MathObj.Exp(x) - MathObj.Exp(-x)) / (MathObj.Exp(x) + MathObj.Exp(-x));
+        }
+
+        // Hyperbolic Secant 
+        public static double HSec(double x)
+        {
+            return 2 / (MathObj.Exp(x) + MathObj.Exp(-x));
+        }
+
+        // Hyperbolic Cosecant 
+        public static double HCosec(double x)
+        {
+            return 2 / (MathObj.Exp(x) - MathObj.Exp(-x));
+        }
+
+        // Hyperbolic Cotangent 
+        public static double HCotan(double x)
+        {
+            return (MathObj.Exp(x) + MathObj.Exp(-x)) / (MathObj.Exp(x) - MathObj.Exp(-x));
+        }
+
+        // Inverse Hyperbolic Sine 
+        public static double HArcsin(double x)
+        {
+            return MathObj.Log(x + MathObj.Sqrt(x * x + 1));
+        }
+
+        // Inverse Hyperbolic Cosine 
+        public static double HArccos(double x)
+        {
+            return MathObj.Log(x + MathObj.Sqrt(x * x - 1));
+        }
+
+        // Inverse Hyperbolic Tangent 
+        public static double HArctan(double x)
+        {
+            return MathObj.Log((1 + x) / (1 - x)) / 2;
+        }
+
+        // Inverse Hyperbolic Secant 
+        public static double HArcsec(double x)
+        {
+            return MathObj.Log((MathObj.Sqrt(-x * x + 1) + 1) / x);
+        }
+
+        // Inverse Hyperbolic Cosecant 
+        public static double HArccosec(double x)
+        {
+            return MathObj.Log((MathObj.Sign(x) * MathObj.Sqrt(x * x + 1) + 1) / x);
+        }
+
+        // Inverse Hyperbolic Cotangent 
+        public static double HArccotan(double x)
+        {
+            return MathObj.Log((x + 1) / (x - 1)) / 2;
+        }
+
+        // Logarithm to base N 
+        public static double LogN(double x, double n)
+        {
+            return MathObj.Log(x) / MathObj.Log(n);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Max.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Max.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Max.cs	(revision 12707)
@@ -0,0 +1,42 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Math
+{
+    public class Max : HiddenValuesHandlingFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1);
+            var values = ArgsToDoubleEnumerable(IgnoreHiddenValues, false, arguments, context);
+            return CreateResult(values.Max(), DataType.Decimal);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Maxa.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Maxa.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Maxa.cs	(revision 12707)
@@ -0,0 +1,55 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+using OfficeOpenXml.FormulaParsing.Utilities;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Math
+{
+    public class Maxa : ExcelFunction
+    {
+        private readonly DoubleEnumerableArgConverter _argConverter;
+
+        public Maxa()
+            : this(new DoubleEnumerableArgConverter())
+        {
+
+        }
+        public Maxa(DoubleEnumerableArgConverter argConverter)
+        {
+            Require.That(argConverter).Named("argConverter").IsNotNull();
+            _argConverter = argConverter;
+        }
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1);
+            var values = _argConverter.ConvertArgsIncludingOtherTypes(arguments);
+            return CreateResult(values.Max(), DataType.Decimal);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Median.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Median.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Median.cs	(revision 12707)
@@ -0,0 +1,54 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2015-01-10
+ *******************************************************************************/
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Math
+{
+    public class Median : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            var nums = ArgsToDoubleEnumerable(arguments, context);
+            var arr = nums.ToArray();
+            Array.Sort(arr);
+            ThrowExcelErrorValueExceptionIf(() => arr.Length == 0, eErrorType.Num);
+            double result;
+            if (arr.Length % 2 == 1)
+            {
+                result = arr[arr.Length / 2];
+            }
+            else
+            {
+                var startIndex = arr.Length/2 - 1;
+                result = (arr[startIndex] + arr[startIndex + 1])/2d;
+            }
+            return CreateResult(result, DataType.Decimal);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Min.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Min.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Min.cs	(revision 12707)
@@ -0,0 +1,42 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Math
+{
+    public class Min : HiddenValuesHandlingFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1);
+            var values = ArgsToDoubleEnumerable(IgnoreHiddenValues, false, arguments, context);
+            return CreateResult(values.Min(), DataType.Decimal);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Mina.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Mina.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Mina.cs	(revision 12707)
@@ -0,0 +1,55 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+using OfficeOpenXml.FormulaParsing.Utilities;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Math
+{
+    public class Mina : ExcelFunction
+    {
+        private readonly DoubleEnumerableArgConverter _argConverter;
+
+        public Mina()
+            : this(new DoubleEnumerableArgConverter())
+        {
+
+        }
+        public Mina(DoubleEnumerableArgConverter argConverter)
+        {
+            Require.That(argConverter).Named("argConverter").IsNotNull();
+            _argConverter = argConverter;
+        }
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1);
+            var values = _argConverter.ConvertArgsIncludingOtherTypes(arguments);
+            return CreateResult(values.Min(), DataType.Decimal);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Mod.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Mod.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Mod.cs	(revision 12707)
@@ -0,0 +1,43 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Math
+{
+    public class Mod : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 2);
+            var n1 = ArgToDecimal(arguments, 0);
+            var n2 = ArgToDecimal(arguments, 1);
+            return new CompileResult(n1 % n2, DataType.Decimal);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/MultipleRangeCriteriasFunction.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/MultipleRangeCriteriasFunction.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/MultipleRangeCriteriasFunction.cs	(revision 12707)
@@ -0,0 +1,91 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2015-01-15
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExcelUtilities;
+using OfficeOpenXml.FormulaParsing.Utilities;
+using OfficeOpenXml.Utils;
+using Require = OfficeOpenXml.FormulaParsing.Utilities.Require;
+
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Math
+{
+    public abstract class MultipleRangeCriteriasFunction : ExcelFunction
+    {
+
+        private readonly NumericExpressionEvaluator _numericExpressionEvaluator;
+        private readonly WildCardValueMatcher _wildCardValueMatcher;
+
+        protected MultipleRangeCriteriasFunction()
+            :this(new NumericExpressionEvaluator(), new WildCardValueMatcher())
+        {
+            
+        }
+
+        protected MultipleRangeCriteriasFunction(NumericExpressionEvaluator evaluator, WildCardValueMatcher wildCardValueMatcher)
+        {
+            Require.That(evaluator).Named("evaluator").IsNotNull();
+            Require.That(wildCardValueMatcher).Named("wildCardValueMatcher").IsNotNull();
+            _numericExpressionEvaluator = evaluator;
+            _wildCardValueMatcher = wildCardValueMatcher;
+        }
+
+        protected bool Evaluate(object obj, object expression)
+        {
+            double? candidate = default(double?);
+            if (IsNumeric(obj))
+            {
+                candidate = ConvertUtil.GetValueDouble(obj);
+            }
+            if (candidate.HasValue && expression is string)
+            {
+                return _numericExpressionEvaluator.Evaluate(candidate.Value, expression.ToString());
+            }
+            if (obj == null) return false;
+            return _wildCardValueMatcher.IsMatch(expression, obj.ToString()) == 0;
+        }
+
+        protected List<int> GetMatchIndexes(ExcelDataProvider.IRangeInfo rangeInfo, object searched)
+        {
+            var result = new List<int>();
+            var internalIndex = 0;
+            for (var row = rangeInfo.Address._fromRow; row <= rangeInfo.Address._toRow; row++)
+            {
+                for (var col = rangeInfo.Address._fromCol; col <= rangeInfo.Address._toCol; col++)
+                {
+                    var candidate = rangeInfo.GetValue(row, col);
+                    if (Evaluate(candidate, searched))
+                    {
+                        result.Add(internalIndex);
+                    }
+                    internalIndex++;
+                }
+            }
+            return result;
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Pi.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Pi.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Pi.cs	(revision 12707)
@@ -0,0 +1,41 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Math
+{
+    public class Pi : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            var result = System.Math.Round((double)System.Math.PI, 14);
+            return CreateResult(result, DataType.Decimal);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Power.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Power.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Power.cs	(revision 12707)
@@ -0,0 +1,44 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Math
+{
+    public class Power : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 2);
+            var number = ArgToDecimal(arguments, 0);
+            var power = ArgToDecimal(arguments, 1);
+            var result = System.Math.Pow(number, power);
+            return CreateResult(result, DataType.Decimal);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Product.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Product.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Product.cs	(revision 12707)
@@ -0,0 +1,91 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Math
+{
+    public class Product : HiddenValuesHandlingFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1);
+            var result = 0d;
+            var index = 0;
+            while (AreEqual(result, 0d) && index < arguments.Count())
+            {
+                result = CalculateFirstItem(arguments, index++, context);
+            }
+            result = CalculateCollection(arguments.Skip(index), result, (arg, current) =>
+            {
+                if (ShouldIgnore(arg)) return current;
+                if (arg.ValueIsExcelError)
+                {
+                    ThrowExcelErrorValueException(arg.ValueAsExcelErrorValue.Type);
+                }
+                if (arg.IsExcelRange)
+                {
+                    foreach (var cell in arg.ValueAsRangeInfo)
+                    {
+                        if(ShouldIgnore(cell, context)) return current;
+                        current *= cell.ValueDouble;
+                    }
+                    return current;
+                }
+                var obj = arg.Value;
+                if (obj != null && IsNumeric(obj))
+                {
+                    var val = Convert.ToDouble(obj);
+                    current *= val;
+                }
+                return current;
+            });
+            return CreateResult(result, DataType.Decimal);
+        }
+
+        private double CalculateFirstItem(IEnumerable<FunctionArgument> arguments, int index, ParsingContext context)
+        {
+            var element = arguments.ElementAt(index);
+            var argList = new List<FunctionArgument> { element };
+            var valueList = ArgsToDoubleEnumerable(false, false, argList, context);
+            var result = 0d;
+            foreach (var value in valueList)
+            {
+                if (result == 0d && value > 0d)
+                {
+                    result = value;
+                }
+                else
+                {
+                    result *= value;
+                }
+            }
+            return result;
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Quotient.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Quotient.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Quotient.cs	(revision 12707)
@@ -0,0 +1,21 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Math
+{
+    public class Quotient : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 2);
+            var num = ArgToDecimal(arguments, 0);
+            var denom = ArgToDecimal(arguments, 1);
+            ThrowExcelErrorValueExceptionIf(() => (int)denom == 0, eErrorType.Div0);
+            var result = (int)(num/denom);
+            return CreateResult(result, DataType.Integer);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Rand.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Rand.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Rand.cs	(revision 12707)
@@ -0,0 +1,24 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Math
+{
+    public class Rand : ExcelFunction
+    {
+        private static int Seed
+        {
+            get;
+            set;
+        }
+
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            Seed = Seed > 50 ? 0 : Seed + 5;
+            var val = new Random(System.DateTime.Now.Millisecond + Seed).NextDouble();
+            return CreateResult(val, DataType.Decimal);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/RandBetween.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/RandBetween.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/RandBetween.cs	(revision 12707)
@@ -0,0 +1,59 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Math
+{
+    public class RandBetween : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 2);
+            var low = ArgToDecimal(arguments, 0);
+            var high = ArgToDecimal(arguments, 1);
+            var rand = new Rand().Execute(new FunctionArgument[0], context).Result;
+            var randPart = (CalulateDiff(high, low) * (double)rand) + 1;
+            randPart = System.Math.Floor(randPart);
+            return CreateResult(low + randPart, DataType.Integer);
+        }
+
+        private double CalulateDiff(double high, double low)
+        {
+            if (high > 0 && low < 0)
+            {
+                return high + low * - 1;
+            }
+            else if (high < 0 && low < 0)
+            {
+                return high * -1 - low * -1;
+            }
+            return high - low;
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Round.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Round.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Round.cs	(revision 12707)
@@ -0,0 +1,48 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Math
+{
+    public class Round : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 2);
+            var number = ArgToDecimal(arguments, 0);
+            var nDigits = ArgToInt(arguments, 1);
+            if (nDigits < 0)
+            {
+                nDigits *= -1;
+                return CreateResult(number - (number % (System.Math.Pow(10, nDigits))), DataType.Integer); 
+            }
+            return CreateResult(System.Math.Round(number, nDigits), DataType.Decimal);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Rounddown.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Rounddown.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Rounddown.cs	(revision 12707)
@@ -0,0 +1,67 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2014-01-06
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Math
+{
+    public class Rounddown : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 2);
+            var number = ArgToDecimal(arguments, 0);
+            var nDecimals = ArgToInt(arguments, 1);
+
+            var nFactor = number < 0 ? -1 : 1;
+            number *= nFactor;
+
+            double result;
+            if (nDecimals > 0)
+            {
+                result = RoundDownDecimalNumber(number, nDecimals);
+            }
+            else
+            {
+                result = (int)System.Math.Floor(number);
+                result = result - (result % System.Math.Pow(10, (nDecimals*-1)));
+            }
+            return CreateResult(result * nFactor, DataType.Decimal);
+        }
+
+        private static double RoundDownDecimalNumber(double number, int nDecimals)
+        {
+            var integerPart = System.Math.Floor(number);
+            var decimalPart = number - integerPart;
+            decimalPart = System.Math.Pow(10d, nDecimals)*decimalPart;
+            decimalPart = System.Math.Truncate(decimalPart)/System.Math.Pow(10d, nDecimals);
+            var result = integerPart + decimalPart;
+            return result;
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Roundup.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Roundup.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Roundup.cs	(revision 12707)
@@ -0,0 +1,46 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2014-01-06
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Math
+{
+    public class Roundup : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 2);
+            var number = ArgToDecimal(arguments, 0);
+            var nDigits = ArgToInt(arguments, 1);
+            double result = (number >= 0) 
+                ? System.Math.Ceiling(number * System.Math.Pow(10, nDigits)) / System.Math.Pow(10, nDigits)
+                : System.Math.Floor(number * System.Math.Pow(10, nDigits)) / System.Math.Pow(10, nDigits);
+            return CreateResult(result, DataType.Decimal);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Sign.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Sign.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Sign.cs	(revision 12707)
@@ -0,0 +1,51 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Math
+{
+    public class Sign : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1);
+            var result = 0d;
+            var val = ArgToDecimal(arguments, 0);
+            if (val < 0)
+            {
+                result = -1;
+            }
+            else if (val > 0)
+            {
+                result = 1;
+            }
+            return CreateResult(result, DataType.Decimal);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Sin.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Sin.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Sin.cs	(revision 12707)
@@ -0,0 +1,42 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Math
+{
+    public class Sin : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1);
+            var arg = ArgToDecimal(arguments, 0);
+            return CreateResult(System.Math.Sin(arg), DataType.Decimal);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Sinh.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Sinh.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Sinh.cs	(revision 12707)
@@ -0,0 +1,42 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Math
+{
+    public class Sinh : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1);
+            var arg = ArgToDecimal(arguments, 0);
+            return CreateResult(System.Math.Sinh(arg), DataType.Decimal);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Small.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Small.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Small.cs	(revision 12707)
@@ -0,0 +1,22 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Math
+{
+    public class Small : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 2);
+            var args = arguments.ElementAt(0);
+            var index = ArgToInt(arguments, 1) - 1;
+            var values = ArgsToDoubleEnumerable(new List<FunctionArgument> { args }, context);
+            ThrowExcelErrorValueExceptionIf(() => index < 0 || index >= values.Count(), eErrorType.Num);
+            var result = values.OrderBy(x => x).ElementAt(index);
+            return CreateResult(result, DataType.Decimal);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Sqrt.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Sqrt.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Sqrt.cs	(revision 12707)
@@ -0,0 +1,43 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Math
+{
+    public class Sqrt : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1);
+            var arg = ArgToDecimal(arguments, 0);
+            var result = System.Math.Sqrt((double)arg);
+            return CreateResult((double)result, DataType.Decimal);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/SqrtPi.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/SqrtPi.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/SqrtPi.cs	(revision 12707)
@@ -0,0 +1,42 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Math
+{
+    public class SqrtPi : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1);
+            var number = ArgToDecimal(arguments, 0);
+            return CreateResult(System.Math.Sqrt(number * System.Math.PI), DataType.Decimal);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Stdev.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Stdev.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Stdev.cs	(revision 12707)
@@ -0,0 +1,62 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.Exceptions;
+using MathObj = System.Math;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Math
+{
+    public class Stdev : HiddenValuesHandlingFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1);
+            var values = ArgsToDoubleEnumerable(arguments, context, false);
+            return CreateResult(StandardDeviation(values), DataType.Decimal);
+        }
+
+        private double StandardDeviation(IEnumerable<double> values)
+        {
+            double ret = 0;
+            if (values.Any())
+            {
+                var nValues = values.Count();
+                if(nValues == 1) throw new ExcelErrorValueException(eErrorType.Div0);
+                //Compute the Average       
+                double avg = values.Average();
+                //Perform the Sum of (value-avg)_2_2       
+                double sum = values.Sum(d => MathObj.Pow(d - avg, 2));
+                //Put it all together       
+                ret = MathObj.Sqrt(Divide(sum, (values.Count() - 1)));
+            }
+            return ret;
+        } 
+
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/StdevP.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/StdevP.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/StdevP.cs	(revision 12707)
@@ -0,0 +1,48 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using MathObj = System.Math;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Math
+{
+    public class StdevP : HiddenValuesHandlingFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            var args = ArgsToDoubleEnumerable(IgnoreHiddenValues, false, arguments, context);
+            return CreateResult(StandardDeviation(args), DataType.Decimal);
+        }
+
+        private static double StandardDeviation(IEnumerable<double> values)
+        {
+            double avg = values.Average();
+            return MathObj.Sqrt(values.Average(v => MathObj.Pow(v - avg, 2)));
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Subtotal.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Subtotal.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Subtotal.cs	(revision 12707)
@@ -0,0 +1,107 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Math
+{
+    public class Subtotal : ExcelFunction
+    {
+        private Dictionary<int, HiddenValuesHandlingFunction> _functions = new Dictionary<int, HiddenValuesHandlingFunction>();
+        
+        public Subtotal()
+        {
+            Initialize();
+        }
+
+        private void Initialize()
+        {
+            _functions[1] = new Average();
+            _functions[2] = new Count();
+            _functions[3] = new CountA();
+            _functions[4] = new Max();
+            _functions[5] = new Min();
+            _functions[6] = new Product();
+            _functions[7] = new Stdev();
+            _functions[8] = new StdevP();
+            _functions[9] = new Sum();
+            _functions[10] = new Var();
+            _functions[11] = new VarP();
+
+            AddHiddenValueHandlingFunction(new Average(), 101);
+            AddHiddenValueHandlingFunction(new Count(), 102);
+            AddHiddenValueHandlingFunction(new CountA(), 103);
+            AddHiddenValueHandlingFunction(new Max(), 104);
+            AddHiddenValueHandlingFunction(new Min(), 105);
+            AddHiddenValueHandlingFunction(new Product(), 106);
+            AddHiddenValueHandlingFunction(new Stdev(), 107);
+            AddHiddenValueHandlingFunction(new StdevP(), 108);
+            AddHiddenValueHandlingFunction(new Sum(), 109);
+            AddHiddenValueHandlingFunction(new Var(), 110);
+            AddHiddenValueHandlingFunction(new VarP(), 111);
+        }
+
+        private void AddHiddenValueHandlingFunction(HiddenValuesHandlingFunction func, int funcNum)
+        {
+            func.IgnoreHiddenValues = true;
+            _functions[funcNum] = func;
+        }
+
+        public override void BeforeInvoke(ParsingContext context)
+        {
+            base.BeforeInvoke(context);
+            context.Scopes.Current.IsSubtotal = true;
+        }
+
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 2);
+            var funcNum = ArgToInt(arguments, 0);
+            if (context.Scopes.Current.Parent != null && context.Scopes.Current.Parent.IsSubtotal)
+            {
+                return CreateResult(0d, DataType.Decimal);
+            }
+            var actualArgs = arguments.Skip(1);
+            ExcelFunction function = null;
+            function = GetFunctionByCalcType(funcNum);
+            var compileResult = function.Execute(actualArgs, context);
+            compileResult.IsResultOfSubtotal = true;
+            return compileResult;
+        }
+
+        private ExcelFunction GetFunctionByCalcType(int funcNum)
+        {
+            if (!_functions.ContainsKey(funcNum))
+            {
+                ThrowExcelErrorValueException(eErrorType.Value);
+                //throw new ArgumentException("Invalid funcNum " + funcNum + ", valid ranges are 1-11 and 101-111");
+            }
+            return _functions[funcNum];
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Sum.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Sum.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Sum.cs	(revision 12707)
@@ -0,0 +1,84 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+using OfficeOpenXml.Utils;
+using OfficeOpenXml.FormulaParsing.Exceptions;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Math
+{
+    public class Sum : HiddenValuesHandlingFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            var retVal = 0d;
+            if (arguments != null)
+            {
+                foreach (var arg in arguments)
+                {
+                    retVal += Calculate(arg, context);                    
+                }
+            }
+            return CreateResult(retVal, DataType.Decimal);
+        }
+
+        
+        private double Calculate(FunctionArgument arg, ParsingContext context)
+        {
+            var retVal = 0d;
+            if (ShouldIgnore(arg))
+            {
+                return retVal;
+            }
+            if (arg.Value is IEnumerable<FunctionArgument>)
+            {
+                foreach (var item in (IEnumerable<FunctionArgument>)arg.Value)
+                {
+                    retVal += Calculate(item, context);
+                }
+            }
+            else if (arg.Value is ExcelDataProvider.IRangeInfo)
+            {
+                foreach (var c in (ExcelDataProvider.IRangeInfo)arg.Value)
+                {
+                    if (ShouldIgnore(c, context) == false)
+                    {
+                        CheckForAndHandleExcelError(c);
+                        retVal += c.ValueDouble;
+                    }
+                }
+            }
+            else
+            {
+                CheckForAndHandleExcelError(arg);
+                retVal += ConvertUtil.GetValueDouble(arg.Value, true);
+            }
+            return retVal;
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/SumIf.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/SumIf.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/SumIf.cs	(revision 12707)
@@ -0,0 +1,176 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+using OfficeOpenXml.FormulaParsing.ExcelUtilities;
+using OfficeOpenXml.FormulaParsing.Utilities;
+using OfficeOpenXml.FormulaParsing.Exceptions;
+using Util=OfficeOpenXml.Utils;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Math
+{
+    public class SumIf : HiddenValuesHandlingFunction
+    {
+        private readonly NumericExpressionEvaluator _evaluator;
+
+        public SumIf()
+            : this(new NumericExpressionEvaluator())
+        {
+
+        }
+
+        public SumIf(NumericExpressionEvaluator evaluator)
+        {
+            Require.That(evaluator).Named("evaluator").IsNotNull();
+            _evaluator = evaluator;
+        }
+
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 2);
+            var args = arguments.ElementAt(0).Value as ExcelDataProvider.IRangeInfo; //IEnumerable<FunctionArgument>;
+            var criteria = arguments.ElementAt(1).Value;
+            ThrowExcelErrorValueExceptionIf(() => criteria == null || criteria.ToString().Length > 255, eErrorType.Value);
+            var retVal = 0d;
+            if (arguments.Count() > 2)
+            {
+                var sumRange = arguments.ElementAt(2).Value as ExcelDataProvider.IRangeInfo;//IEnumerable<FunctionArgument>;
+                retVal = CalculateWithSumRange(args, criteria.ToString(), sumRange, context);
+            }
+            else
+            {
+                if (args != null)
+                {
+                    retVal = CalculateSingleRange(args, criteria.ToString(), context);   
+                }
+                else
+                {
+                    retVal = CalculateSingleRange((arguments.ElementAt(0).Value as IEnumerable<FunctionArgument>),
+                                                  criteria.ToString(), context);
+                }
+            }
+            return CreateResult(retVal, DataType.Decimal);
+        }
+
+        private double CalculateWithSumRange(IEnumerable<FunctionArgument> range, string criteria, IEnumerable<FunctionArgument> sumRange, ParsingContext context)
+        {
+            var retVal = 0d;
+            var flattenedRange = ArgsToDoubleEnumerable(range, context);
+            var flattenedSumRange = ArgsToDoubleEnumerable(sumRange, context);
+            for (var x = 0; x < flattenedRange.Count(); x++)
+            {
+                var candidate = flattenedSumRange.ElementAt(x);
+                if (_evaluator.Evaluate(flattenedRange.ElementAt(x), criteria))
+                {
+                    retVal += candidate;
+                }
+            }
+            return retVal;
+        }
+
+        private double CalculateWithSumRange(ExcelDataProvider.IRangeInfo range, string criteria, ExcelDataProvider.IRangeInfo sumRange, ParsingContext context)
+        {
+            var retVal = 0d;
+            foreach(var cell in range)
+            {
+                if (_evaluator.Evaluate(cell.Value, criteria))
+                {
+                    var or = cell.Row-range.Address._fromRow;
+                    var oc = cell.Column - range.Address._fromCol;
+                    if(sumRange.Address._fromRow+or <= sumRange.Address._toRow && 
+                       sumRange.Address._fromCol+oc <= sumRange.Address._toCol)
+                    {
+                        var v = sumRange.GetOffset(or, oc);
+                        if (v is ExcelErrorValue)
+                        {
+                            throw (new ExcelErrorValueException((ExcelErrorValue)v));
+                        }
+                        retVal += Util.ConvertUtil.GetValueDouble(v, true);
+                    }
+                }
+            }
+            return retVal;
+        }
+
+        private double CalculateSingleRange(IEnumerable<FunctionArgument> args, string expression, ParsingContext context)
+        {
+            var retVal = 0d;
+            var flattendedRange = ArgsToDoubleEnumerable(args, context);
+            foreach (var candidate in flattendedRange)
+            {
+                if (_evaluator.Evaluate(candidate, expression))
+                {
+                    retVal += candidate;
+                }
+            }
+            return retVal;
+        }
+
+        private double CalculateSingleRange(ExcelDataProvider.IRangeInfo range, string expression, ParsingContext context)
+        {
+            var retVal = 0d;
+            foreach (var candidate in range)
+            {
+                if (_evaluator.Evaluate(candidate.Value, expression))
+                {
+                    if (candidate.IsExcelError)
+                    {
+                        throw (new ExcelErrorValueException((ExcelErrorValue)candidate.Value));
+                    }
+                    retVal += candidate.ValueDouble;
+                }
+            }
+            return retVal;
+        }
+
+        //private double Calculate(FunctionArgument arg, string expression)
+        //{
+        //    var retVal = 0d;
+        //    if (ShouldIgnore(arg) || !_evaluator.Evaluate(arg.Value, expression))
+        //    {
+        //        return retVal;
+        //    }
+        //    if (arg.Value is double || arg.Value is int)
+        //    {
+        //        retVal += Convert.ToDouble(arg.Value);
+        //    }
+        //    else if (arg.Value is System.DateTime)
+        //    {
+        //        retVal += Convert.ToDateTime(arg.Value).ToOADate();
+        //    }
+        //    else if (arg.Value is IEnumerable<FunctionArgument>)
+        //    {
+        //        foreach (var item in (IEnumerable<FunctionArgument>)arg.Value)
+        //        {
+        //            retVal += Calculate(item, expression);
+        //        }
+        //    }
+        //    return retVal;
+        //}
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/SumIfs.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/SumIfs.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/SumIfs.cs	(revision 12707)
@@ -0,0 +1,66 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2015-01-15
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Math
+{
+    public class SumIfs : MultipleRangeCriteriasFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            var functionArguments = arguments as FunctionArgument[] ?? arguments.ToArray();
+            ValidateArguments(functionArguments, 3);
+            var sumRange = ArgsToDoubleEnumerable(true, new List<FunctionArgument> {functionArguments[0]}, context).ToList();
+            var argRanges = new List<ExcelDataProvider.IRangeInfo>();
+            var criterias = new List<object>();
+            for (var ix = 1; ix < 31; ix += 2)
+            {
+                if (functionArguments.Length <= ix) break;
+                var rangeInfo = functionArguments[ix].ValueAsRangeInfo;
+                argRanges.Add(rangeInfo);
+                if (ix > 1)
+                {
+                    ThrowExcelErrorValueExceptionIf(() => rangeInfo.GetNCells() != argRanges[0].GetNCells(), eErrorType.Value);
+                }
+                criterias.Add(functionArguments[ix + 1].Value);
+            }
+            IEnumerable<int> matchIndexes = GetMatchIndexes(argRanges[0], criterias[0]);
+            var enumerable = matchIndexes as IList<int> ?? matchIndexes.ToList();
+            for (var ix = 1; ix < argRanges.Count && enumerable.Any(); ix++)
+            {
+                var indexes = GetMatchIndexes(argRanges[ix], criterias[ix]);
+                matchIndexes = enumerable.Intersect(indexes);
+            }
+
+            var result = matchIndexes.Sum(index => sumRange[index]);
+
+            return CreateResult(result, DataType.Decimal);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/SumProduct.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/SumProduct.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/SumProduct.cs	(revision 12707)
@@ -0,0 +1,106 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.Exceptions;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Math
+{
+    public class SumProduct : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1);
+            double result = 0d;
+            List<List<double>> results = new List<List<double>>();
+            foreach (var arg in arguments)
+            {
+                results.Add(new List<double>());
+                var currentResult = results.Last();
+                if (arg.Value is IEnumerable<FunctionArgument>)
+                {
+                    foreach (var val in (IEnumerable<FunctionArgument>)arg.Value)
+                    {
+                        AddValue(val.Value, currentResult);
+                    }
+                }
+                else if (arg.Value is FunctionArgument)
+                {
+                    AddValue(arg.Value, currentResult);
+                }
+                else if (arg.IsExcelRange)
+                {
+                    var r=arg.ValueAsRangeInfo;
+                    for (int col = r.Address._fromCol; col <= r.Address._toCol; col++)
+                    {
+                        for (int row = r.Address._fromRow; row <= r.Address._toRow; row++)
+                        {
+                            AddValue(r.GetValue(row,col), currentResult);
+                        }
+                    }
+                }
+            }
+            // Validate that all supplied lists have the same length
+            var arrayLength = results.First().Count;
+            foreach (var list in results)
+            {
+                if (list.Count != arrayLength)
+                {
+                    throw new ExcelErrorValueException(ExcelErrorValue.Create(eErrorType.Value));
+                    //throw new ExcelFunctionException("All supplied arrays must have the same length", ExcelErrorCodes.Value);
+                }
+            }
+            for (var rowIndex = 0; rowIndex < arrayLength; rowIndex++)
+            {
+                double rowResult = 1;
+                for (var colIndex = 0; colIndex < results.Count; colIndex++)
+                {
+                    rowResult *= results[colIndex][rowIndex];
+                }
+                result += rowResult;
+            }
+            return CreateResult(result, DataType.Decimal);
+        }
+
+        private void AddValue(object convertVal, List<double> currentResult)
+        {
+            if (IsNumeric(convertVal))
+            {
+                currentResult.Add(Convert.ToDouble(convertVal));
+            }
+            else if (convertVal is ExcelErrorValue)
+            {
+                throw (new ExcelErrorValueException((ExcelErrorValue)convertVal));
+            }
+            else
+            {
+                currentResult.Add(0d);
+            }
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Sumsq.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Sumsq.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Sumsq.cs	(revision 12707)
@@ -0,0 +1,69 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+using OfficeOpenXml.Utils;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Math
+{
+    public class Sumsq : HiddenValuesHandlingFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            var retVal = 0d;
+            if (arguments != null)
+            {
+                foreach (var arg in arguments)
+                {
+                    retVal += Calculate(arg, context);
+                }
+            }
+            return CreateResult(retVal, DataType.Decimal);
+        }
+
+
+        private double Calculate(FunctionArgument arg, ParsingContext context, bool isInArray = false)
+        {
+            var retVal = 0d;
+            if (ShouldIgnore(arg))
+            {
+                return retVal;
+            }
+            if (arg.Value is IEnumerable<FunctionArgument>)
+            {
+                foreach (var item in (IEnumerable<FunctionArgument>)arg.Value)
+                {
+                    retVal += Calculate(item, context, true);
+                }
+            }
+            else
+            {
+                var cs = arg.Value as ExcelDataProvider.IRangeInfo;
+                if (cs != null)
+                {
+                    foreach (var c in cs)
+                    {
+                        if (ShouldIgnore(c, context) == false)
+                        {
+                            CheckForAndHandleExcelError(c);
+                            retVal += System.Math.Pow(c.ValueDouble, 2);
+                        }
+                    }
+                }
+                else
+                {
+                    CheckForAndHandleExcelError(arg);
+                    if (IsNumericString(arg.Value) && !isInArray)
+                    {
+                        var value = ConvertUtil.GetValueDouble(arg.Value);
+                        return System.Math.Pow(value, 2);
+                    }
+                    var ignoreBool = isInArray;
+                    retVal += System.Math.Pow(ConvertUtil.GetValueDouble(arg.Value, ignoreBool), 2);
+                }
+            }
+            return retVal;
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Tan.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Tan.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Tan.cs	(revision 12707)
@@ -0,0 +1,42 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Math
+{
+    public class Tan : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1);
+            var arg = ArgToDecimal(arguments, 0);
+            return CreateResult(System.Math.Tan(arg), DataType.Decimal);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Tanh.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Tanh.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Tanh.cs	(revision 12707)
@@ -0,0 +1,42 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Math
+{
+    public class Tanh : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1);
+            var arg = ArgToDecimal(arguments, 0);
+            return CreateResult(System.Math.Tanh(arg), DataType.Decimal);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Trunc.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Trunc.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Trunc.cs	(revision 12707)
@@ -0,0 +1,49 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2014-01-06
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.Exceptions;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Math
+{
+    public class Trunc : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1);
+            var number = ArgToDecimal(arguments, 0);
+            if (arguments.Count() == 1)
+            {
+                return CreateResult(System.Math.Truncate(number), DataType.Decimal);
+            }
+            var nDigits = ArgToInt(arguments, 1);
+            var func = context.Configuration.FunctionRepository.GetFunction("rounddown");
+            return func.Execute(arguments, context);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Var.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Var.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/Var.cs	(revision 12707)
@@ -0,0 +1,46 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.Exceptions;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Math
+{
+    public class Var : HiddenValuesHandlingFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1);
+            var args = ArgsToDoubleEnumerable(IgnoreHiddenValues, false, arguments, context);
+            double avg = args.Average();
+            double d = args.Aggregate(0.0, (total, next) => total += System.Math.Pow(next - avg, 2));
+            var result = Divide(d, (args.Count() - 1));
+            return new CompileResult(result, DataType.Decimal);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/VarP.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/VarP.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Math/VarP.cs	(revision 12707)
@@ -0,0 +1,45 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Math
+{
+    public class VarP : HiddenValuesHandlingFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1);
+            var args = ArgsToDoubleEnumerable(IgnoreHiddenValues, false, arguments, context);
+            double avg = args.Average(); 
+            double d = args.Aggregate(0.0, (total, next) => total += System.Math.Pow(next - avg, 2)); 
+            var result = Divide(d, args.Count()); 
+            return new CompileResult(result, DataType.Decimal);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Numeric/CInt.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Numeric/CInt.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Numeric/CInt.cs	(revision 12707)
@@ -0,0 +1,43 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+using System.Globalization;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Numeric
+{
+    public class CInt : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1);
+            var num = ArgToDecimal(arguments, 0);
+            return CreateResult((int)System.Math.Floor(num), DataType.Integer);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/ObjectEnumerableArgConverter.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/ObjectEnumerableArgConverter.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/ObjectEnumerableArgConverter.cs	(revision 12707)
@@ -0,0 +1,58 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.Utils;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions
+{
+    public class ObjectEnumerableArgConverter : CollectionFlattener<object>
+    {
+        public virtual IEnumerable<object> ConvertArgs(bool ignoreHidden, IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            return base.FuncArgsToFlatEnumerable(arguments, (arg, argList) =>
+                {
+                    if (arg.Value is ExcelDataProvider.IRangeInfo)
+                    {
+                        foreach (var cell in (ExcelDataProvider.IRangeInfo)arg.Value)
+                        {
+                            if (!CellStateHelper.ShouldIgnore(ignoreHidden, cell, context))
+                            {
+                                argList.Add(cell.Value);
+                            }
+                        }
+                    }
+                    else
+                    {
+                       argList.Add(arg.Value);
+                    }
+                })
+            ;
+
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/RefAndLookup/Address.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/RefAndLookup/Address.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/RefAndLookup/Address.cs	(revision 12707)
@@ -0,0 +1,67 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+using OfficeOpenXml.FormulaParsing.ExcelUtilities;
+using OfficeOpenXml.FormulaParsing.Exceptions;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup
+{
+    public class Address : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 2);
+            var row = ArgToInt(arguments, 0);
+            var col = ArgToInt(arguments, 1);
+            ThrowExcelErrorValueExceptionIf(() => row < 0 && col < 0, eErrorType.Value);
+            var referenceType = ExcelReferenceType.AbsoluteRowAndColumn;
+            var worksheetSpec = string.Empty;
+            if (arguments.Count() > 2)
+            {
+                var arg3 = ArgToInt(arguments, 2);
+                ThrowExcelErrorValueExceptionIf(() => arg3 < 1 || arg3 > 4, eErrorType.Value);
+                referenceType = (ExcelReferenceType)ArgToInt(arguments, 2);
+            }
+            if (arguments.Count() > 3)
+            {
+                var fourthArg = arguments.ElementAt(3).Value;
+                if(fourthArg.GetType().Equals(typeof(bool)) && !(bool)fourthArg)
+                {
+                    throw new InvalidOperationException("Excelformulaparser does not support the R1C1 format!");
+                }
+                if (fourthArg.GetType().Equals(typeof(string)))
+                {
+                    worksheetSpec = fourthArg.ToString() + "!";
+                }
+            }
+            var translator = new IndexToAddressTranslator(context.ExcelDataProvider, referenceType);
+            return CreateResult(worksheetSpec + translator.ToAddress(col, row), DataType.ExcelAddress);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/RefAndLookup/ArrayLookupNavigator.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/RefAndLookup/ArrayLookupNavigator.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/RefAndLookup/ArrayLookupNavigator.cs	(revision 12707)
@@ -0,0 +1,78 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.Exceptions;
+using OfficeOpenXml.FormulaParsing.Utilities;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup
+{
+    public class ArrayLookupNavigator : LookupNavigator
+    {
+        private readonly FunctionArgument[] _arrayData;
+        private int _index = 0;
+        private object _currentValue;
+ 
+        public ArrayLookupNavigator(LookupDirection direction, LookupArguments arguments, ParsingContext parsingContext)
+            : base(direction, arguments, parsingContext)
+        {
+            Require.That(arguments).Named("arguments").IsNotNull();
+            Require.That(arguments.DataArray).Named("arguments.DataArray").IsNotNull();
+            _arrayData = arguments.DataArray.ToArray();
+            Initialize();
+        }
+
+        private void Initialize()
+        {
+            if (Arguments.LookupIndex >= _arrayData.Length)
+            {
+                throw new ExcelErrorValueException(eErrorType.Ref);
+            }
+            SetCurrentValue();
+
+        }
+
+        public override int Index
+        {
+            get { return _index; }
+        }
+
+        private void SetCurrentValue()
+        {
+            _currentValue = _arrayData[_index];
+        }
+
+        private bool HasNext()
+        {
+            if (Direction == LookupDirection.Vertical)
+            {
+                return _index < (_arrayData.Length - 1);
+            }
+            else
+            {
+                return false;
+            }
+        }
+
+        public override bool MoveNext()
+        {
+            if (!HasNext()) return false;
+            if (Direction == LookupDirection.Vertical)
+            {
+                _index++;
+            }
+            SetCurrentValue();
+            return true;
+        }
+
+        public override object CurrentValue
+        {
+            get { return _arrayData[_index].Value; }
+        }
+
+        public override object GetLookupValue()
+        {
+            return _arrayData[_index].Value;
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/RefAndLookup/Choose.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/RefAndLookup/Choose.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/RefAndLookup/Choose.cs	(revision 12707)
@@ -0,0 +1,47 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup
+{
+    public class Choose : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 2);
+            var index = ArgToInt(arguments, 0);
+            var items = new List<string>();
+            for (int x = 0; x < arguments.Count(); x++)
+            {
+                items.Add(arguments.ElementAt(x).ValueFirst.ToString());
+            }
+            return CreateResult(items[index], DataType.String);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/RefAndLookup/Column.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/RefAndLookup/Column.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/RefAndLookup/Column.cs	(revision 12707)
@@ -0,0 +1,52 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+using System.Text.RegularExpressions;
+using OfficeOpenXml.FormulaParsing.Utilities;
+using OfficeOpenXml.FormulaParsing.ExcelUtilities;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup
+{
+    public class Column : LookupFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            if (arguments == null || arguments.Count() == 0)
+            {
+                return CreateResult(context.Scopes.Current.Address.FromCol, DataType.Integer);
+            }
+            var rangeAddress = ArgToString(arguments, 0);
+            if (!ExcelAddressUtil.IsValidAddress(rangeAddress))
+                throw new ArgumentException("An invalid argument was supplied");
+            var factory = new RangeAddressFactory(context.ExcelDataProvider);
+            var address = factory.Create(rangeAddress);
+            return CreateResult(address.FromCol, DataType.Integer);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/RefAndLookup/Columns.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/RefAndLookup/Columns.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/RefAndLookup/Columns.cs	(revision 12707)
@@ -0,0 +1,59 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.Utilities;
+using System.Text.RegularExpressions;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+using OfficeOpenXml.FormulaParsing.ExcelUtilities;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup
+{
+    public class Columns : LookupFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1);
+            var r=arguments.ElementAt(0).ValueAsRangeInfo;
+            if (r != null)
+            {
+                return CreateResult(r.Address._toCol - r.Address._fromCol + 1, DataType.Integer);
+            }
+            else
+            {
+                var range = ArgToString(arguments, 0);
+                if (ExcelAddressUtil.IsValidAddress(range))
+                {
+                    var factory = new RangeAddressFactory(context.ExcelDataProvider);
+                    var address = factory.Create(range);
+                    return CreateResult(address.ToCol - address.FromCol + 1, DataType.Integer);
+                }
+            }
+            throw new ArgumentException("Invalid range supplied");
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/RefAndLookup/ExcelLookupNavigator.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/RefAndLookup/ExcelLookupNavigator.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/RefAndLookup/ExcelLookupNavigator.cs	(revision 12707)
@@ -0,0 +1,125 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.Utilities;
+using OfficeOpenXml.FormulaParsing.ExcelUtilities;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup
+{
+    public class ExcelLookupNavigator : LookupNavigator
+    {
+        private int _currentRow;
+        private int _currentCol;
+        private object _currentValue;
+        private RangeAddress _rangeAddress;
+        private int _index;
+
+        public ExcelLookupNavigator(LookupDirection direction, LookupArguments arguments, ParsingContext parsingContext)
+            : base(direction, arguments, parsingContext)
+        {
+            Initialize();
+        }
+
+        private void Initialize()
+        {
+            _index = 0;
+            var factory = new RangeAddressFactory(ParsingContext.ExcelDataProvider);
+            if (Arguments.RangeInfo == null)
+            {
+                _rangeAddress = factory.Create(ParsingContext.Scopes.Current.Address.Worksheet, Arguments.RangeAddress);
+            }
+            else
+            {
+                _rangeAddress = factory.Create(Arguments.RangeInfo.Address.WorkSheet, Arguments.RangeInfo.Address.Address);
+            }
+            _currentCol = _rangeAddress.FromCol;
+            _currentRow = _rangeAddress.FromRow;
+            SetCurrentValue();
+        }
+
+        private void SetCurrentValue()
+        {
+            _currentValue = ParsingContext.ExcelDataProvider.GetCellValue(_rangeAddress.Worksheet, _currentRow, _currentCol);
+        }
+
+        private bool HasNext()
+        {
+            if (Direction == LookupDirection.Vertical)
+            {
+                return _currentRow < _rangeAddress.ToRow;
+            }
+            else
+            {
+                return _currentCol < _rangeAddress.ToCol;
+            }
+        }
+
+        public override int Index
+        {
+            get { return _index; }
+        }
+
+        public override bool MoveNext()
+        {
+            if (!HasNext()) return false;
+            if (Direction == LookupDirection.Vertical)
+            {
+                _currentRow++;
+            }
+            else
+            {
+                _currentCol++;
+            }
+            _index++;
+            SetCurrentValue();
+            return true;
+        }
+
+        public override object CurrentValue
+        {
+            get { return _currentValue; }
+        }
+
+        public override object GetLookupValue()
+        {
+            var row = _currentRow;
+            var col = _currentCol;
+            if (Direction == LookupDirection.Vertical)
+            {
+                col += Arguments.LookupIndex - 1;
+                row += Arguments.LookupOffset;
+            }
+            else
+            {
+                row += Arguments.LookupIndex - 1;
+                col += Arguments.LookupOffset;
+            }
+            return ParsingContext.ExcelDataProvider.GetCellValue(_rangeAddress.Worksheet, row, col); 
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/RefAndLookup/HLookup.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/RefAndLookup/HLookup.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/RefAndLookup/HLookup.cs	(revision 12707)
@@ -0,0 +1,45 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+using OfficeOpenXml.FormulaParsing.Exceptions;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup
+{
+    public class HLookup : LookupFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 3);
+            var lookupArgs = new LookupArguments(arguments);
+            ThrowExcelErrorValueExceptionIf(() => lookupArgs.LookupIndex < 1, eErrorType.Value);
+            var navigator = LookupNavigatorFactory.Create(LookupDirection.Horizontal, lookupArgs, context);
+            return Lookup(navigator, lookupArgs);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/RefAndLookup/Index.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/RefAndLookup/Index.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/RefAndLookup/Index.cs	(revision 12707)
@@ -0,0 +1,56 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.Exceptions;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+using OfficeOpenXml.Utils;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup
+{
+    public class Index : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 2);
+            var arg1 = arguments.ElementAt(0);
+            var args = arg1.Value as IEnumerable<FunctionArgument>;
+            var crf = new CompileResultFactory();
+            if (args != null)
+            {
+                var index = ArgToInt(arguments, 1);
+                if (index > args.Count())
+                {
+                    throw new ExcelErrorValueException(eErrorType.Ref);
+                }
+                var candidate = args.ElementAt(index - 1);
+                //Commented JK-Can be any data type
+                //if (!IsNumber(candidate.Value))
+                //{
+                //    throw new ExcelErrorValueException(eErrorType.Value);
+                //}
+                //return CreateResult(ConvertUtil.GetValueDouble(candidate.Value), DataType.Decimal);
+                return crf.Create(candidate.Value);
+            }
+            if (arg1.IsExcelRange)
+            {
+                var row = ArgToInt(arguments, 1);                 
+                var col = arguments.Count()>2 ? ArgToInt(arguments, 2) : 1;
+                var ri=arg1.ValueAsRangeInfo;
+                if (row > ri.Address._toRow - ri.Address._fromRow + 1 ||
+                    col > ri.Address._toCol - ri.Address._fromCol + 1)
+                {
+                    ThrowExcelErrorValueException(eErrorType.Ref);
+                }
+                var candidate = ri.GetOffset(row-1, col-1);
+                //Commented JK-Can be any data type
+                //if (!IsNumber(candidate.Value))   
+                //{
+                //    throw new ExcelErrorValueException(eErrorType.Value);
+                //}
+                return crf.Create(candidate);
+            }
+            throw new NotImplementedException();
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/RefAndLookup/Indirect.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/RefAndLookup/Indirect.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/RefAndLookup/Indirect.cs	(revision 12707)
@@ -0,0 +1,53 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2014-04-13
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup
+{
+    public class Indirect : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1);
+            var address = ArgToString(arguments, 0);
+            var adr = new ExcelAddress(address);
+            var ws = adr.WorkSheet;
+            if (string.IsNullOrEmpty(ws))
+            {
+                ws = context.Scopes.Current.Address.Worksheet;
+            }
+            var result = context.ExcelDataProvider.GetRange(ws, adr._fromRow, adr._fromCol, address);
+            if (result.IsEmpty)
+            {
+                return CompileResult.Empty;
+            }
+            return new CompileResult(result, DataType.Enumerable);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/RefAndLookup/Lookup.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/RefAndLookup/Lookup.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/RefAndLookup/Lookup.cs	(revision 12707)
@@ -0,0 +1,98 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+using OfficeOpenXml.FormulaParsing.Utilities;
+using OfficeOpenXml.FormulaParsing.ExcelUtilities;
+using System.Text.RegularExpressions;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup
+{
+    public class Lookup : LookupFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 2);
+            if (HaveTwoRanges(arguments))
+            {
+                return HandleTwoRanges(arguments, context);
+            }
+            return HandleSingleRange(arguments, context);
+        }
+
+        private bool HaveTwoRanges(IEnumerable<FunctionArgument> arguments)
+        {
+            if (arguments.Count() == 2) return false;
+            return (ExcelAddressUtil.IsValidAddress(arguments.ElementAt(2).Value.ToString()));
+        }
+
+        private CompileResult HandleSingleRange(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            var searchedValue = arguments.ElementAt(0).Value;
+            Require.That(arguments.ElementAt(1).Value).Named("firstAddress").IsNotNull();
+            var firstAddress = ArgToString(arguments, 1);
+            var rangeAddressFactory = new RangeAddressFactory(context.ExcelDataProvider);
+            var address = rangeAddressFactory.Create(firstAddress);
+            var nRows = address.ToRow - address.FromRow;
+            var nCols = address.ToCol - address.FromCol;
+            var lookupIndex = nCols + 1;
+            var lookupDirection = LookupDirection.Vertical;
+            if (nCols > nRows)
+            {
+                lookupIndex = nRows + 1;
+                lookupDirection = LookupDirection.Horizontal;
+            }
+            var lookupArgs = new LookupArguments(searchedValue, firstAddress, lookupIndex, 0, true);
+            var navigator = LookupNavigatorFactory.Create(lookupDirection, lookupArgs, context);
+            return Lookup(navigator, lookupArgs);
+        }
+
+        private CompileResult HandleTwoRanges(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            var searchedValue = arguments.ElementAt(0).Value;
+            Require.That(arguments.ElementAt(1).Value).Named("firstAddress").IsNotNull();
+            Require.That(arguments.ElementAt(2).Value).Named("secondAddress").IsNotNull();
+            var firstAddress = ArgToString(arguments, 1);
+            var secondAddress = ArgToString(arguments, 2);
+            var rangeAddressFactory = new RangeAddressFactory(context.ExcelDataProvider);
+            var address1 = rangeAddressFactory.Create(firstAddress);
+            var address2 = rangeAddressFactory.Create(secondAddress);
+            var lookupIndex = (address2.FromCol - address1.FromCol) + 1;
+            var lookupOffset = address2.FromRow - address1.FromRow;
+            var lookupDirection = GetLookupDirection(address1);
+            if (lookupDirection == LookupDirection.Horizontal)
+            {
+                lookupIndex = (address2.FromRow - address1.FromRow) + 1;
+                lookupOffset = address2.FromCol - address1.FromCol;
+            }
+            var lookupArgs = new LookupArguments(searchedValue, firstAddress, lookupIndex, lookupOffset,  true);
+            var navigator = LookupNavigatorFactory.Create(lookupDirection, lookupArgs, context);
+            return Lookup(navigator, lookupArgs);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/RefAndLookup/LookupArguments.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/RefAndLookup/LookupArguments.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/RefAndLookup/LookupArguments.cs	(revision 12707)
@@ -0,0 +1,112 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup
+{
+    public class LookupArguments
+    {
+        public enum LookupArgumentDataType
+        {
+            ExcelRange,
+            DataArray
+        }
+
+        public LookupArguments(IEnumerable<FunctionArgument> arguments)
+            : this(arguments, new ArgumentParsers())
+        {
+
+        }
+
+        public LookupArguments(IEnumerable<FunctionArgument> arguments, ArgumentParsers argumentParsers)
+        {
+            _argumentParsers = argumentParsers;
+            SearchedValue = arguments.ElementAt(0).Value;
+            var arg1 = arguments.ElementAt(1).Value;
+            var dataArray = arg1 as IEnumerable<FunctionArgument>;
+            if (dataArray != null)
+            {
+                DataArray = dataArray;
+                ArgumentDataType = LookupArgumentDataType.DataArray;
+            }
+            else
+            {
+                //if (arg1 is ExcelDataProvider.INameInfo) arg1 = ((ExcelDataProvider.INameInfo) arg1).Value;
+                var rangeInfo = arg1 as ExcelDataProvider.IRangeInfo;
+                if (rangeInfo != null)
+                {
+                    RangeAddress = string.IsNullOrEmpty(rangeInfo.Address.WorkSheet) ? rangeInfo.Address.Address : "'" + rangeInfo.Address.WorkSheet + "'!" + rangeInfo.Address.Address;
+                    RangeInfo = rangeInfo;
+                    ArgumentDataType = LookupArgumentDataType.ExcelRange;
+                }
+                else
+                {
+                    RangeAddress = arg1.ToString();
+                    ArgumentDataType = LookupArgumentDataType.ExcelRange;
+                }  
+            }
+            LookupIndex = (int)_argumentParsers.GetParser(DataType.Integer).Parse(arguments.ElementAt(2).Value);
+            if (arguments.Count() > 3)
+            {
+                RangeLookup = (bool)_argumentParsers.GetParser(DataType.Boolean).Parse(arguments.ElementAt(3).Value);
+            }
+            else
+            {
+                RangeLookup = true;
+            }
+        }
+
+        public LookupArguments(object searchedValue, string rangeAddress, int lookupIndex, int lookupOffset, bool rangeLookup)
+        {
+            SearchedValue = searchedValue;
+            RangeAddress = rangeAddress;
+            LookupIndex = lookupIndex;
+            LookupOffset = lookupOffset;
+            RangeLookup = rangeLookup;
+        }
+
+        private readonly ArgumentParsers _argumentParsers;
+
+        public object SearchedValue { get; private set; }
+
+        public string RangeAddress { get; private set; }
+
+        public int LookupIndex { get; private set; }
+
+        public int LookupOffset { get; private set; }
+
+        public bool RangeLookup { get; private set; }
+
+        public IEnumerable<FunctionArgument> DataArray { get; private set; }
+
+        public ExcelDataProvider.IRangeInfo RangeInfo { get; private set; }
+
+        public LookupArgumentDataType ArgumentDataType { get; private set; } 
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/RefAndLookup/LookupDirection.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/RefAndLookup/LookupDirection.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/RefAndLookup/LookupDirection.cs	(revision 12707)
@@ -0,0 +1,37 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup
+{
+    public enum LookupDirection
+    {
+        Vertical,
+        Horizontal
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/RefAndLookup/LookupFunction.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/RefAndLookup/LookupFunction.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/RefAndLookup/LookupFunction.cs	(revision 12707)
@@ -0,0 +1,117 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExcelUtilities;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+using OfficeOpenXml.FormulaParsing.Exceptions;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup
+{
+    public abstract class LookupFunction : ExcelFunction
+    {
+        private readonly ValueMatcher _valueMatcher;
+        private readonly CompileResultFactory _compileResultFactory;
+
+        public LookupFunction()
+            : this(new LookupValueMatcher(), new CompileResultFactory())
+        {
+
+        }
+
+        public LookupFunction(ValueMatcher valueMatcher, CompileResultFactory compileResultFactory)
+        {
+            _valueMatcher = valueMatcher;
+            _compileResultFactory = compileResultFactory;
+        }
+
+        public override bool IsLookupFuction
+        {
+            get
+            {
+                return true;
+            }
+        }
+
+        protected int IsMatch(object o1, object o2)
+        {
+            return _valueMatcher.IsMatch(o1, o2);
+        }
+
+        protected LookupDirection GetLookupDirection(RangeAddress rangeAddress)
+        {
+            var nRows = rangeAddress.ToRow - rangeAddress.FromRow;
+            var nCols = rangeAddress.ToCol - rangeAddress.FromCol;
+            return nCols > nRows ? LookupDirection.Horizontal : LookupDirection.Vertical;
+        }
+
+        protected CompileResult Lookup(LookupNavigator navigator, LookupArguments lookupArgs)
+        {
+            object lastValue = null;
+            object lastLookupValue = null;
+            int? lastMatchResult = null;
+            if (lookupArgs.SearchedValue == null)
+            {
+                return new CompileResult(ExcelErrorValue.Create(eErrorType.NA), DataType.ExcelError);
+            }
+            do
+            {
+                var matchResult = IsMatch(navigator.CurrentValue, lookupArgs.SearchedValue);
+                if (matchResult != 0)
+                {
+                    if (lastValue != null && navigator.CurrentValue == null) break;
+                    
+                    if (lookupArgs.RangeLookup)
+                    {
+                        if (lastValue == null && matchResult > 0)
+                        {
+                            ThrowExcelErrorValueException(eErrorType.NA);
+                        }
+                        if (lastValue != null && matchResult > 0 && lastMatchResult < 0)
+                        {
+                            return _compileResultFactory.Create(lastLookupValue);
+                        }
+                        lastMatchResult = matchResult;
+                        lastValue = navigator.CurrentValue;
+                        lastLookupValue = navigator.GetLookupValue();
+                    }
+                }
+                else
+                {
+                    return _compileResultFactory.Create(navigator.GetLookupValue());
+                }
+            }
+            while (navigator.MoveNext());
+
+            if (lookupArgs.RangeLookup)
+            {
+                return _compileResultFactory.Create(lastLookupValue);
+            }
+            return new CompileResult(ExcelErrorValue.Create(eErrorType.NA), DataType.ExcelError);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/RefAndLookup/LookupNavigator.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/RefAndLookup/LookupNavigator.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/RefAndLookup/LookupNavigator.cs	(revision 12707)
@@ -0,0 +1,66 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.Utilities;
+using OfficeOpenXml.FormulaParsing.ExcelUtilities;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup
+{
+    public abstract class LookupNavigator
+    {
+        protected readonly LookupDirection Direction;
+        protected readonly LookupArguments Arguments;
+        protected readonly ParsingContext ParsingContext;
+
+
+
+        public LookupNavigator(LookupDirection direction, LookupArguments arguments, ParsingContext parsingContext)
+        {
+            Require.That(arguments).Named("arguments").IsNotNull();
+            Require.That(parsingContext).Named("parsingContext").IsNotNull();
+            Require.That(parsingContext.ExcelDataProvider).Named("parsingContext.ExcelDataProvider").IsNotNull();
+            Direction = direction;
+            Arguments = arguments;
+            ParsingContext = parsingContext;
+        }
+
+        public abstract int Index
+        {
+            get;
+        }
+
+        public abstract bool MoveNext();
+
+        public abstract object CurrentValue
+        {
+            get;
+        }
+
+        public abstract object GetLookupValue();
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/RefAndLookup/LookupNavigatorFactory.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/RefAndLookup/LookupNavigatorFactory.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/RefAndLookup/LookupNavigatorFactory.cs	(revision 12707)
@@ -0,0 +1,23 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup
+{
+    public static class LookupNavigatorFactory
+    {
+        public static LookupNavigator Create(LookupDirection direction, LookupArguments args, ParsingContext parsingContext)
+        {
+            if (args.ArgumentDataType == LookupArguments.LookupArgumentDataType.ExcelRange)
+            {
+                return new ExcelLookupNavigator(direction, args, parsingContext);
+            }
+            else if (args.ArgumentDataType == LookupArguments.LookupArgumentDataType.DataArray)
+            {
+                return new ArrayLookupNavigator(direction, args, parsingContext);
+            }
+            throw new NotSupportedException("Invalid argument datatype");
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/RefAndLookup/Match.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/RefAndLookup/Match.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/RefAndLookup/Match.cs	(revision 12707)
@@ -0,0 +1,105 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+using OfficeOpenXml.FormulaParsing.ExcelUtilities;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup
+{
+    public class Match : LookupFunction
+    {
+        private enum MatchType
+        {
+            ClosestAbove = -1,
+            ExactMatch = 0,
+            ClosestBelow = 1
+        }
+
+        public Match()
+            : base(new WildCardValueMatcher(), new CompileResultFactory())
+        {
+
+        }
+
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 2);
+
+            var searchedValue = arguments.ElementAt(0).Value;
+            var address = ArgToString(arguments, 1);
+            var rangeAddressFactory = new RangeAddressFactory(context.ExcelDataProvider);
+            var rangeAddress = rangeAddressFactory.Create(address);
+            var matchType = GetMatchType(arguments);
+            var args = new LookupArguments(searchedValue, address, 0, 0, false);
+            var lookupDirection = GetLookupDirection(rangeAddress);
+            var navigator = LookupNavigatorFactory.Create(lookupDirection, args, context);
+            int? lastMatchResult = default(int?);
+            do
+            {
+                var matchResult = IsMatch(navigator.CurrentValue, searchedValue);
+                if (matchType == MatchType.ClosestBelow && matchResult >= 0)
+                {
+                    if (!lastMatchResult.HasValue && matchResult > 0)
+                    {
+                        // TODO: error handling. This happens only if the first item is
+                        // below the searched value.
+                    }
+                    var index = matchResult == 0 ? navigator.Index + 1 : navigator.Index;
+                    return CreateResult(index, DataType.Integer);
+                }
+                if (matchType == MatchType.ClosestAbove && matchResult <= 0)
+                {
+                    if (!lastMatchResult.HasValue && matchResult < 0)
+                    {
+                        // TODO: error handling. This happens only if the first item is
+                        // above the searched value
+                    }
+                    var index = matchResult == 0 ? navigator.Index + 1 : navigator.Index;
+                    return CreateResult(index, DataType.Integer);
+                }
+                if (matchType == MatchType.ExactMatch && matchResult == 0)
+                {
+                    return CreateResult(navigator.Index + 1, DataType.Integer);
+                }
+                lastMatchResult = matchResult;
+            }
+            while (navigator.MoveNext());
+            return CreateResult(null, DataType.Integer);
+        }
+
+        private MatchType GetMatchType(IEnumerable<FunctionArgument> arguments)
+        {
+            var matchType = MatchType.ClosestBelow;
+            if (arguments.Count() > 2)
+            {
+                matchType = (MatchType)ArgToInt(arguments, 2);
+            }
+            return matchType;
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/RefAndLookup/Offset.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/RefAndLookup/Offset.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/RefAndLookup/Offset.cs	(revision 12707)
@@ -0,0 +1,80 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2015-01-11
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup
+{
+    public class Offset : LookupFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            var functionArguments = arguments as FunctionArgument[] ?? arguments.ToArray();
+            ValidateArguments(functionArguments, 3);
+            var startRange = ArgToString(functionArguments, 0);
+            var rowOffset = ArgToInt(functionArguments, 1);
+            var colOffset = ArgToInt(functionArguments, 2);
+            int width = 0, height = 0;
+            if (functionArguments.Length > 3)
+            {
+                height = ArgToInt(functionArguments, 3);
+                ThrowExcelErrorValueExceptionIf(() => height == 0, eErrorType.Ref);
+            }
+            if (functionArguments.Length > 4)
+            {
+                width = ArgToInt(functionArguments, 4);
+                ThrowExcelErrorValueExceptionIf(() => width == 0, eErrorType.Ref);
+            }
+
+            var adr = new ExcelAddress(startRange);
+            var ws = adr.WorkSheet;
+
+            var fromRow = adr._fromRow + rowOffset;
+            var fromCol = adr._fromCol + colOffset;
+            var toRow = (height != 0 ? height : adr._toRow) + rowOffset;
+            var toCol = (width != 0 ? width : adr._toCol) + colOffset;
+
+            var newRange = context.ExcelDataProvider.GetRange(ws, fromRow, fromCol, toRow, toCol);
+            if (!newRange.IsMulti)
+            {
+                if (newRange.IsEmpty) return CompileResult.Empty;
+                var val = newRange.GetValue(fromRow, fromCol);
+                if (IsNumeric(val))
+                {
+                    return CreateResult(val, DataType.Decimal);
+                }
+                if (val is ExcelErrorValue)
+                {
+                    return CreateResult(val, DataType.ExcelError);
+                }
+                return CreateResult(val, DataType.String);
+            }
+            return CreateResult(newRange, DataType.Enumerable);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/RefAndLookup/Row.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/RefAndLookup/Row.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/RefAndLookup/Row.cs	(revision 12707)
@@ -0,0 +1,52 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+using System.Text.RegularExpressions;
+using OfficeOpenXml.FormulaParsing.Utilities;
+using OfficeOpenXml.FormulaParsing.ExcelUtilities;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup
+{
+    public class Row : LookupFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            if (arguments == null || arguments.Count() == 0)
+            {
+                return CreateResult(context.Scopes.Current.Address.FromRow, DataType.Integer);
+            }
+            var rangeAddress = ArgToString(arguments, 0);
+            if (!ExcelAddressUtil.IsValidAddress(rangeAddress))
+                throw new ArgumentException("An invalid argument was supplied");
+            var factory = new RangeAddressFactory(context.ExcelDataProvider);
+            var address = factory.Create(rangeAddress);
+            return CreateResult(address.FromRow, DataType.Integer);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/RefAndLookup/Rows.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/RefAndLookup/Rows.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/RefAndLookup/Rows.cs	(revision 12707)
@@ -0,0 +1,59 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+using System.Text.RegularExpressions;
+using OfficeOpenXml.FormulaParsing.Utilities;
+using OfficeOpenXml.FormulaParsing.ExcelUtilities;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup
+{
+    public class Rows : LookupFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1);
+            var r=arguments.ElementAt(0).ValueAsRangeInfo;
+            if (r != null)
+            {
+                return CreateResult(r.Address._toRow - r.Address._fromRow + 1, DataType.Integer);
+            }
+            else
+            {
+                var range = ArgToString(arguments, 0);
+                if (ExcelAddressUtil.IsValidAddress(range))
+                {
+                    var factory = new RangeAddressFactory(context.ExcelDataProvider);
+                    var address = factory.Create(range);
+                    return CreateResult(address.ToRow - address.FromRow + 1, DataType.Integer);
+                }
+            }
+            throw new ArgumentException("Invalid range supplied");
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/RefAndLookup/VLookup.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/RefAndLookup/VLookup.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/RefAndLookup/VLookup.cs	(revision 12707)
@@ -0,0 +1,57 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+using OfficeOpenXml.FormulaParsing.ExcelUtilities;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup
+{
+    public class VLookup : LookupFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            Stopwatch sw = null;
+            if (context.Debug)
+            {
+                sw = new Stopwatch();
+                sw.Start();
+            }
+            ValidateArguments(arguments, 3);
+            var lookupArgs = new LookupArguments(arguments);
+            var navigator = LookupNavigatorFactory.Create(LookupDirection.Vertical, lookupArgs, context);
+            var result = Lookup(navigator, lookupArgs);
+            if (context.Debug)
+            {
+                sw.Stop();
+                context.Configuration.Logger.LogFunction("VLOOKUP", sw.ElapsedMilliseconds);
+            }
+            return result;
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Text/CStr.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Text/CStr.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Text/CStr.cs	(revision 12707)
@@ -0,0 +1,41 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Text
+{
+    public class CStr : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1);
+            return CreateResult(ArgToString(arguments, 0), DataType.String);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Text/CharFunction.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Text/CharFunction.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Text/CharFunction.cs	(revision 12707)
@@ -0,0 +1,19 @@
+﻿using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Text
+{
+    public class CharFunction : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1);
+            var number = ArgToInt(arguments, 0);
+            ThrowExcelErrorValueExceptionIf(() => number < 1 || number > 255, eErrorType.Value);
+            return CreateResult(((char) number).ToString(), DataType.String);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Text/Concatenate.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Text/Concatenate.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Text/Concatenate.cs	(revision 12707)
@@ -0,0 +1,53 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Text
+{
+    public class Concatenate : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            if (arguments == null)
+            {
+                return CreateResult(string.Empty, DataType.String);
+            }
+            var sb = new StringBuilder();
+            foreach (var arg in arguments)
+            {
+                var v = arg.ValueFirst;
+                if (v != null)
+                {
+                    sb.Append(v);
+                }
+            }
+            return CreateResult(sb.ToString(), DataType.String);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Text/Exact.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Text/Exact.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Text/Exact.cs	(revision 12707)
@@ -0,0 +1,54 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Text
+{
+    public class Exact : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 2);
+            var val1 = arguments.ElementAt(0).ValueFirst;
+            var val2 = arguments.ElementAt(1).ValueFirst;
+
+            if (val1 == null && val2 == null)
+            {
+                return CreateResult(true, DataType.Boolean);
+            }
+            else if ((val1 == null && val2 != null) || (val1 != null && val2 == null))
+            {
+                return CreateResult(false, DataType.Boolean);
+            }
+
+            var result = string.Compare(val1.ToString(), val2.ToString(), StringComparison.InvariantCulture);
+            return CreateResult(result == 0, DataType.Boolean);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Text/Find.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Text/Find.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Text/Find.cs	(revision 12707)
@@ -0,0 +1,56 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.Exceptions;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Text
+{
+    public class Find : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            var functionArguments = arguments as FunctionArgument[] ?? arguments.ToArray();
+            ValidateArguments(functionArguments, 2);
+            var search = ArgToString(functionArguments, 0);
+            var searchIn = ArgToString(functionArguments, 1);
+            var startIndex = 0;
+            if (functionArguments.Count() > 2)
+            {
+                startIndex = ArgToInt(functionArguments, 2);
+            }
+            var result = searchIn.IndexOf(search, startIndex, System.StringComparison.Ordinal);
+            if (result == -1)
+            {
+                throw new ExcelErrorValueException(ExcelErrorValue.Create(eErrorType.Value));
+            }
+            // Adding 1 because Excel uses 1-based index
+            return CreateResult(result + 1, DataType.Integer);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Text/Fixed.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Text/Fixed.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Text/Fixed.cs	(revision 12707)
@@ -0,0 +1,37 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Text
+{
+    public class Fixed : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1);
+            var number = ArgToDecimal(arguments, 0);
+            var nDecimals = 2;
+            var noCommas = false;
+            if (arguments.Count() > 1)
+            {
+                nDecimals = ArgToInt(arguments, 1);
+            }
+            if (arguments.Count() > 2)
+            {
+                noCommas = ArgToBool(arguments, 2);
+            }
+            var format = (noCommas ? "F" : "N") + nDecimals.ToString(CultureInfo.InvariantCulture);
+            if (nDecimals < 0)
+            {
+                number = number - (number % (System.Math.Pow(10, nDecimals * -1)));
+                number = System.Math.Floor(number);
+                format = noCommas ? "F0" : "N0";
+            }
+            var retVal = number.ToString(format);
+            return CreateResult(retVal, DataType.String);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Text/Hyperlink.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Text/Hyperlink.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Text/Hyperlink.cs	(revision 12707)
@@ -0,0 +1,45 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2015-01-10
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Text
+{
+    public class Hyperlink : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1);
+            if (arguments.Count() > 1)
+            {
+                return CreateResult(ArgToString(arguments, 1), DataType.String);
+            }
+            return CreateResult(ArgToString(arguments, 0), DataType.String);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Text/Left.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Text/Left.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Text/Left.cs	(revision 12707)
@@ -0,0 +1,43 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Text
+{
+    public class Left : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 2);
+            var str = ArgToString(arguments, 0);
+            var length = ArgToInt(arguments, 1);
+            return CreateResult(str.Substring(0, length), DataType.String);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Text/Len.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Text/Len.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Text/Len.cs	(revision 12707)
@@ -0,0 +1,42 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Text
+{
+    public class Len : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1);
+            var length = arguments.First().ValueFirst.ToString().Length;
+            return CreateResult(Convert.ToDouble(length), DataType.Integer);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Text/Lower.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Text/Lower.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Text/Lower.cs	(revision 12707)
@@ -0,0 +1,41 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Text
+{
+    public class Lower : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1);
+            return CreateResult(arguments.First().ValueFirst.ToString().ToLower(), DataType.String);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Text/Mid.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Text/Mid.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Text/Mid.cs	(revision 12707)
@@ -0,0 +1,57 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Text
+{
+    public class Mid : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 3);
+            var text = ArgToString(arguments, 0);
+            var startIx = ArgToInt(arguments, 1);
+            var length = ArgToInt(arguments, 2);
+            if(startIx<=0)
+            {
+                throw(new ArgumentException("Argument start can't be less than 1"));
+            }
+            //Allow overflowing start and length
+            if (startIx > text.Length)
+            {
+                return CreateResult("", DataType.String);
+            }
+            else
+            {
+                var result = text.Substring(startIx - 1, startIx - 1 + length < text.Length ? length : text.Length - startIx + 1);
+                return CreateResult(result, DataType.String);
+            }
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Text/Proper.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Text/Proper.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Text/Proper.cs	(revision 12707)
@@ -0,0 +1,57 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Text
+{
+    public class Proper : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1);
+            var text = ArgToString(arguments, 0).ToLower(CultureInfo.InvariantCulture);
+            var sb = new StringBuilder();
+            var previousChar = '.';
+            foreach (var ch in text)
+            {
+                if (!char.IsLetter(previousChar))
+                {
+                    sb.Append(ch.ToString(CultureInfo.InvariantCulture).ToUpperInvariant());
+                }
+                else
+                {
+                    sb.Append(ch);
+                }
+                previousChar = ch;
+            }
+            return CreateResult(sb.ToString(), DataType.String);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Text/Replace.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Text/Replace.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Text/Replace.cs	(revision 12707)
@@ -0,0 +1,60 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Text
+{
+    public class Replace : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 4);
+            var oldText = ArgToString(arguments, 0);
+            var startPos = ArgToInt(arguments, 1);
+            var nCharsToReplace = ArgToInt(arguments, 2);
+            var newText = ArgToString(arguments, 3);
+            var firstPart = GetFirstPart(oldText, startPos);
+            var lastPart = GetLastPart(oldText, startPos, nCharsToReplace);
+            var result = string.Concat(firstPart, newText, lastPart);
+            return CreateResult(result, DataType.String);
+        }
+
+        private string GetFirstPart(string text, int startPos)
+        {
+            return text.Substring(0, startPos - 1);
+        }
+
+        private string GetLastPart(string text, int startPos, int nCharactersToReplace)
+        {
+            int startIx = startPos -1;
+            startIx += nCharactersToReplace;
+            return text.Substring(startIx, text.Length - startIx);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Text/Rept.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Text/Rept.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Text/Rept.cs	(revision 12707)
@@ -0,0 +1,48 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2015-01-10
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Text
+{
+    public class Rept : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 2);
+            var str = ArgToString(arguments, 0);
+            var n = ArgToInt(arguments, 1);
+            var sb = new StringBuilder();
+            for (var x = 0; x < n; x++)
+            {
+                sb.Append(str);
+            }
+            return CreateResult(sb.ToString(), DataType.String);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Text/Right.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Text/Right.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Text/Right.cs	(revision 12707)
@@ -0,0 +1,44 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Text
+{
+    public class Right : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 2);
+            var str = ArgToString(arguments, 0);
+            var length = ArgToInt(arguments, 1);
+            var startIx = str.Length - length;
+            return CreateResult(str.Substring(startIx, str.Length - startIx), DataType.String);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Text/Substitute.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Text/Substitute.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Text/Substitute.cs	(revision 12707)
@@ -0,0 +1,45 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Text
+{
+    public class Substitute : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 3);
+            var text = ArgToString(arguments, 0);
+            var find = ArgToString(arguments, 1);
+            var replaceWith = ArgToString(arguments, 2);
+            var result = text.Replace(find, replaceWith);
+            return CreateResult(result, DataType.String);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Text/T.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Text/T.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Text/T.cs	(revision 12707)
@@ -0,0 +1,43 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Text
+{
+    public class T : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1);
+            var val = arguments.ElementAt(0).ValueFirst;
+            if (val is string) return CreateResult(val, DataType.String);
+            return CreateResult(string.Empty, DataType.String);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Text/Text.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Text/Text.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Text/Text.cs	(revision 12707)
@@ -0,0 +1,48 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Jan Källman   		            Added		                2014-01-17
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Text
+{
+    public class Text : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 2);
+            var value = arguments.First().ValueFirst;
+            var format = ArgToString(arguments, 1);
+            format = format.Replace(System.Globalization.CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator, ".");
+            format = format.Replace(System.Globalization.CultureInfo.CurrentCulture.NumberFormat.NumberGroupSeparator.Replace((char)160,' '), ","); //Special handling for No-Break Space
+
+            var result = context.ExcelDataProvider.GetFormat(value, format);
+
+            return CreateResult(result, DataType.String);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Text/Upper.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Text/Upper.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/Text/Upper.cs	(revision 12707)
@@ -0,0 +1,41 @@
+﻿/* Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Mats Alm   		                Added		                2013-12-03
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Text
+{
+    public class Upper : ExcelFunction
+    {
+        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
+        {
+            ValidateArguments(arguments, 1);
+            return CreateResult(arguments.First().ValueFirst.ToString().ToUpper(), DataType.String);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Operators/IOperator.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Operators/IOperator.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Operators/IOperator.cs	(revision 12707)
@@ -0,0 +1,47 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Operators
+{
+    public interface IOperator
+    {
+        Operators Operator { get; }
+
+        CompileResult Apply(CompileResult left, CompileResult right);
+
+        int Precedence { get; }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Operators/Operator.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Operators/Operator.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Operators/Operator.cs	(revision 12707)
@@ -0,0 +1,395 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+using OfficeOpenXml.FormulaParsing.Exceptions;
+using OfficeOpenXml.Utils;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Operators
+{
+    public class Operator : IOperator
+    {
+        private const int PrecedencePercent = 2;
+        private const int PrecedenceExp = 4;
+        private const int PrecedenceMultiplyDevide = 6;
+        private const int PrecedenceIntegerDivision = 8;
+        private const int PrecedenceModulus = 10;
+        private const int PrecedenceAddSubtract = 12;
+        private const int PrecedenceConcat = 15;
+        private const int PrecedenceComparison = 25;
+
+        private Operator() { }
+
+        private Operator(Operators @operator, int precedence, Func<CompileResult, CompileResult, CompileResult> implementation)
+        {
+            _implementation = implementation;
+            _precedence = precedence;
+            _operator = @operator;
+        }
+
+        private readonly Func<CompileResult, CompileResult, CompileResult> _implementation;
+        private readonly int _precedence;
+        private readonly Operators _operator;
+
+        int IOperator.Precedence
+        {
+            get { return _precedence; }
+        }
+
+        Operators IOperator.Operator
+        {
+            get { return _operator; }
+        }
+
+        public CompileResult Apply(CompileResult left, CompileResult right)
+        {
+            if (left.Result is ExcelErrorValue)
+            {
+                return new CompileResult(left.Result, DataType.ExcelError);
+                //throw(new ExcelErrorValueException((ExcelErrorValue)left.Result));
+            }
+            else if (right.Result is ExcelErrorValue)
+            {
+                return new CompileResult(right.Result, DataType.ExcelError);
+                //throw(new ExcelErrorValueException((ExcelErrorValue)right.Result));
+            }
+            return _implementation(left, right);
+        }
+
+        public override string ToString()
+        {
+            return "Operator: " + _operator;
+        }
+
+        private static IOperator _plus;
+        public static IOperator Plus
+        {
+            get
+            {
+                return _plus ?? (_plus = new Operator(Operators.Plus, PrecedenceAddSubtract, (l, r) =>
+                {
+                    l = l == null || l.Result == null ? new CompileResult(0, DataType.Integer) : l;
+                    r = r == null || r.Result == null ? new CompileResult(0, DataType.Integer) : r;
+                    ExcelErrorValue errorVal;
+                    if (EitherIsError(l, r, out errorVal))
+                    {
+                        return new CompileResult(errorVal);
+                    }
+                    if (l.DataType == DataType.Integer && r.DataType == DataType.Integer)
+                    {
+                        return new CompileResult(l.ResultNumeric + r.ResultNumeric, DataType.Integer);
+                    }
+                    else if ((l.IsNumeric || l.IsNumericString || l.Result is ExcelDataProvider.IRangeInfo) &&
+                             (r.IsNumeric || r.IsNumericString || r.Result is ExcelDataProvider.IRangeInfo))
+                    {
+                        return new CompileResult(l.ResultNumeric + r.ResultNumeric, DataType.Decimal);
+                    }
+                    return new CompileResult(eErrorType.Value);
+                }));
+            }
+        }
+
+        private static IOperator _minus;
+        public static IOperator Minus
+        {
+            get
+            {
+                return _minus ?? (_minus = new Operator(Operators.Minus, PrecedenceAddSubtract, (l, r) =>
+                {
+                    l = l == null || l.Result == null ? new CompileResult(0, DataType.Integer) : l;
+                    r = r == null || r.Result == null ? new CompileResult(0, DataType.Integer) : r;
+                    if (l.DataType == DataType.Integer && r.DataType == DataType.Integer)
+                    {
+                        return new CompileResult(l.ResultNumeric - r.ResultNumeric, DataType.Integer);
+                    }
+                    else if ((l.IsNumeric || l.IsNumericString || l.Result is ExcelDataProvider.IRangeInfo) &&
+                             (r.IsNumeric || r.IsNumericString || r.Result is ExcelDataProvider.IRangeInfo))
+                    {
+                        return new CompileResult(l.ResultNumeric - r.ResultNumeric, DataType.Decimal);
+                    }
+
+                    return new CompileResult(eErrorType.Value);
+                }));
+            }
+        }
+
+        private static IOperator _multiply;
+        public static IOperator Multiply
+        {
+            get
+            {
+                return _multiply ?? (_multiply = new Operator(Operators.Multiply, PrecedenceMultiplyDevide, (l, r) =>
+                {
+                    l = l ?? new CompileResult(0, DataType.Integer);
+                    r = r ?? new CompileResult(0, DataType.Integer);
+                    if (l.DataType == DataType.Integer && r.DataType == DataType.Integer)
+                    {
+                        return new CompileResult(l.ResultNumeric*r.ResultNumeric, DataType.Integer);
+                    }
+                    else if ((l.IsNumeric || l.IsNumericString || l.Result is ExcelDataProvider.IRangeInfo) &&
+                             (r.IsNumeric || r.IsNumericString || r.Result is ExcelDataProvider.IRangeInfo))
+                    {
+                        return new CompileResult(l.ResultNumeric*r.ResultNumeric, DataType.Decimal);
+                    }
+                    return new CompileResult(eErrorType.Value);
+                }));
+            }
+        }
+
+        private static IOperator _divide;
+        public static IOperator Divide
+        {
+            get
+            {
+                return _divide ?? (_divide = new Operator(Operators.Divide, PrecedenceMultiplyDevide, (l, r) =>
+                {
+                    if (!(l.IsNumeric || l.IsNumericString || l.Result is ExcelDataProvider.IRangeInfo) ||
+                        !(r.IsNumeric || r.IsNumericString || r.Result is ExcelDataProvider.IRangeInfo))
+                    {
+                        return new CompileResult(eErrorType.Value);
+                    }
+                    var left = l.ResultNumeric;
+                    var right = r.ResultNumeric;
+                    if (Math.Abs(right - 0d) < double.Epsilon)
+                    {
+                        return new CompileResult(eErrorType.Div0);
+                    }
+                    else if ((l.IsNumeric || l.IsNumericString || l.Result is ExcelDataProvider.IRangeInfo) &&
+                             (r.IsNumeric || r.IsNumericString || r.Result is ExcelDataProvider.IRangeInfo))
+                    {
+                        return new CompileResult(left/right, DataType.Decimal);
+                    }
+                    return new CompileResult(eErrorType.Value);
+                }));
+            }
+        }
+
+        public static IOperator Exp
+        {
+            get
+            {
+                return new Operator(Operators.Exponentiation, PrecedenceExp, (l, r) =>
+                    {
+                        if (l == null && r == null)
+                        {
+                            return new CompileResult(eErrorType.Value);
+                        }
+                        l = l ?? new CompileResult(0, DataType.Integer);
+                        r = r ?? new CompileResult(0, DataType.Integer);
+                        if ((l.IsNumeric || l.Result is ExcelDataProvider.IRangeInfo) && (r.IsNumeric || r.Result is ExcelDataProvider.IRangeInfo))
+                        {
+                            return new CompileResult(Math.Pow(l.ResultNumeric, r.ResultNumeric), DataType.Decimal);
+                        }
+                        return new CompileResult(0d, DataType.Decimal);
+                    });
+            }
+        }
+
+        public static IOperator Concat
+        {
+            get
+            {
+                return new Operator(Operators.Concat, PrecedenceConcat, (l, r) =>
+                    {
+                        l = l ?? new CompileResult(string.Empty, DataType.String);
+                        r = r ?? new CompileResult(string.Empty, DataType.String);
+                        var lStr = l.Result != null ? l.ResultValue.ToString() : string.Empty;
+                        var rStr = r.Result != null ? r.ResultValue.ToString() : string.Empty;
+                        return new CompileResult(string.Concat(lStr, rStr), DataType.String);
+                    });
+            }
+        }
+
+        private static IOperator _greaterThan;
+        public static IOperator GreaterThan
+        {
+            get
+            {
+                //return new Operator(Operators.GreaterThan, PrecedenceComparison, (l, r) => new CompileResult(Compare(l, r) > 0, DataType.Boolean));
+                return _greaterThan ??
+                       (_greaterThan =
+                           new Operator(Operators.LessThanOrEqual, PrecedenceComparison,
+                               (l, r) => Compare(l, r, (compRes) => compRes > 0)));
+            }
+        }
+
+        private static IOperator _eq;
+        public static IOperator Eq
+        {
+            get
+            {
+                //return new Operator(Operators.Equals, PrecedenceComparison, (l, r) => new CompileResult(Compare(l, r) == 0, DataType.Boolean));
+                return _eq ??
+                       (_eq =
+                           new Operator(Operators.LessThanOrEqual, PrecedenceComparison,
+                               (l, r) => Compare(l, r, (compRes) => compRes == 0)));
+            }
+        }
+
+        private static IOperator _notEqualsTo;
+        public static IOperator NotEqualsTo
+        {
+            get
+            {
+                //return new Operator(Operators.NotEqualTo, PrecedenceComparison, (l, r) => new CompileResult(Compare(l, r) != 0, DataType.Boolean));
+                return _notEqualsTo ??
+                       (_notEqualsTo =
+                           new Operator(Operators.LessThanOrEqual, PrecedenceComparison,
+                               (l, r) => Compare(l, r, (compRes) => compRes != 0)));
+            }
+        }
+
+        private static IOperator _greaterThanOrEqual;
+        public static IOperator GreaterThanOrEqual
+        {
+            get
+            {
+                //return new Operator(Operators.GreaterThanOrEqual, PrecedenceComparison, (l, r) => new CompileResult(Compare(l, r) >= 0, DataType.Boolean));
+                return _greaterThanOrEqual ??
+                       (_greaterThanOrEqual =
+                           new Operator(Operators.LessThanOrEqual, PrecedenceComparison,
+                               (l, r) => Compare(l, r, (compRes) => compRes >= 0)));
+            }
+        }
+
+        private static IOperator _lessThan;
+        public static IOperator LessThan
+        {
+            get
+            {
+                //return new Operator(Operators.LessThan, PrecedenceComparison, (l, r) => new CompileResult(Compare(l, r) < 0, DataType.Boolean));
+                return _lessThan ??
+                       (_lessThan =
+                           new Operator(Operators.LessThanOrEqual, PrecedenceComparison,
+                               (l, r) => Compare(l, r, (compRes) => compRes < 0)));
+            }
+        }
+
+        public static IOperator LessThanOrEqual
+        {
+            get
+            {
+                //return new Operator(Operators.LessThanOrEqual, PrecedenceComparison, (l, r) => new CompileResult(Compare(l, r) <= 0, DataType.Boolean));
+                return new Operator(Operators.LessThanOrEqual, PrecedenceComparison, (l, r) => Compare(l, r, (compRes) => compRes <= 0));
+            }
+        }
+
+        private static IOperator _percent;
+        public static IOperator Percent
+        {
+            get
+            {
+                if (_percent == null)
+                {
+                    _percent = new Operator(Operators.Percent, PrecedencePercent, (l, r) =>
+                        {
+                            l = l ?? new CompileResult(0, DataType.Integer);
+                            r = r ?? new CompileResult(0, DataType.Integer);
+                            if (l.DataType == DataType.Integer && r.DataType == DataType.Integer)
+                            {
+                                return new CompileResult(l.ResultNumeric * r.ResultNumeric, DataType.Integer);
+                            }
+                            else if ((l.IsNumeric || l.Result is ExcelDataProvider.IRangeInfo) && (r.IsNumeric || r.Result is ExcelDataProvider.IRangeInfo))
+                            {
+                                return new CompileResult(l.ResultNumeric * r.ResultNumeric, DataType.Decimal);
+                            }
+                            return new CompileResult(eErrorType.Value);
+                        });
+                }
+                return _percent;
+            }
+        }
+
+        private static object GetObjFromOther(CompileResult obj, CompileResult other)
+        {
+            if (obj.Result == null)
+            {
+                if (other.DataType == DataType.String) return string.Empty;
+                else return 0d;
+            }
+            return obj.ResultValue;
+        }
+
+        private static CompileResult Compare(CompileResult l, CompileResult r, Func<int, bool> comparison )
+        {
+            ExcelErrorValue errorVal;
+            if (EitherIsError(l, r, out errorVal))
+            {
+                return new CompileResult(errorVal);
+            }
+            object left, right;
+            left = GetObjFromOther(l, r);
+            right = GetObjFromOther(r, l);
+            if (ConvertUtil.IsNumeric(left) && ConvertUtil.IsNumeric(right))
+            {
+                var lnum = ConvertUtil.GetValueDouble(left);
+                var rnum = ConvertUtil.GetValueDouble(right);
+                if (Math.Abs(lnum - rnum) < double.Epsilon)
+                {
+                    return new CompileResult(comparison(0), DataType.Boolean);
+                }
+                var comparisonResult = lnum.CompareTo(rnum);
+                return new CompileResult(comparison(comparisonResult), DataType.Boolean);
+            }
+            else
+            {
+                var comparisonResult = CompareString(left, right);
+                return new CompileResult(comparison(comparisonResult), DataType.Boolean);
+            }
+        }
+
+        private static int CompareString(object l, object r)
+        {
+            var sl = (l ?? "").ToString();
+            var sr = (r ?? "").ToString();
+            return System.String.Compare(sl, sr, System.StringComparison.Ordinal);
+        }
+
+        private static bool  EitherIsError(CompileResult l, CompileResult r, out ExcelErrorValue errorVal)
+        {
+            if (l.DataType == DataType.ExcelError)
+            {
+                errorVal = (ExcelErrorValue) l.Result;
+                return true;
+            }
+            if (r.DataType == DataType.ExcelError)
+            {
+                errorVal = (ExcelErrorValue) r.Result;
+                return true;
+            }
+            errorVal = null;
+            return false;
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Operators/Operators.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Operators/Operators.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Operators/Operators.cs	(revision 12707)
@@ -0,0 +1,57 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Operators
+{
+    public enum Operators
+    {
+        Undefined,
+        Concat,
+        Plus,
+        Minus,
+        Multiply,
+        Divide,
+        Modulus,
+        Percent,
+        Equals,
+        GreaterThan,
+        GreaterThanOrEqual,
+        LessThan,
+        LessThanOrEqual,
+        NotEqualTo,
+        IntegerDivision,
+        Exponentiation
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Operators/OperatorsDict.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Operators/OperatorsDict.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Operators/OperatorsDict.cs	(revision 12707)
@@ -0,0 +1,70 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing.Excel.Operators
+{
+    public class OperatorsDict : Dictionary<string, IOperator>
+    {
+        public OperatorsDict()
+        {
+            Add("+", Operator.Plus);
+            Add("-", Operator.Minus);
+            Add("*", Operator.Multiply);
+            Add("/", Operator.Divide);
+            Add("^", Operator.Exp);
+            Add("=", Operator.Eq);
+            Add(">", Operator.GreaterThan);
+            Add(">=", Operator.GreaterThanOrEqual);
+            Add("<", Operator.LessThan);
+            Add("<=", Operator.LessThanOrEqual);
+            Add("<>", Operator.NotEqualsTo);
+            Add("&", Operator.Concat);
+        }
+
+        private static IDictionary<string, IOperator> _instance;
+
+        public static IDictionary<string, IOperator> Instance
+        {
+            get 
+            {
+                if (_instance == null)
+                {
+                    _instance = new OperatorsDict();
+                }
+                return _instance;
+            }
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExcelCalculationOption.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExcelCalculationOption.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExcelCalculationOption.cs	(revision 12707)
@@ -0,0 +1,16 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing
+{
+    public class ExcelCalculationOption
+    {
+        public ExcelCalculationOption()
+        {
+            AllowCirculareReferences = false;
+        }
+        public bool AllowCirculareReferences { get; set; }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExcelCell.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExcelCell.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExcelCell.cs	(revision 12707)
@@ -0,0 +1,26 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing
+{
+    public class ExcelCell
+    {
+        public ExcelCell(object val, string formula, int colIndex, int rowIndex)
+        {
+            Value = val;
+            Formula = formula;
+            ColIndex = colIndex;
+            RowIndex = rowIndex;
+        }
+
+        public int ColIndex { get; private set; }
+
+        public int RowIndex { get; private set; }
+
+        public object Value { get; private set; }
+
+        public string Formula { get; private set; }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExcelDataProvider.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExcelDataProvider.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExcelDataProvider.cs	(revision 12707)
@@ -0,0 +1,131 @@
+﻿using OfficeOpenXml.FormulaParsing.LexicalAnalysis;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing
+{
+    /// <summary>
+    /// This class should be implemented to be able to deliver excel data
+    /// to the formula parser.
+    /// </summary>
+    public abstract class ExcelDataProvider : IDisposable
+    {
+        /// <summary>
+        /// A range of cells in a worksheet.
+        /// </summary>
+        public interface IRangeInfo : IEnumerator<ICellInfo>, IEnumerable<ICellInfo>
+        {
+            bool IsEmpty { get; }
+            bool IsMulti { get; }
+            int GetNCells();
+            ExcelAddressBase Address { get; }
+            object GetValue(int row, int col);
+            object GetOffset(int rowOffset, int colOffset);
+
+            ExcelWorksheet Worksheet { get; }
+        }
+        /// <summary>
+        /// Information and help methods about a cell
+        /// </summary>
+        public interface ICellInfo
+        {
+            string Address { get; }
+            int Row { get; }
+            int Column { get; }
+            string Formula { get;  }
+            object Value { get; }
+            double ValueDouble { get; }
+            double ValueDoubleLogical { get; }
+            bool IsHiddenRow { get; }
+            bool IsExcelError { get; }
+            IList<Token> Tokens { get; }   
+        }
+        public interface INameInfo
+        {
+            ulong Id { get; set; }
+            string Worksheet {get; set;}
+            string Name { get; set; }
+            string Formula { get; set; }
+            IList<Token> Tokens { get; }
+            object Value { get; set; }
+        }
+        /// <summary>
+        /// Returns the names of all worksheet names
+        /// </summary>
+        /// <returns></returns>
+        public abstract ExcelNamedRangeCollection GetWorksheetNames(string worksheet);
+        /// <summary>
+        /// Returns all defined names in a workbook
+        /// </summary>
+        /// <returns></returns>
+        public abstract ExcelNamedRangeCollection GetWorkbookNameValues();
+        /// <summary>
+        /// Returns values from the required range.
+        /// </summary>
+        /// <param name="worksheetName">The name of the worksheet</param>
+        /// <param name="row">Row</param>
+        /// <param name="column">Column</param>
+        /// <param name="address">The reference address</param>
+        /// <returns></returns>
+        public abstract IRangeInfo GetRange(string worksheetName, int row, int column, string address);
+        public abstract INameInfo GetName(string worksheet, string name);
+
+        public abstract IEnumerable<object> GetRangeValues(string address);
+
+        public abstract string GetRangeFormula(string worksheetName, int row, int column);
+        public abstract List<Token> GetRangeFormulaTokens(string worksheetName, int row, int column);
+        public abstract bool IsRowHidden(string worksheetName, int row);
+        ///// <summary>
+        ///// Returns a single cell value
+        ///// </summary>
+        ///// <param name="address"></param>
+        ///// <returns></returns>
+        //public abstract object GetCellValue(int sheetID, string address);
+
+        /// <summary>
+        /// Returns a single cell value
+        /// </summary>
+        /// <param name="sheetName"></param>
+        /// <param name="row"></param>
+        /// <param name="col"></param>
+        /// <returns></returns>
+        public abstract object GetCellValue(string sheetName, int row, int col);
+
+        ///// <summary>
+        ///// Sets the value on the cell
+        ///// </summary>
+        ///// <param name="address"></param>
+        ///// <param name="value"></param>
+        //public abstract void SetCellValue(string address, object value);
+
+        /// <summary>
+        /// Returns the address of the lowest rightmost cell on the worksheet.
+        /// </summary>
+        /// <param name="worksheet"></param>
+        /// <returns></returns>
+        public abstract ExcelCellAddress GetDimensionEnd(string worksheet);
+
+        /// <summary>
+        /// Use this method to free unmanaged resources.
+        /// </summary>
+        public abstract void Dispose();
+
+        /// <summary>
+        /// Max number of columns in a worksheet that the Excel data provider can handle.
+        /// </summary>
+        public abstract int ExcelMaxColumns { get; }
+
+        /// <summary>
+        /// Max number of rows in a worksheet that the Excel data provider can handle
+        /// </summary>
+        public abstract int ExcelMaxRows { get; }
+
+        public abstract object GetRangeValue(string worksheetName, int row, int column);
+        public abstract string GetFormat(object value, string format);
+
+        public abstract void Reset();
+        public abstract IRangeInfo GetRange(string worksheet, int fromRow, int fromCol, int toRow, int toCol);
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExcelDataProvider.cs.orig
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExcelDataProvider.cs.orig	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExcelDataProvider.cs.orig	(revision 12707)
@@ -0,0 +1,101 @@
+﻿using OfficeOpenXml.FormulaParsing.LexicalAnalysis;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing
+{
+    /// <summary>
+    /// This class should be implemented to be able to deliver excel data
+    /// to the formula parser.
+    /// </summary>
+    public abstract class ExcelDataProvider : IDisposable
+    {
+        public interface ICellInfo : IEnumerator<ICellInfo>, IEnumerable<ICellInfo>
+        {
+            string Address { get; }
+            int Row { get; }
+            int Column { get; }
+            string Formula { get;  }
+            object Value { get; }
+            double ValueDouble { get; }
+            double ValueDoubleLogical { get; }
+            bool IsHiddenRow { get; }
+            bool IsEmpty { get; }
+            bool IsMulti { get; }
+            bool NextCell();
+            IList<Token> Tokens { get; }
+            int GetNCells();
+        }
+        public interface INameInfo
+        {
+            ulong Id { get; set; }
+            string Name { get; set; }
+            string Formula { get; set; }
+            IList<Token> Tokens { get; }
+            object Value { get; set; }
+        }
+        /// <summary>
+        /// Returns the names of all worksheet names
+        /// </summary>
+        /// <returns></returns>
+        public abstract ExcelNamedRangeCollection GetWorksheetNames();
+        /// <summary>
+        /// Returns all defined names in a workbook
+        /// </summary>
+        /// <returns></returns>
+        public abstract ExcelNamedRangeCollection GetWorkbookNameValues();
+        /// <summary>
+        /// Returns values from the required range.
+        /// </summary>
+        /// <param name="address">An Excel address</param>
+        /// <returns>values from the required cells</returns>
+        public abstract ICellInfo GetRange(string worksheetName, int row, int column, string address);
+        public abstract INameInfo GetName(string worksheet, string name);
+
+        public abstract IEnumerable<object> GetRangeValues(string address);
+
+        public abstract string GetRangeFormula(string worksheetName, int row, int column);
+        public abstract List<Token> GetRangeFormulaTokens(string worksheetName, int row, int column);
+        public abstract bool IsRowHidden(string worksheetName, int row);
+        ///// <summary>
+        ///// Returns a single cell value
+        ///// </summary>
+        ///// <param name="address"></param>
+        ///// <returns></returns>
+        //public abstract object GetCellValue(int sheetID, string address);
+
+        /// <summary>
+        /// Returns a single cell value
+        /// </summary>
+        /// <param name="row"></param>
+        /// <param name="col"></param>
+        /// <returns></returns>
+        public abstract object GetCellValue(string sheetName, int row, int col);
+
+        ///// <summary>
+        ///// Sets the value on the cell
+        ///// </summary>
+        ///// <param name="address"></param>
+        ///// <param name="value"></param>
+        //public abstract void SetCellValue(string address, object value);
+
+        /// <summary>
+        /// Use this method to free unmanaged resources.
+        /// </summary>
+        public abstract void Dispose();
+
+        /// <summary>
+        /// Max number of columns in a worksheet that the Excel data provider can handle.
+        /// </summary>
+        public abstract int ExcelMaxColumns { get; }
+
+        /// <summary>
+        /// Max number of rows in a worksheet that the Excel data provider can handle
+        /// </summary>
+        public abstract int ExcelMaxRows { get; }
+
+        public abstract object GetRangeValue(string worksheetName, int row, int column);
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExcelUtilities/AddressTranslator.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExcelUtilities/AddressTranslator.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExcelUtilities/AddressTranslator.cs	(revision 12707)
@@ -0,0 +1,131 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+using OfficeOpenXml.FormulaParsing;
+using OfficeOpenXml.FormulaParsing.Utilities;
+
+namespace OfficeOpenXml.FormulaParsing.ExcelUtilities
+{
+    /// <summary>
+    /// Handles translations from Spreadsheet addresses to 0-based numeric index.
+    /// </summary>
+    public class AddressTranslator
+    {
+        public enum RangeCalculationBehaviour
+        {
+            FirstPart,
+            LastPart
+        }
+
+        private readonly ExcelDataProvider _excelDataProvider;
+
+        public AddressTranslator(ExcelDataProvider excelDataProvider)
+        {
+            Require.That(excelDataProvider).Named("excelDataProvider").IsNotNull();
+            _excelDataProvider = excelDataProvider;
+        }
+
+        /// <summary>
+        /// Translates an address in format "A1" to col- and rowindex.
+        /// 
+        /// If the supplied address is a range, the address of the first part will be calculated.
+        /// </summary>
+        /// <param name="address"></param>
+        /// <param name="col"></param>
+        /// <param name="row"></param>
+        public virtual void ToColAndRow(string address, out int col, out int row)
+        {
+            ToColAndRow(address, out col, out row, RangeCalculationBehaviour.FirstPart);
+        }
+
+        /// <summary>
+        /// Translates an address in format "A1" to col- and rowindex.
+        /// </summary>
+        /// <param name="address"></param>
+        /// <param name="col"></param>
+        /// <param name="row"></param>
+        /// <param name="behaviour"></param>
+        public virtual void ToColAndRow(string address, out int col, out int row, RangeCalculationBehaviour behaviour)
+        {
+            address = address.ToUpper(CultureInfo.InvariantCulture);
+            var alphaPart = GetAlphaPart(address);
+            col = 0;
+            var nLettersInAlphabet = 26;
+            for (int x = 0; x < alphaPart.Length; x++)
+            {
+                var pos = alphaPart.Length - x - 1;
+                var currentNumericValue = GetNumericAlphaValue(alphaPart[x]);
+                col += (nLettersInAlphabet * pos * currentNumericValue);
+                if (pos == 0)
+                {
+                    col += currentNumericValue;
+                }
+            }
+            //col--;
+            //row = GetIntPart(address) - 1 ?? GetRowIndexByBehaviour(behaviour);
+            row = GetIntPart(address) ?? GetRowIndexByBehaviour(behaviour);
+
+        }
+
+        private int GetRowIndexByBehaviour(RangeCalculationBehaviour behaviour)
+        {
+            if (behaviour == RangeCalculationBehaviour.FirstPart)
+            {
+                return 1;
+            }
+            return _excelDataProvider.ExcelMaxRows;
+        }
+
+        private int GetNumericAlphaValue(char c)
+        {
+            return (int)c - 64;
+        }
+
+        private string GetAlphaPart(string address)
+        {
+            return Regex.Match(address, "[A-Z]+").Value;
+        }
+
+        private int? GetIntPart(string address)
+        {
+            if (Regex.IsMatch(address, "[0-9]+"))
+            {
+                return int.Parse(Regex.Match(address, "[0-9]+").Value);
+            }
+            return null;
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExcelUtilities/CellReferenceProvider.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExcelUtilities/CellReferenceProvider.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExcelUtilities/CellReferenceProvider.cs	(revision 12707)
@@ -0,0 +1,69 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.LexicalAnalysis;
+
+namespace OfficeOpenXml.FormulaParsing.ExcelUtilities
+{
+    public class CellReferenceProvider
+    {
+        public virtual IEnumerable<string> GetReferencedAddresses(string cellFormula, ParsingContext context)
+        {
+            var resultCells = new List<string>();
+            var r = context.Configuration.Lexer.Tokenize(cellFormula, context.Scopes.Current.Address.Worksheet);
+            var toAddresses = r.Where(x => x.TokenType == TokenType.ExcelAddress);
+            foreach (var toAddress in toAddresses)
+            {
+                var rangeAddress = context.RangeAddressFactory.Create(toAddress.Value);
+                var rangeCells = new List<string>();
+                if (rangeAddress.FromRow < rangeAddress.ToRow || rangeAddress.FromCol < rangeAddress.ToCol)
+                {
+                    for (var col = rangeAddress.FromCol; col <= rangeAddress.ToCol; col++)
+                    {
+                        for (var row = rangeAddress.FromRow; row <= rangeAddress.ToRow; row++)
+                        {
+                            resultCells.Add(context.RangeAddressFactory.Create(col, row).Address);
+                        }
+                    }
+                }
+                else
+                {
+                    rangeCells.Add(toAddress.Value);
+                }
+                resultCells.AddRange(rangeCells);
+            }
+            return resultCells;
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExcelUtilities/ExcelAddressInfo.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExcelUtilities/ExcelAddressInfo.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExcelUtilities/ExcelAddressInfo.cs	(revision 12707)
@@ -0,0 +1,94 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.Utilities;
+
+namespace OfficeOpenXml.FormulaParsing.ExcelUtilities
+{
+    public class ExcelAddressInfo
+    {
+        private ExcelAddressInfo(string address) 
+        {   
+            var addressOnSheet = address;
+            Worksheet = string.Empty;
+            if (address.Contains("!"))
+            {
+                var worksheetArr = address.Split('!');
+                Worksheet = worksheetArr[0];
+                addressOnSheet = worksheetArr[1];
+            }
+            if (addressOnSheet.Contains(":"))
+            {
+                var rangeArr = addressOnSheet.Split(':');
+                StartCell = rangeArr[0];
+                EndCell = rangeArr[1];
+            }
+            else
+            {
+                StartCell = addressOnSheet;
+            }
+            AddressOnSheet = addressOnSheet;
+        }
+
+        public static ExcelAddressInfo Parse(string address)
+        {
+            Require.That(address).Named("address").IsNotNullOrEmpty();
+            return new ExcelAddressInfo(address);
+        }
+
+        public string Worksheet { get; private set; }
+
+        public bool WorksheetIsSpecified
+        {
+            get
+            {
+                return !string.IsNullOrEmpty(Worksheet);
+            }
+        }
+
+        public bool IsMultipleCells 
+        { 
+            get 
+            { 
+                return !string.IsNullOrEmpty(EndCell); 
+            } 
+        }
+
+        public string StartCell { get; private set; }
+
+        public string EndCell { get; private set; }
+
+        public string AddressOnSheet { get; private set; }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExcelUtilities/ExcelAddressUtil.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExcelUtilities/ExcelAddressUtil.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExcelUtilities/ExcelAddressUtil.cs	(revision 12707)
@@ -0,0 +1,71 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing.ExcelUtilities
+{
+    public static class ExcelAddressUtil
+    {
+        static char[] SheetNameInvalidChars = new char[] { '?', ':', '*', '/', '\\' };
+        public static bool IsValidAddress(string token)
+        {
+            int ix;
+            if (token[0] == '\'')
+            {
+                ix = token.LastIndexOf('\'');
+                if (ix > 0 && ix < token.Length - 1 && token[ix + 1] == '!')
+                {
+                    if (token.IndexOfAny(SheetNameInvalidChars, 1, ix - 1) > 0)
+                    {
+                        return false;
+                    }
+                    token = token.Substring(ix + 2);
+                }
+                else
+                {
+                    return false;
+                }
+            }
+            else if ((ix = token.IndexOf('!')) > 1)
+            {
+                if (token.IndexOfAny(SheetNameInvalidChars, 0, token.IndexOf('!')) > 0)
+                {
+                    return false;
+                }
+                token = token.Substring(token.IndexOf('!') + 1);
+            }
+            return OfficeOpenXml.ExcelAddress.IsValidAddress(token);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExcelUtilities/ExcelReferenceType.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExcelUtilities/ExcelReferenceType.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExcelUtilities/ExcelReferenceType.cs	(revision 12707)
@@ -0,0 +1,45 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing.ExcelUtilities
+{
+    public enum ExcelReferenceType
+    {
+        AbsoluteRowAndColumn = 1,
+        AbsoluteRowRelativeColumn = 2,
+        RelativeRowAbsolutColumn = 3,
+        RelativeRowAndColumn = 4
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExcelUtilities/FormulaDependencies.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExcelUtilities/FormulaDependencies.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExcelUtilities/FormulaDependencies.cs	(revision 12707)
@@ -0,0 +1,82 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.Exceptions;
+
+namespace OfficeOpenXml.FormulaParsing.ExcelUtilities
+{
+    public class FormulaDependencies
+    {
+        public FormulaDependencies()
+            : this(new FormulaDependencyFactory())
+        {
+
+        }
+
+        public FormulaDependencies(FormulaDependencyFactory formulaDependencyFactory)
+        {
+            _formulaDependencyFactory = formulaDependencyFactory;
+        }
+
+        private readonly FormulaDependencyFactory _formulaDependencyFactory;
+        private readonly Dictionary<string, FormulaDependency> _dependencies = new Dictionary<string, FormulaDependency>();
+
+        public IEnumerable<KeyValuePair<string, FormulaDependency>> Dependencies { get { return _dependencies; } }
+
+        public void AddFormulaScope(ParsingScope parsingScope)
+        {
+            //var dependency = _formulaDependencyFactory.Create(parsingScope);
+            //var address = parsingScope.Address.ToString();
+            //if (!_dependencies.ContainsKey(address))
+            //{
+            //    _dependencies.Add(address, dependency);
+            //}
+            //if (parsingScope.Parent != null)
+            //{
+            //    var parentAddress = parsingScope.Parent.Address.ToString();
+            //    if (_dependencies.ContainsKey(parentAddress))
+            //    {
+            //        var parent = _dependencies[parentAddress];
+            //        parent.AddReferenceTo(parsingScope.Address);
+            //        dependency.AddReferenceFrom(parent.Address);
+            //    }
+            //}
+        }
+
+        public void Clear()
+        {
+            _dependencies.Clear();
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExcelUtilities/FormulaDependency.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExcelUtilities/FormulaDependency.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExcelUtilities/FormulaDependency.cs	(revision 12707)
@@ -0,0 +1,72 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.Exceptions;
+
+namespace OfficeOpenXml.FormulaParsing.ExcelUtilities
+{
+    public class FormulaDependency
+    {
+        public FormulaDependency(ParsingScope scope)
+	    {   
+            ScopeId = scope.ScopeId;
+            Address = scope.Address;
+	    }
+        public Guid ScopeId { get; private set; }
+
+        public RangeAddress Address { get; private set; }
+
+        private List<RangeAddress> _referencedBy = new List<RangeAddress>();
+
+        private List<RangeAddress> _references = new List<RangeAddress>();
+
+        public virtual void AddReferenceFrom(RangeAddress rangeAddress)
+        {
+            if (Address.CollidesWith(rangeAddress) || _references.Exists(x => x.CollidesWith(rangeAddress)))
+            {
+                throw new CircularReferenceException("Circular reference detected at " + rangeAddress.ToString());
+            }
+            _referencedBy.Add(rangeAddress);
+        }
+
+        public virtual void AddReferenceTo(RangeAddress rangeAddress)
+        {
+            if (Address.CollidesWith(rangeAddress) || _referencedBy.Exists(x => x.CollidesWith(rangeAddress)))
+            {
+                throw new CircularReferenceException("Circular reference detected at " + rangeAddress.ToString());
+            }
+            _references.Add(rangeAddress);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExcelUtilities/FormulaDependencyFactory.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExcelUtilities/FormulaDependencyFactory.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExcelUtilities/FormulaDependencyFactory.cs	(revision 12707)
@@ -0,0 +1,45 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing.ExcelUtilities
+{
+    public class FormulaDependencyFactory
+    {
+        public virtual FormulaDependency Create(ParsingScope scope)
+        {
+            return new FormulaDependency(scope);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExcelUtilities/IndexToAddressTranslator.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExcelUtilities/IndexToAddressTranslator.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExcelUtilities/IndexToAddressTranslator.cs	(revision 12707)
@@ -0,0 +1,102 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing;
+using OfficeOpenXml.FormulaParsing.Utilities;
+
+namespace OfficeOpenXml.FormulaParsing.ExcelUtilities
+{
+    public class IndexToAddressTranslator
+    {
+        public IndexToAddressTranslator(ExcelDataProvider excelDataProvider)
+            : this(excelDataProvider, ExcelReferenceType.AbsoluteRowAndColumn)
+        {
+
+        }
+
+        public IndexToAddressTranslator(ExcelDataProvider excelDataProvider, ExcelReferenceType referenceType)
+        {
+            Require.That(excelDataProvider).Named("excelDataProvider").IsNotNull();
+            _excelDataProvider = excelDataProvider;
+            _excelReferenceType = referenceType;
+        }
+
+        private readonly ExcelDataProvider _excelDataProvider;
+        private readonly ExcelReferenceType _excelReferenceType;
+
+        protected internal static string GetColumnLetter(int iColumnNumber, bool fixedCol)
+        {
+
+            if (iColumnNumber < 1)
+            {
+                //throw new Exception("Column number is out of range");
+                return "#REF!";
+            }
+
+            string sCol = "";
+            do
+            {
+                sCol = ((char)('A' + ((iColumnNumber - 1) % 26))) + sCol;
+                iColumnNumber = (iColumnNumber - ((iColumnNumber - 1) % 26)) / 26;
+            }
+            while (iColumnNumber > 0);
+            return fixedCol ? "$" + sCol : sCol;
+        }
+
+        public string ToAddress(int col, int row)
+        {
+            var fixedCol = _excelReferenceType == ExcelReferenceType.AbsoluteRowAndColumn ||
+                           _excelReferenceType == ExcelReferenceType.RelativeRowAbsolutColumn;
+            var colString = GetColumnLetter(col, fixedCol);
+            return colString + GetRowNumber(row);
+        }
+
+        private string GetRowNumber(int rowNo)
+        {
+            var retVal = rowNo < (_excelDataProvider.ExcelMaxRows) ? rowNo.ToString() : string.Empty;
+            if (!string.IsNullOrEmpty(retVal))
+            {
+                switch (_excelReferenceType)
+                {
+                    case ExcelReferenceType.AbsoluteRowAndColumn:
+                    case ExcelReferenceType.AbsoluteRowRelativeColumn:
+                        return "$" + retVal;
+                    default:
+                        return retVal;
+                }
+            }
+            return retVal;
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExcelUtilities/LookupValueMatcher.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExcelUtilities/LookupValueMatcher.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExcelUtilities/LookupValueMatcher.cs	(revision 12707)
@@ -0,0 +1,15 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing.ExcelUtilities
+{
+    public class LookupValueMatcher : ValueMatcher
+    {
+        protected override int CompareObjectToString(object o1, string o2)
+        {
+            return IncompatibleOperands;
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExcelUtilities/NumericExpressionEvaluator.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExcelUtilities/NumericExpressionEvaluator.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExcelUtilities/NumericExpressionEvaluator.cs	(revision 12707)
@@ -0,0 +1,113 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExcelUtilities;
+using System.Text.RegularExpressions;
+using OfficeOpenXml.FormulaParsing.Excel.Operators;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+
+namespace OfficeOpenXml.FormulaParsing.ExcelUtilities
+{
+    public class NumericExpressionEvaluator
+    {
+        private ValueMatcher _valueMatcher;
+        private CompileResultFactory _compileResultFactory;
+
+        public NumericExpressionEvaluator()
+            : this(new ValueMatcher(), new CompileResultFactory())
+        {
+
+        }
+
+        public NumericExpressionEvaluator(ValueMatcher valueMatcher, CompileResultFactory compileResultFactory)
+        {
+            _valueMatcher = valueMatcher;
+            _compileResultFactory = compileResultFactory;
+        }
+
+        private string GetNonNumericStartChars(string expression)
+        {
+            if (!string.IsNullOrEmpty(expression))
+            {
+                if (Regex.IsMatch(expression, @"^([^\d]{2})")) return expression.Substring(0, 2);
+                if (Regex.IsMatch(expression, @"^([^\d]{1})")) return expression.Substring(0, 1);
+            }
+            return null;
+        }
+
+        public double? OperandAsDouble(object op)
+        {
+            if (op is double || op is int)
+            {
+                return Convert.ToDouble(op);
+            }
+            if (op != null)
+            {
+                double output;
+                if (double.TryParse(op.ToString(), out output))
+                {
+                    return output;
+                }
+            }
+            return null;
+        }
+
+        public bool Evaluate(object left, string expression)
+        {
+            var operatorCandidate = GetNonNumericStartChars(expression);
+            var leftNum = OperandAsDouble(left);
+            if (!string.IsNullOrEmpty(operatorCandidate) && leftNum != null)
+            {
+                IOperator op;
+                if (OperatorsDict.Instance.TryGetValue(operatorCandidate, out op))
+                {
+                    var numericCandidate = expression.Replace(operatorCandidate, string.Empty);
+                    double d;
+                    if (double.TryParse(numericCandidate, out d))
+                    {
+                        var leftResult = _compileResultFactory.Create(leftNum);
+                        var rightResult = _compileResultFactory.Create(d);
+                        var result = op.Apply(leftResult, rightResult);
+                        if (result.DataType != DataType.Boolean)
+                        {
+                            throw new ArgumentException("Illegal operator in expression");
+                        }
+                        return (bool)result.Result;
+                    }
+                }
+            }
+            return _valueMatcher.IsMatch(left, expression) == 0;
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExcelUtilities/RangeAddress.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExcelUtilities/RangeAddress.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExcelUtilities/RangeAddress.cs	(revision 12707)
@@ -0,0 +1,89 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.Utilities;
+
+namespace OfficeOpenXml.FormulaParsing.ExcelUtilities
+{
+    public class RangeAddress
+    {
+        public RangeAddress()
+        {
+            Address = string.Empty;
+        }
+
+        internal string Address { get; set; }
+
+        public string Worksheet { get; internal set; }
+
+        public int FromCol { get; internal set; }
+
+        public int ToCol { get; internal set; }
+
+        public int FromRow { get; internal set; }
+
+        public int ToRow { get; internal set; }
+
+        public override string ToString()
+        {
+            return Address;
+        }
+
+        private static RangeAddress _empty = new RangeAddress();
+        public static RangeAddress Empty
+        {
+            get { return _empty; }
+        }
+
+        /// <summary>
+        /// Returns true if this range collides (full or partly) with the supplied range
+        /// </summary>
+        /// <param name="other">The range to check</param>
+        /// <returns></returns>
+        public bool CollidesWith(RangeAddress other)
+        {
+            if (other.Worksheet != Worksheet)
+            {
+                return false;
+            }
+            if (other.FromRow > ToRow || other.FromCol > ToCol
+                ||
+                FromRow > other.ToRow || FromCol > other.ToCol)
+            {
+                return false;
+            }
+            return true;
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExcelUtilities/RangeAddressFactory.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExcelUtilities/RangeAddressFactory.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExcelUtilities/RangeAddressFactory.cs	(revision 12707)
@@ -0,0 +1,163 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing;
+using OfficeOpenXml.FormulaParsing.Utilities;
+
+namespace OfficeOpenXml.FormulaParsing.ExcelUtilities
+{
+    public class RangeAddressFactory
+    {
+        private readonly ExcelDataProvider _excelDataProvider;
+        private readonly AddressTranslator _addressTranslator;
+        private readonly IndexToAddressTranslator _indexToAddressTranslator;
+
+        public RangeAddressFactory(ExcelDataProvider excelDataProvider)
+            : this(excelDataProvider, new AddressTranslator(excelDataProvider), new IndexToAddressTranslator(excelDataProvider, ExcelReferenceType.RelativeRowAndColumn))
+        {
+           
+            
+        }
+
+        public RangeAddressFactory(ExcelDataProvider excelDataProvider, AddressTranslator addressTranslator, IndexToAddressTranslator indexToAddressTranslator)
+        {
+            Require.That(excelDataProvider).Named("excelDataProvider").IsNotNull();
+            Require.That(addressTranslator).Named("addressTranslator").IsNotNull();
+            Require.That(indexToAddressTranslator).Named("indexToAddressTranslator").IsNotNull();
+            _excelDataProvider = excelDataProvider;
+            _addressTranslator = addressTranslator;
+            _indexToAddressTranslator = indexToAddressTranslator;
+        }
+
+        public RangeAddress Create(int col, int row)
+        {
+            return Create(string.Empty, col, row);
+        }
+
+        public RangeAddress Create(string worksheetName, int col, int row)
+        {
+            return new RangeAddress()
+            {
+                Address = _indexToAddressTranslator.ToAddress(col, row),
+                Worksheet = worksheetName,
+                FromCol = col,
+                ToCol = col,
+                FromRow = row,
+                ToRow = row
+            };
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="worksheetName">will be used if no worksheet name is specified in <paramref name="address"/></param>
+        /// <param name="address">address of a range</param>
+        /// <returns></returns>
+        public RangeAddress Create(string worksheetName, string address)
+        {
+            Require.That(address).Named("range").IsNotNullOrEmpty();
+            //var addressInfo = ExcelAddressInfo.Parse(address);
+            var adr = new ExcelAddressBase(address);  
+            var sheet = string.IsNullOrEmpty(adr.WorkSheet) ? worksheetName : adr.WorkSheet;
+            var dim = _excelDataProvider.GetDimensionEnd(adr.WorkSheet);
+            var rangeAddress = new RangeAddress()
+            {
+                Address = adr.Address,
+                Worksheet = sheet,
+                FromRow = adr._fromRow,
+                FromCol = adr._fromCol,
+                ToRow = (dim != null && adr._toRow > dim.Row) ? dim.Row : adr._toRow,
+                ToCol = adr._toCol
+            };
+
+            //if (addressInfo.IsMultipleCells)
+            //{
+            //    HandleMultipleCellAddress(rangeAddress, addressInfo);
+            //}
+            //else
+            //{
+            //    HandleSingleCellAddress(rangeAddress, addressInfo);
+            //}
+            return rangeAddress;
+        }
+
+        public RangeAddress Create(string range)
+        {
+            Require.That(range).Named("range").IsNotNullOrEmpty();
+            //var addressInfo = ExcelAddressInfo.Parse(range);
+            var adr = new ExcelAddressBase(range);
+            var rangeAddress = new RangeAddress()
+            {
+                Address = adr.Address,
+                Worksheet = adr.WorkSheet ?? "",
+                FromRow = adr._fromRow,
+                FromCol = adr._fromCol,
+                ToRow = adr._toRow,
+                ToCol = adr._toCol
+            };
+           
+            //if (addressInfo.IsMultipleCells)
+            //{
+            //    HandleMultipleCellAddress(rangeAddress, addressInfo);
+            //}
+            //else
+            //{
+            //    HandleSingleCellAddress(rangeAddress, addressInfo);
+            //}
+            return rangeAddress;
+        }
+
+        private void HandleSingleCellAddress(RangeAddress rangeAddress, ExcelAddressInfo addressInfo)
+        {
+            int col, row;
+            _addressTranslator.ToColAndRow(addressInfo.StartCell, out col, out row);
+            rangeAddress.FromCol = col;
+            rangeAddress.ToCol = col;
+            rangeAddress.FromRow = row;
+            rangeAddress.ToRow = row;
+        }
+
+        private void HandleMultipleCellAddress(RangeAddress rangeAddress, ExcelAddressInfo addressInfo)
+        {
+            int fromCol, fromRow;
+            _addressTranslator.ToColAndRow(addressInfo.StartCell, out fromCol, out fromRow);
+            int toCol, toRow;
+            _addressTranslator.ToColAndRow(addressInfo.EndCell, out toCol, out toRow, AddressTranslator.RangeCalculationBehaviour.LastPart);
+            rangeAddress.FromCol = fromCol;
+            rangeAddress.ToCol = toCol;
+            rangeAddress.FromRow = fromRow;
+            rangeAddress.ToRow = toRow;
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExcelUtilities/ValueMatcher.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExcelUtilities/ValueMatcher.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExcelUtilities/ValueMatcher.cs	(revision 12707)
@@ -0,0 +1,110 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing.ExcelUtilities
+{
+    public class ValueMatcher
+    {
+        public const int IncompatibleOperands = -2;
+
+        public virtual int IsMatch(object o1, object o2)
+        {
+            if (o1 != null && o2 == null) return 1;
+            if (o1 == null && o2 != null) return -1;
+            if (o1 == null && o2 == null) return 0;
+            //Handle ranges and defined names
+            o1 = CheckGetRange(o1);
+            o2 = CheckGetRange(o2);
+
+            if (o1 is string && o2 is string)
+            {
+                return CompareStringToString(o1.ToString().ToLower(), o2.ToString().ToLower());
+            }
+            else if( o1.GetType() == typeof(string))
+            {
+                return CompareStringToObject(o1.ToString(), o2);
+            }
+            else if (o2.GetType() == typeof(string))
+            {
+                return CompareObjectToString(o1, o2.ToString());
+            }
+            return Convert.ToDouble(o1).CompareTo(Convert.ToDouble(o2));
+        }
+
+        private static object CheckGetRange(object v)
+        {
+            if (v is ExcelDataProvider.IRangeInfo)
+            {
+                var r = ((ExcelDataProvider.IRangeInfo)v);
+                if (r.GetNCells() > 1)
+                {
+                    v = ExcelErrorValue.Create(eErrorType.NA);
+                }
+                v = r.GetOffset(0, 0);
+            }
+            else if (v is ExcelDataProvider.INameInfo)
+            {
+                var n = ((ExcelDataProvider.INameInfo)v);
+                v = CheckGetRange(n);
+            }
+            return v;
+        }
+
+        protected virtual int CompareStringToString(string s1, string s2)
+        {
+            return s1.CompareTo(s2);
+        }
+
+        protected virtual int CompareStringToObject(string o1, object o2)
+        {
+            double d1;
+            if (double.TryParse(o1, out d1))
+            {
+                return d1.CompareTo(Convert.ToDouble(o2));
+            }
+            return IncompatibleOperands;
+        }
+
+        protected virtual int CompareObjectToString(object o1, string o2)
+        {
+            double d2;
+            if (double.TryParse(o2, out d2))
+            {
+                return Convert.ToDouble(o1).CompareTo(d2);
+            }
+            return IncompatibleOperands;
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExcelUtilities/WildCardValueMatcher.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExcelUtilities/WildCardValueMatcher.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExcelUtilities/WildCardValueMatcher.cs	(revision 12707)
@@ -0,0 +1,57 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+
+namespace OfficeOpenXml.FormulaParsing.ExcelUtilities
+{
+    public class WildCardValueMatcher : ValueMatcher
+    {
+        protected override int CompareStringToString(string s1, string s2)
+        {
+            if (s1.Contains("*") || s1.Contains("?"))
+            {
+                var regexPattern = Regex.Escape(s1);
+                regexPattern = string.Format("^{0}$", regexPattern);
+                regexPattern = regexPattern.Replace(@"\*", ".*");
+                regexPattern = regexPattern.Replace(@"\?", ".");
+                if (Regex.IsMatch(s2, regexPattern))
+                {
+                    return 0;
+                }
+            }
+            return base.CompareStringToString(s1, s2);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExcelValues.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExcelValues.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExcelValues.cs	(revision 12707)
@@ -0,0 +1,184 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+
+namespace OfficeOpenXml
+{
+    /// <summary>
+    /// Represents the errortypes in excel
+    /// </summary>
+    public enum eErrorType
+    {
+        /// <summary>
+        /// Division by zero
+        /// </summary>
+        Div0,
+        /// <summary>
+        /// Not applicable
+        /// </summary>
+        NA,
+        /// <summary>
+        /// Name error
+        /// </summary>
+        Name,
+        /// <summary>
+        /// Null error
+        /// </summary>
+        Null,
+        /// <summary>
+        /// Num error
+        /// </summary>
+        Num,
+        /// <summary>
+        /// Reference error
+        /// </summary>
+        Ref,
+        /// <summary>
+        /// Value error
+        /// </summary>
+        Value
+    }
+
+    /// <summary>
+    /// Represents an Excel error.
+    /// </summary>
+    /// <seealso cref="eErrorType"/>
+    public class ExcelErrorValue
+    {
+        /// <summary>
+        /// Handles the convertion between <see cref="eErrorType"/> and the string values
+        /// used by Excel.
+        /// </summary>
+        public static class Values
+        {
+            public const string Div0 = "#DIV/0!";
+            public const string NA = "#N/A";
+            public const string Name = "#NAME?";
+            public const string Null = "#NULL!";
+            public const string Num = "#NUM!";
+            public const string Ref = "#REF!";
+            public const string Value = "#VALUE!";
+
+            private static Dictionary<string, eErrorType> _values = new Dictionary<string, eErrorType>()
+                {
+                    {Div0, eErrorType.Div0},
+                    {NA, eErrorType.NA},
+                    {Name, eErrorType.Name},
+                    {Null, eErrorType.Null},
+                    {Num, eErrorType.Num},
+                    {Ref, eErrorType.Ref},
+                    {Value, eErrorType.Value}
+                };
+
+            /// <summary>
+            /// Returns true if the supplied <paramref name="candidate"/> is an excel error.
+            /// </summary>
+            /// <param name="candidate"></param>
+            /// <returns></returns>
+            public static bool IsErrorValue(object candidate)
+            {
+                if(candidate == null || !(candidate is ExcelErrorValue)) return false;
+                var candidateString = candidate.ToString();
+                return (!string.IsNullOrEmpty(candidateString) && _values.ContainsKey(candidateString));
+            }
+
+            /// <summary>
+            /// Returns true if the supplied <paramref name="candidate"/> is an excel error.
+            /// </summary>
+            /// <param name="candidate"></param>
+            /// <returns></returns>
+            public static bool StringIsErrorValue(string candidate)
+            {
+                return (!string.IsNullOrEmpty(candidate) && _values.ContainsKey(candidate));
+            }
+
+            /// <summary>
+            /// Converts a string to an <see cref="eErrorType"/>
+            /// </summary>
+            /// <param name="val"></param>
+            /// <returns></returns>
+            /// <exception cref="ArgumentException">Thrown if the supplied value is not an Excel error</exception>
+            public static eErrorType ToErrorType(string val)
+            {
+                if (string.IsNullOrEmpty(val) || !_values.ContainsKey(val))
+                {
+                    throw new ArgumentException("Invalid error code " + (val ?? "<empty>"));
+                }
+                return _values[val];
+            }
+        }
+
+        internal static ExcelErrorValue Create(eErrorType errorType)
+        {
+            return new ExcelErrorValue(errorType);
+        }
+
+        internal static ExcelErrorValue Parse(string val)
+        {
+            if (Values.StringIsErrorValue(val))
+            {
+                return new ExcelErrorValue(Values.ToErrorType(val));
+            }
+            if(string.IsNullOrEmpty(val)) throw new ArgumentNullException("val");
+            throw new ArgumentException("Not a valid error value: " + val);
+        }
+
+        private ExcelErrorValue(eErrorType type)
+        {
+            Type=type; 
+        }
+
+        /// <summary>
+        /// The error type
+        /// </summary>
+        public eErrorType Type { get; private set; }
+
+        /// <summary>
+        /// Returns the string representation of the error type
+        /// </summary>
+        /// <returns></returns>
+        public override string ToString()
+        {
+            switch(Type)
+            {
+                case eErrorType.Div0:
+                    return Values.Div0;
+                case eErrorType.NA:
+                    return Values.NA;
+                case eErrorType.Name:
+                    return Values.Name;
+                case eErrorType.Null:
+                    return Values.Null;
+                case eErrorType.Num:
+                    return Values.Num;
+                case eErrorType.Ref:
+                    return Values.Ref;
+                case eErrorType.Value:
+                    return Values.Value;
+                default:
+                    throw(new ArgumentException("Invalid errortype"));
+            }
+        }
+        public static ExcelErrorValue operator +(object v1, ExcelErrorValue v2)
+        {
+            return v2;
+        }
+        public static ExcelErrorValue operator +(ExcelErrorValue v1, ExcelErrorValue v2)
+        {
+            return v1;
+        }
+
+        public override int GetHashCode()
+        {
+            return base.GetHashCode();
+        }
+
+        public override bool Equals(object obj)
+        {
+            if (!(obj is ExcelErrorValue)) return false;
+            return ((ExcelErrorValue) obj).ToString() == this.ToString();
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Exceptions/CircularReferenceException.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Exceptions/CircularReferenceException.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Exceptions/CircularReferenceException.cs	(revision 12707)
@@ -0,0 +1,46 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing.Exceptions
+{
+    public class CircularReferenceException : Exception
+    {
+        public CircularReferenceException(string message)
+            : base(message)
+        {
+
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Exceptions/ExcelErrorCodes.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Exceptions/ExcelErrorCodes.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Exceptions/ExcelErrorCodes.cs	(revision 12707)
@@ -0,0 +1,106 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing.Exceptions
+{
+    public class ExcelErrorCodes
+    {
+        private ExcelErrorCodes(string code)
+        {
+            Code = code;
+        }
+
+        public string Code
+        {
+            get;
+            private set;
+        }
+
+        public override int GetHashCode()
+        {
+            return Code.GetHashCode();
+        }
+
+        public override bool  Equals(object obj)
+        {
+            if (obj is ExcelErrorCodes)
+            {
+                return ((ExcelErrorCodes)obj).Code.Equals(Code);
+            }
+ 	        return false;
+        }
+
+        public static bool operator == (ExcelErrorCodes c1, ExcelErrorCodes c2)
+        {
+            return c1.Code.Equals(c2.Code);
+        }
+
+        public static bool operator !=(ExcelErrorCodes c1, ExcelErrorCodes c2)
+        {
+            return !c1.Code.Equals(c2.Code);
+        }
+
+        private static readonly IEnumerable<string> Codes = new List<string> { Value.Code, Name.Code, NoValueAvaliable.Code };
+
+        public static bool IsErrorCode(object valueToTest)
+        {
+            if (valueToTest == null)
+            {
+                return false;
+            }
+            var candidate = valueToTest.ToString();
+            if (Codes.FirstOrDefault(x => x == candidate) != null)
+            {
+                return true;
+            }
+            return false;
+        }
+
+        public static ExcelErrorCodes Value
+        {
+            get { return new ExcelErrorCodes("#VALUE!"); }
+        }
+
+        public static ExcelErrorCodes Name
+        {
+            get { return new ExcelErrorCodes("#NAME?"); }
+        }
+
+        public static ExcelErrorCodes NoValueAvaliable
+        {
+            get { return new ExcelErrorCodes("#N/A"); }
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Exceptions/ExcelErrorValueException.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Exceptions/ExcelErrorValueException.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Exceptions/ExcelErrorValueException.cs	(revision 12707)
@@ -0,0 +1,40 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing.Exceptions
+{
+    /// <summary>
+    /// This Exception represents an Excel error. When this exception is thrown
+    /// from an Excel function, the ErrorValue code will be set as the value of the
+    /// parsed cell.
+    /// </summary>
+    /// <seealso cref="ExcelErrorValue"/>
+    public class ExcelErrorValueException : Exception
+    {
+        
+        public ExcelErrorValueException(ExcelErrorValue error)
+            : this(error.ToString(), error)
+        {
+            
+        }
+
+        public ExcelErrorValueException(string message, ExcelErrorValue error)
+            : base(message)
+        {
+            ErrorValue = error;
+        }
+
+        public ExcelErrorValueException(eErrorType errorType)
+            : this(ExcelErrorValue.Create(errorType))
+        {
+            
+        }
+
+        /// <summary>
+        /// The error value
+        /// </summary>
+        public ExcelErrorValue ErrorValue { get; private set; }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Exceptions/UnrecognizedTokenException.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Exceptions/UnrecognizedTokenException.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Exceptions/UnrecognizedTokenException.cs	(revision 12707)
@@ -0,0 +1,47 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.LexicalAnalysis;
+
+namespace OfficeOpenXml.FormulaParsing.Exceptions
+{
+    public class UnrecognizedTokenException : Exception
+    {
+        public UnrecognizedTokenException(Token token)
+            : base( "Unrecognized token: " + token.Value)
+        {
+
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/AtomicExpression.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/AtomicExpression.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/AtomicExpression.cs	(revision 12707)
@@ -0,0 +1,51 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing.ExpressionGraph
+{
+    public abstract class AtomicExpression : Expression
+    {
+        public AtomicExpression(string expression)
+            : base(expression)
+        {
+
+        }
+
+        public override bool IsGroupedExpression
+        {
+            get { return false; }
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/BooleanExpression.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/BooleanExpression.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/BooleanExpression.cs	(revision 12707)
@@ -0,0 +1,60 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing.ExpressionGraph
+{
+    public class BooleanExpression : AtomicExpression
+    {
+        private bool? _precompiledValue;
+
+        public BooleanExpression(string expression)
+            : base(expression)
+        {
+
+        }
+
+        public BooleanExpression(bool value)
+            : base(value ? "true" : "false")
+        {
+            _precompiledValue = value;
+        }
+
+        public override CompileResult Compile()
+        {
+            var result = _precompiledValue ?? bool.Parse(ExpressionString);
+            return new CompileResult(result, DataType.Boolean);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/CompileResult.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/CompileResult.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/CompileResult.cs	(revision 12707)
@@ -0,0 +1,152 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+using OfficeOpenXml.Utils;
+
+namespace OfficeOpenXml.FormulaParsing.ExpressionGraph
+{
+    public class CompileResult
+    {
+        private static CompileResult _empty = new CompileResult(null, DataType.Empty);
+        public static CompileResult Empty
+        {
+            get { return _empty; }
+        }
+
+        public CompileResult(object result, DataType dataType)
+        {
+            Result = result;
+            DataType = dataType;
+        }
+
+        public CompileResult(eErrorType errorType)
+        {
+            Result = ExcelErrorValue.Create(errorType);
+            DataType = DataType.ExcelError;
+        }
+
+        public CompileResult(ExcelErrorValue errorValue)
+        {
+            Require.Argument(errorValue).IsNotNull("errorValue");
+            Result = errorValue;
+            DataType = DataType.ExcelError;
+        }
+        public object Result
+        {
+            get;
+            private set;
+        }
+        public object ResultValue
+        {
+            get
+            {
+                var r = Result as ExcelDataProvider.IRangeInfo;
+                if (r == null)
+                {
+                    return Result;
+                }
+                else
+                {
+                    return r.GetValue(r.Address._fromRow, r.Address._fromCol);
+                }
+            }
+        }
+        public double ResultNumeric
+        {
+            get
+            {
+                if (IsNumeric)
+                {
+                    return Result == null ? 0 :  Convert.ToDouble(Result);
+                }
+                else if(Result is DateTime)
+                {
+                    return ((DateTime)Result).ToOADate();
+                }
+                else if(Result is TimeSpan)
+                {
+                    return new DateTime(((TimeSpan)Result).Ticks).ToOADate();
+                }
+                else if (IsNumericString)
+                {
+                    return double.Parse(Result.ToString(), NumberStyles.Float, CultureInfo.InvariantCulture);
+                }
+                else if (Result is ExcelDataProvider.IRangeInfo)
+                {
+                    var c = ((ExcelDataProvider.IRangeInfo)Result).FirstOrDefault();
+                    if (c == null)
+                    {
+                        return 0;
+                    }
+                    else
+                    {
+                        return c.ValueDoubleLogical;
+                    }
+                }
+                else
+                {
+                    return 0;
+                }
+            }
+        }
+
+        public DataType DataType
+        {
+            get;
+            private set;
+        }
+        
+        public bool IsNumeric
+        {
+            get 
+            {
+                return DataType == DataType.Decimal || DataType == DataType.Integer || DataType == DataType.Empty || DataType == DataType.Boolean || DataType == DataType.Date; 
+            }
+        }
+
+        public bool IsNumericString
+        {
+            get
+            {
+                return DataType == DataType.String && ConvertUtil.IsNumericString(Result);
+            }
+        }
+
+        public bool IsResultOfSubtotal { get; set; }
+
+        public bool IsHiddenCell { get; set; }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/CompileResultFactory.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/CompileResultFactory.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/CompileResultFactory.cs	(revision 12707)
@@ -0,0 +1,78 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing.ExpressionGraph
+{
+    public class CompileResultFactory
+    {
+        public virtual CompileResult Create(object obj)
+        {
+            if ((obj is ExcelDataProvider.INameInfo))
+            {
+                obj = ((ExcelDataProvider.INameInfo)obj).Value;
+            }
+            if (obj is ExcelDataProvider.IRangeInfo)
+            {
+                obj = ((ExcelDataProvider.IRangeInfo)obj).GetOffset(0, 0);
+            }
+            if (obj == null) return new CompileResult(null, DataType.Empty);
+            if (obj.GetType().Equals(typeof(string)))
+            {
+                return new CompileResult(obj, DataType.String);
+            }
+            if (obj.GetType().Equals(typeof(double)) || obj is decimal)
+            {
+                return new CompileResult(obj, DataType.Decimal);
+            }
+            if (obj.GetType().Equals(typeof(int)) || obj is long || obj is short)
+            {
+                return new CompileResult(obj, DataType.Integer);
+            }
+            if (obj.GetType().Equals(typeof(bool)))
+            {
+                return new CompileResult(obj, DataType.Boolean);
+            }
+            if (obj.GetType().Equals(typeof (ExcelErrorValue)))
+            {
+                return new CompileResult(obj, DataType.ExcelError);
+            }
+            if (obj.GetType().Equals(typeof(System.DateTime)))
+            {
+                return new CompileResult(((System.DateTime)obj).ToOADate(), DataType.Date);
+            }
+            throw new ArgumentException("Non supported type " + obj.GetType().FullName);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/CompileStrategy/CompileStrategy.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/CompileStrategy/CompileStrategy.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/CompileStrategy/CompileStrategy.cs	(revision 12707)
@@ -0,0 +1,49 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing.ExpressionGraph.CompileStrategy
+{
+    public abstract class CompileStrategy
+    {
+        protected readonly Expression _expression;
+
+        public CompileStrategy(Expression expression)
+        {
+            _expression = expression;
+        }
+
+        public abstract Expression Compile();
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/CompileStrategy/CompileStrategyFactory.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/CompileStrategy/CompileStrategyFactory.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/CompileStrategy/CompileStrategyFactory.cs	(revision 12707)
@@ -0,0 +1,53 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.Excel.Operators;
+
+namespace OfficeOpenXml.FormulaParsing.ExpressionGraph.CompileStrategy
+{
+    public class CompileStrategyFactory : ICompileStrategyFactory
+    {
+        public CompileStrategy Create(Expression expression)
+        {
+            if (expression.Operator.Operator == Operators.Concat)
+            {
+                return new StringConcatStrategy(expression);
+            }
+            else
+            {
+                return new DefaultCompileStrategy(expression);
+            }
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/CompileStrategy/DefaultCompileStrategy.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/CompileStrategy/DefaultCompileStrategy.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/CompileStrategy/DefaultCompileStrategy.cs	(revision 12707)
@@ -0,0 +1,50 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing.ExpressionGraph.CompileStrategy
+{
+    public class DefaultCompileStrategy : CompileStrategy
+    {
+        public DefaultCompileStrategy(Expression expression)
+            : base(expression)
+        {
+
+        }
+        public override Expression Compile()
+        {
+            return _expression.MergeWithNext();
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/CompileStrategy/ICompileStrategyFactory.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/CompileStrategy/ICompileStrategyFactory.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/CompileStrategy/ICompileStrategyFactory.cs	(revision 12707)
@@ -0,0 +1,42 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing.ExpressionGraph.CompileStrategy
+{
+    public interface ICompileStrategyFactory
+    {
+        CompileStrategy Create(Expression expression);
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/CompileStrategy/StringConcatStrategy.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/CompileStrategy/StringConcatStrategy.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/CompileStrategy/StringConcatStrategy.cs	(revision 12707)
@@ -0,0 +1,62 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing.ExpressionGraph.CompileStrategy
+{
+    public class StringConcatStrategy : CompileStrategy
+    {
+        public StringConcatStrategy(Expression expression)
+            : base(expression)
+        {
+           
+        }
+
+        public override Expression Compile()
+        {
+            var newExp = _expression is ExcelAddressExpression ? _expression : ExpressionConverter.Instance.ToStringExpression(_expression);
+            newExp.Prev = _expression.Prev;
+            newExp.Next = _expression.Next;
+            if (_expression.Prev != null)
+            {
+                _expression.Prev.Next = newExp;
+            }
+            if (_expression.Next != null)
+            {
+                _expression.Next.Prev = newExp;
+            }
+            return newExp.MergeWithNext();
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/ConstantExpressions.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/ConstantExpressions.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/ConstantExpressions.cs	(revision 12707)
@@ -0,0 +1,31 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing.ExpressionGraph
+{
+    public static class ConstantExpressions
+    {
+        public static Expression Percent
+        {
+            get { return new ConstantExpression("Percent", () => new CompileResult(0.01, DataType.Decimal)); }
+        }
+    }
+
+    public class ConstantExpression : AtomicExpression
+    {
+        private readonly Func<CompileResult> _factoryMethod;
+
+        public ConstantExpression(string title, Func<CompileResult> factoryMethod)
+            : base(title)
+        {
+            _factoryMethod = factoryMethod;
+        }
+
+        public override CompileResult Compile()
+        {
+            return _factoryMethod();
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/DataType.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/DataType.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/DataType.cs	(revision 12707)
@@ -0,0 +1,52 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing.ExpressionGraph
+{
+    public enum DataType
+    {
+        Integer,
+        Decimal,
+        String,
+        Boolean,
+        Date,
+        Time,
+        Enumerable,
+        LookupArray,
+        ExcelAddress,
+        ExcelError,
+        Empty
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/DateExpression.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/DateExpression.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/DateExpression.cs	(revision 12707)
@@ -0,0 +1,53 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing.ExpressionGraph
+{
+    public class DateExpression : AtomicExpression
+    {
+        public DateExpression(string expression)
+            : base(expression)
+        {
+
+        }
+
+        public override CompileResult Compile()
+        {
+            var date = double.Parse(ExpressionString,CultureInfo.InvariantCulture);
+            return new CompileResult(DateTime.FromOADate(date), DataType.Date);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/DecimalExpression.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/DecimalExpression.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/DecimalExpression.cs	(revision 12707)
@@ -0,0 +1,69 @@
+﻿using System;
+using System.Collections.Generic;
+/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System.Linq;
+using System.Text;
+using System.Globalization;
+
+namespace OfficeOpenXml.FormulaParsing.ExpressionGraph
+{
+    public class DecimalExpression : AtomicExpression
+    {
+        private readonly double? _compiledValue;
+        private readonly bool _negate;
+
+        public DecimalExpression(string expression)
+            : this(expression, false)
+        {
+            
+        }
+
+        public DecimalExpression(string expression, bool negate)
+            : base(expression)
+        {
+            _negate = negate;
+        }
+
+        public DecimalExpression(double compiledValue)
+            : base(compiledValue.ToString(CultureInfo.InvariantCulture))
+        {
+            _compiledValue = compiledValue;
+        }
+
+        public override CompileResult Compile()
+        {
+            double result = _compiledValue.HasValue ? _compiledValue.Value : double.Parse(ExpressionString, CultureInfo.InvariantCulture);
+            result = _negate ? result * -1 : result;
+            return new CompileResult(result, DataType.Decimal);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/EnumerableExpression.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/EnumerableExpression.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/EnumerableExpression.cs	(revision 12707)
@@ -0,0 +1,73 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing.ExpressionGraph
+{
+    public class EnumerableExpression : Expression
+    {
+        public EnumerableExpression()
+            : this(new ExpressionCompiler())
+        {
+
+        }
+
+        public EnumerableExpression(IExpressionCompiler expressionCompiler)
+        {
+            _expressionCompiler = expressionCompiler;
+        }
+
+        private readonly IExpressionCompiler _expressionCompiler;
+
+        public override bool IsGroupedExpression
+        {
+            get { return false; }
+        }
+
+        public override Expression PrepareForNextChild()
+        {
+            return this;
+        }
+
+        public override CompileResult Compile()
+        {
+            var result = new List<object>();
+            foreach (var childExpression in Children)
+            {
+                result.Add(_expressionCompiler.Compile(new List<Expression>{ childExpression }).Result);
+            }
+            return new CompileResult(result, DataType.Enumerable);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/ExcelAddressExpression.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/ExcelAddressExpression.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/ExcelAddressExpression.cs	(revision 12707)
@@ -0,0 +1,122 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing;
+using OfficeOpenXml.FormulaParsing.ExcelUtilities;
+using OfficeOpenXml.FormulaParsing.Exceptions;
+using OfficeOpenXml.FormulaParsing.LexicalAnalysis;
+using OfficeOpenXml.FormulaParsing.Utilities;
+
+namespace OfficeOpenXml.FormulaParsing.ExpressionGraph
+{
+    public class ExcelAddressExpression : AtomicExpression
+    {
+        private readonly ExcelDataProvider _excelDataProvider;
+        private readonly ParsingContext _parsingContext;
+        private readonly RangeAddressFactory _rangeAddressFactory;
+        private readonly bool _negate;
+
+        public ExcelAddressExpression(string expression, ExcelDataProvider excelDataProvider, ParsingContext parsingContext)
+            : this(expression, excelDataProvider, parsingContext, new RangeAddressFactory(excelDataProvider), false)
+        {
+
+        }
+        public ExcelAddressExpression(string expression, ExcelDataProvider excelDataProvider, ParsingContext parsingContext, bool negate)
+            : this(expression, excelDataProvider, parsingContext, new RangeAddressFactory(excelDataProvider), negate)
+        {
+
+        }
+
+        public ExcelAddressExpression(string expression, ExcelDataProvider excelDataProvider, ParsingContext parsingContext, RangeAddressFactory rangeAddressFactory, bool negate)
+            : base(expression)
+        {
+            Require.That(excelDataProvider).Named("excelDataProvider").IsNotNull();
+            Require.That(parsingContext).Named("parsingContext").IsNotNull();
+            Require.That(rangeAddressFactory).Named("rangeAddressFactory").IsNotNull();
+            _excelDataProvider = excelDataProvider;
+            _parsingContext = parsingContext;
+            _rangeAddressFactory = rangeAddressFactory;
+            _negate = negate;
+        }
+
+        public override bool IsGroupedExpression
+        {
+            get { return false; }
+        }
+
+        public override CompileResult Compile()
+        {
+            if (ParentIsLookupFunction)
+            {
+                return new CompileResult(ExpressionString, DataType.ExcelAddress);
+            }
+            else
+            {
+                return CompileRangeValues();
+            }
+        }
+
+        private CompileResult CompileRangeValues()
+        {
+            var c = this._parsingContext.Scopes.Current;
+            var result = _excelDataProvider.GetRange(c.Address.Worksheet, c.Address.FromRow, c.Address.FromCol, ExpressionString);
+            
+            if (result == null || result.IsEmpty)
+            {
+                return CompileResult.Empty;
+            }
+            if (result.Address.Rows > 1 || result.Address.Columns > 1)
+            {
+                return new CompileResult(result, DataType.Enumerable);
+            }
+            else
+            {
+                return CompileSingleCell(result);
+            }
+        }
+
+        private CompileResult CompileSingleCell(ExcelDataProvider.IRangeInfo result)
+        {
+            var cell = result.First();
+            var factory = new CompileResultFactory();
+            var compileResult = factory.Create(cell.Value);
+            if (_negate && compileResult.IsNumeric)
+            {
+                compileResult = new CompileResult(compileResult.ResultNumeric * -1, compileResult.DataType);
+            }
+            compileResult.IsHiddenCell = cell.IsHiddenRow;
+            return compileResult;
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/ExcelErrorExpression.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/ExcelErrorExpression.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/ExcelErrorExpression.cs	(revision 12707)
@@ -0,0 +1,74 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing;
+using OfficeOpenXml.FormulaParsing.ExcelUtilities;
+using OfficeOpenXml.FormulaParsing.Utilities;
+
+namespace OfficeOpenXml.FormulaParsing.ExpressionGraph
+{
+    public class ExcelErrorExpression : Expression
+    {
+        ExcelErrorValue _error;
+        public ExcelErrorExpression(string expression, ExcelErrorValue error)
+            : base(expression)
+        {
+            _error = error;
+        }
+
+        public ExcelErrorExpression(ExcelErrorValue error)
+            : this(error.ToString(), error)
+        {
+            
+        }
+
+        public override bool IsGroupedExpression
+        {
+            get { return false; }
+        }
+
+        public override CompileResult Compile()
+        {
+            return new CompileResult(_error, DataType.ExcelError);
+            //if (ParentIsLookupFunction)
+            //{
+            //    return new CompileResult(ExpressionString, DataType.ExcelError);
+            //}
+            //else
+            //{
+            //    return CompileRangeValues();
+            //}
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/Expression.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/Expression.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/Expression.cs	(revision 12707)
@@ -0,0 +1,128 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.Excel.Operators;
+using OfficeOpenXml.FormulaParsing.Exceptions;
+
+namespace OfficeOpenXml.FormulaParsing.ExpressionGraph
+{
+    public abstract class Expression
+    {
+        protected string ExpressionString { get; private set; }
+        private readonly List<Expression> _children = new List<Expression>();
+        public IEnumerable<Expression> Children { get { return _children; } }
+        public Expression Next { get; set; }
+        public Expression Prev { get; set; }
+        public IOperator Operator { get; set; }
+        public abstract bool IsGroupedExpression { get; }
+
+        public Expression()
+        {
+
+        }
+
+        public Expression(string expression)
+        {
+            ExpressionString = expression;
+            Operator = null;
+        }
+
+        public virtual bool ParentIsLookupFunction
+        {
+            get;
+            set;
+        }
+
+        public virtual bool HasChildren
+        {
+            get { return _children.Any(); }
+        }
+
+        public virtual Expression  PrepareForNextChild()
+        {
+            return this;
+        }
+
+        public virtual Expression AddChild(Expression child)
+        {
+            if (_children.Any())
+            {
+                var last = _children.Last();
+                child.Prev = last;
+                last.Next = child;
+            }
+            _children.Add(child);
+            return child;
+        }
+
+        public virtual Expression MergeWithNext()
+        {
+            var expression = this;
+            if (Next != null && Operator != null)
+            {
+                var result = Operator.Apply(Compile(), Next.Compile());
+                expression = ExpressionConverter.Instance.FromCompileResult(result);
+                if (expression is ExcelErrorExpression)
+                {
+                    expression.Next = null;
+                    expression.Prev = null;
+                    return expression;
+                }
+                if (Next != null)
+                {
+                    expression.Operator = Next.Operator;
+                }
+                else
+                {
+                    expression.Operator = null;
+                }
+                expression.Next = Next.Next;
+                if (expression.Next != null) expression.Next.Prev = expression;
+                expression.Prev = Prev;
+            }
+            else
+            {
+                throw (new FormatException("Invalid formula syntax. Operator missing expression."));
+            }
+            if (Prev != null)
+            {
+                Prev.Next = expression;
+            }            
+            return expression;
+        }
+
+        public abstract CompileResult Compile();
+
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/ExpressionCompiler.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/ExpressionCompiler.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/ExpressionCompiler.cs	(revision 12707)
@@ -0,0 +1,157 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.Excel.Operators;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph.CompileStrategy;
+
+namespace OfficeOpenXml.FormulaParsing.ExpressionGraph
+{
+    public class ExpressionCompiler : IExpressionCompiler
+    {
+        private IEnumerable<Expression> _expressions;
+        private IExpressionConverter _expressionConverter;
+        private ICompileStrategyFactory _compileStrategyFactory;
+
+        public ExpressionCompiler()
+            : this(new ExpressionConverter(), new CompileStrategyFactory())
+        {
+ 
+        }
+
+        public ExpressionCompiler(IExpressionConverter expressionConverter, ICompileStrategyFactory compileStrategyFactory)
+        {
+            _expressionConverter = expressionConverter;
+            _compileStrategyFactory = compileStrategyFactory;
+        }
+
+        public CompileResult Compile(IEnumerable<Expression> expressions)
+        {
+            _expressions = expressions;
+            return PerformCompilation();
+        }
+        public CompileResult Compile(string worksheet, int row, int column, IEnumerable<Expression> expressions)
+        {
+            _expressions = expressions;
+            return PerformCompilation(worksheet, row, column);
+        }
+
+        private CompileResult PerformCompilation(string worksheet="", int row=-1, int column=-1)
+        {
+            var compiledExpressions = HandleGroupedExpressions();
+            while(compiledExpressions.Any(x => x.Operator != null))
+            {
+                var prec = FindLowestPrecedence();
+                compiledExpressions = HandlePrecedenceLevel(prec);
+            }
+            if (_expressions.Any())
+            {
+                return compiledExpressions.First().Compile();
+            }
+            return CompileResult.Empty;
+        }
+
+        private IEnumerable<Expression> HandleGroupedExpressions()
+        {
+            if (!_expressions.Any()) return Enumerable.Empty<Expression>();
+            var first = _expressions.First();
+            var groupedExpressions = _expressions.Where(x => x.IsGroupedExpression);
+            foreach(var groupedExpression in groupedExpressions)
+            {
+                var result = groupedExpression.Compile();
+                if (result == CompileResult.Empty) continue;
+                var newExp = _expressionConverter.FromCompileResult(result);
+                newExp.Operator = groupedExpression.Operator;
+                newExp.Prev = groupedExpression.Prev;
+                newExp.Next = groupedExpression.Next;
+                if (groupedExpression.Prev != null)
+                {
+                    groupedExpression.Prev.Next = newExp;
+                }
+                if (groupedExpression.Next != null)
+                {
+                    groupedExpression.Next.Prev = newExp;
+                }
+                if (groupedExpression == first)
+                {
+                    first = newExp;
+                }
+            }
+            return RefreshList(first);
+        }
+
+        private IEnumerable<Expression> HandlePrecedenceLevel(int precedence)
+        {
+            var first = _expressions.First();
+            var expressionsToHandle = _expressions.Where(x => x.Operator != null && x.Operator.Precedence == precedence);
+            var last = expressionsToHandle.Last();
+            var expression = expressionsToHandle.First();
+            do
+            {
+                var strategy = _compileStrategyFactory.Create(expression);
+                var compiledExpression = strategy.Compile();
+                if(compiledExpression is ExcelErrorExpression)
+                {
+                    return RefreshList(compiledExpression);
+                }
+                if (expression == first)
+                {
+                    first = compiledExpression;
+                }
+
+                expression = compiledExpression;
+            }
+            while (expression != null && expression.Operator != null && expression.Operator.Precedence == precedence);
+            return RefreshList(first);
+        }
+
+        private int FindLowestPrecedence()
+        {
+            return _expressions.Where(x => x.Operator != null).Min(x => x.Operator.Precedence);
+        }
+
+        private IEnumerable<Expression> RefreshList(Expression first)
+        {
+            var resultList = new List<Expression>();
+            var exp = first;
+            resultList.Add(exp);
+            while (exp.Next != null)
+            {
+                resultList.Add(exp.Next);
+                exp = exp.Next;
+            }
+            _expressions = resultList;
+            return resultList;
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/ExpressionConverter.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/ExpressionConverter.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/ExpressionConverter.cs	(revision 12707)
@@ -0,0 +1,95 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing.ExpressionGraph
+{
+    public class ExpressionConverter : IExpressionConverter
+    {
+        public StringExpression ToStringExpression(Expression expression)
+        {
+            var result = expression.Compile();
+            var newExp = new StringExpression(result.Result.ToString());
+            newExp.Operator = expression.Operator;
+            return newExp;
+        }
+
+        public Expression FromCompileResult(CompileResult compileResult)
+        {
+            switch (compileResult.DataType)
+            {
+                case DataType.Integer:
+                    return compileResult.Result is string
+                        ? new IntegerExpression(compileResult.Result.ToString())
+                        : new IntegerExpression(Convert.ToDouble(compileResult.Result));
+                case DataType.String:
+                    return new StringExpression(compileResult.Result.ToString());
+                case DataType.Decimal:
+                    return compileResult.Result is string
+                               ? new DecimalExpression(compileResult.Result.ToString())
+                               : new DecimalExpression(((double) compileResult.Result));
+                case DataType.Boolean:
+                    return compileResult.Result is string
+                               ? new BooleanExpression(compileResult.Result.ToString())
+                               : new BooleanExpression((bool) compileResult.Result);
+                //case DataType.Enumerable:
+                //    return 
+                case DataType.ExcelError:
+                    //throw (new OfficeOpenXml.FormulaParsing.Exceptions.ExcelErrorValueException((ExcelErrorValue)compileResult.Result)); //Added JK
+                    return compileResult.Result is string
+                        ? new ExcelErrorExpression(compileResult.Result.ToString(),
+                            ExcelErrorValue.Parse(compileResult.Result.ToString()))
+                        : new ExcelErrorExpression((ExcelErrorValue) compileResult.Result);
+                case DataType.Empty:
+                   return new IntegerExpression(0); //Added JK
+
+            }
+            return null;
+        }
+
+        private static IExpressionConverter _instance;
+        public static IExpressionConverter Instance
+        {
+            get
+            {
+                if (_instance == null)
+                {
+                    _instance = new ExpressionConverter();
+                }
+                return _instance;
+            }
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/ExpressionFactory.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/ExpressionFactory.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/ExpressionFactory.cs	(revision 12707)
@@ -0,0 +1,81 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing;
+using OfficeOpenXml.FormulaParsing.LexicalAnalysis;
+
+namespace OfficeOpenXml.FormulaParsing.ExpressionGraph
+{
+    public class ExpressionFactory : IExpressionFactory
+    {
+        private readonly ExcelDataProvider _excelDataProvider;
+        private readonly ParsingContext _parsingContext;
+
+        public ExpressionFactory(ExcelDataProvider excelDataProvider, ParsingContext context)
+        {
+            _excelDataProvider = excelDataProvider;
+            _parsingContext = context;
+        }
+
+
+        public Expression Create(Token token)
+        {
+            switch (token.TokenType)
+            {
+                case TokenType.Integer:
+                    return new IntegerExpression(token.Value, token.IsNegated);
+                case TokenType.String:
+                    return new StringExpression(token.Value);
+                case TokenType.Decimal:
+                    return new DecimalExpression(token.Value, token.IsNegated);
+                case TokenType.Boolean:
+                    return new BooleanExpression(token.Value);
+                case TokenType.ExcelAddress:
+                    return new ExcelAddressExpression(token.Value, _excelDataProvider, _parsingContext, token.IsNegated);
+                case TokenType.InvalidReference:
+                    return new ExcelErrorExpression(token.Value, ExcelErrorValue.Create(eErrorType.Ref));
+                case TokenType.NumericError:
+                    return new ExcelErrorExpression(token.Value, ExcelErrorValue.Create(eErrorType.Num));
+                case TokenType.ValueDataTypeError:
+                    return new ExcelErrorExpression(token.Value, ExcelErrorValue.Create(eErrorType.Value));
+                case TokenType.Null:
+                    return new ExcelErrorExpression(token.Value, ExcelErrorValue.Create(eErrorType.Null));
+                case TokenType.NameValue:
+                    return new NamedValueExpression(token.Value, _parsingContext);
+                default:
+                    return new StringExpression(token.Value);
+            }
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/ExpressionGraph.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/ExpressionGraph.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/ExpressionGraph.cs	(revision 12707)
@@ -0,0 +1,71 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing.ExpressionGraph
+{
+    public class ExpressionGraph
+    {
+        private List<Expression> _expressions = new List<Expression>();
+        public IEnumerable<Expression> Expressions { get { return _expressions; } }
+        public Expression Current { get; private set; }
+
+        public Expression Add(Expression expression)
+        {
+            _expressions.Add(expression);
+            if (Current != null)
+            {
+                Current.Next = expression;
+                expression.Prev = Current;
+            }
+            Current = expression;
+            return expression;
+        }
+
+        public void Reset()
+        {
+            _expressions.Clear();
+            Current = null;
+        }
+
+        public void Remove(Expression item)
+        {
+            if (item == Current)
+            {
+                Current = item.Prev ?? item.Next;
+            }
+            _expressions.Remove(item);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/ExpressionGraphBuilder.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/ExpressionGraphBuilder.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/ExpressionGraphBuilder.cs	(revision 12707)
@@ -0,0 +1,250 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.Excel.Operators;
+using OfficeOpenXml.FormulaParsing.Exceptions;
+using OfficeOpenXml.FormulaParsing.LexicalAnalysis;
+using OfficeOpenXml.FormulaParsing.Excel;
+using OfficeOpenXml.FormulaParsing;
+
+namespace OfficeOpenXml.FormulaParsing.ExpressionGraph
+{
+    public class ExpressionGraphBuilder :IExpressionGraphBuilder
+    {
+        private readonly ExpressionGraph _graph = new ExpressionGraph();
+        private readonly IExpressionFactory _expressionFactory;
+        private readonly ParsingContext _parsingContext;
+        private int _tokenIndex = 0;
+        private bool _negateNextExpression;
+
+        public ExpressionGraphBuilder(ExcelDataProvider excelDataProvider, ParsingContext parsingContext)
+            : this(new ExpressionFactory(excelDataProvider, parsingContext), parsingContext)
+        {
+
+        }
+
+        public ExpressionGraphBuilder(IExpressionFactory expressionFactory, ParsingContext parsingContext)
+        {
+            _expressionFactory = expressionFactory;
+            _parsingContext = parsingContext;
+        }
+
+        public ExpressionGraph Build(IEnumerable<Token> tokens)
+        {
+            _tokenIndex = 0;
+            _graph.Reset();
+            var tokensArr = tokens != null ? tokens.ToArray() : new Token[0];
+            BuildUp(tokensArr, null);
+            return _graph;
+        }
+
+        private void BuildUp(Token[] tokens, Expression parent)
+        {
+            while (_tokenIndex < tokens.Length)
+            {
+                var token = tokens[_tokenIndex];
+                IOperator op = null;
+                if (token.TokenType == TokenType.Operator && OperatorsDict.Instance.TryGetValue(token.Value, out op))
+                {
+                    SetOperatorOnExpression(parent, op);
+                }
+                else if (token.TokenType == TokenType.Function)
+                {
+                    BuildFunctionExpression(tokens, parent, token.Value);
+                }
+                else if (token.TokenType == TokenType.OpeningEnumerable)
+                {
+                    _tokenIndex++;
+                    BuildEnumerableExpression(tokens, parent);
+                }
+                else if (token.TokenType == TokenType.OpeningParenthesis)
+                {
+                    _tokenIndex++;
+                    BuildGroupExpression(tokens, parent);
+                    //if (parent is FunctionExpression)
+                    //{
+                    //    return;
+                    //}
+                }
+                else if (token.TokenType == TokenType.ClosingParenthesis || token.TokenType == TokenType.ClosingEnumerable)
+                {
+                    break;
+                }
+                else if (token.TokenType == TokenType.Negator)
+                {
+                    _negateNextExpression = true;
+                }
+                else if(token.TokenType == TokenType.Percent)
+                {
+                    SetOperatorOnExpression(parent, Operator.Percent);
+                    if (parent == null)
+                    {
+                        _graph.Add(ConstantExpressions.Percent);
+                    }
+                    else
+                    {
+                        parent.AddChild(ConstantExpressions.Percent);
+                    }
+                }
+                else
+                {
+                    CreateAndAppendExpression(ref parent, token);
+                }
+                _tokenIndex++;
+            }
+        }
+
+        private void BuildEnumerableExpression(Token[] tokens, Expression parent)
+        {
+            if (parent == null)
+            {
+                _graph.Add(new EnumerableExpression());
+                BuildUp(tokens, _graph.Current);
+            }
+            else
+            {
+                var enumerableExpression = new EnumerableExpression();
+                parent.AddChild(enumerableExpression);
+                BuildUp(tokens, enumerableExpression);
+            }
+        }
+
+        private void CreateAndAppendExpression(ref Expression parent, Token token)
+        {
+            if (IsWaste(token)) return;
+            if (parent != null && 
+                (token.TokenType == TokenType.Comma || token.TokenType == TokenType.SemiColon))
+            {
+                parent = parent.PrepareForNextChild();
+                return;
+            }
+            if (_negateNextExpression)
+            {
+                token.Negate();
+                _negateNextExpression = false;
+            }
+            var expression = _expressionFactory.Create(token);
+            if (parent == null)
+            {
+                _graph.Add(expression);
+            }
+            else
+            {
+                parent.AddChild(expression);
+            }
+        }
+
+        private bool IsWaste(Token token)
+        {
+            if (token.TokenType == TokenType.String)
+            {
+                return true;
+            }
+            return false;
+        }
+
+        private void BuildFunctionExpression(Token[] tokens, Expression parent, string funcName)
+        {
+            if (parent == null)
+            {
+                _graph.Add(new FunctionExpression(funcName, _parsingContext, _negateNextExpression));
+                _negateNextExpression = false;
+                HandleFunctionArguments(tokens, _graph.Current);
+            }
+            else
+            {
+                var func = new FunctionExpression(funcName, _parsingContext, _negateNextExpression);
+                _negateNextExpression = false;
+                parent.AddChild(func);
+                HandleFunctionArguments(tokens, func);
+            }
+        }
+
+        private void HandleFunctionArguments(Token[] tokens, Expression function)
+        {
+            _tokenIndex++;
+            var token = tokens.ElementAt(_tokenIndex);
+            if (token.TokenType != TokenType.OpeningParenthesis)
+            {
+                throw new ExcelErrorValueException(eErrorType.Value);
+            }
+            _tokenIndex++;
+            BuildUp(tokens, function.Children.First());
+        }
+
+        private void BuildGroupExpression(Token[] tokens, Expression parent)
+        {
+            if (parent == null)
+            {
+                _graph.Add(new GroupExpression());
+                BuildUp(tokens, _graph.Current);
+            }
+            else
+            {
+                if (parent.IsGroupedExpression || parent is FunctionArgumentExpression)
+                {
+                    var newGroupExpression = new GroupExpression();
+                    parent.AddChild(newGroupExpression);
+                    BuildUp(tokens, newGroupExpression);
+                }
+                 BuildUp(tokens, parent);
+            }
+        }
+
+        private void SetOperatorOnExpression(Expression parent, IOperator op)
+        {
+            if (parent == null)
+            {
+                _graph.Current.Operator = op;
+            }
+            else
+            {
+                Expression candidate;
+                if (parent is FunctionArgumentExpression)
+                {
+                    candidate = parent.Children.Last();
+                }
+                else
+                {
+                    candidate = parent.Children.Last();
+                    if (candidate is FunctionArgumentExpression)
+                    {
+                        candidate = candidate.Children.Last();
+                    }
+                }
+                candidate.Operator = op;
+            }
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/FunctionArgumentExpression.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/FunctionArgumentExpression.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/FunctionArgumentExpression.cs	(revision 12707)
@@ -0,0 +1,73 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing.ExpressionGraph
+{
+    public class FunctionArgumentExpression : GroupExpression
+    {
+        private readonly Expression _function;
+
+        public FunctionArgumentExpression(Expression function)
+        {
+            _function = function;
+        }
+
+        public override bool ParentIsLookupFunction
+        {
+            get
+            {
+                return base.ParentIsLookupFunction;
+            }
+            set
+            {
+                base.ParentIsLookupFunction = value;
+                foreach (var child in Children)
+                {
+                    child.ParentIsLookupFunction = value;
+                }
+            }
+        }
+
+        public override bool IsGroupedExpression
+        {
+            get { return false; }
+        }
+
+        public override Expression PrepareForNextChild()
+        {
+            return _function.PrepareForNextChild();
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/FunctionCompilers/DefaultCompiler.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/FunctionCompilers/DefaultCompiler.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/FunctionCompilers/DefaultCompiler.cs	(revision 12707)
@@ -0,0 +1,69 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.Excel;
+using OfficeOpenXml.FormulaParsing.Excel.Functions;
+
+namespace OfficeOpenXml.FormulaParsing.ExpressionGraph.FunctionCompilers
+{
+    public class DefaultCompiler : FunctionCompiler
+    {
+        public DefaultCompiler(ExcelFunction function)
+            : base(function)
+        {
+
+        }
+
+        public override CompileResult Compile(IEnumerable<Expression> children, ParsingContext context)
+        {
+            var args = new List<FunctionArgument>();
+            Function.BeforeInvoke(context);
+            foreach (var child in children)
+            {
+                var compileResult = child.Compile();
+                if (compileResult.IsResultOfSubtotal)
+                {
+                    var arg = new FunctionArgument(compileResult.Result);
+                    arg.SetExcelStateFlag(ExcelCellState.IsResultOfSubtotal);
+                    args.Add(arg);
+                }
+                else
+                {
+                    BuildFunctionArguments(compileResult.Result, args);     
+                }
+            }
+            return Function.Execute(args, context);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/FunctionCompilers/ErrorHandlingFunctionCompiler.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/FunctionCompilers/ErrorHandlingFunctionCompiler.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/FunctionCompilers/ErrorHandlingFunctionCompiler.cs	(revision 12707)
@@ -0,0 +1,71 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.Excel.Functions;
+using OfficeOpenXml.FormulaParsing.Exceptions;
+
+namespace OfficeOpenXml.FormulaParsing.ExpressionGraph.FunctionCompilers
+{
+    public class ErrorHandlingFunctionCompiler : FunctionCompiler
+    {
+        public ErrorHandlingFunctionCompiler(ExcelFunction function)
+            : base(function)
+        {
+
+        }
+        public override CompileResult Compile(IEnumerable<Expression> children, ParsingContext context)
+        {
+            var args = new List<FunctionArgument>();
+            Function.BeforeInvoke(context);
+            foreach (var child in children)
+            {
+                try
+                {
+                    var arg = child.Compile();
+                    BuildFunctionArguments(arg != null ? arg.Result : null, args);
+                }
+                catch (ExcelErrorValueException efe)
+                {
+                    return ((ErrorHandlingFunction)Function).HandleError(efe.ErrorValue.ToString());
+                }
+                catch// (Exception e)
+                {
+                    return ((ErrorHandlingFunction)Function).HandleError(ExcelErrorValue.Values.Value);
+                }
+                
+            }
+            return Function.Execute(args, context);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/FunctionCompilers/FunctionCompiler.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/FunctionCompilers/FunctionCompiler.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/FunctionCompilers/FunctionCompiler.cs	(revision 12707)
@@ -0,0 +1,75 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.Excel.Functions;
+using System.Collections;
+using OfficeOpenXml.FormulaParsing.Utilities;
+
+namespace OfficeOpenXml.FormulaParsing.ExpressionGraph.FunctionCompilers
+{
+    public abstract class FunctionCompiler
+    {
+        protected ExcelFunction Function
+        {
+            get;
+            private set;
+        }
+
+        public FunctionCompiler(ExcelFunction function)
+        {
+            Require.That(function).Named("function").IsNotNull();
+            Function = function;
+        }
+
+        protected void BuildFunctionArguments(object result, List<FunctionArgument> args)
+        {
+            if (result is IEnumerable<object> && !(result is ExcelDataProvider.IRangeInfo))
+            {
+                var argList = new List<FunctionArgument>();
+                var objects = result as IEnumerable<object>;
+                foreach (var arg in objects)
+                {
+                    BuildFunctionArguments(arg, argList);
+                }
+                args.Add(new FunctionArgument(argList));
+            }
+            else
+            {
+                args.Add(new FunctionArgument(result));
+            }
+        }
+
+        public abstract CompileResult Compile(IEnumerable<Expression> children, ParsingContext context);
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/FunctionCompilers/FunctionCompilerFactory.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/FunctionCompilers/FunctionCompilerFactory.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/FunctionCompilers/FunctionCompilerFactory.cs	(revision 12707)
@@ -0,0 +1,67 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.Excel.Functions;
+using OfficeOpenXml.FormulaParsing.Excel.Functions.Logical;
+
+namespace OfficeOpenXml.FormulaParsing.ExpressionGraph.FunctionCompilers
+{
+    public class FunctionCompilerFactory
+    {
+        private readonly Dictionary<Type, FunctionCompiler> _specialCompilers = new Dictionary<Type, FunctionCompiler>();
+
+        public FunctionCompilerFactory(FunctionRepository repository)
+        {
+            _specialCompilers.Add(typeof(If), new IfFunctionCompiler(repository.GetFunction("if")));
+            _specialCompilers.Add(typeof(IfError), new IfErrorFunctionCompiler(repository.GetFunction("iferror")));
+            _specialCompilers.Add(typeof(IfNa), new IfNaFunctionCompiler(repository.GetFunction("ifna")));
+        }
+
+        private FunctionCompiler GetCompilerByType(ExcelFunction function)
+        {
+            var funcType = function.GetType();
+            if (_specialCompilers.ContainsKey(funcType))
+            {
+                return _specialCompilers[funcType];
+            }
+            return new DefaultCompiler(function);
+        }
+        public virtual FunctionCompiler Create(ExcelFunction function)
+        {
+            if (function.IsLookupFuction) return new LookupFunctionCompiler(function);
+            if (function.IsErrorHandlingFunction) return new ErrorHandlingFunctionCompiler(function);
+            return GetCompilerByType(function);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/FunctionCompilers/IfErrorFunctionCompiler.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/FunctionCompilers/IfErrorFunctionCompiler.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/FunctionCompilers/IfErrorFunctionCompiler.cs	(revision 12707)
@@ -0,0 +1,48 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.Excel.Functions;
+using OfficeOpenXml.FormulaParsing.Excel.Functions.Logical;
+using OfficeOpenXml.FormulaParsing.Exceptions;
+using OfficeOpenXml.FormulaParsing.Utilities;
+
+namespace OfficeOpenXml.FormulaParsing.ExpressionGraph.FunctionCompilers
+{
+    public class IfErrorFunctionCompiler : FunctionCompiler
+    {
+        public IfErrorFunctionCompiler(ExcelFunction function)
+            : base(function)
+        {
+            Require.That(function).Named("function").IsNotNull();
+          
+        }
+
+        public override CompileResult Compile(IEnumerable<Expression> children, ParsingContext context)
+        {
+            if (children.Count() != 2) throw new ExcelErrorValueException(eErrorType.Value);
+            var args = new List<FunctionArgument>();
+            Function.BeforeInvoke(context);
+            var firstChild = children.First();
+            var lastChild = children.ElementAt(1);
+            try
+            {
+                var result = firstChild.Compile();
+                if (result.DataType == DataType.ExcelError)
+                {
+                    args.Add(new FunctionArgument(lastChild.Compile().Result));
+                }
+                else
+                {
+                    args.Add(new FunctionArgument(result.Result)); 
+                }
+                
+            }
+            catch (ExcelErrorValueException ex)
+            {
+                args.Add(new FunctionArgument(lastChild.Compile().Result));
+            }
+            return Function.Execute(args, context);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/FunctionCompilers/IfFunctionCompiler.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/FunctionCompilers/IfFunctionCompiler.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/FunctionCompilers/IfFunctionCompiler.cs	(revision 12707)
@@ -0,0 +1,114 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2014-01-27
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.Excel.Functions;
+using OfficeOpenXml.FormulaParsing.Excel.Functions.Logical;
+using OfficeOpenXml.FormulaParsing.Exceptions;
+using OfficeOpenXml.FormulaParsing.Utilities;
+
+namespace OfficeOpenXml.FormulaParsing.ExpressionGraph.FunctionCompilers
+{
+    /// <summary>
+    /// Why do the If function require a compiler of its own you might ask;)
+    /// 
+    /// It is because it only needs to evaluate one of the two last expressions. This
+    /// compiler handles this - it ignores the irrelevant expression.
+    /// </summary>
+    public class IfFunctionCompiler : FunctionCompiler
+    {
+        public IfFunctionCompiler(ExcelFunction function)
+            : base(function)
+        {
+            Require.That(function).Named("function").IsNotNull();
+            if (!(function is If)) throw new ArgumentException("function must be of type If");
+        }
+
+        public override CompileResult Compile(IEnumerable<Expression> children, ParsingContext context)
+        {
+            if(children.Count() < 3) throw new ExcelErrorValueException(eErrorType.Value);
+            var args = new List<FunctionArgument>();
+            Function.BeforeInvoke(context);
+            var firstChild = children.ElementAt(0);
+            var v = firstChild.Compile().Result;
+
+            /****  Handle names and ranges ****/
+            if (v is ExcelDataProvider.INameInfo)
+            {
+                v = ((ExcelDataProvider.INameInfo)v).Value;
+            }
+            
+            if (v is ExcelDataProvider.IRangeInfo)
+            {
+                var r=((ExcelDataProvider.IRangeInfo)v);
+                if(r.GetNCells()>1)
+                {
+                    throw(new ArgumentException("Logical can't be more than one cell"));
+                }
+                v = r.GetOffset(0, 0);
+            }
+            bool boolVal;
+            if(v is bool)
+            {
+                boolVal = (bool)v;
+            }
+            else
+            {
+                if(OfficeOpenXml.Utils.ConvertUtil.IsNumeric(v))
+                {
+                    boolVal = OfficeOpenXml.Utils.ConvertUtil.GetValueDouble(v)!=0;
+                }
+                else
+                {
+                    throw (new ArgumentException("Invalid logical test"));
+                }
+            }
+            /****  End Handle names and ranges ****/
+            
+            args.Add(new FunctionArgument(boolVal));
+            if (boolVal)
+            {
+                var val = children.ElementAt(1).Compile().Result;
+                args.Add(new FunctionArgument(val));
+                args.Add(new FunctionArgument(null));
+            }
+            else
+            {
+                var val = children.ElementAt(2).Compile().Result;
+                args.Add(new FunctionArgument(null));
+                args.Add(new FunctionArgument(val));
+            }
+            return Function.Execute(args, context);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/FunctionCompilers/IfNaFunctionCompiler.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/FunctionCompilers/IfNaFunctionCompiler.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/FunctionCompilers/IfNaFunctionCompiler.cs	(revision 12707)
@@ -0,0 +1,46 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.Excel.Functions;
+using OfficeOpenXml.FormulaParsing.Exceptions;
+
+namespace OfficeOpenXml.FormulaParsing.ExpressionGraph.FunctionCompilers
+{
+    public class IfNaFunctionCompiler : FunctionCompiler
+    {
+        public IfNaFunctionCompiler(ExcelFunction function)
+            :base(function)
+        {
+            
+        }
+
+        public override CompileResult Compile(IEnumerable<Expression> children, ParsingContext context)
+        {
+            if (children.Count() != 2) throw new ExcelErrorValueException(eErrorType.Value);
+            var args = new List<FunctionArgument>();
+            Function.BeforeInvoke(context);
+            var firstChild = children.First();
+            var lastChild = children.ElementAt(1);
+            try
+            {
+                var result = firstChild.Compile();
+                if (result.DataType == DataType.ExcelError && (Equals(result.Result,
+                    ExcelErrorValue.Create(eErrorType.NA))))
+                {
+                    args.Add(new FunctionArgument(lastChild.Compile().Result));
+                }
+                else
+                {
+                    args.Add(new FunctionArgument(result.Result));
+                }
+
+            }
+            catch (ExcelErrorValueException ex)
+            {
+                args.Add(new FunctionArgument(lastChild.Compile().Result));
+            }
+            return Function.Execute(args, context);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/FunctionCompilers/LookupFunctionCompiler.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/FunctionCompilers/LookupFunctionCompiler.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/FunctionCompilers/LookupFunctionCompiler.cs	(revision 12707)
@@ -0,0 +1,68 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.Excel.Functions;
+
+namespace OfficeOpenXml.FormulaParsing.ExpressionGraph.FunctionCompilers
+{
+    public class LookupFunctionCompiler : FunctionCompiler
+    {
+        public LookupFunctionCompiler(ExcelFunction function)
+            : base(function)
+        {
+
+        }
+
+        public override CompileResult Compile(IEnumerable<Expression> children, ParsingContext context)
+        {
+            var args = new List<FunctionArgument>();
+            Function.BeforeInvoke(context);
+            var firstChild = true;
+            foreach (var child in children)
+            {
+                if (!firstChild || Function.SkipArgumentEvaluation)
+                {
+                    child.ParentIsLookupFunction = Function.IsLookupFuction;
+                }
+                else
+                {
+                    firstChild = false;
+                }
+                var arg = child.Compile();
+                BuildFunctionArguments(arg != null ? arg.Result : null, args);
+            }
+            return Function.Execute(args, context);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/FunctionExpression.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/FunctionExpression.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/FunctionExpression.cs	(revision 12707)
@@ -0,0 +1,134 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.Excel;
+using OfficeOpenXml.FormulaParsing.Excel.Functions;
+using OfficeOpenXml.FormulaParsing.Exceptions;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph.FunctionCompilers;
+using OfficeOpenXml.Utils;
+
+namespace OfficeOpenXml.FormulaParsing.ExpressionGraph
+{
+    /// <summary>
+    /// Expression that handles execution of a function.
+    /// </summary>
+    public class FunctionExpression : AtomicExpression
+    {
+        /// <summary>
+        /// Constructor
+        /// </summary>
+        /// <param name="expression">should be the of the function</param>
+        /// <param name="parsingContext"></param>
+        /// <param name="isNegated">True if the numeric result of the function should be negated.</param>
+        public FunctionExpression(string expression, ParsingContext parsingContext, bool isNegated)
+            : base(expression)
+        {
+            _parsingContext = parsingContext;
+            _functionCompilerFactory = new FunctionCompilerFactory(parsingContext.Configuration.FunctionRepository);
+            _isNegated = isNegated;
+            base.AddChild(new FunctionArgumentExpression(this));
+        }
+
+        private readonly ParsingContext _parsingContext;
+        private readonly FunctionCompilerFactory _functionCompilerFactory;
+        private readonly bool _isNegated;
+
+
+        public override CompileResult Compile()
+        {
+            try
+            {
+                var function = _parsingContext.Configuration.FunctionRepository.GetFunction(ExpressionString);
+                if (function == null)
+                {
+                    if (_parsingContext.Debug)
+                    {
+                        _parsingContext.Configuration.Logger.Log(_parsingContext, string.Format("'{0}' is not a supported function", ExpressionString));
+                    }
+                    return new CompileResult(ExcelErrorValue.Create(eErrorType.Name), DataType.ExcelError);
+                }
+                if (_parsingContext.Debug)
+                {
+                    _parsingContext.Configuration.Logger.LogFunction(ExpressionString);
+                }
+                var compiler = _functionCompilerFactory.Create(function);
+                var result = compiler.Compile(HasChildren ? Children : Enumerable.Empty<Expression>(), _parsingContext);
+                if (_isNegated)
+                {
+                    if (!result.IsNumeric)
+                    {
+                        if (_parsingContext.Debug)
+                        {
+                            var msg = string.Format("Trying to negate a non-numeric value ({0}) in function '{1}'",
+                                result.Result, ExpressionString);
+                            _parsingContext.Configuration.Logger.Log(_parsingContext, msg);
+                        }
+                        return new CompileResult(ExcelErrorValue.Create(eErrorType.Value), DataType.ExcelError);
+                    }
+                    return new CompileResult(result.ResultNumeric * -1, result.DataType);
+                }
+                return result;
+            }
+            catch (ExcelErrorValueException e)
+            {
+                if (_parsingContext.Debug)
+                {
+                    _parsingContext.Configuration.Logger.Log(_parsingContext, e);
+                }
+                return new CompileResult(e.ErrorValue, DataType.ExcelError);
+            }
+            
+        }
+
+        public override Expression PrepareForNextChild()
+        {
+            return base.AddChild(new FunctionArgumentExpression(this));
+        }
+
+        public override bool HasChildren
+        {
+            get
+            {
+                return (Children.Any() && Children.First().Children.Any());
+            }
+        }
+
+        public override Expression AddChild(Expression child)
+        {
+            Children.Last().AddChild(child);
+            return child;
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/GroupExpression.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/GroupExpression.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/GroupExpression.cs	(revision 12707)
@@ -0,0 +1,64 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing.ExpressionGraph
+{
+    public class GroupExpression : Expression
+    {
+        public GroupExpression()
+            : this(new ExpressionCompiler())
+        {
+
+        }
+
+        public GroupExpression(IExpressionCompiler expressionCompiler)
+        {
+            _expressionCompiler = expressionCompiler;
+        }
+
+        private readonly IExpressionCompiler _expressionCompiler;
+
+
+        public override CompileResult Compile()
+        {
+            return _expressionCompiler.Compile(Children);
+        }
+
+        public override bool IsGroupedExpression
+        {
+            get { return true; }
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/IExpressionCompiler.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/IExpressionCompiler.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/IExpressionCompiler.cs	(revision 12707)
@@ -0,0 +1,42 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing.ExpressionGraph
+{
+    public interface IExpressionCompiler
+    {
+        CompileResult Compile(IEnumerable<Expression> expressions);
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/IExpressionConverter.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/IExpressionConverter.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/IExpressionConverter.cs	(revision 12707)
@@ -0,0 +1,43 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing.ExpressionGraph
+{
+    public interface IExpressionConverter
+    {
+        StringExpression ToStringExpression(Expression expression);
+        Expression FromCompileResult(CompileResult compileResult);
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/IExpressionFactory.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/IExpressionFactory.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/IExpressionFactory.cs	(revision 12707)
@@ -0,0 +1,43 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.LexicalAnalysis;
+
+namespace OfficeOpenXml.FormulaParsing.ExpressionGraph
+{
+    public interface IExpressionFactory
+    {
+        Expression Create(Token token);
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/IExpressionGraphBuilder.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/IExpressionGraphBuilder.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/IExpressionGraphBuilder.cs	(revision 12707)
@@ -0,0 +1,43 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.LexicalAnalysis;
+
+namespace OfficeOpenXml.FormulaParsing.ExpressionGraph
+{
+    public interface IExpressionGraphBuilder
+    {
+        ExpressionGraph Build(IEnumerable<Token> tokens);
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/IntegerExpression.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/IntegerExpression.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/IntegerExpression.cs	(revision 12707)
@@ -0,0 +1,69 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing.ExpressionGraph
+{
+    public class IntegerExpression : AtomicExpression
+    {
+        private readonly double? _compiledValue;
+        private readonly bool _negate;
+
+        public IntegerExpression(string expression)
+            : this(expression, false)
+        {
+
+        }
+
+        public IntegerExpression(string expression, bool negate)
+            : base(expression)
+        {
+            _negate = negate;
+        }
+
+        public IntegerExpression(double val)
+            : base(val.ToString(CultureInfo.InvariantCulture))
+        {
+            _compiledValue = Math.Floor(val);
+        }
+
+        public override CompileResult Compile()
+        {
+            double result = _compiledValue.HasValue ? _compiledValue.Value : double.Parse(ExpressionString, CultureInfo.InvariantCulture);
+            result = _negate ? result*-1 : result;
+            return new CompileResult(result, DataType.Integer);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/NamedValueExpression.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/NamedValueExpression.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/NamedValueExpression.cs	(revision 12707)
@@ -0,0 +1,90 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing.ExpressionGraph
+{
+    public class NamedValueExpression : AtomicExpression
+    {
+        public NamedValueExpression(string expression, ParsingContext parsingContext)
+            : base(expression)
+        {
+            _parsingContext = parsingContext;
+        }
+
+        private readonly ParsingContext _parsingContext;
+
+        public override CompileResult Compile()
+        {
+            var c = this._parsingContext.Scopes.Current;
+            var name = _parsingContext.ExcelDataProvider.GetName(c.Address.Worksheet, ExpressionString);
+            //var result = _parsingContext.Parser.Parse(value.ToString());
+
+            if (name == null)
+            {
+                throw (new Exceptions.ExcelErrorValueException(ExcelErrorValue.Create(eErrorType.Name)));
+            }
+            if (name.Value==null)
+            {
+                return null;
+            }
+            if (name.Value is ExcelDataProvider.IRangeInfo)
+            {
+                var range = (ExcelDataProvider.IRangeInfo)name.Value;
+                if (range.IsMulti)
+                {
+                    return new CompileResult(name.Value, DataType.Enumerable);
+                }
+                else
+                {
+                    if (range.IsEmpty)
+                    {
+                        return null;
+                    }
+                    var factory = new CompileResultFactory();
+                    return factory.Create(range.First().Value);
+                }
+            }
+            else
+            {                
+                var factory = new CompileResultFactory();
+                return factory.Create(name.Value);
+            }
+
+            
+            
+            //return new CompileResultFactory().Create(result);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/StringExpression.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/StringExpression.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ExpressionGraph/StringExpression.cs	(revision 12707)
@@ -0,0 +1,51 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing.ExpressionGraph
+{
+    public class StringExpression : AtomicExpression
+    {
+        public StringExpression(string expression)
+            : base(expression)
+        {
+
+        }
+
+        public override CompileResult Compile()
+        {
+            return new CompileResult(ExpressionString, DataType.String);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/FormulaParser.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/FormulaParser.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/FormulaParser.cs	(revision 12707)
@@ -0,0 +1,234 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+using OfficeOpenXml.FormulaParsing;
+using OfficeOpenXml.FormulaParsing.Excel.Operators;
+using OfficeOpenXml.FormulaParsing.LexicalAnalysis;
+using OfficeOpenXml.FormulaParsing.Excel;
+using OfficeOpenXml.FormulaParsing.Excel.Functions;
+using OfficeOpenXml.FormulaParsing.ExcelUtilities;
+using OfficeOpenXml.FormulaParsing.Logging;
+using OfficeOpenXml.FormulaParsing.Utilities;
+using System.Diagnostics;
+using OfficeOpenXml.FormulaParsing.Exceptions;
+
+namespace OfficeOpenXml.FormulaParsing
+{
+    public class FormulaParser : IDisposable
+    {
+        private readonly ParsingContext _parsingContext;
+        private readonly ExcelDataProvider _excelDataProvider;
+
+        public FormulaParser(ExcelDataProvider excelDataProvider)
+            : this(excelDataProvider, ParsingContext.Create())
+        {
+           
+        }
+
+        public FormulaParser(ExcelDataProvider excelDataProvider, ParsingContext parsingContext)
+        {
+            parsingContext.Parser = this;
+            parsingContext.ExcelDataProvider = excelDataProvider;
+            parsingContext.NameValueProvider = new EpplusNameValueProvider(excelDataProvider);
+            parsingContext.RangeAddressFactory = new RangeAddressFactory(excelDataProvider);
+            _parsingContext = parsingContext;
+            _excelDataProvider = excelDataProvider;
+            Configure(configuration =>
+            {
+                configuration
+                    .SetLexer(new Lexer(_parsingContext.Configuration.FunctionRepository, _parsingContext.NameValueProvider))
+                    .SetGraphBuilder(new ExpressionGraphBuilder(excelDataProvider, _parsingContext))
+                    .SetExpresionCompiler(new ExpressionCompiler())
+                    .FunctionRepository.LoadModule(new BuiltInFunctions());
+            });
+        }
+
+        public void Configure(Action<ParsingConfiguration> configMethod)
+        {
+            configMethod.Invoke(_parsingContext.Configuration);
+            _lexer = _parsingContext.Configuration.Lexer ?? _lexer;
+            _graphBuilder = _parsingContext.Configuration.GraphBuilder ?? _graphBuilder;
+            _compiler = _parsingContext.Configuration.ExpressionCompiler ?? _compiler;
+        }
+
+        private ILexer _lexer;
+        private IExpressionGraphBuilder _graphBuilder;
+        private IExpressionCompiler _compiler;
+
+        public ILexer Lexer { get { return _lexer; } }
+        public IEnumerable<string> FunctionNames { get { return _parsingContext.Configuration.FunctionRepository.FunctionNames; } } 
+
+        internal virtual object Parse(string formula, RangeAddress rangeAddress)
+        {
+            using (var scope = _parsingContext.Scopes.NewScope(rangeAddress))
+            {
+                var tokens = _lexer.Tokenize(formula);
+                var graph = _graphBuilder.Build(tokens);
+                if (graph.Expressions.Count() == 0)
+                {
+                    return null;
+                }
+                return _compiler.Compile(graph.Expressions).Result;
+            }
+        }
+
+        internal virtual object Parse(IEnumerable<Token> tokens, string worksheet, string address)
+        {
+            var rangeAddress = _parsingContext.RangeAddressFactory.Create(address);
+            using (var scope = _parsingContext.Scopes.NewScope(rangeAddress))
+            {
+                var graph = _graphBuilder.Build(tokens);
+                if (graph.Expressions.Count() == 0)
+                {
+                    return null;
+                }
+                return _compiler.Compile(graph.Expressions).Result;
+            }
+        }
+        internal virtual object ParseCell(IEnumerable<Token> tokens, string worksheet, int row, int column)
+        {
+            var rangeAddress = _parsingContext.RangeAddressFactory.Create(worksheet, column, row);
+            using (var scope = _parsingContext.Scopes.NewScope(rangeAddress))
+            {
+                //    _parsingContext.Dependencies.AddFormulaScope(scope);
+                var graph = _graphBuilder.Build(tokens);
+                if (graph.Expressions.Count() == 0)
+                {
+                    return 0d;
+                }
+                try
+                {
+                    var compileResult = _compiler.Compile(graph.Expressions);
+                    // quick solution for the fact that an excelrange can be returned.
+                    var rangeInfo = compileResult.Result as ExcelDataProvider.IRangeInfo;
+                    if (rangeInfo == null)
+                    {
+                        return compileResult.Result ?? 0d;
+                    }
+                    else
+                    {
+                        if (rangeInfo.IsEmpty)
+                        {
+                            return 0d;
+                        }
+                        if (!rangeInfo.IsMulti)
+                        {
+                            return rangeInfo.First().Value ?? 0d;
+                        }
+                        // ok to return multicell if it is a workbook scoped name.
+                        if (string.IsNullOrEmpty(worksheet))
+                        {
+                            return rangeInfo;
+                        }
+                        if (_parsingContext.Debug)
+                        {
+                            var msg = string.Format("A range with multiple cell was returned at row {0}, column {1}",
+                                row, column);
+                            _parsingContext.Configuration.Logger.Log(_parsingContext, msg);
+                        }
+                        return ExcelErrorValue.Create(eErrorType.Value);
+                    }
+                }
+                catch(ExcelErrorValueException ex)
+                {
+                    if (_parsingContext.Debug)
+                    {
+                        _parsingContext.Configuration.Logger.Log(_parsingContext, ex);
+                    }
+                    return ex.ErrorValue;
+                }
+            }
+        }
+
+        public virtual object Parse(string formula, string address)
+        {
+            return Parse(formula, _parsingContext.RangeAddressFactory.Create(address));
+        }
+        
+        public virtual object Parse(string formula)
+        {
+            return Parse(formula, RangeAddress.Empty);
+        }
+
+        public virtual object ParseAt(string address)
+        {
+            Require.That(address).Named("address").IsNotNullOrEmpty();
+            var rangeAddress = _parsingContext.RangeAddressFactory.Create(address);
+            return ParseAt(rangeAddress.Worksheet, rangeAddress.FromRow, rangeAddress.FromCol);
+        }
+
+        public virtual object ParseAt(string worksheetName, int row, int col)
+        {
+            var f = _excelDataProvider.GetRangeFormula(worksheetName, row, col);
+            if (string.IsNullOrEmpty(f))
+            {
+                return _excelDataProvider.GetRangeValue(worksheetName, row, col);
+            }
+            else
+            {
+                return Parse(f, _parsingContext.RangeAddressFactory.Create(worksheetName,col,row));
+            }
+            //var dataItem = _excelDataProvider.GetRangeValues(address).FirstOrDefault();
+            //if (dataItem == null /*|| (dataItem.Value == null && dataItem.Formula == null)*/) return null;
+            //if (!string.IsNullOrEmpty(dataItem.Formula))
+            //{
+            //    return Parse(dataItem.Formula, _parsingContext.RangeAddressFactory.Create(address));
+            //}
+            //return Parse(dataItem.Value.ToString(), _parsingContext.RangeAddressFactory.Create(address));
+        }
+
+
+        internal void InitNewCalc()
+        {
+            if(_excelDataProvider!=null)
+            {
+                _excelDataProvider.Reset();
+            }
+        }
+
+        public IFormulaParserLogger Logger
+        {
+            get { return _parsingContext.Configuration.Logger; }
+        }
+
+        public void Dispose()
+        {
+            if (_parsingContext.Debug)
+            {
+                _parsingContext.Configuration.Logger.Dispose();
+            }
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/FormulaParserManager.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/FormulaParserManager.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/FormulaParserManager.cs	(revision 12707)
@@ -0,0 +1,98 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.Excel.Functions;
+using OfficeOpenXml.FormulaParsing.Utilities;
+namespace OfficeOpenXml.FormulaParsing
+{
+    /// <summary>
+    /// Provides access to various functionality regarding 
+    /// excel formula evaluation.
+    /// </summary>
+    public class FormulaParserManager
+    {
+        private readonly FormulaParser _parser;
+
+        internal FormulaParserManager(FormulaParser parser)
+        {
+            Require.That(parser).Named("parser").IsNotNull();
+            _parser = parser;
+        }
+
+        /// <summary>
+        /// Loads a module containing custom functions to the formula parser. By using
+        /// this method you can add your own implementations of Excel functions, by
+        /// implementing a <see cref="IFunctionModule"/>.
+        /// </summary>
+        /// <param name="module">A <see cref="IFunctionModule"/> containing <see cref="ExcelFunction"/>s.</param>
+        public void LoadFunctionModule(IFunctionModule module)
+        {
+            _parser.Configure(x => x.FunctionRepository.LoadModule(module));
+        }
+
+        /// <summary>
+        /// If the supplied <paramref name="functionName"/> does not exist, the supplied
+        /// <paramref name="functionImpl"/> implementation will be added to the formula parser.
+        /// If it exists, the existing function will be replaced by the supplied <paramref name="functionImpl">function implementation</paramref>
+        /// </summary>
+        /// <param name="functionName"></param>
+        /// <param name="functionImpl"></param>
+        public void AddOrReplaceFunction(string functionName, ExcelFunction functionImpl)
+        {
+            _parser.Configure(x => x.FunctionRepository.AddOrReplaceFunction(functionName, functionImpl));
+        }
+
+        /// <summary>
+        /// Returns an enumeration of all functions implemented, both the built in functions
+        /// and functions added using the LoadFunctionModule method of this class.
+        /// </summary>
+        /// <returns>Function names in lower case</returns>
+        public IEnumerable<string> GetImplementedFunctionNames()
+        {
+            var fnList = _parser.FunctionNames.ToList();
+            fnList.Sort((x, y) => String.Compare(x, y, System.StringComparison.Ordinal));
+            return fnList;
+        }
+
+        /// <summary>
+        /// Parses the supplied <paramref name="formula"/> and returns the result.
+        /// </summary>
+        /// <param name="formula"></param>
+        /// <returns></returns>
+        public object Parse(string formula)
+        {
+            return _parser.Parse(formula);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/INameValueProvider.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/INameValueProvider.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/INameValueProvider.cs	(revision 12707)
@@ -0,0 +1,16 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing
+{
+    public interface INameValueProvider
+    {
+        bool IsNamedValue(string key, string worksheet);
+
+        object GetNamedValue(string key);
+
+        void Reload();
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/IParsingLifetimeEventHandler.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/IParsingLifetimeEventHandler.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/IParsingLifetimeEventHandler.cs	(revision 12707)
@@ -0,0 +1,12 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing
+{
+    public interface IParsingLifetimeEventHandler
+    {
+        void ParsingCompleted();
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/LexicalAnalysis/ILexer.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/LexicalAnalysis/ILexer.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/LexicalAnalysis/ILexer.cs	(revision 12707)
@@ -0,0 +1,43 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing.LexicalAnalysis
+{
+    public interface ILexer
+    {
+        IEnumerable<Token> Tokenize(string input);
+        IEnumerable<Token> Tokenize(string input, string worksheet);
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/LexicalAnalysis/ISourceCodeTokenizer.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/LexicalAnalysis/ISourceCodeTokenizer.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/LexicalAnalysis/ISourceCodeTokenizer.cs	(revision 12707)
@@ -0,0 +1,42 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing.LexicalAnalysis
+{
+    public interface ISourceCodeTokenizer
+    {
+        IEnumerable<Token> Tokenize(string input, string worksheet);
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/LexicalAnalysis/ISyntacticAnalyzer.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/LexicalAnalysis/ISyntacticAnalyzer.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/LexicalAnalysis/ISyntacticAnalyzer.cs	(revision 12707)
@@ -0,0 +1,42 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing.LexicalAnalysis
+{
+    public interface ISyntacticAnalyzer
+    {
+        void Analyze(IEnumerable<Token> tokens);
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/LexicalAnalysis/ITokenFactory.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/LexicalAnalysis/ITokenFactory.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/LexicalAnalysis/ITokenFactory.cs	(revision 12707)
@@ -0,0 +1,44 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing.LexicalAnalysis
+{
+    public interface ITokenFactory
+    {
+        Token Create(IEnumerable<Token> tokens, string token);
+        Token Create(IEnumerable<Token> tokens, string token, string worksheet);
+        Token Create(string token, TokenType explicitTokenType);
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/LexicalAnalysis/ITokenSeparatorProvider.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/LexicalAnalysis/ITokenSeparatorProvider.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/LexicalAnalysis/ITokenSeparatorProvider.cs	(revision 12707)
@@ -0,0 +1,47 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing.LexicalAnalysis
+{
+    public interface ITokenSeparatorProvider
+    {
+        IDictionary<string, Token> Tokens { get; }
+
+        bool IsOperator(string item);
+
+        bool IsPossibleLastPartOfMultipleCharOperator(string part);
+
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/LexicalAnalysis/Lexer.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/LexicalAnalysis/Lexer.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/LexicalAnalysis/Lexer.cs	(revision 12707)
@@ -0,0 +1,68 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.Excel.Functions;
+//using OfficeOpenXml.FormulaParsing.Excel.Functions;
+
+namespace OfficeOpenXml.FormulaParsing.LexicalAnalysis
+{
+    public class Lexer : ILexer
+    {
+        public Lexer(FunctionRepository functionRepository, INameValueProvider nameValueProvider)
+            :this(new SourceCodeTokenizer(functionRepository, nameValueProvider), new SyntacticAnalyzer())
+        {
+
+        }
+
+        public Lexer(ISourceCodeTokenizer tokenizer, ISyntacticAnalyzer analyzer)
+        {
+            _tokenizer = tokenizer;
+            _analyzer = analyzer;
+        }
+
+        private readonly ISourceCodeTokenizer _tokenizer;
+        private readonly ISyntacticAnalyzer _analyzer;
+
+        public IEnumerable<Token> Tokenize(string input)
+        {
+            return Tokenize(input, null);
+        }
+        public IEnumerable<Token> Tokenize(string input, string worksheet)
+        {
+            var tokens = _tokenizer.Tokenize(input, worksheet);
+            _analyzer.Analyze(tokens);
+            return tokens;
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/LexicalAnalysis/SourceCodeTokenizer.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/LexicalAnalysis/SourceCodeTokenizer.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/LexicalAnalysis/SourceCodeTokenizer.cs	(revision 12707)
@@ -0,0 +1,325 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+using OfficeOpenXml.FormulaParsing.Excel.Functions;
+namespace OfficeOpenXml.FormulaParsing.LexicalAnalysis
+{
+    public class SourceCodeTokenizer : ISourceCodeTokenizer
+    {
+        public static ISourceCodeTokenizer Default
+        {
+            get { return new SourceCodeTokenizer(FunctionNameProvider.Empty, NameValueProvider.Empty); }
+        }
+
+        public SourceCodeTokenizer(IFunctionNameProvider functionRepository, INameValueProvider nameValueProvider)
+            : this(new TokenFactory(functionRepository, nameValueProvider), new TokenSeparatorProvider())
+        {
+
+        }
+        public SourceCodeTokenizer(ITokenFactory tokenFactory, ITokenSeparatorProvider tokenProvider)
+        {
+            _tokenFactory = tokenFactory;
+            _tokenProvider = tokenProvider;
+        }
+
+        private readonly ITokenSeparatorProvider _tokenProvider;
+        private readonly ITokenFactory _tokenFactory;
+
+        public IEnumerable<Token> Tokenize(string input)
+        {
+            return Tokenize(input, null);
+        }
+        public IEnumerable<Token> Tokenize(string input, string worksheet)
+        {
+            if (string.IsNullOrEmpty(input))
+            {
+                return Enumerable.Empty<Token>();
+            }
+            // MA 1401: Ignore leading plus in formula.
+            input = input.TrimStart('+');
+            var context = new TokenizerContext(input);
+            for (int i = 0; i<context.FormulaChars.Length;i++)
+            {
+                var c = context.FormulaChars[i];
+                Token tokenSeparator;
+                if (CharIsTokenSeparator(c, out tokenSeparator))
+                {
+                    if (context.IsInString)
+                    {
+                        if (IsDoubleQuote(tokenSeparator, i, context))
+                        {
+                            i ++;
+                            context.AppendToCurrentToken(c);
+                            continue;
+                        }
+                        if(tokenSeparator.TokenType != TokenType.String)
+                        {
+                            context.AppendToCurrentToken(c);
+                            continue;
+                        }
+                    }
+                    if (tokenSeparator.TokenType == TokenType.OpeningBracket)
+                    {
+                        context.AppendToCurrentToken(c);
+                        context.BracketCount++;
+                        continue;
+                    }
+                    if (tokenSeparator.TokenType == TokenType.ClosingBracket)
+                    {
+                        context.AppendToCurrentToken(c);
+                        context.BracketCount--;
+                        continue;
+                    }
+                    if (context.BracketCount > 0)
+                    {
+                        context.AppendToCurrentToken(c);
+                        continue;
+                    }
+                    // two operators in sequence could be "<=" or ">="
+                    if (IsPartOfMultipleCharSeparator(context, c))
+                    {
+                        var sOp = context.LastToken.Value + c.ToString(CultureInfo.InvariantCulture);
+                        var op = _tokenProvider.Tokens[sOp];
+                        context.ReplaceLastToken(op);
+                        context.NewToken();
+                        continue;
+                    }
+                    if (tokenSeparator.TokenType == TokenType.String)
+                    {
+                        if (context.LastToken != null && context.LastToken.TokenType == TokenType.OpeningEnumerable)
+                        {
+                            context.AppendToCurrentToken(c);
+                            context.ToggleIsInString();
+                            continue;
+                        }
+                        if (context.LastToken != null && context.LastToken.TokenType == TokenType.String)
+                        {
+                            context.AddToken(!context.CurrentTokenHasValue
+                                ? new Token(string.Empty, TokenType.StringContent)
+                                : new Token(context.CurrentToken, TokenType.StringContent));
+                        }
+                        context.AddToken(new Token("\"", TokenType.String));
+                        context.ToggleIsInString();
+                        context.NewToken();
+                        continue;
+                    }
+                    if (context.CurrentTokenHasValue)
+                    {
+                        if (Regex.IsMatch(context.CurrentToken, "^\"*$"))
+                        {
+                            context.AddToken(_tokenFactory.Create(context.CurrentToken, TokenType.StringContent));
+                        }
+                        else
+                        {
+                            context.AddToken(CreateToken(context, worksheet));  
+                        }
+                        
+                        
+                        //If the a next token is an opening parantheses and the previous token is interpeted as an address or name, then the currenct token is a function
+                        if(tokenSeparator.TokenType==TokenType.OpeningParenthesis && (context.LastToken.TokenType==TokenType.ExcelAddress || context.LastToken.TokenType==TokenType.NameValue)) 
+                        {
+                            context.LastToken.TokenType=TokenType.Function;
+                        }
+                    }
+                    if (tokenSeparator.Value == "-")
+                    {
+                        if (TokenIsNegator(context))
+                        {
+                            context.AddToken(new Token("-", TokenType.Negator));
+                            continue;
+                        }
+                    }
+                    context.AddToken(tokenSeparator);
+                    context.NewToken();
+                    continue;
+                }
+                context.AppendToCurrentToken(c);
+            }
+            if (context.CurrentTokenHasValue)
+            {
+                context.AddToken(CreateToken(context, worksheet));
+            }
+
+            CleanupTokens(context, _tokenProvider.Tokens);
+
+            return context.Result;
+        }
+
+        private static bool IsDoubleQuote(Token tokenSeparator, int formulaCharIndex, TokenizerContext context)
+        {
+            return tokenSeparator.TokenType == TokenType.String && formulaCharIndex + 1 < context.FormulaChars.Length && context.FormulaChars[formulaCharIndex + 1] == '\"';
+        }
+
+
+        private static void CleanupTokens(TokenizerContext context, IDictionary<string, Token>  tokens)
+        {
+            for (int i = 0; i < context.Result.Count; i++)
+            {
+                var token=context.Result[i];
+                if (token.TokenType == TokenType.Unrecognized)
+                {
+                    if (i < context.Result.Count - 1)
+                    {
+                        if (context.Result[i+1].TokenType == TokenType.OpeningParenthesis)
+                        {
+                            token.TokenType = TokenType.Function;
+                        }
+                        else
+                        {
+                            token.TokenType = TokenType.NameValue;
+                        }
+                    }
+                    else
+                    {
+                        token.TokenType = TokenType.NameValue;
+                    }
+                }
+                else if ((token.TokenType == TokenType.Operator || token.TokenType == TokenType.Negator) && i < context.Result.Count - 1 &&
+                         (token.Value=="+" || token.Value=="-"))
+                {
+                    if (i > 0 && token.Value == "+")    //Remove any + with an opening parenthesis before.
+                    {
+                        if (context.Result[i - 1].TokenType  == TokenType.OpeningParenthesis)
+                        {
+                            context.Result.RemoveAt(i);
+                            SetNegatorOperator(context, i, tokens);
+                            i--;
+                            continue;
+                        }
+                    }
+
+                    var nextToken = context.Result[i + 1];
+                    if (nextToken.TokenType == TokenType.Operator || nextToken.TokenType == TokenType.Negator)
+                    {
+                        if (token.Value == "+" && (nextToken.Value=="+" || nextToken.Value == "-"))
+                        {
+                            //Remove first
+                            context.Result.RemoveAt(i);
+                            SetNegatorOperator(context, i, tokens);
+                            i--;
+                        }
+                        else if (token.Value == "-" && nextToken.Value == "+")
+                        {
+                            //Remove second
+                            context.Result.RemoveAt(i+1);
+                            SetNegatorOperator(context, i, tokens);
+                            i--;
+                        }
+                        else if (token.Value == "-" && nextToken.Value == "-")
+                        {
+                            //Remove first and set operator to +
+                            context.Result.RemoveAt(i);
+                            if (i == 0)
+                            {
+                                context.Result.RemoveAt(i+1);
+                                i += 2;
+                            }
+                            else
+                            {
+                                //context.Result[i].TokenType = TokenType.Operator;
+                                //context.Result[i].Value = "+";
+                                context.Result[i] = tokens["+"];
+                                SetNegatorOperator(context, i, tokens);
+                                i--;
+                            }
+                        }
+                    }
+                }
+            }
+        }
+
+        private static void SetNegatorOperator(TokenizerContext context, int i, IDictionary<string, Token>  tokens)
+        {
+            if (context.Result[i].Value == "-" && i > 0 && (context.Result[i].TokenType == TokenType.Operator || context.Result[i].TokenType == TokenType.Negator))
+            {
+                if (TokenIsNegator(context.Result[i - 1]))
+                {
+                    context.Result[i] = new Token("-", TokenType.Negator);
+                }
+                else
+                {
+                    context.Result[i] = tokens["-"];
+                }
+            }
+        }
+
+        private static bool TokenIsNegator(TokenizerContext context)
+        {
+            return TokenIsNegator(context.LastToken);
+        }
+        private static bool TokenIsNegator(Token t)
+        {
+            return t == null
+                        ||
+                        t.TokenType == TokenType.Operator
+                        ||
+                        t.TokenType == TokenType.OpeningParenthesis
+                        ||
+                        t.TokenType == TokenType.Comma
+                        ||
+                        t.TokenType == TokenType.SemiColon
+                        ||
+                        t.TokenType == TokenType.OpeningEnumerable;
+        }
+
+        private bool IsPartOfMultipleCharSeparator(TokenizerContext context, char c)
+        {
+            var lastToken = context.LastToken != null ? context.LastToken.Value : string.Empty;
+            return _tokenProvider.IsOperator(lastToken) 
+                && _tokenProvider.IsPossibleLastPartOfMultipleCharOperator(c.ToString(CultureInfo.InvariantCulture)) 
+                && !context.CurrentTokenHasValue;
+        }
+
+        private Token CreateToken(TokenizerContext context, string worksheet)
+        {
+            if (context.CurrentToken == "-")
+            {
+                if (context.LastToken == null && context.LastToken.TokenType == TokenType.Operator)
+                {
+                    return new Token("-", TokenType.Negator);
+                }
+            }
+            return _tokenFactory.Create(context.Result, context.CurrentToken, worksheet);
+        }
+
+        private bool CharIsTokenSeparator(char c, out Token token)
+        {
+            var result = _tokenProvider.Tokens.ContainsKey(c.ToString());
+            token = result ? token = _tokenProvider.Tokens[c.ToString()] : null;
+            return result;
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/LexicalAnalysis/SyntacticAnalyzer.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/LexicalAnalysis/SyntacticAnalyzer.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/LexicalAnalysis/SyntacticAnalyzer.cs	(revision 12707)
@@ -0,0 +1,102 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.Exceptions;
+
+namespace OfficeOpenXml.FormulaParsing.LexicalAnalysis
+{
+    public class SyntacticAnalyzer : ISyntacticAnalyzer
+    {
+        private class AnalyzingContext
+        {
+            public int NumberOfOpenedParentheses { get; set; }
+            public int NumberOfClosedParentheses { get; set; }
+            public int OpenedStrings { get; set; }
+            public int ClosedStrings { get; set; }
+            public bool IsInString { get; set; }
+        }
+        public void Analyze(IEnumerable<Token> tokens)
+        {
+            var context = new AnalyzingContext();
+            foreach (var token in tokens)
+            {
+                if (token.TokenType == TokenType.Unrecognized)
+                {
+                    throw new UnrecognizedTokenException(token);
+                }
+                EnsureParenthesesAreWellFormed(token, context);
+                EnsureStringsAreWellFormed(token, context);
+            }
+            Validate(context);
+        }
+
+        private static void Validate(AnalyzingContext context)
+        {
+            if (context.NumberOfOpenedParentheses != context.NumberOfClosedParentheses)
+            {
+                throw new FormatException("Number of opened and closed parentheses does not match");
+            }
+            if (context.OpenedStrings != context.ClosedStrings)
+            {
+                throw new FormatException("Unterminated string");
+            }
+        }
+
+        private void EnsureParenthesesAreWellFormed(Token token, AnalyzingContext context)
+        {
+            if (token.TokenType == TokenType.OpeningParenthesis)
+            {
+                context.NumberOfOpenedParentheses++;
+            }
+            else if (token.TokenType == TokenType.ClosingParenthesis)
+            {
+                context.NumberOfClosedParentheses++;
+            }
+        }
+
+        private void EnsureStringsAreWellFormed(Token token, AnalyzingContext context)
+        {
+            if (!context.IsInString && token.TokenType == TokenType.String)
+            {
+                context.IsInString = true;
+                context.OpenedStrings++;
+            }
+            else if (context.IsInString && token.TokenType == TokenType.String)
+            {
+                context.IsInString = false;
+                context.ClosedStrings++;
+            }
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/LexicalAnalysis/Token.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/LexicalAnalysis/Token.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/LexicalAnalysis/Token.cs	(revision 12707)
@@ -0,0 +1,75 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing.LexicalAnalysis
+{
+    public class Token
+    {
+        public Token(string token, TokenType tokenType)
+        {
+            Value = token;
+            TokenType = tokenType;
+        }
+
+        public string Value { get; internal set; }
+
+        public TokenType TokenType { get; internal set; }
+
+        public void Append(string stringToAppend)
+        {
+            Value += stringToAppend;
+        }
+
+        public bool IsNegated { get; private set; }
+        
+        public void Negate()
+        {
+
+            if (
+                TokenType == TokenType.Decimal 
+                || 
+                TokenType == TokenType.Integer
+                ||
+                TokenType == TokenType.ExcelAddress)
+            {
+                IsNegated = true;
+            }
+        }
+        public override string ToString()
+        {
+            return TokenType.ToString() + ", " + Value;
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/LexicalAnalysis/TokenFactory.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/LexicalAnalysis/TokenFactory.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/LexicalAnalysis/TokenFactory.cs	(revision 12707)
@@ -0,0 +1,167 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ * Jan Källman                      Replaced Adress validate    2013-03-01
+ * *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+using OfficeOpenXml.FormulaParsing;
+using OfficeOpenXml.FormulaParsing.Excel.Functions;
+using OfficeOpenXml.FormulaParsing.ExcelUtilities;
+using OfficeOpenXml.FormulaParsing.Utilities;
+using OfficeOpenXml;
+
+namespace OfficeOpenXml.FormulaParsing.LexicalAnalysis
+{
+    public class TokenFactory : ITokenFactory
+    {
+        public TokenFactory(IFunctionNameProvider functionRepository, INameValueProvider nameValueProvider)
+            : this(new TokenSeparatorProvider(), nameValueProvider, functionRepository)
+        {
+
+        }
+
+        public TokenFactory(ITokenSeparatorProvider tokenSeparatorProvider, INameValueProvider nameValueProvider, IFunctionNameProvider functionNameProvider)
+        {
+            _tokenSeparatorProvider = tokenSeparatorProvider;
+            _functionNameProvider = functionNameProvider;
+            _nameValueProvider = nameValueProvider;
+        }
+
+        private readonly ITokenSeparatorProvider _tokenSeparatorProvider;
+        private readonly IFunctionNameProvider _functionNameProvider;
+        private readonly INameValueProvider _nameValueProvider;
+        public Token Create(IEnumerable<Token> tokens, string token)
+        {
+            return Create(tokens, token, null);
+        }
+        public Token Create(IEnumerable<Token> tokens, string token, string worksheet)
+        {
+            Token tokenSeparator = null;
+            if (_tokenSeparatorProvider.Tokens.TryGetValue(token, out tokenSeparator))
+            {
+                return tokenSeparator;
+            }
+            var tokenList = (IList<Token>)tokens;
+            //Address with worksheet-string before  /JK
+            if (token.StartsWith("!") && tokenList[tokenList.Count-1].TokenType == TokenType.String)
+            {
+                string addr = "";
+                var i = tokenList.Count - 2;
+                if (i > 0)
+                {
+                    if (tokenList[i].TokenType == TokenType.StringContent)
+                    {
+                        addr = "'" + tokenList[i].Value.Replace("'", "''") + "'";
+                    }
+                    else
+                    {
+                        throw(new ArgumentException(string.Format("Invalid formula token sequence near {0}",token)));
+                    }
+                    //Remove the string tokens and content
+                    tokenList.RemoveAt(tokenList.Count - 1);
+                    tokenList.RemoveAt(tokenList.Count - 1);
+                    tokenList.RemoveAt(tokenList.Count - 1);
+
+                    return new Token(addr + token, TokenType.ExcelAddress);
+                }
+                else
+                {
+                    throw(new ArgumentException(string.Format("Invalid formula token sequence near {0}",token)));
+                }
+                
+            }
+
+            if (tokens.Any() && tokens.Last().TokenType == TokenType.String)
+            {
+                return new Token(token, TokenType.StringContent);
+            }
+            if (!string.IsNullOrEmpty(token))
+            {
+                token = token.Trim();
+            }
+            if (Regex.IsMatch(token, RegexConstants.Decimal))
+            {
+                return new Token(token, TokenType.Decimal);
+            }
+            if(Regex.IsMatch(token, RegexConstants.Integer))
+            {
+                return new Token(token, TokenType.Integer);
+            }
+            if (Regex.IsMatch(token, RegexConstants.Boolean, RegexOptions.IgnoreCase))
+            {
+                return new Token(token, TokenType.Boolean);
+            }
+            if (token.ToUpper(CultureInfo.InvariantCulture).Contains("#REF!"))
+            {
+                return new Token(token, TokenType.InvalidReference);
+            }
+            if (token.ToUpper(CultureInfo.InvariantCulture) == "#NUM!")
+            {
+                return new Token(token, TokenType.NumericError);
+            }
+            if (token.ToUpper(CultureInfo.InvariantCulture) == "#VALUE!")
+            {
+                return new Token(token, TokenType.ValueDataTypeError);
+            }
+            if (token.ToUpper(CultureInfo.InvariantCulture) == "#NULL!")
+            {
+                return new Token(token, TokenType.Null);
+            }
+            if (_nameValueProvider != null && _nameValueProvider.IsNamedValue(token, worksheet))
+            {
+                return new Token(token, TokenType.NameValue);
+            }
+            if (_functionNameProvider.IsFunctionName(token))
+            {
+                return new Token(token, TokenType.Function);
+            }
+            if (tokenList.Count > 0 && tokenList[tokenList.Count - 1].TokenType == TokenType.OpeningEnumerable)
+            {
+                return new Token(token, TokenType.Enumerable);
+            }
+            var at = OfficeOpenXml.ExcelAddressBase.IsValid(token);
+            if (at==ExcelAddressBase.AddressType.InternalAddress)
+            {
+                return new Token(token.ToUpper(CultureInfo.InvariantCulture), TokenType.ExcelAddress);
+            } 
+            return new Token(token, TokenType.Unrecognized);
+
+        }
+
+        public Token Create(string token, TokenType explicitTokenType)
+        {
+            return new Token(token, explicitTokenType);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/LexicalAnalysis/TokenSeparatorProvider.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/LexicalAnalysis/TokenSeparatorProvider.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/LexicalAnalysis/TokenSeparatorProvider.cs	(revision 12707)
@@ -0,0 +1,94 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading;
+
+namespace OfficeOpenXml.FormulaParsing.LexicalAnalysis
+{
+    public class TokenSeparatorProvider : ITokenSeparatorProvider
+    {
+       private static readonly Dictionary<string, Token> _tokens;
+
+        static TokenSeparatorProvider()
+        {
+            _tokens = new Dictionary<string, Token>();
+            _tokens.Add("+", new Token("+", TokenType.Operator));
+            _tokens.Add("-", new Token("-", TokenType.Operator));
+            _tokens.Add("*", new Token("*", TokenType.Operator));
+            _tokens.Add("/", new Token("/", TokenType.Operator));
+            _tokens.Add("^", new Token("^", TokenType.Operator));
+            _tokens.Add("&", new Token("&", TokenType.Operator));
+            _tokens.Add(">", new Token(">", TokenType.Operator));
+            _tokens.Add("<", new Token("<", TokenType.Operator));
+            _tokens.Add("=", new Token("=", TokenType.Operator));
+            _tokens.Add("<=", new Token("<=", TokenType.Operator));
+            _tokens.Add(">=", new Token(">=", TokenType.Operator));
+            _tokens.Add("<>", new Token("<>", TokenType.Operator));
+            _tokens.Add("(", new Token("(", TokenType.OpeningParenthesis));
+            _tokens.Add(")", new Token(")", TokenType.ClosingParenthesis));
+            _tokens.Add("{", new Token("{", TokenType.OpeningEnumerable));
+            _tokens.Add("}", new Token("}", TokenType.ClosingEnumerable));
+            _tokens.Add("'", new Token("'", TokenType.String));
+            _tokens.Add("\"", new Token("\"", TokenType.String));
+            _tokens.Add(",", new Token(",", TokenType.Comma));
+            _tokens.Add(";", new Token(";", TokenType.SemiColon));
+            _tokens.Add("[", new Token("[", TokenType.OpeningBracket));
+            _tokens.Add("]", new Token("]", TokenType.ClosingBracket));
+            _tokens.Add("%", new Token("%", TokenType.Percent));
+        }
+
+        IDictionary<string, Token> ITokenSeparatorProvider.Tokens
+        {
+            get { return _tokens; }
+        }
+
+        public bool IsOperator(string item)
+        {
+            Token token;
+            if (_tokens.TryGetValue(item, out token))
+            {
+                if (token.TokenType == TokenType.Operator)
+                {
+                    return true;
+                }
+            }
+            return false;
+        }
+
+        public bool IsPossibleLastPartOfMultipleCharOperator(string part)
+        {
+            return part == "=" || part == ">";
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/LexicalAnalysis/TokenType.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/LexicalAnalysis/TokenType.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/LexicalAnalysis/TokenType.cs	(revision 12707)
@@ -0,0 +1,66 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing.LexicalAnalysis
+{
+    public enum TokenType
+    {
+        Operator,
+        Negator,
+        OpeningParenthesis,
+        ClosingParenthesis,
+        OpeningEnumerable,
+        ClosingEnumerable,
+        OpeningBracket,
+        ClosingBracket,        
+        Enumerable,
+        Comma,
+        SemiColon,
+        String,
+        StringContent,
+        Integer,
+        Boolean,
+        Decimal,
+        Percent,
+        Function,
+        ExcelAddress,
+        NameValue,
+        InvalidReference,
+        NumericError,
+        ValueDataTypeError,
+        Null,
+        Unrecognized
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/LexicalAnalysis/TokenizerContext.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/LexicalAnalysis/TokenizerContext.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/LexicalAnalysis/TokenizerContext.cs	(revision 12707)
@@ -0,0 +1,132 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing.LexicalAnalysis
+{
+    public class TokenizerContext
+    {
+        public TokenizerContext(string formula)
+        {
+            if (!string.IsNullOrEmpty(formula))
+            {
+                _chars = formula.ToArray();
+            }
+            _result = new List<Token>();
+            _currentToken = new StringBuilder();
+        }
+
+        private char[] _chars;
+        private List<Token> _result;
+        private StringBuilder _currentToken;
+
+        public char[] FormulaChars
+        {
+            get { return _chars; }
+        }
+
+        public IList<Token> Result
+        {
+            get { return _result; }
+        }
+
+        public bool IsInString
+        {
+            get;
+            private set;
+        }
+
+        public void ToggleIsInString()
+        {
+            IsInString = !IsInString;
+        }
+
+        internal int BracketCount
+        {
+            get;
+            set;
+        }
+
+        public string CurrentToken
+        {
+            get { return _currentToken.ToString(); }
+        }
+
+        public bool CurrentTokenHasValue
+        {
+            get { return !string.IsNullOrEmpty(CurrentToken.Trim()); }
+        }
+
+        public void NewToken()
+        {
+            _currentToken = new StringBuilder();
+        }
+
+        public void AddToken(Token token)
+        {
+            _result.Add(token);
+        }
+
+        public void AppendToCurrentToken(char c)
+        {
+            _currentToken.Append(c.ToString());
+        }
+
+        public void AppendToLastToken(string stringToAppend)
+        {
+            _result.Last().Append(stringToAppend);
+        }
+
+        public void SetLastTokenType(TokenType type)
+        {
+            _result.Last().TokenType = type;
+        }
+
+        public void ReplaceLastToken(Token newToken)
+        {
+            var count = _result.Count;
+            if (count > 0)
+            {
+                _result.RemoveAt(count - 1);   
+            }
+            _result.Add(newToken);
+        }
+
+        public Token LastToken
+        {
+            get { return _result.Count > 0 ? _result.Last() : null; }
+        }
+
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Logging/IFormulaParserLogger.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Logging/IFormulaParserLogger.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Logging/IFormulaParserLogger.cs	(revision 12707)
@@ -0,0 +1,18 @@
+﻿using System;
+
+namespace OfficeOpenXml.FormulaParsing.Logging
+{
+    /// <summary>
+    /// Used for logging during FormulaParsing
+    /// </summary>
+    public interface IFormulaParserLogger : IDisposable
+    {
+        void Log(ParsingContext context, Exception ex);
+        void Log(ParsingContext context, string message);
+        void Log(string message);
+        void LogCellCounted();
+
+        void LogFunction(string func);
+        void LogFunction(string func, long milliseconds);
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Logging/LoggerFactory.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Logging/LoggerFactory.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Logging/LoggerFactory.cs	(revision 12707)
@@ -0,0 +1,24 @@
+﻿using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing.Logging
+{
+    /// <summary>
+    /// Create loggers that can be used for logging the formula parser.
+    /// </summary>
+    public static class LoggerFactory
+    {
+        /// <summary>
+        /// Creates a logger that logs to a simple textfile.
+        /// </summary>
+        /// <param name="file"></param>
+        /// <returns></returns>
+        public static IFormulaParserLogger CreateTextFileLogger(FileInfo file)
+        {
+            return new TextFileLogger(file);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Logging/TextFileLogger.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Logging/TextFileLogger.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Logging/TextFileLogger.cs	(revision 12707)
@@ -0,0 +1,112 @@
+﻿using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.Excel.Functions.Logical;
+using OfficeOpenXml.FormulaParsing.Excel.Functions.Math;
+
+namespace OfficeOpenXml.FormulaParsing.Logging
+{
+    internal class TextFileLogger : IFormulaParserLogger
+    {
+        private StreamWriter _sw;
+        private const string Separator = "=================================";
+        private int _count;
+        private DateTime _startTime = DateTime.Now;
+        private Dictionary<string, int> _funcs = new Dictionary<string, int>();
+        private Dictionary<string, long> _funcPerformance = new Dictionary<string, long>();
+        internal TextFileLogger(FileInfo fileInfo)
+        {
+            _sw = new StreamWriter(fileInfo.FullName);
+        }
+
+        private void WriteSeparatorAndTimeStamp()
+        {
+            _sw.WriteLine(Separator);
+            _sw.WriteLine("Timestamp: {0}", DateTime.Now);
+            _sw.WriteLine();
+        }
+
+        private void WriteAddressInfo(ParsingContext context)
+        {
+            if (context.Scopes.Current != null && context.Scopes.Current.Address != null)
+            {
+                _sw.WriteLine("Worksheet: {0}", context.Scopes.Current.Address.Worksheet ?? "<not specified>");
+                _sw.WriteLine("Address: {0}", context.Scopes.Current.Address.Address ?? "<not available>");
+            }
+        }
+
+        public void Log(ParsingContext context, Exception ex)
+        {
+            WriteSeparatorAndTimeStamp();
+            WriteAddressInfo(context);
+            _sw.WriteLine(ex);
+            _sw.WriteLine();
+        }
+
+        public void Log(ParsingContext context, string message)
+        {
+            WriteSeparatorAndTimeStamp();
+            WriteAddressInfo(context);
+            _sw.WriteLine(message);
+            _sw.WriteLine();
+        }
+
+        public void Log(string message)
+        {
+            WriteSeparatorAndTimeStamp();
+            _sw.WriteLine(message);
+            _sw.WriteLine();
+        }
+
+        public void LogCellCounted()
+        {
+            _count++;
+            if (_count%500 == 0)
+            {
+                _sw.WriteLine(Separator);
+                var timeEllapsed = DateTime.Now.Subtract(_startTime);
+                _sw.WriteLine("{0} cells parsed, time {1} seconds", _count, timeEllapsed.TotalSeconds);
+
+                var funcs = _funcs.Keys.OrderByDescending(x => _funcs[x]).ToList();
+                foreach (var func in funcs)
+                {
+                    _sw.Write(func + "  - " + _funcs[func]);
+                    if (_funcPerformance.ContainsKey(func))
+                    {
+                        _sw.Write(" - avg: " + _funcPerformance[func]/_funcs[func] + " milliseconds");
+                    }
+                    _sw.WriteLine();
+                }
+                _sw.WriteLine();
+                _funcs.Clear();
+
+            }
+        }
+
+        public void LogFunction(string func)
+        {
+            if (!_funcs.ContainsKey(func))
+            {
+                _funcs.Add(func, 0);
+            }
+            _funcs[func]++;
+        }
+
+        public void LogFunction(string func, long milliseconds)
+        {
+            if (!_funcPerformance.ContainsKey(func))
+            {
+                _funcPerformance[func] = 0;
+            }
+            _funcPerformance[func] += milliseconds;
+        }
+
+        public void Dispose()
+        {
+            _sw.Close(); 
+            _sw.Dispose();
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/NameValueProvider.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/NameValueProvider.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/NameValueProvider.cs	(revision 12707)
@@ -0,0 +1,35 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing
+{
+    public class NameValueProvider : INameValueProvider
+    {
+        private NameValueProvider()
+        {
+
+        }
+
+        public static INameValueProvider Empty
+        {
+            get { return new NameValueProvider(); }
+        }
+
+        public bool IsNamedValue(string key, string worksheet)
+        {
+            return false;
+        }
+
+        public object GetNamedValue(string key)
+        {
+            return null;
+        }
+
+        public void Reload()
+        {
+            
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ParsedValue.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ParsedValue.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ParsedValue.cs	(revision 12707)
@@ -0,0 +1,35 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing
+{
+    public class ParsedValue
+    {
+        public ParsedValue(object val, int rowIndex, int colIndex)
+        {
+            Value = val;
+            RowIndex = rowIndex;
+            ColIndex = colIndex;
+        }
+
+        public object Value
+        {
+            get;
+            private set;
+        }
+
+        public int RowIndex
+        {
+            get;
+            private set;
+        }
+
+        public int ColIndex
+        {
+            get;
+            private set;
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ParsingConfiguration.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ParsingConfiguration.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ParsingConfiguration.cs	(revision 12707)
@@ -0,0 +1,76 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.Excel.Functions.Math;
+using OfficeOpenXml.FormulaParsing.LexicalAnalysis;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+using OfficeOpenXml.FormulaParsing.Excel.Functions;
+using OfficeOpenXml.FormulaParsing.Logging;
+using OfficeOpenXml.FormulaParsing.Utilities;
+
+namespace OfficeOpenXml.FormulaParsing
+{
+    public class ParsingConfiguration
+    {
+        public virtual ILexer Lexer { get; private set; }
+
+        public IFormulaParserLogger Logger { get; private set; }
+
+        public IExpressionGraphBuilder GraphBuilder { get; private set; }
+
+        public IExpressionCompiler ExpressionCompiler{ get; private set; }
+
+        public FunctionRepository FunctionRepository{ get; private set; }
+
+        private ParsingConfiguration() 
+        {
+            FunctionRepository = FunctionRepository.Create();
+        }
+
+        internal static ParsingConfiguration Create()
+        {
+            return new ParsingConfiguration();
+        }
+
+        public ParsingConfiguration SetLexer(ILexer lexer)
+        {
+            Lexer = lexer;
+            return this;
+        }
+
+        public ParsingConfiguration SetGraphBuilder(IExpressionGraphBuilder graphBuilder)
+        {
+            GraphBuilder = graphBuilder;
+            return this;
+        }
+
+        public ParsingConfiguration SetExpresionCompiler(IExpressionCompiler expressionCompiler)
+        {
+            ExpressionCompiler = expressionCompiler;
+            return this;
+        }
+
+        /// <summary>
+        /// Attaches a logger, errors and log entries will be written to the logger during the parsing process.
+        /// </summary>
+        /// <param name="logger"></param>
+        /// <returns></returns>
+        public ParsingConfiguration AttachLogger(IFormulaParserLogger logger)
+        {
+            Require.That(logger).Named("logger").IsNotNull();
+            Logger = logger;
+            return this;
+        }
+
+        /// <summary>
+        /// if a logger is attached it will be removed.
+        /// </summary>
+        /// <returns></returns>
+        public ParsingConfiguration DetachLogger()
+        {
+            Logger = null;
+            return this;
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ParsingContext.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ParsingContext.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ParsingContext.cs	(revision 12707)
@@ -0,0 +1,76 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.LexicalAnalysis;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+using OfficeOpenXml.FormulaParsing.ExcelUtilities;
+using OfficeOpenXml.FormulaParsing;
+using OfficeOpenXml.FormulaParsing.Logging;
+
+namespace OfficeOpenXml.FormulaParsing
+{
+    /// <summary>
+    /// Parsing context
+    /// </summary>
+    public class ParsingContext : IParsingLifetimeEventHandler
+    {
+        private ParsingContext() { }
+
+        /// <summary>
+        /// The <see cref="FormulaParser"/> of the current context.
+        /// </summary>
+        public FormulaParser Parser { get; set; }
+
+        /// <summary>
+        /// The <see cref="ExcelDataProvider"/> is an abstraction on top of
+        /// Excel, in this case EPPlus.
+        /// </summary>
+        public ExcelDataProvider ExcelDataProvider { get; set; }
+
+        /// <summary>
+        /// Utility for handling addresses
+        /// </summary>
+        public RangeAddressFactory RangeAddressFactory { get; set; }
+
+        /// <summary>
+        /// <see cref="INameValueProvider"/> of the current context
+        /// </summary>
+        public INameValueProvider NameValueProvider { get; set; }
+
+        /// <summary>
+        /// Configuration
+        /// </summary>
+        public ParsingConfiguration Configuration { get; set; }
+
+        /// <summary>
+        /// Scopes, a scope represents the parsing of a cell or a value.
+        /// </summary>
+        public ParsingScopes Scopes { get; private set; }
+
+        /// <summary>
+        /// Returns true if a <see cref="IFormulaParserLogger"/> is attached to the parser.
+        /// </summary>
+        public bool Debug
+        {
+            get { return Configuration.Logger != null; }
+        }
+
+        /// <summary>
+        /// Factory method.
+        /// </summary>
+        /// <returns></returns>
+        public static ParsingContext Create()
+        {
+            var context = new ParsingContext();
+            context.Configuration = ParsingConfiguration.Create();
+            context.Scopes = new ParsingScopes(context);
+            return context;
+        }
+
+        void IParsingLifetimeEventHandler.ParsingCompleted()
+        {
+            
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ParsingScope.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ParsingScope.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ParsingScope.cs	(revision 12707)
@@ -0,0 +1,54 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExcelUtilities;
+
+namespace OfficeOpenXml.FormulaParsing
+{
+    /// <summary>
+    /// Represents a parsing of a single input or workbook addrses.
+    /// </summary>
+    public class ParsingScope : IDisposable
+    {
+        private readonly ParsingScopes _parsingScopes;
+
+        public ParsingScope(ParsingScopes parsingScopes, RangeAddress address)
+            : this(parsingScopes, null, address)
+        {
+        }
+
+        public ParsingScope(ParsingScopes parsingScopes, ParsingScope parent, RangeAddress address)
+        {
+            _parsingScopes = parsingScopes;
+            Parent = parent;
+            Address = address;
+            ScopeId = Guid.NewGuid();
+        }
+
+        /// <summary>
+        /// Id of the scope.
+        /// </summary>
+        public Guid ScopeId { get; private set; }
+
+        /// <summary>
+        /// The calling scope.
+        /// </summary>
+        public ParsingScope Parent { get; private set; }
+
+        /// <summary>
+        /// The address of the cell currently beeing parsed.
+        /// </summary>
+        public RangeAddress Address { get; private set; }
+
+        /// <summary>
+        /// True if the current scope is a Subtotal function beeing executed.
+        /// </summary>
+        public bool IsSubtotal { get; set; }
+
+        public void Dispose()
+        {
+            _parsingScopes.KillScope(this);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ParsingScopes.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ParsingScopes.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ParsingScopes.cs	(revision 12707)
@@ -0,0 +1,65 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using OfficeOpenXml.FormulaParsing.ExcelUtilities;
+
+namespace OfficeOpenXml.FormulaParsing
+{
+    /// <summary>
+    /// This class implements a stack on which instances of <see cref="ParsingScope"/>
+    /// are put. Each ParsingScope represents the parsing of an address in the workbook.
+    /// </summary>
+    public class ParsingScopes
+    {
+        private readonly IParsingLifetimeEventHandler _lifetimeEventHandler;
+
+        public ParsingScopes(IParsingLifetimeEventHandler lifetimeEventHandler)
+        {
+            _lifetimeEventHandler = lifetimeEventHandler;
+        }
+        private Stack<ParsingScope> _scopes = new Stack<ParsingScope>();
+
+        /// <summary>
+        /// Creates a new <see cref="ParsingScope"/> and puts it on top of the stack.
+        /// </summary>
+        /// <param name="address"></param>
+        /// <returns></returns>
+        public virtual ParsingScope NewScope(RangeAddress address)
+        {
+            ParsingScope scope;
+            if (_scopes.Count() > 0)
+            {
+                scope = new ParsingScope(this, _scopes.Peek(), address);
+            }
+            else
+            {
+                scope = new ParsingScope(this, address);
+            }
+            _scopes.Push(scope);
+            return scope;
+        }
+
+
+        /// <summary>
+        /// The current parsing scope.
+        /// </summary>
+        public virtual ParsingScope Current
+        {
+            get { return _scopes.Count() > 0 ? _scopes.Peek() : null; }
+        }
+
+        /// <summary>
+        /// Removes the current scope, setting the calling scope to current.
+        /// </summary>
+        /// <param name="parsingScope"></param>
+        public virtual void KillScope(ParsingScope parsingScope)
+        {
+            _scopes.Pop();
+            if (_scopes.Count() == 0)
+            {
+                _lifetimeEventHandler.ParsingCompleted();
+            }
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Utilities/ArgumentInfo.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Utilities/ArgumentInfo.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Utilities/ArgumentInfo.cs	(revision 12707)
@@ -0,0 +1,25 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing.Utilities
+{
+    public class ArgumentInfo<T>
+    {
+        public ArgumentInfo(T val)
+        {
+            Value = val;
+        }
+
+        public T Value { get; private set; }
+
+        public string Name { get; private set; }
+
+        public ArgumentInfo<T> Named(string argName)
+        {
+            Name = argName;
+            return this;
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Utilities/ExtensionMethods.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Utilities/ExtensionMethods.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Utilities/ExtensionMethods.cs	(revision 12707)
@@ -0,0 +1,33 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing.Utilities
+{
+    public static class ExtensionMethods
+    {
+        public static void IsNotNullOrEmpty(this ArgumentInfo<string> val)
+        {
+            if (string.IsNullOrEmpty(val.Value))
+            {
+                throw new ArgumentException(val.Name + " cannot be null or empty");
+            }
+        }
+
+        public static void IsNotNull<T>(this ArgumentInfo<T> val)
+            where T : class
+        {
+            if (val.Value == null)
+            {
+                throw new ArgumentNullException(val.Name);
+            }
+        }
+
+        public static bool IsNumeric(this object obj)
+        {
+            if (obj == null) return false;
+            return (obj.GetType().IsPrimitive || obj is double || obj is decimal || obj is System.DateTime || obj is TimeSpan);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Utilities/IdProvider.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Utilities/IdProvider.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Utilities/IdProvider.cs	(revision 12707)
@@ -0,0 +1,12 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing.Utilities
+{
+    public abstract class IdProvider
+    {
+        public abstract object NewId();
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Utilities/IntegerIdProvider.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Utilities/IntegerIdProvider.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Utilities/IntegerIdProvider.cs	(revision 12707)
@@ -0,0 +1,21 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing.Utilities
+{
+    public class IntegerIdProvider : IdProvider
+    {
+        private int _lastId = int.MinValue;
+
+        public override object NewId()
+        {
+            if (_lastId >= int.MaxValue)
+            {
+                throw new InvalidOperationException("IdProvider run out of id:s");
+            }
+            return _lastId++;
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Utilities/RegexConstants.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Utilities/RegexConstants.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Utilities/RegexConstants.cs	(revision 12707)
@@ -0,0 +1,48 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2013-03-01 (Prior file history on https://github.com/swmal/ExcelFormulaParser)
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing.Utilities
+{
+    public static class RegexConstants
+    {
+        public const string SingleCellAddress = @"^(('[^/\\?*\[\]]{1,31}'|[A-Za-z_]{1,31})!)?[A-Z]{1,3}[1-9]{1}[0-9]{0,7}$";
+        //Changed JK 26/2-2013
+        public const string ExcelAddress = @"^(('[^/\\?*\[\]]{1,31}'|[A-Za-z_]{1,31})!)?[\$]{0,1}([A-Z]|[A-Z]{1,3}[\$]{0,1}[1-9]{1}[0-9]{0,7})(\:({0,1}[A-Z]|[A-Z]{1,3}[\$]{0,1}[1-9]{1}[0-9]{0,7})){0,1}$";
+        //public const string ExcelAddress = @"^([\$]{0,1}([A-Z]{1,3}[\$]{0,1}[0-9]{1,7})(\:([\$]{0,1}[A-Z]{1,3}[\$]{0,1}[0-9]{1,7}){0,1})|([\$]{0,1}[A-Z]{1,3}\:[\$]{0,1}[A-Z]{1,3})|([\$]{0,1}[0-9]{1,7}\:[\$]{0,1}[0-9]{1,7}))$";
+        public const string Boolean = @"^(true|false)$";
+        public const string Decimal = @"^[0-9]+\.[0-9]+$";
+        public const string Integer = @"^[0-9]+$";
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Utilities/Require.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Utilities/Require.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Utilities/Require.cs	(revision 12707)
@@ -0,0 +1,15 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.FormulaParsing.Utilities
+{
+    public static class Require
+    {
+        public static ArgumentInfo<T> That<T>(T arg)
+        {
+            return new ArgumentInfo<T>(arg);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/IRangeID.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/IRangeID.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/IRangeID.cs	(revision 12707)
@@ -0,0 +1,54 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman          Added       		        2010-02-04
+ * Jan Källman		    License changed GPL-->LGPL  2011-12-27
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace OfficeOpenXml
+{
+    /// <summary>
+    /// Id from a cell, column or row.
+    /// </summary>
+    interface IRangeID
+    {
+        /// <summary>
+        /// This is the id for a cell, row or column.
+        /// The id is a composit of the SheetID, the row number and the column number.
+        /// Bit 1-14 SheetID, Bit 15-28 Column number (0 if entire column), Bit 29- Row number (0 if entire row).
+        /// </summary>
+        ulong RangeID
+        {
+            get;
+            set;
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/OfficeProperties.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/OfficeProperties.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/OfficeProperties.cs	(revision 12707)
@@ -0,0 +1,543 @@
+/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		                Initial Release		        2009-10-01
+ * Jan Källman                      Total rewrite               2010-03-01
+ * Jan Källman		    License changed GPL-->LGPL  2011-12-27
+ * Raziq York                       Added Created & Modified    2014-08-20
+ *******************************************************************************/
+using System;
+using System.Xml;
+using System.IO;
+using System.Globalization;
+using OfficeOpenXml.Utils;
+
+namespace OfficeOpenXml
+{
+    /// <summary>
+    /// Provides access to the properties bag of the package
+    /// </summary>
+    public sealed class OfficeProperties : XmlHelper
+    {
+        #region Private Properties
+        private XmlDocument _xmlPropertiesCore;
+        private XmlDocument _xmlPropertiesExtended;
+        private XmlDocument _xmlPropertiesCustom;
+
+        private Uri _uriPropertiesCore = new Uri("/docProps/core.xml", UriKind.Relative);
+        private Uri _uriPropertiesExtended = new Uri("/docProps/app.xml", UriKind.Relative);
+        private Uri _uriPropertiesCustom = new Uri("/docProps/custom.xml", UriKind.Relative);
+
+        XmlHelper _coreHelper;
+        XmlHelper _extendedHelper;
+        XmlHelper _customHelper;
+        private ExcelPackage _package;
+        #endregion
+
+        #region ExcelProperties Constructor
+        /// <summary>
+        /// Provides access to all the office document properties.
+        /// </summary>
+        /// <param name="package"></param>
+        /// <param name="ns"></param>
+        internal OfficeProperties(ExcelPackage package, XmlNamespaceManager ns) :
+            base(ns)
+        {
+            _package = package;
+
+            _coreHelper = XmlHelperFactory.Create(ns, CorePropertiesXml.SelectSingleNode("cp:coreProperties", NameSpaceManager));
+            _extendedHelper = XmlHelperFactory.Create(ns, ExtendedPropertiesXml);
+            _customHelper = XmlHelperFactory.Create(ns, CustomPropertiesXml);
+
+        }
+        #endregion
+        #region CorePropertiesXml
+        /// <summary>
+        /// Provides access to the XML document that holds all the code 
+        /// document properties.
+        /// </summary>
+        public XmlDocument CorePropertiesXml
+        {
+            get
+            {
+                if (_xmlPropertiesCore == null)
+                {
+                    string xml = string.Format("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?><cp:coreProperties xmlns:cp=\"{0}\" xmlns:dc=\"{1}\" xmlns:dcterms=\"{2}\" xmlns:dcmitype=\"{3}\" xmlns:xsi=\"{4}\"></cp:coreProperties>",
+                        ExcelPackage.schemaCore,
+                        ExcelPackage.schemaDc,
+                        ExcelPackage.schemaDcTerms,
+                        ExcelPackage.schemaDcmiType,
+                        ExcelPackage.schemaXsi);
+
+                    _xmlPropertiesCore = GetXmlDocument(xml, _uriPropertiesCore, @"application/vnd.openxmlformats-package.core-properties+xml", @"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties");
+                }
+                return (_xmlPropertiesCore);
+            }
+        }
+
+        private XmlDocument GetXmlDocument(string startXml, Uri uri, string contentType, string relationship)
+        {
+            XmlDocument xmlDoc;
+            if (_package.Package.PartExists(uri))
+                xmlDoc = _package.GetXmlFromUri(uri);
+            else
+            {
+                xmlDoc = new XmlDocument();
+                xmlDoc.LoadXml(startXml);
+
+                // Create a the part and add to the package
+                Packaging.ZipPackagePart part = _package.Package.CreatePart(uri, contentType);
+
+                // Save it to the package
+                StreamWriter stream = new StreamWriter(part.GetStream(FileMode.Create, FileAccess.Write));
+                xmlDoc.Save(stream);
+                //stream.Close();
+                _package.Package.Flush();
+
+                // create the relationship between the workbook and the new shared strings part
+                _package.Package.CreateRelationship(UriHelper.GetRelativeUri(new Uri("/xl", UriKind.Relative), uri), Packaging.TargetMode.Internal, relationship);
+                _package.Package.Flush();
+            }
+            return xmlDoc;
+        }
+        #endregion
+        #region Core Properties
+        const string TitlePath = "dc:title";
+        /// <summary>
+        /// Gets/sets the title property of the document (core property)
+        /// </summary>
+        public string Title
+        {
+            get { return _coreHelper.GetXmlNodeString(TitlePath); }
+            set { _coreHelper.SetXmlNodeString(TitlePath, value); }
+        }
+
+        const string SubjectPath = "dc:subject";
+        /// <summary>
+        /// Gets/sets the subject property of the document (core property)
+        /// </summary>
+        public string Subject
+        {
+            get { return _coreHelper.GetXmlNodeString(SubjectPath); }
+            set { _coreHelper.SetXmlNodeString(SubjectPath, value); }
+        }
+
+        const string AuthorPath = "dc:creator";
+        /// <summary>
+        /// Gets/sets the author property of the document (core property)
+        /// </summary>
+        public string Author
+        {
+            get { return _coreHelper.GetXmlNodeString(AuthorPath); }
+            set { _coreHelper.SetXmlNodeString(AuthorPath, value); }
+        }
+
+        const string CommentsPath = "dc:description";
+        /// <summary>
+        /// Gets/sets the comments property of the document (core property)
+        /// </summary>
+        public string Comments
+        {
+            get { return _coreHelper.GetXmlNodeString(CommentsPath); }
+            set { _coreHelper.SetXmlNodeString(CommentsPath, value); }
+        }
+
+        const string KeywordsPath = "cp:keywords";
+        /// <summary>
+        /// Gets/sets the keywords property of the document (core property)
+        /// </summary>
+        public string Keywords
+        {
+            get { return _coreHelper.GetXmlNodeString(KeywordsPath); }
+            set { _coreHelper.SetXmlNodeString(KeywordsPath, value); }
+        }
+
+        const string LastModifiedByPath = "cp:lastModifiedBy";
+        /// <summary>
+        /// Gets/sets the lastModifiedBy property of the document (core property)
+        /// </summary>
+        public string LastModifiedBy
+        {
+            get { return _coreHelper.GetXmlNodeString(LastModifiedByPath); }
+            set { _coreHelper.SetXmlNodeString(LastModifiedByPath, value); }
+        }
+
+        const string LastPrintedPath = "cp:lastPrinted";
+        /// <summary>
+        /// Gets/sets the lastPrinted property of the document (core property)
+        /// </summary>
+        public string LastPrinted
+        {
+            get { return _coreHelper.GetXmlNodeString(LastPrintedPath); }
+            set { _coreHelper.SetXmlNodeString(LastPrintedPath, value); }
+        }
+
+        const string CreatedPath = "dcterms:created";
+
+        /// <summary>
+	    /// Gets/sets the created property of the document (core property)
+	    /// </summary>
+	    public DateTime Created
+	    {
+	        get
+	        {
+	            DateTime date;
+	            return DateTime.TryParse(_coreHelper.GetXmlNodeString(CreatedPath), out date) ? date : DateTime.MinValue;
+	        }
+	        set
+	        {
+	            var dateString = value.ToUniversalTime().ToString("s", CultureInfo.InvariantCulture) + "Z";
+	            _coreHelper.SetXmlNodeString(CreatedPath, dateString);
+	        }
+	    }
+
+        const string CategoryPath = "cp:category";
+        /// <summary>
+        /// Gets/sets the category property of the document (core property)
+        /// </summary>
+        public string Category
+        {
+            get { return _coreHelper.GetXmlNodeString(CategoryPath); }
+            set { _coreHelper.SetXmlNodeString(CategoryPath, value); }
+        }
+
+        const string ContentStatusPath = "cp:contentStatus";
+        /// <summary>
+        /// Gets/sets the status property of the document (core property)
+        /// </summary>
+        public string Status
+        {
+            get { return _coreHelper.GetXmlNodeString(ContentStatusPath); }
+            set { _coreHelper.SetXmlNodeString(ContentStatusPath, value); }
+        }
+        #endregion
+
+        #region Extended Properties
+        #region ExtendedPropertiesXml
+        /// <summary>
+        /// Provides access to the XML document that holds the extended properties of the document (app.xml)
+        /// </summary>
+        public XmlDocument ExtendedPropertiesXml
+        {
+            get
+            {
+                if (_xmlPropertiesExtended == null)
+                {
+                    _xmlPropertiesExtended = GetXmlDocument(string.Format("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?><Properties xmlns:vt=\"{0}\" xmlns=\"{1}\"></Properties>",
+                            ExcelPackage.schemaVt,
+                            ExcelPackage.schemaExtended),
+                        _uriPropertiesExtended,
+                        @"application/vnd.openxmlformats-officedocument.extended-properties+xml",
+                        @"http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties");
+                }
+                return (_xmlPropertiesExtended);
+            }
+        }
+        #endregion
+
+        const string ApplicationPath = "xp:Properties/xp:Application";
+        /// <summary>
+        /// Gets the Application property of the document (extended property)
+        /// </summary>
+        public string Application
+        {
+            get { return _extendedHelper.GetXmlNodeString(ApplicationPath); }
+        }
+
+        const string HyperlinkBasePath = "xp:Properties/xp:HyperlinkBase";
+        /// <summary>
+        /// Gets/sets the HyperlinkBase property of the document (extended property)
+        /// </summary>
+        public Uri HyperlinkBase
+        {
+            get { return new Uri(_extendedHelper.GetXmlNodeString(HyperlinkBasePath), UriKind.Absolute); }
+            set { _extendedHelper.SetXmlNodeString(HyperlinkBasePath, value.AbsoluteUri); }
+        }
+
+        const string AppVersionPath = "xp:Properties/xp:AppVersion";
+        /// <summary>
+        /// Gets the AppVersion property of the document (extended property)
+        /// </summary>
+        public string AppVersion
+        {
+            get { return _extendedHelper.GetXmlNodeString(AppVersionPath); }
+        }
+        const string CompanyPath = "xp:Properties/xp:Company";
+
+        /// <summary>
+        /// Gets/sets the Company property of the document (extended property)
+        /// </summary>
+        public string Company
+        {
+            get { return _extendedHelper.GetXmlNodeString(CompanyPath); }
+            set { _extendedHelper.SetXmlNodeString(CompanyPath, value); }
+        }
+
+        const string ManagerPath = "xp:Properties/xp:Manager";
+        /// <summary>
+        /// Gets/sets the Manager property of the document (extended property)
+        /// </summary>
+        public string Manager
+        {
+            get { return _extendedHelper.GetXmlNodeString(ManagerPath); }
+            set { _extendedHelper.SetXmlNodeString(ManagerPath, value); }
+        }
+
+        const string ModifiedPath = "dcterms:modified";
+	    /// <summary>
+	    /// Gets/sets the modified property of the document (core property)
+	    /// </summary>
+	    public DateTime Modified
+	    {
+	        get
+	        {
+	            DateTime date;
+	            return DateTime.TryParse(_coreHelper.GetXmlNodeString(ModifiedPath), out date) ? date : DateTime.MinValue;
+	        }
+	        set
+	        {
+	            var dateString = value.ToUniversalTime().ToString("s", CultureInfo.InvariantCulture) + "Z";
+	            _coreHelper.SetXmlNodeString(ModifiedPath, dateString);
+	        }
+	    }
+
+        #region Get and Set Extended Properties
+        private string GetExtendedPropertyValue(string propertyName)
+        {
+            string retValue = null;
+            string searchString = string.Format("xp:Properties/xp:{0}", propertyName);
+            XmlNode node = ExtendedPropertiesXml.SelectSingleNode(searchString, NameSpaceManager);
+            if (node != null)
+            {
+                retValue = node.InnerText;
+            }
+            return retValue;
+        }
+        #endregion
+        #endregion
+
+        #region Custom Properties
+
+        #region CustomPropertiesXml
+        /// <summary>
+        /// Provides access to the XML document which holds the document's custom properties
+        /// </summary>
+        public XmlDocument CustomPropertiesXml
+        {
+            get
+            {
+                if (_xmlPropertiesCustom == null)
+                {
+                    _xmlPropertiesCustom = GetXmlDocument(string.Format("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?><Properties xmlns:vt=\"{0}\" xmlns=\"{1}\"></Properties>",
+                            ExcelPackage.schemaVt,
+                            ExcelPackage.schemaCustom),
+                         _uriPropertiesCustom, 
+                         @"application/vnd.openxmlformats-officedocument.custom-properties+xml",
+                         @"http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties");
+                }
+                return (_xmlPropertiesCustom);
+            }
+        }
+        #endregion
+
+        #region Get and Set Custom Properties
+        /// <summary>
+        /// Gets the value of a custom property
+        /// </summary>
+        /// <param name="propertyName">The name of the property</param>
+        /// <returns>The current value of the property</returns>
+        public object GetCustomPropertyValue(string propertyName)
+        {
+            string searchString = string.Format("ctp:Properties/ctp:property[@name='{0}']", propertyName);
+            XmlElement node = CustomPropertiesXml.SelectSingleNode(searchString, NameSpaceManager) as XmlElement;
+            if (node != null)
+            {
+                string value = node.LastChild.InnerText;
+                switch (node.LastChild.LocalName)
+                {
+                    case "filetime":
+                        DateTime dt;
+                        if (DateTime.TryParse(value, out dt))
+                        {
+                            return dt;
+                        }
+                        else
+                        {
+                            return null;
+                        }
+                    case "i4":
+                        int i;
+                        if (int.TryParse(value, out i))
+                        {
+                            return i;
+                        }
+                        else
+                        {
+                            return null;
+                        }
+                    case "r8":
+                        double d;
+                        if (double.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out d))
+                        {
+                            return d;
+                        }
+                        else
+                        {
+                            return null;
+                        }
+                    case "bool":
+                        if (value == "true")
+                        {
+                            return true;
+                        }
+                        else if (value == "false")
+                        {
+                            return false;
+                        }
+                        else
+                        {
+                            return null;
+                        }
+                    default:
+                        return value;
+                }
+            }
+            else
+            {
+                return null;
+            }
+        }
+
+        /// <summary>
+        /// Allows you to set the value of a current custom property or create your own custom property.  
+        /// </summary>
+        /// <param name="propertyName">The name of the property</param>
+        /// <param name="value">The value of the property</param>
+        public void SetCustomPropertyValue(string propertyName, object value)
+        {
+            XmlNode allProps = CustomPropertiesXml.SelectSingleNode(@"ctp:Properties", NameSpaceManager);
+
+            var prop = string.Format("ctp:Properties/ctp:property[@name='{0}']", propertyName);
+            XmlElement node = CustomPropertiesXml.SelectSingleNode(prop, NameSpaceManager) as XmlElement;
+            if (node == null)
+            {
+                int pid;
+                var MaxNode = CustomPropertiesXml.SelectSingleNode("ctp:Properties/ctp:property[not(@pid <= preceding-sibling::ctp:property/@pid) and not(@pid <= following-sibling::ctp:property/@pid)]", NameSpaceManager);
+                if (MaxNode == null)
+                {
+                    pid = 2;
+                }
+                else
+                {
+                    if (!int.TryParse(MaxNode.Attributes["pid"].Value, out pid))
+                    {
+                        pid = 2;
+                    }
+                    pid++;
+                }
+                node = CustomPropertiesXml.CreateElement("property", ExcelPackage.schemaCustom);
+                node.SetAttribute("fmtid", "{D5CDD505-2E9C-101B-9397-08002B2CF9AE}");
+                node.SetAttribute("pid", pid.ToString());  // custom property pid
+                node.SetAttribute("name", propertyName);
+
+                allProps.AppendChild(node);
+            }
+            else
+            {
+                while (node.ChildNodes.Count > 0) node.RemoveChild(node.ChildNodes[0]);
+            }
+            XmlElement valueElem;
+            if (value is bool)
+            {
+                valueElem = CustomPropertiesXml.CreateElement("vt", "bool", ExcelPackage.schemaVt);
+                valueElem.InnerText = value.ToString().ToLower(CultureInfo.InvariantCulture);
+            }
+            else if (value is DateTime)
+            {
+                valueElem = CustomPropertiesXml.CreateElement("vt", "filetime", ExcelPackage.schemaVt);
+                valueElem.InnerText = ((DateTime)value).AddHours(-1).ToString("yyyy-MM-ddTHH:mm:ssZ");
+            }
+            else if (value is short || value is int)
+            {
+                valueElem = CustomPropertiesXml.CreateElement("vt", "i4", ExcelPackage.schemaVt);
+                valueElem.InnerText = value.ToString();
+            }
+            else if (value is double || value is decimal || value is float || value is long)
+            {
+                valueElem = CustomPropertiesXml.CreateElement("vt", "r8", ExcelPackage.schemaVt);
+                if (value is double)
+                {
+                    valueElem.InnerText = ((double)value).ToString(CultureInfo.InvariantCulture);
+                }
+                else if (value is float)
+                {
+                    valueElem.InnerText = ((float)value).ToString(CultureInfo.InvariantCulture);
+                }
+                else if (value is decimal)
+                {
+                    valueElem.InnerText = ((decimal)value).ToString(CultureInfo.InvariantCulture);
+                }
+                else
+                {
+                    valueElem.InnerText = value.ToString();
+                }
+            }
+            else
+            {
+                valueElem = CustomPropertiesXml.CreateElement("vt", "lpwstr", ExcelPackage.schemaVt);
+                valueElem.InnerText = value.ToString();
+            }
+            node.AppendChild(valueElem);
+        }
+        #endregion
+        #endregion
+
+        #region Save
+        /// <summary>
+        /// Saves the document properties back to the package.
+        /// </summary>
+        internal void Save()
+        {
+            if (_xmlPropertiesCore != null)
+            {
+                _package.SavePart(_uriPropertiesCore, _xmlPropertiesCore);
+            }
+            if (_xmlPropertiesExtended != null)
+            {
+                _package.SavePart(_uriPropertiesExtended, _xmlPropertiesExtended);
+            }
+            if (_xmlPropertiesCustom != null)
+            {
+                _package.SavePart(_uriPropertiesCustom, _xmlPropertiesCustom);
+            }
+
+        }
+        #endregion
+
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/CRC32.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/CRC32.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/CRC32.cs	(revision 12707)
@@ -0,0 +1,814 @@
+// CRC32.cs
+// ------------------------------------------------------------------
+//
+// Copyright (c) 2011 Dino Chiesa.
+// All rights reserved.
+//
+// This code module is part of DotNetZip, a zipfile class library.
+//
+// ------------------------------------------------------------------
+//
+// This code is licensed under the Microsoft Public License.
+// See the file License.txt for the license details.
+// More info on: http://dotnetzip.codeplex.com
+//
+// ------------------------------------------------------------------
+//
+// Last Saved: <2011-August-02 18:25:54>
+//
+// ------------------------------------------------------------------
+//
+// This module defines the CRC32 class, which can do the CRC32 algorithm, using
+// arbitrary starting polynomials, and bit reversal. The bit reversal is what
+// distinguishes this CRC-32 used in BZip2 from the CRC-32 that is used in PKZIP
+// files, or GZIP files. This class does both.
+//
+// ------------------------------------------------------------------
+
+
+using System;
+using Interop = System.Runtime.InteropServices;
+
+namespace OfficeOpenXml.Packaging.Ionic.Crc
+{
+    /// <summary>
+    ///   Computes a CRC-32. The CRC-32 algorithm is parameterized - you
+    ///   can set the polynomial and enable or disable bit
+    ///   reversal. This can be used for GZIP, BZip2, or ZIP.
+    /// </summary>
+    /// <remarks>
+    ///   This type is used internally by DotNetZip; it is generally not used
+    ///   directly by applications wishing to create, read, or manipulate zip
+    ///   archive files.
+    /// </remarks>
+
+    [Interop.GuidAttribute("ebc25cf6-9120-4283-b972-0e5520d0000C")]
+    [Interop.ComVisible(true)]
+#if !NETCF
+    [Interop.ClassInterface(Interop.ClassInterfaceType.AutoDispatch)]
+#endif
+    internal class CRC32
+    {
+        /// <summary>
+        ///   Indicates the total number of bytes applied to the CRC.
+        /// </summary>
+        public Int64 TotalBytesRead
+        {
+            get
+            {
+                return _TotalBytesRead;
+            }
+        }
+
+        /// <summary>
+        /// Indicates the current CRC for all blocks slurped in.
+        /// </summary>
+        public Int32 Crc32Result
+        {
+            get
+            {
+                return unchecked((Int32)(~_register));
+            }
+        }
+
+        /// <summary>
+        /// Returns the CRC32 for the specified stream.
+        /// </summary>
+        /// <param name="input">The stream over which to calculate the CRC32</param>
+        /// <returns>the CRC32 calculation</returns>
+        public Int32 GetCrc32(System.IO.Stream input)
+        {
+            return GetCrc32AndCopy(input, null);
+        }
+
+        /// <summary>
+        /// Returns the CRC32 for the specified stream, and writes the input into the
+        /// output stream.
+        /// </summary>
+        /// <param name="input">The stream over which to calculate the CRC32</param>
+        /// <param name="output">The stream into which to deflate the input</param>
+        /// <returns>the CRC32 calculation</returns>
+        public Int32 GetCrc32AndCopy(System.IO.Stream input, System.IO.Stream output)
+        {
+            if (input == null)
+                throw new Exception("The input stream must not be null.");
+
+            unchecked
+            {
+                byte[] buffer = new byte[BUFFER_SIZE];
+                int readSize = BUFFER_SIZE;
+
+                _TotalBytesRead = 0;
+                int count = input.Read(buffer, 0, readSize);
+                if (output != null) output.Write(buffer, 0, count);
+                _TotalBytesRead += count;
+                while (count > 0)
+                {
+                    SlurpBlock(buffer, 0, count);
+                    count = input.Read(buffer, 0, readSize);
+                    if (output != null) output.Write(buffer, 0, count);
+                    _TotalBytesRead += count;
+                }
+
+                return (Int32)(~_register);
+            }
+        }
+
+
+        /// <summary>
+        ///   Get the CRC32 for the given (word,byte) combo.  This is a
+        ///   computation defined by PKzip for PKZIP 2.0 (weak) encryption.
+        /// </summary>
+        /// <param name="W">The word to start with.</param>
+        /// <param name="B">The byte to combine it with.</param>
+        /// <returns>The CRC-ized result.</returns>
+        public Int32 ComputeCrc32(Int32 W, byte B)
+        {
+            return _InternalComputeCrc32((UInt32)W, B);
+        }
+
+        internal Int32 _InternalComputeCrc32(UInt32 W, byte B)
+        {
+            return (Int32)(crc32Table[(W ^ B) & 0xFF] ^ (W >> 8));
+        }
+
+
+        /// <summary>
+        /// Update the value for the running CRC32 using the given block of bytes.
+        /// This is useful when using the CRC32() class in a Stream.
+        /// </summary>
+        /// <param name="block">block of bytes to slurp</param>
+        /// <param name="offset">starting point in the block</param>
+        /// <param name="count">how many bytes within the block to slurp</param>
+        public void SlurpBlock(byte[] block, int offset, int count)
+        {
+            if (block == null)
+                throw new Exception("The data buffer must not be null.");
+
+            // bzip algorithm
+            for (int i = 0; i < count; i++)
+            {
+                int x = offset + i;
+                byte b = block[x];
+                if (this.reverseBits)
+                {
+                    UInt32 temp = (_register >> 24) ^ b;
+                    _register = (_register << 8) ^ crc32Table[temp];
+                }
+                else
+                {
+                    UInt32 temp = (_register & 0x000000FF) ^ b;
+                    _register = (_register >> 8) ^ crc32Table[temp];
+                }
+            }
+            _TotalBytesRead += count;
+        }
+
+
+        /// <summary>
+        ///   Process one byte in the CRC.
+        /// </summary>
+        /// <param name = "b">the byte to include into the CRC .  </param>
+        public void UpdateCRC(byte b)
+        {
+            if (this.reverseBits)
+            {
+                UInt32 temp = (_register >> 24) ^ b;
+                _register = (_register << 8) ^ crc32Table[temp];
+            }
+            else
+            {
+                UInt32 temp = (_register & 0x000000FF) ^ b;
+                _register = (_register >> 8) ^ crc32Table[temp];
+            }
+        }
+
+        /// <summary>
+        ///   Process a run of N identical bytes into the CRC.
+        /// </summary>
+        /// <remarks>
+        ///   <para>
+        ///     This method serves as an optimization for updating the CRC when a
+        ///     run of identical bytes is found. Rather than passing in a buffer of
+        ///     length n, containing all identical bytes b, this method accepts the
+        ///     byte value and the length of the (virtual) buffer - the length of
+        ///     the run.
+        ///   </para>
+        /// </remarks>
+        /// <param name = "b">the byte to include into the CRC.  </param>
+        /// <param name = "n">the number of times that byte should be repeated. </param>
+        public void UpdateCRC(byte b, int n)
+        {
+            while (n-- > 0)
+            {
+                if (this.reverseBits)
+                {
+                    uint temp = (_register >> 24) ^ b;
+                    _register = (_register << 8) ^ crc32Table[(temp >= 0)
+                                                              ? temp
+                                                              : (temp + 256)];
+                }
+                else
+                {
+                    UInt32 temp = (_register & 0x000000FF) ^ b;
+                    _register = (_register >> 8) ^ crc32Table[(temp >= 0)
+                                                              ? temp
+                                                              : (temp + 256)];
+
+                }
+            }
+        }
+
+
+
+        private static uint ReverseBits(uint data)
+        {
+            unchecked
+            {
+                uint ret = data;
+                ret = (ret & 0x55555555) << 1 | (ret >> 1) & 0x55555555;
+                ret = (ret & 0x33333333) << 2 | (ret >> 2) & 0x33333333;
+                ret = (ret & 0x0F0F0F0F) << 4 | (ret >> 4) & 0x0F0F0F0F;
+                ret = (ret << 24) | ((ret & 0xFF00) << 8) | ((ret >> 8) & 0xFF00) | (ret >> 24);
+                return ret;
+            }
+        }
+
+        private static byte ReverseBits(byte data)
+        {
+            unchecked
+            {
+                uint u = (uint)data * 0x00020202;
+                uint m = 0x01044010;
+                uint s = u & m;
+                uint t = (u << 2) & (m << 1);
+                return (byte)((0x01001001 * (s + t)) >> 24);
+            }
+        }
+
+
+
+        private void GenerateLookupTable()
+        {
+            crc32Table = new UInt32[256];
+            unchecked
+            {
+                UInt32 dwCrc;
+                byte i = 0;
+                do
+                {
+                    dwCrc = i;
+                    for (byte j = 8; j > 0; j--)
+                    {
+                        if ((dwCrc & 1) == 1)
+                        {
+                            dwCrc = (dwCrc >> 1) ^ dwPolynomial;
+                        }
+                        else
+                        {
+                            dwCrc >>= 1;
+                        }
+                    }
+                    if (reverseBits)
+                    {
+                        crc32Table[ReverseBits(i)] = ReverseBits(dwCrc);
+                    }
+                    else
+                    {
+                        crc32Table[i] = dwCrc;
+                    }
+                    i++;
+                } while (i!=0);
+            }
+
+#if VERBOSE
+            Console.WriteLine();
+            Console.WriteLine("private static readonly UInt32[] crc32Table = {");
+            for (int i = 0; i < crc32Table.Length; i+=4)
+            {
+                Console.Write("   ");
+                for (int j=0; j < 4; j++)
+                {
+                    Console.Write(" 0x{0:X8}U,", crc32Table[i+j]);
+                }
+                Console.WriteLine();
+            }
+            Console.WriteLine("};");
+            Console.WriteLine();
+#endif
+        }
+
+
+        private uint gf2_matrix_times(uint[] matrix, uint vec)
+        {
+            uint sum = 0;
+            int i=0;
+            while (vec != 0)
+            {
+                if ((vec & 0x01)== 0x01)
+                    sum ^= matrix[i];
+                vec >>= 1;
+                i++;
+            }
+            return sum;
+        }
+
+        private void gf2_matrix_square(uint[] square, uint[] mat)
+        {
+            for (int i = 0; i < 32; i++)
+                square[i] = gf2_matrix_times(mat, mat[i]);
+        }
+
+
+
+        /// <summary>
+        ///   Combines the given CRC32 value with the current running total.
+        /// </summary>
+        /// <remarks>
+        ///   This is useful when using a divide-and-conquer approach to
+        ///   calculating a CRC.  Multiple threads can each calculate a
+        ///   CRC32 on a segment of the data, and then combine the
+        ///   individual CRC32 values at the end.
+        /// </remarks>
+        /// <param name="crc">the crc value to be combined with this one</param>
+        /// <param name="length">the length of data the CRC value was calculated on</param>
+        public void Combine(int crc, int length)
+        {
+            uint[] even = new uint[32];     // even-power-of-two zeros operator
+            uint[] odd = new uint[32];      // odd-power-of-two zeros operator
+
+            if (length == 0)
+                return;
+
+            uint crc1= ~_register;
+            uint crc2= (uint) crc;
+
+            // put operator for one zero bit in odd
+            odd[0] = this.dwPolynomial;  // the CRC-32 polynomial
+            uint row = 1;
+            for (int i = 1; i < 32; i++)
+            {
+                odd[i] = row;
+                row <<= 1;
+            }
+
+            // put operator for two zero bits in even
+            gf2_matrix_square(even, odd);
+
+            // put operator for four zero bits in odd
+            gf2_matrix_square(odd, even);
+
+            uint len2 = (uint) length;
+
+            // apply len2 zeros to crc1 (first square will put the operator for one
+            // zero byte, eight zero bits, in even)
+            do {
+                // apply zeros operator for this bit of len2
+                gf2_matrix_square(even, odd);
+
+                if ((len2 & 1)== 1)
+                    crc1 = gf2_matrix_times(even, crc1);
+                len2 >>= 1;
+
+                if (len2 == 0)
+                    break;
+
+                // another iteration of the loop with odd and even swapped
+                gf2_matrix_square(odd, even);
+                if ((len2 & 1)==1)
+                    crc1 = gf2_matrix_times(odd, crc1);
+                len2 >>= 1;
+
+
+            } while (len2 != 0);
+
+            crc1 ^= crc2;
+
+            _register= ~crc1;
+
+            //return (int) crc1;
+            return;
+        }
+
+
+        /// <summary>
+        ///   Create an instance of the CRC32 class using the default settings: no
+        ///   bit reversal, and a polynomial of 0xEDB88320.
+        /// </summary>
+        public CRC32() : this(false)
+        {
+        }
+
+        /// <summary>
+        ///   Create an instance of the CRC32 class, specifying whether to reverse
+        ///   data bits or not.
+        /// </summary>
+        /// <param name='reverseBits'>
+        ///   specify true if the instance should reverse data bits.
+        /// </param>
+        /// <remarks>
+        ///   <para>
+        ///     In the CRC-32 used by BZip2, the bits are reversed. Therefore if you
+        ///     want a CRC32 with compatibility with BZip2, you should pass true
+        ///     here. In the CRC-32 used by GZIP and PKZIP, the bits are not
+        ///     reversed; Therefore if you want a CRC32 with compatibility with
+        ///     those, you should pass false.
+        ///   </para>
+        /// </remarks>
+        public CRC32(bool reverseBits) :
+            this( unchecked((int)0xEDB88320), reverseBits)
+        {
+        }
+
+
+        /// <summary>
+        ///   Create an instance of the CRC32 class, specifying the polynomial and
+        ///   whether to reverse data bits or not.
+        /// </summary>
+        /// <param name='polynomial'>
+        ///   The polynomial to use for the CRC, expressed in the reversed (LSB)
+        ///   format: the highest ordered bit in the polynomial value is the
+        ///   coefficient of the 0th power; the second-highest order bit is the
+        ///   coefficient of the 1 power, and so on. Expressed this way, the
+        ///   polynomial for the CRC-32C used in IEEE 802.3, is 0xEDB88320.
+        /// </param>
+        /// <param name='reverseBits'>
+        ///   specify true if the instance should reverse data bits.
+        /// </param>
+        ///
+        /// <remarks>
+        ///   <para>
+        ///     In the CRC-32 used by BZip2, the bits are reversed. Therefore if you
+        ///     want a CRC32 with compatibility with BZip2, you should pass true
+        ///     here for the <c>reverseBits</c> parameter. In the CRC-32 used by
+        ///     GZIP and PKZIP, the bits are not reversed; Therefore if you want a
+        ///     CRC32 with compatibility with those, you should pass false for the
+        ///     <c>reverseBits</c> parameter.
+        ///   </para>
+        /// </remarks>
+        public CRC32(int polynomial, bool reverseBits)
+        {
+            this.reverseBits = reverseBits;
+            this.dwPolynomial = (uint) polynomial;
+            this.GenerateLookupTable();
+        }
+
+        /// <summary>
+        ///   Reset the CRC-32 class - clear the CRC "remainder register."
+        /// </summary>
+        /// <remarks>
+        ///   <para>
+        ///     Use this when employing a single instance of this class to compute
+        ///     multiple, distinct CRCs on multiple, distinct data blocks.
+        ///   </para>
+        /// </remarks>
+        public void Reset()
+        {
+            _register = 0xFFFFFFFFU;
+        }
+
+        // private member vars
+        private UInt32 dwPolynomial;
+        private Int64 _TotalBytesRead;
+        private bool reverseBits;
+        private UInt32[] crc32Table;
+        private const int BUFFER_SIZE = 8192;
+        private UInt32 _register = 0xFFFFFFFFU;
+    }
+
+
+    /// <summary>
+    /// A Stream that calculates a CRC32 (a checksum) on all bytes read,
+    /// or on all bytes written.
+    /// </summary>
+    ///
+    /// <remarks>
+    /// <para>
+    /// This class can be used to verify the CRC of a ZipEntry when
+    /// reading from a stream, or to calculate a CRC when writing to a
+    /// stream.  The stream should be used to either read, or write, but
+    /// not both.  If you intermix reads and writes, the results are not
+    /// defined.
+    /// </para>
+    ///
+    /// <para>
+    /// This class is intended primarily for use internally by the
+    /// DotNetZip library.
+    /// </para>
+    /// </remarks>
+    internal class CrcCalculatorStream : System.IO.Stream, System.IDisposable
+    {
+        private static readonly Int64 UnsetLengthLimit = -99;
+
+        internal System.IO.Stream _innerStream;
+        private CRC32 _Crc32;
+        private Int64 _lengthLimit = -99;
+        private bool _leaveOpen;
+
+        /// <summary>
+        /// The default constructor.
+        /// </summary>
+        /// <remarks>
+        ///   <para>
+        ///     Instances returned from this constructor will leave the underlying
+        ///     stream open upon Close().  The stream uses the default CRC32
+        ///     algorithm, which implies a polynomial of 0xEDB88320.
+        ///   </para>
+        /// </remarks>
+        /// <param name="stream">The underlying stream</param>
+        public CrcCalculatorStream(System.IO.Stream stream)
+            : this(true, CrcCalculatorStream.UnsetLengthLimit, stream, null)
+        {
+        }
+
+        /// <summary>
+        ///   The constructor allows the caller to specify how to handle the
+        ///   underlying stream at close.
+        /// </summary>
+        /// <remarks>
+        ///   <para>
+        ///     The stream uses the default CRC32 algorithm, which implies a
+        ///     polynomial of 0xEDB88320.
+        ///   </para>
+        /// </remarks>
+        /// <param name="stream">The underlying stream</param>
+        /// <param name="leaveOpen">true to leave the underlying stream
+        /// open upon close of the <c>CrcCalculatorStream</c>; false otherwise.</param>
+        public CrcCalculatorStream(System.IO.Stream stream, bool leaveOpen)
+            : this(leaveOpen, CrcCalculatorStream.UnsetLengthLimit, stream, null)
+        {
+        }
+
+        /// <summary>
+        ///   A constructor allowing the specification of the length of the stream
+        ///   to read.
+        /// </summary>
+        /// <remarks>
+        ///   <para>
+        ///     The stream uses the default CRC32 algorithm, which implies a
+        ///     polynomial of 0xEDB88320.
+        ///   </para>
+        ///   <para>
+        ///     Instances returned from this constructor will leave the underlying
+        ///     stream open upon Close().
+        ///   </para>
+        /// </remarks>
+        /// <param name="stream">The underlying stream</param>
+        /// <param name="length">The length of the stream to slurp</param>
+        public CrcCalculatorStream(System.IO.Stream stream, Int64 length)
+            : this(true, length, stream, null)
+        {
+            if (length < 0)
+                throw new ArgumentException("length");
+        }
+
+        /// <summary>
+        ///   A constructor allowing the specification of the length of the stream
+        ///   to read, as well as whether to keep the underlying stream open upon
+        ///   Close().
+        /// </summary>
+        /// <remarks>
+        ///   <para>
+        ///     The stream uses the default CRC32 algorithm, which implies a
+        ///     polynomial of 0xEDB88320.
+        ///   </para>
+        /// </remarks>
+        /// <param name="stream">The underlying stream</param>
+        /// <param name="length">The length of the stream to slurp</param>
+        /// <param name="leaveOpen">true to leave the underlying stream
+        /// open upon close of the <c>CrcCalculatorStream</c>; false otherwise.</param>
+        public CrcCalculatorStream(System.IO.Stream stream, Int64 length, bool leaveOpen)
+            : this(leaveOpen, length, stream, null)
+        {
+            if (length < 0)
+                throw new ArgumentException("length");
+        }
+
+        /// <summary>
+        ///   A constructor allowing the specification of the length of the stream
+        ///   to read, as well as whether to keep the underlying stream open upon
+        ///   Close(), and the CRC32 instance to use.
+        /// </summary>
+        /// <remarks>
+        ///   <para>
+        ///     The stream uses the specified CRC32 instance, which allows the
+        ///     application to specify how the CRC gets calculated.
+        ///   </para>
+        /// </remarks>
+        /// <param name="stream">The underlying stream</param>
+        /// <param name="length">The length of the stream to slurp</param>
+        /// <param name="leaveOpen">true to leave the underlying stream
+        /// open upon close of the <c>CrcCalculatorStream</c>; false otherwise.</param>
+        /// <param name="crc32">the CRC32 instance to use to calculate the CRC32</param>
+        public CrcCalculatorStream(System.IO.Stream stream, Int64 length, bool leaveOpen,
+                                   CRC32 crc32)
+            : this(leaveOpen, length, stream, crc32)
+        {
+            if (length < 0)
+                throw new ArgumentException("length");
+        }
+
+
+        // This ctor is private - no validation is done here.  This is to allow the use
+        // of a (specific) negative value for the _lengthLimit, to indicate that there
+        // is no length set.  So we validate the length limit in those ctors that use an
+        // explicit param, otherwise we don't validate, because it could be our special
+        // value.
+        private CrcCalculatorStream
+            (bool leaveOpen, Int64 length, System.IO.Stream stream, CRC32 crc32)
+            : base()
+        {
+            _innerStream = stream;
+            _Crc32 = crc32 ?? new CRC32();
+            _lengthLimit = length;
+            _leaveOpen = leaveOpen;
+        }
+
+
+        /// <summary>
+        ///   Gets the total number of bytes run through the CRC32 calculator.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///   This is either the total number of bytes read, or the total number of
+        ///   bytes written, depending on the direction of this stream.
+        /// </remarks>
+        public Int64 TotalBytesSlurped
+        {
+            get { return _Crc32.TotalBytesRead; }
+        }
+
+        /// <summary>
+        ///   Provides the current CRC for all blocks slurped in.
+        /// </summary>
+        /// <remarks>
+        ///   <para>
+        ///     The running total of the CRC is kept as data is written or read
+        ///     through the stream.  read this property after all reads or writes to
+        ///     get an accurate CRC for the entire stream.
+        ///   </para>
+        /// </remarks>
+        public Int32 Crc
+        {
+            get { return _Crc32.Crc32Result; }
+        }
+
+        /// <summary>
+        ///   Indicates whether the underlying stream will be left open when the
+        ///   <c>CrcCalculatorStream</c> is Closed.
+        /// </summary>
+        /// <remarks>
+        ///   <para>
+        ///     Set this at any point before calling <see cref="Close()"/>.
+        ///   </para>
+        /// </remarks>
+        public bool LeaveOpen
+        {
+            get { return _leaveOpen; }
+            set { _leaveOpen = value; }
+        }
+
+        /// <summary>
+        /// Read from the stream
+        /// </summary>
+        /// <param name="buffer">the buffer to read</param>
+        /// <param name="offset">the offset at which to start</param>
+        /// <param name="count">the number of bytes to read</param>
+        /// <returns>the number of bytes actually read</returns>
+        public override int Read(byte[] buffer, int offset, int count)
+        {
+            int bytesToRead = count;
+
+            // Need to limit the # of bytes returned, if the stream is intended to have
+            // a definite length.  This is especially useful when returning a stream for
+            // the uncompressed data directly to the application.  The app won't
+            // necessarily read only the UncompressedSize number of bytes.  For example
+            // wrapping the stream returned from OpenReader() into a StreadReader() and
+            // calling ReadToEnd() on it, We can "over-read" the zip data and get a
+            // corrupt string.  The length limits that, prevents that problem.
+
+            if (_lengthLimit != CrcCalculatorStream.UnsetLengthLimit)
+            {
+                if (_Crc32.TotalBytesRead >= _lengthLimit) return 0; // EOF
+                Int64 bytesRemaining = _lengthLimit - _Crc32.TotalBytesRead;
+                if (bytesRemaining < count) bytesToRead = (int)bytesRemaining;
+            }
+            int n = _innerStream.Read(buffer, offset, bytesToRead);
+            if (n > 0) _Crc32.SlurpBlock(buffer, offset, n);
+            return n;
+        }
+
+        /// <summary>
+        /// Write to the stream.
+        /// </summary>
+        /// <param name="buffer">the buffer from which to write</param>
+        /// <param name="offset">the offset at which to start writing</param>
+        /// <param name="count">the number of bytes to write</param>
+        public override void Write(byte[] buffer, int offset, int count)
+        {
+            if (count > 0) _Crc32.SlurpBlock(buffer, offset, count);
+            _innerStream.Write(buffer, offset, count);
+        }
+
+        /// <summary>
+        /// Indicates whether the stream supports reading.
+        /// </summary>
+        public override bool CanRead
+        {
+            get { return _innerStream.CanRead; }
+        }
+
+        /// <summary>
+        ///   Indicates whether the stream supports seeking.
+        /// </summary>
+        /// <remarks>
+        ///   <para>
+        ///     Always returns false.
+        ///   </para>
+        /// </remarks>
+        public override bool CanSeek
+        {
+            get { return false; }
+        }
+
+        /// <summary>
+        /// Indicates whether the stream supports writing.
+        /// </summary>
+        public override bool CanWrite
+        {
+            get { return _innerStream.CanWrite; }
+        }
+
+        /// <summary>
+        /// Flush the stream.
+        /// </summary>
+        public override void Flush()
+        {
+            _innerStream.Flush();
+        }
+
+        /// <summary>
+        ///   Returns the length of the underlying stream.
+        /// </summary>
+        public override long Length
+        {
+            get
+            {
+                if (_lengthLimit == CrcCalculatorStream.UnsetLengthLimit)
+                    return _innerStream.Length;
+                else return _lengthLimit;
+            }
+        }
+
+        /// <summary>
+        ///   The getter for this property returns the total bytes read.
+        ///   If you use the setter, it will throw
+        /// <see cref="NotSupportedException"/>.
+        /// </summary>
+        public override long Position
+        {
+            get { return _Crc32.TotalBytesRead; }
+            set { throw new NotSupportedException(); }
+        }
+
+        /// <summary>
+        /// Seeking is not supported on this stream. This method always throws
+        /// <see cref="NotSupportedException"/>
+        /// </summary>
+        /// <param name="offset">N/A</param>
+        /// <param name="origin">N/A</param>
+        /// <returns>N/A</returns>
+        public override long Seek(long offset, System.IO.SeekOrigin origin)
+        {
+            throw new NotSupportedException();
+        }
+
+        /// <summary>
+        /// This method always throws
+        /// <see cref="NotSupportedException"/>
+        /// </summary>
+        /// <param name="value">N/A</param>
+        public override void SetLength(long value)
+        {
+            throw new NotSupportedException();
+        }
+
+
+        void IDisposable.Dispose()
+        {
+            Close();
+        }
+
+        /// <summary>
+        /// Closes the stream.
+        /// </summary>
+        public override void Close()
+        {
+            base.Close();
+            if (!_leaveOpen)
+                _innerStream.Close();
+        }
+
+    }
+
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ComHelper.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ComHelper.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ComHelper.cs	(revision 12707)
@@ -0,0 +1,116 @@
+// ComHelper.cs
+// ------------------------------------------------------------------
+//
+// Copyright (c) 2009 Dino Chiesa.
+// All rights reserved.
+//
+// This code module is part of DotNetZip, a zipfile class library.
+//
+// ------------------------------------------------------------------
+//
+// This code is licensed under the Microsoft Public License.
+// See the file License.txt for the license details.
+// More info on: http://dotnetzip.codeplex.com
+//
+// ------------------------------------------------------------------
+//
+// last saved (in emacs):
+// Time-stamp: <2011-June-13 17:04:06>
+//
+// ------------------------------------------------------------------
+//
+// This module defines a COM Helper class.
+//
+// Created: Tue, 08 Sep 2009  22:03
+//
+
+using Interop=System.Runtime.InteropServices;
+
+namespace OfficeOpenXml.Packaging.Ionic.Zip
+{
+    /// <summary>
+    /// This class exposes a set of COM-accessible wrappers for static
+    /// methods available on the ZipFile class.  You don't need this
+    /// class unless you are using DotNetZip from a COM environment.
+    /// </summary>
+    [System.Runtime.InteropServices.GuidAttribute("ebc25cf6-9120-4283-b972-0e5520d0000F")]
+    [System.Runtime.InteropServices.ComVisible(true)]
+#if !NETCF
+    [System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)]
+#endif
+
+    internal class ComHelper
+    {
+        /// <summary>
+        ///  A wrapper for <see cref="ZipFile.IsZipFile(string)">ZipFile.IsZipFile(string)</see>
+        /// </summary>
+        /// <param name="filename">The filename to of the zip file to check.</param>
+        /// <returns>true if the file contains a valid zip file.</returns>
+        public bool IsZipFile(string filename)
+        {
+            return ZipFile.IsZipFile(filename);
+        }
+
+        /// <summary>
+        ///  A wrapper for <see cref="ZipFile.IsZipFile(string, bool)">ZipFile.IsZipFile(string, bool)</see>
+        /// </summary>
+        /// <remarks>
+        /// We cannot use "overloaded" Method names in COM interop.
+        /// So, here, we use a unique name.
+        /// </remarks>
+        /// <param name="filename">The filename to of the zip file to check.</param>
+        /// <returns>true if the file contains a valid zip file.</returns>
+        public bool IsZipFileWithExtract(string filename)
+        {
+            return ZipFile.IsZipFile(filename, true);
+        }
+
+#if !NETCF
+        /// <summary>
+        ///  A wrapper for <see cref="ZipFile.CheckZip(string)">ZipFile.CheckZip(string)</see>
+        /// </summary>
+        /// <param name="filename">The filename to of the zip file to check.</param>
+        ///
+        /// <returns>true if the named zip file checks OK. Otherwise, false. </returns>
+        public bool CheckZip(string filename)
+        {
+            return ZipFile.CheckZip(filename);
+        }
+
+        /// <summary>
+        ///  A COM-friendly wrapper for the static method <see cref="ZipFile.CheckZipPassword(string,string)"/>.
+        /// </summary>
+        ///
+        /// <param name="filename">The filename to of the zip file to check.</param>
+        ///
+        /// <param name="password">The password to check.</param>
+        ///
+        /// <returns>true if the named zip file checks OK. Otherwise, false. </returns>
+        public bool CheckZipPassword(string filename, string password)
+        {
+            return ZipFile.CheckZipPassword(filename, password);
+        }
+
+        /// <summary>
+        ///  A wrapper for <see cref="ZipFile.FixZipDirectory(string)">ZipFile.FixZipDirectory(string)</see>
+        /// </summary>
+        /// <param name="filename">The filename to of the zip file to fix.</param>
+        public void FixZipDirectory(string filename)
+        {
+            ZipFile.FixZipDirectory(filename);
+        }
+#endif
+
+        /// <summary>
+        ///  A wrapper for <see cref="ZipFile.LibraryVersion">ZipFile.LibraryVersion</see>
+        /// </summary>
+        /// <returns>
+        ///  the version number on the DotNetZip assembly, formatted as a string.
+        /// </returns>
+        public string GetZipLibraryVersion()
+        {
+            return ZipFile.LibraryVersion.ToString();
+        }
+
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/EncryptionAlgorithm.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/EncryptionAlgorithm.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/EncryptionAlgorithm.cs	(revision 12707)
@@ -0,0 +1,135 @@
+// EncryptionAlgorithm.cs
+// ------------------------------------------------------------------
+//
+// Copyright (c)  2009 Dino Chiesa
+// All rights reserved.
+//
+// This code module is part of DotNetZip, a zipfile class library.
+//
+// ------------------------------------------------------------------
+//
+// This code is licensed under the Microsoft Public License. 
+// See the file License.txt for the license details.
+// More info on: http://dotnetzip.codeplex.com
+//
+// ------------------------------------------------------------------
+//
+// last saved (in emacs): 
+// Time-stamp: <2009-October-21 17:24:45>
+//
+// ------------------------------------------------------------------
+//
+// This module defines the EncryptionAgorithm enum
+//
+// 
+// ------------------------------------------------------------------
+
+
+namespace OfficeOpenXml.Packaging.Ionic.Zip
+{
+    /// <summary>
+    /// An enum that provides the various encryption algorithms supported by this
+    /// library.
+    /// </summary>
+    ///
+    /// <remarks>
+    ///
+    /// <para>
+    ///   <c>PkzipWeak</c> implies the use of Zip 2.0 encryption, which is known to be
+    ///   weak and subvertible.
+    /// </para>
+    ///
+    /// <para>
+    ///   A note on interoperability: Values of <c>PkzipWeak</c> and <c>None</c> are
+    ///   specified in <see
+    ///   href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT">PKWARE's zip
+    ///   specification</see>, and are considered to be "standard".  Zip archives
+    ///   produced using these options will be interoperable with many other zip tools
+    ///   and libraries, including Windows Explorer.
+    /// </para>
+    ///
+    /// <para>
+    ///   Values of <c>WinZipAes128</c> and <c>WinZipAes256</c> are not part of the Zip
+    ///   specification, but rather imply the use of a vendor-specific extension from
+    ///   WinZip. If you want to produce interoperable Zip archives, do not use these
+    ///   values.  For example, if you produce a zip archive using WinZipAes256, you
+    ///   will be able to open it in Windows Explorer on Windows XP and Vista, but you
+    ///   will not be able to extract entries; trying this will lead to an "unspecified
+    ///   error". For this reason, some people have said that a zip archive that uses
+    ///   WinZip's AES encryption is not actually a zip archive at all.  A zip archive
+    ///   produced this way will be readable with the WinZip tool (Version 11 and
+    ///   beyond).
+    /// </para>
+    ///
+    /// <para>
+    ///   There are other third-party tools and libraries, both commercial and
+    ///   otherwise, that support WinZip's AES encryption. These will be able to read
+    ///   AES-encrypted zip archives produced by DotNetZip, and conversely applications
+    ///   that use DotNetZip to read zip archives will be able to read AES-encrypted
+    ///   archives produced by those tools or libraries.  Consult the documentation for
+    ///   those other tools and libraries to find out if WinZip's AES encryption is
+    ///   supported.
+    /// </para>
+    ///
+    /// <para>
+    ///   In case you care: According to <see
+    ///   href="http://www.winzip.com/aes_info.htm">the WinZip specification</see>, the
+    ///   actual AES key used is derived from the <see cref="ZipEntry.Password"/> via an
+    ///   algorithm that complies with <see
+    ///   href="http://www.ietf.org/rfc/rfc2898.txt">RFC 2898</see>, using an iteration
+    ///   count of 1000.  The algorithm is sometimes referred to as PBKDF2, which stands
+    ///   for "Password Based Key Derivation Function #2".
+    /// </para>
+    ///
+    /// <para>
+    ///   A word about password strength and length: The AES encryption technology is
+    ///   very good, but any system is only as secure as the weakest link.  If you want
+    ///   to secure your data, be sure to use a password that is hard to guess.  To make
+    ///   it harder to guess (increase its "entropy"), you should make it longer.  If
+    ///   you use normal characters from an ASCII keyboard, a password of length 20 will
+    ///   be strong enough that it will be impossible to guess.  For more information on
+    ///   that, I'd encourage you to read <see
+    ///   href="http://www.redkestrel.co.uk/Articles/RandomPasswordStrength.html">this
+    ///   article.</see>
+    /// </para>
+    ///
+    /// <para>
+    ///   The WinZip AES algorithms are not supported with the version of DotNetZip that
+    ///   runs on the .NET Compact Framework.  This is because .NET CF lacks the
+    ///   HMACSHA1 class that is required for producing the archive.
+    /// </para>
+    /// </remarks>
+    internal enum EncryptionAlgorithm
+    {
+        /// <summary>
+        /// No encryption at all.
+        /// </summary>
+        None = 0,
+
+        /// <summary>
+        /// Traditional or Classic pkzip encryption.
+        /// </summary>
+        PkzipWeak,
+
+#if AESCRYPTO
+        /// <summary>
+        /// WinZip AES encryption (128 key bits).
+        /// </summary>
+        WinZipAes128,
+
+        /// <summary>
+        /// WinZip AES encryption (256 key bits).
+        /// </summary>
+        WinZipAes256,
+#endif
+
+        /// <summary>
+        /// An encryption algorithm that is not supported by DotNetZip.
+        /// </summary>
+        Unsupported = 4,
+
+
+        // others... not implemented (yet?)
+    }
+
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/Events.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/Events.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/Events.cs	(revision 12707)
@@ -0,0 +1,684 @@
+// Events.cs
+// ------------------------------------------------------------------
+//
+// Copyright (c) 2006, 2007, 2008, 2009 Dino Chiesa and Microsoft Corporation.
+// All rights reserved.
+//
+// This code module is part of DotNetZip, a zipfile class library.
+//
+// ------------------------------------------------------------------
+//
+// This code is licensed under the Microsoft Public License.
+// See the file License.txt for the license details.
+// More info on: http://dotnetzip.codeplex.com
+//
+// ------------------------------------------------------------------
+//
+// last saved (in emacs):
+// Time-stamp: <2011-August-06 12:26:24>
+//
+// ------------------------------------------------------------------
+//
+// This module defines events used by the ZipFile class.
+//
+//
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace OfficeOpenXml.Packaging.Ionic.Zip
+{
+    /// <summary>
+    ///   Delegate in which the application writes the <c>ZipEntry</c> content for the named entry.
+    /// </summary>
+    ///
+    /// <param name="entryName">The name of the entry that must be written.</param>
+    /// <param name="stream">The stream to which the entry data should be written.</param>
+    ///
+    /// <remarks>
+    ///   When you add an entry and specify a <c>WriteDelegate</c>, via <see
+    ///   cref="Ionic.Zip.ZipFile.AddEntry(string, WriteDelegate)"/>, the application
+    ///   code provides the logic that writes the entry data directly into the zip file.
+    /// </remarks>
+    ///
+    /// <example>
+    ///
+    /// This example shows how to define a WriteDelegate that obtains a DataSet, and then
+    /// writes the XML for the DataSet into the zip archive.  There's no need to
+    /// save the XML to a disk file first.
+    ///
+    /// <code lang="C#">
+    /// private void WriteEntry (String filename, Stream output)
+    /// {
+    ///     DataSet ds1 = ObtainDataSet();
+    ///     ds1.WriteXml(output);
+    /// }
+    ///
+    /// private void Run()
+    /// {
+    ///     using (var zip = new ZipFile())
+    ///     {
+    ///         zip.AddEntry(zipEntryName, WriteEntry);
+    ///         zip.Save(zipFileName);
+    ///     }
+    /// }
+    /// </code>
+    ///
+    /// <code lang="vb">
+    /// Private Sub WriteEntry (ByVal filename As String, ByVal output As Stream)
+    ///     DataSet ds1 = ObtainDataSet()
+    ///     ds1.WriteXml(stream)
+    /// End Sub
+    ///
+    /// Public Sub Run()
+    ///     Using zip = New ZipFile
+    ///         zip.AddEntry(zipEntryName, New WriteDelegate(AddressOf WriteEntry))
+    ///         zip.Save(zipFileName)
+    ///     End Using
+    /// End Sub
+    /// </code>
+    /// </example>
+    /// <seealso cref="Ionic.Zip.ZipFile.AddEntry(string, WriteDelegate)"/>
+    public delegate void WriteDelegate(string entryName, System.IO.Stream stream);
+
+
+    /// <summary>
+    ///   Delegate in which the application opens the stream, just-in-time, for the named entry.
+    /// </summary>
+    ///
+    /// <param name="entryName">
+    /// The name of the ZipEntry that the application should open the stream for.
+    /// </param>
+    ///
+    /// <remarks>
+    ///   When you add an entry via <see cref="Ionic.Zip.ZipFile.AddEntry(string,
+    ///   OpenDelegate, CloseDelegate)"/>, the application code provides the logic that
+    ///   opens and closes the stream for the given ZipEntry.
+    /// </remarks>
+    ///
+    /// <seealso cref="Ionic.Zip.ZipFile.AddEntry(string, OpenDelegate, CloseDelegate)"/>
+    public delegate System.IO.Stream OpenDelegate(string entryName);
+
+    /// <summary>
+    ///   Delegate in which the application closes the stream, just-in-time, for the named entry.
+    /// </summary>
+    ///
+    /// <param name="entryName">
+    /// The name of the ZipEntry that the application should close the stream for.
+    /// </param>
+    ///
+    /// <param name="stream">The stream to be closed.</param>
+    ///
+    /// <remarks>
+    ///   When you add an entry via <see cref="Ionic.Zip.ZipFile.AddEntry(string,
+    ///   OpenDelegate, CloseDelegate)"/>, the application code provides the logic that
+    ///   opens and closes the stream for the given ZipEntry.
+    /// </remarks>
+    ///
+    /// <seealso cref="Ionic.Zip.ZipFile.AddEntry(string, OpenDelegate, CloseDelegate)"/>
+    public delegate void CloseDelegate(string entryName, System.IO.Stream stream);
+
+    /// <summary>
+    ///   Delegate for the callback by which the application tells the
+    ///   library the CompressionLevel to use for a file.
+    /// </summary>
+    ///
+    /// <remarks>
+    /// <para>
+    ///   Using this callback, the application can, for example, specify that
+    ///   previously-compressed files (.mp3, .png, .docx, etc) should use a
+    ///   <c>CompressionLevel</c> of <c>None</c>, or can set the compression level based
+    ///   on any other factor.
+    /// </para>
+    /// </remarks>
+    /// <seealso cref="Ionic.Zip.ZipFile.SetCompression"/>
+    public delegate OfficeOpenXml.Packaging.Ionic.Zlib.CompressionLevel SetCompressionCallback(string localFileName, string fileNameInArchive);
+
+    /// <summary>
+    ///   In an EventArgs type, indicates which sort of progress event is being
+    ///   reported.
+    /// </summary>
+    /// <remarks>
+    ///   There are events for reading, events for saving, and events for
+    ///   extracting. This enumeration allows a single EventArgs type to be sued to
+    ///   describe one of multiple subevents. For example, a SaveProgress event is
+    ///   invoked before, after, and during the saving of a single entry.  The value
+    ///   of an enum with this type, specifies which event is being triggered.  The
+    ///   same applies to Extraction, Reading and Adding events.
+    /// </remarks>
+    internal enum ZipProgressEventType
+    {
+        /// <summary>
+        /// Indicates that a Add() operation has started.
+        /// </summary>
+        Adding_Started,
+
+        /// <summary>
+        /// Indicates that an individual entry in the archive has been added.
+        /// </summary>
+        Adding_AfterAddEntry,
+
+        /// <summary>
+        /// Indicates that a Add() operation has completed.
+        /// </summary>
+        Adding_Completed,
+
+        /// <summary>
+        /// Indicates that a Read() operation has started.
+        /// </summary>
+        Reading_Started,
+
+        /// <summary>
+        /// Indicates that an individual entry in the archive is about to be read.
+        /// </summary>
+        Reading_BeforeReadEntry,
+
+        /// <summary>
+        /// Indicates that an individual entry in the archive has just been read.
+        /// </summary>
+        Reading_AfterReadEntry,
+
+        /// <summary>
+        /// Indicates that a Read() operation has completed.
+        /// </summary>
+        Reading_Completed,
+
+        /// <summary>
+        /// The given event reports the number of bytes read so far
+        /// during a Read() operation.
+        /// </summary>
+        Reading_ArchiveBytesRead,
+
+        /// <summary>
+        /// Indicates that a Save() operation has started.
+        /// </summary>
+        Saving_Started,
+
+        /// <summary>
+        /// Indicates that an individual entry in the archive is about to be written.
+        /// </summary>
+        Saving_BeforeWriteEntry,
+
+        /// <summary>
+        /// Indicates that an individual entry in the archive has just been saved.
+        /// </summary>
+        Saving_AfterWriteEntry,
+
+        /// <summary>
+        /// Indicates that a Save() operation has completed.
+        /// </summary>
+        Saving_Completed,
+
+        /// <summary>
+        /// Indicates that the zip archive has been created in a
+        /// temporary location during a Save() operation.
+        /// </summary>
+        Saving_AfterSaveTempArchive,
+
+        /// <summary>
+        /// Indicates that the temporary file is about to be renamed to the final archive
+        /// name during a Save() operation.
+        /// </summary>
+        Saving_BeforeRenameTempArchive,
+
+        /// <summary>
+        /// Indicates that the temporary file is has just been renamed to the final archive
+        /// name during a Save() operation.
+        /// </summary>
+        Saving_AfterRenameTempArchive,
+
+        /// <summary>
+        /// Indicates that the self-extracting archive has been compiled
+        /// during a Save() operation.
+        /// </summary>
+        Saving_AfterCompileSelfExtractor,
+
+        /// <summary>
+        /// The given event is reporting the number of source bytes that have run through the compressor so far
+        /// during a Save() operation.
+        /// </summary>
+        Saving_EntryBytesRead,
+
+        /// <summary>
+        /// Indicates that an entry is about to be extracted.
+        /// </summary>
+        Extracting_BeforeExtractEntry,
+
+        /// <summary>
+        /// Indicates that an entry has just been extracted.
+        /// </summary>
+        Extracting_AfterExtractEntry,
+
+        /// <summary>
+        ///   Indicates that extraction of an entry would overwrite an existing
+        ///   filesystem file. You must use
+        ///   <see cref="ExtractExistingFileAction.InvokeExtractProgressEvent">
+        ///   ExtractExistingFileAction.InvokeExtractProgressEvent</see> in the call
+        ///   to <c>ZipEntry.Extract()</c> in order to receive this event.
+        /// </summary>
+        Extracting_ExtractEntryWouldOverwrite,
+
+        /// <summary>
+        ///   The given event is reporting the number of bytes written so far for
+        ///   the current entry during an Extract() operation.
+        /// </summary>
+        Extracting_EntryBytesWritten,
+
+        /// <summary>
+        /// Indicates that an ExtractAll operation is about to begin.
+        /// </summary>
+        Extracting_BeforeExtractAll,
+
+        /// <summary>
+        /// Indicates that an ExtractAll operation has completed.
+        /// </summary>
+        Extracting_AfterExtractAll,
+
+        /// <summary>
+        /// Indicates that an error has occurred while saving a zip file.
+        /// This generally means the file cannot be opened, because it has been
+        /// removed, or because it is locked by another process.  It can also
+        /// mean that the file cannot be Read, because of a range lock conflict.
+        /// </summary>
+        Error_Saving,
+    }
+
+
+    /// <summary>
+    /// Provides information about the progress of a save, read, or extract operation.
+    /// This is a base class; you will probably use one of the classes derived from this one.
+    /// </summary>
+    internal class ZipProgressEventArgs : EventArgs
+    {
+        private int _entriesTotal;
+        private bool _cancel;
+        private ZipEntry _latestEntry;
+        private ZipProgressEventType _flavor;
+        private String _archiveName;
+        private Int64 _bytesTransferred;
+        private Int64 _totalBytesToTransfer;
+
+
+        internal ZipProgressEventArgs() { }
+
+        internal ZipProgressEventArgs(string archiveName, ZipProgressEventType flavor)
+        {
+            this._archiveName = archiveName;
+            this._flavor = flavor;
+        }
+
+        /// <summary>
+        /// The total number of entries to be saved or extracted.
+        /// </summary>
+        public int EntriesTotal
+        {
+            get { return _entriesTotal; }
+            set { _entriesTotal = value; }
+        }
+
+        /// <summary>
+        /// The name of the last entry saved or extracted.
+        /// </summary>
+        public ZipEntry CurrentEntry
+        {
+            get { return _latestEntry; }
+            set { _latestEntry = value; }
+        }
+
+        /// <summary>
+        /// In an event handler, set this to cancel the save or extract
+        /// operation that is in progress.
+        /// </summary>
+        public bool Cancel
+        {
+            get { return _cancel; }
+            set { _cancel = _cancel || value; }
+        }
+
+        /// <summary>
+        /// The type of event being reported.
+        /// </summary>
+        public ZipProgressEventType EventType
+        {
+            get { return _flavor; }
+            set { _flavor = value; }
+        }
+
+        /// <summary>
+        /// Returns the archive name associated to this event.
+        /// </summary>
+        public String ArchiveName
+        {
+            get { return _archiveName; }
+            set { _archiveName = value; }
+        }
+
+
+        /// <summary>
+        /// The number of bytes read or written so far for this entry.
+        /// </summary>
+        public Int64 BytesTransferred
+        {
+            get { return _bytesTransferred; }
+            set { _bytesTransferred = value; }
+        }
+
+
+
+        /// <summary>
+        /// Total number of bytes that will be read or written for this entry.
+        /// This number will be -1 if the value cannot be determined.
+        /// </summary>
+        public Int64 TotalBytesToTransfer
+        {
+            get { return _totalBytesToTransfer; }
+            set { _totalBytesToTransfer = value; }
+        }
+    }
+
+
+
+    /// <summary>
+    /// Provides information about the progress of a Read operation.
+    /// </summary>
+    internal class ReadProgressEventArgs : ZipProgressEventArgs
+    {
+
+        internal ReadProgressEventArgs() { }
+
+        private ReadProgressEventArgs(string archiveName, ZipProgressEventType flavor)
+            : base(archiveName, flavor)
+        { }
+
+        internal static ReadProgressEventArgs Before(string archiveName, int entriesTotal)
+        {
+            var x = new ReadProgressEventArgs(archiveName, ZipProgressEventType.Reading_BeforeReadEntry);
+            x.EntriesTotal = entriesTotal;
+            return x;
+        }
+
+        internal static ReadProgressEventArgs After(string archiveName, ZipEntry entry, int entriesTotal)
+        {
+            var x = new ReadProgressEventArgs(archiveName, ZipProgressEventType.Reading_AfterReadEntry);
+            x.EntriesTotal = entriesTotal;
+            x.CurrentEntry = entry;
+            return x;
+        }
+
+        internal static ReadProgressEventArgs Started(string archiveName)
+        {
+            var x = new ReadProgressEventArgs(archiveName, ZipProgressEventType.Reading_Started);
+            return x;
+        }
+
+        internal static ReadProgressEventArgs ByteUpdate(string archiveName, ZipEntry entry, Int64 bytesXferred, Int64 totalBytes)
+        {
+            var x = new ReadProgressEventArgs(archiveName, ZipProgressEventType.Reading_ArchiveBytesRead);
+            x.CurrentEntry = entry;
+            x.BytesTransferred = bytesXferred;
+            x.TotalBytesToTransfer = totalBytes;
+            return x;
+        }
+
+        internal static ReadProgressEventArgs Completed(string archiveName)
+        {
+            var x = new ReadProgressEventArgs(archiveName, ZipProgressEventType.Reading_Completed);
+            return x;
+        }
+
+    }
+
+
+    /// <summary>
+    /// Provides information about the progress of a Add operation.
+    /// </summary>
+    internal class AddProgressEventArgs : ZipProgressEventArgs
+    {
+        internal AddProgressEventArgs() { }
+
+        private AddProgressEventArgs(string archiveName, ZipProgressEventType flavor)
+            : base(archiveName, flavor)
+        { }
+
+        internal static AddProgressEventArgs AfterEntry(string archiveName, ZipEntry entry, int entriesTotal)
+        {
+            var x = new AddProgressEventArgs(archiveName, ZipProgressEventType.Adding_AfterAddEntry);
+            x.EntriesTotal = entriesTotal;
+            x.CurrentEntry = entry;
+            return x;
+        }
+
+        internal static AddProgressEventArgs Started(string archiveName)
+        {
+            var x = new AddProgressEventArgs(archiveName, ZipProgressEventType.Adding_Started);
+            return x;
+        }
+
+        internal static AddProgressEventArgs Completed(string archiveName)
+        {
+            var x = new AddProgressEventArgs(archiveName, ZipProgressEventType.Adding_Completed);
+            return x;
+        }
+
+    }
+
+    /// <summary>
+    /// Provides information about the progress of a save operation.
+    /// </summary>
+    internal class SaveProgressEventArgs : ZipProgressEventArgs
+    {
+        private int _entriesSaved;
+
+        /// <summary>
+        /// Constructor for the SaveProgressEventArgs.
+        /// </summary>
+        /// <param name="archiveName">the name of the zip archive.</param>
+        /// <param name="before">whether this is before saving the entry, or after</param>
+        /// <param name="entriesTotal">The total number of entries in the zip archive.</param>
+        /// <param name="entriesSaved">Number of entries that have been saved.</param>
+        /// <param name="entry">The entry involved in the event.</param>
+        internal SaveProgressEventArgs(string archiveName, bool before, int entriesTotal, int entriesSaved, ZipEntry entry)
+            : base(archiveName, (before) ? ZipProgressEventType.Saving_BeforeWriteEntry : ZipProgressEventType.Saving_AfterWriteEntry)
+        {
+            this.EntriesTotal = entriesTotal;
+            this.CurrentEntry = entry;
+            this._entriesSaved = entriesSaved;
+        }
+
+        internal SaveProgressEventArgs() { }
+
+        internal SaveProgressEventArgs(string archiveName, ZipProgressEventType flavor)
+            : base(archiveName, flavor)
+        { }
+
+
+        internal static SaveProgressEventArgs ByteUpdate(string archiveName, ZipEntry entry, Int64 bytesXferred, Int64 totalBytes)
+        {
+            var x = new SaveProgressEventArgs(archiveName, ZipProgressEventType.Saving_EntryBytesRead);
+            x.ArchiveName = archiveName;
+            x.CurrentEntry = entry;
+            x.BytesTransferred = bytesXferred;
+            x.TotalBytesToTransfer = totalBytes;
+            return x;
+        }
+
+        internal static SaveProgressEventArgs Started(string archiveName)
+        {
+            var x = new SaveProgressEventArgs(archiveName, ZipProgressEventType.Saving_Started);
+            return x;
+        }
+
+        internal static SaveProgressEventArgs Completed(string archiveName)
+        {
+            var x = new SaveProgressEventArgs(archiveName, ZipProgressEventType.Saving_Completed);
+            return x;
+        }
+
+        /// <summary>
+        /// Number of entries saved so far.
+        /// </summary>
+        public int EntriesSaved
+        {
+            get { return _entriesSaved; }
+        }
+    }
+
+
+    /// <summary>
+    /// Provides information about the progress of the extract operation.
+    /// </summary>
+    internal class ExtractProgressEventArgs : ZipProgressEventArgs
+    {
+        private int _entriesExtracted;
+        private string _target;
+
+        /// <summary>
+        /// Constructor for the ExtractProgressEventArgs.
+        /// </summary>
+        /// <param name="archiveName">the name of the zip archive.</param>
+        /// <param name="before">whether this is before saving the entry, or after</param>
+        /// <param name="entriesTotal">The total number of entries in the zip archive.</param>
+        /// <param name="entriesExtracted">Number of entries that have been extracted.</param>
+        /// <param name="entry">The entry involved in the event.</param>
+        /// <param name="extractLocation">The location to which entries are extracted.</param>
+        internal ExtractProgressEventArgs(string archiveName, bool before, int entriesTotal, int entriesExtracted, ZipEntry entry, string extractLocation)
+            : base(archiveName, (before) ? ZipProgressEventType.Extracting_BeforeExtractEntry : ZipProgressEventType.Extracting_AfterExtractEntry)
+        {
+            this.EntriesTotal = entriesTotal;
+            this.CurrentEntry = entry;
+            this._entriesExtracted = entriesExtracted;
+            this._target = extractLocation;
+        }
+
+        internal ExtractProgressEventArgs(string archiveName, ZipProgressEventType flavor)
+            : base(archiveName, flavor)
+        { }
+
+        internal ExtractProgressEventArgs()
+        { }
+
+
+        internal static ExtractProgressEventArgs BeforeExtractEntry(string archiveName, ZipEntry entry, string extractLocation)
+        {
+            var x = new ExtractProgressEventArgs
+                {
+                    ArchiveName = archiveName,
+                    EventType = ZipProgressEventType.Extracting_BeforeExtractEntry,
+                    CurrentEntry = entry,
+                    _target = extractLocation,
+                };
+            return x;
+        }
+
+        internal static ExtractProgressEventArgs ExtractExisting(string archiveName, ZipEntry entry, string extractLocation)
+        {
+            var x = new ExtractProgressEventArgs
+                {
+                    ArchiveName = archiveName,
+                    EventType = ZipProgressEventType.Extracting_ExtractEntryWouldOverwrite,
+                    CurrentEntry = entry,
+                    _target = extractLocation,
+                };
+            return x;
+        }
+
+        internal static ExtractProgressEventArgs AfterExtractEntry(string archiveName, ZipEntry entry, string extractLocation)
+        {
+            var x = new ExtractProgressEventArgs
+                {
+                    ArchiveName = archiveName,
+                    EventType = ZipProgressEventType.Extracting_AfterExtractEntry,
+                    CurrentEntry = entry,
+                    _target = extractLocation,
+                };
+            return x;
+        }
+
+        internal static ExtractProgressEventArgs ExtractAllStarted(string archiveName, string extractLocation)
+        {
+            var x = new ExtractProgressEventArgs(archiveName, ZipProgressEventType.Extracting_BeforeExtractAll);
+            x._target = extractLocation;
+            return x;
+        }
+
+        internal static ExtractProgressEventArgs ExtractAllCompleted(string archiveName, string extractLocation)
+        {
+            var x = new ExtractProgressEventArgs(archiveName, ZipProgressEventType.Extracting_AfterExtractAll);
+            x._target = extractLocation;
+            return x;
+        }
+
+
+        internal static ExtractProgressEventArgs ByteUpdate(string archiveName, ZipEntry entry, Int64 bytesWritten, Int64 totalBytes)
+        {
+            var x = new ExtractProgressEventArgs(archiveName, ZipProgressEventType.Extracting_EntryBytesWritten);
+            x.ArchiveName = archiveName;
+            x.CurrentEntry = entry;
+            x.BytesTransferred = bytesWritten;
+            x.TotalBytesToTransfer = totalBytes;
+            return x;
+        }
+
+
+
+        /// <summary>
+        /// Number of entries extracted so far.  This is set only if the
+        /// EventType is Extracting_BeforeExtractEntry or Extracting_AfterExtractEntry, and
+        /// the Extract() is occurring witin the scope of a call to ExtractAll().
+        /// </summary>
+        public int EntriesExtracted
+        {
+            get { return _entriesExtracted; }
+        }
+
+        /// <summary>
+        /// Returns the extraction target location, a filesystem path.
+        /// </summary>
+        public String ExtractLocation
+        {
+            get { return _target; }
+        }
+
+    }
+
+
+
+    /// <summary>
+    /// Provides information about the an error that occurred while zipping.
+    /// </summary>
+    internal class ZipErrorEventArgs : ZipProgressEventArgs
+    {
+        private Exception _exc;
+        private ZipErrorEventArgs() { }
+        internal static ZipErrorEventArgs Saving(string archiveName, ZipEntry entry, Exception exception)
+        {
+            var x = new ZipErrorEventArgs
+                {
+                    EventType = ZipProgressEventType.Error_Saving,
+                    ArchiveName = archiveName,
+                    CurrentEntry = entry,
+                    _exc = exception
+                };
+            return x;
+        }
+
+        /// <summary>
+        /// Returns the exception that occurred, if any.
+        /// </summary>
+        public Exception @Exception
+        {
+            get { return _exc; }
+        }
+
+        /// <summary>
+        /// Returns the name of the file that caused the exception, if any.
+        /// </summary>
+        public String FileName
+        {
+            get { return CurrentEntry.LocalFileName; }
+        }
+    }
+
+
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/Exceptions.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/Exceptions.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/Exceptions.cs	(revision 12707)
@@ -0,0 +1,300 @@
+// Exceptions.cs
+// ------------------------------------------------------------------
+//
+// Copyright (c) 2008, 2009 Dino Chiesa and Microsoft Corporation.
+// All rights reserved.
+//
+// This code module is part of DotNetZip, a zipfile class library.
+//
+// ------------------------------------------------------------------
+//
+// This code is licensed under the Microsoft Public License.
+// See the file License.txt for the license details.
+// More info on: http://dotnetzip.codeplex.com
+//
+// ------------------------------------------------------------------
+//
+// last saved (in emacs):
+// Time-stamp: <2011-July-12 12:19:10>
+//
+// ------------------------------------------------------------------
+//
+// This module defines exceptions used in the class library.
+//
+
+
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+#if !NETCF
+using System.Runtime.Serialization;
+#endif
+
+namespace OfficeOpenXml.Packaging.Ionic.Zip
+{
+    ///// <summary>
+    ///// Base exception type for all custom exceptions in the Zip library. It acts as a marker class.
+    ///// </summary>
+    //[AttributeUsage(AttributeTargets.Class)]
+    //public class ZipExceptionAttribute : Attribute { }
+
+
+
+    /// <summary>
+    /// Issued when an <c>ZipEntry.ExtractWithPassword()</c> method is invoked
+    /// with an incorrect password.
+    /// </summary>
+#if !SILVERLIGHT
+    [Serializable]
+#endif
+    [System.Runtime.InteropServices.GuidAttribute("ebc25cf6-9120-4283-b972-0e5520d0000B")]
+    public class BadPasswordException : ZipException
+    {
+        /// <summary>
+        /// Default ctor.
+        /// </summary>
+        public BadPasswordException() { }
+
+        /// <summary>
+        /// Come on, you know how exceptions work. Why are you looking at this documentation?
+        /// </summary>
+        /// <param name="message">The message in the exception.</param>
+        public BadPasswordException(String message)
+            : base(message)
+        { }
+
+        /// <summary>
+        /// Come on, you know how exceptions work. Why are you looking at this documentation?
+        /// </summary>
+        /// <param name="message">The message in the exception.</param>
+        /// <param name="innerException">The innerException for this exception.</param>
+        public BadPasswordException(String message, Exception innerException)
+            : base(message, innerException)
+        {
+        }
+
+
+#if ! (NETCF || SILVERLIGHT)
+        /// <summary>
+        /// Come on, you know how exceptions work. Why are you looking at this documentation?
+        /// </summary>
+        /// <param name="info">The serialization info for the exception.</param>
+        /// <param name="context">The streaming context from which to deserialize.</param>
+        protected BadPasswordException(SerializationInfo info, StreamingContext context)
+            : base(info, context)
+          {  }
+#endif
+
+    }
+
+    /// <summary>
+    /// Indicates that a read was attempted on a stream, and bad or incomplete data was
+    /// received.
+    /// </summary>
+#if !SILVERLIGHT
+    [Serializable]
+#endif
+    [System.Runtime.InteropServices.GuidAttribute("ebc25cf6-9120-4283-b972-0e5520d0000A")]
+    public class BadReadException : ZipException
+    {
+        /// <summary>
+        /// Default ctor.
+        /// </summary>
+        public BadReadException() { }
+
+        /// <summary>
+        /// Come on, you know how exceptions work. Why are you looking at this documentation?
+        /// </summary>
+        /// <param name="message">The message in the exception.</param>
+        public BadReadException(String message)
+            : base(message)
+        { }
+
+        /// <summary>
+        /// Come on, you know how exceptions work. Why are you looking at this documentation?
+        /// </summary>
+        /// <param name="message">The message in the exception.</param>
+        /// <param name="innerException">The innerException for this exception.</param>
+        public BadReadException(String message, Exception innerException)
+            : base(message, innerException)
+        {
+        }
+
+#if ! (NETCF || SILVERLIGHT)
+        /// <summary>
+        /// Come on, you know how exceptions work. Why are you looking at this documentation?
+        /// </summary>
+        /// <param name="info">The serialization info for the exception.</param>
+        /// <param name="context">The streaming context from which to deserialize.</param>
+        protected BadReadException(SerializationInfo info, StreamingContext context)
+            : base(info, context)
+          {  }
+#endif
+
+    }
+
+
+
+    /// <summary>
+    /// Issued when an CRC check fails upon extracting an entry from a zip archive.
+    /// </summary>
+#if !SILVERLIGHT
+    [Serializable]
+#endif
+    [System.Runtime.InteropServices.GuidAttribute("ebc25cf6-9120-4283-b972-0e5520d00009")]
+    public class BadCrcException : ZipException
+    {
+        /// <summary>
+        /// Default ctor.
+        /// </summary>
+        public BadCrcException() { }
+
+        /// <summary>
+        /// Come on, you know how exceptions work. Why are you looking at this documentation?
+        /// </summary>
+        /// <param name="message">The message in the exception.</param>
+        public BadCrcException(String message)
+            : base(message)
+        { }
+
+
+#if ! (NETCF || SILVERLIGHT)
+        /// <summary>
+        /// Come on, you know how exceptions work. Why are you looking at this documentation?
+        /// </summary>
+        /// <param name="info">The serialization info for the exception.</param>
+        /// <param name="context">The streaming context from which to deserialize.</param>
+        protected BadCrcException(SerializationInfo info, StreamingContext context)
+            : base(info, context)
+          {  }
+#endif
+
+    }
+
+
+    /// <summary>
+    /// Issued when errors occur saving a self-extracting archive.
+    /// </summary>
+#if !SILVERLIGHT
+    [Serializable]
+#endif
+    [System.Runtime.InteropServices.GuidAttribute("ebc25cf6-9120-4283-b972-0e5520d00008")]
+    public class SfxGenerationException : ZipException
+    {
+        /// <summary>
+        /// Default ctor.
+        /// </summary>
+        public SfxGenerationException() { }
+
+        /// <summary>
+        /// Come on, you know how exceptions work. Why are you looking at this documentation?
+        /// </summary>
+        /// <param name="message">The message in the exception.</param>
+        public SfxGenerationException(String message)
+            : base(message)
+        { }
+
+#if ! (NETCF || SILVERLIGHT)
+        /// <summary>
+        /// Come on, you know how exceptions work. Why are you looking at this documentation?
+        /// </summary>
+        /// <param name="info">The serialization info for the exception.</param>
+        /// <param name="context">The streaming context from which to deserialize.</param>
+        protected SfxGenerationException(SerializationInfo info, StreamingContext context)
+            : base(info, context)
+          {  }
+#endif
+
+    }
+
+
+    /// <summary>
+    /// Indicates that an operation was attempted on a ZipFile which was not possible
+    /// given the state of the instance. For example, if you call <c>Save()</c> on a ZipFile
+    /// which has no filename set, you can get this exception.
+    /// </summary>
+#if !SILVERLIGHT
+    [Serializable]
+#endif
+    [System.Runtime.InteropServices.GuidAttribute("ebc25cf6-9120-4283-b972-0e5520d00007")]
+    public class BadStateException : ZipException
+    {
+        /// <summary>
+        /// Default ctor.
+        /// </summary>
+        public BadStateException() { }
+
+        /// <summary>
+        /// Come on, you know how exceptions work. Why are you looking at this documentation?
+        /// </summary>
+        /// <param name="message">The message in the exception.</param>
+        public BadStateException(String message)
+            : base(message)
+        { }
+
+        /// <summary>
+        /// Come on, you know how exceptions work. Why are you looking at this documentation?
+        /// </summary>
+        /// <param name="message">The message in the exception.</param>
+        /// <param name="innerException">The innerException for this exception.</param>
+        public BadStateException(String message, Exception innerException)
+            : base(message, innerException)
+        {}
+
+#if ! (NETCF || SILVERLIGHT)
+        /// <summary>
+        /// Come on, you know how exceptions work. Why are you looking at this documentation?
+        /// </summary>
+        /// <param name="info">The serialization info for the exception.</param>
+        /// <param name="context">The streaming context from which to deserialize.</param>
+        protected BadStateException(SerializationInfo info, StreamingContext context)
+            : base(info, context)
+          {  }
+#endif
+
+    }
+
+    /// <summary>
+    /// Base class for all exceptions defined by and throw by the Zip library.
+    /// </summary>
+#if !SILVERLIGHT
+    [Serializable]
+#endif
+    [System.Runtime.InteropServices.GuidAttribute("ebc25cf6-9120-4283-b972-0e5520d00006")]
+    public class ZipException : Exception
+    {
+        /// <summary>
+        /// Default ctor.
+        /// </summary>
+        public ZipException() { }
+
+        /// <summary>
+        /// Come on, you know how exceptions work. Why are you looking at this documentation?
+        /// </summary>
+        /// <param name="message">The message in the exception.</param>
+        public ZipException(String message) : base(message) { }
+
+        /// <summary>
+        /// Come on, you know how exceptions work. Why are you looking at this documentation?
+        /// </summary>
+        /// <param name="message">The message in the exception.</param>
+        /// <param name="innerException">The innerException for this exception.</param>
+        public ZipException(String message, Exception innerException)
+            : base(message, innerException)
+        { }
+
+#if ! (NETCF || SILVERLIGHT)
+        /// <summary>
+        /// Come on, you know how exceptions work. Why are you looking at this documentation?
+        /// </summary>
+        /// <param name="info">The serialization info for the exception.</param>
+        /// <param name="context">The streaming context from which to deserialize.</param>
+        protected ZipException(SerializationInfo info, StreamingContext context)
+            : base(info, context)
+        { }
+#endif
+
+    }
+
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ExtractExistingFileAction.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ExtractExistingFileAction.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ExtractExistingFileAction.cs	(revision 12707)
@@ -0,0 +1,85 @@
+// ExtractExistingFileAction.cs
+// ------------------------------------------------------------------
+//
+// Copyright (c)  2009 Dino Chiesa
+// All rights reserved.
+//
+// This code module is part of DotNetZip, a zipfile class library.
+//
+// ------------------------------------------------------------------
+//
+// This code is licensed under the Microsoft Public License. 
+// See the file License.txt for the license details.
+// More info on: http://dotnetzip.codeplex.com
+//
+// ------------------------------------------------------------------
+//
+// last saved (in emacs): 
+// Time-stamp: <2009-August-25 08:44:37>
+//
+// ------------------------------------------------------------------
+//
+// This module defines the ExtractExistingFileAction enum
+//
+// 
+// ------------------------------------------------------------------
+
+
+namespace OfficeOpenXml.Packaging.Ionic.Zip
+{
+
+    /// <summary>
+    /// An enum for the options when extracting an entry would overwrite an existing file. 
+    /// </summary>
+    /// 
+    /// <remarks>
+    ///   <para>
+    ///     This enum describes the actions that the library can take when an
+    ///     <c>Extract()</c> or <c>ExtractWithPassword()</c> method is called to extract an
+    ///     entry to a filesystem, and the extraction would overwrite an existing filesystem
+    ///     file.
+    ///   </para>
+    /// </remarks>
+    ///
+    internal enum ExtractExistingFileAction
+    {
+        /// <summary>
+        /// Throw an exception when extraction would overwrite an existing file. (For
+        /// COM clients, this is a 0 (zero).)
+        /// </summary>
+        Throw,
+
+        /// <summary>
+        /// When extraction would overwrite an existing file, overwrite the file silently.
+        /// The overwrite will happen even if the target file is marked as read-only.
+        /// (For COM clients, this is a 1.)
+        /// </summary>
+        OverwriteSilently,
+
+        /// <summary>
+        /// When extraction would overwrite an existing file, don't overwrite the file, silently. 
+        /// (For COM clients, this is a 2.)
+        /// </summary>
+        DoNotOverwrite,
+
+        /// <summary>
+        /// When extraction would overwrite an existing file, invoke the ExtractProgress
+        /// event, using an event type of <see
+        /// cref="ZipProgressEventType.Extracting_ExtractEntryWouldOverwrite"/>.  In
+        /// this way, the application can decide, just-in-time, whether to overwrite the
+        /// file. For example, a GUI application may wish to pop up a dialog to allow
+        /// the user to choose. You may want to examine the <see
+        /// cref="ExtractProgressEventArgs.ExtractLocation"/> property before making
+        /// the decision. If, after your processing in the Extract progress event, you
+        /// want to NOT extract the file, set <see cref="ZipEntry.ExtractExistingFile"/>
+        /// on the <c>ZipProgressEventArgs.CurrentEntry</c> to <c>DoNotOverwrite</c>.
+        /// If you do want to extract the file, set <c>ZipEntry.ExtractExistingFile</c>
+        /// to <c>OverwriteSilently</c>.  If you want to cancel the Extraction, set
+        /// <c>ZipProgressEventArgs.Cancel</c> to true.  Cancelling differs from using
+        /// DoNotOverwrite in that a cancel will not extract any further entries, if
+        /// there are any.  (For COM clients, the value of this enum is a 3.)
+        /// </summary>
+        InvokeExtractProgressEvent,
+    }
+
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/FileSelector.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/FileSelector.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/FileSelector.cs	(revision 12707)
@@ -0,0 +1,1609 @@
+//#define SelectorTrace
+
+// FileSelector.cs
+// ------------------------------------------------------------------
+//
+// Copyright (c) 2008-2011 Dino Chiesa.
+// All rights reserved.
+//
+// This code module is part of DotNetZip, a zipfile class library.
+//
+// ------------------------------------------------------------------
+//
+// This code is licensed under the Microsoft Public License.
+// See the file License.txt for the license details.
+// More info on: http://dotnetzip.codeplex.com
+//
+// ------------------------------------------------------------------
+//
+// last saved: <2011-August-05 11:03:11>
+//
+// ------------------------------------------------------------------
+//
+// This module implements a "file selector" that finds files based on a
+// set of inclusion criteria, including filename, size, file time, and
+// potentially file attributes.  The criteria are given in a string with
+// a simple expression language. Examples:
+//
+// find all .txt files:
+//     name = *.txt
+//
+// shorthand for the above
+//     *.txt
+//
+// all files modified after January 1st, 2009
+//     mtime > 2009-01-01
+//
+// All .txt files modified after the first of the year
+//     name = *.txt  AND  mtime > 2009-01-01
+//
+// All .txt files modified after the first of the year, or any file with the archive bit set
+//     (name = *.txt  AND  mtime > 2009-01-01) or (attribtues = A)
+//
+// All .txt files or any file greater than 1mb in size
+//     (name = *.txt  or  size > 1mb)
+//
+// and so on.
+// ------------------------------------------------------------------
+
+
+using System;
+using System.Globalization;
+using System.IO;
+using System.Text;
+using System.Reflection;
+using System.ComponentModel;
+using System.Text.RegularExpressions;
+using System.Collections.Generic;
+#if SILVERLIGHT
+using System.Linq;
+#endif
+
+namespace OfficeOpenXml.Packaging.Ionic
+{
+
+    /// <summary>
+    /// Enumerates the options for a logical conjunction. This enum is intended for use
+    /// internally by the FileSelector class.
+    /// </summary>
+    internal enum LogicalConjunction
+    {
+        NONE,
+        AND,
+        OR,
+        XOR,
+    }
+
+    internal enum WhichTime
+    {
+        atime,
+        mtime,
+        ctime,
+    }
+
+
+    internal enum ComparisonOperator
+    {
+        [Description(">")]
+        GreaterThan,
+        [Description(">=")]
+        GreaterThanOrEqualTo,
+        [Description("<")]
+        LesserThan,
+        [Description("<=")]
+        LesserThanOrEqualTo,
+        [Description("=")]
+        EqualTo,
+        [Description("!=")]
+        NotEqualTo
+    }
+
+
+    internal abstract partial class SelectionCriterion
+    {
+        internal virtual bool Verbose
+        {
+            get;set;
+        }
+        internal abstract bool Evaluate(string filename);
+
+        [System.Diagnostics.Conditional("SelectorTrace")]
+        protected static void CriterionTrace(string format, params object[] args)
+        {
+            //System.Console.WriteLine("  " + format, args);
+        }
+    }
+
+
+    internal partial class SizeCriterion : SelectionCriterion
+    {
+        internal ComparisonOperator Operator;
+        internal Int64 Size;
+
+        public override String ToString()
+        {
+            StringBuilder sb = new StringBuilder();
+            sb.Append("size ").Append(EnumUtil.GetDescription(Operator)).Append(" ").Append(Size.ToString());
+            return sb.ToString();
+        }
+
+        internal override bool Evaluate(string filename)
+        {
+            System.IO.FileInfo fi = new System.IO.FileInfo(filename);
+            CriterionTrace("SizeCriterion::Evaluate('{0}' [{1}])",
+                           filename, this.ToString());
+            return _Evaluate(fi.Length);
+        }
+
+        private bool _Evaluate(Int64 Length)
+        {
+            bool result = false;
+            switch (Operator)
+            {
+                case ComparisonOperator.GreaterThanOrEqualTo:
+                    result = Length >= Size;
+                    break;
+                case ComparisonOperator.GreaterThan:
+                    result = Length > Size;
+                    break;
+                case ComparisonOperator.LesserThanOrEqualTo:
+                    result = Length <= Size;
+                    break;
+                case ComparisonOperator.LesserThan:
+                    result = Length < Size;
+                    break;
+                case ComparisonOperator.EqualTo:
+                    result = Length == Size;
+                    break;
+                case ComparisonOperator.NotEqualTo:
+                    result = Length != Size;
+                    break;
+                default:
+                    throw new ArgumentException("Operator");
+            }
+            return result;
+        }
+
+    }
+
+
+
+    internal partial class TimeCriterion : SelectionCriterion
+    {
+        internal ComparisonOperator Operator;
+        internal WhichTime Which;
+        internal DateTime Time;
+
+        public override String ToString()
+        {
+            StringBuilder sb = new StringBuilder();
+            sb.Append(Which.ToString()).Append(" ").Append(EnumUtil.GetDescription(Operator)).Append(" ").Append(Time.ToString("yyyy-MM-dd-HH:mm:ss"));
+            return sb.ToString();
+        }
+
+        internal override bool Evaluate(string filename)
+        {
+            DateTime x;
+            switch (Which)
+            {
+                case WhichTime.atime:
+                    x = System.IO.File.GetLastAccessTime(filename).ToUniversalTime();
+                    break;
+                case WhichTime.mtime:
+                    x = System.IO.File.GetLastWriteTime(filename).ToUniversalTime();
+                    break;
+                case WhichTime.ctime:
+                    x = System.IO.File.GetCreationTime(filename).ToUniversalTime();
+                    break;
+                default:
+                    throw new ArgumentException("Operator");
+            }
+            CriterionTrace("TimeCriterion({0},{1})= {2}", filename, Which.ToString(), x);
+            return _Evaluate(x);
+        }
+
+
+        private bool _Evaluate(DateTime x)
+        {
+            bool result = false;
+            switch (Operator)
+            {
+                case ComparisonOperator.GreaterThanOrEqualTo:
+                    result = (x >= Time);
+                    break;
+                case ComparisonOperator.GreaterThan:
+                    result = (x > Time);
+                    break;
+                case ComparisonOperator.LesserThanOrEqualTo:
+                    result = (x <= Time);
+                    break;
+                case ComparisonOperator.LesserThan:
+                    result = (x < Time);
+                    break;
+                case ComparisonOperator.EqualTo:
+                    result = (x == Time);
+                    break;
+                case ComparisonOperator.NotEqualTo:
+                    result = (x != Time);
+                    break;
+                default:
+                    throw new ArgumentException("Operator");
+            }
+
+            CriterionTrace("TimeCriterion: {0}", result);
+            return result;
+        }
+    }
+
+
+
+    internal partial class NameCriterion : SelectionCriterion
+    {
+        private Regex _re;
+        private String _regexString;
+        internal ComparisonOperator Operator;
+        private string _MatchingFileSpec;
+        internal virtual string MatchingFileSpec
+        {
+            set
+            {
+                // workitem 8245
+                if (Directory.Exists(value))
+                {
+                    _MatchingFileSpec = ".\\" + value + "\\*.*";
+                }
+                else
+                {
+                    _MatchingFileSpec = value;
+                }
+
+                _regexString = "^" +
+                Regex.Escape(_MatchingFileSpec)
+                    .Replace(@"\\\*\.\*", @"\\([^\.]+|.*\.[^\\\.]*)")
+                    .Replace(@"\.\*", @"\.[^\\\.]*")
+                    .Replace(@"\*", @".*")
+                    //.Replace(@"\*", @"[^\\\.]*") // ill-conceived
+                    .Replace(@"\?", @"[^\\\.]")
+                    + "$";
+
+                CriterionTrace("NameCriterion regexString({0})", _regexString);
+
+                _re = new Regex(_regexString, RegexOptions.IgnoreCase);
+            }
+        }
+
+
+        public override String ToString()
+        {
+            StringBuilder sb = new StringBuilder();
+            sb.Append("name ").Append(EnumUtil.GetDescription(Operator))
+                .Append(" '")
+                .Append(_MatchingFileSpec)
+                .Append("'");
+            return sb.ToString();
+        }
+
+
+        internal override bool Evaluate(string filename)
+        {
+            CriterionTrace("NameCriterion::Evaluate('{0}' pattern[{1}])",
+                           filename, _MatchingFileSpec);
+            return _Evaluate(filename);
+        }
+
+        private bool _Evaluate(string fullpath)
+        {
+            CriterionTrace("NameCriterion::Evaluate({0})", fullpath);
+            // No slash in the pattern implicitly means recurse, which means compare to
+            // filename only, not full path.
+            String f = (_MatchingFileSpec.IndexOf('\\') == -1)
+                ? System.IO.Path.GetFileName(fullpath)
+                : fullpath; // compare to fullpath
+
+            bool result = _re.IsMatch(f);
+
+            if (Operator != ComparisonOperator.EqualTo)
+                result = !result;
+            return result;
+        }
+    }
+
+
+    internal partial class TypeCriterion : SelectionCriterion
+    {
+        private char ObjectType;  // 'D' = Directory, 'F' = File
+        internal ComparisonOperator Operator;
+        internal string AttributeString
+        {
+            get
+            {
+                return ObjectType.ToString();
+            }
+            set
+            {
+                if (value.Length != 1 ||
+                    (value[0]!='D' && value[0]!='F'))
+                    throw new ArgumentException("Specify a single character: either D or F");
+                ObjectType = value[0];
+            }
+        }
+
+        public override String ToString()
+        {
+            StringBuilder sb = new StringBuilder();
+            sb.Append("type ").Append(EnumUtil.GetDescription(Operator)).Append(" ").Append(AttributeString);
+            return sb.ToString();
+        }
+
+        internal override bool Evaluate(string filename)
+        {
+            CriterionTrace("TypeCriterion::Evaluate({0})", filename);
+
+            bool result = (ObjectType == 'D')
+                ? Directory.Exists(filename)
+                : File.Exists(filename);
+
+            if (Operator != ComparisonOperator.EqualTo)
+                result = !result;
+            return result;
+        }
+    }
+
+
+#if !SILVERLIGHT
+    internal partial class AttributesCriterion : SelectionCriterion
+    {
+        private FileAttributes _Attributes;
+        internal ComparisonOperator Operator;
+        internal string AttributeString
+        {
+            get
+            {
+                string result = "";
+                if ((_Attributes & FileAttributes.Hidden) != 0)
+                    result += "H";
+                if ((_Attributes & FileAttributes.System) != 0)
+                    result += "S";
+                if ((_Attributes & FileAttributes.ReadOnly) != 0)
+                    result += "R";
+                if ((_Attributes & FileAttributes.Archive) != 0)
+                    result += "A";
+                if ((_Attributes & FileAttributes.ReparsePoint) != 0)
+                    result += "L";
+                if ((_Attributes & FileAttributes.NotContentIndexed) != 0)
+                    result += "I";
+                return result;
+            }
+
+            set
+            {
+                _Attributes = FileAttributes.Normal;
+                foreach (char c in value.ToUpper(CultureInfo.InvariantCulture))
+                {
+                    switch (c)
+                    {
+                        case 'H':
+                            if ((_Attributes & FileAttributes.Hidden) != 0)
+                                throw new ArgumentException(String.Format("Repeated flag. ({0})", c), "value");
+                            _Attributes |= FileAttributes.Hidden;
+                            break;
+
+                        case 'R':
+                            if ((_Attributes & FileAttributes.ReadOnly) != 0)
+                                throw new ArgumentException(String.Format("Repeated flag. ({0})", c), "value");
+                            _Attributes |= FileAttributes.ReadOnly;
+                            break;
+
+                        case 'S':
+                            if ((_Attributes & FileAttributes.System) != 0)
+                                throw new ArgumentException(String.Format("Repeated flag. ({0})", c), "value");
+                            _Attributes |= FileAttributes.System;
+                            break;
+
+                        case 'A':
+                            if ((_Attributes & FileAttributes.Archive) != 0)
+                                throw new ArgumentException(String.Format("Repeated flag. ({0})", c), "value");
+                            _Attributes |= FileAttributes.Archive;
+                            break;
+
+                        case 'I':
+                            if ((_Attributes & FileAttributes.NotContentIndexed) != 0)
+                                throw new ArgumentException(String.Format("Repeated flag. ({0})", c), "value");
+                            _Attributes |= FileAttributes.NotContentIndexed;
+                            break;
+
+                        case 'L':
+                            if ((_Attributes & FileAttributes.ReparsePoint) != 0)
+                                throw new ArgumentException(String.Format("Repeated flag. ({0})", c), "value");
+                            _Attributes |= FileAttributes.ReparsePoint;
+                            break;
+
+                        default:
+                            throw new ArgumentException(value);
+                    }
+                }
+            }
+        }
+
+
+        public override String ToString()
+        {
+            StringBuilder sb = new StringBuilder();
+            sb.Append("attributes ").Append(EnumUtil.GetDescription(Operator)).Append(" ").Append(AttributeString);
+            return sb.ToString();
+        }
+
+        private bool _EvaluateOne(FileAttributes fileAttrs, FileAttributes criterionAttrs)
+        {
+            bool result = false;
+            if ((_Attributes & criterionAttrs) == criterionAttrs)
+                result = ((fileAttrs & criterionAttrs) == criterionAttrs);
+            else
+                result = true;
+            return result;
+        }
+
+
+
+        internal override bool Evaluate(string filename)
+        {
+            // workitem 10191
+            if (Directory.Exists(filename))
+            {
+                // Directories don't have file attributes, so the result
+                // of an evaluation is always NO. This gets negated if
+                // the operator is NotEqualTo.
+                return (Operator != ComparisonOperator.EqualTo);
+            }
+#if NETCF
+            FileAttributes fileAttrs = NetCfFile.GetAttributes(filename);
+#else
+            FileAttributes fileAttrs = System.IO.File.GetAttributes(filename);
+#endif
+
+            return _Evaluate(fileAttrs);
+        }
+
+        private bool _Evaluate(FileAttributes fileAttrs)
+        {
+            bool result = _EvaluateOne(fileAttrs, FileAttributes.Hidden);
+            if (result)
+                result = _EvaluateOne(fileAttrs, FileAttributes.System);
+            if (result)
+                result = _EvaluateOne(fileAttrs, FileAttributes.ReadOnly);
+            if (result)
+                result = _EvaluateOne(fileAttrs, FileAttributes.Archive);
+            if (result)
+                result = _EvaluateOne(fileAttrs, FileAttributes.NotContentIndexed);
+            if (result)
+                result = _EvaluateOne(fileAttrs, FileAttributes.ReparsePoint);
+
+            if (Operator != ComparisonOperator.EqualTo)
+                result = !result;
+
+            return result;
+        }
+    }
+#endif
+
+
+    internal partial class CompoundCriterion : SelectionCriterion
+    {
+        internal LogicalConjunction Conjunction;
+        internal SelectionCriterion Left;
+
+        private SelectionCriterion _Right;
+        internal SelectionCriterion Right
+        {
+            get { return _Right; }
+            set
+            {
+                _Right = value;
+                if (value == null)
+                    Conjunction = LogicalConjunction.NONE;
+                else if (Conjunction == LogicalConjunction.NONE)
+                    Conjunction = LogicalConjunction.AND;
+            }
+        }
+
+
+        internal override bool Evaluate(string filename)
+        {
+            bool result = Left.Evaluate(filename);
+            switch (Conjunction)
+            {
+                case LogicalConjunction.AND:
+                    if (result)
+                        result = Right.Evaluate(filename);
+                    break;
+                case LogicalConjunction.OR:
+                    if (!result)
+                        result = Right.Evaluate(filename);
+                    break;
+                case LogicalConjunction.XOR:
+                    result ^= Right.Evaluate(filename);
+                    break;
+                default:
+                    throw new ArgumentException("Conjunction");
+            }
+            return result;
+        }
+
+
+        public override String ToString()
+        {
+            StringBuilder sb = new StringBuilder();
+            sb.Append("(")
+            .Append((Left != null) ? Left.ToString() : "null")
+            .Append(" ")
+            .Append(Conjunction.ToString())
+            .Append(" ")
+            .Append((Right != null) ? Right.ToString() : "null")
+            .Append(")");
+            return sb.ToString();
+        }
+    }
+
+
+
+    /// <summary>
+    ///   FileSelector encapsulates logic that selects files from a source - a zip file
+    ///   or the filesystem - based on a set of criteria.  This class is used internally
+    ///   by the DotNetZip library, in particular for the AddSelectedFiles() methods.
+    ///   This class can also be used independently of the zip capability in DotNetZip.
+    /// </summary>
+    ///
+    /// <remarks>
+    ///
+    /// <para>
+    ///   The FileSelector class is used internally by the ZipFile class for selecting
+    ///   files for inclusion into the ZipFile, when the <see
+    ///   cref="Ionic.Zip.ZipFile.AddSelectedFiles(String,String)"/> method, or one of
+    ///   its overloads, is called.  It's also used for the <see
+    ///   cref="Ionic.Zip.ZipFile.ExtractSelectedEntries(String)"/> methods.  Typically, an
+    ///   application that creates or manipulates Zip archives will not directly
+    ///   interact with the FileSelector class.
+    /// </para>
+    ///
+    /// <para>
+    ///   Some applications may wish to use the FileSelector class directly, to
+    ///   select files from disk volumes based on a set of criteria, without creating or
+    ///   querying Zip archives.  The file selection criteria include: a pattern to
+    ///   match the filename; the last modified, created, or last accessed time of the
+    ///   file; the size of the file; and the attributes of the file.
+    /// </para>
+    ///
+    /// <para>
+    ///   Consult the documentation for <see cref="SelectionCriteria"/>
+    ///   for more information on specifying the selection criteria.
+    /// </para>
+    ///
+    /// </remarks>
+    internal partial class FileSelector
+    {
+        internal SelectionCriterion _Criterion;
+
+#if NOTUSED
+        /// <summary>
+        ///   The default constructor.
+        /// </summary>
+        /// <remarks>
+        ///   Typically, applications won't use this constructor.  Instead they'll
+        ///   call the constructor that accepts a selectionCriteria string.  If you
+        ///   use this constructor, you'll want to set the SelectionCriteria
+        ///   property on the instance before calling SelectFiles().
+        /// </remarks>
+        protected FileSelector() { }
+#endif
+        /// <summary>
+        ///   Constructor that allows the caller to specify file selection criteria.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   This constructor allows the caller to specify a set of criteria for
+        ///   selection of files.
+        /// </para>
+        ///
+        /// <para>
+        ///   See <see cref="FileSelector.SelectionCriteria"/> for a description of
+        ///   the syntax of the selectionCriteria string.
+        /// </para>
+        ///
+        /// <para>
+        ///   By default the FileSelector will traverse NTFS Reparse Points.  To
+        ///   change this, use <see cref="FileSelector(String,
+        ///   bool)">FileSelector(String, bool)</see>.
+        /// </para>
+        /// </remarks>
+        ///
+        /// <param name="selectionCriteria">The criteria for file selection.</param>
+        public FileSelector(String selectionCriteria)
+        : this(selectionCriteria, true)
+        {
+        }
+
+        /// <summary>
+        ///   Constructor that allows the caller to specify file selection criteria.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   This constructor allows the caller to specify a set of criteria for
+        ///   selection of files.
+        /// </para>
+        ///
+        /// <para>
+        ///   See <see cref="FileSelector.SelectionCriteria"/> for a description of
+        ///   the syntax of the selectionCriteria string.
+        /// </para>
+        /// </remarks>
+        ///
+        /// <param name="selectionCriteria">The criteria for file selection.</param>
+        /// <param name="traverseDirectoryReparsePoints">
+        /// whether to traverse NTFS reparse points (junctions).
+        /// </param>
+        public FileSelector(String selectionCriteria, bool traverseDirectoryReparsePoints)
+        {
+            if (!String.IsNullOrEmpty(selectionCriteria))
+                _Criterion = _ParseCriterion(selectionCriteria);
+            TraverseReparsePoints = traverseDirectoryReparsePoints;
+        }
+
+
+
+        /// <summary>
+        ///   The string specifying which files to include when retrieving.
+        /// </summary>
+        /// <remarks>
+        ///
+        /// <para>
+        ///   Specify the criteria in statements of 3 elements: a noun, an operator,
+        ///   and a value.  Consider the string "name != *.doc" .  The noun is
+        ///   "name".  The operator is "!=", implying "Not Equal".  The value is
+        ///   "*.doc".  That criterion, in English, says "all files with a name that
+        ///   does not end in the .doc extension."
+        /// </para>
+        ///
+        /// <para>
+        ///   Supported nouns include "name" (or "filename") for the filename;
+        ///   "atime", "mtime", and "ctime" for last access time, last modfied time,
+        ///   and created time of the file, respectively; "attributes" (or "attrs")
+        ///   for the file attributes; "size" (or "length") for the file length
+        ///   (uncompressed); and "type" for the type of object, either a file or a
+        ///   directory.  The "attributes", "type", and "name" nouns all support =
+        ///   and != as operators.  The "size", "atime", "mtime", and "ctime" nouns
+        ///   support = and !=, and &gt;, &gt;=, &lt;, &lt;= as well.  The times are
+        ///   taken to be expressed in local time.
+        /// </para>
+        ///
+        /// <para>
+        ///   Specify values for the file attributes as a string with one or more of
+        ///   the characters H,R,S,A,I,L in any order, implying file attributes of
+        ///   Hidden, ReadOnly, System, Archive, NotContextIndexed, and ReparsePoint
+        ///   (symbolic link) respectively.
+        /// </para>
+        ///
+        /// <para>
+        ///   To specify a time, use YYYY-MM-DD-HH:mm:ss or YYYY/MM/DD-HH:mm:ss as
+        ///   the format.  If you omit the HH:mm:ss portion, it is assumed to be
+        ///   00:00:00 (midnight).
+        /// </para>
+        ///
+        /// <para>
+        ///   The value for a size criterion is expressed in integer quantities of
+        ///   bytes, kilobytes (use k or kb after the number), megabytes (m or mb),
+        ///   or gigabytes (g or gb).
+        /// </para>
+        ///
+        /// <para>
+        ///   The value for a name is a pattern to match against the filename,
+        ///   potentially including wildcards.  The pattern follows CMD.exe glob
+        ///   rules: * implies one or more of any character, while ?  implies one
+        ///   character.  If the name pattern contains any slashes, it is matched to
+        ///   the entire filename, including the path; otherwise, it is matched
+        ///   against only the filename without the path.  This means a pattern of
+        ///   "*\*.*" matches all files one directory level deep, while a pattern of
+        ///   "*.*" matches all files in all directories.
+        /// </para>
+        ///
+        /// <para>
+        ///   To specify a name pattern that includes spaces, use single quotes
+        ///   around the pattern.  A pattern of "'* *.*'" will match all files that
+        ///   have spaces in the filename.  The full criteria string for that would
+        ///   be "name = '* *.*'" .
+        /// </para>
+        ///
+        /// <para>
+        ///   The value for a type criterion is either F (implying a file) or D
+        ///   (implying a directory).
+        /// </para>
+        ///
+        /// <para>
+        ///   Some examples:
+        /// </para>
+        ///
+        /// <list type="table">
+        ///   <listheader>
+        ///     <term>criteria</term>
+        ///     <description>Files retrieved</description>
+        ///   </listheader>
+        ///
+        ///   <item>
+        ///     <term>name != *.xls </term>
+        ///     <description>any file with an extension that is not .xls
+        ///     </description>
+        ///   </item>
+        ///
+        ///   <item>
+        ///     <term>name = *.mp3 </term>
+        ///     <description>any file with a .mp3 extension.
+        ///     </description>
+        ///   </item>
+        ///
+        ///   <item>
+        ///     <term>*.mp3</term>
+        ///     <description>(same as above) any file with a .mp3 extension.
+        ///     </description>
+        ///   </item>
+        ///
+        ///   <item>
+        ///     <term>attributes = A </term>
+        ///     <description>all files whose attributes include the Archive bit.
+        ///     </description>
+        ///   </item>
+        ///
+        ///   <item>
+        ///     <term>attributes != H </term>
+        ///     <description>all files whose attributes do not include the Hidden bit.
+        ///     </description>
+        ///   </item>
+        ///
+        ///   <item>
+        ///     <term>mtime > 2009-01-01</term>
+        ///     <description>all files with a last modified time after January 1st, 2009.
+        ///     </description>
+        ///   </item>
+        ///
+        ///   <item>
+        ///     <term>ctime > 2009/01/01-03:00:00</term>
+        ///     <description>all files with a created time after 3am (local time),
+        ///     on January 1st, 2009.
+        ///     </description>
+        ///   </item>
+        ///
+        ///   <item>
+        ///     <term>size > 2gb</term>
+        ///     <description>all files whose uncompressed size is greater than 2gb.
+        ///     </description>
+        ///   </item>
+        ///
+        ///   <item>
+        ///     <term>type = D</term>
+        ///     <description>all directories in the filesystem. </description>
+        ///   </item>
+        ///
+        /// </list>
+        ///
+        /// <para>
+        ///   You can combine criteria with the conjunctions AND, OR, and XOR. Using
+        ///   a string like "name = *.txt AND size &gt;= 100k" for the
+        ///   selectionCriteria retrieves entries whose names end in .txt, and whose
+        ///   uncompressed size is greater than or equal to 100 kilobytes.
+        /// </para>
+        ///
+        /// <para>
+        ///   For more complex combinations of criteria, you can use parenthesis to
+        ///   group clauses in the boolean logic.  Absent parenthesis, the
+        ///   precedence of the criterion atoms is determined by order of
+        ///   appearance.  Unlike the C# language, the AND conjunction does not take
+        ///   precendence over the logical OR.  This is important only in strings
+        ///   that contain 3 or more criterion atoms.  In other words, "name = *.txt
+        ///   and size &gt; 1000 or attributes = H" implies "((name = *.txt AND size
+        ///   &gt; 1000) OR attributes = H)" while "attributes = H OR name = *.txt
+        ///   and size &gt; 1000" evaluates to "((attributes = H OR name = *.txt)
+        ///   AND size &gt; 1000)".  When in doubt, use parenthesis.
+        /// </para>
+        ///
+        /// <para>
+        ///   Using time properties requires some extra care. If you want to
+        ///   retrieve all entries that were last updated on 2009 February 14,
+        ///   specify "mtime &gt;= 2009-02-14 AND mtime &lt; 2009-02-15".  Read this
+        ///   to say: all files updated after 12:00am on February 14th, until
+        ///   12:00am on February 15th.  You can use the same bracketing approach to
+        ///   specify any time period - a year, a month, a week, and so on.
+        /// </para>
+        ///
+        /// <para>
+        ///   The syntax allows one special case: if you provide a string with no
+        ///   spaces, it is treated as a pattern to match for the filename.
+        ///   Therefore a string like "*.xls" will be equivalent to specifying "name
+        ///   = *.xls".  This "shorthand" notation does not work with compound
+        ///   criteria.
+        /// </para>
+        ///
+        /// <para>
+        ///   There is no logic in this class that insures that the inclusion
+        ///   criteria are internally consistent.  For example, it's possible to
+        ///   specify criteria that says the file must have a size of less than 100
+        ///   bytes, as well as a size that is greater than 1000 bytes.  Obviously
+        ///   no file will ever satisfy such criteria, but this class does not check
+        ///   for or detect such inconsistencies.
+        /// </para>
+        ///
+        /// </remarks>
+        ///
+        /// <exception cref="System.Exception">
+        ///   Thrown in the setter if the value has an invalid syntax.
+        /// </exception>
+        public String SelectionCriteria
+        {
+            get
+            {
+                if (_Criterion == null) return null;
+                return _Criterion.ToString();
+            }
+            set
+            {
+                if (value == null) _Criterion = null;
+                else if (value.Trim() == "") _Criterion = null;
+                else
+                    _Criterion = _ParseCriterion(value);
+            }
+        }
+
+        /// <summary>
+        ///  Indicates whether searches will traverse NTFS reparse points, like Junctions.
+        /// </summary>
+        public bool TraverseReparsePoints
+        {
+            get; set;
+        }
+
+
+        private enum ParseState
+        {
+            Start,
+            OpenParen,
+            CriterionDone,
+            ConjunctionPending,
+            Whitespace,
+        }
+
+
+        private static class RegexAssertions
+        {
+            public static readonly String PrecededByOddNumberOfSingleQuotes = "(?<=(?:[^']*'[^']*')*'[^']*)";
+            public static readonly String FollowedByOddNumberOfSingleQuotesAndLineEnd = "(?=[^']*'(?:[^']*'[^']*')*[^']*$)";
+
+            public static readonly String PrecededByEvenNumberOfSingleQuotes = "(?<=(?:[^']*'[^']*')*[^']*)";
+            public static readonly String FollowedByEvenNumberOfSingleQuotesAndLineEnd = "(?=(?:[^']*'[^']*')*[^']*$)";
+        }
+
+
+        private static string NormalizeCriteriaExpression(string source)
+        {
+            // The goal here is to normalize the criterion expression. At output, in
+            // the transformed criterion string, every significant syntactic element
+            // - a property element, grouping paren for the boolean logic, operator
+            // ( = < > != ), conjunction, or property value - will be separated from
+            // its neighbors by at least one space. Thus,
+            //
+            // before                         after
+            // -------------------------------------------------------------------
+            // name=*.txt                     name = *.txt
+            // (size>100)AND(name=*.txt)      ( size > 100 ) AND ( name = *.txt )
+            //
+            // This is relatively straightforward using regular expression
+            // replacement. This method applies a distinct regex pattern and
+            // corresponding replacement string for each one of a number of cases:
+            // an open paren followed by a word; a word followed by a close-paren; a
+            // pair of open parens; a close paren followed by a word (which should
+            // then be followed by an open paren). And so on. These patterns and
+            // replacements are all stored in prPairs. By applying each of these
+            // regex replacements in turn, we get the transformed string. Easy.
+            //
+            // The resulting "normalized" criterion string, is then used as the
+            // subject that gets parsed, by splitting the string into tokens that
+            // are separated by spaces.  Here, there's a twist. The spaces within
+            // single-quote delimiters do not delimit distinct tokens.  So, this
+            // normalization method temporarily replaces those spaces with
+            // ASCII 6 (0x06), a control character which is not a legal
+            // character in a filename. The parsing logic that happens later will
+            // revert that change, restoring the original value of the filename
+            // specification.
+            //
+            // To illustrate, for a "before" string of [(size>100)AND(name='Name
+            // (with Parens).txt')] , the "after" string is [( size > 100 ) AND
+            // ( name = 'Name\u0006(with\u0006Parens).txt' )].
+            //
+
+            string[][] prPairs =
+                {
+                    // A. opening double parens - insert a space between them
+                    new string[] { @"([^']*)\(\(([^']+)", "$1( ($2" },
+
+                    // B. closing double parens - insert a space between
+                    new string[] { @"(.)\)\)", "$1) )" },
+
+                    // C. single open paren with a following word - insert a space between
+                    new string[] { @"\((\S)", "( $1" },
+
+                    // D. single close paren with a preceding word - insert a space between the two
+                    new string[] { @"(\S)\)", "$1 )" },
+
+                    // E. close paren at line start?, insert a space before the close paren
+                    // this seems like a degenerate case.  I don't recall why it's here.
+                    new string[] { @"^\)", " )" },
+
+                    // F. a word (likely a conjunction) followed by an open paren - insert a space between
+                    new string[] { @"(\S)\(", "$1 (" },
+
+                    // G. single close paren followed by word - insert a paren after close paren
+                    new string[] { @"\)(\S)", ") $1" },
+
+                    // H. insert space between = and a following single quote
+                    //new string[] { @"(=|!=)('[^']*')", "$1 $2" },
+                    new string[] { @"(=)('[^']*')", "$1 $2" },
+
+                    // I. insert space between property names and the following operator
+                    //new string[] { @"([^ ])([><(?:!=)=])", "$1 $2" },
+                    new string[] { @"([^ !><])(>|<|!=|=)", "$1 $2" },
+
+                    // J. insert spaces between operators and the following values
+                    //new string[] { @"([><(?:!=)=])([^ ])", "$1 $2" },
+                    new string[] { @"(>|<|!=|=)([^ =])", "$1 $2" },
+
+                    // K. replace fwd slash with backslash
+                    new string[] { @"/", "\\" },
+                };
+
+            string interim = source;
+
+            for (int i=0; i < prPairs.Length; i++)
+            {
+                //char caseIdx = (char)('A' + i);
+                string pattern = RegexAssertions.PrecededByEvenNumberOfSingleQuotes +
+                    prPairs[i][0] +
+                    RegexAssertions.FollowedByEvenNumberOfSingleQuotesAndLineEnd;
+
+                interim = Regex.Replace(interim, pattern, prPairs[i][1]);
+            }
+
+            // match a fwd slash, followed by an odd number of single quotes.
+            // This matches fwd slashes only inside a pair of single quote delimiters,
+            // eg, a filename.  This must be done as well as the case above, to handle
+            // filenames specified inside quotes as well as filenames without quotes.
+            var regexPattern = @"/" +
+                                RegexAssertions.FollowedByOddNumberOfSingleQuotesAndLineEnd;
+            // replace with backslash
+            interim = Regex.Replace(interim, regexPattern, "\\");
+
+            // match a space, followed by an odd number of single quotes.
+            // This matches spaces only inside a pair of single quote delimiters.
+            regexPattern = " " +
+                RegexAssertions.FollowedByOddNumberOfSingleQuotesAndLineEnd;
+
+            // Replace all spaces that appear inside single quotes, with
+            // ascii 6.  This allows a split on spaces to get tokens in
+            // the expression. The split will not split any filename or
+            // wildcard that appears within single quotes. After tokenizing, we
+            // need to replace ascii 6 with ascii 32 to revert the
+            // spaces within quotes.
+            return Regex.Replace(interim, regexPattern, "\u0006");
+        }
+
+
+        private static SelectionCriterion _ParseCriterion(String s)
+        {
+            if (s == null) return null;
+
+            // inject spaces after open paren and before close paren, etc
+            s = NormalizeCriteriaExpression(s);
+
+            // no spaces in the criteria is shorthand for filename glob
+            if (s.IndexOf(" ") == -1)
+                s = "name = " + s;
+
+            // split the expression into tokens
+            string[] tokens = s.Trim().Split(' ', '\t');
+
+            if (tokens.Length < 3) throw new ArgumentException(s);
+
+            SelectionCriterion current = null;
+
+            LogicalConjunction pendingConjunction = LogicalConjunction.NONE;
+
+            ParseState state;
+            var stateStack = new System.Collections.Generic.Stack<ParseState>();
+            var critStack = new System.Collections.Generic.Stack<SelectionCriterion>();
+            stateStack.Push(ParseState.Start);
+
+            for (int i = 0; i < tokens.Length; i++)
+            {
+                string tok1 = tokens[i].ToLower(CultureInfo.InvariantCulture);
+                switch (tok1)
+                {
+                    case "and":
+                    case "xor":
+                    case "or":
+                        state = stateStack.Peek();
+                        if (state != ParseState.CriterionDone)
+                            throw new ArgumentException(String.Join(" ", tokens, i, tokens.Length - i));
+
+                        if (tokens.Length <= i + 3)
+                            throw new ArgumentException(String.Join(" ", tokens, i, tokens.Length - i));
+
+                        pendingConjunction = (LogicalConjunction)Enum.Parse(typeof(LogicalConjunction), tokens[i].ToUpper(CultureInfo.InvariantCulture), true);
+                        current = new CompoundCriterion { Left = current, Right = null, Conjunction = pendingConjunction };
+                        stateStack.Push(state);
+                        stateStack.Push(ParseState.ConjunctionPending);
+                        critStack.Push(current);
+                        break;
+
+                    case "(":
+                        state = stateStack.Peek();
+                        if (state != ParseState.Start && state != ParseState.ConjunctionPending && state != ParseState.OpenParen)
+                            throw new ArgumentException(String.Join(" ", tokens, i, tokens.Length - i));
+
+                        if (tokens.Length <= i + 4)
+                            throw new ArgumentException(String.Join(" ", tokens, i, tokens.Length - i));
+
+                        stateStack.Push(ParseState.OpenParen);
+                        break;
+
+                    case ")":
+                        state = stateStack.Pop();
+                        if (stateStack.Peek() != ParseState.OpenParen)
+                            throw new ArgumentException(String.Join(" ", tokens, i, tokens.Length - i));
+
+                        stateStack.Pop();
+                        stateStack.Push(ParseState.CriterionDone);
+                        break;
+
+                    case "atime":
+                    case "ctime":
+                    case "mtime":
+                        if (tokens.Length <= i + 2)
+                            throw new ArgumentException(String.Join(" ", tokens, i, tokens.Length - i));
+
+                        DateTime t;
+                        try
+                        {
+                            t = DateTime.ParseExact(tokens[i + 2], "yyyy-MM-dd-HH:mm:ss", null);
+                        }
+                        catch (FormatException)
+                        {
+                            try
+                            {
+                                t = DateTime.ParseExact(tokens[i + 2], "yyyy/MM/dd-HH:mm:ss", null);
+                            }
+                            catch (FormatException)
+                            {
+                                try
+                                {
+                                    t = DateTime.ParseExact(tokens[i + 2], "yyyy/MM/dd", null);
+                                }
+                                catch (FormatException)
+                                {
+                                    try
+                                    {
+                                        t = DateTime.ParseExact(tokens[i + 2], "MM/dd/yyyy", null);
+                                    }
+                                    catch (FormatException)
+                                    {
+                                        t = DateTime.ParseExact(tokens[i + 2], "yyyy-MM-dd", null);
+                                    }
+                                }
+                            }
+                        }
+                        t= DateTime.SpecifyKind(t, DateTimeKind.Local).ToUniversalTime();
+                        current = new TimeCriterion
+                        {
+                            Which = (WhichTime)Enum.Parse(typeof(WhichTime), tokens[i], true),
+                            Operator = (ComparisonOperator)EnumUtil.Parse(typeof(ComparisonOperator), tokens[i + 1]),
+                            Time = t
+                        };
+                        i += 2;
+                        stateStack.Push(ParseState.CriterionDone);
+                        break;
+
+
+                    case "length":
+                    case "size":
+                        if (tokens.Length <= i + 2)
+                            throw new ArgumentException(String.Join(" ", tokens, i, tokens.Length - i));
+
+                        Int64 sz = 0;
+                        string v = tokens[i + 2];
+                        if (v.EndsWith("K", StringComparison.InvariantCultureIgnoreCase))
+                            sz = Int64.Parse(v.Substring(0, v.Length - 1)) * 1024;
+                        else if (v.EndsWith("KB", StringComparison.InvariantCultureIgnoreCase))
+                            sz = Int64.Parse(v.Substring(0, v.Length - 2)) * 1024;
+                        else if (v.EndsWith("M", StringComparison.InvariantCultureIgnoreCase))
+                            sz = Int64.Parse(v.Substring(0, v.Length - 1)) * 1024 * 1024;
+                        else if (v.EndsWith("MB", StringComparison.InvariantCultureIgnoreCase))
+                            sz = Int64.Parse(v.Substring(0, v.Length - 2)) * 1024 * 1024;
+                        else if (v.EndsWith("G", StringComparison.InvariantCultureIgnoreCase))
+                            sz = Int64.Parse(v.Substring(0, v.Length - 1)) * 1024 * 1024 * 1024;
+                        else if (v.EndsWith("GB", StringComparison.InvariantCultureIgnoreCase))
+                            sz = Int64.Parse(v.Substring(0, v.Length - 2)) * 1024 * 1024 * 1024;
+                        else sz = Int64.Parse(tokens[i + 2]);
+
+                        current = new SizeCriterion
+                        {
+                            Size = sz,
+                            Operator = (ComparisonOperator)EnumUtil.Parse(typeof(ComparisonOperator), tokens[i + 1])
+                        };
+                        i += 2;
+                        stateStack.Push(ParseState.CriterionDone);
+                        break;
+
+                    case "filename":
+                    case "name":
+                        {
+                            if (tokens.Length <= i + 2)
+                                throw new ArgumentException(String.Join(" ", tokens, i, tokens.Length - i));
+
+                            ComparisonOperator c =
+                                (ComparisonOperator)EnumUtil.Parse(typeof(ComparisonOperator), tokens[i + 1]);
+
+                            if (c != ComparisonOperator.NotEqualTo && c != ComparisonOperator.EqualTo)
+                                throw new ArgumentException(String.Join(" ", tokens, i, tokens.Length - i));
+
+                            string m = tokens[i + 2];
+
+                            // handle single-quoted filespecs (used to include
+                            // spaces in filename patterns)
+                            if (m.StartsWith("'") && m.EndsWith("'"))
+                            {
+                                // trim off leading and trailing single quotes and
+                                // revert the control characters to spaces.
+                                m = m.Substring(1, m.Length - 2)
+                                    .Replace("\u0006", " ");
+                            }
+
+                            // if (m.StartsWith("'"))
+                            //     m = m.Replace("\u0006", " ");
+
+                            current = new NameCriterion
+                            {
+                                MatchingFileSpec = m,
+                                Operator = c
+                            };
+                            i += 2;
+                            stateStack.Push(ParseState.CriterionDone);
+                        }
+                        break;
+
+#if !SILVERLIGHT
+                    case "attrs":
+                    case "attributes":
+#endif
+                    case "type":
+                        {
+                            if (tokens.Length <= i + 2)
+                                throw new ArgumentException(String.Join(" ", tokens, i, tokens.Length - i));
+
+                            ComparisonOperator c =
+                                (ComparisonOperator)EnumUtil.Parse(typeof(ComparisonOperator), tokens[i + 1]);
+
+                            if (c != ComparisonOperator.NotEqualTo && c != ComparisonOperator.EqualTo)
+                                throw new ArgumentException(String.Join(" ", tokens, i, tokens.Length - i));
+
+#if SILVERLIGHT
+                            current = (SelectionCriterion) new TypeCriterion
+                                    {
+                                        AttributeString = tokens[i + 2],
+                                        Operator = c
+                                    };
+#else
+                            current = (tok1 == "type")
+                                ? (SelectionCriterion) new TypeCriterion
+                                    {
+                                        AttributeString = tokens[i + 2],
+                                        Operator = c
+                                    }
+                                : (SelectionCriterion) new AttributesCriterion
+                                    {
+                                        AttributeString = tokens[i + 2],
+                                        Operator = c
+                                    };
+#endif
+                            i += 2;
+                            stateStack.Push(ParseState.CriterionDone);
+                        }
+                        break;
+
+                    case "":
+                        // NOP
+                        stateStack.Push(ParseState.Whitespace);
+                        break;
+
+                    default:
+                        throw new ArgumentException("'" + tokens[i] + "'");
+                }
+
+                state = stateStack.Peek();
+                if (state == ParseState.CriterionDone)
+                {
+                    stateStack.Pop();
+                    if (stateStack.Peek() == ParseState.ConjunctionPending)
+                    {
+                        while (stateStack.Peek() == ParseState.ConjunctionPending)
+                        {
+                            var cc = critStack.Pop() as CompoundCriterion;
+                            cc.Right = current;
+                            current = cc; // mark the parent as current (walk up the tree)
+                            stateStack.Pop();   // the conjunction is no longer pending
+
+                            state = stateStack.Pop();
+                            if (state != ParseState.CriterionDone)
+                                throw new ArgumentException("??");
+                        }
+                    }
+                    else stateStack.Push(ParseState.CriterionDone);  // not sure?
+                }
+
+                if (state == ParseState.Whitespace)
+                    stateStack.Pop();
+            }
+
+            return current;
+        }
+
+
+        /// <summary>
+        /// Returns a string representation of the FileSelector object.
+        /// </summary>
+        /// <returns>The string representation of the boolean logic statement of the file
+        /// selection criteria for this instance. </returns>
+        public override String ToString()
+        {
+            return "FileSelector("+_Criterion.ToString()+")";
+        }
+
+
+        private bool Evaluate(string filename)
+        {
+            // dinoch - Thu, 11 Feb 2010  18:34
+            SelectorTrace("Evaluate({0})", filename);
+            bool result = _Criterion.Evaluate(filename);
+            return result;
+        }
+
+        [System.Diagnostics.Conditional("SelectorTrace")]
+        private void SelectorTrace(string format, params object[] args)
+        {
+            if (_Criterion != null && _Criterion.Verbose)
+                System.Console.WriteLine(format, args);
+        }
+
+        /// <summary>
+        ///   Returns the names of the files in the specified directory
+        ///   that fit the selection criteria specified in the FileSelector.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///   This is equivalent to calling <see cref="SelectFiles(String, bool)"/>
+        ///   with recurseDirectories = false.
+        /// </remarks>
+        ///
+        /// <param name="directory">
+        ///   The name of the directory over which to apply the FileSelector
+        ///   criteria.
+        /// </param>
+        ///
+        /// <returns>
+        ///   A collection of strings containing fully-qualified pathnames of files
+        ///   that match the criteria specified in the FileSelector instance.
+        /// </returns>
+        public System.Collections.Generic.ICollection<String> SelectFiles(String directory)
+        {
+            return SelectFiles(directory, false);
+        }
+
+
+        /// <summary>
+        ///   Returns the names of the files in the specified directory that fit the
+        ///   selection criteria specified in the FileSelector, optionally recursing
+        ///   through subdirectories.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///   This method applies the file selection criteria contained in the
+        ///   FileSelector to the files contained in the given directory, and
+        ///   returns the names of files that conform to the criteria.
+        /// </remarks>
+        ///
+        /// <param name="directory">
+        ///   The name of the directory over which to apply the FileSelector
+        ///   criteria.
+        /// </param>
+        ///
+        /// <param name="recurseDirectories">
+        ///   Whether to recurse through subdirectories when applying the file
+        ///   selection criteria.
+        /// </param>
+        ///
+        /// <returns>
+        ///   A collection of strings containing fully-qualified pathnames of files
+        ///   that match the criteria specified in the FileSelector instance.
+        /// </returns>
+        public System.Collections.ObjectModel.ReadOnlyCollection<String>
+            SelectFiles(String directory,
+                        bool recurseDirectories)
+        {
+            if (_Criterion == null)
+                throw new ArgumentException("SelectionCriteria has not been set");
+
+            var list = new List<String>();
+            try
+            {
+                if (Directory.Exists(directory))
+                {
+                    String[] filenames = Directory.GetFiles(directory);
+
+                    // add the files:
+                    foreach (String filename in filenames)
+                    {
+                        if (Evaluate(filename))
+                            list.Add(filename);
+                    }
+
+                    if (recurseDirectories)
+                    {
+                        // add the subdirectories:
+                        String[] dirnames = Directory.GetDirectories(directory);
+                        foreach (String dir in dirnames)
+                        {
+                            if (this.TraverseReparsePoints
+#if !SILVERLIGHT
+                                || ((File.GetAttributes(dir) & FileAttributes.ReparsePoint) == 0)
+#endif
+                                )
+                            {
+                                // workitem 10191
+                                if (Evaluate(dir)) list.Add(dir);
+                                list.AddRange(this.SelectFiles(dir, recurseDirectories));
+                            }
+                        }
+                    }
+                }
+            }
+            // can get System.UnauthorizedAccessException here
+            catch (System.UnauthorizedAccessException)
+            {
+            }
+            catch (System.IO.IOException)
+            {
+            }
+
+            return list.AsReadOnly();
+        }
+    }
+
+
+
+    /// <summary>
+    /// Summary description for EnumUtil.
+    /// </summary>
+    internal sealed class EnumUtil
+    {
+        private EnumUtil() { }
+        /// <summary>
+        ///   Returns the value of the DescriptionAttribute if the specified Enum
+        ///   value has one.  If not, returns the ToString() representation of the
+        ///   Enum value.
+        /// </summary>
+        /// <param name="value">The Enum to get the description for</param>
+        /// <returns></returns>
+        internal static string GetDescription(System.Enum value)
+        {
+            FieldInfo fi = value.GetType().GetField(value.ToString());
+            var attributes = (DescriptionAttribute[])fi.GetCustomAttributes(typeof(DescriptionAttribute), false);
+            if (attributes.Length > 0)
+                return attributes[0].Description;
+            else
+                return value.ToString();
+        }
+
+        /// <summary>
+        ///   Converts the string representation of the name or numeric value of one
+        ///   or more enumerated constants to an equivalent enumerated object.
+        ///   Note: use the DescriptionAttribute on enum values to enable this.
+        /// </summary>
+        /// <param name="enumType">The System.Type of the enumeration.</param>
+        /// <param name="stringRepresentation">
+        ///   A string containing the name or value to convert.
+        /// </param>
+        /// <returns></returns>
+        internal static object Parse(Type enumType, string stringRepresentation)
+        {
+            return Parse(enumType, stringRepresentation, false);
+        }
+
+
+#if SILVERLIGHT
+       public static System.Enum[] GetEnumValues(Type type)
+        {
+            if (!type.IsEnum)
+                throw new ArgumentException("not an enum");
+
+            return (
+              from field in type.GetFields(BindingFlags.Public | BindingFlags.Static)
+              where field.IsLiteral
+              select (System.Enum)field.GetValue(null)
+            ).ToArray();
+        }
+
+        public static string[] GetEnumStrings<T>()
+        {
+            var type = typeof(T);
+            if (!type.IsEnum)
+                throw new ArgumentException("not an enum");
+
+            return (
+              from field in type.GetFields(BindingFlags.Public | BindingFlags.Static)
+              where field.IsLiteral
+              select field.Name
+            ).ToArray();
+        }
+#endif
+
+        /// <summary>
+        ///   Converts the string representation of the name or numeric value of one
+        ///   or more enumerated constants to an equivalent enumerated object.  A
+        ///   parameter specified whether the operation is case-sensitive.  Note:
+        ///   use the DescriptionAttribute on enum values to enable this.
+        /// </summary>
+        /// <param name="enumType">The System.Type of the enumeration.</param>
+        /// <param name="stringRepresentation">
+        ///   A string containing the name or value to convert.
+        /// </param>
+        /// <param name="ignoreCase">
+        ///   Whether the operation is case-sensitive or not.</param>
+        /// <returns></returns>
+        internal static object Parse(Type enumType, string stringRepresentation, bool ignoreCase)
+        {
+            if (ignoreCase)
+                stringRepresentation = stringRepresentation.ToLower(CultureInfo.InvariantCulture);
+
+#if SILVERLIGHT
+            foreach (System.Enum enumVal in GetEnumValues(enumType))
+#else
+            foreach (System.Enum enumVal in System.Enum.GetValues(enumType))
+#endif
+            {
+                string description = GetDescription(enumVal);
+                if (ignoreCase)
+                    description = description.ToLower(CultureInfo.InvariantCulture);
+                if (description == stringRepresentation)
+                    return enumVal;
+            }
+
+            return System.Enum.Parse(enumType, stringRepresentation, ignoreCase);
+        }
+    }
+
+
+#if DEMO
+    internal class DemonstrateFileSelector
+    {
+        private string _directory;
+        private bool _recurse;
+        private bool _traverse;
+        private bool _verbose;
+        private string _selectionCriteria;
+        private FileSelector f;
+
+        public DemonstrateFileSelector()
+        {
+            this._directory = ".";
+            this._recurse = true;
+        }
+
+        public DemonstrateFileSelector(string[] args) : this()
+        {
+            for (int i = 0; i < args.Length; i++)
+            {
+                switch(args[i])
+                {
+                case"-?":
+                    Usage();
+                    Environment.Exit(0);
+                    break;
+                case "-d":
+                    i++;
+                    if (args.Length <= i)
+                        throw new ArgumentException("-directory");
+                    this._directory = args[i];
+                    break;
+                case "-norecurse":
+                    this._recurse = false;
+                    break;
+
+                case "-j-":
+                    this._traverse = false;
+                    break;
+
+                case "-j+":
+                    this._traverse = true;
+                    break;
+
+                case "-v":
+                    this._verbose = true;
+                    break;
+
+                default:
+                    if (this._selectionCriteria != null)
+                        throw new ArgumentException(args[i]);
+                    this._selectionCriteria = args[i];
+                    break;
+                }
+
+                if (this._selectionCriteria != null)
+                    this.f = new FileSelector(this._selectionCriteria);
+            }
+        }
+
+
+        public static void Main(string[] args)
+        {
+            try
+            {
+                Console.WriteLine();
+                new DemonstrateFileSelector(args).Run();
+            }
+            catch (Exception exc1)
+            {
+                Console.WriteLine("Exception: {0}", exc1.ToString());
+                Usage();
+            }
+        }
+
+
+        public void Run()
+        {
+            if (this.f == null)
+                this.f = new FileSelector("name = *.jpg AND (size > 1000 OR atime < 2009-02-14-01:00:00)");
+
+            this.f.TraverseReparsePoints = _traverse;
+            this.f.Verbose = this._verbose;
+            Console.WriteLine();
+            Console.WriteLine(new String(':', 88));
+            Console.WriteLine("Selecting files:\n" + this.f.ToString());
+            var files = this.f.SelectFiles(this._directory, this._recurse);
+            if (files.Count == 0)
+            {
+                Console.WriteLine("no files.");
+            }
+            else
+            {
+                Console.WriteLine("files: {0}", files.Count);
+                foreach (string file in files)
+                {
+                    Console.WriteLine("  " + file);
+                }
+            }
+        }
+
+        public static void Usage()
+        {
+            Console.WriteLine("FileSelector: select files based on selection criteria.\n");
+            Console.WriteLine("Usage:\n  FileSelector <selectionCriteria>  [options]\n" +
+                              "\n" +
+                              "  -d <dir>   directory to select from (Default .)\n" +
+                              " -norecurse  don't recurse into subdirs\n" +
+                              " -j-         don't traverse junctions\n" +
+                              " -v          verbose output\n");
+        }
+    }
+
+#endif
+
+
+
+}
+
+
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/OffsetStream.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/OffsetStream.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/OffsetStream.cs	(revision 12707)
@@ -0,0 +1,114 @@
+// OffsetStream.cs
+// ------------------------------------------------------------------
+//
+// Copyright (c)  2009 Dino Chiesa
+// All rights reserved.
+//
+// This code module is part of DotNetZip, a zipfile class library.
+//
+// ------------------------------------------------------------------
+//
+// This code is licensed under the Microsoft Public License. 
+// See the file License.txt for the license details.
+// More info on: http://dotnetzip.codeplex.com
+//
+// ------------------------------------------------------------------
+//
+// last saved (in emacs): 
+// Time-stamp: <2009-August-27 12:50:35>
+//
+// ------------------------------------------------------------------
+//
+// This module defines logic for handling reading of zip archives embedded 
+// into larger streams.  The initial position of the stream serves as
+// the base offset for all future Seek() operations.
+// 
+// ------------------------------------------------------------------
+
+
+using System;
+using System.IO;
+
+namespace OfficeOpenXml.Packaging.Ionic.Zip
+{
+    internal class OffsetStream : System.IO.Stream, System.IDisposable
+    {
+        private Int64 _originalPosition;
+        private Stream _innerStream;
+
+        public OffsetStream(Stream s)
+            : base()
+        {
+            _originalPosition = s.Position;
+            _innerStream = s;
+        }
+
+        public override int Read(byte[] buffer, int offset, int count)
+        {
+            return _innerStream.Read(buffer, offset, count);
+        }
+
+        public override void Write(byte[] buffer, int offset, int count)
+        {
+            throw new NotImplementedException();
+        }
+
+        public override bool CanRead
+        {
+            get { return _innerStream.CanRead; }
+        }
+
+        public override bool CanSeek
+        {
+            get { return _innerStream.CanSeek; }
+        }
+
+        public override bool CanWrite
+        {
+            get { return false; }
+        }
+
+        public override void Flush()
+        {
+            _innerStream.Flush();
+        }
+
+        public override long Length
+        {
+            get
+            {
+                return _innerStream.Length;
+            }
+        }
+
+        public override long Position
+        {
+            get { return _innerStream.Position - _originalPosition; }
+            set { _innerStream.Position = _originalPosition + value; }
+        }
+
+
+        public override long Seek(long offset, System.IO.SeekOrigin origin)
+        {
+            return _innerStream.Seek(_originalPosition + offset, origin) - _originalPosition;
+        }
+
+
+        public override void SetLength(long value)
+        {
+            throw new NotImplementedException();
+        }
+
+        void IDisposable.Dispose()
+        {
+            Close();
+        }
+
+        public override void Close()
+        {
+            base.Close();
+        }
+
+    }
+
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/Shared.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/Shared.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/Shared.cs	(revision 12707)
@@ -0,0 +1,901 @@
+// Shared.cs
+// ------------------------------------------------------------------
+//
+// Copyright (c) 2006-2011 Dino Chiesa.
+// All rights reserved.
+//
+// This code module is part of DotNetZip, a zipfile class library.
+//
+// ------------------------------------------------------------------
+//
+// This code is licensed under the Microsoft Public License.
+// See the file License.txt for the license details.
+// More info on: http://dotnetzip.codeplex.com
+//
+// ------------------------------------------------------------------
+//
+// Last Saved: <2011-August-02 19:41:01>
+//
+// ------------------------------------------------------------------
+//
+// This module defines some shared utility classes and methods.
+//
+// Created: Tue, 27 Mar 2007  15:30
+//
+
+using System;
+using System.IO;
+using System.Security.Permissions;
+
+namespace OfficeOpenXml.Packaging.Ionic.Zip
+{
+    /// <summary>
+    /// Collects general purpose utility methods.
+    /// </summary>
+    internal static class SharedUtilities
+    {
+        /// private null constructor
+        //private SharedUtilities() { }
+
+        // workitem 8423
+        public static Int64 GetFileLength(string fileName)
+        {
+            if (!File.Exists(fileName))
+                throw new System.IO.FileNotFoundException(fileName);
+
+            long fileLength = 0L;
+            FileShare fs = FileShare.ReadWrite;
+#if !NETCF
+            // FileShare.Delete is not defined for the Compact Framework
+            fs |= FileShare.Delete;
+#endif
+            using (var s = File.Open(fileName, FileMode.Open, FileAccess.Read, fs))
+            {
+                fileLength = s.Length;
+            }
+            return fileLength;
+        }
+
+
+        [System.Diagnostics.Conditional("NETCF")]
+        public static void Workaround_Ladybug318918(Stream s)
+        {
+            // This is a workaround for this issue:
+            // https://connect.microsoft.com/VisualStudio/feedback/details/318918
+            // It's required only on NETCF.
+            s.Flush();
+        }
+
+
+#if LEGACY
+        /// <summary>
+        /// Round the given DateTime value to an even second value.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        /// Round up in the case of an odd second value.  The rounding does not consider
+        /// fractional seconds.
+        /// </para>
+        /// <para>
+        /// This is useful because the Zip spec allows storage of time only to the nearest
+        /// even second.  So if you want to compare the time of an entry in the archive with
+        /// it's actual time in the filesystem, you need to round the actual filesystem
+        /// time, or use a 2-second threshold for the comparison.
+        /// </para>
+        /// <para>
+        /// This is most nautrally an extension method for the DateTime class but this
+        /// library is built for .NET 2.0, not for .NET 3.5; This means extension methods
+        /// are a no-no.
+        /// </para>
+        /// </remarks>
+        /// <param name="source">The DateTime value to round</param>
+        /// <returns>The ruonded DateTime value</returns>
+        public static DateTime RoundToEvenSecond(DateTime source)
+        {
+            // round to nearest second:
+            if ((source.Second % 2) == 1)
+                source += new TimeSpan(0, 0, 1);
+
+            DateTime dtRounded = new DateTime(source.Year, source.Month, source.Day, source.Hour, source.Minute, source.Second);
+            //if (source.Millisecond >= 500) dtRounded = dtRounded.AddSeconds(1);
+            return dtRounded;
+        }
+#endif
+
+#if YOU_LIKE_REDUNDANT_CODE
+        internal static string NormalizePath(string path)
+        {
+            // remove leading single dot slash
+            if (path.StartsWith(".\\")) path = path.Substring(2);
+
+            // remove intervening dot-slash
+            path = path.Replace("\\.\\", "\\");
+
+            // remove double dot when preceded by a directory name
+            var re = new System.Text.RegularExpressions.Regex(@"^(.*\\)?([^\\\.]+\\\.\.\\)(.+)$");
+            path = re.Replace(path, "$1$3");
+            return path;
+        }
+#endif
+
+        private static System.Text.RegularExpressions.Regex doubleDotRegex1 =
+            new System.Text.RegularExpressions.Regex(@"^(.*/)?([^/\\.]+/\\.\\./)(.+)$");
+
+        private static string SimplifyFwdSlashPath(string path)
+        {
+            if (path.StartsWith("./")) path = path.Substring(2);
+            path = path.Replace("/./", "/");
+
+            // Replace foo/anything/../bar with foo/bar
+            path = doubleDotRegex1.Replace(path, "$1$3");
+            return path;
+        }
+
+
+        /// <summary>
+        /// Utility routine for transforming path names from filesystem format (on Windows that means backslashes) to
+        /// a format suitable for use within zipfiles. This means trimming the volume letter and colon (if any) And
+        /// swapping backslashes for forward slashes.
+        /// </summary>
+        /// <param name="pathName">source path.</param>
+        /// <returns>transformed path</returns>
+        public static string NormalizePathForUseInZipFile(string pathName)
+        {
+            // boundary case
+            if (String.IsNullOrEmpty(pathName)) return pathName;
+
+            // trim volume if necessary
+            if ((pathName.Length >= 2)  && ((pathName[1] == ':') && (pathName[2] == '\\')))
+                pathName =  pathName.Substring(3);
+
+            // swap slashes
+            pathName = pathName.Replace('\\', '/');
+
+            // trim all leading slashes
+            while (pathName.StartsWith("/")) pathName = pathName.Substring(1);
+
+            return SimplifyFwdSlashPath(pathName);
+        }
+
+
+        static System.Text.Encoding ibm437 = System.Text.Encoding.GetEncoding("IBM437");
+        static System.Text.Encoding utf8 = System.Text.Encoding.GetEncoding("UTF-8");
+
+        internal static byte[] StringToByteArray(string value, System.Text.Encoding encoding)
+        {
+            byte[] a = encoding.GetBytes(value);
+            return a;
+        }
+        internal static byte[] StringToByteArray(string value)
+        {
+            return StringToByteArray(value, ibm437);
+        }
+
+        //internal static byte[] Utf8StringToByteArray(string value)
+        //{
+        //    return StringToByteArray(value, utf8);
+        //}
+
+        //internal static string StringFromBuffer(byte[] buf, int maxlength)
+        //{
+        //    return StringFromBuffer(buf, maxlength, ibm437);
+        //}
+
+        internal static string Utf8StringFromBuffer(byte[] buf)
+        {
+            return StringFromBuffer(buf, utf8);
+        }
+
+        internal static string StringFromBuffer(byte[] buf, System.Text.Encoding encoding)
+        {
+            // this form of the GetString() method is required for .NET CF compatibility
+            string s = encoding.GetString(buf, 0, buf.Length);
+            return s;
+        }
+
+
+        internal static int ReadSignature(System.IO.Stream s)
+        {
+            int x = 0;
+            try { x = _ReadFourBytes(s, "n/a"); }
+            catch (BadReadException) { }
+            return x;
+        }
+
+
+        internal static int ReadEntrySignature(System.IO.Stream s)
+        {
+            // handle the case of ill-formatted zip archives - includes a data descriptor
+            // when none is expected.
+            int x = 0;
+            try
+            {
+                x = _ReadFourBytes(s, "n/a");
+                if (x == ZipConstants.ZipEntryDataDescriptorSignature)
+                {
+                    // advance past data descriptor - 12 bytes if not zip64
+                    s.Seek(12, SeekOrigin.Current);
+                    // workitem 10178
+                    Workaround_Ladybug318918(s);
+                    x = _ReadFourBytes(s, "n/a");
+                    if (x != ZipConstants.ZipEntrySignature)
+                    {
+                        // Maybe zip64 was in use for the prior entry.
+                        // Therefore, skip another 8 bytes.
+                        s.Seek(8, SeekOrigin.Current);
+                        // workitem 10178
+                        Workaround_Ladybug318918(s);
+                        x = _ReadFourBytes(s, "n/a");
+                        if (x != ZipConstants.ZipEntrySignature)
+                        {
+                            // seek back to the first spot
+                            s.Seek(-24, SeekOrigin.Current);
+                            // workitem 10178
+                            Workaround_Ladybug318918(s);
+                            x = _ReadFourBytes(s, "n/a");
+                        }
+                    }
+                }
+            }
+            catch (BadReadException) { }
+            return x;
+        }
+
+
+        internal static int ReadInt(System.IO.Stream s)
+        {
+            return _ReadFourBytes(s, "Could not read block - no data!  (position 0x{0:X8})");
+        }
+
+        private static int _ReadFourBytes(System.IO.Stream s, string message)
+        {
+            int n = 0;
+            byte[] block = new byte[4];
+#if NETCF
+            // workitem 9181
+            // Reading here in NETCF sometimes reads "backwards". Seems to happen for
+            // larger files.  Not sure why. Maybe an error in caching.  If the data is:
+            //
+            // 00100210: 9efa 0f00 7072 6f6a 6563 742e 6963 7750  ....project.icwP
+            // 00100220: 4b05 0600 0000 0006 0006 0091 0100 008e  K...............
+            // 00100230: 0010 0000 00                             .....
+            //
+            // ...and the stream Position is 10021F, then a Read of 4 bytes is returning
+            // 50776369, instead of 06054b50. This seems to happen the 2nd time Read()
+            // is called from that Position..
+            //
+            // submitted to connect.microsoft.com
+            // https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=318918#tabs
+            //
+            for (int i = 0; i < block.Length; i++)
+            {
+                n+= s.Read(block, i, 1);
+            }
+#else
+            n = s.Read(block, 0, block.Length);
+#endif
+            if (n != block.Length) throw new BadReadException(String.Format(message, s.Position));
+            int data = unchecked((((block[3] * 256 + block[2]) * 256) + block[1]) * 256 + block[0]);
+            return data;
+        }
+
+
+
+        /// <summary>
+        ///   Finds a signature in the zip stream. This is useful for finding
+        ///   the end of a zip entry, for example, or the beginning of the next ZipEntry.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///   <para>
+        ///     Scans through 64k at a time.
+        ///   </para>
+        ///
+        ///   <para>
+        ///     If the method fails to find the requested signature, the stream Position
+        ///     after completion of this method is unchanged. If the method succeeds in
+        ///     finding the requested signature, the stream position after completion is
+        ///     direct AFTER the signature found in the stream.
+        ///   </para>
+        /// </remarks>
+        ///
+        /// <param name="stream">The stream to search</param>
+        /// <param name="SignatureToFind">The 4-byte signature to find</param>
+        /// <returns>The number of bytes read</returns>
+        internal static long FindSignature(System.IO.Stream stream, int SignatureToFind)
+        {
+            long startingPosition = stream.Position;
+
+            int BATCH_SIZE = 65536; //  8192;
+            byte[] targetBytes = new byte[4];
+            targetBytes[0] = (byte)(SignatureToFind >> 24);
+            targetBytes[1] = (byte)((SignatureToFind & 0x00FF0000) >> 16);
+            targetBytes[2] = (byte)((SignatureToFind & 0x0000FF00) >> 8);
+            targetBytes[3] = (byte)(SignatureToFind & 0x000000FF);
+            byte[] batch = new byte[BATCH_SIZE];
+            int n = 0;
+            bool success = false;
+            do
+            {
+                n = stream.Read(batch, 0, batch.Length);
+                if (n != 0)
+                {
+                    for (int i = 0; i < n; i++)
+                    {
+                        if (batch[i] == targetBytes[3])
+                        {
+                            long curPosition = stream.Position;
+                            stream.Seek(i - n, System.IO.SeekOrigin.Current);
+                            // workitem 10178
+                            Workaround_Ladybug318918(stream);
+
+                            // workitem 7711
+                            int sig = ReadSignature(stream);
+
+                            success = (sig == SignatureToFind);
+                            if (!success)
+                            {
+                                stream.Seek(curPosition, System.IO.SeekOrigin.Begin);
+                                // workitem 10178
+                                Workaround_Ladybug318918(stream);
+                            }
+                            else
+                                break; // out of for loop
+                        }
+                    }
+                }
+                else break;
+                if (success) break;
+
+            } while (true);
+
+            if (!success)
+            {
+                stream.Seek(startingPosition, System.IO.SeekOrigin.Begin);
+                // workitem 10178
+                Workaround_Ladybug318918(stream);
+                return -1;  // or throw?
+            }
+
+            // subtract 4 for the signature.
+            long bytesRead = (stream.Position - startingPosition) - 4;
+
+            return bytesRead;
+        }
+
+
+        // If I have a time in the .NET environment, and I want to use it for
+        // SetWastWriteTime() etc, then I need to adjust it for Win32.
+        internal static DateTime AdjustTime_Reverse(DateTime time)
+        {
+            if (time.Kind == DateTimeKind.Utc) return time;
+            DateTime adjusted = time;
+            if (DateTime.Now.IsDaylightSavingTime() && !time.IsDaylightSavingTime())
+                adjusted = time - new System.TimeSpan(1, 0, 0);
+
+            else if (!DateTime.Now.IsDaylightSavingTime() && time.IsDaylightSavingTime())
+                adjusted = time + new System.TimeSpan(1, 0, 0);
+
+            return adjusted;
+        }
+
+#if NECESSARY
+        // If I read a time from a file with GetLastWriteTime() (etc), I need
+        // to adjust it for display in the .NET environment.
+        internal static DateTime AdjustTime_Forward(DateTime time)
+        {
+            if (time.Kind == DateTimeKind.Utc) return time;
+            DateTime adjusted = time;
+            if (DateTime.Now.IsDaylightSavingTime() && !time.IsDaylightSavingTime())
+                adjusted = time + new System.TimeSpan(1, 0, 0);
+
+            else if (!DateTime.Now.IsDaylightSavingTime() && time.IsDaylightSavingTime())
+                adjusted = time - new System.TimeSpan(1, 0, 0);
+
+            return adjusted;
+        }
+#endif
+
+
+        internal static DateTime PackedToDateTime(Int32 packedDateTime)
+        {
+            // workitem 7074 & workitem 7170
+            if (packedDateTime == 0xFFFF || packedDateTime == 0)
+                return new System.DateTime(1995, 1, 1, 0, 0, 0, 0);  // return a fixed date when none is supplied.
+
+            Int16 packedTime = unchecked((Int16)(packedDateTime & 0x0000ffff));
+            Int16 packedDate = unchecked((Int16)((packedDateTime & 0xffff0000) >> 16));
+
+            int year = 1980 + ((packedDate & 0xFE00) >> 9);
+            int month = (packedDate & 0x01E0) >> 5;
+            int day = packedDate & 0x001F;
+
+            int hour = (packedTime & 0xF800) >> 11;
+            int minute = (packedTime & 0x07E0) >> 5;
+            //int second = packedTime & 0x001F;
+            int second = (packedTime & 0x001F) * 2;
+
+            // validation and error checking.
+            // this is not foolproof but will catch most errors.
+            if (second >= 60) { minute++; second = 0; }
+            if (minute >= 60) { hour++; minute = 0; }
+            if (hour >= 24) { day++; hour = 0; }
+
+            DateTime d = System.DateTime.Now;
+            bool success= false;
+            try
+            {
+                d = new System.DateTime(year, month, day, hour, minute, second, 0);
+                success= true;
+            }
+            catch (System.ArgumentOutOfRangeException)
+            {
+                if (year == 1980 && (month == 0 || day == 0))
+                {
+                    try
+                    {
+                        d = new System.DateTime(1980, 1, 1, hour, minute, second, 0);
+                success= true;
+                    }
+                    catch (System.ArgumentOutOfRangeException)
+                    {
+                        try
+                        {
+                            d = new System.DateTime(1980, 1, 1, 0, 0, 0, 0);
+                success= true;
+                        }
+                        catch (System.ArgumentOutOfRangeException) { }
+
+                    }
+                }
+                // workitem 8814
+                // my god, I can't believe how many different ways applications
+                // can mess up a simple date format.
+                else
+                {
+                    try
+                    {
+                        while (year < 1980) year++;
+                        while (year > 2030) year--;
+                        while (month < 1) month++;
+                        while (month > 12) month--;
+                        while (day < 1) day++;
+                        while (day > 28) day--;
+                        while (minute < 0) minute++;
+                        while (minute > 59) minute--;
+                        while (second < 0) second++;
+                        while (second > 59) second--;
+                        d = new System.DateTime(year, month, day, hour, minute, second, 0);
+                        success= true;
+                    }
+                    catch (System.ArgumentOutOfRangeException) { }
+                }
+            }
+            if (!success)
+            {
+                string msg = String.Format("y({0}) m({1}) d({2}) h({3}) m({4}) s({5})", year, month, day, hour, minute, second);
+                throw new ZipException(String.Format("Bad date/time format in the zip file. ({0})", msg));
+
+            }
+            // workitem 6191
+            //d = AdjustTime_Reverse(d);
+            d = DateTime.SpecifyKind(d, DateTimeKind.Local);
+            return d;
+        }
+
+
+        internal
+         static Int32 DateTimeToPacked(DateTime time)
+        {
+            // The time is passed in here only for purposes of writing LastModified to the
+            // zip archive. It should always be LocalTime, but we convert anyway.  And,
+            // since the time is being written out, it needs to be adjusted.
+
+            time = time.ToLocalTime();
+            // workitem 7966
+            //time = AdjustTime_Forward(time);
+
+            // see http://www.vsft.com/hal/dostime.htm for the format
+            UInt16 packedDate = (UInt16)((time.Day & 0x0000001F) | ((time.Month << 5) & 0x000001E0) | (((time.Year - 1980) << 9) & 0x0000FE00));
+            UInt16 packedTime = (UInt16)((time.Second / 2 & 0x0000001F) | ((time.Minute << 5) & 0x000007E0) | ((time.Hour << 11) & 0x0000F800));
+
+            Int32 result = (Int32)(((UInt32)(packedDate << 16)) | packedTime);
+            return result;
+        }
+
+
+        /// <summary>
+        ///   Create a pseudo-random filename, suitable for use as a temporary
+        ///   file, and open it.
+        /// </summary>
+        /// <remarks>
+        /// <para>
+        ///   The System.IO.Path.GetRandomFileName() method is not available on
+        ///   the Compact Framework, so this library provides its own substitute
+        ///   on NETCF.
+        /// </para>
+        /// <para>
+        ///   This method produces a filename of the form
+        ///   DotNetZip-xxxxxxxx.tmp, where xxxxxxxx is replaced by randomly
+        ///   chosen characters, and creates that file.
+        /// </para>
+        /// </remarks>
+        public static void CreateAndOpenUniqueTempFile(string dir,
+                                                       out Stream fs,
+                                                       out string filename)
+        {
+            // workitem 9763
+            // http://dotnet.org.za/markn/archive/2006/04/15/51594.aspx
+            // try 3 times:
+            for (int i = 0; i < 3; i++)
+            {
+                try
+                {
+                    filename = Path.Combine(dir, InternalGetTempFileName());
+                    fs = new FileStream(filename, FileMode.CreateNew);
+                    return;
+                }
+                catch (IOException)
+                {
+                    if (i == 2) throw;
+                }
+            }
+            throw new IOException();
+        }
+
+#if NETCF || SILVERLIGHT
+        public static string InternalGetTempFileName()
+        {
+            return "DotNetZip-" + GenerateRandomStringImpl(8,0) + ".tmp";
+        }
+
+        internal static string GenerateRandomStringImpl(int length, int delta)
+        {
+            bool WantMixedCase = (delta == 0);
+            System.Random rnd = new System.Random();
+
+            string result = "";
+            char[] a = new char[length];
+
+            for (int i = 0; i < length; i++)
+            {
+               // delta == 65 means uppercase
+               // delta == 97 means lowercase
+                if (WantMixedCase)
+                    delta = (rnd.Next(2) == 0) ? 65 : 97;
+                a[i] = (char)(rnd.Next(26) + delta);
+            }
+
+            result = new System.String(a);
+            return result;
+        }
+#else
+        public static string InternalGetTempFileName()
+        {
+            return "DotNetZip-" + Path.GetRandomFileName().Substring(0, 8) + ".tmp";
+        }
+
+#endif
+
+
+        /// <summary>
+        /// Workitem 7889: handle ERROR_LOCK_VIOLATION during read
+        /// </summary>
+        /// <remarks>
+        /// This could be gracefully handled with an extension attribute, but
+        /// This assembly is built for .NET 2.0, so I cannot use them.
+        /// </remarks>
+        internal static int ReadWithRetry(System.IO.Stream s, byte[] buffer, int offset, int count, string FileName)
+        {
+            int n = 0;
+            bool done = false;
+#if !NETCF && !SILVERLIGHT
+            int retries = 0;
+#endif
+            do
+            {
+                try
+                {
+                    n = s.Read(buffer, offset, count);
+                    done = true;
+                }
+#if NETCF || SILVERLIGHT
+                catch (System.IO.IOException)
+                {
+                    throw;
+                }
+#else
+                catch (System.IO.IOException ioexc1)
+                {
+                    // Check if we can call GetHRForException,
+                    // which makes unmanaged code calls.
+                    var p = new SecurityPermission(SecurityPermissionFlag.UnmanagedCode);
+                    if (p.IsUnrestricted())
+                    {
+                        uint hresult = _HRForException(ioexc1);
+                        if (hresult != 0x80070021)  // ERROR_LOCK_VIOLATION
+                            throw new System.IO.IOException(String.Format("Cannot read file {0}", FileName), ioexc1);
+                        retries++;
+                        if (retries > 10)
+                            throw new System.IO.IOException(String.Format("Cannot read file {0}, at offset 0x{1:X8} after 10 retries", FileName, offset), ioexc1);
+
+                        // max time waited on last retry = 250 + 10*550 = 5.75s
+                        // aggregate time waited after 10 retries: 250 + 55*550 = 30.5s
+                        System.Threading.Thread.Sleep(250 + retries * 550);
+                    }
+                    else
+                    {
+                        // The permission.Demand() failed. Therefore, we cannot call
+                        // GetHRForException, and cannot do the subtle handling of
+                        // ERROR_LOCK_VIOLATION.  Just bail.
+                        throw;
+                    }
+                }
+#endif
+            }
+            while (!done);
+
+            return n;
+        }
+
+
+#if !NETCF
+        // workitem 8009
+        //
+        // This method must remain separate.
+        //
+        // Marshal.GetHRForException() is needed to do special exception handling for
+        // the read.  But, that method requires UnmanagedCode permissions, and is marked
+        // with LinkDemand for UnmanagedCode.  In an ASP.NET medium trust environment,
+        // where UnmanagedCode is restricted, will generate a SecurityException at the
+        // time of JIT of the method that calls a method that is marked with LinkDemand
+        // for UnmanagedCode. The SecurityException, if it is restricted, will occur
+        // when this method is JITed.
+        //
+        // The Marshal.GetHRForException() is factored out of ReadWithRetry in order to
+        // avoid the SecurityException at JIT compile time. Because _HRForException is
+        // called only when the UnmanagedCode is allowed.  This means .NET never
+        // JIT-compiles this method when UnmanagedCode is disallowed, and thus never
+        // generates the JIT-compile time exception.
+        //
+#endif
+        private static uint _HRForException(System.Exception ex1)
+        {
+            return unchecked((uint)System.Runtime.InteropServices.Marshal.GetHRForException(ex1));
+        }
+
+    }
+
+
+
+    /// <summary>
+    ///   A decorator stream. It wraps another stream, and performs bookkeeping
+    ///   to keep track of the stream Position.
+    /// </summary>
+    /// <remarks>
+    ///   <para>
+    ///     In some cases, it is not possible to get the Position of a stream, let's
+    ///     say, on a write-only output stream like ASP.NET's
+    ///     <c>Response.OutputStream</c>, or on a different write-only stream
+    ///     provided as the destination for the zip by the application.  In this
+    ///     case, programmers can use this counting stream to count the bytes read
+    ///     or written.
+    ///   </para>
+    ///   <para>
+    ///     Consider the scenario of an application that saves a self-extracting
+    ///     archive (SFX), that uses a custom SFX stub.
+    ///   </para>
+    ///   <para>
+    ///     Saving to a filesystem file, the application would open the
+    ///     filesystem file (getting a <c>FileStream</c>), save the custom sfx stub
+    ///     into it, and then call <c>ZipFile.Save()</c>, specifying the same
+    ///     FileStream. <c>ZipFile.Save()</c> does the right thing for the zipentry
+    ///     offsets, by inquiring the Position of the <c>FileStream</c> before writing
+    ///     any data, and then adding that initial offset into any ZipEntry
+    ///     offsets in the zip directory. Everything works fine.
+    ///   </para>
+    ///   <para>
+    ///     Now suppose the application is an ASPNET application and it saves
+    ///     directly to <c>Response.OutputStream</c>. It's not possible for DotNetZip to
+    ///     inquire the <c>Position</c>, so the offsets for the SFX will be wrong.
+    ///   </para>
+    ///   <para>
+    ///     The workaround is for the application to use this class to wrap
+    ///     <c>HttpResponse.OutputStream</c>, then write the SFX stub and the ZipFile
+    ///     into that wrapper stream. Because <c>ZipFile.Save()</c> can inquire the
+    ///     <c>Position</c>, it will then do the right thing with the offsets.
+    ///   </para>
+    /// </remarks>
+    internal class CountingStream : System.IO.Stream
+    {
+        // workitem 12374: this class is now public
+        private System.IO.Stream _s;
+        private Int64 _bytesWritten;
+        private Int64 _bytesRead;
+        private Int64 _initialOffset;
+
+        /// <summary>
+        /// The constructor.
+        /// </summary>
+        /// <param name="stream">The underlying stream</param>
+        public CountingStream(System.IO.Stream stream)
+            : base()
+        {
+            _s = stream;
+            try
+            {
+                _initialOffset = _s.Position;
+            }
+            catch
+            {
+                _initialOffset = 0L;
+            }
+        }
+
+        /// <summary>
+        ///   Gets the wrapped stream.
+        /// </summary>
+        public Stream WrappedStream
+        {
+            get
+            {
+                return _s;
+            }
+        }
+
+        /// <summary>
+        ///   The count of bytes written out to the stream.
+        /// </summary>
+        public Int64 BytesWritten
+        {
+            get { return _bytesWritten; }
+        }
+
+        /// <summary>
+        ///   the count of bytes that have been read from the stream.
+        /// </summary>
+        public Int64 BytesRead
+        {
+            get { return _bytesRead; }
+        }
+
+        /// <summary>
+        ///    Adjust the byte count on the stream.
+        /// </summary>
+        ///
+        /// <param name='delta'>
+        ///   the number of bytes to subtract from the count.
+        /// </param>
+        ///
+        /// <remarks>
+        ///   <para>
+        ///     Subtract delta from the count of bytes written to the stream.
+        ///     This is necessary when seeking back, and writing additional data,
+        ///     as happens in some cases when saving Zip files.
+        ///   </para>
+        /// </remarks>
+        public void Adjust(Int64 delta)
+        {
+            _bytesWritten -= delta;
+            if (_bytesWritten < 0)
+                throw new InvalidOperationException();
+            if (_s as CountingStream != null)
+                ((CountingStream)_s).Adjust(delta);
+        }
+
+        /// <summary>
+        ///   The read method.
+        /// </summary>
+        /// <param name="buffer">The buffer to hold the data read from the stream.</param>
+        /// <param name="offset">the offset within the buffer to copy the first byte read.</param>
+        /// <param name="count">the number of bytes to read.</param>
+        /// <returns>the number of bytes read, after decryption and decompression.</returns>
+        public override int Read(byte[] buffer, int offset, int count)
+        {
+            int n = _s.Read(buffer, offset, count);
+            _bytesRead += n;
+            return n;
+        }
+
+        /// <summary>
+        ///   Write data into the stream.
+        /// </summary>
+        /// <param name="buffer">The buffer holding data to write to the stream.</param>
+        /// <param name="offset">the offset within that data array to find the first byte to write.</param>
+        /// <param name="count">the number of bytes to write.</param>
+        public override void Write(byte[] buffer, int offset, int count)
+        {
+            if (count == 0) return;
+            _s.Write(buffer, offset, count);
+            _bytesWritten += count;
+        }
+
+        /// <summary>
+        ///   Whether the stream can be read.
+        /// </summary>
+        public override bool CanRead
+        {
+            get { return _s.CanRead; }
+        }
+
+        /// <summary>
+        ///   Whether it is possible to call Seek() on the stream.
+        /// </summary>
+        public override bool CanSeek
+        {
+            get { return _s.CanSeek; }
+        }
+
+        /// <summary>
+        ///   Whether it is possible to call Write() on the stream.
+        /// </summary>
+        public override bool CanWrite
+        {
+            get { return _s.CanWrite; }
+        }
+
+        /// <summary>
+        ///   Flushes the underlying stream.
+        /// </summary>
+        public override void Flush()
+        {
+            _s.Flush();
+        }
+
+        /// <summary>
+        ///   The length of the underlying stream.
+        /// </summary>
+        public override long Length
+        {
+            get { return _s.Length; }   // bytesWritten??
+        }
+
+        /// <summary>
+        ///   Returns the sum of number of bytes written, plus the initial
+        ///   offset before writing.
+        /// </summary>
+        public long ComputedPosition
+        {
+            get { return _initialOffset + _bytesWritten; }
+        }
+
+
+        /// <summary>
+        ///   The Position of the stream.
+        /// </summary>
+        public override long Position
+        {
+            get { return _s.Position; }
+            set
+            {
+                _s.Seek(value, System.IO.SeekOrigin.Begin);
+                // workitem 10178
+                Ionic.Zip.SharedUtilities.Workaround_Ladybug318918(_s);
+            }
+        }
+
+        /// <summary>
+        ///   Seek in the stream.
+        /// </summary>
+        /// <param name="offset">the offset point to seek to</param>
+        /// <param name="origin">the reference point from which to seek</param>
+        /// <returns>The new position</returns>
+        public override long Seek(long offset, System.IO.SeekOrigin origin)
+        {
+            return _s.Seek(offset, origin);
+        }
+
+        /// <summary>
+        ///   Set the length of the underlying stream.  Be careful with this!
+        /// </summary>
+        ///
+        /// <param name='value'>the length to set on the underlying stream.</param>
+        public override void SetLength(long value)
+        {
+            _s.SetLength(value);
+        }
+    }
+
+
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/WinZipAes.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/WinZipAes.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/WinZipAes.cs	(revision 12707)
@@ -0,0 +1,941 @@
+//#define Trace
+
+// WinZipAes.cs
+// ------------------------------------------------------------------
+//
+// Copyright (c) 2009-2011 Dino Chiesa.
+// All rights reserved.
+//
+// This code module is part of DotNetZip, a zipfile class library.
+//
+// ------------------------------------------------------------------
+//
+// This code is licensed under the Microsoft Public License.
+// See the file License.txt for the license details.
+// More info on: http://dotnetzip.codeplex.com
+//
+// ------------------------------------------------------------------
+//
+// last saved (in emacs):
+// Time-stamp: <2011-July-12 13:42:06>
+//
+// ------------------------------------------------------------------
+//
+// This module defines the classes for dealing with WinZip's AES encryption,
+// according to the specifications for the format available on WinZip's website.
+//
+// Created: January 2009
+//
+// ------------------------------------------------------------------
+
+using System;
+using System.IO;
+using System.Collections.Generic;
+using System.Security.Cryptography;
+
+#if AESCRYPTO
+namespace OfficeOpenXml.Packaging.Ionic.Zip
+{
+    /// <summary>
+    ///   This is a helper class supporting WinZip AES encryption.
+    ///   This class is intended for use only by the DotNetZip library.
+    /// </summary>
+    ///
+    /// <remarks>
+    ///   Most uses of the DotNetZip library will not involve direct calls into
+    ///   the WinZipAesCrypto class.  Instead, the WinZipAesCrypto class is
+    ///   instantiated and used by the ZipEntry() class when WinZip AES
+    ///   encryption or decryption on an entry is employed.
+    /// </remarks>
+    internal class WinZipAesCrypto
+    {
+        internal byte[] _Salt;
+        internal byte[] _providedPv;
+        internal byte[] _generatedPv;
+        internal int _KeyStrengthInBits;
+        private byte[] _MacInitializationVector;
+        private byte[] _StoredMac;
+        private byte[] _keyBytes;
+        private Int16 PasswordVerificationStored;
+        private Int16 PasswordVerificationGenerated;
+        private int Rfc2898KeygenIterations = 1000;
+        private string _Password;
+        private bool _cryptoGenerated ;
+
+        private WinZipAesCrypto(string password, int KeyStrengthInBits)
+        {
+            _Password = password;
+            _KeyStrengthInBits = KeyStrengthInBits;
+        }
+
+        public static WinZipAesCrypto Generate(string password, int KeyStrengthInBits)
+        {
+            WinZipAesCrypto c = new WinZipAesCrypto(password, KeyStrengthInBits);
+
+            int saltSizeInBytes = c._KeyStrengthInBytes / 2;
+            c._Salt = new byte[saltSizeInBytes];
+            Random rnd = new Random();
+            rnd.NextBytes(c._Salt);
+            return c;
+        }
+
+
+
+        public static WinZipAesCrypto ReadFromStream(string password, int KeyStrengthInBits, Stream s)
+        {
+            // from http://www.winzip.com/aes_info.htm
+            //
+            // Size(bytes)   Content
+            // -----------------------------------
+            // Variable      Salt value
+            // 2             Password verification value
+            // Variable      Encrypted file data
+            // 10            Authentication code
+            //
+            // ZipEntry.CompressedSize represents the size of all of those elements.
+
+            // salt size varies with key length:
+            //    128 bit key => 8 bytes salt
+            //    192 bits => 12 bytes salt
+            //    256 bits => 16 bytes salt
+
+            WinZipAesCrypto c = new WinZipAesCrypto(password, KeyStrengthInBits);
+
+            int saltSizeInBytes = c._KeyStrengthInBytes / 2;
+            c._Salt = new byte[saltSizeInBytes];
+            c._providedPv = new byte[2];
+
+            s.Read(c._Salt, 0, c._Salt.Length);
+            s.Read(c._providedPv, 0, c._providedPv.Length);
+
+            c.PasswordVerificationStored = (Int16)(c._providedPv[0] + c._providedPv[1] * 256);
+            if (password != null)
+            {
+                c.PasswordVerificationGenerated = (Int16)(c.GeneratedPV[0] + c.GeneratedPV[1] * 256);
+                if (c.PasswordVerificationGenerated != c.PasswordVerificationStored)
+                    throw new BadPasswordException("bad password");
+            }
+
+            return c;
+        }
+
+        public byte[] GeneratedPV
+        {
+            get
+            {
+                if (!_cryptoGenerated) _GenerateCryptoBytes();
+                return _generatedPv;
+            }
+        }
+
+
+        public byte[] Salt
+        {
+            get
+            {
+                return _Salt;
+            }
+        }
+
+
+        private int _KeyStrengthInBytes
+        {
+            get
+            {
+                return _KeyStrengthInBits / 8;
+
+            }
+        }
+
+        public int SizeOfEncryptionMetadata
+        {
+            get
+            {
+                // 10 bytes after, (n-10) before the compressed data
+                return _KeyStrengthInBytes / 2 + 10 + 2;
+            }
+        }
+
+        public string Password
+        {
+            set
+            {
+                _Password = value;
+                if (_Password != null)
+                {
+                    PasswordVerificationGenerated = (Int16)(GeneratedPV[0] + GeneratedPV[1] * 256);
+                    if (PasswordVerificationGenerated != PasswordVerificationStored)
+                        throw new Ionic.Zip.BadPasswordException();
+                }
+            }
+            private get
+            {
+                return _Password;
+            }
+        }
+
+
+        private void _GenerateCryptoBytes()
+        {
+            //Console.WriteLine(" provided password: '{0}'", _Password);
+
+            System.Security.Cryptography.Rfc2898DeriveBytes rfc2898 =
+                new System.Security.Cryptography.Rfc2898DeriveBytes(_Password, Salt, Rfc2898KeygenIterations);
+
+            _keyBytes = rfc2898.GetBytes(_KeyStrengthInBytes); // 16 or 24 or 32 ???
+            _MacInitializationVector = rfc2898.GetBytes(_KeyStrengthInBytes);
+            _generatedPv = rfc2898.GetBytes(2);
+
+            _cryptoGenerated = true;
+        }
+
+
+        public byte[] KeyBytes
+        {
+            get
+            {
+                if (!_cryptoGenerated) _GenerateCryptoBytes();
+                return _keyBytes;
+            }
+        }
+
+
+        public byte[] MacIv
+        {
+            get
+            {
+                if (!_cryptoGenerated) _GenerateCryptoBytes();
+                return _MacInitializationVector;
+            }
+        }
+
+        public byte[] CalculatedMac;
+
+
+        public void ReadAndVerifyMac(System.IO.Stream s)
+        {
+            bool invalid = false;
+
+            // read integrityCheckVector.
+            // caller must ensure that the file pointer is in the right spot!
+            _StoredMac = new byte[10];  // aka "authentication code"
+            s.Read(_StoredMac, 0, _StoredMac.Length);
+
+            if (_StoredMac.Length != CalculatedMac.Length)
+                invalid = true;
+
+            if (!invalid)
+            {
+                for (int i = 0; i < _StoredMac.Length; i++)
+                {
+                    if (_StoredMac[i] != CalculatedMac[i])
+                        invalid = true;
+                }
+            }
+
+            if (invalid)
+                throw new Ionic.Zip.BadStateException("The MAC does not match.");
+        }
+
+    }
+
+
+    #region DONT_COMPILE_BUT_KEEP_FOR_POTENTIAL_FUTURE_USE
+#if NO
+    internal class Util
+    {
+        private static void _Format(System.Text.StringBuilder sb1,
+                                    byte[] b,
+                                    int offset,
+                                    int length)
+        {
+
+            System.Text.StringBuilder sb2 = new System.Text.StringBuilder();
+            sb1.Append("0000    ");
+            int i;
+            for (i = 0; i < length; i++)
+            {
+                int x = offset+i;
+                if (i != 0 && i % 16 == 0)
+                {
+                    sb1.Append("    ")
+                        .Append(sb2)
+                        .Append("\n")
+                        .Append(String.Format("{0:X4}    ", i));
+                    sb2.Remove(0,sb2.Length);
+                }
+                sb1.Append(System.String.Format("{0:X2} ", b[x]));
+                if (b[x] >=32 && b[x] <= 126)
+                    sb2.Append((char)b[x]);
+                else
+                    sb2.Append(".");
+            }
+            if (sb2.Length > 0)
+            {
+                sb1.Append(new String(' ', ((16 - i%16) * 3) + 4))
+                    .Append(sb2);
+            }
+        }
+
+
+
+        internal static string FormatByteArray(byte[] b, int limit)
+        {
+            System.Text.StringBuilder sb1 = new System.Text.StringBuilder();
+
+            if ((limit * 2 > b.Length) || limit == 0)
+            {
+                _Format(sb1, b, 0, b.Length);
+            }
+            else
+            {
+                // first N bytes of the buffer
+                _Format(sb1, b, 0, limit);
+
+                if (b.Length > limit * 2)
+                    sb1.Append(String.Format("\n   ...({0} other bytes here)....\n", b.Length - limit * 2));
+
+                // last N bytes of the buffer
+                _Format(sb1, b, b.Length - limit, limit);
+            }
+
+            return sb1.ToString();
+        }
+
+
+        internal static string FormatByteArray(byte[] b)
+        {
+            return FormatByteArray(b, 0);
+        }
+    }
+
+#endif
+    #endregion
+
+
+
+
+    /// <summary>
+    ///   A stream that encrypts as it writes, or decrypts as it reads.  The
+    ///   Crypto is AES in CTR (counter) mode, which is compatible with the AES
+    ///   encryption employed by WinZip 12.0.
+    /// </summary>
+    /// <remarks>
+    ///   <para>
+    ///     The AES/CTR encryption protocol used by WinZip works like this:
+    ///
+    ///       - start with a counter, initialized to zero.
+    ///
+    ///       - to encrypt, take the data by 16-byte blocks. For each block:
+    ///         - apply the transform to the counter
+    ///         - increement the counter
+    ///         - XOR the result of the transform with the plaintext to
+    ///           get the ciphertext.
+    ///         - compute the mac on the encrypted bytes
+    ///       - when finished with all blocks, store the computed MAC.
+    ///
+    ///       - to decrypt, take the data by 16-byte blocks. For each block:
+    ///         - compute the mac on the encrypted bytes,
+    ///         - apply the transform to the counter
+    ///         - increement the counter
+    ///         - XOR the result of the transform with the ciphertext to
+    ///           get the plaintext.
+    ///       - when finished with all blocks, compare the computed MAC against
+    ///         the stored MAC
+    ///
+    ///   </para>
+    /// </remarks>
+    //
+    internal class WinZipAesCipherStream : Stream
+    {
+        private WinZipAesCrypto _params;
+        private System.IO.Stream _s;
+        private CryptoMode _mode;
+        private int _nonce;
+        private bool _finalBlock;
+
+        internal HMACSHA1 _mac;
+
+        // Use RijndaelManaged from .NET 2.0.
+        // AesManaged came in .NET 3.5, but we want to limit
+        // dependency to .NET 2.0.  AES is just a restricted form
+        // of Rijndael (fixed block size of 128, some crypto modes not supported).
+
+        internal RijndaelManaged _aesCipher;
+        internal ICryptoTransform _xform;
+
+        private const int BLOCK_SIZE_IN_BYTES = 16;
+
+        private byte[] counter = new byte[BLOCK_SIZE_IN_BYTES];
+        private byte[] counterOut = new byte[BLOCK_SIZE_IN_BYTES];
+
+        // I've had a problem when wrapping a WinZipAesCipherStream inside
+        // a DeflateStream. Calling Read() on the DeflateStream results in
+        // a Read() on the WinZipAesCipherStream, but the buffer is larger
+        // than the total size of the encrypted data, and larger than the
+        // initial Read() on the DeflateStream!  When the encrypted
+        // bytestream is embedded within a larger stream (As in a zip
+        // archive), the Read() doesn't fail with EOF.  This causes bad
+        // data to be returned, and it messes up the MAC.
+
+        // This field is used to provide a hard-stop to the size of
+        // data that can be read from the stream.  In Read(), if the buffer or
+        // read request goes beyond the stop, we truncate it.
+
+        private long _length;
+        private long _totalBytesXferred;
+        private byte[] _PendingWriteBlock;
+        private int _pendingCount;
+        private byte[] _iobuf;
+
+        /// <summary>
+        /// The constructor.
+        /// </summary>
+        /// <param name="s">The underlying stream</param>
+        /// <param name="mode">To either encrypt or decrypt.</param>
+        /// <param name="cryptoParams">The pre-initialized WinZipAesCrypto object.</param>
+        /// <param name="length">The maximum number of bytes to read from the stream.</param>
+        internal WinZipAesCipherStream(System.IO.Stream s, WinZipAesCrypto cryptoParams, long length, CryptoMode mode)
+            : this(s, cryptoParams, mode)
+        {
+            // don't read beyond this limit!
+            _length = length;
+            //Console.WriteLine("max length of AES stream: {0}", _length);
+        }
+
+
+#if WANT_TRACE
+            Stream untransformed;
+        String traceFileUntransformed;
+        Stream transformed;
+        String traceFileTransformed;
+#endif
+
+
+        internal WinZipAesCipherStream(System.IO.Stream s, WinZipAesCrypto cryptoParams, CryptoMode mode)
+            : base()
+        {
+            TraceOutput("-------------------------------------------------------");
+            TraceOutput("Create {0:X8}", this.GetHashCode());
+
+            _params = cryptoParams;
+            _s = s;
+            _mode = mode;
+            _nonce = 1;
+
+            if (_params == null)
+                throw new BadPasswordException("Supply a password to use AES encryption.");
+
+            int keySizeInBits = _params.KeyBytes.Length * 8;
+            if (keySizeInBits != 256 && keySizeInBits != 128 && keySizeInBits != 192)
+                throw new ArgumentOutOfRangeException("keysize",
+                                                      "size of key must be 128, 192, or 256");
+
+            _mac = new HMACSHA1(_params.MacIv);
+
+            _aesCipher = new System.Security.Cryptography.RijndaelManaged();
+            _aesCipher.BlockSize = 128;
+            _aesCipher.KeySize = keySizeInBits;  // 128, 192, 256
+            _aesCipher.Mode = CipherMode.ECB;
+            _aesCipher.Padding = PaddingMode.None;
+
+            byte[] iv = new byte[BLOCK_SIZE_IN_BYTES]; // all zeroes
+
+            // Create an ENCRYPTOR, regardless whether doing decryption or encryption.
+            // It is reflexive.
+            _xform = _aesCipher.CreateEncryptor(_params.KeyBytes, iv);
+
+            if (_mode == CryptoMode.Encrypt)
+            {
+                _iobuf = new byte[2048];
+                _PendingWriteBlock = new byte[BLOCK_SIZE_IN_BYTES];
+            }
+
+
+#if WANT_TRACE
+                traceFileUntransformed = "unpack\\WinZipAesCipherStream.trace.untransformed.out";
+            traceFileTransformed = "unpack\\WinZipAesCipherStream.trace.transformed.out";
+
+            untransformed = System.IO.File.Create(traceFileUntransformed);
+            transformed = System.IO.File.Create(traceFileTransformed);
+#endif
+        }
+
+        private void XorInPlace(byte[] buffer, int offset, int count)
+        {
+            for (int i = 0; i < count; i++)
+            {
+                buffer[offset + i] = (byte)(counterOut[i] ^ buffer[offset + i]);
+            }
+        }
+
+        private void WriteTransformOneBlock(byte[] buffer, int offset)
+        {
+            System.Array.Copy(BitConverter.GetBytes(_nonce++), 0, counter, 0, 4);
+            _xform.TransformBlock(counter,
+                                  0,
+                                  BLOCK_SIZE_IN_BYTES,
+                                  counterOut,
+                                  0);
+            XorInPlace(buffer, offset, BLOCK_SIZE_IN_BYTES);
+            _mac.TransformBlock(buffer, offset, BLOCK_SIZE_IN_BYTES, null, 0);
+        }
+
+
+        private void WriteTransformBlocks(byte[] buffer, int offset, int count)
+        {
+            int posn = offset;
+            int last = count + offset;
+
+            while (posn < buffer.Length && posn < last)
+            {
+                WriteTransformOneBlock (buffer, posn);
+                posn += BLOCK_SIZE_IN_BYTES;
+            }
+        }
+
+
+        private void WriteTransformFinalBlock()
+        {
+            if (_pendingCount == 0)
+                throw new InvalidOperationException("No bytes available.");
+
+            if (_finalBlock)
+                throw new InvalidOperationException("The final block has already been transformed.");
+
+            System.Array.Copy(BitConverter.GetBytes(_nonce++), 0, counter, 0, 4);
+            counterOut = _xform.TransformFinalBlock(counter,
+                                                    0,
+                                                    BLOCK_SIZE_IN_BYTES);
+            XorInPlace(_PendingWriteBlock, 0, _pendingCount);
+            _mac.TransformFinalBlock(_PendingWriteBlock, 0, _pendingCount);
+            _finalBlock = true;
+        }
+
+
+
+
+
+        private int ReadTransformOneBlock(byte[] buffer, int offset, int last)
+        {
+            if (_finalBlock)
+                throw new NotSupportedException();
+
+            int bytesRemaining = last - offset;
+            int bytesToRead = (bytesRemaining > BLOCK_SIZE_IN_BYTES)
+                ? BLOCK_SIZE_IN_BYTES
+                : bytesRemaining;
+
+            // update the counter
+            System.Array.Copy(BitConverter.GetBytes(_nonce++), 0, counter, 0, 4);
+
+            // Determine if this is the final block
+            if ((bytesToRead == bytesRemaining) &&
+                (_length > 0) &&
+                (_totalBytesXferred + last == _length))
+            {
+                _mac.TransformFinalBlock(buffer, offset, bytesToRead);
+                counterOut = _xform.TransformFinalBlock(counter,
+                                                        0,
+                                                        BLOCK_SIZE_IN_BYTES);
+                _finalBlock = true;
+            }
+            else
+            {
+                _mac.TransformBlock(buffer, offset, bytesToRead, null, 0);
+                _xform.TransformBlock(counter,
+                                      0, // offset
+                                      BLOCK_SIZE_IN_BYTES,
+                                      counterOut,
+                                      0);  // offset
+            }
+
+            XorInPlace(buffer, offset, bytesToRead);
+            return bytesToRead;
+        }
+
+
+
+        private void ReadTransformBlocks(byte[] buffer, int offset, int count)
+        {
+            int posn = offset;
+            int last = count + offset;
+
+            while (posn < buffer.Length && posn < last )
+            {
+                int n = ReadTransformOneBlock (buffer, posn, last);
+                posn += n;
+            }
+        }
+
+
+
+        public override int Read(byte[] buffer, int offset, int count)
+        {
+            if (_mode == CryptoMode.Encrypt)
+                throw new NotSupportedException();
+
+            if (buffer == null)
+                throw new ArgumentNullException("buffer");
+
+            if (offset < 0)
+                throw new ArgumentOutOfRangeException("offset",
+                                                      "Must not be less than zero.");
+            if (count < 0)
+                throw new ArgumentOutOfRangeException("count",
+                                                      "Must not be less than zero.");
+
+            if (buffer.Length < offset + count)
+                throw new ArgumentException("The buffer is too small");
+
+            // When I wrap a WinZipAesStream in a DeflateStream, the
+            // DeflateStream asks its captive to read 4k blocks, even if the
+            // encrypted bytestream is smaller than that.  This is a way to
+            // limit the number of bytes read.
+
+            int bytesToRead = count;
+
+            if (_totalBytesXferred >= _length)
+            {
+                return 0; // EOF
+            }
+
+            long bytesRemaining = _length - _totalBytesXferred;
+            if (bytesRemaining < count) bytesToRead = (int)bytesRemaining;
+
+            int n = _s.Read(buffer, offset, bytesToRead);
+
+
+#if WANT_TRACE
+                untransformed.Write(buffer, offset, bytesToRead);
+#endif
+
+            ReadTransformBlocks(buffer, offset, bytesToRead);
+
+#if WANT_TRACE
+                transformed.Write(buffer, offset, bytesToRead);
+#endif
+            _totalBytesXferred += n;
+            return n;
+        }
+
+
+
+        /// <summary>
+        /// Returns the final HMAC-SHA1-80 for the data that was encrypted.
+        /// </summary>
+        public byte[] FinalAuthentication
+        {
+            get
+            {
+                if (!_finalBlock)
+                {
+                    // special-case zero-byte files
+                    if ( _totalBytesXferred != 0)
+                        throw new BadStateException("The final hash has not been computed.");
+
+                    // Must call ComputeHash on an empty byte array when no data
+                    // has run through the MAC.
+
+                    byte[] b = {  };
+                    _mac.ComputeHash(b);
+                    // fall through
+                }
+                byte[] macBytes10 = new byte[10];
+                System.Array.Copy(_mac.Hash, 0, macBytes10, 0, 10);
+                return macBytes10;
+            }
+        }
+
+
+        public override void Write(byte[] buffer, int offset, int count)
+        {
+            if (_finalBlock)
+                throw new InvalidOperationException("The final block has already been transformed.");
+
+            if (_mode == CryptoMode.Decrypt)
+                throw new NotSupportedException();
+
+            if (buffer == null)
+                throw new ArgumentNullException("buffer");
+
+            if (offset < 0)
+                throw new ArgumentOutOfRangeException("offset",
+                                                      "Must not be less than zero.");
+            if (count < 0)
+                throw new ArgumentOutOfRangeException("count",
+                                                      "Must not be less than zero.");
+            if (buffer.Length < offset + count)
+                throw new ArgumentException("The offset and count are too large");
+
+            if (count == 0)
+                return;
+
+            TraceOutput("Write off({0}) count({1})", offset, count);
+
+#if WANT_TRACE
+            untransformed.Write(buffer, offset, count);
+#endif
+
+            // For proper AES encryption, an AES encryptor application calls
+            // TransformBlock repeatedly for all 16-byte blocks except the
+            // last. For the last block, it then calls TransformFinalBlock().
+            //
+            // This class is a stream that encrypts via Write().  But, it's not
+            // possible to recognize which are the "last" bytes from within the call
+            // to Write(). The caller can call Write() several times in succession,
+            // with varying buffers. This class only "knows" that the last bytes
+            // have been written when the app calls Close().
+            //
+            // Therefore, this class buffers writes: After completion every Write(),
+            // a 16-byte "pending" block (_PendingWriteBlock) must hold between 1
+            // and 16 bytes, which will be used in TransformFinalBlock if the app
+            // calls Close() immediately thereafter. Also, every write must
+            // transform any pending bytes, before transforming the data passed in
+            // to the current call.
+            //
+            // In operation, after the first call to Write() and before the call to
+            // Close(), one full or partial block of bytes is always available,
+            // pending.  At time of Close(), this class calls
+            // WriteTransformFinalBlock() to flush the pending bytes.
+            //
+            // This approach works whether the caller writes in odd-sized batches,
+            // for example 5000 bytes, or in batches that are neat multiples of the
+            // blocksize (16).
+            //
+            // Logicaly, what we do is this:
+            //
+            //  1. if there are fewer than 16 bytes (pending + current), then
+            //     just copy them into th pending buffer and return.
+            //
+            //  2. there are more than 16 bytes to write. So, take the leading slice
+            //     of bytes from the current buffer, enough to fill the pending
+            //     buffer. Transform the pending block, and write it out.
+            //
+            //  3. Take the trailing slice of bytes (a full block or a partial block),
+            //     and copy it to the pending block for next time.
+            //
+            //  4. transform and write all the other blocks, the middle slice.
+            //
+
+            // There are 16 or fewer bytes, so just buffer the bytes.
+            if (count + _pendingCount <= BLOCK_SIZE_IN_BYTES)
+            {
+                Buffer.BlockCopy(buffer,
+                                 offset,
+                                 _PendingWriteBlock,
+                                 _pendingCount,
+                                 count);
+                _pendingCount += count;
+
+                // At this point, _PendingWriteBlock contains up to
+                // BLOCK_SIZE_IN_BYTES bytes, and _pendingCount ranges from 0 to
+                // BLOCK_SIZE_IN_BYTES. We don't want to xform+write them yet,
+                // because this may have been the last block.  The last block gets
+                // written at Close().
+                return;
+            }
+
+            // We know there are at least 17 bytes, counting those in the current
+            // buffer, along with the (possibly empty) pending block.
+
+            int bytesRemaining = count;
+            int curOffset = offset;
+
+            // workitem 12815
+            //
+            // xform chunkwise ... Cannot transform in place using the original
+            // buffer because that is user-maintained.
+
+            if (_pendingCount != 0)
+            {
+                // We have more than one block of data to write, therefore it is safe
+                // to xform+write.
+                int fillCount = BLOCK_SIZE_IN_BYTES - _pendingCount;
+
+                // fillCount is possibly zero here. That happens when the pending
+                // buffer held 16 bytes (one complete block) before this call to
+                // Write.
+                if (fillCount > 0)
+                {
+                    Buffer.BlockCopy(buffer,
+                                     offset,
+                                     _PendingWriteBlock,
+                                     _pendingCount,
+                                     fillCount);
+
+                    // adjust counts:
+                    bytesRemaining -= fillCount;
+                    curOffset += fillCount;
+                }
+
+                // xform and write:
+                WriteTransformOneBlock(_PendingWriteBlock, 0);
+                _s.Write(_PendingWriteBlock, 0, BLOCK_SIZE_IN_BYTES);
+                _totalBytesXferred += BLOCK_SIZE_IN_BYTES;
+                _pendingCount = 0;
+            }
+
+            // At this point _PendingWriteBlock is empty, and bytesRemaining is
+            // always greater than 0.
+
+            // Now, xform N blocks, where N = floor((bytesRemaining-1)/16).  If
+            // writing 32 bytes, then xform 1 block, and stage the remaining 16.  If
+            // writing 10037 bytes, xform 627 blocks of 16 bytes, then stage the
+            // remaining 5 bytes.
+
+            int blocksToXform = (bytesRemaining-1)/BLOCK_SIZE_IN_BYTES;
+            _pendingCount = bytesRemaining - (blocksToXform * BLOCK_SIZE_IN_BYTES);
+
+            // _pendingCount is ALWAYS between 1 and 16.
+            // Put the last _pendingCount bytes into the pending block.
+            Buffer.BlockCopy(buffer,
+                             curOffset + bytesRemaining - _pendingCount,
+                             _PendingWriteBlock,
+                             0,
+                             _pendingCount);
+            bytesRemaining -= _pendingCount;
+            _totalBytesXferred += bytesRemaining; // will be true after the loop
+
+            // now, transform all the full blocks preceding that.
+            // bytesRemaining is always a multiple of 16 .
+            if (blocksToXform > 0)
+            {
+                do
+                {
+                    int c = _iobuf.Length;
+                    if (c > bytesRemaining) c = bytesRemaining;
+                    Buffer.BlockCopy(buffer,
+                                     curOffset,
+                                     _iobuf,
+                                     0,
+                                     c);
+
+                    WriteTransformBlocks(_iobuf, 0, c);
+                    _s.Write(_iobuf, 0, c);
+                    bytesRemaining -= c;
+                    curOffset += c;
+                } while(bytesRemaining > 0);
+            }
+        }
+
+
+
+        /// <summary>
+        ///   Close the stream.
+        /// </summary>
+        public override void Close()
+        {
+            TraceOutput("Close {0:X8}", this.GetHashCode());
+
+            // In the degenerate case, no bytes have been written to the
+            // stream at all.  Need to check here, and NOT emit the
+            // final block if Write has not been called.
+            if (_pendingCount > 0)
+            {
+                WriteTransformFinalBlock();
+                _s.Write(_PendingWriteBlock, 0, _pendingCount);
+                _totalBytesXferred += _pendingCount;
+                _pendingCount = 0;
+            }
+            _s.Close();
+
+#if WANT_TRACE
+            untransformed.Close();
+            transformed.Close();
+            Console.WriteLine("\nuntransformed bytestream is in  {0}", traceFileUntransformed);
+            Console.WriteLine("\ntransformed bytestream is in  {0}", traceFileTransformed);
+#endif
+            TraceOutput("-------------------------------------------------------");
+        }
+
+
+        /// <summary>
+        /// Returns true if the stream can be read.
+        /// </summary>
+        public override bool CanRead
+        {
+            get
+            {
+                if (_mode != CryptoMode.Decrypt) return false;
+                return true;
+            }
+        }
+
+
+        /// <summary>
+        /// Always returns false.
+        /// </summary>
+        public override bool CanSeek
+        {
+            get { return false; }
+        }
+
+        /// <summary>
+        /// Returns true if the CryptoMode is Encrypt.
+        /// </summary>
+        public override bool CanWrite
+        {
+            get { return (_mode == CryptoMode.Encrypt); }
+        }
+
+        /// <summary>
+        /// Flush the content in the stream.
+        /// </summary>
+        public override void Flush()
+        {
+            _s.Flush();
+        }
+
+        /// <summary>
+        /// Getting this property throws a NotImplementedException.
+        /// </summary>
+        public override long Length
+        {
+            get { throw new NotImplementedException(); }
+        }
+
+        /// <summary>
+        /// Getting or Setting this property throws a NotImplementedException.
+        /// </summary>
+        public override long Position
+        {
+            get { throw new NotImplementedException(); }
+            set { throw new NotImplementedException(); }
+        }
+
+        /// <summary>
+        /// This method throws a NotImplementedException.
+        /// </summary>
+        public override long Seek(long offset, System.IO.SeekOrigin origin)
+        {
+            throw new NotImplementedException();
+        }
+
+        /// <summary>
+        /// This method throws a NotImplementedException.
+        /// </summary>
+        public override void SetLength(long value)
+        {
+            throw new NotImplementedException();
+        }
+
+
+
+        [System.Diagnostics.ConditionalAttribute("Trace")]
+        private void TraceOutput(string format, params object[] varParams)
+        {
+            lock(_outputLock)
+            {
+                int tid = System.Threading.Thread.CurrentThread.GetHashCode();
+                Console.ForegroundColor = (ConsoleColor) (tid % 8 + 8);
+                Console.Write("{0:000} WZACS ", tid);
+                Console.WriteLine(format, varParams);
+                Console.ResetColor();
+            }
+        }
+
+        private object _outputLock = new Object();
+    }
+}
+#endif
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ZipConstants.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ZipConstants.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ZipConstants.cs	(revision 12707)
@@ -0,0 +1,51 @@
+// ZipConstants.cs
+// ------------------------------------------------------------------
+//
+// Copyright (c) 2006, 2007, 2008, 2009 Dino Chiesa and Microsoft Corporation.  
+// All rights reserved.
+//
+// This code module is part of DotNetZip, a zipfile class library.
+//
+// ------------------------------------------------------------------
+//
+// This code is licensed under the Microsoft Public License. 
+// See the file License.txt for the license details.
+// More info on: http://dotnetzip.codeplex.com
+//
+// ------------------------------------------------------------------
+//
+// last saved (in emacs): 
+// Time-stamp: <2009-August-27 23:22:32>
+//
+// ------------------------------------------------------------------
+//
+// This module defines a few constants that are used in the project. 
+//
+// ------------------------------------------------------------------
+
+using System;
+
+namespace OfficeOpenXml.Packaging.Ionic.Zip
+{
+  static class ZipConstants
+  {      
+    public const UInt32 PackedToRemovableMedia = 0x30304b50;
+    public const UInt32 Zip64EndOfCentralDirectoryRecordSignature = 0x06064b50;
+    public const UInt32 Zip64EndOfCentralDirectoryLocatorSignature = 0x07064b50;
+    public const UInt32 EndOfCentralDirectorySignature = 0x06054b50;
+    public const int ZipEntrySignature                 = 0x04034b50;
+    public const int ZipEntryDataDescriptorSignature   = 0x08074b50;
+    public const int SplitArchiveSignature             = 0x08074b50;
+    public const int ZipDirEntrySignature              = 0x02014b50;
+
+      
+    // These are dictated by the Zip Spec.See APPNOTE.txt
+    public const int AesKeySize = 192;  // 128, 192, 256
+    public const int AesBlockSize = 128;  // ???
+
+    public const UInt16 AesAlgId128 = 0x660E; 
+    public const UInt16 AesAlgId192 = 0x660F; 
+    public const UInt16 AesAlgId256 = 0x6610; 
+
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ZipCrypto.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ZipCrypto.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ZipCrypto.cs	(revision 12707)
@@ -0,0 +1,455 @@
+// ZipCrypto.cs
+// ------------------------------------------------------------------
+//
+// Copyright (c) 2008, 2009, 2011 Dino Chiesa
+// All rights reserved.
+//
+// This code module is part of DotNetZip, a zipfile class library.
+//
+// ------------------------------------------------------------------
+//
+// This code is licensed under the Microsoft Public License.
+// See the file License.txt for the license details.
+// More info on: http://dotnetzip.codeplex.com
+//
+// ------------------------------------------------------------------
+//
+// last saved (in emacs):
+// Time-stamp: <2011-July-28 06:30:59>
+//
+// ------------------------------------------------------------------
+//
+// This module provides the implementation for "traditional" Zip encryption.
+//
+// Created Tue Apr 15 17:39:56 2008
+//
+// ------------------------------------------------------------------
+
+using System;
+
+namespace OfficeOpenXml.Packaging.Ionic.Zip
+{
+    /// <summary>
+    ///   This class implements the "traditional" or "classic" PKZip encryption,
+    ///   which today is considered to be weak. On the other hand it is
+    ///   ubiquitous. This class is intended for use only by the DotNetZip
+    ///   library.
+    /// </summary>
+    ///
+    /// <remarks>
+    ///   Most uses of the DotNetZip library will not involve direct calls into
+    ///   the ZipCrypto class.  Instead, the ZipCrypto class is instantiated and
+    ///   used by the ZipEntry() class when encryption or decryption on an entry
+    ///   is employed.  If for some reason you really wanted to use a weak
+    ///   encryption algorithm in some other application, you might use this
+    ///   library.  But you would be much better off using one of the built-in
+    ///   strong encryption libraries in the .NET Framework, like the AES
+    ///   algorithm or SHA.
+    /// </remarks>
+    internal class ZipCrypto
+    {
+        /// <summary>
+        ///   The default constructor for ZipCrypto.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///   This class is intended for internal use by the library only. It's
+        ///   probably not useful to you. Seriously.  Stop reading this
+        ///   documentation.  It's a waste of your time.  Go do something else.
+        ///   Check the football scores. Go get an ice cream with a friend.
+        ///   Seriously.
+        /// </remarks>
+        ///
+        private ZipCrypto() { }
+
+        public static ZipCrypto ForWrite(string password)
+        {
+            ZipCrypto z = new ZipCrypto();
+            if (password == null)
+                throw new BadPasswordException("This entry requires a password.");
+            z.InitCipher(password);
+            return z;
+        }
+
+
+        public static ZipCrypto ForRead(string password, ZipEntry e)
+        {
+            System.IO.Stream s = e._archiveStream;
+            e._WeakEncryptionHeader = new byte[12];
+            byte[] eh = e._WeakEncryptionHeader;
+            ZipCrypto z = new ZipCrypto();
+
+            if (password == null)
+                throw new BadPasswordException("This entry requires a password.");
+
+            z.InitCipher(password);
+
+            ZipEntry.ReadWeakEncryptionHeader(s, eh);
+
+            // Decrypt the header.  This has a side effect of "further initializing the
+            // encryption keys" in the traditional zip encryption.
+            byte[] DecryptedHeader = z.DecryptMessage(eh, eh.Length);
+
+            // CRC check
+            // According to the pkzip spec, the final byte in the decrypted header
+            // is the highest-order byte in the CRC. We check it here.
+            if (DecryptedHeader[11] != (byte)((e._Crc32 >> 24) & 0xff))
+            {
+                // In the case that bit 3 of the general purpose bit flag is set to
+                // indicate the presence of an 'Extended File Header' or a 'data
+                // descriptor' (signature 0x08074b50), the last byte of the decrypted
+                // header is sometimes compared with the high-order byte of the
+                // lastmodified time, rather than the high-order byte of the CRC, to
+                // verify the password.
+                //
+                // This is not documented in the PKWare Appnote.txt.  It was
+                // discovered this by analysis of the Crypt.c source file in the
+                // InfoZip library http://www.info-zip.org/pub/infozip/
+                //
+                // The reason for this is that the CRC for a file cannot be known
+                // until the entire contents of the file have been streamed. This
+                // means a tool would have to read the file content TWICE in its
+                // entirety in order to perform PKZIP encryption - once to compute
+                // the CRC, and again to actually encrypt.
+                //
+                // This is so important for performance that using the timeblob as
+                // the verification should be the standard practice for DotNetZip
+                // when using PKZIP encryption. This implies that bit 3 must be
+                // set. The downside is that some tools still cannot cope with ZIP
+                // files that use bit 3.  Therefore, DotNetZip DOES NOT force bit 3
+                // when PKZIP encryption is in use, and instead, reads the stream
+                // twice.
+                //
+
+                if ((e._BitField & 0x0008) != 0x0008)
+                {
+                    throw new BadPasswordException("The password did not match.");
+                }
+                else if (DecryptedHeader[11] != (byte)((e._TimeBlob >> 8) & 0xff))
+                {
+                    throw new BadPasswordException("The password did not match.");
+                }
+
+                // We have a good password.
+            }
+            else
+            {
+                // A-OK
+            }
+            return z;
+        }
+
+
+
+
+        /// <summary>
+        /// From AppNote.txt:
+        /// unsigned char decrypt_byte()
+        ///     local unsigned short temp
+        ///     temp :=- Key(2) | 2
+        ///     decrypt_byte := (temp * (temp ^ 1)) bitshift-right 8
+        /// end decrypt_byte
+        /// </summary>
+        private byte MagicByte
+        {
+            get
+            {
+                UInt16 t = (UInt16)((UInt16)(_Keys[2] & 0xFFFF) | 2);
+                return (byte)((t * (t ^ 1)) >> 8);
+            }
+        }
+
+        // Decrypting:
+        // From AppNote.txt:
+        // loop for i from 0 to 11
+        //     C := buffer(i) ^ decrypt_byte()
+        //     update_keys(C)
+        //     buffer(i) := C
+        // end loop
+
+
+        /// <summary>
+        ///   Call this method on a cipher text to render the plaintext. You must
+        ///   first initialize the cipher with a call to InitCipher.
+        /// </summary>
+        ///
+        /// <example>
+        ///   <code>
+        ///     var cipher = new ZipCrypto();
+        ///     cipher.InitCipher(Password);
+        ///     // Decrypt the header.  This has a side effect of "further initializing the
+        ///     // encryption keys" in the traditional zip encryption.
+        ///     byte[] DecryptedMessage = cipher.DecryptMessage(EncryptedMessage);
+        ///   </code>
+        /// </example>
+        ///
+        /// <param name="cipherText">The encrypted buffer.</param>
+        /// <param name="length">
+        ///   The number of bytes to encrypt.
+        ///   Should be less than or equal to CipherText.Length.
+        /// </param>
+        ///
+        /// <returns>The plaintext.</returns>
+        public byte[] DecryptMessage(byte[] cipherText, int length)
+        {
+            if (cipherText == null)
+                throw new ArgumentNullException("cipherText");
+
+            if (length > cipherText.Length)
+                throw new ArgumentOutOfRangeException("length",
+                                                      "Bad length during Decryption: the length parameter must be smaller than or equal to the size of the destination array.");
+
+            byte[] plainText = new byte[length];
+            for (int i = 0; i < length; i++)
+            {
+                byte C = (byte)(cipherText[i] ^ MagicByte);
+                UpdateKeys(C);
+                plainText[i] = C;
+            }
+            return plainText;
+        }
+
+        /// <summary>
+        ///   This is the converse of DecryptMessage.  It encrypts the plaintext
+        ///   and produces a ciphertext.
+        /// </summary>
+        ///
+        /// <param name="plainText">The plain text buffer.</param>
+        ///
+        /// <param name="length">
+        ///   The number of bytes to encrypt.
+        ///   Should be less than or equal to plainText.Length.
+        /// </param>
+        ///
+        /// <returns>The ciphertext.</returns>
+        public byte[] EncryptMessage(byte[] plainText, int length)
+        {
+            if (plainText == null)
+                throw new ArgumentNullException("plaintext");
+
+            if (length > plainText.Length)
+                throw new ArgumentOutOfRangeException("length",
+                                                      "Bad length during Encryption: The length parameter must be smaller than or equal to the size of the destination array.");
+
+            byte[] cipherText = new byte[length];
+            for (int i = 0; i < length; i++)
+            {
+                byte C = plainText[i];
+                cipherText[i] = (byte)(plainText[i] ^ MagicByte);
+                UpdateKeys(C);
+            }
+            return cipherText;
+        }
+
+
+        /// <summary>
+        ///   This initializes the cipher with the given password.
+        ///   See AppNote.txt for details.
+        /// </summary>
+        ///
+        /// <param name="passphrase">
+        ///   The passphrase for encrypting or decrypting with this cipher.
+        /// </param>
+        ///
+        /// <remarks>
+        /// <code>
+        /// Step 1 - Initializing the encryption keys
+        /// -----------------------------------------
+        /// Start with these keys:
+        /// Key(0) := 305419896 (0x12345678)
+        /// Key(1) := 591751049 (0x23456789)
+        /// Key(2) := 878082192 (0x34567890)
+        ///
+        /// Then, initialize the keys with a password:
+        ///
+        /// loop for i from 0 to length(password)-1
+        ///     update_keys(password(i))
+        /// end loop
+        ///
+        /// Where update_keys() is defined as:
+        ///
+        /// update_keys(char):
+        ///   Key(0) := crc32(key(0),char)
+        ///   Key(1) := Key(1) + (Key(0) bitwiseAND 000000ffH)
+        ///   Key(1) := Key(1) * 134775813 + 1
+        ///   Key(2) := crc32(key(2),key(1) rightshift 24)
+        /// end update_keys
+        ///
+        /// Where crc32(old_crc,char) is a routine that given a CRC value and a
+        /// character, returns an updated CRC value after applying the CRC-32
+        /// algorithm described elsewhere in this document.
+        ///
+        /// </code>
+        ///
+        /// <para>
+        ///   After the keys are initialized, then you can use the cipher to
+        ///   encrypt the plaintext.
+        /// </para>
+        ///
+        /// <para>
+        ///   Essentially we encrypt the password with the keys, then discard the
+        ///   ciphertext for the password. This initializes the keys for later use.
+        /// </para>
+        ///
+        /// </remarks>
+        public void InitCipher(string passphrase)
+        {
+            byte[] p = SharedUtilities.StringToByteArray(passphrase);
+            for (int i = 0; i < passphrase.Length; i++)
+                UpdateKeys(p[i]);
+        }
+
+
+        private void UpdateKeys(byte byteValue)
+        {
+            _Keys[0] = (UInt32)crc32.ComputeCrc32((int)_Keys[0], byteValue);
+            _Keys[1] = _Keys[1] + (byte)_Keys[0];
+            _Keys[1] = _Keys[1] * 0x08088405 + 1;
+            _Keys[2] = (UInt32)crc32.ComputeCrc32((int)_Keys[2], (byte)(_Keys[1] >> 24));
+        }
+
+        ///// <summary>
+        ///// The byte array representing the seed keys used.
+        ///// Get this after calling InitCipher.  The 12 bytes represents
+        ///// what the zip spec calls the "EncryptionHeader".
+        ///// </summary>
+        //public byte[] KeyHeader
+        //{
+        //    get
+        //    {
+        //        byte[] result = new byte[12];
+        //        result[0] = (byte)(_Keys[0] & 0xff);
+        //        result[1] = (byte)((_Keys[0] >> 8) & 0xff);
+        //        result[2] = (byte)((_Keys[0] >> 16) & 0xff);
+        //        result[3] = (byte)((_Keys[0] >> 24) & 0xff);
+        //        result[4] = (byte)(_Keys[1] & 0xff);
+        //        result[5] = (byte)((_Keys[1] >> 8) & 0xff);
+        //        result[6] = (byte)((_Keys[1] >> 16) & 0xff);
+        //        result[7] = (byte)((_Keys[1] >> 24) & 0xff);
+        //        result[8] = (byte)(_Keys[2] & 0xff);
+        //        result[9] = (byte)((_Keys[2] >> 8) & 0xff);
+        //        result[10] = (byte)((_Keys[2] >> 16) & 0xff);
+        //        result[11] = (byte)((_Keys[2] >> 24) & 0xff);
+        //        return result;
+        //    }
+        //}
+
+        // private fields for the crypto stuff:
+        private UInt32[] _Keys = { 0x12345678, 0x23456789, 0x34567890 };
+        private Ionic.Crc.CRC32 crc32 = new Ionic.Crc.CRC32();
+
+    }
+
+    internal enum CryptoMode
+    {
+        Encrypt,
+        Decrypt
+    }
+
+    /// <summary>
+    ///   A Stream for reading and concurrently decrypting data from a zip file,
+    ///   or for writing and concurrently encrypting data to a zip file.
+    /// </summary>
+    internal class ZipCipherStream : System.IO.Stream
+    {
+        private ZipCrypto _cipher;
+        private System.IO.Stream _s;
+        private CryptoMode _mode;
+
+        /// <summary>  The constructor. </summary>
+        /// <param name="s">The underlying stream</param>
+        /// <param name="mode">To either encrypt or decrypt.</param>
+        /// <param name="cipher">The pre-initialized ZipCrypto object.</param>
+        public ZipCipherStream(System.IO.Stream s, ZipCrypto cipher, CryptoMode mode)
+            : base()
+        {
+            _cipher = cipher;
+            _s = s;
+            _mode = mode;
+        }
+
+        public override int Read(byte[] buffer, int offset, int count)
+        {
+            if (_mode == CryptoMode.Encrypt)
+                throw new NotSupportedException("This stream does not encrypt via Read()");
+
+            if (buffer == null)
+                throw new ArgumentNullException("buffer");
+
+            byte[] db = new byte[count];
+            int n = _s.Read(db, 0, count);
+            byte[] decrypted = _cipher.DecryptMessage(db, n);
+            for (int i = 0; i < n; i++)
+            {
+                buffer[offset + i] = decrypted[i];
+            }
+            return n;
+        }
+
+        public override void Write(byte[] buffer, int offset, int count)
+        {
+            if (_mode == CryptoMode.Decrypt)
+                throw new NotSupportedException("This stream does not Decrypt via Write()");
+
+            if (buffer == null)
+                throw new ArgumentNullException("buffer");
+
+            // workitem 7696
+            if (count == 0) return;
+
+            byte[] plaintext = null;
+            if (offset != 0)
+            {
+                plaintext = new byte[count];
+                for (int i = 0; i < count; i++)
+                {
+                    plaintext[i] = buffer[offset + i];
+                }
+            }
+            else plaintext = buffer;
+
+            byte[] encrypted = _cipher.EncryptMessage(plaintext, count);
+            _s.Write(encrypted, 0, encrypted.Length);
+        }
+
+
+        public override bool CanRead
+        {
+            get { return (_mode == CryptoMode.Decrypt); }
+        }
+        public override bool CanSeek
+        {
+            get { return false; }
+        }
+
+        public override bool CanWrite
+        {
+            get { return (_mode == CryptoMode.Encrypt); }
+        }
+
+        public override void Flush()
+        {
+            //throw new NotSupportedException();
+        }
+
+        public override long Length
+        {
+            get { throw new NotSupportedException(); }
+        }
+
+        public override long Position
+        {
+            get { throw new NotSupportedException(); }
+            set { throw new NotSupportedException(); }
+        }
+        public override long Seek(long offset, System.IO.SeekOrigin origin)
+        {
+            throw new NotSupportedException();
+        }
+
+        public override void SetLength(long value)
+        {
+            throw new NotSupportedException();
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ZipDirEntry.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ZipDirEntry.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ZipDirEntry.cs	(revision 12707)
@@ -0,0 +1,381 @@
+// ZipDirEntry.cs
+// ------------------------------------------------------------------
+//
+// Copyright (c) 2006-2011 Dino Chiesa .
+// All rights reserved.
+//
+// This code module is part of DotNetZip, a zipfile class library.
+//
+// ------------------------------------------------------------------
+//
+// This code is licensed under the Microsoft Public License.
+// See the file License.txt for the license details.
+// More info on: http://dotnetzip.codeplex.com
+//
+// ------------------------------------------------------------------
+//
+// last saved (in emacs):
+// Time-stamp: <2011-July-11 12:03:03>
+//
+// ------------------------------------------------------------------
+//
+// This module defines members of the ZipEntry class for reading the
+// Zip file central directory.
+//
+// Created: Tue, 27 Mar 2007  15:30
+//
+// ------------------------------------------------------------------
+
+
+using System;
+using System.Collections.Generic;
+
+namespace OfficeOpenXml.Packaging.Ionic.Zip
+{
+
+    partial class ZipEntry
+    {
+        /// <summary>
+        /// True if the referenced entry is a directory.
+        /// </summary>
+        internal bool AttributesIndicateDirectory
+        {
+            get { return ((_InternalFileAttrs == 0) && ((_ExternalFileAttrs & 0x0010) == 0x0010)); }
+        }
+
+
+        internal void ResetDirEntry()
+        {
+            // __FileDataPosition is the position of the file data for an entry.
+            // It is _RelativeOffsetOfLocalHeader + size of local header.
+
+            // We cannot know the __FileDataPosition until we read the local
+            // header.
+
+            // The local header is not necessarily the same length as the record
+            // in the central directory.
+
+            // Set to -1, to indicate we need to read this later.
+            this.__FileDataPosition = -1;
+
+            // set _LengthOfHeader to 0, to indicate we need to read later.
+            this._LengthOfHeader = 0;
+        }
+
+        /// <summary>
+        /// Provides a human-readable string with information about the ZipEntry.
+        /// </summary>
+        public string Info
+        {
+            get
+            {
+                var builder = new System.Text.StringBuilder();
+                builder
+                    .Append(string.Format("          ZipEntry: {0}\n", this.FileName))
+                    .Append(string.Format("   Version Made By: {0}\n", this._VersionMadeBy))
+                    .Append(string.Format(" Needed to extract: {0}\n", this.VersionNeeded));
+
+                if (this._IsDirectory)
+                    builder.Append("        Entry type: directory\n");
+                else
+                {
+                    builder.Append(string.Format("         File type: {0}\n", this._IsText? "text":"binary"))
+                        .Append(string.Format("       Compression: {0}\n", this.CompressionMethod))
+                        .Append(string.Format("        Compressed: 0x{0:X}\n", this.CompressedSize))
+                        .Append(string.Format("      Uncompressed: 0x{0:X}\n", this.UncompressedSize))
+                        .Append(string.Format("             CRC32: 0x{0:X8}\n", this._Crc32));
+                }
+                builder.Append(string.Format("       Disk Number: {0}\n", this._diskNumber));
+                if (this._RelativeOffsetOfLocalHeader > 0xFFFFFFFF)
+                    builder
+                        .Append(string.Format("   Relative Offset: 0x{0:X16}\n", this._RelativeOffsetOfLocalHeader));
+                        else
+                    builder
+                        .Append(string.Format("   Relative Offset: 0x{0:X8}\n", this._RelativeOffsetOfLocalHeader));
+
+                    builder
+                    .Append(string.Format("         Bit Field: 0x{0:X4}\n", this._BitField))
+                    .Append(string.Format("        Encrypted?: {0}\n", this._sourceIsEncrypted))
+                    .Append(string.Format("          Timeblob: 0x{0:X8}\n", this._TimeBlob))
+                        .Append(string.Format("              Time: {0}\n", Ionic.Zip.SharedUtilities.PackedToDateTime(this._TimeBlob)));
+
+                builder.Append(string.Format("         Is Zip64?: {0}\n", this._InputUsesZip64));
+                if (!string.IsNullOrEmpty(this._Comment))
+                {
+                    builder.Append(string.Format("           Comment: {0}\n", this._Comment));
+                }
+                builder.Append("\n");
+                return builder.ToString();
+            }
+        }
+
+
+        // workitem 10330
+        private class CopyHelper
+        {
+            private static System.Text.RegularExpressions.Regex re =
+                new System.Text.RegularExpressions.Regex(" \\(copy (\\d+)\\)$");
+
+            private static int callCount = 0;
+
+            internal static string AppendCopyToFileName(string f)
+            {
+                callCount++;
+                if (callCount > 25)
+                    throw new OverflowException("overflow while creating filename");
+
+                int n = 1;
+                int r = f.LastIndexOf(".");
+
+                if (r == -1)
+                {
+                    // there is no extension
+                    System.Text.RegularExpressions.Match m = re.Match(f);
+                    if (m.Success)
+                    {
+                        n = Int32.Parse(m.Groups[1].Value) + 1;
+                        string copy = String.Format(" (copy {0})", n);
+                        f = f.Substring(0, m.Index) + copy;
+                    }
+                    else
+                    {
+                        string copy = String.Format(" (copy {0})", n);
+                        f = f + copy;
+                    }
+                }
+                else
+                {
+                    //System.Console.WriteLine("HasExtension");
+                    System.Text.RegularExpressions.Match m = re.Match(f.Substring(0, r));
+                    if (m.Success)
+                    {
+                        n = Int32.Parse(m.Groups[1].Value) + 1;
+                        string copy = String.Format(" (copy {0})", n);
+                        f = f.Substring(0, m.Index) + copy + f.Substring(r);
+                    }
+                    else
+                    {
+                        string copy = String.Format(" (copy {0})", n);
+                        f = f.Substring(0, r) + copy + f.Substring(r);
+                    }
+
+                    //System.Console.WriteLine("returning f({0})", f);
+                }
+                return f;
+            }
+        }
+
+
+
+        /// <summary>
+        ///   Reads one entry from the zip directory structure in the zip file.
+        /// </summary>
+        ///
+        /// <param name="zf">
+        ///   The zipfile for which a directory entry will be read.  From this param, the
+        ///   method gets the ReadStream and the expected text encoding
+        ///   (ProvisionalAlternateEncoding) which is used if the entry is not marked
+        ///   UTF-8.
+        /// </param>
+        ///
+        /// <param name="previouslySeen">
+        ///   a list of previously seen entry names; used to prevent duplicates.
+        /// </param>
+        ///
+        /// <returns>the entry read from the archive.</returns>
+        internal static ZipEntry ReadDirEntry(ZipFile zf,
+                                              Dictionary<String,Object> previouslySeen)
+        {
+            System.IO.Stream s = zf.ReadStream;
+            System.Text.Encoding expectedEncoding = (zf.AlternateEncodingUsage == ZipOption.Always)
+                ? zf.AlternateEncoding
+                : ZipFile.DefaultEncoding;
+
+            int signature = Ionic.Zip.SharedUtilities.ReadSignature(s);
+            // return null if this is not a local file header signature
+            if (IsNotValidZipDirEntrySig(signature))
+            {
+                s.Seek(-4, System.IO.SeekOrigin.Current);
+                // workitem 10178
+                Ionic.Zip.SharedUtilities.Workaround_Ladybug318918(s);
+
+                // Getting "not a ZipDirEntry signature" here is not always wrong or an
+                // error.  This can happen when walking through a zipfile.  After the
+                // last ZipDirEntry, we expect to read an
+                // EndOfCentralDirectorySignature.  When we get this is how we know
+                // we've reached the end of the central directory.
+                if (signature != ZipConstants.EndOfCentralDirectorySignature &&
+                    signature != ZipConstants.Zip64EndOfCentralDirectoryRecordSignature &&
+                    signature != ZipConstants.ZipEntrySignature  // workitem 8299
+                    )
+                {
+                    throw new BadReadException(String.Format("  Bad signature (0x{0:X8}) at position 0x{1:X8}", signature, s.Position));
+                }
+                return null;
+            }
+
+            int bytesRead = 42 + 4;
+            byte[] block = new byte[42];
+            int n = s.Read(block, 0, block.Length);
+            if (n != block.Length) return null;
+
+            int i = 0;
+            ZipEntry zde = new ZipEntry();
+            zde.AlternateEncoding = expectedEncoding;
+            zde._Source = ZipEntrySource.ZipFile;
+            zde._container = new ZipContainer(zf);
+
+            unchecked
+            {
+                zde._VersionMadeBy = (short)(block[i++] + block[i++] * 256);
+                zde._VersionNeeded = (short)(block[i++] + block[i++] * 256);
+                zde._BitField = (short)(block[i++] + block[i++] * 256);
+                zde._CompressionMethod = (Int16)(block[i++] + block[i++] * 256);
+                zde._TimeBlob = block[i++] + block[i++] * 256 + block[i++] * 256 * 256 + block[i++] * 256 * 256 * 256;
+                zde._LastModified = Ionic.Zip.SharedUtilities.PackedToDateTime(zde._TimeBlob);
+                zde._timestamp |= ZipEntryTimestamp.DOS;
+
+                zde._Crc32 = block[i++] + block[i++] * 256 + block[i++] * 256 * 256 + block[i++] * 256 * 256 * 256;
+                zde._CompressedSize = (uint)(block[i++] + block[i++] * 256 + block[i++] * 256 * 256 + block[i++] * 256 * 256 * 256);
+                zde._UncompressedSize = (uint)(block[i++] + block[i++] * 256 + block[i++] * 256 * 256 + block[i++] * 256 * 256 * 256);
+            }
+
+            // preserve
+            zde._CompressionMethod_FromZipFile = zde._CompressionMethod;
+
+            zde._filenameLength = (short)(block[i++] + block[i++] * 256);
+            zde._extraFieldLength = (short)(block[i++] + block[i++] * 256);
+            zde._commentLength = (short)(block[i++] + block[i++] * 256);
+            zde._diskNumber = (UInt32)(block[i++] + block[i++] * 256);
+
+            zde._InternalFileAttrs = (short)(block[i++] + block[i++] * 256);
+            zde._ExternalFileAttrs = block[i++] + block[i++] * 256 + block[i++] * 256 * 256 + block[i++] * 256 * 256 * 256;
+
+            zde._RelativeOffsetOfLocalHeader = (uint)(block[i++] + block[i++] * 256 + block[i++] * 256 * 256 + block[i++] * 256 * 256 * 256);
+
+            // workitem 7801
+            zde.IsText = ((zde._InternalFileAttrs & 0x01) == 0x01);
+
+            block = new byte[zde._filenameLength];
+            n = s.Read(block, 0, block.Length);
+            bytesRead += n;
+            if ((zde._BitField & 0x0800) == 0x0800)
+            {
+                // UTF-8 is in use
+                zde._FileNameInArchive = Ionic.Zip.SharedUtilities.Utf8StringFromBuffer(block);
+            }
+            else
+            {
+                zde._FileNameInArchive = Ionic.Zip.SharedUtilities.StringFromBuffer(block, expectedEncoding);
+            }
+
+            // workitem 10330
+            // insure unique entry names
+            while (previouslySeen.ContainsKey(zde._FileNameInArchive))
+            {
+                zde._FileNameInArchive = CopyHelper.AppendCopyToFileName(zde._FileNameInArchive);
+                zde._metadataChanged = true;
+            }
+
+            if (zde.AttributesIndicateDirectory)
+                zde.MarkAsDirectory();  // may append a slash to filename if nec.
+            // workitem 6898
+            else if (zde._FileNameInArchive.EndsWith("/")) zde.MarkAsDirectory();
+
+            zde._CompressedFileDataSize = zde._CompressedSize;
+            if ((zde._BitField & 0x01) == 0x01)
+            {
+                // this may change after processing the Extra field
+                zde._Encryption_FromZipFile = zde._Encryption =
+                    EncryptionAlgorithm.PkzipWeak;
+                zde._sourceIsEncrypted = true;
+            }
+
+            if (zde._extraFieldLength > 0)
+            {
+                zde._InputUsesZip64 = (zde._CompressedSize == 0xFFFFFFFF ||
+                      zde._UncompressedSize == 0xFFFFFFFF ||
+                      zde._RelativeOffsetOfLocalHeader == 0xFFFFFFFF);
+
+                // Console.WriteLine("  Input uses Z64?:      {0}", zde._InputUsesZip64);
+
+                bytesRead += zde.ProcessExtraField(s, zde._extraFieldLength);
+                zde._CompressedFileDataSize = zde._CompressedSize;
+            }
+
+            // we've processed the extra field, so we know the encryption method is set now.
+            if (zde._Encryption == EncryptionAlgorithm.PkzipWeak)
+            {
+                // the "encryption header" of 12 bytes precedes the file data
+                zde._CompressedFileDataSize -= 12;
+            }
+#if AESCRYPTO
+            else if (zde.Encryption == EncryptionAlgorithm.WinZipAes128 ||
+                        zde.Encryption == EncryptionAlgorithm.WinZipAes256)
+            {
+                zde._CompressedFileDataSize = zde.CompressedSize -
+                    (ZipEntry.GetLengthOfCryptoHeaderBytes(zde.Encryption) + 10);
+                zde._LengthOfTrailer = 10;
+            }
+#endif
+
+            // tally the trailing descriptor
+            if ((zde._BitField & 0x0008) == 0x0008)
+            {
+                // sig, CRC, Comp and Uncomp sizes
+                if (zde._InputUsesZip64)
+                    zde._LengthOfTrailer += 24;
+                else
+                    zde._LengthOfTrailer += 16;
+            }
+
+            // workitem 12744
+            zde.AlternateEncoding = ((zde._BitField & 0x0800) == 0x0800)
+                ? System.Text.Encoding.UTF8
+                :expectedEncoding;
+
+            zde.AlternateEncodingUsage = ZipOption.Always;
+
+            if (zde._commentLength > 0)
+            {
+                block = new byte[zde._commentLength];
+                n = s.Read(block, 0, block.Length);
+                bytesRead += n;
+                if ((zde._BitField & 0x0800) == 0x0800)
+                {
+                    // UTF-8 is in use
+                    zde._Comment = Ionic.Zip.SharedUtilities.Utf8StringFromBuffer(block);
+                }
+                else
+                {
+                    zde._Comment = Ionic.Zip.SharedUtilities.StringFromBuffer(block, expectedEncoding);
+                }
+            }
+            //zde._LengthOfDirEntry = bytesRead;
+            return zde;
+        }
+
+
+        /// <summary>
+        /// Returns true if the passed-in value is a valid signature for a ZipDirEntry.
+        /// </summary>
+        /// <param name="signature">the candidate 4-byte signature value.</param>
+        /// <returns>true, if the signature is valid according to the PKWare spec.</returns>
+        internal static bool IsNotValidZipDirEntrySig(int signature)
+        {
+            return (signature != ZipConstants.ZipDirEntrySignature);
+        }
+
+
+        private Int16 _VersionMadeBy;
+        private Int16 _InternalFileAttrs;
+        private Int32 _ExternalFileAttrs;
+
+        //private Int32 _LengthOfDirEntry;
+        private Int16 _filenameLength;
+        private Int16 _extraFieldLength;
+        private Int16 _commentLength;
+    }
+
+
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ZipEntry.Extract.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ZipEntry.Extract.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ZipEntry.Extract.cs	(revision 12707)
@@ -0,0 +1,1455 @@
+// ZipEntry.Extract.cs
+// ------------------------------------------------------------------
+//
+// Copyright (c) 2009-2011 Dino Chiesa
+// All rights reserved.
+//
+// This code module is part of DotNetZip, a zipfile class library.
+//
+// ------------------------------------------------------------------
+//
+// This code is licensed under the Microsoft Public License.
+// See the file License.txt for the license details.
+// More info on: http://dotnetzip.codeplex.com
+//
+// ------------------------------------------------------------------
+//
+// last saved (in emacs):
+// Time-stamp: <2011-August-06 18:08:21>
+//
+// ------------------------------------------------------------------
+//
+// This module defines logic for Extract methods on the ZipEntry class.
+//
+// ------------------------------------------------------------------
+
+
+using System;
+using System.IO;
+
+namespace OfficeOpenXml.Packaging.Ionic.Zip
+{
+
+    internal partial class ZipEntry
+    {
+        /// <summary>
+        ///   Extract the entry to the filesystem, starting at the current
+        ///   working directory.
+        /// </summary>
+        ///
+        /// <overloads>
+        ///   This method has a bunch of overloads! One of them is sure to
+        ///   be the right one for you... If you don't like these, check
+        ///   out the <c>ExtractWithPassword()</c> methods.
+        /// </overloads>
+        ///
+        /// <seealso cref="ZipEntry.ExtractExistingFile"/>
+        /// <seealso cref="ZipEntry.Extract(ExtractExistingFileAction)"/>
+        ///
+        /// <remarks>
+        ///
+        /// <para>
+        ///   This method extracts an entry from a zip file into the current
+        ///   working directory.  The path of the entry as extracted is the full
+        ///   path as specified in the zip archive, relative to the current
+        ///   working directory.  After the file is extracted successfully, the
+        ///   file attributes and timestamps are set.
+        /// </para>
+        ///
+        /// <para>
+        ///   The action taken when extraction an entry would overwrite an
+        ///   existing file is determined by the <see cref="ExtractExistingFile"
+        ///   /> property.
+        /// </para>
+        ///
+        /// <para>
+        ///   Within the call to <c>Extract()</c>, the content for the entry is
+        ///   written into a filesystem file, and then the last modified time of the
+        ///   file is set according to the <see cref="LastModified"/> property on
+        ///   the entry. See the remarks the <see cref="LastModified"/> property for
+        ///   some details about the last modified time.
+        /// </para>
+        ///
+        /// </remarks>
+        internal void Extract()
+        {
+            InternalExtract(".", null, null);
+        }
+
+
+        /// <summary>
+        ///   Extract the entry to a file in the filesystem, using the specified
+        ///   behavior when extraction would overwrite an existing file.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   See the remarks on the <see cref="LastModified"/> property, for some
+        ///   details about how the last modified time of the file is set after
+        ///   extraction.
+        /// </para>
+        /// </remarks>
+        ///
+        /// <param name="extractExistingFile">
+        ///   The action to take if extraction would overwrite an existing file.
+        /// </param>
+        internal void Extract(ExtractExistingFileAction extractExistingFile)
+        {
+            ExtractExistingFile = extractExistingFile;
+            InternalExtract(".", null, null);
+        }
+
+        /// <summary>
+        ///   Extracts the entry to the specified stream.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   The caller can specify any write-able stream, for example a <see
+        ///   cref="System.IO.FileStream"/>, a <see
+        ///   cref="System.IO.MemoryStream"/>, or ASP.NET's
+        ///   <c>Response.OutputStream</c>.  The content will be decrypted and
+        ///   decompressed as necessary. If the entry is encrypted and no password
+        ///   is provided, this method will throw.
+        /// </para>
+        /// <para>
+        ///   The position on the stream is not reset by this method before it extracts.
+        ///   You may want to call stream.Seek() before calling ZipEntry.Extract().
+        /// </para>
+        /// </remarks>
+        ///
+        /// <param name="stream">
+        ///   the stream to which the entry should be extracted.
+        /// </param>
+        ///
+        public void Extract(Stream stream)
+        {
+            InternalExtract(null, stream, null);
+        }
+
+        /// <summary>
+        ///   Extract the entry to the filesystem, starting at the specified base
+        ///   directory.
+        /// </summary>
+        ///
+        /// <param name="baseDirectory">the pathname of the base directory</param>
+        ///
+        /// <seealso cref="ZipEntry.ExtractExistingFile"/>
+        /// <seealso cref="ZipEntry.Extract(string, ExtractExistingFileAction)"/>
+        ///
+        /// <example>
+        /// This example extracts only the entries in a zip file that are .txt files,
+        /// into a directory called "textfiles".
+        /// <code lang="C#">
+        /// using (ZipFile zip = ZipFile.Read("PackedDocuments.zip"))
+        /// {
+        ///   foreach (string s1 in zip.EntryFilenames)
+        ///   {
+        ///     if (s1.EndsWith(".txt"))
+        ///     {
+        ///       zip[s1].Extract("textfiles");
+        ///     }
+        ///   }
+        /// }
+        /// </code>
+        /// <code lang="VB">
+        ///   Using zip As ZipFile = ZipFile.Read("PackedDocuments.zip")
+        ///       Dim s1 As String
+        ///       For Each s1 In zip.EntryFilenames
+        ///           If s1.EndsWith(".txt") Then
+        ///               zip(s1).Extract("textfiles")
+        ///           End If
+        ///       Next
+        ///   End Using
+        /// </code>
+        /// </example>
+        ///
+        /// <remarks>
+        ///
+        /// <para>
+        ///   Using this method, existing entries in the filesystem will not be
+        ///   overwritten. If you would like to force the overwrite of existing
+        ///   files, see the <see cref="ExtractExistingFile"/> property, or call
+        ///   <see cref="Extract(string, ExtractExistingFileAction)"/>.
+        /// </para>
+        ///
+        /// <para>
+        ///   See the remarks on the <see cref="LastModified"/> property, for some
+        ///   details about how the last modified time of the created file is set.
+        /// </para>
+        /// </remarks>
+        public void Extract(string baseDirectory)
+        {
+            InternalExtract(baseDirectory, null, null);
+        }
+
+
+
+
+
+        /// <summary>
+        ///   Extract the entry to the filesystem, starting at the specified base
+        ///   directory, and using the specified behavior when extraction would
+        ///   overwrite an existing file.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   See the remarks on the <see cref="LastModified"/> property, for some
+        ///   details about how the last modified time of the created file is set.
+        /// </para>
+        /// </remarks>
+        ///
+        /// <example>
+        /// <code lang="C#">
+        /// String sZipPath = "Airborne.zip";
+        /// String sFilePath = "Readme.txt";
+        /// String sRootFolder = "Digado";
+        /// using (ZipFile zip = ZipFile.Read(sZipPath))
+        /// {
+        ///   if (zip.EntryFileNames.Contains(sFilePath))
+        ///   {
+        ///     // use the string indexer on the zip file
+        ///     zip[sFileName].Extract(sRootFolder,
+        ///                            ExtractExistingFileAction.OverwriteSilently);
+        ///   }
+        /// }
+        /// </code>
+        ///
+        /// <code lang="VB">
+        /// Dim sZipPath as String = "Airborne.zip"
+        /// Dim sFilePath As String = "Readme.txt"
+        /// Dim sRootFolder As String = "Digado"
+        /// Using zip As ZipFile = ZipFile.Read(sZipPath)
+        ///   If zip.EntryFileNames.Contains(sFilePath)
+        ///     ' use the string indexer on the zip file
+        ///     zip(sFilePath).Extract(sRootFolder, _
+        ///                            ExtractExistingFileAction.OverwriteSilently)
+        ///   End If
+        /// End Using
+        /// </code>
+        /// </example>
+        ///
+        /// <param name="baseDirectory">the pathname of the base directory</param>
+        /// <param name="extractExistingFile">
+        /// The action to take if extraction would overwrite an existing file.
+        /// </param>
+        internal void Extract(string baseDirectory, ExtractExistingFileAction extractExistingFile)
+        {
+            ExtractExistingFile = extractExistingFile;
+            InternalExtract(baseDirectory, null, null);
+        }
+
+
+        /// <summary>
+        ///   Extract the entry to the filesystem, using the current working directory
+        ///   and the specified password.
+        /// </summary>
+        ///
+        /// <overloads>
+        ///   This method has a bunch of overloads! One of them is sure to be
+        ///   the right one for you...
+        /// </overloads>
+        ///
+        /// <seealso cref="ZipEntry.ExtractExistingFile"/>
+        /// <seealso cref="ZipEntry.ExtractWithPassword(ExtractExistingFileAction, string)"/>
+        ///
+        /// <remarks>
+        ///
+        /// <para>
+        ///   Existing entries in the filesystem will not be overwritten. If you
+        ///   would like to force the overwrite of existing files, see the <see
+        ///   cref="ZipEntry.ExtractExistingFile"/>property, or call
+        ///   <see
+        ///   cref="ExtractWithPassword(ExtractExistingFileAction,string)"/>.
+        /// </para>
+        ///
+        /// <para>
+        ///   See the remarks on the <see cref="LastModified"/> property for some
+        ///   details about how the "last modified" time of the created file is
+        ///   set.
+        /// </para>
+        /// </remarks>
+        ///
+        /// <example>
+        ///   In this example, entries that use encryption are extracted using a
+        ///   particular password.
+        /// <code>
+        /// using (var zip = ZipFile.Read(FilePath))
+        /// {
+        ///     foreach (ZipEntry e in zip)
+        ///     {
+        ///         if (e.UsesEncryption)
+        ///             e.ExtractWithPassword("Secret!");
+        ///         else
+        ///             e.Extract();
+        ///     }
+        /// }
+        /// </code>
+        /// <code lang="VB">
+        /// Using zip As ZipFile = ZipFile.Read(FilePath)
+        ///     Dim e As ZipEntry
+        ///     For Each e In zip
+        ///         If (e.UsesEncryption)
+        ///           e.ExtractWithPassword("Secret!")
+        ///         Else
+        ///           e.Extract
+        ///         End If
+        ///     Next
+        /// End Using
+        /// </code>
+        /// </example>
+        /// <param name="password">The Password to use for decrypting the entry.</param>
+        public void ExtractWithPassword(string password)
+        {
+            InternalExtract(".", null, password);
+        }
+
+        /// <summary>
+        ///   Extract the entry to the filesystem, starting at the specified base
+        ///   directory, and using the specified password.
+        /// </summary>
+        ///
+        /// <seealso cref="ZipEntry.ExtractExistingFile"/>
+        /// <seealso cref="ZipEntry.ExtractWithPassword(string, ExtractExistingFileAction, string)"/>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   Existing entries in the filesystem will not be overwritten. If you
+        ///   would like to force the overwrite of existing files, see the <see
+        ///   cref="ZipEntry.ExtractExistingFile"/>property, or call
+        ///   <see
+        ///   cref="ExtractWithPassword(ExtractExistingFileAction,string)"/>.
+        /// </para>
+        ///
+        /// <para>
+        ///   See the remarks on the <see cref="LastModified"/> property, for some
+        ///   details about how the last modified time of the created file is set.
+        /// </para>
+        /// </remarks>
+        ///
+        /// <param name="baseDirectory">The pathname of the base directory.</param>
+        /// <param name="password">The Password to use for decrypting the entry.</param>
+        public void ExtractWithPassword(string baseDirectory, string password)
+        {
+            InternalExtract(baseDirectory, null, password);
+        }
+
+
+
+
+        /// <summary>
+        ///   Extract the entry to a file in the filesystem, relative to the
+        ///   current directory, using the specified behavior when extraction
+        ///   would overwrite an existing file.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   See the remarks on the <see cref="LastModified"/> property, for some
+        ///   details about how the last modified time of the created file is set.
+        /// </para>
+        /// </remarks>
+        ///
+        /// <param name="password">The Password to use for decrypting the entry.</param>
+        ///
+        /// <param name="extractExistingFile">
+        /// The action to take if extraction would overwrite an existing file.
+        /// </param>
+        internal void ExtractWithPassword(ExtractExistingFileAction extractExistingFile, string password)
+        {
+            ExtractExistingFile = extractExistingFile;
+            InternalExtract(".", null, password);
+        }
+
+
+
+        /// <summary>
+        ///   Extract the entry to the filesystem, starting at the specified base
+        ///   directory, and using the specified behavior when extraction would
+        ///   overwrite an existing file.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///   See the remarks on the <see cref="LastModified"/> property, for some
+        ///   details about how the last modified time of the created file is set.
+        /// </remarks>
+        ///
+        /// <param name="baseDirectory">the pathname of the base directory</param>
+        ///
+        /// <param name="extractExistingFile">The action to take if extraction would
+        /// overwrite an existing file.</param>
+        ///
+        /// <param name="password">The Password to use for decrypting the entry.</param>
+        internal void ExtractWithPassword(string baseDirectory, ExtractExistingFileAction extractExistingFile, string password)
+        {
+            ExtractExistingFile = extractExistingFile;
+            InternalExtract(baseDirectory, null, password);
+        }
+
+        /// <summary>
+        ///   Extracts the entry to the specified stream, using the specified
+        ///   Password.  For example, the caller could extract to Console.Out, or
+        ///   to a MemoryStream.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   The caller can specify any write-able stream, for example a <see
+        ///   cref="System.IO.FileStream"/>, a <see
+        ///   cref="System.IO.MemoryStream"/>, or ASP.NET's
+        ///   <c>Response.OutputStream</c>.  The content will be decrypted and
+        ///   decompressed as necessary. If the entry is encrypted and no password
+        ///   is provided, this method will throw.
+        /// </para>
+        /// <para>
+        ///   The position on the stream is not reset by this method before it extracts.
+        ///   You may want to call stream.Seek() before calling ZipEntry.Extract().
+        /// </para>
+        /// </remarks>
+        ///
+        ///
+        /// <param name="stream">
+        ///   the stream to which the entry should be extracted.
+        /// </param>
+        /// <param name="password">
+        ///   The password to use for decrypting the entry.
+        /// </param>
+        public void ExtractWithPassword(Stream stream, string password)
+        {
+            InternalExtract(null, stream, password);
+        }
+
+
+        /// <summary>
+        ///   Opens a readable stream corresponding to the zip entry in the
+        ///   archive.  The stream decompresses and decrypts as necessary, as it
+        ///   is read.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///
+        /// <para>
+        ///   DotNetZip offers a variety of ways to extract entries from a zip
+        ///   file.  This method allows an application to extract an entry by
+        ///   reading a <see cref="System.IO.Stream"/>.
+        /// </para>
+        ///
+        /// <para>
+        ///   The return value is of type <see
+        ///   cref="Ionic.Crc.CrcCalculatorStream"/>.  Use it as you would any
+        ///   stream for reading.  When an application calls <see
+        ///   cref="Stream.Read(byte[], int, int)"/> on that stream, it will
+        ///   receive data from the zip entry that is decrypted and decompressed
+        ///   as necessary.
+        /// </para>
+        ///
+        /// <para>
+        ///   <c>CrcCalculatorStream</c> adds one additional feature: it keeps a
+        ///   CRC32 checksum on the bytes of the stream as it is read.  The CRC
+        ///   value is available in the <see
+        ///   cref="Ionic.Crc.CrcCalculatorStream.Crc"/> property on the
+        ///   <c>CrcCalculatorStream</c>.  When the read is complete, your
+        ///   application
+        ///   <em>should</em> check this CRC against the <see cref="ZipEntry.Crc"/>
+        ///   property on the <c>ZipEntry</c> to validate the content of the
+        ///   ZipEntry. You don't have to validate the entry using the CRC, but
+        ///   you should, to verify integrity. Check the example for how to do
+        ///   this.
+        /// </para>
+        ///
+        /// <para>
+        ///   If the entry is protected with a password, then you need to provide
+        ///   a password prior to calling <see cref="OpenReader()"/>, either by
+        ///   setting the <see cref="Password"/> property on the entry, or the
+        ///   <see cref="ZipFile.Password"/> property on the <c>ZipFile</c>
+        ///   itself. Or, you can use <see cref="OpenReader(String)" />, the
+        ///   overload of OpenReader that accepts a password parameter.
+        /// </para>
+        ///
+        /// <para>
+        ///   If you want to extract entry data into a write-able stream that is
+        ///   already opened, like a <see cref="System.IO.FileStream"/>, do not
+        ///   use this method. Instead, use <see cref="Extract(Stream)"/>.
+        /// </para>
+        ///
+        /// <para>
+        ///   Your application may use only one stream created by OpenReader() at
+        ///   a time, and you should not call other Extract methods before
+        ///   completing your reads on a stream obtained from OpenReader().  This
+        ///   is because there is really only one source stream for the compressed
+        ///   content.  A call to OpenReader() seeks in the source stream, to the
+        ///   beginning of the compressed content.  A subsequent call to
+        ///   OpenReader() on a different entry will seek to a different position
+        ///   in the source stream, as will a call to Extract() or one of its
+        ///   overloads.  This will corrupt the state for the decompressing stream
+        ///   from the original call to OpenReader().
+        /// </para>
+        ///
+        /// <para>
+        ///    The <c>OpenReader()</c> method works only when the ZipEntry is
+        ///    obtained from an instance of <c>ZipFile</c>. This method will throw
+        ///    an exception if the ZipEntry is obtained from a ZipInputStream.
+        /// </para>
+        /// </remarks>
+        ///
+        /// <example>
+        ///   This example shows how to open a zip archive, then read in a named
+        ///   entry via a stream. After the read loop is complete, the code
+        ///   compares the calculated during the read loop with the expected CRC
+        ///   on the <c>ZipEntry</c>, to verify the extraction.
+        /// <code>
+        /// using (ZipFile zip = new ZipFile(ZipFileToRead))
+        /// {
+        ///   ZipEntry e1= zip["Elevation.mp3"];
+        ///   using (Ionic.Zlib.CrcCalculatorStream s = e1.OpenReader())
+        ///   {
+        ///     byte[] buffer = new byte[4096];
+        ///     int n, totalBytesRead= 0;
+        ///     do {
+        ///       n = s.Read(buffer,0, buffer.Length);
+        ///       totalBytesRead+=n;
+        ///     } while (n&gt;0);
+        ///      if (s.Crc32 != e1.Crc32)
+        ///       throw new Exception(string.Format("The Zip Entry failed the CRC Check. (0x{0:X8}!=0x{1:X8})", s.Crc32, e1.Crc32));
+        ///      if (totalBytesRead != e1.UncompressedSize)
+        ///       throw new Exception(string.Format("We read an unexpected number of bytes. ({0}!={1})", totalBytesRead, e1.UncompressedSize));
+        ///   }
+        /// }
+        /// </code>
+        /// <code lang="VB">
+        ///   Using zip As New ZipFile(ZipFileToRead)
+        ///       Dim e1 As ZipEntry = zip.Item("Elevation.mp3")
+        ///       Using s As Ionic.Zlib.CrcCalculatorStream = e1.OpenReader
+        ///           Dim n As Integer
+        ///           Dim buffer As Byte() = New Byte(4096) {}
+        ///           Dim totalBytesRead As Integer = 0
+        ///           Do
+        ///               n = s.Read(buffer, 0, buffer.Length)
+        ///               totalBytesRead = (totalBytesRead + n)
+        ///           Loop While (n &gt; 0)
+        ///           If (s.Crc32 &lt;&gt; e1.Crc32) Then
+        ///               Throw New Exception(String.Format("The Zip Entry failed the CRC Check. (0x{0:X8}!=0x{1:X8})", s.Crc32, e1.Crc32))
+        ///           End If
+        ///           If (totalBytesRead &lt;&gt; e1.UncompressedSize) Then
+        ///               Throw New Exception(String.Format("We read an unexpected number of bytes. ({0}!={1})", totalBytesRead, e1.UncompressedSize))
+        ///           End If
+        ///       End Using
+        ///   End Using
+        /// </code>
+        /// </example>
+        /// <seealso cref="ZipEntry.Extract(System.IO.Stream)"/>
+        /// <returns>The Stream for reading.</returns>
+        internal Ionic.Crc.CrcCalculatorStream OpenReader()
+        {
+            // workitem 10923
+            if (_container.ZipFile == null)
+                throw new InvalidOperationException("Use OpenReader() only with ZipFile.");
+
+            // use the entry password if it is non-null,
+            // else use the zipfile password, which is possibly null
+            return InternalOpenReader(this._Password ?? this._container.Password);
+        }
+
+        /// <summary>
+        ///   Opens a readable stream for an encrypted zip entry in the archive.
+        ///   The stream decompresses and decrypts as necessary, as it is read.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   See the documentation on the <see cref="OpenReader()"/> method for
+        ///   full details. This overload allows the application to specify a
+        ///   password for the <c>ZipEntry</c> to be read.
+        /// </para>
+        /// </remarks>
+        ///
+        /// <param name="password">The password to use for decrypting the entry.</param>
+        /// <returns>The Stream for reading.</returns>
+        internal Ionic.Crc.CrcCalculatorStream OpenReader(string password)
+        {
+            // workitem 10923
+            if (_container.ZipFile == null)
+                throw new InvalidOperationException("Use OpenReader() only with ZipFile.");
+
+            return InternalOpenReader(password);
+        }
+
+
+
+        internal Ionic.Crc.CrcCalculatorStream InternalOpenReader(string password)
+        {
+            ValidateCompression();
+            ValidateEncryption();
+            SetupCryptoForExtract(password);
+
+            // workitem 7958
+            if (this._Source != ZipEntrySource.ZipFile)
+                throw new BadStateException("You must call ZipFile.Save before calling OpenReader");
+
+            // LeftToRead is a count of bytes remaining to be read (out)
+            // from the stream AFTER decompression and decryption.
+            // It is the uncompressed size, unless ... there is no compression in which
+            // case ...?  :< I'm not sure why it's not always UncompressedSize
+            Int64 LeftToRead = (_CompressionMethod_FromZipFile == (short)CompressionMethod.None)
+                ? this._CompressedFileDataSize
+                : this.UncompressedSize;
+
+            Stream input = this.ArchiveStream;
+
+            this.ArchiveStream.Seek(this.FileDataPosition, SeekOrigin.Begin);
+            // workitem 10178
+            Ionic.Zip.SharedUtilities.Workaround_Ladybug318918(this.ArchiveStream);
+
+            _inputDecryptorStream = GetExtractDecryptor(input);
+            Stream input3 = GetExtractDecompressor(_inputDecryptorStream);
+
+            return new Ionic.Crc.CrcCalculatorStream(input3, LeftToRead);
+        }
+
+
+
+        private void OnExtractProgress(Int64 bytesWritten, Int64 totalBytesToWrite)
+        {
+            if (_container.ZipFile != null)
+            _ioOperationCanceled = _container.ZipFile.OnExtractBlock(this, bytesWritten, totalBytesToWrite);
+        }
+
+
+        private void OnBeforeExtract(string path)
+        {
+            // When in the context of a ZipFile.ExtractAll, the events are generated from
+            // the ZipFile method, not from within the ZipEntry instance. (why?)
+            // Therefore we suppress the events originating from the ZipEntry method.
+            if (_container.ZipFile != null)
+            {
+                if (!_container.ZipFile._inExtractAll)
+                {
+                    _ioOperationCanceled = _container.ZipFile.OnSingleEntryExtract(this, path, true);
+                }
+            }
+        }
+
+        private void OnAfterExtract(string path)
+        {
+            // When in the context of a ZipFile.ExtractAll, the events are generated from
+            // the ZipFile method, not from within the ZipEntry instance. (why?)
+            // Therefore we suppress the events originating from the ZipEntry method.
+            if (_container.ZipFile != null)
+            {
+                if (!_container.ZipFile._inExtractAll)
+                {
+                    _container.ZipFile.OnSingleEntryExtract(this, path, false);
+                }
+            }
+        }
+
+        private void OnExtractExisting(string path)
+        {
+            if (_container.ZipFile != null)
+                _ioOperationCanceled = _container.ZipFile.OnExtractExisting(this, path);
+        }
+
+        private static void ReallyDelete(string fileName)
+        {
+            // workitem 7881
+            // reset ReadOnly bit if necessary
+#if NETCF
+            if ( (NetCfFile.GetAttributes(fileName) & (uint)FileAttributes.ReadOnly) == (uint)FileAttributes.ReadOnly)
+                NetCfFile.SetAttributes(fileName, (uint)FileAttributes.Normal);
+#elif SILVERLIGHT
+#else
+            if ((File.GetAttributes(fileName) & FileAttributes.ReadOnly) == FileAttributes.ReadOnly)
+                File.SetAttributes(fileName, FileAttributes.Normal);
+#endif
+            File.Delete(fileName);
+        }
+
+
+        private void WriteStatus(string format, params Object[] args)
+        {
+            if (_container.ZipFile != null && _container.ZipFile.Verbose) _container.ZipFile.StatusMessageTextWriter.WriteLine(format, args);
+        }
+
+
+        // Pass in either basedir or s, but not both.
+        // In other words, you can extract to a stream or to a directory (filesystem), but not both!
+        // The Password param is required for encrypted entries.
+        private void InternalExtract(string baseDir, Stream outstream, string password)
+        {
+            // workitem 7958
+            if (_container == null)
+                throw new BadStateException("This entry is an orphan");
+
+            // workitem 10355
+            if (_container.ZipFile == null)
+                throw new InvalidOperationException("Use Extract() only with ZipFile.");
+
+            _container.ZipFile.Reset(false);
+
+            if (this._Source != ZipEntrySource.ZipFile)
+                throw new BadStateException("You must call ZipFile.Save before calling any Extract method");
+
+            OnBeforeExtract(baseDir);
+            _ioOperationCanceled = false;
+            string targetFileName = null;
+            Stream output = null;
+            bool fileExistsBeforeExtraction = false;
+            bool checkLaterForResetDirTimes = false;
+            try
+            {
+                ValidateCompression();
+                ValidateEncryption();
+
+                if (ValidateOutput(baseDir, outstream, out targetFileName))
+                {
+                    WriteStatus("extract dir {0}...", targetFileName);
+                    // if true, then the entry was a directory and has been created.
+                    // We need to fire the Extract Event.
+                    OnAfterExtract(baseDir);
+                    return;
+                }
+
+                // workitem 10639
+                // do we want to extract to a regular filesystem file?
+                if (targetFileName != null)
+                {
+                    // Check for extracting to a previously extant file. The user
+                    // can specify bejavior for that case: overwrite, don't
+                    // overwrite, and throw.  Also, if the file exists prior to
+                    // extraction, it affects exception handling: whether to delete
+                    // the target of extraction or not.  This check needs to be done
+                    // before the password check is done, because password check may
+                    // throw a BadPasswordException, which triggers the catch,
+                    // wherein the extant file may be deleted if not flagged as
+                    // pre-existing.
+                    if (File.Exists(targetFileName))
+                    {
+                        fileExistsBeforeExtraction = true;
+                        int rc = CheckExtractExistingFile(baseDir, targetFileName);
+                        if (rc == 2) goto ExitTry; // cancel
+                        if (rc == 1) return; // do not overwrite
+                    }
+                }
+
+                // If no password explicitly specified, use the password on the entry itself,
+                // or on the zipfile itself.
+                string p = password ?? this._Password ?? this._container.Password;
+                if (_Encryption_FromZipFile != EncryptionAlgorithm.None)
+                {
+                    if (p == null)
+                        throw new BadPasswordException();
+                    SetupCryptoForExtract(p);
+                }
+
+
+                // set up the output stream
+                if (targetFileName != null)
+                {
+                    WriteStatus("extract file {0}...", targetFileName);
+                    targetFileName += ".tmp";
+                    var dirName = Path.GetDirectoryName(targetFileName);
+                    // ensure the target path exists
+                    if (!Directory.Exists(dirName))
+                    {
+                        // we create the directory here, but we do not set the
+                        // create/modified/accessed times on it because it is being
+                        // created implicitly, not explcitly. There's no entry in the
+                        // zip archive for the directory.
+                        Directory.CreateDirectory(dirName);
+                    }
+                    else
+                    {
+                        // workitem 8264
+                        if (_container.ZipFile != null)
+                            checkLaterForResetDirTimes = _container.ZipFile._inExtractAll;
+                    }
+
+                    // File.Create(CreateNew) will overwrite any existing file.
+                    output = new FileStream(targetFileName, FileMode.CreateNew);
+                }
+                else
+                {
+                    WriteStatus("extract entry {0} to stream...", FileName);
+                    output = outstream;
+                }
+
+
+                if (_ioOperationCanceled)
+                    goto ExitTry;
+
+                Int32 ActualCrc32 = ExtractOne(output);
+
+                if (_ioOperationCanceled)
+                    goto ExitTry;
+
+                VerifyCrcAfterExtract(ActualCrc32);
+
+                if (targetFileName != null)
+                {
+                    output.Close();
+                    output = null;
+
+                    // workitem 10639
+                    // move file to permanent home
+                    string tmpName = targetFileName;
+                    string zombie = null;
+                    targetFileName = tmpName.Substring(0,tmpName.Length-4);
+
+                    if (fileExistsBeforeExtraction)
+                    {
+                        // An AV program may hold the target file open, which means
+                        // File.Delete() will succeed, though the actual deletion
+                        // remains pending. This will prevent a subsequent
+                        // File.Move() from succeeding. To avoid this, when the file
+                        // already exists, we need to replace it in 3 steps:
+                        //
+                        //     1. rename the existing file to a zombie name;
+                        //     2. rename the extracted file from the temp name to
+                        //        the target file name;
+                        //     3. delete the zombie.
+                        //
+                        zombie = targetFileName + ".PendingOverwrite";
+                        File.Move(targetFileName, zombie);
+                    }
+
+                    File.Move(tmpName, targetFileName);
+                    _SetTimes(targetFileName, true);
+
+                    if (zombie != null && File.Exists(zombie))
+                        ReallyDelete(zombie);
+
+                    // workitem 8264
+                    if (checkLaterForResetDirTimes)
+                    {
+                        // This is sort of a hack.  What I do here is set the time on
+                        // the parent directory, every time a file is extracted into
+                        // it.  If there is a directory with 1000 files, then I set
+                        // the time on the dir, 1000 times. This allows the directory
+                        // to have times that reflect the actual time on the entry in
+                        // the zip archive.
+
+                        // String.Contains is not available on .NET CF 2.0
+                        if (this.FileName.IndexOf('/') != -1)
+                        {
+                            string dirname = Path.GetDirectoryName(this.FileName);
+                            if (this._container.ZipFile[dirname] == null)
+                            {
+                                _SetTimes(Path.GetDirectoryName(targetFileName), false);
+                            }
+                        }
+                    }
+
+#if NETCF
+                    // workitem 7926 - version made by OS can be zero or 10
+                    if ((_VersionMadeBy & 0xFF00) == 0x0a00 || (_VersionMadeBy & 0xFF00) == 0x0000)
+                        NetCfFile.SetAttributes(targetFileName, (uint)_ExternalFileAttrs);
+
+#else
+                    // workitem 7071
+                    //
+                    // We can only apply attributes if they are relevant to the NTFS
+                    // OS.  Must do this LAST because it may involve a ReadOnly bit,
+                    // which would prevent us from setting the time, etc.
+                    //
+                    // workitem 7926 - version made by OS can be zero (FAT) or 10
+                    // (NTFS)
+                    if ((_VersionMadeBy & 0xFF00) == 0x0a00 || (_VersionMadeBy & 0xFF00) == 0x0000)
+                        File.SetAttributes(targetFileName, (FileAttributes)_ExternalFileAttrs);
+#endif
+                }
+
+                OnAfterExtract(baseDir);
+
+                ExitTry: ;
+            }
+            catch (Exception)
+            {
+                _ioOperationCanceled = true;
+                throw;
+            }
+            finally
+            {
+                if (_ioOperationCanceled)
+                {
+                    if (targetFileName != null)
+                    {
+                        try
+                        {
+                            if (output != null) output.Close();
+                            // An exception has occurred. If the file exists, check
+                            // to see if it existed before we tried extracting.  If
+                            // it did not, attempt to remove the target file. There
+                            // is a small possibility that the existing file has
+                            // been extracted successfully, overwriting a previously
+                            // existing file, and an exception was thrown after that
+                            // but before final completion (setting times, etc). In
+                            // that case the file will remain, even though some
+                            // error occurred.  Nothing to be done about it.
+                            if (File.Exists(targetFileName) && !fileExistsBeforeExtraction)
+                                File.Delete(targetFileName);
+
+                        }
+                        finally { }
+                    }
+                }
+            }
+        }
+
+
+#if NOT
+        internal void CalcWinZipAesMac(Stream input)
+        {
+            if (Encryption == EncryptionAlgorithm.WinZipAes128 ||
+                Encryption == EncryptionAlgorithm.WinZipAes256)
+            {
+                if (input is WinZipAesCipherStream)
+                    wzs = input as WinZipAesCipherStream;
+
+                else if (input is Ionic.Zlib.CrcCalculatorStream)
+                {
+                    xxx;
+                }
+
+            }
+        }
+#endif
+
+
+        internal void VerifyCrcAfterExtract(Int32 actualCrc32)
+        {
+
+#if AESCRYPTO
+                // After extracting, Validate the CRC32
+                if (actualCrc32 != _Crc32)
+                {
+                    // CRC is not meaningful with WinZipAES and AES method 2 (AE-2)
+                    if ((Encryption != EncryptionAlgorithm.WinZipAes128 &&
+                         Encryption != EncryptionAlgorithm.WinZipAes256)
+                        || _WinZipAesMethod != 0x02)
+                        throw new BadCrcException("CRC error: the file being extracted appears to be corrupted. " +
+                                                  String.Format("Expected 0x{0:X8}, Actual 0x{1:X8}", _Crc32, actualCrc32));
+                }
+
+                // ignore MAC if the size of the file is zero
+                if (this.UncompressedSize == 0)
+                    return;
+
+                // calculate the MAC
+                if (Encryption == EncryptionAlgorithm.WinZipAes128 ||
+                    Encryption == EncryptionAlgorithm.WinZipAes256)
+                {
+                    WinZipAesCipherStream wzs = _inputDecryptorStream as WinZipAesCipherStream;
+                    _aesCrypto_forExtract.CalculatedMac = wzs.FinalAuthentication;
+
+                    _aesCrypto_forExtract.ReadAndVerifyMac(this.ArchiveStream); // throws if MAC is bad
+                    // side effect: advances file position.
+                }
+
+
+
+
+#else
+            if (actualCrc32 != _Crc32)
+                throw new BadCrcException("CRC error: the file being extracted appears to be corrupted. " +
+                                          String.Format("Expected 0x{0:X8}, Actual 0x{1:X8}", _Crc32, actualCrc32));
+#endif
+        }
+
+
+
+
+        private int CheckExtractExistingFile(string baseDir, string targetFileName)
+        {
+            int loop = 0;
+            // returns: 0 == extract, 1 = don't, 2 = cancel
+            do
+            {
+                switch (ExtractExistingFile)
+                {
+                    case ExtractExistingFileAction.OverwriteSilently:
+                        WriteStatus("the file {0} exists; will overwrite it...", targetFileName);
+                        return 0;
+
+                    case ExtractExistingFileAction.DoNotOverwrite:
+                        WriteStatus("the file {0} exists; not extracting entry...", FileName);
+                        OnAfterExtract(baseDir);
+                        return 1;
+
+                    case ExtractExistingFileAction.InvokeExtractProgressEvent:
+                        if (loop>0)
+                            throw new ZipException(String.Format("The file {0} already exists.", targetFileName));
+                        OnExtractExisting(baseDir);
+                        if (_ioOperationCanceled)
+                            return 2;
+
+                        // loop around
+                        break;
+
+                    case ExtractExistingFileAction.Throw:
+                    default:
+                        throw new ZipException(String.Format("The file {0} already exists.", targetFileName));
+                }
+                loop++;
+            }
+            while (true);
+        }
+
+
+
+
+        private void _CheckRead(int nbytes)
+        {
+            if (nbytes == 0)
+                throw new BadReadException(String.Format("bad read of entry {0} from compressed archive.",
+                             this.FileName));
+        }
+
+
+        private Stream _inputDecryptorStream;
+
+        private Int32 ExtractOne(Stream output)
+        {
+            Int32 CrcResult = 0;
+            Stream input = this.ArchiveStream;
+
+            try
+            {
+                // change for workitem 8098
+                input.Seek(this.FileDataPosition, SeekOrigin.Begin);
+                // workitem 10178
+                Ionic.Zip.SharedUtilities.Workaround_Ladybug318918(input);
+
+                byte[] bytes = new byte[BufferSize];
+
+                // The extraction process varies depending on how the entry was
+                // stored.  It could have been encrypted, and it coould have
+                // been compressed, or both, or neither. So we need to check
+                // both the encryption flag and the compression flag, and take
+                // the proper action in all cases.
+
+                Int64 LeftToRead = (_CompressionMethod_FromZipFile != (short)CompressionMethod.None)
+                    ? this.UncompressedSize
+                    : this._CompressedFileDataSize;
+
+                // Get a stream that either decrypts or not.
+                _inputDecryptorStream = GetExtractDecryptor(input);
+
+                Stream input3 = GetExtractDecompressor( _inputDecryptorStream );
+
+                Int64 bytesWritten = 0;
+                // As we read, we maybe decrypt, and then we maybe decompress. Then we write.
+                using (var s1 = new Ionic.Crc.CrcCalculatorStream(input3))
+                {
+                    while (LeftToRead > 0)
+                    {
+                        //Console.WriteLine("ExtractOne: LeftToRead {0}", LeftToRead);
+
+                        // Casting LeftToRead down to an int is ok here in the else clause,
+                        // because that only happens when it is less than bytes.Length,
+                        // which is much less than MAX_INT.
+                        int len = (LeftToRead > bytes.Length) ? bytes.Length : (int)LeftToRead;
+                        int n = s1.Read(bytes, 0, len);
+
+                        // must check data read - essential for detecting corrupt zip files
+                        _CheckRead(n);
+
+                        output.Write(bytes, 0, n);
+                        LeftToRead -= n;
+                        bytesWritten += n;
+
+                        // fire the progress event, check for cancels
+                        OnExtractProgress(bytesWritten, UncompressedSize);
+                        if (_ioOperationCanceled)
+                        {
+                            break;
+                        }
+                    }
+
+                    CrcResult = s1.Crc;
+                }
+            }
+            finally
+            {
+                var zss = input as ZipSegmentedStream;
+                if (zss != null)
+                {
+#if NETCF
+                    zss.Close();
+#else
+                    // need to dispose it
+                    zss.Dispose();
+#endif
+                    _archiveStream = null;
+                }
+            }
+
+            return CrcResult;
+        }
+
+
+
+        internal Stream GetExtractDecompressor(Stream input2)
+        {
+            // get a stream that either decompresses or not.
+            switch (_CompressionMethod_FromZipFile)
+            {
+                case (short)CompressionMethod.None:
+                    return input2;
+                case (short)CompressionMethod.Deflate:
+                    return new Ionic.Zlib.DeflateStream(input2, Ionic.Zlib.CompressionMode.Decompress, true);
+#if BZIP
+                case (short)CompressionMethod.BZip2:
+                    return new Ionic.BZip2.BZip2InputStream(input2, true);
+#endif
+            }
+
+            return null;
+        }
+
+
+
+        internal Stream GetExtractDecryptor(Stream input)
+        {
+            Stream input2 = null;
+            if (_Encryption_FromZipFile == EncryptionAlgorithm.PkzipWeak)
+                input2 = new ZipCipherStream(input, _zipCrypto_forExtract, CryptoMode.Decrypt);
+
+#if AESCRYPTO
+            else if (_Encryption_FromZipFile == EncryptionAlgorithm.WinZipAes128 ||
+                 _Encryption_FromZipFile == EncryptionAlgorithm.WinZipAes256)
+                input2 = new WinZipAesCipherStream(input, _aesCrypto_forExtract, _CompressedFileDataSize, CryptoMode.Decrypt);
+#endif
+
+            else
+                input2 = input;
+
+            return input2;
+        }
+
+
+
+
+        internal void _SetTimes(string fileOrDirectory, bool isFile)
+        {
+#if SILVERLIGHT
+                    // punt on setting file times
+#else
+            // workitem 8807:
+            // Because setting the time is not considered to be a fatal error,
+            // and because other applications can interfere with the setting
+            // of a time on a directory, we're going to swallow IO exceptions
+            // in this method.
+
+            try
+            {
+                if (_ntfsTimesAreSet)
+                {
+#if NETCF
+                    // workitem 7944: set time should not be a fatal error on CF
+                    int rc = NetCfFile.SetTimes(fileOrDirectory, _Ctime, _Atime, _Mtime);
+                    if ( rc != 0)
+                    {
+                        WriteStatus("Warning: SetTimes failed.  entry({0})  file({1})  rc({2})",
+                                    FileName, fileOrDirectory, rc);
+                    }
+#else
+                    if (isFile)
+                    {
+                        // It's possible that the extract was cancelled, in which case,
+                        // the file does not exist.
+                        if (File.Exists(fileOrDirectory))
+                        {
+                            File.SetCreationTimeUtc(fileOrDirectory, _Ctime);
+                            File.SetLastAccessTimeUtc(fileOrDirectory, _Atime);
+                            File.SetLastWriteTimeUtc(fileOrDirectory, _Mtime);
+                        }
+                    }
+                    else
+                    {
+                        // It's possible that the extract was cancelled, in which case,
+                        // the directory does not exist.
+                        if (Directory.Exists(fileOrDirectory))
+                        {
+                            Directory.SetCreationTimeUtc(fileOrDirectory, _Ctime);
+                            Directory.SetLastAccessTimeUtc(fileOrDirectory, _Atime);
+                            Directory.SetLastWriteTimeUtc(fileOrDirectory, _Mtime);
+                        }
+                    }
+#endif
+                }
+                else
+                {
+                    // workitem 6191
+                    DateTime AdjustedLastModified = Ionic.Zip.SharedUtilities.AdjustTime_Reverse(LastModified);
+
+#if NETCF
+                    int rc = NetCfFile.SetLastWriteTime(fileOrDirectory, AdjustedLastModified);
+
+                    if ( rc != 0)
+                    {
+                        WriteStatus("Warning: SetLastWriteTime failed.  entry({0})  file({1})  rc({2})",
+                                    FileName, fileOrDirectory, rc);
+                    }
+#else
+                    if (isFile)
+                        File.SetLastWriteTime(fileOrDirectory, AdjustedLastModified);
+                    else
+                        Directory.SetLastWriteTime(fileOrDirectory, AdjustedLastModified);
+#endif
+                }
+            }
+            catch (System.IO.IOException ioexc1)
+            {
+                WriteStatus("failed to set time on {0}: {1}", fileOrDirectory, ioexc1.Message);
+            }
+#endif
+        }
+
+
+        #region Support methods
+
+
+        // workitem 7968
+        private string UnsupportedAlgorithm
+        {
+            get
+            {
+                string alg = String.Empty;
+                switch (_UnsupportedAlgorithmId)
+                {
+                    case 0:
+                        alg = "--";
+                        break;
+                    case 0x6601:
+                        alg = "DES";
+                        break;
+                    case 0x6602: // - RC2 (version needed to extract < 5.2)
+                        alg = "RC2";
+                        break;
+                    case 0x6603: // - 3DES 168
+                        alg = "3DES-168";
+                        break;
+                    case 0x6609: // - 3DES 112
+                        alg = "3DES-112";
+                        break;
+                    case 0x660E: // - AES 128
+                        alg = "PKWare AES128";
+                        break;
+                    case 0x660F: // - AES 192
+                        alg = "PKWare AES192";
+                        break;
+                    case 0x6610: // - AES 256
+                        alg = "PKWare AES256";
+                        break;
+                    case 0x6702: // - RC2 (version needed to extract >= 5.2)
+                        alg = "RC2";
+                        break;
+                    case 0x6720: // - Blowfish
+                        alg = "Blowfish";
+                        break;
+                    case 0x6721: // - Twofish
+                        alg = "Twofish";
+                        break;
+                    case 0x6801: // - RC4
+                        alg = "RC4";
+                        break;
+                    case 0xFFFF: // - Unknown algorithm
+                    default:
+                        alg = String.Format("Unknown (0x{0:X4})", _UnsupportedAlgorithmId);
+                        break;
+                }
+                return alg;
+            }
+        }
+
+        // workitem 7968
+        private string UnsupportedCompressionMethod
+        {
+            get
+            {
+                string meth = String.Empty;
+                switch ((int)_CompressionMethod)
+                {
+                    case 0:
+                        meth = "Store";
+                        break;
+                    case 1:
+                        meth = "Shrink";
+                        break;
+                    case 8:
+                        meth = "DEFLATE";
+                        break;
+                    case 9:
+                        meth = "Deflate64";
+                        break;
+                    case 12:
+                        meth = "BZIP2"; // only if BZIP not compiled in
+                        break;
+                    case 14:
+                        meth = "LZMA";
+                        break;
+                    case 19:
+                        meth = "LZ77";
+                        break;
+                    case 98:
+                        meth = "PPMd";
+                        break;
+                    default:
+                        meth = String.Format("Unknown (0x{0:X4})", _CompressionMethod);
+                        break;
+                }
+                return meth;
+            }
+        }
+
+
+        internal void ValidateEncryption()
+        {
+            if (Encryption != EncryptionAlgorithm.PkzipWeak &&
+#if AESCRYPTO
+ Encryption != EncryptionAlgorithm.WinZipAes128 &&
+                Encryption != EncryptionAlgorithm.WinZipAes256 &&
+#endif
+ Encryption != EncryptionAlgorithm.None)
+            {
+                // workitem 7968
+                if (_UnsupportedAlgorithmId != 0)
+                    throw new ZipException(String.Format("Cannot extract: Entry {0} is encrypted with an algorithm not supported by DotNetZip: {1}",
+                                                         FileName, UnsupportedAlgorithm));
+                else
+                    throw new ZipException(String.Format("Cannot extract: Entry {0} uses an unsupported encryption algorithm ({1:X2})",
+                                                         FileName, (int)Encryption));
+            }
+        }
+
+
+        private void ValidateCompression()
+        {
+            if ((_CompressionMethod_FromZipFile != (short)CompressionMethod.None) &&
+                (_CompressionMethod_FromZipFile != (short)CompressionMethod.Deflate)
+#if BZIP
+                && (_CompressionMethod_FromZipFile != (short)CompressionMethod.BZip2)
+#endif
+                )
+                throw new ZipException(String.Format("Entry {0} uses an unsupported compression method (0x{1:X2}, {2})",
+                                                          FileName, _CompressionMethod_FromZipFile, UnsupportedCompressionMethod));
+        }
+
+
+        private void SetupCryptoForExtract(string password)
+        {
+            //if (password == null) return;
+            if (_Encryption_FromZipFile == EncryptionAlgorithm.None) return;
+
+            if (_Encryption_FromZipFile == EncryptionAlgorithm.PkzipWeak)
+            {
+                if (password == null)
+                    throw new ZipException("Missing password.");
+
+                this.ArchiveStream.Seek(this.FileDataPosition - 12, SeekOrigin.Begin);
+                // workitem 10178
+                Ionic.Zip.SharedUtilities.Workaround_Ladybug318918(this.ArchiveStream);
+                _zipCrypto_forExtract = ZipCrypto.ForRead(password, this);
+            }
+
+#if AESCRYPTO
+            else if (_Encryption_FromZipFile == EncryptionAlgorithm.WinZipAes128 ||
+                 _Encryption_FromZipFile == EncryptionAlgorithm.WinZipAes256)
+            {
+                if (password == null)
+                    throw new ZipException("Missing password.");
+
+                // If we already have a WinZipAesCrypto object in place, use it.
+                // It can be set up in the ReadDirEntry(), or during a previous Extract.
+                if (_aesCrypto_forExtract != null)
+                {
+                    _aesCrypto_forExtract.Password = password;
+                }
+                else
+                {
+                    int sizeOfSaltAndPv = GetLengthOfCryptoHeaderBytes(_Encryption_FromZipFile);
+                    this.ArchiveStream.Seek(this.FileDataPosition - sizeOfSaltAndPv, SeekOrigin.Begin);
+                    // workitem 10178
+                    Ionic.Zip.SharedUtilities.Workaround_Ladybug318918(this.ArchiveStream);
+                    int keystrength = GetKeyStrengthInBits(_Encryption_FromZipFile);
+                    _aesCrypto_forExtract = WinZipAesCrypto.ReadFromStream(password, keystrength, this.ArchiveStream);
+                }
+            }
+#endif
+        }
+
+
+
+        /// <summary>
+        /// Validates that the args are consistent.
+        /// </summary>
+        /// <remarks>
+        /// Only one of {baseDir, outStream} can be non-null.
+        /// If baseDir is non-null, then the outputFile is created.
+        /// </remarks>
+        private bool ValidateOutput(string basedir, Stream outstream, out string outFileName)
+        {
+            if (basedir != null)
+            {
+                // Sometimes the name on the entry starts with a slash.
+                // Rather than unpack to the root of the volume, we're going to
+                // drop the slash and unpack to the specified base directory.
+                string f = this.FileName.Replace("\\","/");
+
+                // workitem 11772: remove drive letter with separator
+                if (f.IndexOf(':') == 1)
+                    f= f.Substring(2);
+
+                if (f.StartsWith("/"))
+                    f= f.Substring(1);
+
+                // String.Contains is not available on .NET CF 2.0
+
+                if (_container.ZipFile.FlattenFoldersOnExtract)
+                    outFileName = Path.Combine(basedir,
+                                              (f.IndexOf('/') != -1) ? Path.GetFileName(f) : f);
+                else
+                    outFileName = Path.Combine(basedir, f);
+
+                // workitem 10639
+                outFileName = outFileName.Replace("/","\\");
+
+                // check if it is a directory
+                if ((IsDirectory) || (FileName.EndsWith("/")))
+                {
+                    if (!Directory.Exists(outFileName))
+                    {
+                        Directory.CreateDirectory(outFileName);
+                        _SetTimes(outFileName, false);
+                    }
+                    else
+                    {
+                        // the dir exists, maybe we want to overwrite times.
+                        if (ExtractExistingFile == ExtractExistingFileAction.OverwriteSilently)
+                            _SetTimes(outFileName, false);
+                    }
+                    return true;  // true == all done, caller will return
+                }
+                return false;  // false == work to do by caller.
+            }
+
+            if (outstream != null)
+            {
+                outFileName = null;
+                if ((IsDirectory) || (FileName.EndsWith("/")))
+                {
+                    // extract a directory to streamwriter?  nothing to do!
+                    return true;  // true == all done!  caller can return
+                }
+                return false;
+            }
+
+            throw new ArgumentNullException("outstream");
+        }
+
+
+        #endregion
+
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ZipEntry.Read.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ZipEntry.Read.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ZipEntry.Read.cs	(revision 12707)
@@ -0,0 +1,798 @@
+// ZipEntry.Read.cs
+// ------------------------------------------------------------------
+//
+// Copyright (c) 2009-2011 Dino Chiesa
+// All rights reserved.
+//
+// This code module is part of DotNetZip, a zipfile class library.
+//
+// ------------------------------------------------------------------
+//
+// This code is licensed under the Microsoft Public License.
+// See the file License.txt for the license details.
+// More info on: http://dotnetzip.codeplex.com
+//
+// ------------------------------------------------------------------
+//
+// last saved (in emacs):
+// Time-stamp: <2011-July-09 21:31:28>
+//
+// ------------------------------------------------------------------
+//
+// This module defines logic for Reading the ZipEntry from a
+// zip file.
+//
+// ------------------------------------------------------------------
+
+
+using System;
+using System.IO;
+
+namespace OfficeOpenXml.Packaging.Ionic.Zip
+{
+    internal partial class ZipEntry
+    {
+        private int _readExtraDepth;
+        private void ReadExtraField()
+        {
+            _readExtraDepth++;
+            // workitem 8098: ok (restore)
+            long posn = this.ArchiveStream.Position;
+            this.ArchiveStream.Seek(this._RelativeOffsetOfLocalHeader, SeekOrigin.Begin);
+            // workitem 10178
+            Ionic.Zip.SharedUtilities.Workaround_Ladybug318918(this.ArchiveStream);
+
+            byte[] block = new byte[30];
+            this.ArchiveStream.Read(block, 0, block.Length);
+            int i = 26;
+            Int16 filenameLength = (short)(block[i++] + block[i++] * 256);
+            Int16 extraFieldLength = (short)(block[i++] + block[i++] * 256);
+
+            // workitem 8098: ok (relative)
+            this.ArchiveStream.Seek(filenameLength, SeekOrigin.Current);
+            // workitem 10178
+            Ionic.Zip.SharedUtilities.Workaround_Ladybug318918(this.ArchiveStream);
+
+            ProcessExtraField(this.ArchiveStream, extraFieldLength);
+
+            // workitem 8098: ok (restore)
+            this.ArchiveStream.Seek(posn, SeekOrigin.Begin);
+            // workitem 10178
+            Ionic.Zip.SharedUtilities.Workaround_Ladybug318918(this.ArchiveStream);
+            _readExtraDepth--;
+        }
+
+
+        private static bool ReadHeader(ZipEntry ze, System.Text.Encoding defaultEncoding)
+        {
+            int bytesRead = 0;
+
+            // change for workitem 8098
+            ze._RelativeOffsetOfLocalHeader = ze.ArchiveStream.Position;
+
+            int signature = Ionic.Zip.SharedUtilities.ReadEntrySignature(ze.ArchiveStream);
+            bytesRead += 4;
+
+            // Return false if this is not a local file header signature.
+            if (ZipEntry.IsNotValidSig(signature))
+            {
+                // Getting "not a ZipEntry signature" is not always wrong or an error.
+                // This will happen after the last entry in a zipfile.  In that case, we
+                // expect to read :
+                //    a ZipDirEntry signature (if a non-empty zip file) or
+                //    a ZipConstants.EndOfCentralDirectorySignature.
+                //
+                // Anything else is a surprise.
+
+                ze.ArchiveStream.Seek(-4, SeekOrigin.Current); // unread the signature
+                // workitem 10178
+                Ionic.Zip.SharedUtilities.Workaround_Ladybug318918(ze.ArchiveStream);
+                if (ZipEntry.IsNotValidZipDirEntrySig(signature) && (signature != ZipConstants.EndOfCentralDirectorySignature))
+                {
+                    throw new BadReadException(String.Format("  Bad signature (0x{0:X8}) at position  0x{1:X8}", signature, ze.ArchiveStream.Position));
+                }
+                return false;
+            }
+
+            byte[] block = new byte[26];
+            int n = ze.ArchiveStream.Read(block, 0, block.Length);
+            if (n != block.Length) return false;
+            bytesRead += n;
+
+            int i = 0;
+            ze._VersionNeeded = (Int16)(block[i++] + block[i++] * 256);
+            ze._BitField = (Int16)(block[i++] + block[i++] * 256);
+            ze._CompressionMethod_FromZipFile = ze._CompressionMethod = (Int16)(block[i++] + block[i++] * 256);
+            ze._TimeBlob = block[i++] + block[i++] * 256 + block[i++] * 256 * 256 + block[i++] * 256 * 256 * 256;
+            // transform the time data into something usable (a DateTime)
+            ze._LastModified = Ionic.Zip.SharedUtilities.PackedToDateTime(ze._TimeBlob);
+            ze._timestamp |= ZipEntryTimestamp.DOS;
+
+            if ((ze._BitField & 0x01) == 0x01)
+            {
+                ze._Encryption_FromZipFile = ze._Encryption = EncryptionAlgorithm.PkzipWeak; // this *may* change after processing the Extra field
+                ze._sourceIsEncrypted = true;
+            }
+
+            // NB: if ((ze._BitField & 0x0008) != 0x0008), then the Compressed, uncompressed and
+            // CRC values are not true values; the true values will follow the entry data.
+            // But, regardless of the status of bit 3 in the bitfield, the slots for
+            // the three amigos may contain marker values for ZIP64.  So we must read them.
+            {
+                ze._Crc32 = (Int32)(block[i++] + block[i++] * 256 + block[i++] * 256 * 256 + block[i++] * 256 * 256 * 256);
+                ze._CompressedSize = (uint)(block[i++] + block[i++] * 256 + block[i++] * 256 * 256 + block[i++] * 256 * 256 * 256);
+                ze._UncompressedSize = (uint)(block[i++] + block[i++] * 256 + block[i++] * 256 * 256 + block[i++] * 256 * 256 * 256);
+
+                if ((uint)ze._CompressedSize == 0xFFFFFFFF ||
+                    (uint)ze._UncompressedSize == 0xFFFFFFFF)
+
+                    ze._InputUsesZip64 = true;
+            }
+
+            Int16 filenameLength = (short)(block[i++] + block[i++] * 256);
+            Int16 extraFieldLength = (short)(block[i++] + block[i++] * 256);
+
+            block = new byte[filenameLength];
+            n = ze.ArchiveStream.Read(block, 0, block.Length);
+            bytesRead += n;
+
+            // if the UTF8 bit is set for this entry, override the
+            // encoding the application requested.
+
+            if ((ze._BitField & 0x0800) == 0x0800)
+            {
+                // workitem 12744
+                ze.AlternateEncoding = System.Text.Encoding.UTF8;
+                ze.AlternateEncodingUsage = ZipOption.Always;
+            }
+
+            // need to use this form of GetString() for .NET CF
+            ze._FileNameInArchive = ze.AlternateEncoding.GetString(block, 0, block.Length);
+
+            // workitem 6898
+            if (ze._FileNameInArchive.EndsWith("/")) ze.MarkAsDirectory();
+
+            bytesRead += ze.ProcessExtraField(ze.ArchiveStream, extraFieldLength);
+
+            ze._LengthOfTrailer = 0;
+
+            // workitem 6607 - don't read for directories
+            // actually get the compressed size and CRC if necessary
+            if (!ze._FileNameInArchive.EndsWith("/") && (ze._BitField & 0x0008) == 0x0008)
+            {
+                // This descriptor exists only if bit 3 of the general
+                // purpose bit flag is set (see below).  It is byte aligned
+                // and immediately follows the last byte of compressed data,
+                // as well as any encryption trailer, as with AES.
+                // This descriptor is used only when it was not possible to
+                // seek in the output .ZIP file, e.g., when the output .ZIP file
+                // was standard output or a non-seekable device.  For ZIP64(tm) format
+                // archives, the compressed and uncompressed sizes are 8 bytes each.
+
+                // workitem 8098: ok (restore)
+                long posn = ze.ArchiveStream.Position;
+
+                // Here, we're going to loop until we find a ZipEntryDataDescriptorSignature and
+                // a consistent data record after that.   To be consistent, the data record must
+                // indicate the length of the entry data.
+                bool wantMore = true;
+                long SizeOfDataRead = 0;
+                int tries = 0;
+                while (wantMore)
+                {
+                    tries++;
+                    // We call the FindSignature shared routine to find the specified signature
+                    // in the already-opened zip archive, starting from the current cursor
+                    // position in that filestream.  If we cannot find the signature, then the
+                    // routine returns -1, and the ReadHeader() method returns false,
+                    // indicating we cannot read a legal entry header.  If we have found it,
+                    // then the FindSignature() method returns the number of bytes in the
+                    // stream we had to seek forward, to find the sig.  We need this to
+                    // determine if the zip entry is valid, later.
+
+                    if (ze._container.ZipFile != null)
+                        ze._container.ZipFile.OnReadBytes(ze);
+
+                    long d = Ionic.Zip.SharedUtilities.FindSignature(ze.ArchiveStream, ZipConstants.ZipEntryDataDescriptorSignature);
+                    if (d == -1) return false;
+
+                    // total size of data read (through all loops of this).
+                    SizeOfDataRead += d;
+
+                    if (ze._InputUsesZip64)
+                    {
+                        // read 1x 4-byte (CRC) and 2x 8-bytes (Compressed Size, Uncompressed Size)
+                        block = new byte[20];
+                        n = ze.ArchiveStream.Read(block, 0, block.Length);
+                        if (n != 20) return false;
+
+                        // do not increment bytesRead - it is for entry header only.
+                        // the data we have just read is a footer (falls after the file data)
+                        //bytesRead += n;
+
+                        i = 0;
+                        ze._Crc32 = (Int32)(block[i++] + block[i++] * 256 + block[i++] * 256 * 256 + block[i++] * 256 * 256 * 256);
+                        ze._CompressedSize = BitConverter.ToInt64(block, i);
+                        i += 8;
+                        ze._UncompressedSize = BitConverter.ToInt64(block, i);
+                        i += 8;
+
+                        ze._LengthOfTrailer += 24;  // bytes including sig, CRC, Comp and Uncomp sizes
+                    }
+                    else
+                    {
+                        // read 3x 4-byte fields (CRC, Compressed Size, Uncompressed Size)
+                        block = new byte[12];
+                        n = ze.ArchiveStream.Read(block, 0, block.Length);
+                        if (n != 12) return false;
+
+                        // do not increment bytesRead - it is for entry header only.
+                        // the data we have just read is a footer (falls after the file data)
+                        //bytesRead += n;
+
+                        i = 0;
+                        ze._Crc32 = (Int32)(block[i++] + block[i++] * 256 + block[i++] * 256 * 256 + block[i++] * 256 * 256 * 256);
+                        ze._CompressedSize = (uint)(block[i++] + block[i++] * 256 + block[i++] * 256 * 256 + block[i++] * 256 * 256 * 256);
+                        ze._UncompressedSize = (uint)(block[i++] + block[i++] * 256 + block[i++] * 256 * 256 + block[i++] * 256 * 256 * 256);
+
+                        ze._LengthOfTrailer += 16;  // bytes including sig, CRC, Comp and Uncomp sizes
+
+                    }
+
+                    wantMore = (SizeOfDataRead != ze._CompressedSize);
+
+                    if (wantMore)
+                    {
+                        // Seek back to un-read the last 12 bytes  - maybe THEY contain
+                        // the ZipEntryDataDescriptorSignature.
+                        // (12 bytes for the CRC, Comp and Uncomp size.)
+                        ze.ArchiveStream.Seek(-12, SeekOrigin.Current);
+                        // workitem 10178
+                        Ionic.Zip.SharedUtilities.Workaround_Ladybug318918(ze.ArchiveStream);
+
+                        // Adjust the size to account for the false signature read in
+                        // FindSignature().
+                        SizeOfDataRead += 4;
+                    }
+                }
+
+                // seek back to previous position, to prepare to read file data
+                // workitem 8098: ok (restore)
+                ze.ArchiveStream.Seek(posn, SeekOrigin.Begin);
+                // workitem 10178
+                Ionic.Zip.SharedUtilities.Workaround_Ladybug318918(ze.ArchiveStream);
+            }
+
+            ze._CompressedFileDataSize = ze._CompressedSize;
+
+
+            // bit 0 set indicates that some kind of encryption is in use
+            if ((ze._BitField & 0x01) == 0x01)
+            {
+#if AESCRYPTO
+                if (ze.Encryption == EncryptionAlgorithm.WinZipAes128 ||
+                    ze.Encryption == EncryptionAlgorithm.WinZipAes256)
+                {
+                    int bits = ZipEntry.GetKeyStrengthInBits(ze._Encryption_FromZipFile);
+                    // read in the WinZip AES metadata: salt + PV. 18 bytes for AES256. 10 bytes for AES128.
+                    ze._aesCrypto_forExtract = WinZipAesCrypto.ReadFromStream(null, bits, ze.ArchiveStream);
+                    bytesRead += ze._aesCrypto_forExtract.SizeOfEncryptionMetadata - 10; // MAC (follows crypto bytes)
+                    // according to WinZip, the CompressedSize includes the AES Crypto framing data.
+                    ze._CompressedFileDataSize -= ze._aesCrypto_forExtract.SizeOfEncryptionMetadata;
+                    ze._LengthOfTrailer += 10;  // MAC
+                }
+                else
+#endif
+                {
+                    // read in the header data for "weak" encryption
+                    ze._WeakEncryptionHeader = new byte[12];
+                    bytesRead += ZipEntry.ReadWeakEncryptionHeader(ze._archiveStream, ze._WeakEncryptionHeader);
+                    // decrease the filedata size by 12 bytes
+                    ze._CompressedFileDataSize -= 12;
+                }
+            }
+
+            // Remember the size of the blob for this entry.
+            // We also have the starting position in the stream for this entry.
+            ze._LengthOfHeader = bytesRead;
+            ze._TotalEntrySize = ze._LengthOfHeader + ze._CompressedFileDataSize + ze._LengthOfTrailer;
+
+
+            // We've read in the regular entry header, the extra field, and any
+            // encryption header.  The pointer in the file is now at the start of the
+            // filedata, which is potentially compressed and encrypted.  Just ahead in
+            // the file, there are _CompressedFileDataSize bytes of data, followed by
+            // potentially a non-zero length trailer, consisting of optionally, some
+            // encryption stuff (10 byte MAC for AES), and the bit-3 trailer (16 or 24
+            // bytes).
+
+            return true;
+        }
+
+
+
+        internal static int ReadWeakEncryptionHeader(Stream s, byte[] buffer)
+        {
+            // PKZIP encrypts the compressed data stream.  Encrypted files must
+            // be decrypted before they can be extracted.
+
+            // Each PKZIP-encrypted file has an extra 12 bytes stored at the start of the data
+            // area defining the encryption header for that file.  The encryption header is
+            // originally set to random values, and then itself encrypted, using three, 32-bit
+            // keys.  The key values are initialized using the supplied encryption password.
+            // After each byte is encrypted, the keys are then updated using pseudo-random
+            // number generation techniques in combination with the same CRC-32 algorithm used
+            // in PKZIP and implemented in the CRC32.cs module in this project.
+
+            // read the 12-byte encryption header
+            int additionalBytesRead = s.Read(buffer, 0, 12);
+            if (additionalBytesRead != 12)
+                throw new ZipException(String.Format("Unexpected end of data at position 0x{0:X8}", s.Position));
+
+            return additionalBytesRead;
+        }
+
+
+
+        private static bool IsNotValidSig(int signature)
+        {
+            return (signature != ZipConstants.ZipEntrySignature);
+        }
+
+
+        /// <summary>
+        ///   Reads one <c>ZipEntry</c> from the given stream.  The content for
+        ///   the entry does not get decompressed or decrypted.  This method
+        ///   basically reads metadata, and seeks.
+        /// </summary>
+        /// <param name="zc">the ZipContainer this entry belongs to.</param>
+        /// <param name="first">
+        ///   true of this is the first entry being read from the stream.
+        /// </param>
+        /// <returns>the <c>ZipEntry</c> read from the stream.</returns>
+        internal static ZipEntry ReadEntry(ZipContainer zc, bool first)
+        {
+            ZipFile zf = zc.ZipFile;
+            Stream s = zc.ReadStream;
+            System.Text.Encoding defaultEncoding = zc.AlternateEncoding;
+            ZipEntry entry = new ZipEntry();
+            entry._Source = ZipEntrySource.ZipFile;
+            entry._container = zc;
+            entry._archiveStream = s;
+            if (zf != null)
+                zf.OnReadEntry(true, null);
+
+            if (first) HandlePK00Prefix(s);
+
+            // Read entry header, including any encryption header
+            if (!ReadHeader(entry, defaultEncoding)) return null;
+
+            // Store the position in the stream for this entry
+            // change for workitem 8098
+            entry.__FileDataPosition = entry.ArchiveStream.Position;
+
+            // seek past the data without reading it. We will read on Extract()
+            s.Seek(entry._CompressedFileDataSize + entry._LengthOfTrailer, SeekOrigin.Current);
+            // workitem 10178
+            Ionic.Zip.SharedUtilities.Workaround_Ladybug318918(s);
+
+            // ReadHeader moves the file pointer to the end of the entry header,
+            // as well as any encryption header.
+
+            // CompressedFileDataSize includes:
+            //   the maybe compressed, maybe encrypted file data
+            //   the encryption trailer, if any
+            //   the bit 3 descriptor, if any
+
+            // workitem 5306
+            // http://www.codeplex.com/DotNetZip/WorkItem/View.aspx?WorkItemId=5306
+            HandleUnexpectedDataDescriptor(entry);
+
+            if (zf != null)
+            {
+                zf.OnReadBytes(entry);
+                zf.OnReadEntry(false, entry);
+            }
+
+            return entry;
+        }
+
+
+        internal static void HandlePK00Prefix(Stream s)
+        {
+            // in some cases, the zip file begins with "PK00".  This is a throwback and is rare,
+            // but we handle it anyway. We do not change behavior based on it.
+            uint datum = (uint)Ionic.Zip.SharedUtilities.ReadInt(s);
+            if (datum != ZipConstants.PackedToRemovableMedia)
+            {
+                s.Seek(-4, SeekOrigin.Current); // unread the block
+                // workitem 10178
+                Ionic.Zip.SharedUtilities.Workaround_Ladybug318918(s);
+            }
+        }
+
+
+
+        private static void HandleUnexpectedDataDescriptor(ZipEntry entry)
+        {
+            Stream s = entry.ArchiveStream;
+
+            // In some cases, the "data descriptor" is present, without a signature, even when
+            // bit 3 of the BitField is NOT SET.  This is the CRC, followed
+            //    by the compressed length and the uncompressed length (4 bytes for each
+            //    of those three elements).  Need to check that here.
+            //
+            uint datum = (uint)Ionic.Zip.SharedUtilities.ReadInt(s);
+            if (datum == entry._Crc32)
+            {
+                int sz = Ionic.Zip.SharedUtilities.ReadInt(s);
+                if (sz == entry._CompressedSize)
+                {
+                    sz = Ionic.Zip.SharedUtilities.ReadInt(s);
+                    if (sz == entry._UncompressedSize)
+                    {
+                        // ignore everything and discard it.
+                    }
+                    else
+                    {
+                        s.Seek(-12, SeekOrigin.Current); // unread the three blocks
+
+                        // workitem 10178
+                        Ionic.Zip.SharedUtilities.Workaround_Ladybug318918(s);
+                    }
+                }
+                else
+                {
+                    s.Seek(-8, SeekOrigin.Current); // unread the two blocks
+
+                    // workitem 10178
+                    Ionic.Zip.SharedUtilities.Workaround_Ladybug318918(s);
+                }
+            }
+            else
+            {
+                s.Seek(-4, SeekOrigin.Current); // unread the block
+
+                // workitem 10178
+                Ionic.Zip.SharedUtilities.Workaround_Ladybug318918(s);
+            }
+        }
+
+
+        /// <summary>
+        ///   Finds a particular segment in the given extra field.
+        ///   This is used when modifying a previously-generated
+        ///   extra field, in particular when removing the AES crypto
+        ///   segment in the extra field.
+        /// </summary>
+        static internal int FindExtraFieldSegment(byte[] extra, int offx, UInt16 targetHeaderId)
+        {
+            int j = offx;
+            while (j + 3 < extra.Length)
+            {
+                UInt16 headerId = (UInt16)(extra[j++] + extra[j++] * 256);
+                if (headerId == targetHeaderId) return j-2;
+
+                // else advance to next segment
+                Int16 dataSize = (short)(extra[j++] + extra[j++] * 256);
+                j+= dataSize;
+            }
+
+            return -1;
+        }
+
+
+        /// <summary>
+        ///   At current cursor position in the stream, read the extra
+        ///   field, and set the properties on the ZipEntry instance
+        ///   appropriately.  This can be called when processing the
+        ///   Extra field in the Central Directory, or in the local
+        ///   header.
+        /// </summary>
+        internal int ProcessExtraField(Stream s, Int16 extraFieldLength)
+        {
+            int additionalBytesRead = 0;
+            if (extraFieldLength > 0)
+            {
+                byte[] buffer = this._Extra = new byte[extraFieldLength];
+                additionalBytesRead = s.Read(buffer, 0, buffer.Length);
+                long posn = s.Position - additionalBytesRead;
+                int j = 0;
+                while (j + 3 < buffer.Length)
+                {
+                    int start = j;
+                    UInt16 headerId = (UInt16)(buffer[j++] + buffer[j++] * 256);
+                    Int16 dataSize = (short)(buffer[j++] + buffer[j++] * 256);
+
+                    switch (headerId)
+                    {
+                        case 0x000a:  // NTFS ctime, atime, mtime
+                            j = ProcessExtraFieldWindowsTimes(buffer, j, dataSize, posn);
+                            break;
+
+                        case 0x5455:  // Unix ctime, atime, mtime
+                            j = ProcessExtraFieldUnixTimes(buffer, j, dataSize, posn);
+                            break;
+
+                        case 0x5855:  // Info-zip Extra field (outdated)
+                            // This is outdated, so the field is supported on
+                            // read only.
+                            j = ProcessExtraFieldInfoZipTimes(buffer, j, dataSize, posn);
+                            break;
+
+                        case 0x7855:  // Unix uid/gid
+                            // ignored. DotNetZip does not handle this field.
+                            break;
+
+                        case 0x7875:  // ??
+                            // ignored.  I could not find documentation on this field,
+                            // though it appears in some zip files.
+                            break;
+
+                        case 0x0001: // ZIP64
+                            j = ProcessExtraFieldZip64(buffer, j, dataSize, posn);
+                            break;
+
+#if AESCRYPTO
+                        case 0x9901: // WinZip AES encryption is in use.  (workitem 6834)
+                            // we will handle this extra field only  if compressionmethod is 0x63
+                            j = ProcessExtraFieldWinZipAes(buffer, j, dataSize, posn);
+                            break;
+#endif
+                        case 0x0017: // workitem 7968: handle PKWare Strong encryption header
+                            j = ProcessExtraFieldPkwareStrongEncryption(buffer, j);
+                            break;
+                    }
+
+                    // move to the next Header in the extra field
+                    j = start + dataSize + 4;
+                }
+            }
+            return additionalBytesRead;
+        }
+
+        private int ProcessExtraFieldPkwareStrongEncryption(byte[] Buffer, int j)
+        {
+            //           Value     Size     Description
+            //           -----     ----     -----------
+            //           0x0017    2 bytes  Tag for this "extra" block type
+            //           TSize     2 bytes  Size of data that follows
+            //           Format    2 bytes  Format definition for this record
+            //           AlgID     2 bytes  Encryption algorithm identifier
+            //           Bitlen    2 bytes  Bit length of encryption key
+            //           Flags     2 bytes  Processing flags
+            //           CertData  TSize-8  Certificate decryption extra field data
+            //                              (refer to the explanation for CertData
+            //                               in the section describing the
+            //                               Certificate Processing Method under
+            //                               the Strong Encryption Specification)
+
+            j += 2;
+            _UnsupportedAlgorithmId = (UInt16)(Buffer[j++] + Buffer[j++] * 256);
+            _Encryption_FromZipFile = _Encryption = EncryptionAlgorithm.Unsupported;
+
+            // DotNetZip doesn't support this algorithm, but we don't need to throw
+            // here.  we might just be reading the archive, which is fine.  We'll
+            // need to throw if Extract() is called.
+
+            return j;
+        }
+
+
+#if AESCRYPTO
+        private int ProcessExtraFieldWinZipAes(byte[] buffer, int j, Int16 dataSize, long posn)
+        {
+            if (this._CompressionMethod == 0x0063)
+            {
+                if ((this._BitField & 0x01) != 0x01)
+                    throw new BadReadException(String.Format("  Inconsistent metadata at position 0x{0:X16}", posn));
+
+                this._sourceIsEncrypted = true;
+
+                //this._aesCrypto = new WinZipAesCrypto(this);
+                // see spec at http://www.winzip.com/aes_info.htm
+                if (dataSize != 7)
+                    throw new BadReadException(String.Format("  Inconsistent size (0x{0:X4}) in WinZip AES field at position 0x{1:X16}", dataSize, posn));
+
+                this._WinZipAesMethod = BitConverter.ToInt16(buffer, j);
+                j += 2;
+                if (this._WinZipAesMethod != 0x01 && this._WinZipAesMethod != 0x02)
+                    throw new BadReadException(String.Format("  Unexpected vendor version number (0x{0:X4}) for WinZip AES metadata at position 0x{1:X16}",
+                        this._WinZipAesMethod, posn));
+
+                Int16 vendorId = BitConverter.ToInt16(buffer, j);
+                j += 2;
+                if (vendorId != 0x4541)
+                    throw new BadReadException(String.Format("  Unexpected vendor ID (0x{0:X4}) for WinZip AES metadata at position 0x{1:X16}", vendorId, posn));
+
+                int keystrength = (buffer[j] == 1) ? 128 : (buffer[j] == 3) ? 256 : -1;
+                if (keystrength < 0)
+                    throw new BadReadException(String.Format("Invalid key strength ({0})", keystrength));
+
+                _Encryption_FromZipFile = this._Encryption = (keystrength == 128)
+                    ? EncryptionAlgorithm.WinZipAes128
+                    : EncryptionAlgorithm.WinZipAes256;
+
+                j++;
+
+                // set the actual compression method
+                this._CompressionMethod_FromZipFile =
+                this._CompressionMethod = BitConverter.ToInt16(buffer, j);
+                j += 2; // for the next segment of the extra field
+            }
+            return j;
+        }
+
+#endif
+
+        private delegate T Func<T>();
+
+        private int ProcessExtraFieldZip64(byte[] buffer, int j, Int16 dataSize, long posn)
+        {
+            // The PKWare spec says that any of {UncompressedSize, CompressedSize,
+            // RelativeOffset} exceeding 0xFFFFFFFF can lead to the ZIP64 header,
+            // and the ZIP64 header may contain one or more of those.  If the
+            // values are present, they will be found in the prescribed order.
+            // There may also be a 4-byte "disk start number."
+            // This means that the DataSize must be 28 bytes or less.
+
+            this._InputUsesZip64 = true;
+
+            // workitem 7941: check datasize before reading.
+            if (dataSize > 28)
+                throw new BadReadException(String.Format("  Inconsistent size (0x{0:X4}) for ZIP64 extra field at position 0x{1:X16}",
+                                                         dataSize, posn));
+            int remainingData = dataSize;
+
+            var slurp = new Func<Int64>( () => {
+                    if (remainingData < 8)
+                        throw new BadReadException(String.Format("  Missing data for ZIP64 extra field, position 0x{0:X16}", posn));
+                    var x = BitConverter.ToInt64(buffer, j);
+                    j+= 8;
+                    remainingData -= 8;
+                    return x;
+                });
+
+            if (this._UncompressedSize == 0xFFFFFFFF)
+                this._UncompressedSize = slurp();
+
+            if (this._CompressedSize == 0xFFFFFFFF)
+                this._CompressedSize = slurp();
+
+            if (this._RelativeOffsetOfLocalHeader == 0xFFFFFFFF)
+                this._RelativeOffsetOfLocalHeader = slurp();
+
+            // Ignore anything else. Potentially there are 4 more bytes for the
+            // disk start number.  DotNetZip currently doesn't handle multi-disk
+            // archives.
+            return j;
+        }
+
+
+        private int ProcessExtraFieldInfoZipTimes(byte[] buffer, int j, Int16 dataSize, long posn)
+        {
+            if (dataSize != 12 && dataSize != 8)
+                throw new BadReadException(String.Format("  Unexpected size (0x{0:X4}) for InfoZip v1 extra field at position 0x{1:X16}", dataSize, posn));
+
+            Int32 timet = BitConverter.ToInt32(buffer, j);
+            this._Mtime = _unixEpoch.AddSeconds(timet);
+            j += 4;
+
+            timet = BitConverter.ToInt32(buffer, j);
+            this._Atime = _unixEpoch.AddSeconds(timet);
+            j += 4;
+
+            this._Ctime = DateTime.UtcNow;
+
+            _ntfsTimesAreSet = true;
+            _timestamp |= ZipEntryTimestamp.InfoZip1; return j;
+        }
+
+
+
+        private int ProcessExtraFieldUnixTimes(byte[] buffer, int j, Int16 dataSize, long posn)
+        {
+            // The Unix filetimes are 32-bit unsigned integers,
+            // storing seconds since Unix epoch.
+
+            if (dataSize != 13 && dataSize != 9 && dataSize != 5)
+                throw new BadReadException(String.Format("  Unexpected size (0x{0:X4}) for Extended Timestamp extra field at position 0x{1:X16}", dataSize, posn));
+
+            int remainingData = dataSize;
+
+            var slurp = new Func<DateTime>( () => {
+                    Int32 timet = BitConverter.ToInt32(buffer, j);
+                    j += 4;
+                    remainingData -= 4;
+                    return _unixEpoch.AddSeconds(timet);
+                });
+
+            if (dataSize == 13 || _readExtraDepth > 0)
+            {
+                byte flag = buffer[j++];
+                remainingData--;
+
+                if ((flag & 0x0001) != 0 && remainingData >= 4)
+                    this._Mtime = slurp();
+
+                 this._Atime = ((flag & 0x0002) != 0 && remainingData >= 4)
+                     ? slurp()
+                     : DateTime.UtcNow;
+
+                 this._Ctime =  ((flag & 0x0004) != 0 && remainingData >= 4)
+                     ? slurp()
+                     :DateTime.UtcNow;
+
+                _timestamp |= ZipEntryTimestamp.Unix;
+                _ntfsTimesAreSet = true;
+                _emitUnixTimes = true;
+            }
+            else
+                ReadExtraField(); // will recurse
+
+            return j;
+        }
+
+
+        private int ProcessExtraFieldWindowsTimes(byte[] buffer, int j, Int16 dataSize, long posn)
+        {
+            // The NTFS filetimes are 64-bit unsigned integers, stored in Intel
+            // (least significant byte first) byte order. They are expressed as the
+            // number of 1.0E-07 seconds (1/10th microseconds!) past WinNT "epoch",
+            // which is "01-Jan-1601 00:00:00 UTC".
+            //
+            // HeaderId   2 bytes    0x000a == NTFS stuff
+            // Datasize   2 bytes    ?? (usually 32)
+            // reserved   4 bytes    ??
+            // timetag    2 bytes    0x0001 == time
+            // size       2 bytes    24 == 8 bytes each for ctime, mtime, atime
+            // mtime      8 bytes    win32 ticks since win32epoch
+            // atime      8 bytes    win32 ticks since win32epoch
+            // ctime      8 bytes    win32 ticks since win32epoch
+
+            if (dataSize != 32)
+                throw new BadReadException(String.Format("  Unexpected size (0x{0:X4}) for NTFS times extra field at position 0x{1:X16}", dataSize, posn));
+
+            j += 4;  // reserved
+            Int16 timetag = (Int16)(buffer[j] + buffer[j + 1] * 256);
+            Int16 addlsize = (Int16)(buffer[j + 2] + buffer[j + 3] * 256);
+            j += 4;  // tag and size
+
+            if (timetag == 0x0001 && addlsize == 24)
+            {
+                Int64 z = BitConverter.ToInt64(buffer, j);
+                this._Mtime = DateTime.FromFileTimeUtc(z);
+                j += 8;
+
+                // At this point the library *could* set the LastModified value
+                // to coincide with the Mtime value.  In theory, they refer to
+                // the same property of the file, and should be the same anyway,
+                // allowing for differences in precision.  But they are
+                // independent quantities in the zip archive, and this library
+                // will keep them separate in the object model. There is no ill
+                // effect from this, because as files are extracted, the
+                // higher-precision value (Mtime) is used if it is present.
+                // Apps may wish to compare the Mtime versus LastModified
+                // values, but any difference when both are present is not
+                // germaine to the correctness of the library. but note: when
+                // explicitly setting either value, both are set. See the setter
+                // for LastModified or the SetNtfsTimes() method.
+
+                z = BitConverter.ToInt64(buffer, j);
+                this._Atime = DateTime.FromFileTimeUtc(z);
+                j += 8;
+
+                z = BitConverter.ToInt64(buffer, j);
+                this._Ctime = DateTime.FromFileTimeUtc(z);
+                j += 8;
+
+                _ntfsTimesAreSet = true;
+                _timestamp |= ZipEntryTimestamp.Windows;
+                _emitNtfsTimes = true;
+            }
+            return j;
+        }
+
+
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ZipEntry.Write.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ZipEntry.Write.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ZipEntry.Write.cs	(revision 12707)
@@ -0,0 +1,2583 @@
+//#define Trace
+
+// ZipEntry.Write.cs
+// ------------------------------------------------------------------
+//
+// Copyright (c) 2009-2011 Dino Chiesa
+// All rights reserved.
+//
+// This code module is part of DotNetZip, a zipfile class library.
+//
+// ------------------------------------------------------------------
+//
+// This code is licensed under the Microsoft Public License.
+// See the file License.txt for the license details.
+// More info on: http://dotnetzip.codeplex.com
+//
+// ------------------------------------------------------------------
+//
+// Last Saved: <2011-July-30 14:55:47>
+//
+// ------------------------------------------------------------------
+//
+// This module defines logic for writing (saving) the ZipEntry into a
+// zip file.
+//
+// ------------------------------------------------------------------
+
+
+using OfficeOpenXml.Packaging.Ionic.Zlib;
+using System;
+using System.IO;
+using RE = System.Text.RegularExpressions;
+
+namespace OfficeOpenXml.Packaging.Ionic.Zip
+{
+    internal partial class ZipEntry
+    {
+        internal void WriteCentralDirectoryEntry(Stream s)
+        {
+            byte[] bytes = new byte[4096];
+            int i = 0;
+            // signature
+            bytes[i++] = (byte)(ZipConstants.ZipDirEntrySignature & 0x000000FF);
+            bytes[i++] = (byte)((ZipConstants.ZipDirEntrySignature & 0x0000FF00) >> 8);
+            bytes[i++] = (byte)((ZipConstants.ZipDirEntrySignature & 0x00FF0000) >> 16);
+            bytes[i++] = (byte)((ZipConstants.ZipDirEntrySignature & 0xFF000000) >> 24);
+
+            // Version Made By
+            // workitem 7071
+            // We must not overwrite the VersionMadeBy field when writing out a zip
+            // archive.  The VersionMadeBy tells the zip reader the meaning of the
+            // File attributes.  Overwriting the VersionMadeBy will result in
+            // inconsistent metadata.  Consider the scenario where the application
+            // opens and reads a zip file that had been created on Linux. Then the
+            // app adds one file to the Zip archive, and saves it.  The file
+            // attributes for all the entries added on Linux will be significant for
+            // Linux.  Therefore the VersionMadeBy for those entries must not be
+            // changed.  Only the entries that are actually created on Windows NTFS
+            // should get the VersionMadeBy indicating Windows/NTFS.
+            bytes[i++] = (byte)(_VersionMadeBy & 0x00FF);
+            bytes[i++] = (byte)((_VersionMadeBy & 0xFF00) >> 8);
+
+            // Apparently we want to duplicate the extra field here; we cannot
+            // simply zero it out and assume tools and apps will use the right one.
+
+            ////Int16 extraFieldLengthSave = (short)(_EntryHeader[28] + _EntryHeader[29] * 256);
+            ////_EntryHeader[28] = 0;
+            ////_EntryHeader[29] = 0;
+
+            // Version Needed, Bitfield, compression method, lastmod,
+            // crc, compressed and uncompressed sizes, filename length and extra field length.
+            // These are all present in the local file header, but they may be zero values there.
+            // So we cannot just copy them.
+
+            // workitem 11969: Version Needed To Extract in central directory must be
+            // the same as the local entry or MS .NET System.IO.Zip fails read.
+            Int16 vNeeded = (Int16)(VersionNeeded != 0 ? VersionNeeded : 20);
+            // workitem 12964
+            if (_OutputUsesZip64==null)
+            {
+                // a zipentry in a zipoutputstream, with zero bytes written
+                _OutputUsesZip64 = new Nullable<bool>(_container.Zip64 == Zip64Option.Always);
+            }
+
+            Int16 versionNeededToExtract = (Int16)(_OutputUsesZip64.Value ? 45 : vNeeded);
+#if BZIP
+            if (this.CompressionMethod == Ionic.Zip.CompressionMethod.BZip2)
+                versionNeededToExtract = 46;
+#endif
+
+            bytes[i++] = (byte)(versionNeededToExtract & 0x00FF);
+            bytes[i++] = (byte)((versionNeededToExtract & 0xFF00) >> 8);
+
+            bytes[i++] = (byte)(_BitField & 0x00FF);
+            bytes[i++] = (byte)((_BitField & 0xFF00) >> 8);
+
+            bytes[i++] = (byte)(_CompressionMethod & 0x00FF);
+            bytes[i++] = (byte)((_CompressionMethod & 0xFF00) >> 8);
+
+#if AESCRYPTO
+            if (Encryption == EncryptionAlgorithm.WinZipAes128 ||
+            Encryption == EncryptionAlgorithm.WinZipAes256)
+            {
+                i -= 2;
+                bytes[i++] = 0x63;
+                bytes[i++] = 0;
+            }
+#endif
+
+            bytes[i++] = (byte)(_TimeBlob & 0x000000FF);
+            bytes[i++] = (byte)((_TimeBlob & 0x0000FF00) >> 8);
+            bytes[i++] = (byte)((_TimeBlob & 0x00FF0000) >> 16);
+            bytes[i++] = (byte)((_TimeBlob & 0xFF000000) >> 24);
+            bytes[i++] = (byte)(_Crc32 & 0x000000FF);
+            bytes[i++] = (byte)((_Crc32 & 0x0000FF00) >> 8);
+            bytes[i++] = (byte)((_Crc32 & 0x00FF0000) >> 16);
+            bytes[i++] = (byte)((_Crc32 & 0xFF000000) >> 24);
+
+            int j = 0;
+            if (_OutputUsesZip64.Value)
+            {
+                // CompressedSize (Int32) and UncompressedSize - all 0xFF
+                for (j = 0; j < 8; j++)
+                    bytes[i++] = 0xFF;
+            }
+            else
+            {
+                bytes[i++] = (byte)(_CompressedSize & 0x000000FF);
+                bytes[i++] = (byte)((_CompressedSize & 0x0000FF00) >> 8);
+                bytes[i++] = (byte)((_CompressedSize & 0x00FF0000) >> 16);
+                bytes[i++] = (byte)((_CompressedSize & 0xFF000000) >> 24);
+
+                bytes[i++] = (byte)(_UncompressedSize & 0x000000FF);
+                bytes[i++] = (byte)((_UncompressedSize & 0x0000FF00) >> 8);
+                bytes[i++] = (byte)((_UncompressedSize & 0x00FF0000) >> 16);
+                bytes[i++] = (byte)((_UncompressedSize & 0xFF000000) >> 24);
+            }
+
+            byte[] fileNameBytes = GetEncodedFileNameBytes();
+            Int16 filenameLength = (Int16)fileNameBytes.Length;
+            bytes[i++] = (byte)(filenameLength & 0x00FF);
+            bytes[i++] = (byte)((filenameLength & 0xFF00) >> 8);
+
+            // do this again because now we have real data
+            _presumeZip64 = _OutputUsesZip64.Value;
+
+            // workitem 11131
+            //
+            // cannot generate the extra field again, here's why: In the case of a
+            // zero-byte entry, which uses encryption, DotNetZip will "remove" the
+            // encryption from the entry.  It does this in PostProcessOutput; it
+            // modifies the entry header, and rewrites it, resetting the Bitfield
+            // (one bit indicates encryption), and potentially resetting the
+            // compression method - for AES the Compression method is 0x63, and it
+            // would get reset to zero (no compression).  It then calls SetLength()
+            // to truncate the stream to remove the encryption header (12 bytes for
+            // AES256).  But, it leaves the previously-generated "Extra Field"
+            // metadata (11 bytes) for AES in the entry header. This extra field
+            // data is now "orphaned" - it refers to AES encryption when in fact no
+            // AES encryption is used. But no problem, the PKWARE spec says that
+            // unrecognized extra fields can just be ignored. ok.  After "removal"
+            // of AES encryption, the length of the Extra Field can remains the
+            // same; it's just that there will be 11 bytes in there that previously
+            // pertained to AES which are now unused. Even the field code is still
+            // there, but it will be unused by readers, as the encryption bit is not
+            // set.
+            //
+            // Re-calculating the Extra field now would produce a block that is 11
+            // bytes shorter, and that mismatch - between the extra field in the
+            // local header and the extra field in the Central Directory - would
+            // cause problems. (where? why? what problems?)  So we can't do
+            // that. It's all good though, because though the content may have
+            // changed, the length definitely has not. Also, the _EntryHeader
+            // contains the "updated" extra field (after PostProcessOutput) at
+            // offset (30 + filenameLength).
+
+            _Extra = ConstructExtraField(true);
+
+            Int16 extraFieldLength = (Int16)((_Extra == null) ? 0 : _Extra.Length);
+            bytes[i++] = (byte)(extraFieldLength & 0x00FF);
+            bytes[i++] = (byte)((extraFieldLength & 0xFF00) >> 8);
+
+            // File (entry) Comment Length
+            // the _CommentBytes private field was set during WriteHeader()
+            int commentLength = (_CommentBytes == null) ? 0 : _CommentBytes.Length;
+
+            // the size of our buffer defines the max length of the comment we can write
+            if (commentLength + i > bytes.Length) commentLength = bytes.Length - i;
+            bytes[i++] = (byte)(commentLength & 0x00FF);
+            bytes[i++] = (byte)((commentLength & 0xFF00) >> 8);
+
+            // Disk number start
+            bool segmented = (this._container.ZipFile != null) &&
+                (this._container.ZipFile.MaxOutputSegmentSize != 0);
+            if (segmented) // workitem 13915
+            {
+                // Emit nonzero disknumber only if saving segmented archive.
+                bytes[i++] = (byte)(_diskNumber & 0x00FF);
+                bytes[i++] = (byte)((_diskNumber & 0xFF00) >> 8);
+            }
+            else
+            {
+                // If reading a segmneted archive and saving to a regular archive,
+                // ZipEntry._diskNumber will be non-zero but it should be saved as
+                // zero.
+                bytes[i++] = 0;
+                bytes[i++] = 0;
+            }
+
+            // internal file attrs
+            // workitem 7801
+            bytes[i++] = (byte)((_IsText) ? 1 : 0); // lo bit: filetype hint.  0=bin, 1=txt.
+            bytes[i++] = 0;
+
+            // external file attrs
+            // workitem 7071
+            bytes[i++] = (byte)(_ExternalFileAttrs & 0x000000FF);
+            bytes[i++] = (byte)((_ExternalFileAttrs & 0x0000FF00) >> 8);
+            bytes[i++] = (byte)((_ExternalFileAttrs & 0x00FF0000) >> 16);
+            bytes[i++] = (byte)((_ExternalFileAttrs & 0xFF000000) >> 24);
+
+            // workitem 11131
+            // relative offset of local header.
+            //
+            // If necessary to go to 64-bit value, then emit 0xFFFFFFFF,
+            // else write out the value.
+            //
+            // Even if zip64 is required for other reasons - number of the entry
+            // > 65534, or uncompressed size of the entry > MAX_INT32, the ROLH
+            // need not be stored in a 64-bit field .
+            if (_RelativeOffsetOfLocalHeader > 0xFFFFFFFFL) // _OutputUsesZip64.Value
+            {
+                bytes[i++] = 0xFF;
+                bytes[i++] = 0xFF;
+                bytes[i++] = 0xFF;
+                bytes[i++] = 0xFF;
+            }
+            else
+            {
+                bytes[i++] = (byte)(_RelativeOffsetOfLocalHeader & 0x000000FF);
+                bytes[i++] = (byte)((_RelativeOffsetOfLocalHeader & 0x0000FF00) >> 8);
+                bytes[i++] = (byte)((_RelativeOffsetOfLocalHeader & 0x00FF0000) >> 16);
+                bytes[i++] = (byte)((_RelativeOffsetOfLocalHeader & 0xFF000000) >> 24);
+            }
+
+            // actual filename
+            Buffer.BlockCopy(fileNameBytes, 0, bytes, i, filenameLength);
+            i += filenameLength;
+
+            // "Extra field"
+            if (_Extra != null)
+            {
+                // workitem 11131
+                //
+                // copy from EntryHeader if available - it may have been updated.
+                // if not, copy from Extra. This would be unnecessary if I just
+                // updated the Extra field when updating EntryHeader, in
+                // PostProcessOutput.
+
+                //?? I don't understand why I wouldn't want to just use
+                // the recalculated Extra field. ??
+
+                // byte[] h = _EntryHeader ?? _Extra;
+                // int offx = (h == _EntryHeader) ? 30 + filenameLength : 0;
+                // Buffer.BlockCopy(h, offx, bytes, i, extraFieldLength);
+                // i += extraFieldLength;
+
+                byte[] h = _Extra;
+                int offx = 0;
+                Buffer.BlockCopy(h, offx, bytes, i, extraFieldLength);
+                i += extraFieldLength;
+            }
+
+            // file (entry) comment
+            if (commentLength != 0)
+            {
+                // now actually write the comment itself into the byte buffer
+                Buffer.BlockCopy(_CommentBytes, 0, bytes, i, commentLength);
+                // for (j = 0; (j < commentLength) && (i + j < bytes.Length); j++)
+                //     bytes[i + j] = _CommentBytes[j];
+                i += commentLength;
+            }
+
+            s.Write(bytes, 0, i);
+        }
+
+
+#if INFOZIP_UTF8
+        static private bool FileNameIsUtf8(char[] FileNameChars)
+        {
+            bool isUTF8 = false;
+            bool isUnicode = false;
+            for (int j = 0; j < FileNameChars.Length; j++)
+            {
+                byte[] b = System.BitConverter.GetBytes(FileNameChars[j]);
+                isUnicode |= (b.Length != 2);
+                isUnicode |= (b[1] != 0);
+                isUTF8 |= ((b[0] & 0x80) != 0);
+            }
+
+            return isUTF8;
+        }
+#endif
+
+
+        private byte[] ConstructExtraField(bool forCentralDirectory)
+        {
+            var listOfBlocks = new System.Collections.Generic.List<byte[]>();
+            byte[] block;
+
+            // Conditionally emit an extra field with Zip64 information.  If the
+            // Zip64 option is Always, we emit the field, before knowing that it's
+            // necessary.  Later, if it turns out this entry does not need zip64,
+            // we'll set the header ID to rubbish and the data will be ignored.
+            // This results in additional overhead metadata in the zip file, but
+            // it will be small in comparison to the entry data.
+            //
+            // On the other hand if the Zip64 option is AsNecessary and it's NOT
+            // for the central directory, then we do the same thing.  Or, if the
+            // Zip64 option is AsNecessary and it IS for the central directory,
+            // and the entry requires zip64, then emit the header.
+            if (_container.Zip64 == Zip64Option.Always ||
+                (_container.Zip64 == Zip64Option.AsNecessary &&
+                 (!forCentralDirectory || _entryRequiresZip64.Value)))
+            {
+                // add extra field for zip64 here
+                // workitem 7924
+                int sz = 4 + (forCentralDirectory ? 28 : 16);
+                block = new byte[sz];
+                int i = 0;
+
+                if (_presumeZip64 || forCentralDirectory)
+                {
+                    // HeaderId = always use zip64 extensions.
+                    block[i++] = 0x01;
+                    block[i++] = 0x00;
+                }
+                else
+                {
+                    // HeaderId = dummy data now, maybe set to 0x0001 (ZIP64) later.
+                    block[i++] = 0x99;
+                    block[i++] = 0x99;
+                }
+
+                // DataSize
+                block[i++] = (byte)(sz - 4);  // decimal 28 or 16  (workitem 7924)
+                block[i++] = 0x00;
+
+                // The actual metadata - we may or may not have real values yet...
+
+                // uncompressed size
+                Array.Copy(BitConverter.GetBytes(_UncompressedSize), 0, block, i, 8);
+                i += 8;
+                // compressed size
+                Array.Copy(BitConverter.GetBytes(_CompressedSize), 0, block, i, 8);
+                i += 8;
+
+                // workitem 7924 - only include this if the "extra" field is for
+                // use in the central directory.  It is unnecessary and not useful
+                // for local header; makes WinZip choke.
+                if (forCentralDirectory)
+                {
+                    // relative offset
+                    Array.Copy(BitConverter.GetBytes(_RelativeOffsetOfLocalHeader), 0, block, i, 8);
+                    i += 8;
+
+                    // starting disk number
+                    Array.Copy(BitConverter.GetBytes(0), 0, block, i, 4);
+                }
+                listOfBlocks.Add(block);
+            }
+
+
+#if AESCRYPTO
+            if (Encryption == EncryptionAlgorithm.WinZipAes128 ||
+                Encryption == EncryptionAlgorithm.WinZipAes256)
+            {
+                block = new byte[4 + 7];
+                int i = 0;
+                // extra field for WinZip AES
+                // header id
+                block[i++] = 0x01;
+                block[i++] = 0x99;
+
+                // data size
+                block[i++] = 0x07;
+                block[i++] = 0x00;
+
+                // vendor number
+                block[i++] = 0x01;  // AE-1 - means "Verify CRC"
+                block[i++] = 0x00;
+
+                // vendor id "AE"
+                block[i++] = 0x41;
+                block[i++] = 0x45;
+
+                // key strength
+                int keystrength = GetKeyStrengthInBits(Encryption);
+                if (keystrength == 128)
+                    block[i] = 1;
+                else if (keystrength == 256)
+                    block[i] = 3;
+                else
+                    block[i] = 0xFF;
+                i++;
+
+                // actual compression method
+                block[i++] = (byte)(_CompressionMethod & 0x00FF);
+                block[i++] = (byte)(_CompressionMethod & 0xFF00);
+
+                listOfBlocks.Add(block);
+            }
+#endif
+
+            if (_ntfsTimesAreSet && _emitNtfsTimes)
+            {
+                block = new byte[32 + 4];
+                // HeaderId   2 bytes    0x000a == NTFS times
+                // Datasize   2 bytes    32
+                // reserved   4 bytes    ?? don't care
+                // timetag    2 bytes    0x0001 == NTFS time
+                // size       2 bytes    24 == 8 bytes each for ctime, mtime, atime
+                // mtime      8 bytes    win32 ticks since win32epoch
+                // atime      8 bytes    win32 ticks since win32epoch
+                // ctime      8 bytes    win32 ticks since win32epoch
+                int i = 0;
+                // extra field for NTFS times
+                // header id
+                block[i++] = 0x0a;
+                block[i++] = 0x00;
+
+                // data size
+                block[i++] = 32;
+                block[i++] = 0;
+
+                i += 4; // reserved
+
+                // time tag
+                block[i++] = 0x01;
+                block[i++] = 0x00;
+
+                // data size (again)
+                block[i++] = 24;
+                block[i++] = 0;
+
+                Int64 z = _Mtime.ToFileTime();
+                Array.Copy(BitConverter.GetBytes(z), 0, block, i, 8);
+                i += 8;
+                z = _Atime.ToFileTime();
+                Array.Copy(BitConverter.GetBytes(z), 0, block, i, 8);
+                i += 8;
+                z = _Ctime.ToFileTime();
+                Array.Copy(BitConverter.GetBytes(z), 0, block, i, 8);
+                i += 8;
+
+                listOfBlocks.Add(block);
+            }
+
+            if (_ntfsTimesAreSet && _emitUnixTimes)
+            {
+                int len = 5 + 4;
+                if (!forCentralDirectory) len += 8;
+
+                block = new byte[len];
+                // local form:
+                // --------------
+                // HeaderId   2 bytes    0x5455 == unix timestamp
+                // Datasize   2 bytes    13
+                // flags      1 byte     7 (low three bits all set)
+                // mtime      4 bytes    seconds since unix epoch
+                // atime      4 bytes    seconds since unix epoch
+                // ctime      4 bytes    seconds since unix epoch
+                //
+                // central directory form:
+                //---------------------------------
+                // HeaderId   2 bytes    0x5455 == unix timestamp
+                // Datasize   2 bytes    5
+                // flags      1 byte     7 (low three bits all set)
+                // mtime      4 bytes    seconds since unix epoch
+                //
+                int i = 0;
+                // extra field for "unix" times
+                // header id
+                block[i++] = 0x55;
+                block[i++] = 0x54;
+
+                // data size
+                block[i++] = unchecked((byte)(len - 4));
+                block[i++] = 0;
+
+                // flags
+                block[i++] = 0x07;
+
+                Int32 z = unchecked((int)((_Mtime - _unixEpoch).TotalSeconds));
+                Array.Copy(BitConverter.GetBytes(z), 0, block, i, 4);
+                i += 4;
+                if (!forCentralDirectory)
+                {
+                    z = unchecked((int)((_Atime - _unixEpoch).TotalSeconds));
+                    Array.Copy(BitConverter.GetBytes(z), 0, block, i, 4);
+                    i += 4;
+                    z = unchecked((int)((_Ctime - _unixEpoch).TotalSeconds));
+                    Array.Copy(BitConverter.GetBytes(z), 0, block, i, 4);
+                    i += 4;
+                }
+                listOfBlocks.Add(block);
+            }
+
+
+            // inject other blocks here...
+
+
+            // concatenate any blocks we've got:
+            byte[] aggregateBlock = null;
+            if (listOfBlocks.Count > 0)
+            {
+                int totalLength = 0;
+                int i, current = 0;
+                for (i = 0; i < listOfBlocks.Count; i++)
+                    totalLength += listOfBlocks[i].Length;
+                aggregateBlock = new byte[totalLength];
+                for (i = 0; i < listOfBlocks.Count; i++)
+                {
+                    System.Array.Copy(listOfBlocks[i], 0, aggregateBlock, current, listOfBlocks[i].Length);
+                    current += listOfBlocks[i].Length;
+                }
+            }
+
+            return aggregateBlock;
+        }
+
+
+
+        // private System.Text.Encoding GenerateCommentBytes()
+        // {
+        //     var getEncoding = new Func<System.Text.Encoding>({
+        //     switch (AlternateEncodingUsage)
+        //     {
+        //         case ZipOption.Always:
+        //             return AlternateEncoding;
+        //         case ZipOption.Never:
+        //             return ibm437;
+        //     }
+        //     var cb = ibm437.GetBytes(_Comment);
+        //     // need to use this form of GetString() for .NET CF
+        //     string s1 = ibm437.GetString(cb, 0, cb.Length);
+        //     if (s1 == _Comment)
+        //         return ibm437;
+        //     return AlternateEncoding;
+        //     });
+        //
+        //     var encoding = getEncoding();
+        //     _CommentBytes = encoding.GetBytes(_Comment);
+        //     return encoding;
+        // }
+
+
+        private string NormalizeFileName()
+        {
+            // here, we need to flip the backslashes to forward-slashes,
+            // also, we need to trim the \\server\share syntax from any UNC path.
+            // and finally, we need to remove any leading .\
+
+            string SlashFixed = FileName.Replace("\\", "/");
+            string s1 = null;
+            if ((_TrimVolumeFromFullyQualifiedPaths) && (FileName.Length >= 3)
+                && (FileName[1] == ':') && (SlashFixed[2] == '/'))
+            {
+                // trim off volume letter, colon, and slash
+                s1 = SlashFixed.Substring(3);
+            }
+            else if ((FileName.Length >= 4)
+                     && ((SlashFixed[0] == '/') && (SlashFixed[1] == '/')))
+            {
+                int n = SlashFixed.IndexOf('/', 2);
+                if (n == -1)
+                    throw new ArgumentException("The path for that entry appears to be badly formatted");
+                s1 = SlashFixed.Substring(n + 1);
+            }
+            else if ((FileName.Length >= 3)
+                     && ((SlashFixed[0] == '.') && (SlashFixed[1] == '/')))
+            {
+                // trim off dot and slash
+                s1 = SlashFixed.Substring(2);
+            }
+            else
+            {
+                s1 = SlashFixed;
+            }
+            return s1;
+        }
+
+
+        /// <summary>
+        ///   generate and return a byte array that encodes the filename
+        ///   for the entry.
+        /// </summary>
+        /// <remarks>
+        ///   <para>
+        ///     side effects: generate and store into _CommentBytes the
+        ///     byte array for any comment attached to the entry. Also
+        ///     sets _actualEncoding to indicate the actual encoding
+        ///     used. The same encoding is used for both filename and
+        ///     comment.
+        ///   </para>
+        /// </remarks>
+        private byte[] GetEncodedFileNameBytes()
+        {
+            // workitem 6513
+            var s1 = NormalizeFileName();
+
+            switch(AlternateEncodingUsage)
+            {
+                case ZipOption.Always:
+                    if (!(_Comment == null || _Comment.Length == 0))
+                        _CommentBytes = AlternateEncoding.GetBytes(_Comment);
+                    _actualEncoding = AlternateEncoding;
+                    return AlternateEncoding.GetBytes(s1);
+
+                case ZipOption.Never:
+                    if (!(_Comment == null || _Comment.Length == 0))
+                        _CommentBytes = ibm437.GetBytes(_Comment);
+                    _actualEncoding = ibm437;
+                    return ibm437.GetBytes(s1);
+            }
+
+            // arriving here means AlternateEncodingUsage is "AsNecessary"
+
+            // case ZipOption.AsNecessary:
+            // workitem 6513: when writing, use the alternative encoding
+            // only when _actualEncoding is not yet set (it can be set
+            // during Read), and when ibm437 will not do.
+
+            byte[] result = ibm437.GetBytes(s1);
+            // need to use this form of GetString() for .NET CF
+            string s2 = ibm437.GetString(result, 0, result.Length);
+            _CommentBytes = null;
+            if (s2 != s1)
+            {
+                // Encoding the filename with ibm437 does not allow round-trips.
+                // Therefore, use the alternate encoding.  Assume it will work,
+                // no checking of round trips here.
+                result = AlternateEncoding.GetBytes(s1);
+                if (_Comment != null && _Comment.Length != 0)
+                    _CommentBytes = AlternateEncoding.GetBytes(_Comment);
+                _actualEncoding = AlternateEncoding;
+                return result;
+            }
+
+            _actualEncoding = ibm437;
+
+            // Using ibm437, FileName can be encoded without information
+            // loss; now try the Comment.
+
+            // if there is no comment, use ibm437.
+            if (_Comment == null || _Comment.Length == 0)
+                return result;
+
+            // there is a comment. Get the encoded form.
+            byte[] cbytes = ibm437.GetBytes(_Comment);
+            string c2 = ibm437.GetString(cbytes,0,cbytes.Length);
+
+            // Check for round-trip.
+            if (c2 != Comment)
+            {
+                // Comment cannot correctly be encoded with ibm437.  Use
+                // the alternate encoding.
+
+                result = AlternateEncoding.GetBytes(s1);
+                _CommentBytes = AlternateEncoding.GetBytes(_Comment);
+                _actualEncoding = AlternateEncoding;
+                return result;
+            }
+
+            // use IBM437
+            _CommentBytes = cbytes;
+            return result;
+        }
+
+
+
+        private bool WantReadAgain()
+        {
+            if (_UncompressedSize < 0x10) return false;
+            if (_CompressionMethod == 0x00) return false;
+            if (CompressionLevel == OfficeOpenXml.Packaging.Ionic.Zlib.CompressionLevel.None) return false;
+            if (_CompressedSize < _UncompressedSize) return false;
+
+            if (this._Source == ZipEntrySource.Stream && !this._sourceStream.CanSeek) return false;
+
+#if AESCRYPTO
+            if (_aesCrypto_forWrite != null && (CompressedSize - _aesCrypto_forWrite.SizeOfEncryptionMetadata) <= UncompressedSize + 0x10) return false;
+#endif
+
+            if (_zipCrypto_forWrite != null && (CompressedSize - 12) <= UncompressedSize) return false;
+
+            return true;
+        }
+
+
+
+        private void MaybeUnsetCompressionMethodForWriting(int cycle)
+        {
+            // if we've already tried with compression... turn it off this time
+            if (cycle > 1)
+            {
+                _CompressionMethod = 0x0;
+                return;
+            }
+            // compression for directories = 0x00 (No Compression)
+            if (IsDirectory)
+            {
+                _CompressionMethod = 0x0;
+                return;
+            }
+
+            if (this._Source == ZipEntrySource.ZipFile)
+            {
+                return; // do nothing
+            }
+
+            // If __FileDataPosition is zero, then that means we will get the data
+            // from a file or stream.
+
+            // It is never possible to compress a zero-length file, so we check for
+            // this condition.
+
+            if (this._Source == ZipEntrySource.Stream)
+            {
+                // workitem 7742
+                if (_sourceStream != null && _sourceStream.CanSeek)
+                {
+                    // Length prop will throw if CanSeek is false
+                    long fileLength = _sourceStream.Length;
+                    if (fileLength == 0)
+                    {
+                        _CompressionMethod = 0x00;
+                        return;
+                    }
+                }
+            }
+            else if ((this._Source == ZipEntrySource.FileSystem) && (SharedUtilities.GetFileLength(LocalFileName) == 0L))
+            {
+                _CompressionMethod = 0x00;
+                return;
+            }
+
+            // Ok, we're getting the data to be compressed from a
+            // non-zero-length file or stream, or a file or stream of
+            // unknown length, and we presume that it is non-zero.  In
+            // that case we check the callback to see if the app wants
+            // to tell us whether to compress or not.
+            if (SetCompression != null)
+                CompressionLevel = SetCompression(LocalFileName, _FileNameInArchive);
+
+            // finally, set CompressionMethod to None if CompressionLevel is None
+            if (CompressionLevel == (short)Ionic.Zlib.CompressionLevel.None &&
+                CompressionMethod == Ionic.Zip.CompressionMethod.Deflate)
+                _CompressionMethod = 0x00;
+
+            return;
+        }
+
+
+
+        // write the header info for an entry
+        internal void WriteHeader(Stream s, int cycle)
+        {
+            // Must remember the offset, within the output stream, of this particular
+            // entry header.
+            //
+            // This is for 2 reasons:
+            //
+            //  1. so we can determine the RelativeOffsetOfLocalHeader (ROLH) for
+            //     use in the central directory.
+            //  2. so we can seek backward in case there is an error opening or reading
+            //     the file, and the application decides to skip the file. In this case,
+            //     we need to seek backward in the output stream to allow the next entry
+            //     to be added to the zipfile output stream.
+            //
+            // Normally you would just store the offset before writing to the output
+            // stream and be done with it.  But the possibility to use split archives
+            // makes this approach ineffective.  In split archives, each file or segment
+            // is bound to a max size limit, and each local file header must not span a
+            // segment boundary; it must be written contiguously.  If it will fit in the
+            // current segment, then the ROLH is just the current Position in the output
+            // stream.  If it won't fit, then we need a new file (segment) and the ROLH
+            // is zero.
+            //
+            // But we only can know if it is possible to write a header contiguously
+            // after we know the size of the local header, a size that varies with
+            // things like filename length, comments, and extra fields.  We have to
+            // compute the header fully before knowing whether it will fit.
+            //
+            // That takes care of item #1 above.  Now, regarding #2.  If an error occurs
+            // while computing the local header, we want to just seek backward. The
+            // exception handling logic (in the caller of WriteHeader) uses ROLH to
+            // scroll back.
+            //
+            // All this means we have to preserve the starting offset before computing
+            // the header, and also we have to compute the offset later, to handle the
+            // case of split archives.
+
+            var counter = s as CountingStream;
+
+            // workitem 8098: ok (output)
+            // This may change later, for split archives
+
+            // Don't set _RelativeOffsetOfLocalHeader. Instead, set a temp variable.
+            // This allows for re-streaming, where a zip entry might be read from a
+            // zip archive (and maybe decrypted, and maybe decompressed) and then
+            // written to another zip archive, with different settings for
+            // compression method, compression level, or encryption algorithm.
+            _future_ROLH = (counter != null)
+                ? counter.ComputedPosition
+                : s.Position;
+
+            int j = 0, i = 0;
+
+            byte[] block = new byte[30];
+
+            // signature
+            block[i++] = (byte)(ZipConstants.ZipEntrySignature & 0x000000FF);
+            block[i++] = (byte)((ZipConstants.ZipEntrySignature & 0x0000FF00) >> 8);
+            block[i++] = (byte)((ZipConstants.ZipEntrySignature & 0x00FF0000) >> 16);
+            block[i++] = (byte)((ZipConstants.ZipEntrySignature & 0xFF000000) >> 24);
+
+            // Design notes for ZIP64:
+            //
+            // The specification says that the header must include the Compressed
+            // and Uncompressed sizes, as well as the CRC32 value.  When creating
+            // a zip via streamed processing, these quantities are not known until
+            // after the compression is done.  Thus, a typical way to do it is to
+            // insert zeroes for these quantities, then do the compression, then
+            // seek back to insert the appropriate values, then seek forward to
+            // the end of the file data.
+            //
+            // There is also the option of using bit 3 in the GP bitfield - to
+            // specify that there is a data descriptor after the file data
+            // containing these three quantities.
+            //
+            // This works when the size of the quantities is known, either 32-bits
+            // or 64 bits as with the ZIP64 extensions.
+            //
+            // With Zip64, the 4-byte fields are set to 0xffffffff, and there is a
+            // corresponding data block in the "extra field" that contains the
+            // actual Compressed, uncompressed sizes.  (As well as an additional
+            // field, the "Relative Offset of Local Header")
+            //
+            // The problem is when the app desires to use ZIP64 extensions
+            // optionally, only when necessary.  Suppose the library assumes no
+            // zip64 extensions when writing the header, then after compression
+            // finds that the size of the data requires zip64.  At this point, the
+            // header, already written to the file, won't have the necessary data
+            // block in the "extra field".  The size of the entry header is fixed,
+            // so it is not possible to just "add on" the zip64 data block after
+            // compressing the file.  On the other hand, always using zip64 will
+            // break interoperability with many other systems and apps.
+            //
+            // The approach we take is to insert a 32-byte dummy data block in the
+            // extra field, whenever zip64 is to be used "as necessary". This data
+            // block will get the actual zip64 HeaderId and zip64 metadata if
+            // necessary.  If not necessary, the data block will get a meaningless
+            // HeaderId (0x1111), and will be filled with zeroes.
+            //
+            // When zip64 is actually in use, we also need to set the
+            // VersionNeededToExtract field to 45.
+            //
+            // There is one additional wrinkle: using zip64 as necessary conflicts
+            // with output to non-seekable devices.  The header is emitted and
+            // must indicate whether zip64 is in use, before we know if zip64 is
+            // necessary.  Because there is no seeking, the header can never be
+            // changed.  Therefore, on non-seekable devices,
+            // Zip64Option.AsNecessary is the same as Zip64Option.Always.
+            //
+
+
+            // version needed- see AppNote.txt.
+            //
+            // need v5.1 for PKZIP strong encryption, or v2.0 for no encryption or
+            // for PK encryption, 4.5 for zip64.  We may reset this later, as
+            // necessary or zip64.
+
+            _presumeZip64 = (_container.Zip64 == Zip64Option.Always ||
+                             (_container.Zip64 == Zip64Option.AsNecessary && !s.CanSeek));
+            Int16 VersionNeededToExtract = (Int16)(_presumeZip64 ? 45 : 20);
+#if BZIP
+            if (this.CompressionMethod == Ionic.Zip.CompressionMethod.BZip2)
+                VersionNeededToExtract = 46;
+#endif
+
+            // (i==4)
+            block[i++] = (byte)(VersionNeededToExtract & 0x00FF);
+            block[i++] = (byte)((VersionNeededToExtract & 0xFF00) >> 8);
+
+            // Get byte array. Side effect: sets ActualEncoding.
+            // Must determine encoding before setting the bitfield.
+            // workitem 6513
+            byte[] fileNameBytes = GetEncodedFileNameBytes();
+            Int16 filenameLength = (Int16)fileNameBytes.Length;
+
+            // general purpose bitfield
+            // In the current implementation, this library uses only these bits
+            // in the GP bitfield:
+            //  bit 0 = if set, indicates the entry is encrypted
+            //  bit 3 = if set, indicates the CRC, C and UC sizes follow the file data.
+            //  bit 6 = strong encryption - for pkware's meaning of strong encryption
+            //  bit 11 = UTF-8 encoding is used in the comment and filename
+
+
+            // Here we set or unset the encryption bit.
+            // _BitField may already be set, as with a ZipEntry added into ZipOutputStream, which
+            // has bit 3 always set. We only want to set one bit
+            if (_Encryption == EncryptionAlgorithm.None)
+                _BitField &= ~1;  // encryption bit OFF
+            else
+                _BitField |= 1;   // encryption bit ON
+
+
+            // workitem 7941: WinZip does not the "strong encryption" bit  when using AES.
+            // This "Strong Encryption" is a PKWare Strong encryption thing.
+            //                 _BitField |= 0x0020;
+
+            // set the UTF8 bit if necessary
+#if SILVERLIGHT
+            if (_actualEncoding.WebName == "utf-8")
+#else
+            if (_actualEncoding.CodePage == System.Text.Encoding.UTF8.CodePage)
+#endif
+                _BitField |= 0x0800;
+
+            // The PKZIP spec says that if bit 3 is set (0x0008) in the General
+            // Purpose BitField, then the CRC, Compressed size, and uncompressed
+            // size are written directly after the file data.
+            //
+            // These 3 quantities are normally present in the regular zip entry
+            // header. But, they are not knowable until after the compression is
+            // done. So, in the normal case, we
+            //
+            //  - write the header, using zeros for these quantities
+            //  - compress the data, and incidentally compute these quantities.
+            //  - seek back and write the correct values them into the header.
+            //
+            // This is nice because, while it is more complicated to write the zip
+            // file, it is simpler and less error prone to read the zip file, and
+            // as a result more applications can read zip files produced this way,
+            // with those 3 quantities in the header.
+            //
+            // But if seeking in the output stream is not possible, then we need
+            // to set the appropriate bitfield and emit these quantities after the
+            // compressed file data in the output.
+            //
+            // workitem 7216 - having trouble formatting a zip64 file that is
+            // readable by WinZip.  not sure why!  What I found is that setting
+            // bit 3 and following all the implications, the zip64 file is
+            // readable by WinZip 12. and Perl's IO::Compress::Zip .  Perl takes
+            // an interesting approach - it always sets bit 3 if ZIP64 in use.
+            // DotNetZip now does the same; this gives better compatibility with
+            // WinZip 12.
+
+            if (IsDirectory || cycle == 99)
+            {
+                // (cycle == 99) indicates a zero-length entry written by ZipOutputStream
+
+                _BitField &= ~0x0008;  // unset bit 3 - no "data descriptor" - ever
+                _BitField &= ~0x0001;  // unset bit 1 - no encryption - ever
+                Encryption = EncryptionAlgorithm.None;
+                Password = null;
+            }
+            else if (!s.CanSeek)
+                _BitField |= 0x0008;
+
+#if DONT_GO_THERE
+            else if (this.Encryption == EncryptionAlgorithm.PkzipWeak  &&
+                     this._Source != ZipEntrySource.ZipFile)
+            {
+                // Set bit 3 to avoid the double-read perf issue.
+                //
+                // When PKZIP encryption is used, byte 11 of the encryption header is
+                // used as a consistency check. It is normally set to the MSByte of the
+                // CRC.  But this means the cRC must be known ebfore compression and
+                // encryption, which means the entire stream has to be read twice.  To
+                // avoid that, the high-byte of the time blob (when in DOS format) can
+                // be used for the consistency check (byte 11 in the encryption header).
+                // But this means the entry must have bit 3 set.
+                //
+                // Previously I used a more complex arrangement - using the methods like
+                // FigureCrc32(), PrepOutputStream() and others, in order to manage the
+                // seek-back in the source stream.  Why?  Because bit 3 is not always
+                // friendly with third-party zip tools, like those on the Mac.
+                //
+                // This is why this code is still ifdef'd  out.
+                //
+                // Might consider making this yet another programmable option -
+                // AlwaysUseBit3ForPkzip.  But that's for another day.
+                //
+                _BitField |= 0x0008;
+            }
+#endif
+
+            // (i==6)
+            block[i++] = (byte)(_BitField & 0x00FF);
+            block[i++] = (byte)((_BitField & 0xFF00) >> 8);
+
+            // Here, we want to set values for Compressed Size, Uncompressed Size,
+            // and CRC.  If we have __FileDataPosition as not -1 (zero is a valid
+            // FDP), then that means we are reading this zip entry from a zip
+            // file, and we have good values for those quantities.
+            //
+            // If _FileDataPosition is -1, then we are constructing this Entry
+            // from nothing.  We zero those quantities now, and we will compute
+            // actual values for the three quantities later, when we do the
+            // compression, and then seek back to write them into the appropriate
+            // place in the header.
+            if (this.__FileDataPosition == -1)
+            {
+                //_UncompressedSize = 0; // do not unset - may need this value for restream
+                // _Crc32 = 0;           // ditto
+                _CompressedSize = 0;
+                _crcCalculated = false;
+            }
+
+            // set compression method here
+            MaybeUnsetCompressionMethodForWriting(cycle);
+
+            // (i==8) compression method
+            block[i++] = (byte)(_CompressionMethod & 0x00FF);
+            block[i++] = (byte)((_CompressionMethod & 0xFF00) >> 8);
+
+            if (cycle == 99)
+            {
+                // (cycle == 99) indicates a zero-length entry written by ZipOutputStream
+                SetZip64Flags();
+            }
+
+#if AESCRYPTO
+            else if (Encryption == EncryptionAlgorithm.WinZipAes128 || Encryption == EncryptionAlgorithm.WinZipAes256)
+            {
+                i -= 2;
+                block[i++] = 0x63;
+                block[i++] = 0;
+            }
+#endif
+
+            // LastMod
+            _TimeBlob = Ionic.Zip.SharedUtilities.DateTimeToPacked(LastModified);
+
+            // (i==10) time blob
+            block[i++] = (byte)(_TimeBlob & 0x000000FF);
+            block[i++] = (byte)((_TimeBlob & 0x0000FF00) >> 8);
+            block[i++] = (byte)((_TimeBlob & 0x00FF0000) >> 16);
+            block[i++] = (byte)((_TimeBlob & 0xFF000000) >> 24);
+
+            // (i==14) CRC - if source==filesystem, this is zero now, actual value
+            // will be calculated later.  if source==archive, this is a bonafide
+            // value.
+            block[i++] = (byte)(_Crc32 & 0x000000FF);
+            block[i++] = (byte)((_Crc32 & 0x0000FF00) >> 8);
+            block[i++] = (byte)((_Crc32 & 0x00FF0000) >> 16);
+            block[i++] = (byte)((_Crc32 & 0xFF000000) >> 24);
+
+            if (_presumeZip64)
+            {
+                // (i==18) CompressedSize (Int32) and UncompressedSize - all 0xFF for now
+                for (j = 0; j < 8; j++)
+                    block[i++] = 0xFF;
+            }
+            else
+            {
+                // (i==18) CompressedSize (Int32) - this value may or may not be
+                // bonafide.  if source == filesystem, then it is zero, and we'll
+                // learn it after we compress.  if source == archive, then it is
+                // bonafide data.
+                block[i++] = (byte)(_CompressedSize & 0x000000FF);
+                block[i++] = (byte)((_CompressedSize & 0x0000FF00) >> 8);
+                block[i++] = (byte)((_CompressedSize & 0x00FF0000) >> 16);
+                block[i++] = (byte)((_CompressedSize & 0xFF000000) >> 24);
+
+                // (i==22) UncompressedSize (Int32) - this value may or may not be
+                // bonafide.
+                block[i++] = (byte)(_UncompressedSize & 0x000000FF);
+                block[i++] = (byte)((_UncompressedSize & 0x0000FF00) >> 8);
+                block[i++] = (byte)((_UncompressedSize & 0x00FF0000) >> 16);
+                block[i++] = (byte)((_UncompressedSize & 0xFF000000) >> 24);
+            }
+
+            // (i==26) filename length (Int16)
+            block[i++] = (byte)(filenameLength & 0x00FF);
+            block[i++] = (byte)((filenameLength & 0xFF00) >> 8);
+
+            _Extra = ConstructExtraField(false);
+
+            // (i==28) extra field length (short)
+            Int16 extraFieldLength = (Int16)((_Extra == null) ? 0 : _Extra.Length);
+            block[i++] = (byte)(extraFieldLength & 0x00FF);
+            block[i++] = (byte)((extraFieldLength & 0xFF00) >> 8);
+
+            // workitem 13542
+            byte[] bytes = new byte[i + filenameLength + extraFieldLength];
+
+            // get the fixed portion
+            Buffer.BlockCopy(block, 0, bytes, 0, i);
+            //for (j = 0; j < i; j++) bytes[j] = block[j];
+
+            // The filename written to the archive.
+            Buffer.BlockCopy(fileNameBytes, 0, bytes, i, fileNameBytes.Length);
+            // for (j = 0; j < fileNameBytes.Length; j++)
+            //     bytes[i + j] = fileNameBytes[j];
+
+            i += fileNameBytes.Length;
+
+            // "Extra field"
+            if (_Extra != null)
+            {
+                Buffer.BlockCopy(_Extra, 0, bytes, i, _Extra.Length);
+                // for (j = 0; j < _Extra.Length; j++)
+                //     bytes[i + j] = _Extra[j];
+                i += _Extra.Length;
+            }
+
+            _LengthOfHeader = i;
+
+            // handle split archives
+            var zss = s as ZipSegmentedStream;
+            if (zss != null)
+            {
+                zss.ContiguousWrite = true;
+                UInt32 requiredSegment = zss.ComputeSegment(i);
+                if (requiredSegment != zss.CurrentSegment)
+                    _future_ROLH = 0; // rollover!
+                else
+                    _future_ROLH = zss.Position;
+
+                _diskNumber = requiredSegment;
+            }
+
+            // validate the ZIP64 usage
+            if (_container.Zip64 == Zip64Option.Never && (uint)_RelativeOffsetOfLocalHeader >= 0xFFFFFFFF)
+                throw new ZipException("Offset within the zip archive exceeds 0xFFFFFFFF. Consider setting the UseZip64WhenSaving property on the ZipFile instance.");
+
+
+            // finally, write the header to the stream
+            s.Write(bytes, 0, i);
+
+            // now that the header is written, we can turn off the contiguous write restriction.
+            if (zss != null)
+                zss.ContiguousWrite = false;
+
+            // Preserve this header data, we'll use it again later.
+            // ..when seeking backward, to write again, after we have the Crc, compressed
+            //   and uncompressed sizes.
+            // ..and when writing the central directory structure.
+            _EntryHeader = bytes;
+        }
+
+
+
+
+        private Int32 FigureCrc32()
+        {
+            if (_crcCalculated == false)
+            {
+                Stream input = null;
+                // get the original stream:
+                if (this._Source == ZipEntrySource.WriteDelegate)
+                {
+                    var output = new Ionic.Crc.CrcCalculatorStream(Stream.Null);
+                    // allow the application to write the data
+                    this._WriteDelegate(this.FileName, output);
+                    _Crc32 = output.Crc;
+                }
+                else if (this._Source == ZipEntrySource.ZipFile)
+                {
+                    // nothing to do - the CRC is already set
+                }
+                else
+                {
+                    if (this._Source == ZipEntrySource.Stream)
+                    {
+                        PrepSourceStream();
+                        input = this._sourceStream;
+                    }
+                    else if (this._Source == ZipEntrySource.JitStream)
+                    {
+                        // allow the application to open the stream
+                        if (this._sourceStream == null)
+                            _sourceStream = this._OpenDelegate(this.FileName);
+                        PrepSourceStream();
+                        input = this._sourceStream;
+                    }
+                    else if (this._Source == ZipEntrySource.ZipOutputStream)
+                    {
+                    }
+                    else
+                    {
+                        //input = File.OpenRead(LocalFileName);
+                        input = File.Open(LocalFileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
+                    }
+
+                    var crc32 = new Ionic.Crc.CRC32();
+                    _Crc32 = crc32.GetCrc32(input);
+
+                    if (_sourceStream == null)
+                    {
+#if NETCF
+                        input.Close();
+#else
+                        input.Dispose();
+#endif
+                    }
+                }
+                _crcCalculated = true;
+            }
+            return _Crc32;
+        }
+
+
+        /// <summary>
+        ///   Stores the position of the entry source stream, or, if the position is
+        ///   already stored, seeks to that position.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   This method is called in prep for reading the source stream.  If PKZIP
+        ///   encryption is used, then we need to calc the CRC32 before doing the
+        ///   encryption, because the CRC is used in the 12th byte of the PKZIP
+        ///   encryption header.  So, we need to be able to seek backward in the source
+        ///   when saving the ZipEntry. This method is called from the place that
+        ///   calculates the CRC, and also from the method that does the encryption of
+        ///   the file data.
+        /// </para>
+        ///
+        /// <para>
+        ///   The first time through, this method sets the _sourceStreamOriginalPosition
+        ///   field. Subsequent calls to this method seek to that position.
+        /// </para>
+        /// </remarks>
+        private void PrepSourceStream()
+        {
+            if (_sourceStream == null)
+                throw new ZipException(String.Format("The input stream is null for entry '{0}'.", FileName));
+
+            if (this._sourceStreamOriginalPosition != null)
+            {
+                // this will happen the 2nd cycle through, if the stream is seekable
+                this._sourceStream.Position = this._sourceStreamOriginalPosition.Value;
+            }
+            else if (this._sourceStream.CanSeek)
+            {
+                // this will happen the first cycle through, if seekable
+                this._sourceStreamOriginalPosition = new Nullable<Int64>(this._sourceStream.Position);
+            }
+            else if (this.Encryption == EncryptionAlgorithm.PkzipWeak)
+            {
+                // In general, using PKZIP encryption on a a zip entry whose input
+                // comes from a non-seekable stream, is tricky.  Here's why:
+                //
+                // Byte 11 of the PKZIP encryption header is used for password
+                // validation and consistency checknig.
+                //
+                // Normally, the highest byte of the CRC is used as the 11th (last) byte
+                // in the PKZIP encryption header. This means the CRC must be known
+                // before encryption is performed. Normally that means we read the full
+                // data stream, compute the CRC, then seek back and read it again for
+                // the compression+encryption phase. Obviously this is bad for
+                // performance with a large input file.
+                //
+                // There's a twist in the ZIP spec (actually documented only in infozip
+                // code, not in the spec itself) that allows the high-order byte of the
+                // last modified time for the entry, when the lastmod time is in packed
+                // (DOS) format, to be used for Byte 11 in the encryption header. In
+                // this case, the bit 3 "data descriptor" must be used.
+                //
+                // An intelligent implementation would therefore force the use of the
+                // bit 3 data descriptor when PKZIP encryption is in use, regardless.
+                // This avoids the double-read of the stream to be encrypted.  So far,
+                // DotNetZip doesn't do that; it just punts when the input stream is
+                // non-seekable, and the output does not use Bit 3.
+                //
+                // The other option is to use the CRC when it is already available, eg,
+                // when the source for the data is a ZipEntry (when the zip file is
+                // being updated). In this case we already know the CRC and can just use
+                // what we know.
+
+                if (this._Source != ZipEntrySource.ZipFile && ((this._BitField & 0x0008) != 0x0008))
+                    throw new ZipException("It is not possible to use PKZIP encryption on a non-seekable input stream");
+            }
+        }
+
+
+        /// <summary>
+        /// Copy metadata that may have been changed by the app.  We do this when
+        /// resetting the zipFile instance.  If the app calls Save() on a ZipFile, then
+        /// tries to party on that file some more, we may need to Reset() it , which
+        /// means re-reading the entries and then copying the metadata.  I think.
+        /// </summary>
+        internal void CopyMetaData(ZipEntry source)
+        {
+            this.__FileDataPosition = source.__FileDataPosition;
+            this.CompressionMethod = source.CompressionMethod;
+            this._CompressionMethod_FromZipFile = source._CompressionMethod_FromZipFile;
+            this._CompressedFileDataSize = source._CompressedFileDataSize;
+            this._UncompressedSize = source._UncompressedSize;
+            this._BitField = source._BitField;
+            this._Source = source._Source;
+            this._LastModified = source._LastModified;
+            this._Mtime = source._Mtime;
+            this._Atime = source._Atime;
+            this._Ctime = source._Ctime;
+            this._ntfsTimesAreSet = source._ntfsTimesAreSet;
+            this._emitUnixTimes = source._emitUnixTimes;
+            this._emitNtfsTimes = source._emitNtfsTimes;
+        }
+
+
+        private void OnWriteBlock(Int64 bytesXferred, Int64 totalBytesToXfer)
+        {
+            if (_container.ZipFile != null)
+                _ioOperationCanceled = _container.ZipFile.OnSaveBlock(this, bytesXferred, totalBytesToXfer);
+        }
+
+
+
+        private void _WriteEntryData(Stream s)
+        {
+            // Read in the data from the input stream (often a file in the filesystem),
+            // and write it to the output stream, calculating a CRC on it as we go.
+            // We will also compress and encrypt as necessary.
+
+            Stream input = null;
+            long fdp = -1L;
+            try
+            {
+                // Want to record the position in the zip file of the zip entry
+                // data (as opposed to the metadata).  s.Position may fail on some
+                // write-only streams, eg stdout or System.Web.HttpResponseStream.
+                // We swallow that exception, because we don't care, in that case.
+                // But, don't set __FileDataPosition directly.  It may be needed
+                // to READ the zip entry from the zip file, if this is a
+                // "re-stream" situation. In other words if the zip entry has
+                // changed compression level, or compression method, or (maybe?)
+                // encryption algorithm.  In that case if the original entry is
+                // encrypted, we need __FileDataPosition to be the value for the
+                // input zip file.  This s.Position is for the output zipfile.  So
+                // we copy fdp to __FileDataPosition after this entry has been
+                // (maybe) restreamed.
+                fdp = s.Position;
+            }
+            catch (Exception) { }
+
+            try
+            {
+                // Use fileLength for progress updates, and to decide whether we can
+                // skip encryption and compression altogether (in case of length==zero)
+                long fileLength = SetInputAndFigureFileLength(ref input);
+
+                // Wrap a counting stream around the raw output stream:
+                // This is the last thing that happens before the bits go to the
+                // application-provided stream.
+                //
+                // Sometimes s is a CountingStream. Doesn't matter. Wrap it with a
+                // counter anyway. We need to count at both levels.
+
+                CountingStream entryCounter = new CountingStream(s);
+
+                Stream encryptor;
+                Stream compressor;
+
+                if (fileLength != 0L)
+                {
+                    // Maybe wrap an encrypting stream around the counter: This will
+                    // happen BEFORE output counting, and AFTER compression, if encryption
+                    // is used.
+                    encryptor = MaybeApplyEncryption(entryCounter);
+
+                    // Maybe wrap a compressing Stream around that.
+                    // This will happen BEFORE encryption (if any) as we write data out.
+                    compressor = MaybeApplyCompression(encryptor, fileLength);
+                }
+                else
+                {
+                    encryptor = compressor = entryCounter;
+                }
+
+                // Wrap a CrcCalculatorStream around that.
+                // This will happen BEFORE compression (if any) as we write data out.
+                var output = new Ionic.Crc.CrcCalculatorStream(compressor, true);
+
+                // output.Write() causes this flow:
+                // calc-crc -> compress -> encrypt -> count -> actually write
+
+                if (this._Source == ZipEntrySource.WriteDelegate)
+                {
+                    // allow the application to write the data
+                    this._WriteDelegate(this.FileName, output);
+                }
+                else
+                {
+                    // synchronously copy the input stream to the output stream-chain
+                    byte[] buffer = new byte[BufferSize];
+                    int n;
+                    while ((n = SharedUtilities.ReadWithRetry(input, buffer, 0, buffer.Length, FileName)) != 0)
+                    {
+                        output.Write(buffer, 0, n);
+                        OnWriteBlock(output.TotalBytesSlurped, fileLength);
+                        if (_ioOperationCanceled)
+                            break;
+                    }
+                }
+
+                FinishOutputStream(s, entryCounter, encryptor, compressor, output);
+            }
+            finally
+            {
+                if (this._Source == ZipEntrySource.JitStream)
+                {
+                    // allow the application to close the stream
+                    if (this._CloseDelegate != null)
+                        this._CloseDelegate(this.FileName, input);
+                }
+                else if ((input as FileStream) != null)
+                {
+#if NETCF
+                    input.Close();
+#else
+                    input.Dispose();
+#endif
+                }
+            }
+
+            if (_ioOperationCanceled)
+                return;
+
+            // set FDP now, to allow for re-streaming
+            this.__FileDataPosition = fdp;
+            PostProcessOutput(s);
+        }
+
+
+        /// <summary>
+        ///   Set the input stream and get its length, if possible.  The length is
+        ///   used for progress updates, AND, to allow an optimization in case of
+        ///   a stream/file of zero length. In that case we skip the Encrypt and
+        ///   compression Stream. (like DeflateStream or BZip2OutputStream)
+        /// </summary>
+        private long SetInputAndFigureFileLength(ref Stream input)
+        {
+            long fileLength = -1L;
+            // get the original stream:
+            if (this._Source == ZipEntrySource.Stream)
+            {
+                PrepSourceStream();
+                input = this._sourceStream;
+
+                // Try to get the length, no big deal if not available.
+                try { fileLength = this._sourceStream.Length; }
+                catch (NotSupportedException) { }
+            }
+            else if (this._Source == ZipEntrySource.ZipFile)
+            {
+                // we are "re-streaming" the zip entry.
+                string pwd = (_Encryption_FromZipFile == EncryptionAlgorithm.None) ? null : (this._Password ?? this._container.Password);
+                this._sourceStream = InternalOpenReader(pwd);
+                PrepSourceStream();
+                input = this._sourceStream;
+                fileLength = this._sourceStream.Length;
+            }
+            else if (this._Source == ZipEntrySource.JitStream)
+            {
+                // allow the application to open the stream
+                if (this._sourceStream == null) _sourceStream = this._OpenDelegate(this.FileName);
+                PrepSourceStream();
+                input = this._sourceStream;
+                try { fileLength = this._sourceStream.Length; }
+                catch (NotSupportedException) { }
+            }
+            else if (this._Source == ZipEntrySource.FileSystem)
+            {
+                // workitem 7145
+                FileShare fs = FileShare.ReadWrite;
+#if !NETCF
+                // FileShare.Delete is not defined for the Compact Framework
+                fs |= FileShare.Delete;
+#endif
+                // workitem 8423
+                input = File.Open(LocalFileName, FileMode.Open, FileAccess.Read, fs);
+                fileLength = input.Length;
+            }
+
+            return fileLength;
+        }
+
+
+
+        internal void FinishOutputStream(Stream s,
+                                         CountingStream entryCounter,
+                                         Stream encryptor,
+                                         Stream compressor,
+                                         Ionic.Crc.CrcCalculatorStream output)
+        {
+            if (output == null) return;
+
+            output.Close();
+
+            // by calling Close() on the deflate stream, we write the footer bytes, as necessary.
+            if ((compressor as Ionic.Zlib.DeflateStream) != null)
+                compressor.Close();
+#if BZIP
+            else if ((compressor as Ionic.BZip2.BZip2OutputStream) != null)
+                compressor.Close();
+#if !NETCF
+            else if ((compressor as Ionic.BZip2.ParallelBZip2OutputStream) != null)
+                compressor.Close();
+#endif
+#endif
+
+#if !NETCF
+            else if ((compressor as Ionic.Zlib.ParallelDeflateOutputStream) != null)
+                compressor.Close();
+#endif
+
+            encryptor.Flush();
+            encryptor.Close();
+
+            _LengthOfTrailer = 0;
+
+            _UncompressedSize = output.TotalBytesSlurped;
+
+#if AESCRYPTO
+            WinZipAesCipherStream wzacs = encryptor as WinZipAesCipherStream;
+            if (wzacs != null && _UncompressedSize > 0)
+            {
+                s.Write(wzacs.FinalAuthentication, 0, 10);
+                _LengthOfTrailer += 10;
+            }
+#endif
+            _CompressedFileDataSize = entryCounter.BytesWritten;
+            _CompressedSize = _CompressedFileDataSize;   // may be adjusted
+            _Crc32 = output.Crc;
+
+            // Set _RelativeOffsetOfLocalHeader now, to allow for re-streaming
+            StoreRelativeOffset();
+        }
+
+
+
+
+        internal void PostProcessOutput(Stream s)
+        {
+            var s1 = s as CountingStream;
+
+            // workitem 8931 - for WriteDelegate.
+            // The WriteDelegate changes things because there can be a zero-byte stream
+            // written. In all other cases DotNetZip knows the length of the stream
+            // before compressing and encrypting. In this case we have to circle back,
+            // and omit all the crypto stuff - the GP bitfield, and the crypto header.
+            if (_UncompressedSize == 0 && _CompressedSize == 0)
+            {
+                if (this._Source == ZipEntrySource.ZipOutputStream) return;  // nothing to do...
+
+                if (_Password != null)
+                {
+                    int headerBytesToRetract = 0;
+                    if (Encryption == EncryptionAlgorithm.PkzipWeak)
+                        headerBytesToRetract = 12;
+#if AESCRYPTO
+                    else if (Encryption == EncryptionAlgorithm.WinZipAes128 ||
+                             Encryption == EncryptionAlgorithm.WinZipAes256)
+                    {
+                        headerBytesToRetract = _aesCrypto_forWrite._Salt.Length + _aesCrypto_forWrite.GeneratedPV.Length;
+                    }
+#endif
+                    if (this._Source == ZipEntrySource.ZipOutputStream && !s.CanSeek)
+                        throw new ZipException("Zero bytes written, encryption in use, and non-seekable output.");
+
+                    if (Encryption != EncryptionAlgorithm.None)
+                    {
+                        // seek back in the stream to un-output the security metadata
+                        s.Seek(-1 * headerBytesToRetract, SeekOrigin.Current);
+                        s.SetLength(s.Position);
+                        // workitem 10178
+                        Ionic.Zip.SharedUtilities.Workaround_Ladybug318918(s);
+
+                        // workitem 11131
+                        // adjust the count on the CountingStream as necessary
+                        if (s1 != null) s1.Adjust(headerBytesToRetract);
+
+                        // subtract the size of the security header from the _LengthOfHeader
+                        _LengthOfHeader -= headerBytesToRetract;
+                        __FileDataPosition -= headerBytesToRetract;
+                    }
+                    _Password = null;
+
+                    // turn off the encryption bit
+                    _BitField &= ~(0x0001);
+
+                    // copy the updated bitfield value into the header
+                    int j = 6;
+                    _EntryHeader[j++] = (byte)(_BitField & 0x00FF);
+                    _EntryHeader[j++] = (byte)((_BitField & 0xFF00) >> 8);
+
+#if AESCRYPTO
+                    if (Encryption == EncryptionAlgorithm.WinZipAes128 ||
+                        Encryption == EncryptionAlgorithm.WinZipAes256)
+                    {
+                        // Fix the extra field - overwrite the 0x9901 headerId
+                        // with dummy data. (arbitrarily, 0x9999)
+                        Int16 fnLength = (short)(_EntryHeader[26] + _EntryHeader[27] * 256);
+                        int offx = 30 + fnLength;
+                        int aesIndex = FindExtraFieldSegment(_EntryHeader, offx, 0x9901);
+                        if (aesIndex >= 0)
+                        {
+                            _EntryHeader[aesIndex++] = 0x99;
+                            _EntryHeader[aesIndex++] = 0x99;
+                        }
+                    }
+#endif
+                }
+
+                CompressionMethod = 0;
+                Encryption = EncryptionAlgorithm.None;
+            }
+            else if (_zipCrypto_forWrite != null
+#if AESCRYPTO
+                     || _aesCrypto_forWrite != null
+#endif
+                     )
+
+            {
+                if (Encryption == EncryptionAlgorithm.PkzipWeak)
+                {
+                    _CompressedSize += 12; // 12 extra bytes for the encryption header
+                }
+#if AESCRYPTO
+                else if (Encryption == EncryptionAlgorithm.WinZipAes128 ||
+                         Encryption == EncryptionAlgorithm.WinZipAes256)
+                {
+                    // adjust the compressed size to include the variable (salt+pv)
+                    // security header and 10-byte trailer. According to the winzip AES
+                    // spec, that metadata is included in the "Compressed Size" figure
+                    // when encoding the zip archive.
+                    _CompressedSize += _aesCrypto_forWrite.SizeOfEncryptionMetadata;
+                }
+#endif
+            }
+
+            int i = 8;
+            _EntryHeader[i++] = (byte)(_CompressionMethod & 0x00FF);
+            _EntryHeader[i++] = (byte)((_CompressionMethod & 0xFF00) >> 8);
+
+            i = 14;
+            // CRC - the correct value now
+            _EntryHeader[i++] = (byte)(_Crc32 & 0x000000FF);
+            _EntryHeader[i++] = (byte)((_Crc32 & 0x0000FF00) >> 8);
+            _EntryHeader[i++] = (byte)((_Crc32 & 0x00FF0000) >> 16);
+            _EntryHeader[i++] = (byte)((_Crc32 & 0xFF000000) >> 24);
+
+            SetZip64Flags();
+
+            // (i==26) filename length (Int16)
+            Int16 filenameLength = (short)(_EntryHeader[26] + _EntryHeader[27] * 256);
+            Int16 extraFieldLength = (short)(_EntryHeader[28] + _EntryHeader[29] * 256);
+
+            if (_OutputUsesZip64.Value)
+            {
+                // VersionNeededToExtract - set to 45 to indicate zip64
+                _EntryHeader[4] = (byte)(45 & 0x00FF);
+                _EntryHeader[5] = 0x00;
+
+                // workitem 7924 - don't need bit 3
+                // // workitem 7917
+                // // set bit 3 for ZIP64 compatibility with WinZip12
+                // _BitField |= 0x0008;
+                // _EntryHeader[6] = (byte)(_BitField & 0x00FF);
+
+                // CompressedSize and UncompressedSize - 0xFF
+                for (int j = 0; j < 8; j++)
+                    _EntryHeader[i++] = 0xff;
+
+                // At this point we need to find the "Extra field" that follows the
+                // filename.  We had already emitted it, but the data (uncomp, comp,
+                // ROLH) was not available at the time we did so.  Here, we emit it
+                // again, with final values.
+
+                i = 30 + filenameLength;
+                _EntryHeader[i++] = 0x01;  // zip64
+                _EntryHeader[i++] = 0x00;
+
+                i += 2; // skip over data size, which is 16+4
+
+                Array.Copy(BitConverter.GetBytes(_UncompressedSize), 0, _EntryHeader, i, 8);
+                i += 8;
+                Array.Copy(BitConverter.GetBytes(_CompressedSize), 0, _EntryHeader, i, 8);
+            }
+            else
+            {
+                // VersionNeededToExtract - reset to 20 since no zip64
+                _EntryHeader[4] = (byte)(20 & 0x00FF);
+                _EntryHeader[5] = 0x00;
+
+                // CompressedSize - the correct value now
+                i = 18;
+                _EntryHeader[i++] = (byte)(_CompressedSize & 0x000000FF);
+                _EntryHeader[i++] = (byte)((_CompressedSize & 0x0000FF00) >> 8);
+                _EntryHeader[i++] = (byte)((_CompressedSize & 0x00FF0000) >> 16);
+                _EntryHeader[i++] = (byte)((_CompressedSize & 0xFF000000) >> 24);
+
+                // UncompressedSize - the correct value now
+                _EntryHeader[i++] = (byte)(_UncompressedSize & 0x000000FF);
+                _EntryHeader[i++] = (byte)((_UncompressedSize & 0x0000FF00) >> 8);
+                _EntryHeader[i++] = (byte)((_UncompressedSize & 0x00FF0000) >> 16);
+                _EntryHeader[i++] = (byte)((_UncompressedSize & 0xFF000000) >> 24);
+
+                // The HeaderId in the extra field header, is already dummied out.
+                if (extraFieldLength != 0)
+                {
+                    i = 30 + filenameLength;
+                    // For zip archives written by this library, if the zip64
+                    // header exists, it is the first header. Because of the logic
+                    // used when first writing the _EntryHeader bytes, the
+                    // HeaderId is not guaranteed to be any particular value.  So
+                    // we determine if the first header is a putative zip64 header
+                    // by examining the datasize.  UInt16 HeaderId =
+                    // (UInt16)(_EntryHeader[i] + _EntryHeader[i + 1] * 256);
+                    Int16 DataSize = (short)(_EntryHeader[i + 2] + _EntryHeader[i + 3] * 256);
+                    if (DataSize == 16)
+                    {
+                        // reset to Header Id to dummy value, effectively dummy-ing out the zip64 metadata
+                        _EntryHeader[i++] = 0x99;
+                        _EntryHeader[i++] = 0x99;
+                    }
+                }
+            }
+
+
+#if AESCRYPTO
+
+            if (Encryption == EncryptionAlgorithm.WinZipAes128 ||
+                Encryption == EncryptionAlgorithm.WinZipAes256)
+            {
+                // Must set compressionmethod to 0x0063 (decimal 99)
+                //
+                // and then set the compression method bytes inside the extra
+                // field to the actual compression method value.
+
+                i = 8;
+                _EntryHeader[i++] = 0x63;
+                _EntryHeader[i++] = 0;
+
+                i = 30 + filenameLength;
+                do
+                {
+                    UInt16 HeaderId = (UInt16)(_EntryHeader[i] + _EntryHeader[i + 1] * 256);
+                    Int16 DataSize = (short)(_EntryHeader[i + 2] + _EntryHeader[i + 3] * 256);
+                    if (HeaderId != 0x9901)
+                    {
+                        // skip this header
+                        i += DataSize + 4;
+                    }
+                    else
+                    {
+                        i += 9;
+                        // actual compression method
+                        _EntryHeader[i++] = (byte)(_CompressionMethod & 0x00FF);
+                        _EntryHeader[i++] = (byte)(_CompressionMethod & 0xFF00);
+                    }
+                } while (i < (extraFieldLength - 30 - filenameLength));
+            }
+#endif
+
+            // finally, write the data.
+
+            // workitem 7216 - sometimes we don't seek even if we CAN.  ASP.NET
+            // Response.OutputStream, or stdout are non-seekable.  But we may also want
+            // to NOT seek in other cases, eg zip64.  For all cases, we just check bit 3
+            // to see if we want to seek.  There's one exception - if using a
+            // ZipOutputStream, and PKZip encryption is in use, then we set bit 3 even
+            // if the out is seekable. This is so the check on the last byte of the
+            // PKZip Encryption Header can be done on the current time, as opposed to
+            // the CRC, to prevent streaming the file twice.  So, test for
+            // ZipOutputStream and seekable, and if so, seek back, even if bit 3 is set.
+
+            if ((_BitField & 0x0008) != 0x0008 ||
+                 (this._Source == ZipEntrySource.ZipOutputStream && s.CanSeek))
+            {
+                // seek back and rewrite the entry header
+                var zss = s as ZipSegmentedStream;
+                if (zss != null && _diskNumber != zss.CurrentSegment)
+                {
+                    // In this case the entry header is in a different file,
+                    // which has already been closed. Need to re-open it.
+                    using (Stream hseg = ZipSegmentedStream.ForUpdate(this._container.ZipFile.Name, _diskNumber))
+                    {
+                        hseg.Seek(this._RelativeOffsetOfLocalHeader, SeekOrigin.Begin);
+                        hseg.Write(_EntryHeader, 0, _EntryHeader.Length);
+                    }
+                }
+                else
+                {
+                    // seek in the raw output stream, to the beginning of the header for
+                    // this entry.
+                    // workitem 8098: ok (output)
+                    s.Seek(this._RelativeOffsetOfLocalHeader, SeekOrigin.Begin);
+
+                    // write the updated header to the output stream
+                    s.Write(_EntryHeader, 0, _EntryHeader.Length);
+
+                    // adjust the count on the CountingStream as necessary
+                    if (s1 != null) s1.Adjust(_EntryHeader.Length);
+
+                    // seek in the raw output stream, to the end of the file data
+                    // for this entry
+                    s.Seek(_CompressedSize, SeekOrigin.Current);
+                }
+            }
+
+            // emit the descriptor - only if not a directory.
+            if (((_BitField & 0x0008) == 0x0008) && !IsDirectory)
+            {
+                byte[] Descriptor = new byte[16 + (_OutputUsesZip64.Value ? 8 : 0)];
+                i = 0;
+
+                // signature
+                Array.Copy(BitConverter.GetBytes(ZipConstants.ZipEntryDataDescriptorSignature), 0, Descriptor, i, 4);
+                i += 4;
+
+                // CRC - the correct value now
+                Array.Copy(BitConverter.GetBytes(_Crc32), 0, Descriptor, i, 4);
+                i += 4;
+
+                // workitem 7917
+                if (_OutputUsesZip64.Value)
+                {
+                    // CompressedSize - the correct value now
+                    Array.Copy(BitConverter.GetBytes(_CompressedSize), 0, Descriptor, i, 8);
+                    i += 8;
+
+                    // UncompressedSize - the correct value now
+                    Array.Copy(BitConverter.GetBytes(_UncompressedSize), 0, Descriptor, i, 8);
+                    i += 8;
+                }
+                else
+                {
+                    // CompressedSize - (lower 32 bits) the correct value now
+                    Descriptor[i++] = (byte)(_CompressedSize & 0x000000FF);
+                    Descriptor[i++] = (byte)((_CompressedSize & 0x0000FF00) >> 8);
+                    Descriptor[i++] = (byte)((_CompressedSize & 0x00FF0000) >> 16);
+                    Descriptor[i++] = (byte)((_CompressedSize & 0xFF000000) >> 24);
+
+                    // UncompressedSize - (lower 32 bits) the correct value now
+                    Descriptor[i++] = (byte)(_UncompressedSize & 0x000000FF);
+                    Descriptor[i++] = (byte)((_UncompressedSize & 0x0000FF00) >> 8);
+                    Descriptor[i++] = (byte)((_UncompressedSize & 0x00FF0000) >> 16);
+                    Descriptor[i++] = (byte)((_UncompressedSize & 0xFF000000) >> 24);
+                }
+
+                // finally, write the trailing descriptor to the output stream
+                s.Write(Descriptor, 0, Descriptor.Length);
+
+                _LengthOfTrailer += Descriptor.Length;
+            }
+        }
+
+
+
+        private void SetZip64Flags()
+        {
+            // zip64 housekeeping
+            _entryRequiresZip64 = new Nullable<bool>
+                (_CompressedSize >= 0xFFFFFFFF || _UncompressedSize >= 0xFFFFFFFF || _RelativeOffsetOfLocalHeader >= 0xFFFFFFFF);
+
+            // validate the ZIP64 usage
+            if (_container.Zip64 == Zip64Option.Never && _entryRequiresZip64.Value)
+                throw new ZipException("Compressed or Uncompressed size, or offset exceeds the maximum value. Consider setting the UseZip64WhenSaving property on the ZipFile instance.");
+
+            _OutputUsesZip64 = new Nullable<bool>(_container.Zip64 == Zip64Option.Always || _entryRequiresZip64.Value);
+        }
+
+
+
+        /// <summary>
+        ///   Prepare the given stream for output - wrap it in a CountingStream, and
+        ///   then in a CRC stream, and an encryptor and deflator as appropriate.
+        /// </summary>
+        /// <remarks>
+        ///   <para>
+        ///     Previously this was used in ZipEntry.Write(), but in an effort to
+        ///     introduce some efficiencies in that method I've refactored to put the
+        ///     code inline.  This method still gets called by ZipOutputStream.
+        ///   </para>
+        /// </remarks>
+        internal void PrepOutputStream(Stream s,
+                                       long streamLength,
+                                       out CountingStream outputCounter,
+                                       out Stream encryptor,
+                                       out Stream compressor,
+                                       out Ionic.Crc.CrcCalculatorStream output)
+        {
+            TraceWriteLine("PrepOutputStream: e({0}) comp({1}) crypto({2}) zf({3})",
+                           FileName,
+                           CompressionLevel,
+                           Encryption,
+                           _container.Name);
+
+            // Wrap a counting stream around the raw output stream:
+            // This is the last thing that happens before the bits go to the
+            // application-provided stream.
+            outputCounter = new CountingStream(s);
+
+            // Sometimes the incoming "raw" output stream is already a CountingStream.
+            // Doesn't matter. Wrap it with a counter anyway. We need to count at both
+            // levels.
+
+            if (streamLength != 0L)
+            {
+                // Maybe wrap an encrypting stream around that:
+                // This will happen BEFORE output counting, and AFTER deflation, if encryption
+                // is used.
+                encryptor = MaybeApplyEncryption(outputCounter);
+
+                // Maybe wrap a compressing Stream around that.
+                // This will happen BEFORE encryption (if any) as we write data out.
+                compressor = MaybeApplyCompression(encryptor, streamLength);
+            }
+            else
+            {
+                encryptor = compressor = outputCounter;
+            }
+            // Wrap a CrcCalculatorStream around that.
+            // This will happen BEFORE compression (if any) as we write data out.
+            output = new Ionic.Crc.CrcCalculatorStream(compressor, true);
+        }
+
+
+
+        private Stream MaybeApplyCompression(Stream s, long streamLength)
+        {
+            if (_CompressionMethod == 0x08 && CompressionLevel != Ionic.Zlib.CompressionLevel.None)
+            {
+#if !NETCF
+                // ParallelDeflateThreshold == 0    means ALWAYS use parallel deflate
+                // ParallelDeflateThreshold == -1L  means NEVER use parallel deflate
+                // Other values specify the actual threshold.
+                if (_container.ParallelDeflateThreshold == 0L ||
+                    (streamLength > _container.ParallelDeflateThreshold &&
+                     _container.ParallelDeflateThreshold > 0L))
+                {
+                    // This is sort of hacky.
+                    //
+                    // It's expensive to create a ParallelDeflateOutputStream, because
+                    // of the large memory buffers.  But the class is unlike most Stream
+                    // classes in that it can be re-used, so the caller can compress
+                    // multiple files with it, one file at a time.  The key is to call
+                    // Reset() on it, in between uses.
+                    //
+                    // The ParallelDeflateOutputStream is attached to the container
+                    // itself - there is just one for the entire ZipFile or
+                    // ZipOutputStream. So it gets created once, per save, and then
+                    // re-used many times.
+                    //
+                    // This approach will break when we go to a "parallel save"
+                    // approach, where multiple entries within the zip file are being
+                    // compressed and saved at the same time.  But for now it's ok.
+                    //
+
+                    // instantiate the ParallelDeflateOutputStream
+                    if (_container.ParallelDeflater == null)
+                    {
+                        _container.ParallelDeflater =
+                            new ParallelDeflateOutputStream(s,
+                                                                        CompressionLevel,
+                                                                       _container.Strategy,
+                                                                       true);
+                        // can set the codec buffer size only before the first call to Write().
+                        if (_container.CodecBufferSize > 0)
+                            _container.ParallelDeflater.BufferSize = _container.CodecBufferSize;
+                        if (_container.ParallelDeflateMaxBufferPairs > 0)
+                            _container.ParallelDeflater.MaxBufferPairs =
+                                _container.ParallelDeflateMaxBufferPairs;
+                    }
+                    // reset it with the new stream
+                    Ionic.Zlib.ParallelDeflateOutputStream o1 = _container.ParallelDeflater;
+                    o1.Reset(s);
+                    return o1;
+                }
+#endif
+                var o = new DeflateStream(s, OfficeOpenXml.Packaging.Ionic.Zlib.CompressionMode.Compress,
+                                                     CompressionLevel,
+                                                     true);
+                if (_container.CodecBufferSize > 0)
+                    o.BufferSize = _container.CodecBufferSize;
+                o.Strategy = _container.Strategy;
+                return o;
+            }
+
+
+#if BZIP
+            if (_CompressionMethod == 0x0c)
+            {
+#if !NETCF
+                if (_container.ParallelDeflateThreshold == 0L ||
+                    (streamLength > _container.ParallelDeflateThreshold &&
+                     _container.ParallelDeflateThreshold > 0L))
+                {
+
+                    var o1 = new Ionic.BZip2.ParallelBZip2OutputStream(s, true);
+                    return o1;
+                }
+#endif
+                var o = new Ionic.BZip2.BZip2OutputStream(s, true);
+                return o;
+            }
+#endif
+
+            return s;
+        }
+
+
+
+        private Stream MaybeApplyEncryption(Stream s)
+        {
+            if (Encryption == EncryptionAlgorithm.PkzipWeak)
+            {
+                TraceWriteLine("MaybeApplyEncryption: e({0}) PKZIP", FileName);
+
+                return new ZipCipherStream(s, _zipCrypto_forWrite, CryptoMode.Encrypt);
+            }
+#if AESCRYPTO
+            if (Encryption == EncryptionAlgorithm.WinZipAes128 ||
+                     Encryption == EncryptionAlgorithm.WinZipAes256)
+            {
+                TraceWriteLine("MaybeApplyEncryption: e({0}) AES", FileName);
+
+                return new WinZipAesCipherStream(s, _aesCrypto_forWrite, CryptoMode.Encrypt);
+            }
+#endif
+            TraceWriteLine("MaybeApplyEncryption: e({0}) None", FileName);
+
+            return s;
+        }
+
+
+
+        private void OnZipErrorWhileSaving(Exception e)
+        {
+            if (_container.ZipFile != null)
+                _ioOperationCanceled = _container.ZipFile.OnZipErrorSaving(this, e);
+        }
+
+
+
+        internal void Write(Stream s)
+        {
+            var cs1 = s as CountingStream;
+            var zss1 = s as ZipSegmentedStream;
+
+            bool done = false;
+            do
+            {
+                try
+                {
+                    // When the app is updating a zip file, it may be possible to
+                    // just copy data for a ZipEntry from the source zipfile to the
+                    // destination, as a block, without decompressing and
+                    // recompressing, etc.  But, in some cases the app modifies the
+                    // properties on a ZipEntry prior to calling Save(). A change to
+                    // any of the metadata - the FileName, CompressioLeve and so on,
+                    // means DotNetZip cannot simply copy through the existing
+                    // ZipEntry data unchanged.
+                    //
+                    // There are two cases:
+                    //
+                    //  1. Changes to only metadata, which means the header and
+                    //     central directory must be changed.
+                    //
+                    //  2. Changes to the properties that affect the compressed
+                    //     stream, such as CompressionMethod, CompressionLevel, or
+                    //     EncryptionAlgorithm. In this case, DotNetZip must
+                    //     "re-stream" the data: the old entry data must be maybe
+                    //     decrypted, maybe decompressed, then maybe re-compressed
+                    //     and maybe re-encrypted.
+                    //
+                    // This test checks if the source for the entry data is a zip file, and
+                    // if a restream is necessary.  If NOT, then it just copies through
+                    // one entry, potentially changing the metadata.
+
+                    if (_Source == ZipEntrySource.ZipFile && !_restreamRequiredOnSave)
+                    {
+                        CopyThroughOneEntry(s);
+                        return;
+                    }
+
+                    // Is the entry a directory?  If so, the write is relatively simple.
+                    if (IsDirectory)
+                    {
+                        WriteHeader(s, 1);
+                        StoreRelativeOffset();
+                        _entryRequiresZip64 = new Nullable<bool>(_RelativeOffsetOfLocalHeader >= 0xFFFFFFFF);
+                        _OutputUsesZip64 = new Nullable<bool>(_container.Zip64 == Zip64Option.Always || _entryRequiresZip64.Value);
+                        // handle case for split archives
+                        if (zss1 != null)
+                            _diskNumber = zss1.CurrentSegment;
+
+                        return;
+                    }
+
+                    // At this point, the source for this entry is not a directory, and
+                    // not a previously created zip file, or the source for the entry IS
+                    // a previously created zip but the settings whave changed in
+                    // important ways and therefore we will need to process the
+                    // bytestream (compute crc, maybe compress, maybe encrypt) in order
+                    // to write the content into the new zip.
+                    //
+                    // We do this in potentially 2 passes: The first time we do it as
+                    // requested, maybe with compression and maybe encryption.  If that
+                    // causes the bytestream to inflate in size, and if compression was
+                    // on, then we turn off compression and do it again.
+
+
+                    bool readAgain = true;
+                    int nCycles = 0;
+                    do
+                    {
+                        nCycles++;
+
+                        WriteHeader(s, nCycles);
+
+                        // write the encrypted header
+                        WriteSecurityMetadata(s);
+
+                        // write the (potentially compressed, potentially encrypted) file data
+                        _WriteEntryData(s);
+
+                        // track total entry size (including the trailing descriptor and MAC)
+                        _TotalEntrySize = _LengthOfHeader + _CompressedFileDataSize + _LengthOfTrailer;
+
+                        // The file data has now been written to the stream, and
+                        // the file pointer is positioned directly after file data.
+
+                        if (nCycles > 1) readAgain = false;
+                        else if (!s.CanSeek) readAgain = false;
+                        else readAgain = WantReadAgain();
+
+                        if (readAgain)
+                        {
+                            // Seek back in the raw output stream, to the beginning of the file
+                            // data for this entry.
+
+                            // handle case for split archives
+                            if (zss1 != null)
+                            {
+                                // Console.WriteLine("***_diskNumber/first: {0}", _diskNumber);
+                                // Console.WriteLine("***_diskNumber/current: {0}", zss.CurrentSegment);
+                                zss1.TruncateBackward(_diskNumber, _RelativeOffsetOfLocalHeader);
+                            }
+                            else
+                                // workitem 8098: ok (output).
+                                s.Seek(_RelativeOffsetOfLocalHeader, SeekOrigin.Begin);
+
+                            // If the last entry expands, we read again; but here, we must
+                            // truncate the stream to prevent garbage data after the
+                            // end-of-central-directory.
+
+                            // workitem 8098: ok (output).
+                            s.SetLength(s.Position);
+
+                            // Adjust the count on the CountingStream as necessary.
+                            if (cs1 != null) cs1.Adjust(_TotalEntrySize);
+                        }
+                    }
+                    while (readAgain);
+                    _skippedDuringSave = false;
+                    done = true;
+                }
+                catch (System.Exception exc1)
+                {
+                    ZipErrorAction orig = this.ZipErrorAction;
+                    int loop = 0;
+                    do
+                    {
+                        if (ZipErrorAction == ZipErrorAction.Throw)
+                            throw;
+
+                        if (ZipErrorAction == ZipErrorAction.Skip ||
+                            ZipErrorAction == ZipErrorAction.Retry)
+                        {
+                            // must reset file pointer here.
+                            // workitem 13903 - seek back only when necessary
+                            long p1 = (cs1 != null)
+                                ? cs1.ComputedPosition
+                                : s.Position;
+                            long delta = p1 - _future_ROLH;
+                            if (delta > 0)
+                            {
+                                s.Seek(delta, SeekOrigin.Current); // may throw
+                                long p2 = s.Position;
+                                s.SetLength(s.Position);  // to prevent garbage if this is the last entry
+                                if (cs1 != null) cs1.Adjust(p1 - p2);
+                            }
+                            if (ZipErrorAction == ZipErrorAction.Skip)
+                            {
+                                WriteStatus("Skipping file {0} (exception: {1})", LocalFileName, exc1.ToString());
+
+                                _skippedDuringSave = true;
+                                done = true;
+                            }
+                            else
+                                this.ZipErrorAction = orig;
+                            break;
+                        }
+
+                        if (loop > 0) throw;
+
+                        if (ZipErrorAction == ZipErrorAction.InvokeErrorEvent)
+                        {
+                            OnZipErrorWhileSaving(exc1);
+                            if (_ioOperationCanceled)
+                            {
+                                done = true;
+                                break;
+                            }
+                        }
+                        loop++;
+                    }
+                    while (true);
+                }
+            }
+            while (!done);
+        }
+
+
+        internal void StoreRelativeOffset()
+        {
+            _RelativeOffsetOfLocalHeader = _future_ROLH;
+        }
+
+
+
+        internal void NotifySaveComplete()
+        {
+            // When updating a zip file, there are two contexts for properties
+            // like Encryption or CompressionMethod - the values read from the
+            // original zip file, and the values used in the updated zip file.
+            // The _FromZipFile versions are the originals.  At the end of a save,
+            // these values are the same.  So we need to update them.  This takes
+            // care of the boundary case where a single zipfile instance can be
+            // saved multiple times, with distinct changes to the properties on
+            // the entries, in between each Save().
+            _Encryption_FromZipFile = _Encryption;
+            _CompressionMethod_FromZipFile = _CompressionMethod;
+            _restreamRequiredOnSave = false;
+            _metadataChanged = false;
+            //_Source = ZipEntrySource.None;
+            _Source = ZipEntrySource.ZipFile; // workitem 10694
+        }
+
+
+        internal void WriteSecurityMetadata(Stream outstream)
+        {
+            if (Encryption == EncryptionAlgorithm.None)
+                return;
+
+            string pwd = this._Password;
+
+            // special handling for source == ZipFile.
+            // Want to support the case where we re-stream an encrypted entry. This will involve,
+            // at runtime, reading, decrypting, and decompressing from the original zip file, then
+            // compressing, encrypting, and writing to the output zip file.
+
+            // If that's what we're doing, and the password hasn't been set on the entry,
+            // we use the container (ZipFile/ZipOutputStream) password to decrypt.
+            // This test here says to use the container password to re-encrypt, as well,
+            // with that password, if the entry password is null.
+
+            if (this._Source == ZipEntrySource.ZipFile && pwd == null)
+                pwd = this._container.Password;
+
+            if (pwd == null)
+            {
+                _zipCrypto_forWrite = null;
+#if AESCRYPTO
+                _aesCrypto_forWrite = null;
+#endif
+                return;
+            }
+
+            TraceWriteLine("WriteSecurityMetadata: e({0}) crypto({1}) pw({2})",
+                           FileName, Encryption.ToString(), pwd);
+
+            if (Encryption == EncryptionAlgorithm.PkzipWeak)
+            {
+                // If PKZip (weak) encryption is in use, then the encrypted entry data
+                // is preceded by 12-byte "encryption header" for the entry.
+
+                _zipCrypto_forWrite = ZipCrypto.ForWrite(pwd);
+
+                // generate the random 12-byte header:
+                var rnd = new System.Random();
+                byte[] encryptionHeader = new byte[12];
+                rnd.NextBytes(encryptionHeader);
+
+                // workitem 8271
+                if ((this._BitField & 0x0008) == 0x0008)
+                {
+                    // In the case that bit 3 of the general purpose bit flag is set to
+                    // indicate the presence of a 'data descriptor' (signature
+                    // 0x08074b50), the last byte of the decrypted header is sometimes
+                    // compared with the high-order byte of the lastmodified time,
+                    // rather than the high-order byte of the CRC, to verify the
+                    // password.
+                    //
+                    // This is not documented in the PKWare Appnote.txt.
+                    // This was discovered this by analysis of the Crypt.c source file in the
+                    // InfoZip library
+                    // http://www.info-zip.org/pub/infozip/
+
+                    // Also, winzip insists on this!
+                    _TimeBlob = Ionic.Zip.SharedUtilities.DateTimeToPacked(LastModified);
+                    encryptionHeader[11] = (byte)((this._TimeBlob >> 8) & 0xff);
+                }
+                else
+                {
+                    // When bit 3 is not set, the CRC value is required before
+                    // encryption of the file data begins. In this case there is no way
+                    // around it: must read the stream in its entirety to compute the
+                    // actual CRC before proceeding.
+                    FigureCrc32();
+                    encryptionHeader[11] = (byte)((this._Crc32 >> 24) & 0xff);
+                }
+
+                // Encrypt the random header, INCLUDING the final byte which is either
+                // the high-order byte of the CRC32, or the high-order byte of the
+                // _TimeBlob.  Must do this BEFORE encrypting the file data.  This
+                // step changes the state of the cipher, or in the words of the PKZIP
+                // spec, it "further initializes" the cipher keys.
+
+                byte[] cipherText = _zipCrypto_forWrite.EncryptMessage(encryptionHeader, encryptionHeader.Length);
+
+                // Write the ciphered bonafide encryption header.
+                outstream.Write(cipherText, 0, cipherText.Length);
+                _LengthOfHeader += cipherText.Length;  // 12 bytes
+            }
+
+#if AESCRYPTO
+            else if (Encryption == EncryptionAlgorithm.WinZipAes128 ||
+                Encryption == EncryptionAlgorithm.WinZipAes256)
+            {
+                // If WinZip AES encryption is in use, then the encrypted entry data is
+                // preceded by a variable-sized Salt and a 2-byte "password
+                // verification" value for the entry.
+
+                int keystrength = GetKeyStrengthInBits(Encryption);
+                _aesCrypto_forWrite = WinZipAesCrypto.Generate(pwd, keystrength);
+                outstream.Write(_aesCrypto_forWrite.Salt, 0, _aesCrypto_forWrite._Salt.Length);
+                outstream.Write(_aesCrypto_forWrite.GeneratedPV, 0, _aesCrypto_forWrite.GeneratedPV.Length);
+                _LengthOfHeader += _aesCrypto_forWrite._Salt.Length + _aesCrypto_forWrite.GeneratedPV.Length;
+
+                TraceWriteLine("WriteSecurityMetadata: AES e({0}) keybits({1}) _LOH({2})",
+                               FileName, keystrength, _LengthOfHeader);
+
+            }
+#endif
+
+        }
+
+
+
+        private void CopyThroughOneEntry(Stream outStream)
+        {
+            // Just read the entry from the existing input zipfile and write to the output.
+            // But, if metadata has changed (like file times or attributes), or if the ZIP64
+            // option has changed, we can re-stream the entry data but must recompute the
+            // metadata.
+            if (this.LengthOfHeader == 0)
+                throw new BadStateException("Bad header length.");
+
+            // is it necessary to re-constitute new metadata for this entry?
+            bool needRecompute = _metadataChanged ||
+                (this.ArchiveStream is ZipSegmentedStream) ||
+                (outStream is ZipSegmentedStream) ||
+                (_InputUsesZip64 && _container.UseZip64WhenSaving == Zip64Option.Never) ||
+                (!_InputUsesZip64 && _container.UseZip64WhenSaving == Zip64Option.Always);
+
+            if (needRecompute)
+                CopyThroughWithRecompute(outStream);
+            else
+                CopyThroughWithNoChange(outStream);
+
+            // zip64 housekeeping
+            _entryRequiresZip64 = new Nullable<bool>
+                (_CompressedSize >= 0xFFFFFFFF || _UncompressedSize >= 0xFFFFFFFF ||
+                _RelativeOffsetOfLocalHeader >= 0xFFFFFFFF
+                );
+
+            _OutputUsesZip64 = new Nullable<bool>(_container.Zip64 == Zip64Option.Always || _entryRequiresZip64.Value);
+        }
+
+
+
+        private void CopyThroughWithRecompute(Stream outstream)
+        {
+            int n;
+            byte[] bytes = new byte[BufferSize];
+            var input = new CountingStream(this.ArchiveStream);
+
+            long origRelativeOffsetOfHeader = _RelativeOffsetOfLocalHeader;
+
+            // The header length may change due to rename of file, add a comment, etc.
+            // We need to retain the original.
+            int origLengthOfHeader = LengthOfHeader; // including crypto bytes!
+
+            // WriteHeader() has the side effect of changing _RelativeOffsetOfLocalHeader
+            // and setting _LengthOfHeader.  While ReadHeader() reads the crypto header if
+            // present, WriteHeader() does not write the crypto header.
+            WriteHeader(outstream, 0);
+            StoreRelativeOffset();
+
+            if (!this.FileName.EndsWith("/"))
+            {
+                // Not a directory; there is file data.
+                // Seek to the beginning of the entry data in the input stream.
+
+                long pos = origRelativeOffsetOfHeader + origLengthOfHeader;
+                int len = GetLengthOfCryptoHeaderBytes(_Encryption_FromZipFile);
+                pos -= len; // want to keep the crypto header
+                _LengthOfHeader += len;
+
+                input.Seek(pos, SeekOrigin.Begin);
+
+                // copy through everything after the header to the output stream
+                long remaining = this._CompressedSize;
+
+                while (remaining > 0)
+                {
+                    len = (remaining > bytes.Length) ? bytes.Length : (int)remaining;
+
+                    // read
+                    n = input.Read(bytes, 0, len);
+                    //_CheckRead(n);
+
+                    // write
+                    outstream.Write(bytes, 0, n);
+                    remaining -= n;
+                    OnWriteBlock(input.BytesRead, this._CompressedSize);
+                    if (_ioOperationCanceled)
+                        break;
+                }
+
+                // bit 3 descriptor
+                if ((this._BitField & 0x0008) == 0x0008)
+                {
+                    int size = 16;
+                    if (_InputUsesZip64) size += 8;
+                    byte[] Descriptor = new byte[size];
+                    input.Read(Descriptor, 0, size);
+
+                    if (_InputUsesZip64 && _container.UseZip64WhenSaving == Zip64Option.Never)
+                    {
+                        // original descriptor was 24 bytes, now we need 16.
+                        // Must check for underflow here.
+                        // signature + CRC.
+                        outstream.Write(Descriptor, 0, 8);
+
+                        // Compressed
+                        if (_CompressedSize > 0xFFFFFFFF)
+                            throw new InvalidOperationException("ZIP64 is required");
+                        outstream.Write(Descriptor, 8, 4);
+
+                        // UnCompressed
+                        if (_UncompressedSize > 0xFFFFFFFF)
+                            throw new InvalidOperationException("ZIP64 is required");
+                        outstream.Write(Descriptor, 16, 4);
+                        _LengthOfTrailer -= 8;
+                    }
+                    else if (!_InputUsesZip64 && _container.UseZip64WhenSaving == Zip64Option.Always)
+                    {
+                        // original descriptor was 16 bytes, now we need 24
+                        // signature + CRC
+                        byte[] pad = new byte[4];
+                        outstream.Write(Descriptor, 0, 8);
+                        // Compressed
+                        outstream.Write(Descriptor, 8, 4);
+                        outstream.Write(pad, 0, 4);
+                        // UnCompressed
+                        outstream.Write(Descriptor, 12, 4);
+                        outstream.Write(pad, 0, 4);
+                        _LengthOfTrailer += 8;
+                    }
+                    else
+                    {
+                        // same descriptor on input and output. Copy it through.
+                        outstream.Write(Descriptor, 0, size);
+                        //_LengthOfTrailer += size;
+                    }
+                }
+            }
+
+            _TotalEntrySize = _LengthOfHeader + _CompressedFileDataSize + _LengthOfTrailer;
+        }
+
+
+        private void CopyThroughWithNoChange(Stream outstream)
+        {
+            int n;
+            byte[] bytes = new byte[BufferSize];
+            var input = new CountingStream(this.ArchiveStream);
+
+            // seek to the beginning of the entry data in the input stream
+            input.Seek(this._RelativeOffsetOfLocalHeader, SeekOrigin.Begin);
+
+            if (this._TotalEntrySize == 0)
+            {
+                // We've never set the length of the entry.
+                // Set it here.
+                this._TotalEntrySize = this._LengthOfHeader + this._CompressedFileDataSize + _LengthOfTrailer;
+
+                // The CompressedSize includes all the leading metadata associated
+                // to encryption, if any, as well as the compressed data, or
+                // compressed-then-encrypted data, and the trailer in case of AES.
+
+                // The CompressedFileData size is the same, less the encryption
+                // framing data (12 bytes header for PKZip; 10/18 bytes header and
+                // 10 byte trailer for AES).
+
+                // The _LengthOfHeader includes all the zip entry header plus the
+                // crypto header, if any.  The _LengthOfTrailer includes the
+                // 10-byte MAC for AES, where appropriate, and the bit-3
+                // Descriptor, where applicable.
+            }
+
+
+            // workitem 5616
+            // remember the offset, within the output stream, of this particular entry header.
+            // This may have changed if any of the other entries changed (eg, if a different
+            // entry was removed or added.)
+            var counter = outstream as CountingStream;
+            _RelativeOffsetOfLocalHeader = (counter != null)
+                ? counter.ComputedPosition
+                : outstream.Position;  // BytesWritten
+
+            // copy through the header, filedata, trailer, everything...
+            long remaining = this._TotalEntrySize;
+            while (remaining > 0)
+            {
+                int len = (remaining > bytes.Length) ? bytes.Length : (int)remaining;
+
+                // read
+                n = input.Read(bytes, 0, len);
+                //_CheckRead(n);
+
+                // write
+                outstream.Write(bytes, 0, n);
+                remaining -= n;
+                OnWriteBlock(input.BytesRead, this._TotalEntrySize);
+                if (_ioOperationCanceled)
+                    break;
+            }
+        }
+
+
+
+
+        [System.Diagnostics.ConditionalAttribute("Trace")]
+        private void TraceWriteLine(string format, params object[] varParams)
+        {
+            lock (_outputLock)
+            {
+                int tid = System.Threading.Thread.CurrentThread.GetHashCode();
+#if ! (NETCF || SILVERLIGHT)
+                Console.ForegroundColor = (ConsoleColor)(tid % 8 + 8);
+#endif
+                Console.Write("{0:000} ZipEntry.Write ", tid);
+                Console.WriteLine(format, varParams);
+#if ! (NETCF || SILVERLIGHT)
+                Console.ResetColor();
+#endif
+            }
+        }
+
+        private object _outputLock = new Object();
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ZipEntry.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ZipEntry.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ZipEntry.cs	(revision 12707)
@@ -0,0 +1,2968 @@
+// ZipEntry.cs
+// ------------------------------------------------------------------
+//
+// Copyright (c) 2006-2010 Dino Chiesa.
+// All rights reserved.
+//
+// This code module is part of DotNetZip, a zipfile class library.
+//
+// ------------------------------------------------------------------
+//
+// This code is licensed under the Microsoft Public License.
+// See the file License.txt for the license details.
+// More info on: http://dotnetzip.codeplex.com
+//
+// ------------------------------------------------------------------
+//
+// last saved (in emacs):
+// Time-stamp: <2011-August-06 17:25:53>
+//
+// ------------------------------------------------------------------
+//
+// This module defines the ZipEntry class, which models the entries within a zip file.
+//
+// Created: Tue, 27 Mar 2007  15:30
+//
+// ------------------------------------------------------------------
+
+
+using System;
+using System.IO;
+using Interop = System.Runtime.InteropServices;
+
+namespace OfficeOpenXml.Packaging.Ionic.Zip
+{
+    /// <summary>
+    /// Represents a single entry in a ZipFile. Typically, applications get a ZipEntry
+    /// by enumerating the entries within a ZipFile, or by adding an entry to a ZipFile.
+    /// </summary>
+
+    [Interop.GuidAttribute("ebc25cf6-9120-4283-b972-0e5520d00004")]
+    [Interop.ComVisible(true)]
+#if !NETCF
+    [Interop.ClassInterface(Interop.ClassInterfaceType.AutoDispatch)]  // AutoDual
+#endif
+    internal partial class ZipEntry
+    {
+        /// <summary>
+        /// Default constructor.
+        /// </summary>
+        /// <remarks>
+        /// Applications should never need to call this directly.  It is exposed to
+        /// support COM Automation environments.
+        /// </remarks>
+        public ZipEntry()
+        {
+            _CompressionMethod = (Int16)CompressionMethod.Deflate;
+            _CompressionLevel = Ionic.Zlib.CompressionLevel.Default;
+            _Encryption = EncryptionAlgorithm.None;
+            _Source = ZipEntrySource.None;
+            AlternateEncoding = System.Text.Encoding.GetEncoding("IBM437");
+            AlternateEncodingUsage = ZipOption.Never;
+        }
+
+        /// <summary>
+        ///   The time and date at which the file indicated by the <c>ZipEntry</c> was
+        ///   last modified.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   The DotNetZip library sets the LastModified value for an entry, equal to
+        ///   the Last Modified time of the file in the filesystem.  If an entry is
+        ///   added from a stream, the library uses <c>System.DateTime.Now</c> for this
+        ///   value, for the given entry.
+        /// </para>
+        ///
+        /// <para>
+        ///   This property allows the application to retrieve and possibly set the
+        ///   LastModified value on an entry, to an arbitrary value.  <see
+        ///   cref="System.DateTime"/> values with a <see cref="System.DateTimeKind" />
+        ///   setting of <c>DateTimeKind.Unspecified</c> are taken to be expressed as
+        ///   <c>DateTimeKind.Local</c>.
+        /// </para>
+        ///
+        /// <para>
+        ///   Be aware that because of the way <see
+        ///   href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT">PKWare's
+        ///   Zip specification</see> describes how times are stored in the zip file,
+        ///   the full precision of the <c>System.DateTime</c> datatype is not stored
+        ///   for the last modified time when saving zip files.  For more information on
+        ///   how times are formatted, see the PKZip specification.
+        /// </para>
+        ///
+        /// <para>
+        ///   The actual last modified time of a file can be stored in multiple ways in
+        ///   the zip file, and they are not mutually exclusive:
+        /// </para>
+        ///
+        /// <list type="bullet">
+        ///   <item>
+        ///     In the so-called "DOS" format, which has a 2-second precision. Values
+        ///     are rounded to the nearest even second. For example, if the time on the
+        ///     file is 12:34:43, then it will be stored as 12:34:44. This first value
+        ///     is accessible via the <c>LastModified</c> property. This value is always
+        ///     present in the metadata for each zip entry.  In some cases the value is
+        ///     invalid, or zero.
+        ///   </item>
+        ///
+        ///   <item>
+        ///     In the so-called "Windows" or "NTFS" format, as an 8-byte integer
+        ///     quantity expressed as the number of 1/10 milliseconds (in other words
+        ///     the number of 100 nanosecond units) since January 1, 1601 (UTC).  This
+        ///     format is how Windows represents file times.  This time is accessible
+        ///     via the <c>ModifiedTime</c> property.
+        ///   </item>
+        ///
+        ///   <item>
+        ///     In the "Unix" format, a 4-byte quantity specifying the number of seconds since
+        ///     January 1, 1970 UTC.
+        ///   </item>
+        ///
+        ///   <item>
+        ///     In an older format, now deprecated but still used by some current
+        ///     tools. This format is also a 4-byte quantity specifying the number of
+        ///     seconds since January 1, 1970 UTC.
+        ///   </item>
+        ///
+        /// </list>
+        ///
+        /// <para>
+        ///   Zip tools and libraries will always at least handle (read or write) the
+        ///   DOS time, and may also handle the other time formats.  Keep in mind that
+        ///   while the names refer to particular operating systems, there is nothing in
+        ///   the time formats themselves that prevents their use on other operating
+        ///   systems.
+        /// </para>
+        ///
+        /// <para>
+        ///   When reading ZIP files, the DotNetZip library reads the Windows-formatted
+        ///   time, if it is stored in the entry, and sets both <c>LastModified</c> and
+        ///   <c>ModifiedTime</c> to that value. When writing ZIP files, the DotNetZip
+        ///   library by default will write both time quantities. It can also emit the
+        ///   Unix-formatted time if desired (See <see
+        ///   cref="EmitTimesInUnixFormatWhenSaving"/>.)
+        /// </para>
+        ///
+        /// <para>
+        ///   The last modified time of the file created upon a call to
+        ///   <c>ZipEntry.Extract()</c> may be adjusted during extraction to compensate
+        ///   for differences in how the .NET Base Class Library deals with daylight
+        ///   saving time (DST) versus how the Windows filesystem deals with daylight
+        ///   saving time.  Raymond Chen <see
+        ///   href="http://blogs.msdn.com/oldnewthing/archive/2003/10/24/55413.aspx">provides
+        ///   some good context</see>.
+        /// </para>
+        ///
+        /// <para>
+        ///   In a nutshell: Daylight savings time rules change regularly.  In 2007, for
+        ///   example, the inception week of DST changed.  In 1977, DST was in place all
+        ///   year round. In 1945, likewise.  And so on.  Win32 does not attempt to
+        ///   guess which time zone rules were in effect at the time in question.  It
+        ///   will render a time as "standard time" and allow the app to change to DST
+        ///   as necessary.  .NET makes a different choice.
+        /// </para>
+        ///
+        /// <para>
+        ///   Compare the output of FileInfo.LastWriteTime.ToString("f") with what you
+        ///   see in the Windows Explorer property sheet for a file that was last
+        ///   written to on the other side of the DST transition. For example, suppose
+        ///   the file was last modified on October 17, 2003, during DST but DST is not
+        ///   currently in effect. Explorer's file properties reports Thursday, October
+        ///   17, 2003, 8:45:38 AM, but .NETs FileInfo reports Thursday, October 17,
+        ///   2003, 9:45 AM.
+        /// </para>
+        ///
+        /// <para>
+        ///   Win32 says, "Thursday, October 17, 2002 8:45:38 AM PST". Note: Pacific
+        ///   STANDARD Time. Even though October 17 of that year occurred during Pacific
+        ///   Daylight Time, Win32 displays the time as standard time because that's
+        ///   what time it is NOW.
+        /// </para>
+        ///
+        /// <para>
+        ///   .NET BCL assumes that the current DST rules were in place at the time in
+        ///   question.  So, .NET says, "Well, if the rules in effect now were also in
+        ///   effect on October 17, 2003, then that would be daylight time" so it
+        ///   displays "Thursday, October 17, 2003, 9:45 AM PDT" - daylight time.
+        /// </para>
+        ///
+        /// <para>
+        ///   So .NET gives a value which is more intuitively correct, but is also
+        ///   potentially incorrect, and which is not invertible. Win32 gives a value
+        ///   which is intuitively incorrect, but is strictly correct.
+        /// </para>
+        ///
+        /// <para>
+        ///   Because of this funkiness, this library adds one hour to the LastModified
+        ///   time on the extracted file, if necessary.  That is to say, if the time in
+        ///   question had occurred in what the .NET Base Class Library assumed to be
+        ///   DST. This assumption may be wrong given the constantly changing DST rules,
+        ///   but it is the best we can do.
+        /// </para>
+        ///
+        /// </remarks>
+        ///
+        public DateTime LastModified
+        {
+            get { return _LastModified.ToLocalTime(); }
+            set
+            {
+                _LastModified = (value.Kind == DateTimeKind.Unspecified)
+                    ? DateTime.SpecifyKind(value, DateTimeKind.Local)
+                    : value.ToLocalTime();
+                _Mtime = Ionic.Zip.SharedUtilities.AdjustTime_Reverse(_LastModified).ToUniversalTime();
+                _metadataChanged = true;
+            }
+        }
+
+
+        private int BufferSize
+        {
+            get
+            {
+                return this._container.BufferSize;
+            }
+        }
+
+        /// <summary>
+        /// Last Modified time for the file represented by the entry.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///
+        /// <para>
+        ///   This value corresponds to the "last modified" time in the NTFS file times
+        ///   as described in <see
+        ///   href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT">the Zip
+        ///   specification</see>.  When getting this property, the value may be
+        ///   different from <see cref="LastModified" />.  When setting the property,
+        ///   the <see cref="LastModified"/> property also gets set, but with a lower
+        ///   precision.
+        /// </para>
+        ///
+        /// <para>
+        ///   Let me explain. It's going to take a while, so get
+        ///   comfortable. Originally, waaaaay back in 1989 when the ZIP specification
+        ///   was originally described by the esteemed Mr. Phil Katz, the dominant
+        ///   operating system of the time was MS-DOS. MSDOS stored file times with a
+        ///   2-second precision, because, c'mon, <em>who is ever going to need better
+        ///   resolution than THAT?</em> And so ZIP files, regardless of the platform on
+        ///   which the zip file was created, store file times in exactly <see
+        ///   href="http://www.vsft.com/hal/dostime.htm">the same format that DOS used
+        ///   in 1989</see>.
+        /// </para>
+        ///
+        /// <para>
+        ///   Since then, the ZIP spec has evolved, but the internal format for file
+        ///   timestamps remains the same.  Despite the fact that the way times are
+        ///   stored in a zip file is rooted in DOS heritage, any program on any
+        ///   operating system can format a time in this way, and most zip tools and
+        ///   libraries DO - they round file times to the nearest even second and store
+        ///   it just like DOS did 25+ years ago.
+        /// </para>
+        ///
+        /// <para>
+        ///   PKWare extended the ZIP specification to allow a zip file to store what
+        ///   are called "NTFS Times" and "Unix(tm) times" for a file.  These are the
+        ///   <em>last write</em>, <em>last access</em>, and <em>file creation</em>
+        ///   times of a particular file. These metadata are not actually specific
+        ///   to NTFS or Unix. They are tracked for each file by NTFS and by various
+        ///   Unix filesystems, but they are also tracked by other filesystems, too.
+        ///   The key point is that the times are <em>formatted in the zip file</em>
+        ///   in the same way that NTFS formats the time (ticks since win32 epoch),
+        ///   or in the same way that Unix formats the time (seconds since Unix
+        ///   epoch). As with the DOS time, any tool or library running on any
+        ///   operating system is capable of formatting a time in one of these ways
+        ///   and embedding it into the zip file.
+        /// </para>
+        ///
+        /// <para>
+        ///   These extended times are higher precision quantities than the DOS time.
+        ///   As described above, the (DOS) LastModified has a precision of 2 seconds.
+        ///   The Unix time is stored with a precision of 1 second. The NTFS time is
+        ///   stored with a precision of 0.0000001 seconds. The quantities are easily
+        ///   convertible, except for the loss of precision you may incur.
+        /// </para>
+        ///
+        /// <para>
+        ///   A zip archive can store the {C,A,M} times in NTFS format, in Unix format,
+        ///   or not at all.  Often a tool running on Unix or Mac will embed the times
+        ///   in Unix format (1 second precision), while WinZip running on Windows might
+        ///   embed the times in NTFS format (precision of of 0.0000001 seconds).  When
+        ///   reading a zip file with these "extended" times, in either format,
+        ///   DotNetZip represents the values with the
+        ///   <c>ModifiedTime</c>, <c>AccessedTime</c> and <c>CreationTime</c>
+        ///   properties on the <c>ZipEntry</c>.
+        /// </para>
+        ///
+        /// <para>
+        ///   While any zip application or library, regardless of the platform it
+        ///   runs on, could use any of the time formats allowed by the ZIP
+        ///   specification, not all zip tools or libraries do support all these
+        ///   formats.  Storing the higher-precision times for each entry is
+        ///   optional for zip files, and many tools and libraries don't use the
+        ///   higher precision quantities at all. The old DOS time, represented by
+        ///   <see cref="LastModified"/>, is guaranteed to be present, though it
+        ///   sometimes unset.
+        /// </para>
+        ///
+        /// <para>
+        ///   Ok, getting back to the question about how the <c>LastModified</c>
+        ///   property relates to this <c>ModifiedTime</c>
+        ///   property... <c>LastModified</c> is always set, while
+        ///   <c>ModifiedTime</c> is not. (The other times stored in the <em>NTFS
+        ///   times extension</em>, <c>CreationTime</c> and <c>AccessedTime</c> also
+        ///   may not be set on an entry that is read from an existing zip file.)
+        ///   When reading a zip file, then <c>LastModified</c> takes the DOS time
+        ///   that is stored with the file. If the DOS time has been stored as zero
+        ///   in the zipfile, then this library will use <c>DateTime.Now</c> for the
+        ///   <c>LastModified</c> value.  If the ZIP file was created by an evolved
+        ///   tool, then there will also be higher precision NTFS or Unix times in
+        ///   the zip file.  In that case, this library will read those times, and
+        ///   set <c>LastModified</c> and <c>ModifiedTime</c> to the same value, the
+        ///   one corresponding to the last write time of the file.  If there are no
+        ///   higher precision times stored for the entry, then <c>ModifiedTime</c>
+        ///   remains unset (likewise <c>AccessedTime</c> and <c>CreationTime</c>),
+        ///   and <c>LastModified</c> keeps its DOS time.
+        /// </para>
+        ///
+        /// <para>
+        ///   When creating zip files with this library, by default the extended time
+        ///   properties (<c>ModifiedTime</c>, <c>AccessedTime</c>, and
+        ///   <c>CreationTime</c>) are set on the ZipEntry instance, and these data are
+        ///   stored in the zip archive for each entry, in NTFS format. If you add an
+        ///   entry from an actual filesystem file, then the entry gets the actual file
+        ///   times for that file, to NTFS-level precision.  If you add an entry from a
+        ///   stream, or a string, then the times get the value <c>DateTime.Now</c>.  In
+        ///   this case <c>LastModified</c> and <c>ModifiedTime</c> will be identical,
+        ///   to 2 seconds of precision.  You can explicitly set the
+        ///   <c>CreationTime</c>, <c>AccessedTime</c>, and <c>ModifiedTime</c> of an
+        ///   entry using the property setters.  If you want to set all of those
+        ///   quantities, it's more efficient to use the <see
+        ///   cref="SetEntryTimes(DateTime, DateTime, DateTime)"/> method.  Those
+        ///   changes are not made permanent in the zip file until you call <see
+        ///   cref="ZipFile.Save()"/> or one of its cousins.
+        /// </para>
+        ///
+        /// <para>
+        ///   When creating a zip file, you can override the default behavior of
+        ///   this library for formatting times in the zip file, disabling the
+        ///   embedding of file times in NTFS format or enabling the storage of file
+        ///   times in Unix format, or both.  You may want to do this, for example,
+        ///   when creating a zip file on Windows, that will be consumed on a Mac,
+        ///   by an application that is not hip to the "NTFS times" format. To do
+        ///   this, use the <see cref="EmitTimesInWindowsFormatWhenSaving"/> and
+        ///   <see cref="EmitTimesInUnixFormatWhenSaving"/> properties.  A valid zip
+        ///   file may store the file times in both formats.  But, there are no
+        ///   guarantees that a program running on Mac or Linux will gracefully
+        ///   handle the NTFS-formatted times when Unix times are present, or that a
+        ///   non-DotNetZip-powered application running on Windows will be able to
+        ///   handle file times in Unix format. DotNetZip will always do something
+        ///   reasonable; other libraries or tools may not. When in doubt, test.
+        /// </para>
+        ///
+        /// <para>
+        ///   I'll bet you didn't think one person could type so much about time, eh?
+        ///   And reading it was so enjoyable, too!  Well, in appreciation, <see
+        ///   href="http://cheeso.members.winisp.net/DotNetZipDonate.aspx">maybe you
+        ///   should donate</see>?
+        /// </para>
+        /// </remarks>
+        ///
+        /// <seealso cref="AccessedTime"/>
+        /// <seealso cref="CreationTime"/>
+        /// <seealso cref="Ionic.Zip.ZipEntry.LastModified"/>
+        /// <seealso cref="SetEntryTimes"/>
+        public DateTime ModifiedTime
+        {
+            get { return _Mtime; }
+            set
+            {
+                SetEntryTimes(_Ctime, _Atime, value);
+            }
+        }
+
+        /// <summary>
+        /// Last Access time for the file represented by the entry.
+        /// </summary>
+        /// <remarks>
+        /// This value may or may not be meaningful.  If the <c>ZipEntry</c> was read from an existing
+        /// Zip archive, this information may not be available. For an explanation of why, see
+        /// <see cref="ModifiedTime"/>.
+        /// </remarks>
+        /// <seealso cref="ModifiedTime"/>
+        /// <seealso cref="CreationTime"/>
+        /// <seealso cref="SetEntryTimes"/>
+        public DateTime AccessedTime
+        {
+            get { return _Atime; }
+            set
+            {
+                SetEntryTimes(_Ctime, value, _Mtime);
+            }
+        }
+
+        /// <summary>
+        /// The file creation time for the file represented by the entry.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// This value may or may not be meaningful.  If the <c>ZipEntry</c> was read
+        /// from an existing zip archive, and the creation time was not set on the entry
+        /// when the zip file was created, then this property may be meaningless. For an
+        /// explanation of why, see <see cref="ModifiedTime"/>.
+        /// </remarks>
+        /// <seealso cref="ModifiedTime"/>
+        /// <seealso cref="AccessedTime"/>
+        /// <seealso cref="SetEntryTimes"/>
+        public DateTime CreationTime
+        {
+            get { return _Ctime; }
+            set
+            {
+                SetEntryTimes(value, _Atime, _Mtime);
+            }
+        }
+
+        /// <summary>
+        ///   Sets the NTFS Creation, Access, and Modified times for the given entry.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   When adding an entry from a file or directory, the Creation, Access, and
+        ///   Modified times for the given entry are automatically set from the
+        ///   filesystem values. When adding an entry from a stream or string, the
+        ///   values are implicitly set to DateTime.Now.  The application may wish to
+        ///   set these values to some arbitrary value, before saving the archive, and
+        ///   can do so using the various setters.  If you want to set all of the times,
+        ///   this method is more efficient.
+        /// </para>
+        ///
+        /// <para>
+        ///   The values you set here will be retrievable with the <see
+        ///   cref="ModifiedTime"/>, <see cref="CreationTime"/> and <see
+        ///   cref="AccessedTime"/> properties.
+        /// </para>
+        ///
+        /// <para>
+        ///   When this method is called, if both <see
+        ///   cref="EmitTimesInWindowsFormatWhenSaving"/> and <see
+        ///   cref="EmitTimesInUnixFormatWhenSaving"/> are false, then the
+        ///   <c>EmitTimesInWindowsFormatWhenSaving</c> flag is automatically set.
+        /// </para>
+        ///
+        /// <para>
+        ///   DateTime values provided here without a DateTimeKind are assumed to be Local Time.
+        /// </para>
+        ///
+        /// </remarks>
+        /// <param name="created">the creation time of the entry.</param>
+        /// <param name="accessed">the last access time of the entry.</param>
+        /// <param name="modified">the last modified time of the entry.</param>
+        ///
+        /// <seealso cref="EmitTimesInWindowsFormatWhenSaving" />
+        /// <seealso cref="EmitTimesInUnixFormatWhenSaving" />
+        /// <seealso cref="AccessedTime"/>
+        /// <seealso cref="CreationTime"/>
+        /// <seealso cref="ModifiedTime"/>
+        public void SetEntryTimes(DateTime created, DateTime accessed, DateTime modified)
+        {
+            _ntfsTimesAreSet = true;
+            if (created == _zeroHour && created.Kind == _zeroHour.Kind) created = _win32Epoch;
+            if (accessed == _zeroHour && accessed.Kind == _zeroHour.Kind) accessed = _win32Epoch;
+            if (modified == _zeroHour && modified.Kind == _zeroHour.Kind) modified = _win32Epoch;
+            _Ctime = created.ToUniversalTime();
+            _Atime = accessed.ToUniversalTime();
+            _Mtime = modified.ToUniversalTime();
+            _LastModified = _Mtime;
+            if (!_emitUnixTimes && !_emitNtfsTimes)
+                _emitNtfsTimes = true;
+            _metadataChanged = true;
+        }
+
+
+
+        /// <summary>
+        ///   Specifies whether the Creation, Access, and Modified times for the given
+        ///   entry will be emitted in "Windows format" when the zip archive is saved.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   An application creating a zip archive can use this flag to explicitly
+        ///   specify that the file times for the entry should or should not be stored
+        ///   in the zip archive in the format used by Windows. The default value of
+        ///   this property is <c>true</c>.
+        /// </para>
+        ///
+        /// <para>
+        ///   When adding an entry from a file or directory, the Creation (<see
+        ///   cref="CreationTime"/>), Access (<see cref="AccessedTime"/>), and Modified
+        ///   (<see cref="ModifiedTime"/>) times for the given entry are automatically
+        ///   set from the filesystem values. When adding an entry from a stream or
+        ///   string, all three values are implicitly set to DateTime.Now.  Applications
+        ///   can also explicitly set those times by calling <see
+        ///   cref="SetEntryTimes(DateTime, DateTime, DateTime)" />.
+        /// </para>
+        ///
+        /// <para>
+        ///   <see
+        ///   href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT">PKWARE's
+        ///   zip specification</see> describes multiple ways to format these times in a
+        ///   zip file. One is the format Windows applications normally use: 100ns ticks
+        ///   since Jan 1, 1601 UTC.  The other is a format Unix applications typically
+        ///   use: seconds since January 1, 1970 UTC.  Each format can be stored in an
+        ///   "extra field" in the zip entry when saving the zip archive. The former
+        ///   uses an extra field with a Header Id of 0x000A, while the latter uses a
+        ///   header ID of 0x5455.
+        /// </para>
+        ///
+        /// <para>
+        ///   Not all zip tools and libraries can interpret these fields.  Windows
+        ///   compressed folders is one that can read the Windows Format timestamps,
+        ///   while I believe the <see href="http://www.info-zip.org/">Infozip</see>
+        ///   tools can read the Unix format timestamps. Although the time values are
+        ///   easily convertible, subject to a loss of precision, some tools and
+        ///   libraries may be able to read only one or the other. DotNetZip can read or
+        ///   write times in either or both formats.
+        /// </para>
+        ///
+        /// <para>
+        ///   The times stored are taken from <see cref="ModifiedTime"/>, <see
+        ///   cref="AccessedTime"/>, and <see cref="CreationTime"/>.
+        /// </para>
+        ///
+        /// <para>
+        ///   This property is not mutually exclusive from the <see
+        ///   cref="ZipEntry.EmitTimesInUnixFormatWhenSaving"/> property.  It is
+        ///   possible that a zip entry can embed the timestamps in both forms, one
+        ///   form, or neither.  But, there are no guarantees that a program running on
+        ///   Mac or Linux will gracefully handle NTFS Formatted times, or that a
+        ///   non-DotNetZip-powered application running on Windows will be able to
+        ///   handle file times in Unix format. When in doubt, test.
+        /// </para>
+        ///
+        /// <para>
+        ///   Normally you will use the <see
+        ///   cref="ZipFile.EmitTimesInWindowsFormatWhenSaving">ZipFile.EmitTimesInWindowsFormatWhenSaving</see>
+        ///   property, to specify the behavior for all entries in a zip, rather than
+        ///   the property on each individual entry.
+        /// </para>
+        ///
+        /// </remarks>
+        ///
+        /// <seealso cref="SetEntryTimes(DateTime, DateTime, DateTime)"/>
+        /// <seealso cref="EmitTimesInUnixFormatWhenSaving"/>
+        /// <seealso cref="CreationTime"/>
+        /// <seealso cref="AccessedTime"/>
+        /// <seealso cref="ModifiedTime"/>
+        public bool EmitTimesInWindowsFormatWhenSaving
+        {
+            get
+            {
+                return _emitNtfsTimes;
+            }
+            set
+            {
+                _emitNtfsTimes = value;
+                _metadataChanged = true;
+            }
+        }
+
+        /// <summary>
+        ///   Specifies whether the Creation, Access, and Modified times for the given
+        ///   entry will be emitted in &quot;Unix(tm) format&quot; when the zip archive is saved.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   An application creating a zip archive can use this flag to explicitly
+        ///   specify that the file times for the entry should or should not be stored
+        ///   in the zip archive in the format used by Unix. By default this flag is
+        ///   <c>false</c>, meaning the Unix-format times are not stored in the zip
+        ///   archive.
+        /// </para>
+        ///
+        /// <para>
+        ///   When adding an entry from a file or directory, the Creation (<see
+        ///   cref="CreationTime"/>), Access (<see cref="AccessedTime"/>), and Modified
+        ///   (<see cref="ModifiedTime"/>) times for the given entry are automatically
+        ///   set from the filesystem values. When adding an entry from a stream or
+        ///   string, all three values are implicitly set to DateTime.Now.  Applications
+        ///   can also explicitly set those times by calling <see
+        ///   cref="SetEntryTimes(DateTime, DateTime, DateTime)"/>.
+        /// </para>
+        ///
+        /// <para>
+        ///   <see
+        ///   href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT">PKWARE's
+        ///   zip specification</see> describes multiple ways to format these times in a
+        ///   zip file. One is the format Windows applications normally use: 100ns ticks
+        ///   since Jan 1, 1601 UTC.  The other is a format Unix applications typically
+        ///   use: seconds since Jan 1, 1970 UTC.  Each format can be stored in an
+        ///   "extra field" in the zip entry when saving the zip archive. The former
+        ///   uses an extra field with a Header Id of 0x000A, while the latter uses a
+        ///   header ID of 0x5455.
+        /// </para>
+        ///
+        /// <para>
+        ///   Not all tools and libraries can interpret these fields.  Windows
+        ///   compressed folders is one that can read the Windows Format timestamps,
+        ///   while I believe the <see href="http://www.info-zip.org/">Infozip</see>
+        ///   tools can read the Unix format timestamps. Although the time values are
+        ///   easily convertible, subject to a loss of precision, some tools and
+        ///   libraries may be able to read only one or the other. DotNetZip can read or
+        ///   write times in either or both formats.
+        /// </para>
+        ///
+        /// <para>
+        ///   The times stored are taken from <see cref="ModifiedTime"/>, <see
+        ///   cref="AccessedTime"/>, and <see cref="CreationTime"/>.
+        /// </para>
+        ///
+        /// <para>
+        ///   This property is not mutually exclusive from the <see
+        ///   cref="ZipEntry.EmitTimesInWindowsFormatWhenSaving"/> property.  It is
+        ///   possible that a zip entry can embed the timestamps in both forms, one
+        ///   form, or neither.  But, there are no guarantees that a program running on
+        ///   Mac or Linux will gracefully handle NTFS Formatted times, or that a
+        ///   non-DotNetZip-powered application running on Windows will be able to
+        ///   handle file times in Unix format. When in doubt, test.
+        /// </para>
+        ///
+        /// <para>
+        ///   Normally you will use the <see
+        ///   cref="ZipFile.EmitTimesInUnixFormatWhenSaving">ZipFile.EmitTimesInUnixFormatWhenSaving</see>
+        ///   property, to specify the behavior for all entries, rather than the
+        ///   property on each individual entry.
+        /// </para>
+        /// </remarks>
+        ///
+        /// <seealso cref="SetEntryTimes(DateTime, DateTime, DateTime)"/>
+        /// <seealso cref="EmitTimesInWindowsFormatWhenSaving"/>
+        /// <seealso cref="ZipFile.EmitTimesInUnixFormatWhenSaving"/>
+        /// <seealso cref="CreationTime"/>
+        /// <seealso cref="AccessedTime"/>
+        /// <seealso cref="ModifiedTime"/>
+        public bool EmitTimesInUnixFormatWhenSaving
+        {
+            get
+            {
+                return _emitUnixTimes;
+            }
+            set
+            {
+                _emitUnixTimes = value;
+                _metadataChanged = true;
+            }
+        }
+
+
+        /// <summary>
+        /// The type of timestamp attached to the ZipEntry.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// This property is valid only for a ZipEntry that was read from a zip archive.
+        /// It indicates the type of timestamp attached to the entry.
+        /// </remarks>
+        ///
+        /// <seealso cref="EmitTimesInWindowsFormatWhenSaving"/>
+        /// <seealso cref="EmitTimesInUnixFormatWhenSaving"/>
+        internal ZipEntryTimestamp Timestamp
+        {
+            get
+            {
+                return _timestamp;
+            }
+        }
+
+        /// <summary>
+        ///   The file attributes for the entry.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///
+        /// <para>
+        ///   The <see cref="System.IO.FileAttributes">attributes</see> in NTFS include
+        ///   ReadOnly, Archive, Hidden, System, and Indexed.  When adding a
+        ///   <c>ZipEntry</c> to a ZipFile, these attributes are set implicitly when
+        ///   adding an entry from the filesystem.  When adding an entry from a stream
+        ///   or string, the Attributes are not set implicitly.  Regardless of the way
+        ///   an entry was added to a <c>ZipFile</c>, you can set the attributes
+        ///   explicitly if you like.
+        /// </para>
+        ///
+        /// <para>
+        ///   When reading a <c>ZipEntry</c> from a <c>ZipFile</c>, the attributes are
+        ///   set according to the data stored in the <c>ZipFile</c>. If you extract the
+        ///   entry from the archive to a filesystem file, DotNetZip will set the
+        ///   attributes on the resulting file accordingly.
+        /// </para>
+        ///
+        /// <para>
+        ///   The attributes can be set explicitly by the application.  For example the
+        ///   application may wish to set the <c>FileAttributes.ReadOnly</c> bit for all
+        ///   entries added to an archive, so that on unpack, this attribute will be set
+        ///   on the extracted file.  Any changes you make to this property are made
+        ///   permanent only when you call a <c>Save()</c> method on the <c>ZipFile</c>
+        ///   instance that contains the ZipEntry.
+        /// </para>
+        ///
+        /// <para>
+        ///   For example, an application may wish to zip up a directory and set the
+        ///   ReadOnly bit on every file in the archive, so that upon later extraction,
+        ///   the resulting files will be marked as ReadOnly.  Not every extraction tool
+        ///   respects these attributes, but if you unpack with DotNetZip, as for
+        ///   example in a self-extracting archive, then the attributes will be set as
+        ///   they are stored in the <c>ZipFile</c>.
+        /// </para>
+        ///
+        /// <para>
+        ///   These attributes may not be interesting or useful if the resulting archive
+        ///   is extracted on a non-Windows platform.  How these attributes get used
+        ///   upon extraction depends on the platform and tool used.
+        /// </para>
+        ///
+        /// <para>
+        ///   This property is only partially supported in the Silverlight version
+        ///   of the library: applications can read attributes on entries within
+        ///   ZipFiles. But extracting entries within Silverlight will not set the
+        ///   attributes on the extracted files.
+        /// </para>
+        ///
+        /// </remarks>
+        public System.IO.FileAttributes Attributes
+        {
+            // workitem 7071
+            get { return (System.IO.FileAttributes)_ExternalFileAttrs; }
+            set
+            {
+                _ExternalFileAttrs = (int)value;
+                // Since the application is explicitly setting the attributes, overwriting
+                // whatever was there, we will explicitly set the Version made by field.
+                // workitem 7926 - "version made by" OS should be zero for compat with WinZip
+                _VersionMadeBy = (0 << 8) + 45;  // v4.5 of the spec
+                _metadataChanged = true;
+            }
+        }
+
+
+        /// <summary>
+        ///   The name of the filesystem file, referred to by the ZipEntry.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///  <para>
+        ///    This property specifies the thing-to-be-zipped on disk, and is set only
+        ///    when the <c>ZipEntry</c> is being created from a filesystem file.  If the
+        ///    <c>ZipFile</c> is instantiated by reading an existing .zip archive, then
+        ///    the LocalFileName will be <c>null</c> (<c>Nothing</c> in VB).
+        ///  </para>
+        ///
+        ///  <para>
+        ///    When it is set, the value of this property may be different than <see
+        ///    cref="FileName"/>, which is the path used in the archive itself.  If you
+        ///    call <c>Zip.AddFile("foop.txt", AlternativeDirectory)</c>, then the path
+        ///    used for the <c>ZipEntry</c> within the zip archive will be different
+        ///    than this path.
+        ///  </para>
+        ///
+        ///  <para>
+        ///   If the entry is being added from a stream, then this is null (Nothing in VB).
+        ///  </para>
+        ///
+        /// </remarks>
+        /// <seealso cref="FileName"/>
+        internal string LocalFileName
+        {
+            get { return _LocalFileName; }
+        }
+
+        /// <summary>
+        ///   The name of the file contained in the ZipEntry.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///
+        /// <para>
+        ///   This is the name of the entry in the <c>ZipFile</c> itself.  When creating
+        ///   a zip archive, if the <c>ZipEntry</c> has been created from a filesystem
+        ///   file, via a call to <see cref="ZipFile.AddFile(String,String)"/> or <see
+        ///   cref="ZipFile.AddItem(String,String)"/>, or a related overload, the value
+        ///   of this property is derived from the name of that file. The
+        ///   <c>FileName</c> property does not include drive letters, and may include a
+        ///   different directory path, depending on the value of the
+        ///   <c>directoryPathInArchive</c> parameter used when adding the entry into
+        ///   the <c>ZipFile</c>.
+        /// </para>
+        ///
+        /// <para>
+        ///   In some cases there is no related filesystem file - for example when a
+        ///   <c>ZipEntry</c> is created using <see cref="ZipFile.AddEntry(string,
+        ///   string)"/> or one of the similar overloads.  In this case, the value of
+        ///   this property is derived from the fileName and the directory path passed
+        ///   to that method.
+        /// </para>
+        ///
+        /// <para>
+        ///   When reading a zip file, this property takes the value of the entry name
+        ///   as stored in the zip file. If you extract such an entry, the extracted
+        ///   file will take the name given by this property.
+        /// </para>
+        ///
+        /// <para>
+        ///   Applications can set this property when creating new zip archives or when
+        ///   reading existing archives. When setting this property, the actual value
+        ///   that is set will replace backslashes with forward slashes, in accordance
+        ///   with <see
+        ///   href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT">the Zip
+        ///   specification</see>, for compatibility with Unix(tm) and ... get
+        ///   this.... Amiga!
+        /// </para>
+        ///
+        /// <para>
+        ///   If an application reads a <c>ZipFile</c> via <see
+        ///   cref="ZipFile.Read(String)"/> or a related overload, and then explicitly
+        ///   sets the FileName on an entry contained within the <c>ZipFile</c>, and
+        ///   then calls <see cref="ZipFile.Save()"/>, the application will effectively
+        ///   rename the entry within the zip archive.
+        /// </para>
+        ///
+        /// <para>
+        ///   If an application sets the value of <c>FileName</c>, then calls
+        ///   <c>Extract()</c> on the entry, the entry is extracted to a file using the
+        ///   newly set value as the filename.  The <c>FileName</c> value is made
+        ///   permanent in the zip archive only <em>after</em> a call to one of the
+        ///   <c>ZipFile.Save()</c> methods on the <c>ZipFile</c> that contains the
+        ///   ZipEntry.
+        /// </para>
+        ///
+        /// <para>
+        ///   If an application attempts to set the <c>FileName</c> to a value that
+        ///   would result in a duplicate entry in the <c>ZipFile</c>, an exception is
+        ///   thrown.
+        /// </para>
+        ///
+        /// <para>
+        ///   When a <c>ZipEntry</c> is contained within a <c>ZipFile</c>, applications
+        ///   cannot rename the entry within the context of a <c>foreach</c> (<c>For
+        ///   Each</c> in VB) loop, because of the way the <c>ZipFile</c> stores
+        ///   entries.  If you need to enumerate through all the entries and rename one
+        ///   or more of them, use <see
+        ///   cref="ZipFile.EntriesSorted">ZipFile.EntriesSorted</see> as the
+        ///   collection.  See also, <see
+        ///   cref="ZipFile.GetEnumerator()">ZipFile.GetEnumerator()</see>.
+        /// </para>
+        ///
+        /// </remarks>
+        public string FileName
+        {
+            get { return _FileNameInArchive; }
+            set
+            {
+                if (_container.ZipFile == null)
+                    throw new ZipException("Cannot rename; this is not supported in ZipOutputStream/ZipInputStream.");
+
+                // rename the entry!
+                if (String.IsNullOrEmpty(value)) throw new ZipException("The FileName must be non empty and non-null.");
+
+                var filename = ZipEntry.NameInArchive(value, null);
+                // workitem 8180
+                if (_FileNameInArchive == filename) return; // nothing to do
+
+                // workitem 8047 - when renaming, must remove old and then add a new entry
+                this._container.ZipFile.RemoveEntry(this);
+                this._container.ZipFile.InternalAddEntry(filename, this);
+
+                _FileNameInArchive = filename;
+                _container.ZipFile.NotifyEntryChanged();
+                _metadataChanged = true;
+            }
+        }
+
+
+        /// <summary>
+        /// The stream that provides content for the ZipEntry.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///
+        /// <para>
+        ///   The application can use this property to set the input stream for an
+        ///   entry on a just-in-time basis. Imagine a scenario where the application
+        ///   creates a <c>ZipFile</c> comprised of content obtained from hundreds of
+        ///   files, via calls to <c>AddFile()</c>. The DotNetZip library opens streams
+        ///   on these files on a just-in-time basis, only when writing the entry out to
+        ///   an external store within the scope of a <c>ZipFile.Save()</c> call.  Only
+        ///   one input stream is opened at a time, as each entry is being written out.
+        /// </para>
+        ///
+        /// <para>
+        ///   Now imagine a different application that creates a <c>ZipFile</c>
+        ///   with content obtained from hundreds of streams, added through <see
+        ///   cref="ZipFile.AddEntry(string, System.IO.Stream)"/>.  Normally the
+        ///   application would supply an open stream to that call.  But when large
+        ///   numbers of streams are being added, this can mean many open streams at one
+        ///   time, unnecessarily.
+        /// </para>
+        ///
+        /// <para>
+        ///   To avoid this, call <see cref="ZipFile.AddEntry(String, OpenDelegate,
+        ///   CloseDelegate)"/> and specify delegates that open and close the stream at
+        ///   the time of Save.
+        /// </para>
+        ///
+        ///
+        /// <para>
+        ///   Setting the value of this property when the entry was not added from a
+        ///   stream (for example, when the <c>ZipEntry</c> was added with <see
+        ///   cref="ZipFile.AddFile(String)"/> or <see
+        ///   cref="ZipFile.AddDirectory(String)"/>, or when the entry was added by
+        ///   reading an existing zip archive) will throw an exception.
+        /// </para>
+        ///
+        /// </remarks>
+        ///
+        public Stream InputStream
+        {
+            get { return _sourceStream; }
+
+            set
+            {
+                if (this._Source != ZipEntrySource.Stream)
+                    throw new ZipException("You must not set the input stream for this entry.");
+
+                _sourceWasJitProvided = true;
+                _sourceStream = value;
+            }
+        }
+
+
+        /// <summary>
+        ///   A flag indicating whether the InputStream was provided Just-in-time.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///
+        /// <para>
+        ///   When creating a zip archive, an application can obtain content for one or
+        ///   more of the <c>ZipEntry</c> instances from streams, using the <see
+        ///   cref="ZipFile.AddEntry(string, System.IO.Stream)"/> method.  At the time
+        ///   of calling that method, the application can supply null as the value of
+        ///   the stream parameter.  By doing so, the application indicates to the
+        ///   library that it will provide a stream for the entry on a just-in-time
+        ///   basis, at the time one of the <c>ZipFile.Save()</c> methods is called and
+        ///   the data for the various entries are being compressed and written out.
+        /// </para>
+        ///
+        /// <para>
+        ///   In this case, the application can set the <see cref="InputStream"/>
+        ///   property, typically within the SaveProgress event (event type: <see
+        ///   cref="ZipProgressEventType.Saving_BeforeWriteEntry"/>) for that entry.
+        /// </para>
+        ///
+        /// <para>
+        ///   The application will later want to call Close() and Dispose() on that
+        ///   stream.  In the SaveProgress event, when the event type is <see
+        ///   cref="ZipProgressEventType.Saving_AfterWriteEntry"/>, the application can
+        ///   do so.  This flag indicates that the stream has been provided by the
+        ///   application on a just-in-time basis and that it is the application's
+        ///   responsibility to call Close/Dispose on that stream.
+        /// </para>
+        ///
+        /// </remarks>
+        /// <seealso cref="InputStream"/>
+        public bool InputStreamWasJitProvided
+        {
+            get { return _sourceWasJitProvided; }
+        }
+
+
+
+        /// <summary>
+        /// An enum indicating the source of the ZipEntry.
+        /// </summary>
+        internal ZipEntrySource Source
+        {
+            get { return _Source; }
+        }
+
+
+        /// <summary>
+        /// The version of the zip engine needed to read the ZipEntry.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   This is a readonly property, indicating the version of <a
+        ///   href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT">the Zip
+        ///   specification</a> that the extracting tool or library must support to
+        ///   extract the given entry.  Generally higher versions indicate newer
+        ///   features.  Older zip engines obviously won't know about new features, and
+        ///   won't be able to extract entries that depend on those newer features.
+        /// </para>
+        ///
+        /// <list type="table">
+        /// <listheader>
+        /// <term>value</term>
+        /// <description>Features</description>
+        /// </listheader>
+        ///
+        /// <item>
+        /// <term>20</term>
+        /// <description>a basic Zip Entry, potentially using PKZIP encryption.
+        /// </description>
+        /// </item>
+        ///
+        /// <item>
+        /// <term>45</term>
+        /// <description>The ZIP64 extension is used on the entry.
+        /// </description>
+        /// </item>
+        ///
+        /// <item>
+        /// <term>46</term>
+        /// <description> File is compressed using BZIP2 compression*</description>
+        /// </item>
+        ///
+        /// <item>
+        /// <term>50</term>
+        /// <description> File is encrypted using PkWare's DES, 3DES, (broken) RC2 or RC4</description>
+        /// </item>
+        ///
+        /// <item>
+        /// <term>51</term>
+        /// <description> File is encrypted using PKWare's AES encryption or corrected RC2 encryption.</description>
+        /// </item>
+        ///
+        /// <item>
+        /// <term>52</term>
+        /// <description> File is encrypted using corrected RC2-64 encryption**</description>
+        /// </item>
+        ///
+        /// <item>
+        /// <term>61</term>
+        /// <description> File is encrypted using non-OAEP key wrapping***</description>
+        /// </item>
+        ///
+        /// <item>
+        /// <term>63</term>
+        /// <description> File is compressed using LZMA, PPMd+, Blowfish, or Twofish</description>
+        /// </item>
+        ///
+        /// </list>
+        ///
+        /// <para>
+        ///   There are other values possible, not listed here. DotNetZip supports
+        ///   regular PKZip encryption, and ZIP64 extensions.  DotNetZip cannot extract
+        ///   entries that require a zip engine higher than 45.
+        /// </para>
+        ///
+        /// <para>
+        ///   This value is set upon reading an existing zip file, or after saving a zip
+        ///   archive.
+        /// </para>
+        /// </remarks>
+        public Int16 VersionNeeded
+        {
+            get { return _VersionNeeded; }
+        }
+
+        /// <summary>
+        /// The comment attached to the ZipEntry.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   Each entry in a zip file can optionally have a comment associated to
+        ///   it. The comment might be displayed by a zip tool during extraction, for
+        ///   example.
+        /// </para>
+        ///
+        /// <para>
+        ///   By default, the <c>Comment</c> is encoded in IBM437 code page. You can
+        ///   specify an alternative with <see cref="AlternateEncoding"/> and
+        ///  <see cref="AlternateEncodingUsage"/>.
+        /// </para>
+        /// </remarks>
+        /// <seealso cref="AlternateEncoding"/>
+        /// <seealso cref="AlternateEncodingUsage"/>
+        public string Comment
+        {
+            get { return _Comment; }
+            set
+            {
+                _Comment = value;
+                _metadataChanged = true;
+            }
+        }
+
+
+        /// <summary>
+        /// Indicates whether the entry requires ZIP64 extensions.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///
+        /// <para>
+        ///   This property is null (Nothing in VB) until a <c>Save()</c> method on the
+        ///   containing <see cref="ZipFile"/> instance has been called. The property is
+        ///   non-null (<c>HasValue</c> is true) only after a <c>Save()</c> method has
+        ///   been called.
+        /// </para>
+        ///
+        /// <para>
+        ///   After the containing <c>ZipFile</c> has been saved, the Value of this
+        ///   property is true if any of the following three conditions holds: the
+        ///   uncompressed size of the entry is larger than 0xFFFFFFFF; the compressed
+        ///   size of the entry is larger than 0xFFFFFFFF; the relative offset of the
+        ///   entry within the zip archive is larger than 0xFFFFFFFF.  These quantities
+        ///   are not known until a <c>Save()</c> is attempted on the zip archive and
+        ///   the compression is applied.
+        /// </para>
+        ///
+        /// <para>
+        ///   If none of the three conditions holds, then the <c>Value</c> is false.
+        /// </para>
+        ///
+        /// <para>
+        ///   A <c>Value</c> of false does not indicate that the entry, as saved in the
+        ///   zip archive, does not use ZIP64.  It merely indicates that ZIP64 is
+        ///   <em>not required</em>.  An entry may use ZIP64 even when not required if
+        ///   the <see cref="ZipFile.UseZip64WhenSaving"/> property on the containing
+        ///   <c>ZipFile</c> instance is set to <see cref="Zip64Option.Always"/>, or if
+        ///   the <see cref="ZipFile.UseZip64WhenSaving"/> property on the containing
+        ///   <c>ZipFile</c> instance is set to <see cref="Zip64Option.AsNecessary"/>
+        ///   and the output stream was not seekable.
+        /// </para>
+        ///
+        /// </remarks>
+        /// <seealso cref="OutputUsedZip64"/>
+        public Nullable<bool> RequiresZip64
+        {
+            get
+            {
+                return _entryRequiresZip64;
+            }
+        }
+
+        /// <summary>
+        ///   Indicates whether the entry actually used ZIP64 extensions, as it was most
+        ///   recently written to the output file or stream.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///
+        /// <para>
+        ///   This Nullable property is null (Nothing in VB) until a <c>Save()</c>
+        ///   method on the containing <see cref="ZipFile"/> instance has been
+        ///   called. <c>HasValue</c> is true only after a <c>Save()</c> method has been
+        ///   called.
+        /// </para>
+        ///
+        /// <para>
+        ///   The value of this property for a particular <c>ZipEntry</c> may change
+        ///   over successive calls to <c>Save()</c> methods on the containing ZipFile,
+        ///   even if the file that corresponds to the <c>ZipEntry</c> does not. This
+        ///   may happen if other entries contained in the <c>ZipFile</c> expand,
+        ///   causing the offset for this particular entry to exceed 0xFFFFFFFF.
+        /// </para>
+        /// </remarks>
+        /// <seealso cref="RequiresZip64"/>
+        public Nullable<bool> OutputUsedZip64
+        {
+            get { return _OutputUsesZip64; }
+        }
+
+
+        /// <summary>
+        ///   The bitfield for the entry as defined in the zip spec. You probably
+        ///   never need to look at this.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   You probably do not need to concern yourself with the contents of this
+        ///   property, but in case you do:
+        /// </para>
+        ///
+        /// <list type="table">
+        /// <listheader>
+        /// <term>bit</term>
+        /// <description>meaning</description>
+        /// </listheader>
+        ///
+        /// <item>
+        /// <term>0</term>
+        /// <description>set if encryption is used.</description>
+        /// </item>
+        ///
+        /// <item>
+        /// <term>1-2</term>
+        /// <description>
+        /// set to determine whether normal, max, fast deflation.  DotNetZip library
+        /// always leaves these bits unset when writing (indicating "normal"
+        /// deflation"), but can read an entry with any value here.
+        /// </description>
+        /// </item>
+        ///
+        /// <item>
+        /// <term>3</term>
+        /// <description>
+        /// Indicates that the Crc32, Compressed and Uncompressed sizes are zero in the
+        /// local header.  This bit gets set on an entry during writing a zip file, when
+        /// it is saved to a non-seekable output stream.
+        /// </description>
+        /// </item>
+        ///
+        ///
+        /// <item>
+        /// <term>4</term>
+        /// <description>reserved for "enhanced deflating". This library doesn't do enhanced deflating.</description>
+        /// </item>
+        ///
+        /// <item>
+        /// <term>5</term>
+        /// <description>set to indicate the zip is compressed patched data.  This library doesn't do that.</description>
+        /// </item>
+        ///
+        /// <item>
+        /// <term>6</term>
+        /// <description>
+        /// set if PKWare's strong encryption is used (must also set bit 1 if bit 6 is
+        /// set). This bit is not set if WinZip's AES encryption is set.</description>
+        /// </item>
+        ///
+        /// <item>
+        /// <term>7</term>
+        /// <description>not used</description>
+        /// </item>
+        ///
+        /// <item>
+        /// <term>8</term>
+        /// <description>not used</description>
+        /// </item>
+        ///
+        /// <item>
+        /// <term>9</term>
+        /// <description>not used</description>
+        /// </item>
+        ///
+        /// <item>
+        /// <term>10</term>
+        /// <description>not used</description>
+        /// </item>
+        ///
+        /// <item>
+        /// <term>11</term>
+        /// <description>
+        /// Language encoding flag (EFS).  If this bit is set, the filename and comment
+        /// fields for this file must be encoded using UTF-8. This library currently
+        /// does not support UTF-8.
+        /// </description>
+        /// </item>
+        ///
+        /// <item>
+        /// <term>12</term>
+        /// <description>Reserved by PKWARE for enhanced compression.</description>
+        /// </item>
+        ///
+        /// <item>
+        /// <term>13</term>
+        /// <description>
+        ///   Used when encrypting the Central Directory to indicate selected data
+        ///   values in the Local Header are masked to hide their actual values.  See
+        ///   the section in <a
+        ///   href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT">the Zip
+        ///   specification</a> describing the Strong Encryption Specification for
+        ///   details.
+        /// </description>
+        /// </item>
+        ///
+        /// <item>
+        /// <term>14</term>
+        /// <description>Reserved by PKWARE.</description>
+        /// </item>
+        ///
+        /// <item>
+        /// <term>15</term>
+        /// <description>Reserved by PKWARE.</description>
+        /// </item>
+        ///
+        /// </list>
+        ///
+        /// </remarks>
+        public Int16 BitField
+        {
+            get { return _BitField; }
+        }
+
+        /// <summary>
+        ///   The compression method employed for this ZipEntry.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///
+        /// <para>
+        ///   <see href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT">The
+        ///   Zip specification</see> allows a variety of compression methods.  This
+        ///   library supports just two: 0x08 = Deflate.  0x00 = Store (no compression),
+        ///   for reading or writing.
+        /// </para>
+        ///
+        /// <para>
+        ///   When reading an entry from an existing zipfile, the value you retrieve
+        ///   here indicates the compression method used on the entry by the original
+        ///   creator of the zip.  When writing a zipfile, you can specify either 0x08
+        ///   (Deflate) or 0x00 (None).  If you try setting something else, you will get
+        ///   an exception.
+        /// </para>
+        ///
+        /// <para>
+        ///   You may wish to set <c>CompressionMethod</c> to <c>CompressionMethod.None</c> (0)
+        ///   when zipping already-compressed data like a jpg, png, or mp3 file.
+        ///   This can save time and cpu cycles.
+        /// </para>
+        ///
+        /// <para>
+        ///   When setting this property on a <c>ZipEntry</c> that is read from an
+        ///   existing zip file, calling <c>ZipFile.Save()</c> will cause the new
+        ///   CompressionMethod to be used on the entry in the newly saved zip file.
+        /// </para>
+        ///
+        /// <para>
+        ///   Setting this property may have the side effect of modifying the
+        ///   <c>CompressionLevel</c> property. If you set the <c>CompressionMethod</c> to a
+        ///   value other than <c>None</c>, and <c>CompressionLevel</c> is previously
+        ///   set to <c>None</c>, then <c>CompressionLevel</c> will be set to
+        ///   <c>Default</c>.
+        /// </para>
+        /// </remarks>
+        ///
+        /// <seealso cref="CompressionMethod"/>
+        ///
+        /// <example>
+        ///   In this example, the first entry added to the zip archive uses the default
+        ///   behavior - compression is used where it makes sense.  The second entry,
+        ///   the MP3 file, is added to the archive without being compressed.
+        /// <code>
+        /// using (ZipFile zip = new ZipFile(ZipFileToCreate))
+        /// {
+        ///   ZipEntry e1= zip.AddFile(@"notes\Readme.txt");
+        ///   ZipEntry e2= zip.AddFile(@"music\StopThisTrain.mp3");
+        ///   e2.CompressionMethod = CompressionMethod.None;
+        ///   zip.Save();
+        /// }
+        /// </code>
+        ///
+        /// <code lang="VB">
+        /// Using zip As New ZipFile(ZipFileToCreate)
+        ///   zip.AddFile("notes\Readme.txt")
+        ///   Dim e2 as ZipEntry = zip.AddFile("music\StopThisTrain.mp3")
+        ///   e2.CompressionMethod = CompressionMethod.None
+        ///   zip.Save
+        /// End Using
+        /// </code>
+        /// </example>
+        internal CompressionMethod CompressionMethod
+        {
+            get { return (CompressionMethod)_CompressionMethod; }
+            set
+            {
+                if (value == (CompressionMethod)_CompressionMethod) return; // nothing to do.
+
+                if (value != CompressionMethod.None && value != CompressionMethod.Deflate
+#if BZIP
+                    && value != CompressionMethod.BZip2
+#endif
+                    )
+                    throw new InvalidOperationException("Unsupported compression method.");
+
+                // If the source is a zip archive and there was encryption on the
+                // entry, changing the compression method is not supported.
+                //                 if (this._Source == ZipEntrySource.ZipFile && _sourceIsEncrypted)
+                //                     throw new InvalidOperationException("Cannot change compression method on encrypted entries read from archives.");
+
+                _CompressionMethod = (Int16)value;
+
+                if (_CompressionMethod == (Int16)Ionic.Zip.CompressionMethod.None)
+                    _CompressionLevel = Ionic.Zlib.CompressionLevel.None;
+                else if (CompressionLevel == Ionic.Zlib.CompressionLevel.None)
+                    _CompressionLevel = Ionic.Zlib.CompressionLevel.Default;
+
+                if (_container.ZipFile != null) _container.ZipFile.NotifyEntryChanged();
+                _restreamRequiredOnSave = true;
+            }
+        }
+
+
+        /// <summary>
+        ///   Sets the compression level to be used for the entry when saving the zip
+        ///   archive. This applies only for CompressionMethod = DEFLATE.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///  <para>
+        ///    When using the DEFLATE compression method, Varying the compression
+        ///    level used on entries can affect the size-vs-speed tradeoff when
+        ///    compression and decompressing data streams or files.
+        ///  </para>
+        ///
+        ///  <para>
+        ///    If you do not set this property, the default compression level is used,
+        ///    which normally gives a good balance of compression efficiency and
+        ///    compression speed.  In some tests, using <c>BestCompression</c> can
+        ///    double the time it takes to compress, while delivering just a small
+        ///    increase in compression efficiency.  This behavior will vary with the
+        ///    type of data you compress.  If you are in doubt, just leave this setting
+        ///    alone, and accept the default.
+        ///  </para>
+        ///
+        ///  <para>
+        ///    When setting this property on a <c>ZipEntry</c> that is read from an
+        ///    existing zip file, calling <c>ZipFile.Save()</c> will cause the new
+        ///    <c>CompressionLevel</c> to be used on the entry in the newly saved zip file.
+        ///  </para>
+        ///
+        ///  <para>
+        ///    Setting this property may have the side effect of modifying the
+        ///    <c>CompressionMethod</c> property. If you set the <c>CompressionLevel</c>
+        ///    to a value other than <c>None</c>, <c>CompressionMethod</c> will be set
+        ///    to <c>Deflate</c>, if it was previously <c>None</c>.
+        ///  </para>
+        ///
+        ///  <para>
+        ///    Setting this property has no effect if the <c>CompressionMethod</c> is something
+        ///    other than <c>Deflate</c> or <c>None</c>.
+        ///  </para>
+        /// </remarks>
+        ///
+        /// <seealso cref="CompressionMethod"/>
+        public OfficeOpenXml.Packaging.Ionic.Zlib.CompressionLevel CompressionLevel
+        {
+            get
+            {
+                return _CompressionLevel;
+            }
+            set
+            {
+                if (_CompressionMethod != (short)CompressionMethod.Deflate &&
+                    _CompressionMethod != (short)CompressionMethod.None)
+                    return ; // no effect
+
+                if (value == OfficeOpenXml.Packaging.Ionic.Zlib.CompressionLevel.Default &&
+                    _CompressionMethod == (short)CompressionMethod.Deflate) return; // nothing to do
+                _CompressionLevel = value;
+
+                if (value == OfficeOpenXml.Packaging.Ionic.Zlib.CompressionLevel.None &&
+                    _CompressionMethod == (short)CompressionMethod.None)
+                    return; // nothing more to do
+
+                if (_CompressionLevel == OfficeOpenXml.Packaging.Ionic.Zlib.CompressionLevel.None)
+                    _CompressionMethod = (short)OfficeOpenXml.Packaging.Ionic.Zip.CompressionMethod.None;
+                else
+                    _CompressionMethod = (short)OfficeOpenXml.Packaging.Ionic.Zip.CompressionMethod.Deflate;
+
+                if (_container.ZipFile != null) _container.ZipFile.NotifyEntryChanged();
+                _restreamRequiredOnSave = true;
+            }
+        }
+
+
+
+        /// <summary>
+        ///   The compressed size of the file, in bytes, within the zip archive.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///   When reading a <c>ZipFile</c>, this value is read in from the existing
+        ///   zip file. When creating or updating a <c>ZipFile</c>, the compressed
+        ///   size is computed during compression.  Therefore the value on a
+        ///   <c>ZipEntry</c> is valid after a call to <c>Save()</c> (or one of its
+        ///   overloads) in that case.
+        /// </remarks>
+        ///
+        /// <seealso cref="ZipEntry.UncompressedSize"/>
+        public Int64 CompressedSize
+        {
+            get { return _CompressedSize; }
+        }
+
+        /// <summary>
+        ///   The size of the file, in bytes, before compression, or after extraction.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///   When reading a <c>ZipFile</c>, this value is read in from the existing
+        ///   zip file. When creating or updating a <c>ZipFile</c>, the uncompressed
+        ///   size is computed during compression.  Therefore the value on a
+        ///   <c>ZipEntry</c> is valid after a call to <c>Save()</c> (or one of its
+        ///   overloads) in that case.
+        /// </remarks>
+        ///
+        /// <seealso cref="Ionic.Zip.ZipEntry.CompressedSize"/>
+        public Int64 UncompressedSize
+        {
+            get { return _UncompressedSize; }
+        }
+
+        /// <summary>
+        /// The ratio of compressed size to uncompressed size of the ZipEntry.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   This is a ratio of the compressed size to the uncompressed size of the
+        ///   entry, expressed as a double in the range of 0 to 100+. A value of 100
+        ///   indicates no compression at all.  It could be higher than 100 when the
+        ///   compression algorithm actually inflates the data, as may occur for small
+        ///   files, or uncompressible data that is encrypted.
+        /// </para>
+        ///
+        /// <para>
+        ///   You could format it for presentation to a user via a format string of
+        ///   "{3,5:F0}%" to see it as a percentage.
+        /// </para>
+        ///
+        /// <para>
+        ///   If the size of the original uncompressed file is 0, implying a
+        ///   denominator of 0, the return value will be zero.
+        /// </para>
+        ///
+        /// <para>
+        ///   This property is valid after reading in an existing zip file, or after
+        ///   saving the <c>ZipFile</c> that contains the ZipEntry. You cannot know the
+        ///   effect of a compression transform until you try it.
+        /// </para>
+        ///
+        /// </remarks>
+        public Double CompressionRatio
+        {
+            get
+            {
+                if (UncompressedSize == 0) return 0;
+                return 100 * (1.0 - (1.0 * CompressedSize) / (1.0 * UncompressedSize));
+            }
+        }
+
+        /// <summary>
+        /// The 32-bit CRC (Cyclic Redundancy Check) on the contents of the ZipEntry.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///
+        /// <para> You probably don't need to concern yourself with this. It is used
+        /// internally by DotNetZip to verify files or streams upon extraction.  </para>
+        ///
+        /// <para> The value is a <see href="http://en.wikipedia.org/wiki/CRC32">32-bit
+        /// CRC</see> using 0xEDB88320 for the polynomial. This is the same CRC-32 used in
+        /// PNG, MPEG-2, and other protocols and formats.  It is a read-only property; when
+        /// creating a Zip archive, the CRC for each entry is set only after a call to
+        /// <c>Save()</c> on the containing ZipFile. When reading an existing zip file, the value
+        /// of this property reflects the stored CRC for the entry.  </para>
+        ///
+        /// </remarks>
+        public Int32 Crc
+        {
+            get { return _Crc32; }
+        }
+
+        /// <summary>
+        /// True if the entry is a directory (not a file).
+        /// This is a readonly property on the entry.
+        /// </summary>
+        public bool IsDirectory
+        {
+            get { return _IsDirectory; }
+        }
+
+        /// <summary>
+        /// A derived property that is <c>true</c> if the entry uses encryption.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   This is a readonly property on the entry.  When reading a zip file,
+        ///   the value for the <c>ZipEntry</c> is determined by the data read
+        ///   from the zip file.  After saving a ZipFile, the value of this
+        ///   property for each <c>ZipEntry</c> indicates whether encryption was
+        ///   actually used (which will have been true if the <see
+        ///   cref="Password"/> was set and the <see cref="Encryption"/> property
+        ///   was something other than <see cref="EncryptionAlgorithm.None"/>.
+        /// </para>
+        /// </remarks>
+        public bool UsesEncryption
+        {
+            get { return (_Encryption_FromZipFile != EncryptionAlgorithm.None); }
+        }
+
+
+        /// <summary>
+        ///   Set this to specify which encryption algorithm to use for the entry when
+        ///   saving it to a zip archive.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///
+        /// <para>
+        ///   Set this property in order to encrypt the entry when the <c>ZipFile</c> is
+        ///   saved. When setting this property, you must also set a <see
+        ///   cref="Password"/> on the entry.  If you set a value other than <see
+        ///   cref="EncryptionAlgorithm.None"/> on this property and do not set a
+        ///   <c>Password</c> then the entry will not be encrypted. The <c>ZipEntry</c>
+        ///   data is encrypted as the <c>ZipFile</c> is saved, when you call <see
+        ///   cref="ZipFile.Save()"/> or one of its cousins on the containing
+        ///   <c>ZipFile</c> instance. You do not need to specify the <c>Encryption</c>
+        ///   when extracting entries from an archive.
+        /// </para>
+        ///
+        /// <para>
+        ///   The Zip specification from PKWare defines a set of encryption algorithms,
+        ///   and the data formats for the zip archive that support them, and PKWare
+        ///   supports those algorithms in the tools it produces. Other vendors of tools
+        ///   and libraries, such as WinZip or Xceed, typically support <em>a
+        ///   subset</em> of the algorithms specified by PKWare. These tools can
+        ///   sometimes support additional different encryption algorithms and data
+        ///   formats, not specified by PKWare. The AES Encryption specified and
+        ///   supported by WinZip is the most popular example. This library supports a
+        ///   subset of the complete set of algorithms specified by PKWare and other
+        ///   vendors.
+        /// </para>
+        ///
+        /// <para>
+        ///   There is no common, ubiquitous multi-vendor standard for strong encryption
+        ///   within zip files. There is broad support for so-called "traditional" Zip
+        ///   encryption, sometimes called Zip 2.0 encryption, as <see
+        ///   href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT">specified
+        ///   by PKWare</see>, but this encryption is considered weak and
+        ///   breakable. This library currently supports the Zip 2.0 "weak" encryption,
+        ///   and also a stronger WinZip-compatible AES encryption, using either 128-bit
+        ///   or 256-bit key strength. If you want DotNetZip to support an algorithm
+        ///   that is not currently supported, call the author of this library and maybe
+        ///   we can talk business.
+        /// </para>
+        ///
+        /// <para>
+        ///   The <see cref="ZipFile"/> class also has a <see
+        ///   cref="ZipFile.Encryption"/> property.  In most cases you will use
+        ///   <em>that</em> property when setting encryption. This property takes
+        ///   precedence over any <c>Encryption</c> set on the <c>ZipFile</c> itself.
+        ///   Typically, you would use the per-entry Encryption when most entries in the
+        ///   zip archive use one encryption algorithm, and a few entries use a
+        ///   different one.  If all entries in the zip file use the same Encryption,
+        ///   then it is simpler to just set this property on the ZipFile itself, when
+        ///   creating a zip archive.
+        /// </para>
+        ///
+        /// <para>
+        ///   Some comments on updating archives: If you read a <c>ZipFile</c>, you can
+        ///   modify the Encryption on an encrypted entry: you can remove encryption
+        ///   from an entry that was encrypted; you can encrypt an entry that was not
+        ///   encrypted previously; or, you can change the encryption algorithm.  The
+        ///   changes in encryption are not made permanent until you call Save() on the
+        ///   <c>ZipFile</c>.  To effect changes in encryption, the entry content is
+        ///   streamed through several transformations, depending on the modification
+        ///   the application has requested. For example if the entry is not encrypted
+        ///   and the application sets <c>Encryption</c> to <c>PkzipWeak</c>, then at
+        ///   the time of <c>Save()</c>, the original entry is read and decompressed,
+        ///   then re-compressed and encrypted.  Conversely, if the original entry is
+        ///   encrypted with <c>PkzipWeak</c> encryption, and the application sets the
+        ///   <c>Encryption</c> property to <c>WinZipAes128</c>, then at the time of
+        ///   <c>Save()</c>, the original entry is decrypted via PKZIP encryption and
+        ///   decompressed, then re-compressed and re-encrypted with AES.  This all
+        ///   happens automatically within the library, but it can be time-consuming for
+        ///   large entries.
+        /// </para>
+        ///
+        /// <para>
+        ///   Additionally, when updating archives, it is not possible to change the
+        ///   password when changing the encryption algorithm.  To change both the
+        ///   algorithm and the password, you need to Save() the zipfile twice.  First
+        ///   set the <c>Encryption</c> to None, then call <c>Save()</c>.  Then set the
+        ///   <c>Encryption</c> to the new value (not "None"), then call <c>Save()</c>
+        ///   once again.
+        /// </para>
+        ///
+        /// <para>
+        ///   The WinZip AES encryption algorithms are not supported on the .NET Compact
+        ///   Framework.
+        /// </para>
+        /// </remarks>
+        ///
+        /// <example>
+        /// <para>
+        ///   This example creates a zip archive that uses encryption, and then extracts
+        ///   entries from the archive.  When creating the zip archive, the ReadMe.txt
+        ///   file is zipped without using a password or encryption.  The other file
+        ///   uses encryption.
+        /// </para>
+        /// <code>
+        /// // Create a zip archive with AES Encryption.
+        /// using (ZipFile zip = new ZipFile())
+        /// {
+        ///     zip.AddFile("ReadMe.txt")
+        ///     ZipEntry e1= zip.AddFile("2008-Regional-Sales-Report.pdf");
+        ///     e1.Encryption= EncryptionAlgorithm.WinZipAes256;
+        ///     e1.Password= "Top.Secret.No.Peeking!";
+        ///     zip.Save("EncryptedArchive.zip");
+        /// }
+        ///
+        /// // Extract a zip archive that uses AES Encryption.
+        /// // You do not need to specify the algorithm during extraction.
+        /// using (ZipFile zip = ZipFile.Read("EncryptedArchive.zip"))
+        /// {
+        ///     // Specify the password that is used during extraction, for
+        ///     // all entries that require a password:
+        ///     zip.Password= "Top.Secret.No.Peeking!";
+        ///     zip.ExtractAll("extractDirectory");
+        /// }
+        /// </code>
+        ///
+        /// <code lang="VB">
+        /// ' Create a zip that uses Encryption.
+        /// Using zip As New ZipFile()
+        ///     zip.AddFile("ReadMe.txt")
+        ///     Dim e1 as ZipEntry
+        ///     e1= zip.AddFile("2008-Regional-Sales-Report.pdf")
+        ///     e1.Encryption= EncryptionAlgorithm.WinZipAes256
+        ///     e1.Password= "Top.Secret.No.Peeking!"
+        ///     zip.Save("EncryptedArchive.zip")
+        /// End Using
+        ///
+        /// ' Extract a zip archive that uses AES Encryption.
+        /// ' You do not need to specify the algorithm during extraction.
+        /// Using (zip as ZipFile = ZipFile.Read("EncryptedArchive.zip"))
+        ///     ' Specify the password that is used during extraction, for
+        ///     ' all entries that require a password:
+        ///     zip.Password= "Top.Secret.No.Peeking!"
+        ///     zip.ExtractAll("extractDirectory")
+        /// End Using
+        /// </code>
+        ///
+        /// </example>
+        ///
+        /// <exception cref="System.InvalidOperationException">
+        /// Thrown in the setter if EncryptionAlgorithm.Unsupported is specified.
+        /// </exception>
+        ///
+        /// <seealso cref="Ionic.Zip.ZipEntry.Password">ZipEntry.Password</seealso>
+        /// <seealso cref="Ionic.Zip.ZipFile.Encryption">ZipFile.Encryption</seealso>
+        internal EncryptionAlgorithm Encryption
+        {
+            get
+            {
+                return _Encryption;
+            }
+            set
+            {
+                if (value == _Encryption) return; // no change
+
+                if (value == EncryptionAlgorithm.Unsupported)
+                    throw new InvalidOperationException("You may not set Encryption to that value.");
+
+                // If the source is a zip archive and there was encryption
+                // on the entry, this will not work. <XXX>
+                //if (this._Source == ZipEntrySource.ZipFile && _sourceIsEncrypted)
+                //    throw new InvalidOperationException("You cannot change the encryption method on encrypted entries read from archives.");
+
+                _Encryption = value;
+                _restreamRequiredOnSave = true;
+                if (_container.ZipFile!=null)
+                    _container.ZipFile.NotifyEntryChanged();
+            }
+        }
+
+
+        /// <summary>
+        /// The Password to be used when encrypting a <c>ZipEntry</c> upon
+        /// <c>ZipFile.Save()</c>, or when decrypting an entry upon Extract().
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   This is a write-only property on the entry. Set this to request that the
+        ///   entry be encrypted when writing the zip archive, or set it to specify the
+        ///   password to be used when extracting an existing entry that is encrypted.
+        /// </para>
+        ///
+        /// <para>
+        ///   The password set here is implicitly used to encrypt the entry during the
+        ///   <see cref="ZipFile.Save()"/> operation, or to decrypt during the <see
+        ///   cref="Extract()"/> or <see cref="OpenReader()"/> operation.  If you set
+        ///   the Password on a <c>ZipEntry</c> after calling <c>Save()</c>, there is no
+        ///   effect.
+        /// </para>
+        ///
+        /// <para>
+        ///   Consider setting the <see cref="Encryption"/> property when using a
+        ///   password. Answering concerns that the standard password protection
+        ///   supported by all zip tools is weak, WinZip has extended the ZIP
+        ///   specification with a way to use AES Encryption to protect entries in the
+        ///   Zip file. Unlike the "PKZIP 2.0" encryption specified in the PKZIP
+        ///   specification, <see href=
+        ///   "http://en.wikipedia.org/wiki/Advanced_Encryption_Standard">AES
+        ///   Encryption</see> uses a standard, strong, tested, encryption
+        ///   algorithm. DotNetZip can create zip archives that use WinZip-compatible
+        ///   AES encryption, if you set the <see cref="Encryption"/> property. But,
+        ///   archives created that use AES encryption may not be readable by all other
+        ///   tools and libraries. For example, Windows Explorer cannot read a
+        ///   "compressed folder" (a zip file) that uses AES encryption, though it can
+        ///   read a zip file that uses "PKZIP encryption."
+        /// </para>
+        ///
+        /// <para>
+        ///   The <see cref="ZipFile"/> class also has a <see cref="ZipFile.Password"/>
+        ///   property.  This property takes precedence over any password set on the
+        ///   ZipFile itself.  Typically, you would use the per-entry Password when most
+        ///   entries in the zip archive use one password, and a few entries use a
+        ///   different password.  If all entries in the zip file use the same password,
+        ///   then it is simpler to just set this property on the ZipFile itself,
+        ///   whether creating a zip archive or extracting a zip archive.
+        /// </para>
+        ///
+        /// <para>
+        ///   Some comments on updating archives: If you read a <c>ZipFile</c>, you
+        ///   cannot modify the password on any encrypted entry, except by extracting
+        ///   the entry with the original password (if any), removing the original entry
+        ///   via <see cref="ZipFile.RemoveEntry(ZipEntry)"/>, and then adding a new
+        ///   entry with a new Password.
+        /// </para>
+        ///
+        /// <para>
+        ///   For example, suppose you read a <c>ZipFile</c>, and there is an encrypted
+        ///   entry.  Setting the Password property on that <c>ZipEntry</c> and then
+        ///   calling <c>Save()</c> on the <c>ZipFile</c> does not update the password
+        ///   on that entry in the archive.  Neither is an exception thrown. Instead,
+        ///   what happens during the <c>Save()</c> is the existing entry is copied
+        ///   through to the new zip archive, in its original encrypted form. Upon
+        ///   re-reading that archive, the entry can be decrypted with its original
+        ///   password.
+        /// </para>
+        ///
+        /// <para>
+        ///   If you read a ZipFile, and there is an un-encrypted entry, you can set the
+        ///   <c>Password</c> on the entry and then call Save() on the ZipFile, and get
+        ///   encryption on that entry.
+        /// </para>
+        ///
+        /// </remarks>
+        ///
+        /// <example>
+        /// <para>
+        ///   This example creates a zip file with two entries, and then extracts the
+        ///   entries from the zip file.  When creating the zip file, the two files are
+        ///   added to the zip file using password protection. Each entry uses a
+        ///   different password.  During extraction, each file is extracted with the
+        ///   appropriate password.
+        /// </para>
+        /// <code>
+        /// // create a file with encryption
+        /// using (ZipFile zip = new ZipFile())
+        /// {
+        ///     ZipEntry entry;
+        ///     entry= zip.AddFile("Declaration.txt");
+        ///     entry.Password= "123456!";
+        ///     entry = zip.AddFile("Report.xls");
+        ///     entry.Password= "1Secret!";
+        ///     zip.Save("EncryptedArchive.zip");
+        /// }
+        ///
+        /// // extract entries that use encryption
+        /// using (ZipFile zip = ZipFile.Read("EncryptedArchive.zip"))
+        /// {
+        ///     ZipEntry entry;
+        ///     entry = zip["Declaration.txt"];
+        ///     entry.Password = "123456!";
+        ///     entry.Extract("extractDir");
+        ///     entry = zip["Report.xls"];
+        ///     entry.Password = "1Secret!";
+        ///     entry.Extract("extractDir");
+        /// }
+        ///
+        /// </code>
+        ///
+        /// <code lang="VB">
+        /// Using zip As New ZipFile
+        ///     Dim entry as ZipEntry
+        ///     entry= zip.AddFile("Declaration.txt")
+        ///     entry.Password= "123456!"
+        ///     entry = zip.AddFile("Report.xls")
+        ///     entry.Password= "1Secret!"
+        ///     zip.Save("EncryptedArchive.zip")
+        /// End Using
+        ///
+        ///
+        /// ' extract entries that use encryption
+        /// Using (zip as ZipFile = ZipFile.Read("EncryptedArchive.zip"))
+        ///     Dim entry as ZipEntry
+        ///     entry = zip("Declaration.txt")
+        ///     entry.Password = "123456!"
+        ///     entry.Extract("extractDir")
+        ///     entry = zip("Report.xls")
+        ///     entry.Password = "1Secret!"
+        ///     entry.Extract("extractDir")
+        /// End Using
+        ///
+        /// </code>
+        ///
+        /// </example>
+        ///
+        /// <seealso cref="Ionic.Zip.ZipEntry.Encryption"/>
+        /// <seealso cref="Ionic.Zip.ZipFile.Password">ZipFile.Password</seealso>
+        public string Password
+        {
+            set
+            {
+                _Password = value;
+                if (_Password == null)
+                {
+                    _Encryption = EncryptionAlgorithm.None;
+                }
+                else
+                {
+                    // We're setting a non-null password.
+
+                    // For entries obtained from a zip file that are encrypted, we cannot
+                    // simply restream (recompress, re-encrypt) the file data, because we
+                    // need the old password in order to decrypt the data, and then we
+                    // need the new password to encrypt.  So, setting the password is
+                    // never going to work on an entry that is stored encrypted in a zipfile.
+
+                    // But it is not en error to set the password, obviously: callers will
+                    // set the password in order to Extract encrypted archives.
+
+                    // If the source is a zip archive and there was previously no encryption
+                    // on the entry, then we must re-stream the entry in order to encrypt it.
+                    if (this._Source == ZipEntrySource.ZipFile && !_sourceIsEncrypted)
+                        _restreamRequiredOnSave = true;
+
+                    if (Encryption == EncryptionAlgorithm.None)
+                    {
+                        _Encryption = EncryptionAlgorithm.PkzipWeak;
+                    }
+                }
+            }
+            private get { return _Password; }
+        }
+
+
+
+        internal bool IsChanged
+        {
+            get
+            {
+                return _restreamRequiredOnSave | _metadataChanged;
+            }
+        }
+
+
+        /// <summary>
+        /// The action the library should take when extracting a file that already exists.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///   <para>
+        ///     This property affects the behavior of the Extract methods (one of the
+        ///     <c>Extract()</c> or <c>ExtractWithPassword()</c> overloads), when
+        ///     extraction would would overwrite an existing filesystem file. If you do
+        ///     not set this property, the library throws an exception when extracting
+        ///     an entry would overwrite an existing file.
+        ///   </para>
+        ///
+        ///   <para>
+        ///     This property has no effect when extracting to a stream, or when the file to be
+        ///     extracted does not already exist.
+        ///   </para>
+        ///
+        /// </remarks>
+        /// <seealso cref="Ionic.Zip.ZipFile.ExtractExistingFile"/>
+        ///
+        /// <example>
+        ///   This example shows how to set the <c>ExtractExistingFile</c> property in
+        ///   an <c>ExtractProgress</c> event, in response to user input. The
+        ///   <c>ExtractProgress</c> event is invoked if and only if the
+        ///   <c>ExtractExistingFile</c> property was previously set to
+        ///   <c>ExtractExistingFileAction.InvokeExtractProgressEvent</c>.
+        /// <code lang="C#">
+        /// public static void ExtractProgress(object sender, ExtractProgressEventArgs e)
+        /// {
+        ///     if (e.EventType == ZipProgressEventType.Extracting_BeforeExtractEntry)
+        ///         Console.WriteLine("extract {0} ", e.CurrentEntry.FileName);
+        ///
+        ///     else if (e.EventType == ZipProgressEventType.Extracting_ExtractEntryWouldOverwrite)
+        ///     {
+        ///         ZipEntry entry = e.CurrentEntry;
+        ///         string response = null;
+        ///         // Ask the user if he wants overwrite the file
+        ///         do
+        ///         {
+        ///             Console.Write("Overwrite {0} in {1} ? (y/n/C) ", entry.FileName, e.ExtractLocation);
+        ///             response = Console.ReadLine();
+        ///             Console.WriteLine();
+        ///
+        ///         } while (response != null &amp;&amp; response[0]!='Y' &amp;&amp;
+        ///                  response[0]!='N' &amp;&amp; response[0]!='C');
+        ///
+        ///         if  (response[0]=='C')
+        ///             e.Cancel = true;
+        ///         else if (response[0]=='Y')
+        ///             entry.ExtractExistingFile = ExtractExistingFileAction.OverwriteSilently;
+        ///         else
+        ///             entry.ExtractExistingFile= ExtractExistingFileAction.DoNotOverwrite;
+        ///     }
+        /// }
+        /// </code>
+        /// </example>
+        internal ExtractExistingFileAction ExtractExistingFile
+        {
+            get;
+            set;
+        }
+
+
+        /// <summary>
+        ///   The action to take when an error is encountered while
+        ///   opening or reading files as they are saved into a zip archive.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///  <para>
+        ///     Errors can occur within a call to <see
+        ///     cref="ZipFile.Save()">ZipFile.Save</see>, as the various files contained
+        ///     in a ZipFile are being saved into the zip archive.  During the
+        ///     <c>Save</c>, DotNetZip will perform a <c>File.Open</c> on the file
+        ///     associated to the ZipEntry, and then will read the entire contents of
+        ///     the file as it is zipped. Either the open or the Read may fail, because
+        ///     of lock conflicts or other reasons.  Using this property, you can
+        ///     specify the action to take when such errors occur.
+        ///  </para>
+        ///
+        ///  <para>
+        ///     Typically you will NOT set this property on individual ZipEntry
+        ///     instances.  Instead, you will set the <see
+        ///     cref="ZipFile.ZipErrorAction">ZipFile.ZipErrorAction</see> property on
+        ///     the ZipFile instance, before adding any entries to the
+        ///     <c>ZipFile</c>. If you do this, errors encountered on behalf of any of
+        ///     the entries in the ZipFile will be handled the same way.
+        ///  </para>
+        ///
+        ///  <para>
+        ///     But, if you use a <see cref="ZipFile.ZipError"/> handler, you will want
+        ///     to set this property on the <c>ZipEntry</c> within the handler, to
+        ///     communicate back to DotNetZip what you would like to do with the
+        ///     particular error.
+        ///  </para>
+        ///
+        /// </remarks>
+        /// <seealso cref="Ionic.Zip.ZipFile.ZipErrorAction"/>
+        /// <seealso cref="Ionic.Zip.ZipFile.ZipError"/>
+        internal ZipErrorAction ZipErrorAction
+        {
+            get;
+            set;
+        }
+
+
+        /// <summary>
+        /// Indicates whether the entry was included in the most recent save.
+        /// </summary>
+        /// <remarks>
+        /// An entry can be excluded or skipped from a save if there is an error
+        /// opening or reading the entry.
+        /// </remarks>
+        /// <seealso cref="ZipErrorAction"/>
+        internal bool IncludedInMostRecentSave
+        {
+            get
+            {
+                return !_skippedDuringSave;
+            }
+        }
+
+
+        /// <summary>
+        ///   A callback that allows the application to specify the compression to use
+        ///   for a given entry that is about to be added to the zip archive.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   See <see cref="ZipFile.SetCompression" />
+        /// </para>
+        /// </remarks>
+        public SetCompressionCallback SetCompression
+        {
+            get;
+            set;
+        }
+
+
+
+        /// <summary>
+        ///   Set to indicate whether to use UTF-8 encoding for filenames and comments.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///
+        /// <para>
+        ///   If this flag is set, the comment and filename for the entry will be
+        ///   encoded with UTF-8, as described in <see
+        ///   href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT">the Zip
+        ///   specification</see>, if necessary. "Necessary" means, the filename or
+        ///   entry comment (if any) cannot be reflexively encoded and decoded using the
+        ///   default code page, IBM437.
+        /// </para>
+        ///
+        /// <para>
+        ///   Setting this flag to true is equivalent to setting <see
+        ///   cref="ProvisionalAlternateEncoding"/> to <c>System.Text.Encoding.UTF8</c>.
+        /// </para>
+        ///
+        /// <para>
+        ///   This flag has no effect or relation to the text encoding used within the
+        ///   file itself.
+        /// </para>
+        ///
+        /// </remarks>
+        [Obsolete("Beginning with v1.9.1.6 of DotNetZip, this property is obsolete.  It will be removed in a future version of the library. Your applications should  use AlternateEncoding and AlternateEncodingUsage instead.")]
+        public bool UseUnicodeAsNecessary
+        {
+            get
+            {
+                return (AlternateEncoding == System.Text.Encoding.GetEncoding("UTF-8")) &&
+                    (AlternateEncodingUsage == ZipOption.AsNecessary);
+            }
+            set
+            {
+                if (value)
+                {
+                    AlternateEncoding = System.Text.Encoding.GetEncoding("UTF-8");
+                    AlternateEncodingUsage = ZipOption.AsNecessary;
+
+                }
+                else
+                {
+                    AlternateEncoding = Ionic.Zip.ZipFile.DefaultEncoding;
+                    AlternateEncodingUsage = ZipOption.Never;
+                }
+            }
+        }
+
+        /// <summary>
+        ///   The text encoding to use for the FileName and Comment on this ZipEntry,
+        ///   when the default encoding is insufficient.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///
+        /// <para>
+        ///   Don't use this property.  See <see cref='AlternateEncoding'/>.
+        /// </para>
+        ///
+        /// </remarks>
+        [Obsolete("This property is obsolete since v1.9.1.6. Use AlternateEncoding and AlternateEncodingUsage instead.", true)]
+        public System.Text.Encoding ProvisionalAlternateEncoding
+        {
+            get; set;
+        }
+
+        /// <summary>
+        ///   Specifies the alternate text encoding used by this ZipEntry
+        /// </summary>
+        /// <remarks>
+        ///   <para>
+        ///     The default text encoding used in Zip files for encoding filenames and
+        ///     comments is IBM437, which is something like a superset of ASCII.  In
+        ///     cases where this is insufficient, applications can specify an
+        ///     alternate encoding.
+        ///   </para>
+        ///   <para>
+        ///     When creating a zip file, the usage of the alternate encoding is
+        ///     governed by the <see cref="AlternateEncodingUsage"/> property.
+        ///     Typically you would set both properties to tell DotNetZip to employ an
+        ///     encoding that is not IBM437 in the zipfile you are creating.
+        ///   </para>
+        ///   <para>
+        ///     Keep in mind that because the ZIP specification states that the only
+        ///     valid encodings to use are IBM437 and UTF-8, if you use something
+        ///     other than that, then zip tools and libraries may not be able to
+        ///     successfully read the zip archive you generate.
+        ///   </para>
+        ///   <para>
+        ///     The zip specification states that applications should presume that
+        ///     IBM437 is in use, except when a special bit is set, which indicates
+        ///     UTF-8. There is no way to specify an arbitrary code page, within the
+        ///     zip file itself. When you create a zip file encoded with gb2312 or
+        ///     ibm861 or anything other than IBM437 or UTF-8, then the application
+        ///     that reads the zip file needs to "know" which code page to use. In
+        ///     some cases, the code page used when reading is chosen implicitly. For
+        ///     example, WinRar uses the ambient code page for the host desktop
+        ///     operating system. The pitfall here is that if you create a zip in
+        ///     Copenhagen and send it to Tokyo, the reader of the zipfile may not be
+        ///     able to decode successfully.
+        ///   </para>
+        /// </remarks>
+        /// <example>
+        ///   This example shows how to create a zipfile encoded with a
+        ///   language-specific encoding:
+        /// <code>
+        ///   using (var zip = new ZipFile())
+        ///   {
+        ///      zip.AlternateEnoding = System.Text.Encoding.GetEncoding("ibm861");
+        ///      zip.AlternateEnodingUsage = ZipOption.Always;
+        ///      zip.AddFileS(arrayOfFiles);
+        ///      zip.Save("Myarchive-Encoded-in-IBM861.zip");
+        ///   }
+        /// </code>
+        /// </example>
+        /// <seealso cref="ZipFile.AlternateEncodingUsage" />
+        public System.Text.Encoding AlternateEncoding
+        {
+            get; set;
+        }
+
+
+        /// <summary>
+        ///   Describes if and when this instance should apply
+        ///   AlternateEncoding to encode the FileName and Comment, when
+        ///   saving.
+        /// </summary>
+        /// <seealso cref="ZipFile.AlternateEncoding" />
+        internal ZipOption AlternateEncodingUsage
+        {
+            get; set;
+        }
+
+
+        // /// <summary>
+        // /// The text encoding actually used for this ZipEntry.
+        // /// </summary>
+        // ///
+        // /// <remarks>
+        // ///
+        // /// <para>
+        // ///   This read-only property describes the encoding used by the
+        // ///   <c>ZipEntry</c>.  If the entry has been read in from an existing ZipFile,
+        // ///   then it may take the value UTF-8, if the entry is coded to specify UTF-8.
+        // ///   If the entry does not specify UTF-8, the typical case, then the encoding
+        // ///   used is whatever the application specified in the call to
+        // ///   <c>ZipFile.Read()</c>. If the application has used one of the overloads of
+        // ///   <c>ZipFile.Read()</c> that does not accept an encoding parameter, then the
+        // ///   encoding used is IBM437, which is the default encoding described in the
+        // ///   ZIP specification.  </para>
+        // ///
+        // /// <para>
+        // ///   If the entry is being created, then the value of ActualEncoding is taken
+        // ///   according to the logic described in the documentation for <see
+        // ///   cref="ZipFile.ProvisionalAlternateEncoding" />.  </para>
+        // ///
+        // /// <para>
+        // ///   An application might be interested in retrieving this property to see if
+        // ///   an entry read in from a file has used Unicode (UTF-8).  </para>
+        // ///
+        // /// </remarks>
+        // ///
+        // /// <seealso cref="ZipFile.ProvisionalAlternateEncoding" />
+        // public System.Text.Encoding ActualEncoding
+        // {
+        //     get
+        //     {
+        //         return _actualEncoding;
+        //     }
+        // }
+
+
+
+
+        internal static string NameInArchive(String filename, string directoryPathInArchive)
+        {
+            string result = null;
+            if (directoryPathInArchive == null)
+                result = filename;
+
+            else
+            {
+                if (String.IsNullOrEmpty(directoryPathInArchive))
+                {
+                    result = Path.GetFileName(filename);
+                }
+                else
+                {
+                    // explicitly specify a pathname for this file
+                    result = Path.Combine(directoryPathInArchive, Path.GetFileName(filename));
+                }
+            }
+
+            //result = Path.GetFullPath(result);
+            result = SharedUtilities.NormalizePathForUseInZipFile(result);
+
+            return result;
+        }
+
+        // workitem 9073
+        internal static ZipEntry CreateFromNothing(String nameInArchive)
+        {
+            return Create(nameInArchive, ZipEntrySource.None, null, null);
+        }
+
+        internal static ZipEntry CreateFromFile(String filename, string nameInArchive)
+        {
+            return Create(nameInArchive, ZipEntrySource.FileSystem, filename, null);
+        }
+
+        internal static ZipEntry CreateForStream(String entryName, Stream s)
+        {
+            return Create(entryName, ZipEntrySource.Stream, s, null);
+        }
+
+        internal static ZipEntry CreateForWriter(String entryName, WriteDelegate d)
+        {
+            return Create(entryName, ZipEntrySource.WriteDelegate, d, null);
+        }
+
+        internal static ZipEntry CreateForJitStreamProvider(string nameInArchive, OpenDelegate opener, CloseDelegate closer)
+        {
+            return Create(nameInArchive, ZipEntrySource.JitStream, opener, closer);
+        }
+
+        internal static ZipEntry CreateForZipOutputStream(string nameInArchive)
+        {
+            return Create(nameInArchive, ZipEntrySource.ZipOutputStream, null, null);
+        }
+
+
+        private static ZipEntry Create(string nameInArchive, ZipEntrySource source, Object arg1, Object arg2)
+        {
+            if (String.IsNullOrEmpty(nameInArchive))
+                throw new Ionic.Zip.ZipException("The entry name must be non-null and non-empty.");
+
+            ZipEntry entry = new ZipEntry();
+
+            // workitem 7071
+            // workitem 7926 - "version made by" OS should be zero for compat with WinZip
+            entry._VersionMadeBy = (0 << 8) + 45; // indicates the attributes are FAT Attributes, and v4.5 of the spec
+            entry._Source = source;
+            entry._Mtime = entry._Atime = entry._Ctime = DateTime.UtcNow;
+
+            if (source == ZipEntrySource.Stream)
+            {
+                entry._sourceStream = (arg1 as Stream);         // may  or may not be null
+            }
+            else if (source == ZipEntrySource.WriteDelegate)
+            {
+                entry._WriteDelegate = (arg1 as WriteDelegate); // may  or may not be null
+            }
+            else if (source == ZipEntrySource.JitStream)
+            {
+                entry._OpenDelegate = (arg1 as OpenDelegate);   // may  or may not be null
+                entry._CloseDelegate = (arg2 as CloseDelegate); // may  or may not be null
+            }
+            else if (source == ZipEntrySource.ZipOutputStream)
+            {
+            }
+            // workitem 9073
+            else if (source == ZipEntrySource.None)
+            {
+                // make this a valid value, for later.
+                entry._Source = ZipEntrySource.FileSystem;
+            }
+            else
+            {
+                String filename = (arg1 as String);   // must not be null
+
+                if (String.IsNullOrEmpty(filename))
+                    throw new Ionic.Zip.ZipException("The filename must be non-null and non-empty.");
+
+                try
+                {
+                    // The named file may or may not exist at this time.  For
+                    // example, when adding a directory by name.  We test existence
+                    // when necessary: when saving the ZipFile, or when getting the
+                    // attributes, and so on.
+
+#if NETCF
+                    // workitem 6878
+                    // Ionic.Zip.SharedUtilities.AdjustTime_Win32ToDotNet
+                    entry._Mtime = File.GetLastWriteTime(filename).ToUniversalTime();
+                    entry._Ctime = File.GetCreationTime(filename).ToUniversalTime();
+                    entry._Atime = File.GetLastAccessTime(filename).ToUniversalTime();
+
+                    // workitem 7071
+                    // can only get attributes of files that exist.
+                    if (File.Exists(filename) || Directory.Exists(filename))
+                        entry._ExternalFileAttrs = (int)NetCfFile.GetAttributes(filename);
+
+#elif SILVERLIGHT
+                    entry._Mtime =
+                        entry._Ctime =
+                        entry._Atime = System.DateTime.UtcNow;
+                    entry._ExternalFileAttrs = (int)0;
+#else
+                    // workitem 6878??
+                    entry._Mtime = File.GetLastWriteTime(filename).ToUniversalTime();
+                    entry._Ctime = File.GetCreationTime(filename).ToUniversalTime();
+                    entry._Atime = File.GetLastAccessTime(filename).ToUniversalTime();
+
+                    // workitem 7071
+                    // can only get attributes on files that exist.
+                    if (File.Exists(filename) || Directory.Exists(filename))
+                        entry._ExternalFileAttrs = (int)File.GetAttributes(filename);
+
+#endif
+                    entry._ntfsTimesAreSet = true;
+
+                    entry._LocalFileName = Path.GetFullPath(filename); // workitem 8813
+
+                }
+                catch (System.IO.PathTooLongException ptle)
+                {
+                    // workitem 14035
+                    var msg = String.Format("The path is too long, filename={0}",
+                                            filename);
+                    throw new ZipException(msg, ptle);
+                }
+
+            }
+
+            entry._LastModified = entry._Mtime;
+            entry._FileNameInArchive = SharedUtilities.NormalizePathForUseInZipFile(nameInArchive);
+            // We don't actually slurp in the file data until the caller invokes Write on this entry.
+
+            return entry;
+        }
+
+
+
+
+        internal void MarkAsDirectory()
+        {
+            _IsDirectory = true;
+            // workitem 6279
+            if (!_FileNameInArchive.EndsWith("/"))
+                _FileNameInArchive += "/";
+        }
+
+
+
+        /// <summary>
+        ///   Indicates whether an entry is marked as a text file. Be careful when
+        ///   using on this property. Unless you have a good reason, you should
+        ///   probably ignore this property.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   The ZIP format includes a provision for specifying whether an entry in
+        ///   the zip archive is a text or binary file.  This property exposes that
+        ///   metadata item. Be careful when using this property: It's not clear
+        ///   that this property as a firm meaning, across tools and libraries.
+        /// </para>
+        ///
+        /// <para>
+        ///   To be clear, when reading a zip file, the property value may or may
+        ///   not be set, and its value may or may not be valid.  Not all entries
+        ///   that you may think of as "text" entries will be so marked, and entries
+        ///   marked as "text" are not guaranteed in any way to be text entries.
+        ///   Whether the value is set and set correctly depends entirely on the
+        ///   application that produced the zip file.
+        /// </para>
+        ///
+        /// <para>
+        ///   There are many zip tools available, and when creating zip files, some
+        ///   of them "respect" the IsText metadata field, and some of them do not.
+        ///   Unfortunately, even when an application tries to do "the right thing",
+        ///   it's not always clear what "the right thing" is.
+        /// </para>
+        ///
+        /// <para>
+        ///   There's no firm definition of just what it means to be "a text file",
+        ///   and the zip specification does not help in this regard. Twenty years
+        ///   ago, text was ASCII, each byte was less than 127. IsText meant, all
+        ///   bytes in the file were less than 127.  These days, it is not the case
+        ///   that all text files have all bytes less than 127.  Any unicode file
+        ///   may have bytes that are above 0x7f.  The zip specification has nothing
+        ///   to say on this topic. Therefore, it's not clear what IsText really
+        ///   means.
+        /// </para>
+        ///
+        /// <para>
+        ///   This property merely tells a reading application what is stored in the
+        ///   metadata for an entry, without guaranteeing its validity or its
+        ///   meaning.
+        /// </para>
+        ///
+        /// <para>
+        ///   When DotNetZip is used to create a zipfile, it attempts to set this
+        ///   field "correctly." For example, if a file ends in ".txt", this field
+        ///   will be set. Your application may override that default setting.  When
+        ///   writing a zip file, you must set the property before calling
+        ///   <c>Save()</c> on the ZipFile.
+        /// </para>
+        ///
+        /// <para>
+        ///   When reading a zip file, a more general way to decide just what kind
+        ///   of file is contained in a particular entry is to use the file type
+        ///   database stored in the operating system.  The operating system stores
+        ///   a table that says, a file with .jpg extension is a JPG image file, a
+        ///   file with a .xml extension is an XML document, a file with a .txt is a
+        ///   pure ASCII text document, and so on.  To get this information on
+        ///   Windows, <see
+        ///   href="http://www.codeproject.com/KB/cs/GetFileTypeAndIcon.aspx"> you
+        ///   need to read and parse the registry.</see> </para>
+        /// </remarks>
+        ///
+        /// <example>
+        /// <code>
+        /// using (var zip = new ZipFile())
+        /// {
+        ///     var e = zip.UpdateFile("Descriptions.mme", "");
+        ///     e.IsText = true;
+        ///     zip.Save(zipPath);
+        /// }
+        /// </code>
+        ///
+        /// <code lang="VB">
+        /// Using zip As New ZipFile
+        ///     Dim e2 as ZipEntry = zip.AddFile("Descriptions.mme", "")
+        ///     e.IsText= True
+        ///     zip.Save(zipPath)
+        /// End Using
+        /// </code>
+        /// </example>
+        public bool IsText
+        {
+            // workitem 7801
+            get { return _IsText; }
+            set { _IsText = value; }
+        }
+
+
+
+        /// <summary>Provides a string representation of the instance.</summary>
+        /// <returns>a string representation of the instance.</returns>
+        public override String ToString()
+        {
+            return String.Format("ZipEntry::{0}", FileName);
+        }
+
+
+        internal Stream ArchiveStream
+        {
+            get
+            {
+                if (_archiveStream == null)
+                {
+                    if (_container.ZipFile != null)
+                    {
+                        var zf = _container.ZipFile;
+                        zf.Reset(false);
+                        _archiveStream = zf.StreamForDiskNumber(_diskNumber);
+                    }
+                    else
+                    {
+                        _archiveStream = _container.ZipOutputStream.OutputStream;
+                    }
+                }
+                return _archiveStream;
+            }
+        }
+
+
+        private void SetFdpLoh()
+        {
+            // The value for FileDataPosition has not yet been set.
+            // Therefore, seek to the local header, and figure the start of file data.
+            // workitem 8098: ok (restore)
+            long origPosition = this.ArchiveStream.Position;
+            try
+            {
+                this.ArchiveStream.Seek(this._RelativeOffsetOfLocalHeader, SeekOrigin.Begin);
+
+                // workitem 10178
+                Ionic.Zip.SharedUtilities.Workaround_Ladybug318918(this.ArchiveStream);
+            }
+            catch (System.IO.IOException exc1)
+            {
+                string description = String.Format("Exception seeking  entry({0}) offset(0x{1:X8}) len(0x{2:X8})",
+                                                   this.FileName, this._RelativeOffsetOfLocalHeader,
+                                                   this.ArchiveStream.Length);
+                throw new BadStateException(description, exc1);
+            }
+
+            byte[] block = new byte[30];
+            this.ArchiveStream.Read(block, 0, block.Length);
+
+            // At this point we could verify the contents read from the local header
+            // with the contents read from the central header.  We could, but don't need to.
+            // So we won't.
+
+            Int16 filenameLength = (short)(block[26] + block[27] * 256);
+            Int16 extraFieldLength = (short)(block[28] + block[29] * 256);
+
+            // Console.WriteLine("  pos  0x{0:X8} ({0})", this.ArchiveStream.Position);
+            // Console.WriteLine("  seek 0x{0:X8} ({0})", filenameLength + extraFieldLength);
+
+            this.ArchiveStream.Seek(filenameLength + extraFieldLength, SeekOrigin.Current);
+            // workitem 10178
+            Ionic.Zip.SharedUtilities.Workaround_Ladybug318918(this.ArchiveStream);
+
+            this._LengthOfHeader = 30 + extraFieldLength + filenameLength +
+                GetLengthOfCryptoHeaderBytes(_Encryption_FromZipFile);
+
+            // Console.WriteLine("  ROLH  0x{0:X8} ({0})", _RelativeOffsetOfLocalHeader);
+            // Console.WriteLine("  LOH   0x{0:X8} ({0})", _LengthOfHeader);
+            // workitem 8098: ok (arithmetic)
+            this.__FileDataPosition = _RelativeOffsetOfLocalHeader + _LengthOfHeader;
+            // Console.WriteLine("  FDP   0x{0:X8} ({0})", __FileDataPosition);
+
+            // restore file position:
+            // workitem 8098: ok (restore)
+            this.ArchiveStream.Seek(origPosition, SeekOrigin.Begin);
+            // workitem 10178
+            Ionic.Zip.SharedUtilities.Workaround_Ladybug318918(this.ArchiveStream);
+        }
+
+
+
+#if AESCRYPTO
+        private static int GetKeyStrengthInBits(EncryptionAlgorithm a)
+        {
+            if (a == EncryptionAlgorithm.WinZipAes256) return 256;
+            else if (a == EncryptionAlgorithm.WinZipAes128) return 128;
+            return -1;
+        }
+#endif
+
+        internal static int GetLengthOfCryptoHeaderBytes(EncryptionAlgorithm a)
+        {
+            //if ((_BitField & 0x01) != 0x01) return 0;
+            if (a == EncryptionAlgorithm.None) return 0;
+
+#if AESCRYPTO
+            if (a == EncryptionAlgorithm.WinZipAes128 ||
+                a == EncryptionAlgorithm.WinZipAes256)
+            {
+                int KeyStrengthInBits = GetKeyStrengthInBits(a);
+                int sizeOfSaltAndPv = ((KeyStrengthInBits / 8 / 2) + 2);
+                return sizeOfSaltAndPv;
+            }
+#endif
+            if (a == EncryptionAlgorithm.PkzipWeak)
+                return 12;
+            throw new ZipException("internal error");
+        }
+
+
+        internal long FileDataPosition
+        {
+            get
+            {
+                if (__FileDataPosition == -1)
+                    SetFdpLoh();
+
+                return __FileDataPosition;
+            }
+        }
+
+        private int LengthOfHeader
+        {
+            get
+            {
+                if (_LengthOfHeader == 0)
+                    SetFdpLoh();
+
+                return _LengthOfHeader;
+            }
+        }
+
+
+
+        private ZipCrypto _zipCrypto_forExtract;
+        private ZipCrypto _zipCrypto_forWrite;
+#if AESCRYPTO
+        private WinZipAesCrypto _aesCrypto_forExtract;
+        private WinZipAesCrypto _aesCrypto_forWrite;
+        private Int16 _WinZipAesMethod;
+#endif
+
+        internal DateTime _LastModified;
+        private DateTime _Mtime, _Atime, _Ctime;  // workitem 6878: NTFS quantities
+        private bool _ntfsTimesAreSet;
+        private bool _emitNtfsTimes = true;
+        private bool _emitUnixTimes;  // by default, false
+        private bool _TrimVolumeFromFullyQualifiedPaths = true;  // by default, trim them.
+        internal string _LocalFileName;
+        private string _FileNameInArchive;
+        internal Int16 _VersionNeeded;
+        internal Int16 _BitField;
+        internal Int16 _CompressionMethod;
+        private Int16 _CompressionMethod_FromZipFile;
+        private Ionic.Zlib.CompressionLevel _CompressionLevel;
+        internal string _Comment;
+        private bool _IsDirectory;
+        private byte[] _CommentBytes;
+        internal Int64 _CompressedSize;
+        internal Int64 _CompressedFileDataSize; // CompressedSize less 12 bytes for the encryption header, if any
+        internal Int64 _UncompressedSize;
+        internal Int32 _TimeBlob;
+        private bool _crcCalculated;
+        internal Int32 _Crc32;
+        internal byte[] _Extra;
+        private bool _metadataChanged;
+        private bool _restreamRequiredOnSave;
+        private bool _sourceIsEncrypted;
+        private bool _skippedDuringSave;
+        private UInt32 _diskNumber;
+
+        private static System.Text.Encoding ibm437 = System.Text.Encoding.GetEncoding("IBM437");
+        //private System.Text.Encoding _provisionalAlternateEncoding = System.Text.Encoding.GetEncoding("IBM437");
+        private System.Text.Encoding _actualEncoding;
+
+        internal ZipContainer _container;
+
+        private long __FileDataPosition = -1;
+        private byte[] _EntryHeader;
+        internal Int64 _RelativeOffsetOfLocalHeader;
+        private Int64 _future_ROLH;
+        private Int64 _TotalEntrySize;
+        private int _LengthOfHeader;
+        private int _LengthOfTrailer;
+        internal bool _InputUsesZip64;
+        private UInt32 _UnsupportedAlgorithmId;
+
+        internal string _Password;
+        internal ZipEntrySource _Source;
+        internal EncryptionAlgorithm _Encryption;
+        internal EncryptionAlgorithm _Encryption_FromZipFile;
+        internal byte[] _WeakEncryptionHeader;
+        internal Stream _archiveStream;
+        private Stream _sourceStream;
+        private Nullable<Int64> _sourceStreamOriginalPosition;
+        private bool _sourceWasJitProvided;
+        private bool _ioOperationCanceled;
+        private bool _presumeZip64;
+        private Nullable<bool> _entryRequiresZip64;
+        private Nullable<bool> _OutputUsesZip64;
+        private bool _IsText; // workitem 7801
+        private ZipEntryTimestamp _timestamp;
+
+        private static System.DateTime _unixEpoch = new System.DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
+        private static System.DateTime _win32Epoch = System.DateTime.FromFileTimeUtc(0L);
+        private static System.DateTime _zeroHour = new System.DateTime(1, 1, 1, 0, 0, 0, DateTimeKind.Utc);
+
+        private WriteDelegate _WriteDelegate;
+        private OpenDelegate _OpenDelegate;
+        private CloseDelegate _CloseDelegate;
+
+
+        // summary
+        // The default size of the IO buffer for ZipEntry instances. Currently it is 8192 bytes.
+        // summary
+        //public const int IO_BUFFER_SIZE_DEFAULT = 8192; // 0x8000; // 0x4400
+
+    }
+
+
+
+    /// <summary>
+    ///   An enum that specifies the type of timestamp available on the ZipEntry.
+    /// </summary>
+    ///
+    /// <remarks>
+    ///
+    /// <para>
+    ///   The last modified time of a file can be stored in multiple ways in
+    ///   a zip file, and they are not mutually exclusive:
+    /// </para>
+    ///
+    /// <list type="bullet">
+    ///   <item>
+    ///     In the so-called "DOS" format, which has a 2-second precision. Values
+    ///     are rounded to the nearest even second. For example, if the time on the
+    ///     file is 12:34:43, then it will be stored as 12:34:44. This first value
+    ///     is accessible via the <c>LastModified</c> property. This value is always
+    ///     present in the metadata for each zip entry.  In some cases the value is
+    ///     invalid, or zero.
+    ///   </item>
+    ///
+    ///   <item>
+    ///     In the so-called "Windows" or "NTFS" format, as an 8-byte integer
+    ///     quantity expressed as the number of 1/10 milliseconds (in other words
+    ///     the number of 100 nanosecond units) since January 1, 1601 (UTC).  This
+    ///     format is how Windows represents file times.  This time is accessible
+    ///     via the <c>ModifiedTime</c> property.
+    ///   </item>
+    ///
+    ///   <item>
+    ///     In the "Unix" format, a 4-byte quantity specifying the number of seconds since
+    ///     January 1, 1970 UTC.
+    ///   </item>
+    ///
+    ///   <item>
+    ///     In an older format, now deprecated but still used by some current
+    ///     tools. This format is also a 4-byte quantity specifying the number of
+    ///     seconds since January 1, 1970 UTC.
+    ///   </item>
+    ///
+    /// </list>
+    ///
+    /// <para>
+    ///   This bit field describes which of the formats were found in a <c>ZipEntry</c> that was read.
+    /// </para>
+    ///
+    /// </remarks>
+    [Flags]
+    internal enum ZipEntryTimestamp
+    {
+        /// <summary>
+        /// Default value.
+        /// </summary>
+        None = 0,
+
+        /// <summary>
+        /// A DOS timestamp with 2-second precision.
+        /// </summary>
+        DOS = 1,
+
+        /// <summary>
+        /// A Windows timestamp with 100-ns precision.
+        /// </summary>
+        Windows = 2,
+
+        /// <summary>
+        /// A Unix timestamp with 1-second precision.
+        /// </summary>
+        Unix = 4,
+
+        /// <summary>
+        /// A Unix timestamp with 1-second precision, stored in InfoZip v1 format.  This
+        /// format is outdated and is supported for reading archives only.
+        /// </summary>
+        InfoZip1 = 8,
+    }
+
+
+
+    /// <summary>
+    ///   The method of compression to use for a particular ZipEntry.
+    /// </summary>
+    ///
+    /// <remarks>
+    ///   <see
+    ///   href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT">PKWare's
+    ///   ZIP Specification</see> describes a number of distinct
+    ///   cmopression methods that can be used within a zip
+    ///   file. DotNetZip supports a subset of them.
+    /// </remarks>
+    internal enum CompressionMethod
+    {
+        /// <summary>
+        /// No compression at all. For COM environments, the value is 0 (zero).
+        /// </summary>
+        None = 0,
+
+        /// <summary>
+        ///   DEFLATE compression, as described in <see
+        ///   href="http://www.ietf.org/rfc/rfc1951.txt">IETF RFC
+        ///   1951</see>.  This is the "normal" compression used in zip
+        ///   files. For COM environments, the value is 8.
+        /// </summary>
+        Deflate = 8,
+
+#if BZIP
+        /// <summary>
+        ///   BZip2 compression, a compression algorithm developed by Julian Seward.
+        ///   For COM environments, the value is 12.
+        /// </summary>
+        BZip2 = 12,
+#endif
+    }
+
+
+#if NETCF
+    internal class NetCfFile
+    {
+        public static int SetTimes(string filename, DateTime ctime, DateTime atime, DateTime mtime)
+        {
+            IntPtr hFile  = (IntPtr) CreateFileCE(filename,
+                                                  (uint)0x40000000L, // (uint)FileAccess.Write,
+                                                  (uint)0x00000002L, // (uint)FileShare.Write,
+                                                  0,
+                                                  (uint) 3,  // == open existing
+                                                  (uint)0, // flagsAndAttributes
+                                                  0);
+
+            if((int)hFile == -1)
+            {
+                // workitem 7944: don't throw on failure to set file times
+                // throw new ZipException("CreateFileCE Failed");
+                return Interop.Marshal.GetLastWin32Error();
+            }
+
+            SetFileTime(hFile,
+                        BitConverter.GetBytes(ctime.ToFileTime()),
+                        BitConverter.GetBytes(atime.ToFileTime()),
+                        BitConverter.GetBytes(mtime.ToFileTime()));
+
+            CloseHandle(hFile);
+            return 0;
+        }
+
+
+        public static int SetLastWriteTime(string filename, DateTime mtime)
+        {
+            IntPtr hFile  = (IntPtr) CreateFileCE(filename,
+                                                  (uint)0x40000000L, // (uint)FileAccess.Write,
+                                                  (uint)0x00000002L, // (uint)FileShare.Write,
+                                                  0,
+                                                  (uint) 3,  // == open existing
+                                                  (uint)0, // flagsAndAttributes
+                                                  0);
+
+            if((int)hFile == -1)
+            {
+                // workitem 7944: don't throw on failure to set file time
+                // throw new ZipException(String.Format("CreateFileCE Failed ({0})",
+                //                                      Interop.Marshal.GetLastWin32Error()));
+                return Interop.Marshal.GetLastWin32Error();
+            }
+
+            SetFileTime(hFile, null, null,
+                        BitConverter.GetBytes(mtime.ToFileTime()));
+
+            CloseHandle(hFile);
+            return 0;
+        }
+
+
+        [Interop.DllImport("coredll.dll", EntryPoint="CreateFile", SetLastError=true)]
+        internal static extern int CreateFileCE(string lpFileName,
+                                                uint dwDesiredAccess,
+                                                uint dwShareMode,
+                                                int lpSecurityAttributes,
+                                                uint dwCreationDisposition,
+                                                uint dwFlagsAndAttributes,
+                                                int hTemplateFile);
+
+
+        [Interop.DllImport("coredll", EntryPoint="GetFileAttributes", SetLastError=true)]
+        internal static extern uint GetAttributes(string lpFileName);
+
+        [Interop.DllImport("coredll", EntryPoint="SetFileAttributes", SetLastError=true)]
+        internal static extern bool SetAttributes(string lpFileName, uint dwFileAttributes);
+
+        [Interop.DllImport("coredll", EntryPoint="SetFileTime", SetLastError=true)]
+        internal static extern bool SetFileTime(IntPtr hFile, byte[] lpCreationTime, byte[] lpLastAccessTime, byte[] lpLastWriteTime);
+
+        [Interop.DllImport("coredll.dll", SetLastError=true)]
+        internal static extern bool CloseHandle(IntPtr hObject);
+
+    }
+#endif
+
+
+
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ZipEntrySource.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ZipEntrySource.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ZipEntrySource.cs	(revision 12707)
@@ -0,0 +1,69 @@
+// ZipEntrySource.cs
+// ------------------------------------------------------------------
+//
+// Copyright (c) 2009 Dino Chiesa
+// All rights reserved.
+//
+// This code module is part of DotNetZip, a zipfile class library.
+//
+// ------------------------------------------------------------------
+//
+// This code is licensed under the Microsoft Public License. 
+// See the file License.txt for the license details.
+// More info on: http://dotnetzip.codeplex.com
+//
+// ------------------------------------------------------------------
+//
+// last saved (in emacs): 
+// Time-stamp: <2009-November-19 11:18:42>
+//
+// ------------------------------------------------------------------
+//
+
+namespace OfficeOpenXml.Packaging.Ionic.Zip
+{
+    /// <summary>
+    /// An enum that specifies the source of the ZipEntry. 
+    /// </summary>
+    internal enum ZipEntrySource
+    {
+        /// <summary>
+        /// Default value.  Invalid on a bonafide ZipEntry.
+        /// </summary>
+        None = 0,
+
+        /// <summary>
+        /// The entry was instantiated by calling AddFile() or another method that 
+        /// added an entry from the filesystem.
+        /// </summary>
+        FileSystem,
+
+        /// <summary>
+        /// The entry was instantiated via <see cref="Ionic.Zip.ZipFile.AddEntry(string,string)"/> or
+        /// <see cref="Ionic.Zip.ZipFile.AddEntry(string,System.IO.Stream)"/> .
+        /// </summary>
+        Stream,
+
+        /// <summary>
+        /// The ZipEntry was instantiated by reading a zipfile.
+        /// </summary>
+        ZipFile,
+        
+        /// <summary>
+        /// The content for the ZipEntry will be or was provided by the WriteDelegate.
+        /// </summary>
+        WriteDelegate,
+        
+        /// <summary>
+        /// The content for the ZipEntry will be obtained from the stream dispensed by the <c>OpenDelegate</c>.
+        /// The entry was instantiated via <see cref="Ionic.Zip.ZipFile.AddEntry(string,OpenDelegate,CloseDelegate)"/>.
+        /// </summary>
+        JitStream,
+        
+        /// <summary>
+        /// The content for the ZipEntry will be or was obtained from a <c>ZipOutputStream</c>.
+        /// </summary>
+        ZipOutputStream,
+    }
+    
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ZipErrorAction.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ZipErrorAction.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ZipErrorAction.cs	(revision 12707)
@@ -0,0 +1,97 @@
+// ZipErrorAction.cs
+// ------------------------------------------------------------------
+//
+// Copyright (c)  2009 Dino Chiesa
+// All rights reserved.
+//
+// This code module is part of DotNetZip, a zipfile class library.
+//
+// ------------------------------------------------------------------
+//
+// This code is licensed under the Microsoft Public License. 
+// See the file License.txt for the license details.
+// More info on: http://dotnetzip.codeplex.com
+//
+// ------------------------------------------------------------------
+//
+// last saved (in emacs): 
+// Time-stamp: <2009-September-01 18:43:20>
+//
+// ------------------------------------------------------------------
+//
+// This module defines the ZipErrorAction enum, which provides
+// an action to take when errors occur when opening or reading
+// files to be added to a zip file. 
+// 
+// ------------------------------------------------------------------
+
+
+namespace OfficeOpenXml.Packaging.Ionic.Zip
+{
+    /// <summary>
+    /// An enum providing the options when an error occurs during opening or reading
+    /// of a file or directory that is being saved to a zip file. 
+    /// </summary>
+    ///
+    /// <remarks>
+    ///  <para>
+    ///    This enum describes the actions that the library can take when an error occurs
+    ///    opening or reading a file, as it is being saved into a Zip archive. 
+    ///  </para>
+    ///
+    ///  <para>
+    ///     In some cases an error will occur when DotNetZip tries to open a file to be
+    ///     added to the zip archive.  In other cases, an error might occur after the
+    ///     file has been successfully opened, while DotNetZip is reading the file.
+    ///  </para>
+    /// 
+    ///  <para>
+    ///    The first problem might occur when calling AddDirectory() on a directory
+    ///    that contains a Clipper .dbf file; the file is locked by Clipper and
+    ///    cannot be opened by another process. An example of the second problem is
+    ///    the ERROR_LOCK_VIOLATION that results when a file is opened by another
+    ///    process, but not locked, and a range lock has been taken on the file.
+    ///    Microsoft Outlook takes range locks on .PST files.
+    ///  </para>
+    /// </remarks>
+    internal enum ZipErrorAction
+    {
+        /// <summary>
+        /// Throw an exception when an error occurs while zipping.  This is the default
+        /// behavior.  (For COM clients, this is a 0 (zero).)
+        /// </summary>
+        Throw,
+
+        /// <summary>
+        /// When an error occurs during zipping, for example a file cannot be opened,
+        /// skip the file causing the error, and continue zipping.  (For COM clients,
+        /// this is a 1.)
+        /// </summary>
+        Skip,
+        
+        /// <summary>
+        /// When an error occurs during zipping, for example a file cannot be opened,
+        /// retry the operation that caused the error. Be careful with this option. If
+        /// the error is not temporary, the library will retry forever.  (For COM
+        /// clients, this is a 2.)
+        /// </summary>
+        Retry,
+
+        /// <summary>
+        /// When an error occurs, invoke the zipError event.  The event type used is
+        /// <see cref="ZipProgressEventType.Error_Saving"/>.  A typical use of this option:
+        /// a GUI application may wish to pop up a dialog to allow the user to view the
+        /// error that occurred, and choose an appropriate action.  After your
+        /// processing in the error event, if you want to skip the file, set <see
+        /// cref="ZipEntry.ZipErrorAction"/> on the
+        /// <c>ZipProgressEventArgs.CurrentEntry</c> to <c>Skip</c>.  If you want the
+        /// exception to be thrown, set <c>ZipErrorAction</c> on the <c>CurrentEntry</c>
+        /// to <c>Throw</c>.  If you want to cancel the zip, set
+        /// <c>ZipProgressEventArgs.Cancel</c> to true.  Cancelling differs from using
+        /// Skip in that a cancel will not save any further entries, if there are any.
+        /// (For COM clients, the value of this enum is a 3.)
+        /// </summary>
+        InvokeErrorEvent,
+    }
+
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ZipFile.AddUpdate.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ZipFile.AddUpdate.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ZipFile.AddUpdate.cs	(revision 12707)
@@ -0,0 +1,2182 @@
+// ZipFile.AddUpdate.cs
+// ------------------------------------------------------------------
+//
+// Copyright (c) 2009-2011 Dino Chiesa.
+// All rights reserved.
+//
+// This code module is part of DotNetZip, a zipfile class library.
+//
+// ------------------------------------------------------------------
+//
+// This code is licensed under the Microsoft Public License.
+// See the file License.txt for the license details.
+// More info on: http://dotnetzip.codeplex.com
+//
+// ------------------------------------------------------------------
+//
+// last saved (in emacs):
+// Time-stamp: <2011-November-01 13:56:58>
+//
+// ------------------------------------------------------------------
+//
+// This module defines the methods for Adding and Updating entries in
+// the ZipFile.
+//
+// ------------------------------------------------------------------
+//
+
+
+using System;
+using System.IO;
+using System.Collections.Generic;
+
+namespace OfficeOpenXml.Packaging.Ionic.Zip
+{
+    internal partial class ZipFile
+    {
+        /// <summary>
+        ///   Adds an item, either a file or a directory, to a zip file archive.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   This method is handy if you are adding things to zip archive and don't
+        ///   want to bother distinguishing between directories or files.  Any files are
+        ///   added as single entries.  A directory added through this method is added
+        ///   recursively: all files and subdirectories contained within the directory
+        ///   are added to the <c>ZipFile</c>.
+        /// </para>
+        ///
+        /// <para>
+        ///   The name of the item may be a relative path or a fully-qualified
+        ///   path. Remember, the items contained in <c>ZipFile</c> instance get written
+        ///   to the disk only when you call <see cref="ZipFile.Save()"/> or a similar
+        ///   save method.
+        /// </para>
+        ///
+        /// <para>
+        ///   The directory name used for the file within the archive is the same
+        ///   as the directory name (potentially a relative path) specified in the
+        ///   <paramref name="fileOrDirectoryName"/>.
+        /// </para>
+        ///
+        /// <para>
+        ///   For <c>ZipFile</c> properties including <see cref="Encryption"/>, <see
+        ///   cref="Password"/>, <see cref="SetCompression"/>, <see
+        ///   cref="ProvisionalAlternateEncoding"/>, <see cref="ExtractExistingFile"/>,
+        ///   <see cref="ZipErrorAction"/>, and <see cref="CompressionLevel"/>, their
+        ///   respective values at the time of this call will be applied to the
+        ///   <c>ZipEntry</c> added.
+        /// </para>
+        ///
+        /// </remarks>
+        ///
+        /// <seealso cref="Ionic.Zip.ZipFile.AddFile(string)"/>
+        /// <seealso cref="Ionic.Zip.ZipFile.AddDirectory(string)"/>
+        /// <seealso cref="Ionic.Zip.ZipFile.UpdateItem(string)"/>
+        ///
+        /// <overloads>This method has two overloads.</overloads>
+        /// <param name="fileOrDirectoryName">
+        /// the name of the file or directory to add.</param>
+        ///
+        /// <returns>The <c>ZipEntry</c> added.</returns>
+        public ZipEntry AddItem(string fileOrDirectoryName)
+        {
+            return AddItem(fileOrDirectoryName, null);
+        }
+
+
+        /// <summary>
+        ///   Adds an item, either a file or a directory, to a zip file archive,
+        ///   explicitly specifying the directory path to be used in the archive.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   If adding a directory, the add is recursive on all files and
+        ///   subdirectories contained within it.
+        /// </para>
+        /// <para>
+        ///   The name of the item may be a relative path or a fully-qualified path.
+        ///   The item added by this call to the <c>ZipFile</c> is not read from the
+        ///   disk nor written to the zip file archive until the application calls
+        ///   Save() on the <c>ZipFile</c>.
+        /// </para>
+        ///
+        /// <para>
+        ///   This version of the method allows the caller to explicitly specify the
+        ///   directory path to be used in the archive, which would override the
+        ///   "natural" path of the filesystem file.
+        /// </para>
+        ///
+        /// <para>
+        ///   Encryption will be used on the file data if the <c>Password</c> has
+        ///   been set on the <c>ZipFile</c> object, prior to calling this method.
+        /// </para>
+        ///
+        /// <para>
+        ///   For <c>ZipFile</c> properties including <see cref="Encryption"/>, <see
+        ///   cref="Password"/>, <see cref="SetCompression"/>, <see
+        ///   cref="ProvisionalAlternateEncoding"/>, <see cref="ExtractExistingFile"/>,
+        ///   <see cref="ZipErrorAction"/>, and <see cref="CompressionLevel"/>, their
+        ///   respective values at the time of this call will be applied to the
+        ///   <c>ZipEntry</c> added.
+        /// </para>
+        ///
+        /// </remarks>
+        ///
+        /// <exception cref="System.IO.FileNotFoundException">
+        ///   Thrown if the file or directory passed in does not exist.
+        /// </exception>
+        ///
+        /// <param name="fileOrDirectoryName">the name of the file or directory to add.
+        /// </param>
+        ///
+        /// <param name="directoryPathInArchive">
+        ///   The name of the directory path to use within the zip archive.  This path
+        ///   need not refer to an extant directory in the current filesystem.  If the
+        ///   files within the zip are later extracted, this is the path used for the
+        ///   extracted file.  Passing <c>null</c> (<c>Nothing</c> in VB) will use the
+        ///   path on the fileOrDirectoryName.  Passing the empty string ("") will
+        ///   insert the item at the root path within the archive.
+        /// </param>
+        ///
+        /// <seealso cref="Ionic.Zip.ZipFile.AddFile(string, string)"/>
+        /// <seealso cref="Ionic.Zip.ZipFile.AddDirectory(string, string)"/>
+        /// <seealso cref="Ionic.Zip.ZipFile.UpdateItem(string, string)"/>
+        ///
+        /// <example>
+        ///   This example shows how to zip up a set of files into a flat hierarchy,
+        ///   regardless of where in the filesystem the files originated. The resulting
+        ///   zip archive will contain a toplevel directory named "flat", which itself
+        ///   will contain files Readme.txt, MyProposal.docx, and Image1.jpg.  A
+        ///   subdirectory under "flat" called SupportFiles will contain all the files
+        ///   in the "c:\SupportFiles" directory on disk.
+        ///
+        /// <code>
+        /// String[] itemnames= {
+        ///   "c:\\fixedContent\\Readme.txt",
+        ///   "MyProposal.docx",
+        ///   "c:\\SupportFiles",  // a directory
+        ///   "images\\Image1.jpg"
+        /// };
+        ///
+        /// try
+        /// {
+        ///   using (ZipFile zip = new ZipFile())
+        ///   {
+        ///     for (int i = 1; i &lt; itemnames.Length; i++)
+        ///     {
+        ///       // will add Files or Dirs, recurses and flattens subdirectories
+        ///       zip.AddItem(itemnames[i],"flat");
+        ///     }
+        ///     zip.Save(ZipToCreate);
+        ///   }
+        /// }
+        /// catch (System.Exception ex1)
+        /// {
+        ///   System.Console.Error.WriteLine("exception: {0}", ex1);
+        /// }
+        /// </code>
+        ///
+        /// <code lang="VB">
+        ///   Dim itemnames As String() = _
+        ///     New String() { "c:\fixedContent\Readme.txt", _
+        ///                    "MyProposal.docx", _
+        ///                    "SupportFiles", _
+        ///                    "images\Image1.jpg" }
+        ///   Try
+        ///       Using zip As New ZipFile
+        ///           Dim i As Integer
+        ///           For i = 1 To itemnames.Length - 1
+        ///               ' will add Files or Dirs, recursing and flattening subdirectories.
+        ///               zip.AddItem(itemnames(i), "flat")
+        ///           Next i
+        ///           zip.Save(ZipToCreate)
+        ///       End Using
+        ///   Catch ex1 As Exception
+        ///       Console.Error.WriteLine("exception: {0}", ex1.ToString())
+        ///   End Try
+        /// </code>
+        /// </example>
+        /// <returns>The <c>ZipEntry</c> added.</returns>
+        public ZipEntry AddItem(String fileOrDirectoryName, String directoryPathInArchive)
+        {
+            if (File.Exists(fileOrDirectoryName))
+                return AddFile(fileOrDirectoryName, directoryPathInArchive);
+
+            if (Directory.Exists(fileOrDirectoryName))
+                return AddDirectory(fileOrDirectoryName, directoryPathInArchive);
+
+            throw new FileNotFoundException(String.Format("That file or directory ({0}) does not exist!",
+                                                          fileOrDirectoryName));
+        }
+
+        /// <summary>
+        ///   Adds a File to a Zip file archive.
+        /// </summary>
+        /// <remarks>
+        ///
+        /// <para>
+        ///   This call collects metadata for the named file in the filesystem,
+        ///   including the file attributes and the timestamp, and inserts that metadata
+        ///   into the resulting ZipEntry.  Only when the application calls Save() on
+        ///   the <c>ZipFile</c>, does DotNetZip read the file from the filesystem and
+        ///   then write the content to the zip file archive.
+        /// </para>
+        ///
+        /// <para>
+        ///   This method will throw an exception if an entry with the same name already
+        ///   exists in the <c>ZipFile</c>.
+        /// </para>
+        ///
+        /// <para>
+        ///   For <c>ZipFile</c> properties including <see cref="Encryption"/>, <see
+        ///   cref="Password"/>, <see cref="SetCompression"/>, <see
+        ///   cref="ProvisionalAlternateEncoding"/>, <see cref="ExtractExistingFile"/>,
+        ///   <see cref="ZipErrorAction"/>, and <see cref="CompressionLevel"/>, their
+        ///   respective values at the time of this call will be applied to the
+        ///   <c>ZipEntry</c> added.
+        /// </para>
+        ///
+        /// </remarks>
+        ///
+        /// <example>
+        /// <para>
+        ///   In this example, three files are added to a Zip archive. The ReadMe.txt
+        ///   file will be placed in the root of the archive. The .png file will be
+        ///   placed in a folder within the zip called photos\personal.  The pdf file
+        ///   will be included into a folder within the zip called Desktop.
+        /// </para>
+        /// <code>
+        ///    try
+        ///    {
+        ///      using (ZipFile zip = new ZipFile())
+        ///      {
+        ///        zip.AddFile("c:\\photos\\personal\\7440-N49th.png");
+        ///        zip.AddFile("c:\\Desktop\\2008-Regional-Sales-Report.pdf");
+        ///        zip.AddFile("ReadMe.txt");
+        ///
+        ///        zip.Save("Package.zip");
+        ///      }
+        ///    }
+        ///    catch (System.Exception ex1)
+        ///    {
+        ///      System.Console.Error.WriteLine("exception: " + ex1);
+        ///    }
+        /// </code>
+        ///
+        /// <code lang="VB">
+        ///  Try
+        ///       Using zip As ZipFile = New ZipFile
+        ///           zip.AddFile("c:\photos\personal\7440-N49th.png")
+        ///           zip.AddFile("c:\Desktop\2008-Regional-Sales-Report.pdf")
+        ///           zip.AddFile("ReadMe.txt")
+        ///           zip.Save("Package.zip")
+        ///       End Using
+        ///   Catch ex1 As Exception
+        ///       Console.Error.WriteLine("exception: {0}", ex1.ToString)
+        ///   End Try
+        /// </code>
+        /// </example>
+        ///
+        /// <overloads>This method has two overloads.</overloads>
+        ///
+        /// <seealso cref="Ionic.Zip.ZipFile.AddItem(string)"/>
+        /// <seealso cref="Ionic.Zip.ZipFile.AddDirectory(string)"/>
+        /// <seealso cref="Ionic.Zip.ZipFile.UpdateFile(string)"/>
+        ///
+        /// <param name="fileName">
+        ///   The name of the file to add. It should refer to a file in the filesystem.
+        ///   The name of the file may be a relative path or a fully-qualified path.
+        /// </param>
+        /// <returns>The <c>ZipEntry</c> corresponding to the File added.</returns>
+        public ZipEntry AddFile(string fileName)
+        {
+            return AddFile(fileName, null);
+        }
+
+
+
+
+
+        /// <summary>
+        ///   Adds a File to a Zip file archive, potentially overriding the path to be
+        ///   used within the zip archive.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   The file added by this call to the <c>ZipFile</c> is not written to the
+        ///   zip file archive until the application calls Save() on the <c>ZipFile</c>.
+        /// </para>
+        ///
+        /// <para>
+        ///   This method will throw an exception if an entry with the same name already
+        ///   exists in the <c>ZipFile</c>.
+        /// </para>
+        ///
+        /// <para>
+        ///   This version of the method allows the caller to explicitly specify the
+        ///   directory path to be used in the archive.
+        /// </para>
+        ///
+        /// <para>
+        ///   For <c>ZipFile</c> properties including <see cref="Encryption"/>, <see
+        ///   cref="Password"/>, <see cref="SetCompression"/>, <see
+        ///   cref="ProvisionalAlternateEncoding"/>, <see cref="ExtractExistingFile"/>,
+        ///   <see cref="ZipErrorAction"/>, and <see cref="CompressionLevel"/>, their
+        ///   respective values at the time of this call will be applied to the
+        ///   <c>ZipEntry</c> added.
+        /// </para>
+        ///
+        /// </remarks>
+        ///
+        /// <example>
+        /// <para>
+        ///   In this example, three files are added to a Zip archive. The ReadMe.txt
+        ///   file will be placed in the root of the archive. The .png file will be
+        ///   placed in a folder within the zip called images.  The pdf file will be
+        ///   included into a folder within the zip called files\docs, and will be
+        ///   encrypted with the given password.
+        /// </para>
+        /// <code>
+        /// try
+        /// {
+        ///   using (ZipFile zip = new ZipFile())
+        ///   {
+        ///     // the following entry will be inserted at the root in the archive.
+        ///     zip.AddFile("c:\\datafiles\\ReadMe.txt", "");
+        ///     // this image file will be inserted into the "images" directory in the archive.
+        ///     zip.AddFile("c:\\photos\\personal\\7440-N49th.png", "images");
+        ///     // the following will result in a password-protected file called
+        ///     // files\\docs\\2008-Regional-Sales-Report.pdf  in the archive.
+        ///     zip.Password = "EncryptMe!";
+        ///     zip.AddFile("c:\\Desktop\\2008-Regional-Sales-Report.pdf", "files\\docs");
+        ///     zip.Save("Archive.zip");
+        ///   }
+        /// }
+        /// catch (System.Exception ex1)
+        /// {
+        ///   System.Console.Error.WriteLine("exception: {0}", ex1);
+        /// }
+        /// </code>
+        ///
+        /// <code lang="VB">
+        ///   Try
+        ///       Using zip As ZipFile = New ZipFile
+        ///           ' the following entry will be inserted at the root in the archive.
+        ///           zip.AddFile("c:\datafiles\ReadMe.txt", "")
+        ///           ' this image file will be inserted into the "images" directory in the archive.
+        ///           zip.AddFile("c:\photos\personal\7440-N49th.png", "images")
+        ///           ' the following will result in a password-protected file called
+        ///           ' files\\docs\\2008-Regional-Sales-Report.pdf  in the archive.
+        ///           zip.Password = "EncryptMe!"
+        ///           zip.AddFile("c:\Desktop\2008-Regional-Sales-Report.pdf", "files\documents")
+        ///           zip.Save("Archive.zip")
+        ///       End Using
+        ///   Catch ex1 As Exception
+        ///       Console.Error.WriteLine("exception: {0}", ex1)
+        ///   End Try
+        /// </code>
+        /// </example>
+        ///
+        /// <seealso cref="Ionic.Zip.ZipFile.AddItem(string,string)"/>
+        /// <seealso cref="Ionic.Zip.ZipFile.AddDirectory(string, string)"/>
+        /// <seealso cref="Ionic.Zip.ZipFile.UpdateFile(string,string)"/>
+        ///
+        /// <param name="fileName">
+        ///   The name of the file to add.  The name of the file may be a relative path
+        ///   or a fully-qualified path.
+        /// </param>
+        ///
+        /// <param name="directoryPathInArchive">
+        ///   Specifies a directory path to use to override any path in the fileName.
+        ///   This path may, or may not, correspond to a real directory in the current
+        ///   filesystem.  If the files within the zip are later extracted, this is the
+        ///   path used for the extracted file.  Passing <c>null</c> (<c>Nothing</c> in
+        ///   VB) will use the path on the fileName, if any.  Passing the empty string
+        ///   ("") will insert the item at the root path within the archive.
+        /// </param>
+        ///
+        /// <returns>The <c>ZipEntry</c> corresponding to the file added.</returns>
+        public ZipEntry AddFile(string fileName, String directoryPathInArchive)
+        {
+            string nameInArchive = ZipEntry.NameInArchive(fileName, directoryPathInArchive);
+            ZipEntry ze = ZipEntry.CreateFromFile(fileName, nameInArchive);
+            if (Verbose) StatusMessageTextWriter.WriteLine("adding {0}...", fileName);
+            return _InternalAddEntry(ze);
+        }
+
+
+        /// <summary>
+        ///   This method removes a collection of entries from the <c>ZipFile</c>.
+        /// </summary>
+        ///
+        /// <param name="entriesToRemove">
+        ///   A collection of ZipEntry instances from this zip file to be removed. For
+        ///   example, you can pass in an array of ZipEntry instances; or you can call
+        ///   SelectEntries(), and then add or remove entries from that
+        ///   ICollection&lt;ZipEntry&gt; (ICollection(Of ZipEntry) in VB), and pass
+        ///   that ICollection to this method.
+        /// </param>
+        ///
+        /// <seealso cref="Ionic.Zip.ZipFile.SelectEntries(String)" />
+        /// <seealso cref="Ionic.Zip.ZipFile.RemoveSelectedEntries(String)" />
+        public void RemoveEntries(System.Collections.Generic.ICollection<ZipEntry> entriesToRemove)
+        {
+            if (entriesToRemove == null)
+                throw new ArgumentNullException("entriesToRemove");
+
+            foreach (ZipEntry e in entriesToRemove)
+            {
+                this.RemoveEntry(e);
+            }
+        }
+
+
+        /// <summary>
+        ///   This method removes a collection of entries from the <c>ZipFile</c>, by name.
+        /// </summary>
+        ///
+        /// <param name="entriesToRemove">
+        ///   A collection of strings that refer to names of entries to be removed
+        ///   from the <c>ZipFile</c>.  For example, you can pass in an array or a
+        ///   List of Strings that provide the names of entries to be removed.
+        /// </param>
+        ///
+        /// <seealso cref="Ionic.Zip.ZipFile.SelectEntries(String)" />
+        /// <seealso cref="Ionic.Zip.ZipFile.RemoveSelectedEntries(String)" />
+        public void RemoveEntries(System.Collections.Generic.ICollection<String> entriesToRemove)
+        {
+            if (entriesToRemove == null)
+                throw new ArgumentNullException("entriesToRemove");
+
+            foreach (String e in entriesToRemove)
+            {
+                this.RemoveEntry(e);
+            }
+        }
+
+
+        /// <summary>
+        ///   This method adds a set of files to the <c>ZipFile</c>.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   Use this method to add a set of files to the zip archive, in one call.
+        ///   For example, a list of files received from
+        ///   <c>System.IO.Directory.GetFiles()</c> can be added to a zip archive in one
+        ///   call.
+        /// </para>
+        ///
+        /// <para>
+        ///   For <c>ZipFile</c> properties including <see cref="Encryption"/>, <see
+        ///   cref="Password"/>, <see cref="SetCompression"/>, <see
+        ///   cref="ProvisionalAlternateEncoding"/>, <see cref="ExtractExistingFile"/>,
+        ///   <see cref="ZipErrorAction"/>, and <see cref="CompressionLevel"/>, their
+        ///   respective values at the time of this call will be applied to each
+        ///   ZipEntry added.
+        /// </para>
+        /// </remarks>
+        ///
+        /// <param name="fileNames">
+        ///   The collection of names of the files to add. Each string should refer to a
+        ///   file in the filesystem. The name of the file may be a relative path or a
+        ///   fully-qualified path.
+        /// </param>
+        ///
+        /// <example>
+        ///   This example shows how to create a zip file, and add a few files into it.
+        /// <code>
+        /// String ZipFileToCreate = "archive1.zip";
+        /// String DirectoryToZip = "c:\\reports";
+        /// using (ZipFile zip = new ZipFile())
+        /// {
+        ///   // Store all files found in the top level directory, into the zip archive.
+        ///   String[] filenames = System.IO.Directory.GetFiles(DirectoryToZip);
+        ///   zip.AddFiles(filenames);
+        ///   zip.Save(ZipFileToCreate);
+        /// }
+        /// </code>
+        ///
+        /// <code lang="VB">
+        /// Dim ZipFileToCreate As String = "archive1.zip"
+        /// Dim DirectoryToZip As String = "c:\reports"
+        /// Using zip As ZipFile = New ZipFile
+        ///     ' Store all files found in the top level directory, into the zip archive.
+        ///     Dim filenames As String() = System.IO.Directory.GetFiles(DirectoryToZip)
+        ///     zip.AddFiles(filenames)
+        ///     zip.Save(ZipFileToCreate)
+        /// End Using
+        /// </code>
+        /// </example>
+        ///
+        /// <seealso cref="Ionic.Zip.ZipFile.AddSelectedFiles(String, String)" />
+        public void AddFiles(System.Collections.Generic.IEnumerable<String> fileNames)
+        {
+            this.AddFiles(fileNames, null);
+        }
+
+
+        /// <summary>
+        ///   Adds or updates a set of files in the <c>ZipFile</c>.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   Any files that already exist in the archive are updated. Any files that
+        ///   don't yet exist in the archive are added.
+        /// </para>
+        ///
+        /// <para>
+        ///   For <c>ZipFile</c> properties including <see cref="Encryption"/>, <see
+        ///   cref="Password"/>, <see cref="SetCompression"/>, <see
+        ///   cref="ProvisionalAlternateEncoding"/>, <see cref="ExtractExistingFile"/>,
+        ///   <see cref="ZipErrorAction"/>, and <see cref="CompressionLevel"/>, their
+        ///   respective values at the time of this call will be applied to each
+        ///   ZipEntry added.
+        /// </para>
+        /// </remarks>
+        ///
+        /// <param name="fileNames">
+        ///   The collection of names of the files to update. Each string should refer to a file in
+        ///   the filesystem. The name of the file may be a relative path or a fully-qualified path.
+        /// </param>
+        ///
+        public void UpdateFiles(System.Collections.Generic.IEnumerable<String> fileNames)
+        {
+            this.UpdateFiles(fileNames, null);
+        }
+
+
+        /// <summary>
+        ///   Adds a set of files to the <c>ZipFile</c>, using the
+        ///   specified directory path in the archive.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   Any directory structure that may be present in the
+        ///   filenames contained in the list is "flattened" in the
+        ///   archive.  Each file in the list is added to the archive in
+        ///   the specified top-level directory.
+        /// </para>
+        ///
+        /// <para>
+        ///   For <c>ZipFile</c> properties including <see
+        ///   cref="Encryption"/>, <see cref="Password"/>, <see
+        ///   cref="SetCompression"/>, <see
+        ///   cref="ProvisionalAlternateEncoding"/>, <see
+        ///   cref="ExtractExistingFile"/>, <see
+        ///   cref="ZipErrorAction"/>, and <see
+        ///   cref="CompressionLevel"/>, their respective values at the
+        ///   time of this call will be applied to each ZipEntry added.
+        /// </para>
+        /// </remarks>
+        ///
+        /// <param name="fileNames">
+        ///   The names of the files to add. Each string should refer to
+        ///   a file in the filesystem.  The name of the file may be a
+        ///   relative path or a fully-qualified path.
+        /// </param>
+        ///
+        /// <param name="directoryPathInArchive">
+        ///   Specifies a directory path to use to override any path in the file name.
+        ///   Th is path may, or may not, correspond to a real directory in the current
+        ///   filesystem.  If the files within the zip are later extracted, this is the
+        ///   path used for the extracted file.  Passing <c>null</c> (<c>Nothing</c> in
+        ///   VB) will use the path on each of the <c>fileNames</c>, if any.  Passing
+        ///   the empty string ("") will insert the item at the root path within the
+        ///   archive.
+        /// </param>
+        ///
+        /// <seealso cref="Ionic.Zip.ZipFile.AddSelectedFiles(String, String)" />
+        public void AddFiles(System.Collections.Generic.IEnumerable<String> fileNames, String directoryPathInArchive)
+        {
+            AddFiles(fileNames, false, directoryPathInArchive);
+        }
+
+
+
+        /// <summary>
+        ///   Adds a set of files to the <c>ZipFile</c>, using the specified directory
+        ///   path in the archive, and preserving the full directory structure in the
+        ///   filenames.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///
+        /// <para>
+        ///   Think of the <paramref name="directoryPathInArchive"/> as a "root" or
+        ///   base directory used in the archive for the files that get added.  when
+        ///   <paramref name="preserveDirHierarchy"/> is true, the hierarchy of files
+        ///   found in the filesystem will be placed, with the hierarchy intact,
+        ///   starting at that root in the archive. When <c>preserveDirHierarchy</c>
+        ///   is false, the path hierarchy of files is flattned, and the flattened
+        ///   set of files gets placed in the root within the archive as specified in
+        ///   <c>directoryPathInArchive</c>.
+        /// </para>
+        ///
+        /// <para>
+        ///   For <c>ZipFile</c> properties including <see cref="Encryption"/>, <see
+        ///   cref="Password"/>, <see cref="SetCompression"/>, <see
+        ///   cref="ProvisionalAlternateEncoding"/>, <see cref="ExtractExistingFile"/>,
+        ///   <see cref="ZipErrorAction"/>, and <see cref="CompressionLevel"/>, their
+        ///   respective values at the time of this call will be applied to each
+        ///   ZipEntry added.
+        /// </para>
+        ///
+        /// </remarks>
+        ///
+        /// <param name="fileNames">
+        ///   The names of the files to add. Each string should refer to a file in the
+        ///   filesystem.  The name of the file may be a relative path or a
+        ///   fully-qualified path.
+        /// </param>
+        ///
+        /// <param name="directoryPathInArchive">
+        ///   Specifies a directory path to use as a prefix for each entry name.
+        ///   This path may, or may not, correspond to a real directory in the current
+        ///   filesystem.  If the files within the zip are later extracted, this is the
+        ///   path used for the extracted file.  Passing <c>null</c> (<c>Nothing</c> in
+        ///   VB) will use the path on each of the <c>fileNames</c>, if any.  Passing
+        ///   the empty string ("") will insert the item at the root path within the
+        ///   archive.
+        /// </param>
+        ///
+        /// <param name="preserveDirHierarchy">
+        ///   whether the entries in the zip archive will reflect the directory
+        ///   hierarchy that is present in the various filenames.  For example, if
+        ///   <paramref name="fileNames"/> includes two paths,
+        ///   \Animalia\Chordata\Mammalia\Info.txt and
+        ///   \Plantae\Magnoliophyta\Dicotyledon\Info.txt, then calling this method
+        ///   with <paramref name="preserveDirHierarchy"/> = <c>false</c> will
+        ///   result in an exception because of a duplicate entry name, while
+        ///   calling this method with <paramref name="preserveDirHierarchy"/> =
+        ///   <c>true</c> will result in the full direcory paths being included in
+        ///   the entries added to the ZipFile.
+        /// </param>
+        /// <seealso cref="Ionic.Zip.ZipFile.AddSelectedFiles(String, String)" />
+        public void AddFiles(System.Collections.Generic.IEnumerable<String> fileNames,
+                             bool preserveDirHierarchy,
+                             String directoryPathInArchive)
+        {
+            if (fileNames == null)
+                throw new ArgumentNullException("fileNames");
+
+            _addOperationCanceled = false;
+            OnAddStarted();
+            if (preserveDirHierarchy)
+            {
+                foreach (var f in fileNames)
+                {
+                    if (_addOperationCanceled) break;
+                    if (directoryPathInArchive != null)
+                    {
+                        //string s = SharedUtilities.NormalizePath(Path.Combine(directoryPathInArchive, Path.GetDirectoryName(f)));
+                        string s = Path.GetFullPath(Path.Combine(directoryPathInArchive, Path.GetDirectoryName(f)));
+                        this.AddFile(f, s);
+                    }
+                    else
+                        this.AddFile(f, null);
+                }
+            }
+            else
+            {
+                foreach (var f in fileNames)
+                {
+                    if (_addOperationCanceled) break;
+                    this.AddFile(f, directoryPathInArchive);
+                }
+            }
+            if (!_addOperationCanceled)
+                OnAddCompleted();
+        }
+
+
+        /// <summary>
+        ///   Adds or updates a set of files to the <c>ZipFile</c>, using the specified
+        ///   directory path in the archive.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///
+        /// <para>
+        ///   Any files that already exist in the archive are updated. Any files that
+        ///   don't yet exist in the archive are added.
+        /// </para>
+        ///
+        /// <para>
+        ///   For <c>ZipFile</c> properties including <see cref="Encryption"/>, <see
+        ///   cref="Password"/>, <see cref="SetCompression"/>, <see
+        ///   cref="ProvisionalAlternateEncoding"/>, <see cref="ExtractExistingFile"/>,
+        ///   <see cref="ZipErrorAction"/>, and <see cref="CompressionLevel"/>, their
+        ///   respective values at the time of this call will be applied to each
+        ///   ZipEntry added.
+        /// </para>
+        /// </remarks>
+        ///
+        /// <param name="fileNames">
+        ///   The names of the files to add or update. Each string should refer to a
+        ///   file in the filesystem.  The name of the file may be a relative path or a
+        ///   fully-qualified path.
+        /// </param>
+        ///
+        /// <param name="directoryPathInArchive">
+        ///   Specifies a directory path to use to override any path in the file name.
+        ///   This path may, or may not, correspond to a real directory in the current
+        ///   filesystem.  If the files within the zip are later extracted, this is the
+        ///   path used for the extracted file.  Passing <c>null</c> (<c>Nothing</c> in
+        ///   VB) will use the path on each of the <c>fileNames</c>, if any.  Passing
+        ///   the empty string ("") will insert the item at the root path within the
+        ///   archive.
+        /// </param>
+        ///
+        /// <seealso cref="Ionic.Zip.ZipFile.AddSelectedFiles(String, String)" />
+        public void UpdateFiles(System.Collections.Generic.IEnumerable<String> fileNames, String directoryPathInArchive)
+        {
+            if (fileNames == null)
+                throw new ArgumentNullException("fileNames");
+
+            OnAddStarted();
+            foreach (var f in fileNames)
+                this.UpdateFile(f, directoryPathInArchive);
+            OnAddCompleted();
+        }
+
+
+
+
+        /// <summary>
+        ///   Adds or Updates a File in a Zip file archive.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   This method adds a file to a zip archive, or, if the file already exists
+        ///   in the zip archive, this method Updates the content of that given filename
+        ///   in the zip archive.  The <c>UpdateFile</c> method might more accurately be
+        ///   called "AddOrUpdateFile".
+        /// </para>
+        ///
+        /// <para>
+        ///   Upon success, there is no way for the application to learn whether the file
+        ///   was added versus updated.
+        /// </para>
+        ///
+        /// <para>
+        ///   For <c>ZipFile</c> properties including <see cref="Encryption"/>, <see
+        ///   cref="Password"/>, <see cref="SetCompression"/>, <see
+        ///   cref="ProvisionalAlternateEncoding"/>, <see cref="ExtractExistingFile"/>,
+        ///   <see cref="ZipErrorAction"/>, and <see cref="CompressionLevel"/>, their
+        ///   respective values at the time of this call will be applied to the
+        ///   <c>ZipEntry</c> added.
+        /// </para>
+        /// </remarks>
+        ///
+        /// <example>
+        ///
+        ///   This example shows how to Update an existing entry in a zipfile. The first
+        ///   call to UpdateFile adds the file to the newly-created zip archive.  The
+        ///   second call to UpdateFile updates the content for that file in the zip
+        ///   archive.
+        ///
+        /// <code>
+        /// using (ZipFile zip1 = new ZipFile())
+        /// {
+        ///   // UpdateFile might more accurately be called "AddOrUpdateFile"
+        ///   zip1.UpdateFile("MyDocuments\\Readme.txt");
+        ///   zip1.UpdateFile("CustomerList.csv");
+        ///   zip1.Comment = "This zip archive has been created.";
+        ///   zip1.Save("Content.zip");
+        /// }
+        ///
+        /// using (ZipFile zip2 = ZipFile.Read("Content.zip"))
+        /// {
+        ///   zip2.UpdateFile("Updates\\Readme.txt");
+        ///   zip2.Comment = "This zip archive has been updated: The Readme.txt file has been changed.";
+        ///   zip2.Save();
+        /// }
+        ///
+        /// </code>
+        /// <code lang="VB">
+        ///   Using zip1 As New ZipFile
+        ///       ' UpdateFile might more accurately be called "AddOrUpdateFile"
+        ///       zip1.UpdateFile("MyDocuments\Readme.txt")
+        ///       zip1.UpdateFile("CustomerList.csv")
+        ///       zip1.Comment = "This zip archive has been created."
+        ///       zip1.Save("Content.zip")
+        ///   End Using
+        ///
+        ///   Using zip2 As ZipFile = ZipFile.Read("Content.zip")
+        ///       zip2.UpdateFile("Updates\Readme.txt")
+        ///       zip2.Comment = "This zip archive has been updated: The Readme.txt file has been changed."
+        ///       zip2.Save
+        ///   End Using
+        /// </code>
+        /// </example>
+        ///
+        /// <seealso cref="Ionic.Zip.ZipFile.AddFile(string)"/>
+        /// <seealso cref="Ionic.Zip.ZipFile.UpdateDirectory(string)"/>
+        /// <seealso cref="Ionic.Zip.ZipFile.UpdateItem(string)"/>
+        ///
+        /// <param name="fileName">
+        ///   The name of the file to add or update. It should refer to a file in the
+        ///   filesystem.  The name of the file may be a relative path or a
+        ///   fully-qualified path.
+        /// </param>
+        ///
+        /// <returns>
+        ///   The <c>ZipEntry</c> corresponding to the File that was added or updated.
+        /// </returns>
+        public ZipEntry UpdateFile(string fileName)
+        {
+            return UpdateFile(fileName, null);
+        }
+
+
+
+        /// <summary>
+        ///   Adds or Updates a File in a Zip file archive.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   This method adds a file to a zip archive, or, if the file already exists
+        ///   in the zip archive, this method Updates the content of that given filename
+        ///   in the zip archive.
+        /// </para>
+        ///
+        /// <para>
+        ///   This version of the method allows the caller to explicitly specify the
+        ///   directory path to be used in the archive.  The entry to be added or
+        ///   updated is found by using the specified directory path, combined with the
+        ///   basename of the specified filename.
+        /// </para>
+        ///
+        /// <para>
+        ///   Upon success, there is no way for the application to learn if the file was
+        ///   added versus updated.
+        /// </para>
+        ///
+        /// <para>
+        ///   For <c>ZipFile</c> properties including <see cref="Encryption"/>, <see
+        ///   cref="Password"/>, <see cref="SetCompression"/>, <see
+        ///   cref="ProvisionalAlternateEncoding"/>, <see cref="ExtractExistingFile"/>,
+        ///   <see cref="ZipErrorAction"/>, and <see cref="CompressionLevel"/>, their
+        ///   respective values at the time of this call will be applied to the
+        ///   <c>ZipEntry</c> added.
+        /// </para>
+        /// </remarks>
+        ///
+        /// <seealso cref="Ionic.Zip.ZipFile.AddFile(string,string)"/>
+        /// <seealso cref="Ionic.Zip.ZipFile.UpdateDirectory(string,string)"/>
+        /// <seealso cref="Ionic.Zip.ZipFile.UpdateItem(string,string)"/>
+        ///
+        /// <param name="fileName">
+        ///   The name of the file to add or update. It should refer to a file in the
+        ///   filesystem.  The name of the file may be a relative path or a
+        ///   fully-qualified path.
+        /// </param>
+        ///
+        /// <param name="directoryPathInArchive">
+        ///   Specifies a directory path to use to override any path in the
+        ///   <c>fileName</c>.  This path may, or may not, correspond to a real
+        ///   directory in the current filesystem.  If the files within the zip are
+        ///   later extracted, this is the path used for the extracted file.  Passing
+        ///   <c>null</c> (<c>Nothing</c> in VB) will use the path on the
+        ///   <c>fileName</c>, if any.  Passing the empty string ("") will insert the
+        ///   item at the root path within the archive.
+        /// </param>
+        ///
+        /// <returns>
+        ///   The <c>ZipEntry</c> corresponding to the File that was added or updated.
+        /// </returns>
+        public ZipEntry UpdateFile(string fileName, String directoryPathInArchive)
+        {
+            // ideally this would all be transactional!
+            var key = ZipEntry.NameInArchive(fileName, directoryPathInArchive);
+            if (this[key] != null)
+                this.RemoveEntry(key);
+            return this.AddFile(fileName, directoryPathInArchive);
+        }
+
+
+
+
+
+        /// <summary>
+        ///   Add or update a directory in a zip archive.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///   If the specified directory does not exist in the archive, then this method
+        ///   is equivalent to calling <c>AddDirectory()</c>.  If the specified
+        ///   directory already exists in the archive, then this method updates any
+        ///   existing entries, and adds any new entries. Any entries that are in the
+        ///   zip archive but not in the specified directory, are left alone.  In other
+        ///   words, the contents of the zip file will be a union of the previous
+        ///   contents and the new files.
+        /// </remarks>
+        ///
+        /// <seealso cref="Ionic.Zip.ZipFile.UpdateFile(string)"/>
+        /// <seealso cref="Ionic.Zip.ZipFile.AddDirectory(string)"/>
+        /// <seealso cref="Ionic.Zip.ZipFile.UpdateItem(string)"/>
+        ///
+        /// <param name="directoryName">
+        ///   The path to the directory to be added to the zip archive, or updated in
+        ///   the zip archive.
+        /// </param>
+        ///
+        /// <returns>
+        /// The <c>ZipEntry</c> corresponding to the Directory that was added or updated.
+        /// </returns>
+        public ZipEntry UpdateDirectory(string directoryName)
+        {
+            return UpdateDirectory(directoryName, null);
+        }
+
+
+        /// <summary>
+        ///   Add or update a directory in the zip archive at the specified root
+        ///   directory in the archive.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///   If the specified directory does not exist in the archive, then this method
+        ///   is equivalent to calling <c>AddDirectory()</c>.  If the specified
+        ///   directory already exists in the archive, then this method updates any
+        ///   existing entries, and adds any new entries. Any entries that are in the
+        ///   zip archive but not in the specified directory, are left alone.  In other
+        ///   words, the contents of the zip file will be a union of the previous
+        ///   contents and the new files.
+        /// </remarks>
+        ///
+        /// <seealso cref="Ionic.Zip.ZipFile.UpdateFile(string,string)"/>
+        /// <seealso cref="Ionic.Zip.ZipFile.AddDirectory(string,string)"/>
+        /// <seealso cref="Ionic.Zip.ZipFile.UpdateItem(string,string)"/>
+        ///
+        /// <param name="directoryName">
+        ///   The path to the directory to be added to the zip archive, or updated
+        ///   in the zip archive.
+        /// </param>
+        ///
+        /// <param name="directoryPathInArchive">
+        ///   Specifies a directory path to use to override any path in the
+        ///   <c>directoryName</c>.  This path may, or may not, correspond to a real
+        ///   directory in the current filesystem.  If the files within the zip are
+        ///   later extracted, this is the path used for the extracted file.  Passing
+        ///   <c>null</c> (<c>Nothing</c> in VB) will use the path on the
+        ///   <c>directoryName</c>, if any.  Passing the empty string ("") will insert
+        ///   the item at the root path within the archive.
+        /// </param>
+        ///
+        /// <returns>
+        ///   The <c>ZipEntry</c> corresponding to the Directory that was added or updated.
+        /// </returns>
+        public ZipEntry UpdateDirectory(string directoryName, String directoryPathInArchive)
+        {
+            return this.AddOrUpdateDirectoryImpl(directoryName, directoryPathInArchive, AddOrUpdateAction.AddOrUpdate);
+        }
+
+
+
+
+
+        /// <summary>
+        ///   Add or update a file or directory in the zip archive.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   This is useful when the application is not sure or does not care if the
+        ///   item to be added is a file or directory, and does not know or does not
+        ///   care if the item already exists in the <c>ZipFile</c>. Calling this method
+        ///   is equivalent to calling <c>RemoveEntry()</c> if an entry by the same name
+        ///   already exists, followed calling by <c>AddItem()</c>.
+        /// </para>
+        ///
+        /// <para>
+        ///   For <c>ZipFile</c> properties including <see cref="Encryption"/>, <see
+        ///   cref="Password"/>, <see cref="SetCompression"/>, <see
+        ///   cref="ProvisionalAlternateEncoding"/>, <see cref="ExtractExistingFile"/>,
+        ///   <see cref="ZipErrorAction"/>, and <see cref="CompressionLevel"/>, their
+        ///   respective values at the time of this call will be applied to the
+        ///   <c>ZipEntry</c> added.
+        /// </para>
+        /// </remarks>
+        ///
+        /// <seealso cref="Ionic.Zip.ZipFile.AddItem(string)"/>
+        /// <seealso cref="Ionic.Zip.ZipFile.UpdateFile(string)"/>
+        /// <seealso cref="Ionic.Zip.ZipFile.UpdateDirectory(string)"/>
+        ///
+        /// <param name="itemName">
+        ///  the path to the file or directory to be added or updated.
+        /// </param>
+        public void UpdateItem(string itemName)
+        {
+            UpdateItem(itemName, null);
+        }
+
+
+        /// <summary>
+        ///   Add or update a file or directory.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   This method is useful when the application is not sure or does not care if
+        ///   the item to be added is a file or directory, and does not know or does not
+        ///   care if the item already exists in the <c>ZipFile</c>. Calling this method
+        ///   is equivalent to calling <c>RemoveEntry()</c>, if an entry by that name
+        ///   exists, and then calling <c>AddItem()</c>.
+        /// </para>
+        ///
+        /// <para>
+        ///   This version of the method allows the caller to explicitly specify the
+        ///   directory path to be used for the item being added to the archive.  The
+        ///   entry or entries that are added or updated will use the specified
+        ///   <c>DirectoryPathInArchive</c>. Extracting the entry from the archive will
+        ///   result in a file stored in that directory path.
+        /// </para>
+        ///
+        /// <para>
+        ///   For <c>ZipFile</c> properties including <see cref="Encryption"/>, <see
+        ///   cref="Password"/>, <see cref="SetCompression"/>, <see
+        ///   cref="ProvisionalAlternateEncoding"/>, <see cref="ExtractExistingFile"/>,
+        ///   <see cref="ZipErrorAction"/>, and <see cref="CompressionLevel"/>, their
+        ///   respective values at the time of this call will be applied to the
+        ///   <c>ZipEntry</c> added.
+        /// </para>
+        /// </remarks>
+        ///
+        /// <seealso cref="Ionic.Zip.ZipFile.AddItem(string, string)"/>
+        /// <seealso cref="Ionic.Zip.ZipFile.UpdateFile(string, string)"/>
+        /// <seealso cref="Ionic.Zip.ZipFile.UpdateDirectory(string, string)"/>
+        ///
+        /// <param name="itemName">
+        ///   The path for the File or Directory to be added or updated.
+        /// </param>
+        /// <param name="directoryPathInArchive">
+        ///   Specifies a directory path to use to override any path in the
+        ///   <c>itemName</c>.  This path may, or may not, correspond to a real
+        ///   directory in the current filesystem.  If the files within the zip are
+        ///   later extracted, this is the path used for the extracted file.  Passing
+        ///   <c>null</c> (<c>Nothing</c> in VB) will use the path on the
+        ///   <c>itemName</c>, if any.  Passing the empty string ("") will insert the
+        ///   item at the root path within the archive.
+        /// </param>
+        public void UpdateItem(string itemName, string directoryPathInArchive)
+        {
+            if (File.Exists(itemName))
+                UpdateFile(itemName, directoryPathInArchive);
+
+            else if (Directory.Exists(itemName))
+                UpdateDirectory(itemName, directoryPathInArchive);
+
+            else
+                throw new FileNotFoundException(String.Format("That file or directory ({0}) does not exist!", itemName));
+        }
+
+
+
+
+        /// <summary>
+        ///   Adds a named entry into the zip archive, taking content for the entry
+        ///   from a string.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///   Calling this method creates an entry using the given fileName and
+        ///   directory path within the archive.  There is no need for a file by the
+        ///   given name to exist in the filesystem; the name is used within the zip
+        ///   archive only. The content for the entry is encoded using the default text
+        ///   encoding for the machine, or on Silverlight, using UTF-8.
+        /// </remarks>
+        ///
+        /// <param name="content">
+        ///   The content of the file, should it be extracted from the zip.
+        /// </param>
+        ///
+        /// <param name="entryName">
+        ///   The name, including any path, to use for the entry within the archive.
+        /// </param>
+        ///
+        /// <returns>The <c>ZipEntry</c> added.</returns>
+        ///
+        /// <example>
+        ///
+        /// This example shows how to add an entry to the zipfile, using a string as
+        /// content for that entry.
+        ///
+        /// <code lang="C#">
+        /// string Content = "This string will be the content of the Readme.txt file in the zip archive.";
+        /// using (ZipFile zip1 = new ZipFile())
+        /// {
+        ///   zip1.AddFile("MyDocuments\\Resume.doc", "files");
+        ///   zip1.AddEntry("Readme.txt", Content);
+        ///   zip1.Comment = "This zip file was created at " + System.DateTime.Now.ToString("G");
+        ///   zip1.Save("Content.zip");
+        /// }
+        ///
+        /// </code>
+        /// <code lang="VB">
+        /// Public Sub Run()
+        ///   Dim Content As String = "This string will be the content of the Readme.txt file in the zip archive."
+        ///   Using zip1 As ZipFile = New ZipFile
+        ///     zip1.AddEntry("Readme.txt", Content)
+        ///     zip1.AddFile("MyDocuments\Resume.doc", "files")
+        ///     zip1.Comment = ("This zip file was created at " &amp; DateTime.Now.ToString("G"))
+        ///     zip1.Save("Content.zip")
+        ///   End Using
+        /// End Sub
+        /// </code>
+        /// </example>
+        public ZipEntry AddEntry(string entryName, string content)
+        {
+#if SILVERLIGHT
+            return AddEntry(entryName, content, System.Text.Encoding.UTF8);
+#else
+            return AddEntry(entryName, content, System.Text.Encoding.Default);
+#endif
+        }
+
+
+
+        /// <summary>
+        ///   Adds a named entry into the zip archive, taking content for the entry
+        ///   from a string, and using the specified text encoding.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///
+        /// <para>
+        ///   Calling this method creates an entry using the given fileName and
+        ///   directory path within the archive.  There is no need for a file by the
+        ///   given name to exist in the filesystem; the name is used within the zip
+        ///   archive only.
+        /// </para>
+        ///
+        /// <para>
+        ///   The content for the entry, a string value, is encoded using the given
+        ///   text encoding. A BOM (byte-order-mark) is emitted into the file, if the
+        ///   Encoding parameter is set for that.
+        /// </para>
+        ///
+        /// <para>
+        ///   Most Encoding classes support a constructor that accepts a boolean,
+        ///   indicating whether to emit a BOM or not. For example see <see
+        ///   cref="System.Text.UTF8Encoding(bool)"/>.
+        /// </para>
+        ///
+        /// </remarks>
+        ///
+        /// <param name="entryName">
+        ///   The name, including any path, to use within the archive for the entry.
+        /// </param>
+        ///
+        /// <param name="content">
+        ///   The content of the file, should it be extracted from the zip.
+        /// </param>
+        ///
+        /// <param name="encoding">
+        ///   The text encoding to use when encoding the string. Be aware: This is
+        ///   distinct from the text encoding used to encode the fileName, as specified
+        ///   in <see cref="ProvisionalAlternateEncoding" />.
+        /// </param>
+        ///
+        /// <returns>The <c>ZipEntry</c> added.</returns>
+        ///
+        public ZipEntry AddEntry(string entryName, string content, System.Text.Encoding encoding)
+        {
+            // cannot employ a using clause here.  We need the stream to
+            // persist after exit from this method.
+            var ms = new MemoryStream();
+
+            // cannot use a using clause here; StreamWriter takes
+            // ownership of the stream and Disposes it before we are ready.
+            var sw = new StreamWriter(ms, encoding);
+            sw.Write(content);
+            sw.Flush();
+
+            // reset to allow reading later
+            ms.Seek(0, SeekOrigin.Begin);
+
+            return AddEntry(entryName, ms);
+
+            // must not dispose the MemoryStream - it will be used later.
+        }
+
+
+        /// <summary>
+        ///   Create an entry in the <c>ZipFile</c> using the given <c>Stream</c>
+        ///   as input.  The entry will have the given filename.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///
+        /// <para>
+        ///   The application should provide an open, readable stream; in this case it
+        ///   will be read during the call to <see cref="ZipFile.Save()"/> or one of
+        ///   its overloads.
+        /// </para>
+        ///
+        /// <para>
+        ///   The passed stream will be read from its current position. If
+        ///   necessary, callers should set the position in the stream before
+        ///   calling AddEntry(). This might be appropriate when using this method
+        ///   with a MemoryStream, for example.
+        /// </para>
+        ///
+        /// <para>
+        ///   In cases where a large number of streams will be added to the
+        ///   <c>ZipFile</c>, the application may wish to avoid maintaining all of the
+        ///   streams open simultaneously.  To handle this situation, the application
+        ///   should use the <see cref="AddEntry(string, OpenDelegate, CloseDelegate)"/>
+        ///   overload.
+        /// </para>
+        ///
+        /// <para>
+        ///   For <c>ZipFile</c> properties including <see cref="Encryption"/>, <see
+        ///   cref="Password"/>, <see cref="SetCompression"/>, <see
+        ///   cref="ProvisionalAlternateEncoding"/>, <see cref="ExtractExistingFile"/>,
+        ///   <see cref="ZipErrorAction"/>, and <see cref="CompressionLevel"/>, their
+        ///   respective values at the time of this call will be applied to the
+        ///   <c>ZipEntry</c> added.
+        /// </para>
+        ///
+        /// </remarks>
+        ///
+        /// <example>
+        /// <para>
+        ///   This example adds a single entry to a <c>ZipFile</c> via a <c>Stream</c>.
+        /// </para>
+        ///
+        /// <code lang="C#">
+        /// String zipToCreate = "Content.zip";
+        /// String fileNameInArchive = "Content-From-Stream.bin";
+        /// using (System.IO.Stream streamToRead = MyStreamOpener())
+        /// {
+        ///   using (ZipFile zip = new ZipFile())
+        ///   {
+        ///     ZipEntry entry= zip.AddEntry(fileNameInArchive, streamToRead);
+        ///     zip.AddFile("Readme.txt");
+        ///     zip.Save(zipToCreate);  // the stream is read implicitly here
+        ///   }
+        /// }
+        /// </code>
+        ///
+        /// <code lang="VB">
+        /// Dim zipToCreate As String = "Content.zip"
+        /// Dim fileNameInArchive As String = "Content-From-Stream.bin"
+        /// Using streamToRead as System.IO.Stream = MyStreamOpener()
+        ///   Using zip As ZipFile = New ZipFile()
+        ///     Dim entry as ZipEntry = zip.AddEntry(fileNameInArchive, streamToRead)
+        ///     zip.AddFile("Readme.txt")
+        ///     zip.Save(zipToCreate)  '' the stream is read implicitly, here
+        ///   End Using
+        /// End Using
+        /// </code>
+        /// </example>
+        ///
+        /// <seealso cref="Ionic.Zip.ZipFile.UpdateEntry(string, System.IO.Stream)"/>
+        ///
+        /// <param name="entryName">
+        ///   The name, including any path, which is shown in the zip file for the added
+        ///   entry.
+        /// </param>
+        /// <param name="stream">
+        ///   The input stream from which to grab content for the file
+        /// </param>
+        /// <returns>The <c>ZipEntry</c> added.</returns>
+        public ZipEntry AddEntry(string entryName, Stream stream)
+        {
+            ZipEntry ze = ZipEntry.CreateForStream(entryName, stream);
+            ze.SetEntryTimes(DateTime.Now,DateTime.Now,DateTime.Now);
+            if (Verbose) StatusMessageTextWriter.WriteLine("adding {0}...", entryName);
+            return _InternalAddEntry(ze);
+        }
+
+
+
+        /// <summary>
+        ///   Add a ZipEntry for which content is written directly by the application.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   When the application needs to write the zip entry data, use this
+        ///   method to add the ZipEntry. For example, in the case that the
+        ///   application wishes to write the XML representation of a DataSet into
+        ///   a ZipEntry, the application can use this method to do so.
+        /// </para>
+        ///
+        /// <para>
+        ///   For <c>ZipFile</c> properties including <see cref="Encryption"/>, <see
+        ///   cref="Password"/>, <see cref="SetCompression"/>, <see
+        ///   cref="ProvisionalAlternateEncoding"/>, <see cref="ExtractExistingFile"/>,
+        ///   <see cref="ZipErrorAction"/>, and <see cref="CompressionLevel"/>, their
+        ///   respective values at the time of this call will be applied to the
+        ///   <c>ZipEntry</c> added.
+        /// </para>
+        ///
+        /// <para>
+        ///   About progress events: When using the WriteDelegate, DotNetZip does
+        ///   not issue any SaveProgress events with <c>EventType</c> = <see
+        ///   cref="ZipProgressEventType.Saving_EntryBytesRead">
+        ///   Saving_EntryBytesRead</see>. (This is because it is the
+        ///   application's code that runs in WriteDelegate - there's no way for
+        ///   DotNetZip to know when to issue a EntryBytesRead event.)
+        ///   Applications that want to update a progress bar or similar status
+        ///   indicator should do so from within the WriteDelegate
+        ///   itself. DotNetZip will issue the other SaveProgress events,
+        ///   including <see cref="ZipProgressEventType.Saving_Started">
+        ///   Saving_Started</see>,
+        ///   <see cref="ZipProgressEventType.Saving_BeforeWriteEntry">
+        ///   Saving_BeforeWriteEntry</see>, and <see
+        ///   cref="ZipProgressEventType.Saving_AfterWriteEntry">
+        ///   Saving_AfterWriteEntry</see>.
+        /// </para>
+        ///
+        /// <para>
+        ///   Note: When you use PKZip encryption, it's normally necessary to
+        ///   compute the CRC of the content to be encrypted, before compressing or
+        ///   encrypting it. Therefore, when using PKZip encryption with a
+        ///   WriteDelegate, the WriteDelegate CAN BE called twice: once to compute
+        ///   the CRC, and the second time to potentially compress and
+        ///   encrypt. Surprising, but true. This is because PKWARE specified that
+        ///   the encryption initialization data depends on the CRC.
+        ///   If this happens, for each call of the delegate, your
+        ///   application must stream the same entry data in its entirety. If your
+        ///   application writes different data during the second call, it will
+        ///   result in a corrupt zip file.
+        /// </para>
+        ///
+        /// <para>
+        ///   The double-read behavior happens with all types of entries, not only
+        ///   those that use WriteDelegate. It happens if you add an entry from a
+        ///   filesystem file, or using a string, or a stream, or an opener/closer
+        ///   pair. But in those cases, DotNetZip takes care of reading twice; in
+        ///   the case of the WriteDelegate, the application code gets invoked
+        ///   twice. Be aware.
+        /// </para>
+        ///
+        /// <para>
+        ///   As you can imagine, this can cause performance problems for large
+        ///   streams, and it can lead to correctness problems when you use a
+        ///   <c>WriteDelegate</c>. This is a pretty big pitfall.  There are two
+        ///   ways to avoid it.  First, and most preferred: don't use PKZIP
+        ///   encryption.  If you use the WinZip AES encryption, this problem
+        ///   doesn't occur, because the encryption protocol doesn't require the CRC
+        ///   up front. Second: if you do choose to use PKZIP encryption, write out
+        ///   to a non-seekable stream (like standard output, or the
+        ///   Response.OutputStream in an ASP.NET application).  In this case,
+        ///   DotNetZip will use an alternative encryption protocol that does not
+        ///   rely on the CRC of the content.  This also implies setting bit 3 in
+        ///   the zip entry, which still presents problems for some zip tools.
+        /// </para>
+        ///
+        /// <para>
+        ///   In the future I may modify DotNetZip to *always* use bit 3 when PKZIP
+        ///   encryption is in use.  This seems like a win overall, but there will
+        ///   be some work involved.  If you feel strongly about it, visit the
+        ///   DotNetZip forums and vote up <see
+        ///   href="http://dotnetzip.codeplex.com/workitem/13686">the Workitem
+        ///   tracking this issue</see>.
+        /// </para>
+        ///
+        /// </remarks>
+        ///
+        /// <param name="entryName">the name of the entry to add</param>
+        /// <param name="writer">the delegate which will write the entry content</param>
+        /// <returns>the ZipEntry added</returns>
+        ///
+        /// <example>
+        ///
+        ///   This example shows an application filling a DataSet, then saving the
+        ///   contents of that DataSet as XML, into a ZipEntry in a ZipFile, using an
+        ///   anonymous delegate in C#. The DataSet XML is never saved to a disk file.
+        ///
+        /// <code lang="C#">
+        /// var c1= new System.Data.SqlClient.SqlConnection(connstring1);
+        /// var da = new System.Data.SqlClient.SqlDataAdapter()
+        ///     {
+        ///         SelectCommand=  new System.Data.SqlClient.SqlCommand(strSelect, c1)
+        ///     };
+        ///
+        /// DataSet ds1 = new DataSet();
+        /// da.Fill(ds1, "Invoices");
+        ///
+        /// using(Ionic.Zip.ZipFile zip = new Ionic.Zip.ZipFile())
+        /// {
+        ///     zip.AddEntry(zipEntryName, (name,stream) => ds1.WriteXml(stream) );
+        ///     zip.Save(zipFileName);
+        /// }
+        /// </code>
+        /// </example>
+        ///
+        /// <example>
+        ///
+        /// This example uses an anonymous method in C# as the WriteDelegate to provide
+        /// the data for the ZipEntry. The example is a bit contrived - the
+        /// <c>AddFile()</c> method is a simpler way to insert the contents of a file
+        /// into an entry in a zip file. On the other hand, if there is some sort of
+        /// processing or transformation of the file contents required before writing,
+        /// the application could use the <c>WriteDelegate</c> to do it, in this way.
+        ///
+        /// <code lang="C#">
+        /// using (var input = File.Open(filename, FileMode.Open, FileAccess.Read, FileShare.ReadWrite ))
+        /// {
+        ///     using(Ionic.Zip.ZipFile zip = new Ionic.Zip.ZipFile())
+        ///     {
+        ///         zip.AddEntry(zipEntryName, (name,output) =>
+        ///             {
+        ///                 byte[] buffer = new byte[BufferSize];
+        ///                 int n;
+        ///                 while ((n = input.Read(buffer, 0, buffer.Length)) != 0)
+        ///                 {
+        ///                     // could transform the data here...
+        ///                     output.Write(buffer, 0, n);
+        ///                     // could update a progress bar here
+        ///                 }
+        ///             });
+        ///
+        ///         zip.Save(zipFileName);
+        ///     }
+        /// }
+        /// </code>
+        /// </example>
+        ///
+        /// <example>
+        ///
+        /// This example uses a named delegate in VB to write data for the given
+        /// ZipEntry (VB9 does not have anonymous delegates). The example here is a bit
+        /// contrived - a simpler way to add the contents of a file to a ZipEntry is to
+        /// simply use the appropriate <c>AddFile()</c> method.  The key scenario for
+        /// which the <c>WriteDelegate</c> makes sense is saving a DataSet, in XML
+        /// format, to the zip file. The DataSet can write XML to a stream, and the
+        /// WriteDelegate is the perfect place to write into the zip file.  There may be
+        /// other data structures that can write to a stream, but cannot be read as a
+        /// stream.  The <c>WriteDelegate</c> would be appropriate for those cases as
+        /// well.
+        ///
+        /// <code lang="VB">
+        /// Private Sub WriteEntry (ByVal name As String, ByVal output As Stream)
+        ///     Using input As FileStream = File.Open(filename, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)
+        ///         Dim n As Integer = -1
+        ///         Dim buffer As Byte() = New Byte(BufferSize){}
+        ///         Do While n &lt;&gt; 0
+        ///             n = input.Read(buffer, 0, buffer.Length)
+        ///             output.Write(buffer, 0, n)
+        ///         Loop
+        ///     End Using
+        /// End Sub
+        ///
+        /// Public Sub Run()
+        ///     Using zip = New ZipFile
+        ///         zip.AddEntry(zipEntryName, New WriteDelegate(AddressOf WriteEntry))
+        ///         zip.Save(zipFileName)
+        ///     End Using
+        /// End Sub
+        /// </code>
+        /// </example>
+        public ZipEntry AddEntry(string entryName, WriteDelegate writer)
+        {
+            ZipEntry ze = ZipEntry.CreateForWriter(entryName, writer);
+            if (Verbose) StatusMessageTextWriter.WriteLine("adding {0}...", entryName);
+            return _InternalAddEntry(ze);
+        }
+
+
+        /// <summary>
+        ///   Add an entry, for which the application will provide a stream
+        ///   containing the entry data, on a just-in-time basis.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   In cases where the application wishes to open the stream that
+        ///   holds the content for the ZipEntry, on a just-in-time basis, the
+        ///   application can use this method.  The application provides an
+        ///   opener delegate that will be called by the DotNetZip library to
+        ///   obtain a readable stream that can be read to get the bytes for
+        ///   the given entry.  Typically, this delegate opens a stream.
+        ///   Optionally, the application can provide a closer delegate as
+        ///   well, which will be called by DotNetZip when all bytes have been
+        ///   read from the entry.
+        /// </para>
+        ///
+        /// <para>
+        ///   These delegates are called from within the scope of the call to
+        ///   ZipFile.Save().
+        /// </para>
+        ///
+        /// <para>
+        ///   For <c>ZipFile</c> properties including <see cref="Encryption"/>, <see
+        ///   cref="Password"/>, <see cref="SetCompression"/>, <see
+        ///   cref="ProvisionalAlternateEncoding"/>, <see cref="ExtractExistingFile"/>,
+        ///   <see cref="ZipErrorAction"/>, and <see cref="CompressionLevel"/>, their
+        ///   respective values at the time of this call will be applied to the
+        ///   <c>ZipEntry</c> added.
+        /// </para>
+        ///
+        /// </remarks>
+        ///
+        /// <example>
+        ///
+        ///   This example uses anonymous methods in C# to open and close the
+        ///   source stream for the content for a zip entry.
+        ///
+        /// <code lang="C#">
+        /// using(Ionic.Zip.ZipFile zip = new Ionic.Zip.ZipFile())
+        /// {
+        ///     zip.AddEntry(zipEntryName,
+        ///                  (name) =>  File.Open(filename, FileMode.Open, FileAccess.Read, FileShare.ReadWrite ),
+        ///                  (name, stream) =>  stream.Close()
+        ///                  );
+        ///
+        ///     zip.Save(zipFileName);
+        /// }
+        /// </code>
+        ///
+        /// </example>
+        ///
+        /// <example>
+        ///
+        ///   This example uses delegates in VB.NET to open and close the
+        ///   the source stream for the content for a zip entry.  VB 9.0 lacks
+        ///   support for "Sub" lambda expressions, and so the CloseDelegate must
+        ///   be an actual, named Sub.
+        ///
+        /// <code lang="VB">
+        ///
+        /// Function MyStreamOpener(ByVal entryName As String) As Stream
+        ///     '' This simply opens a file.  You probably want to do somethinig
+        ///     '' more involved here: open a stream to read from a database,
+        ///     '' open a stream on an HTTP connection, and so on.
+        ///     Return File.OpenRead(entryName)
+        /// End Function
+        ///
+        /// Sub MyStreamCloser(entryName As String, stream As Stream)
+        ///     stream.Close()
+        /// End Sub
+        ///
+        /// Public Sub Run()
+        ///     Dim dirToZip As String = "fodder"
+        ///     Dim zipFileToCreate As String = "Archive.zip"
+        ///     Dim opener As OpenDelegate = AddressOf MyStreamOpener
+        ///     Dim closer As CloseDelegate = AddressOf MyStreamCloser
+        ///     Dim numFilestoAdd As Int32 = 4
+        ///     Using zip As ZipFile = New ZipFile
+        ///         Dim i As Integer
+        ///         For i = 0 To numFilesToAdd - 1
+        ///             zip.AddEntry(String.Format("content-{0:000}.txt"), opener, closer)
+        ///         Next i
+        ///         zip.Save(zipFileToCreate)
+        ///     End Using
+        /// End Sub
+        ///
+        /// </code>
+        /// </example>
+        ///
+        /// <param name="entryName">the name of the entry to add</param>
+        /// <param name="opener">
+        ///  the delegate that will be invoked by ZipFile.Save() to get the
+        ///  readable stream for the given entry. ZipFile.Save() will call
+        ///  read on this stream to obtain the data for the entry. This data
+        ///  will then be compressed and written to the newly created zip
+        ///  file.
+        /// </param>
+        /// <param name="closer">
+        ///  the delegate that will be invoked to close the stream. This may
+        ///  be null (Nothing in VB), in which case no call is makde to close
+        ///  the stream.
+        /// </param>
+        /// <returns>the ZipEntry added</returns>
+        ///
+        public ZipEntry AddEntry(string entryName, OpenDelegate opener, CloseDelegate closer)
+        {
+            ZipEntry ze = ZipEntry.CreateForJitStreamProvider(entryName, opener, closer);
+            ze.SetEntryTimes(DateTime.Now,DateTime.Now,DateTime.Now);
+            if (Verbose) StatusMessageTextWriter.WriteLine("adding {0}...", entryName);
+            return _InternalAddEntry(ze);
+        }
+
+
+
+        private ZipEntry _InternalAddEntry(ZipEntry ze)
+        {
+            // stamp all the props onto the entry
+            ze._container = new ZipContainer(this);
+            ze.CompressionMethod = this.CompressionMethod;
+            ze.CompressionLevel = this.CompressionLevel;
+            ze.ExtractExistingFile = this.ExtractExistingFile;
+            ze.ZipErrorAction = this.ZipErrorAction;
+            ze.SetCompression = this.SetCompression;
+            ze.AlternateEncoding = this.AlternateEncoding;
+            ze.AlternateEncodingUsage = this.AlternateEncodingUsage;
+            ze.Password = this._Password;
+            ze.Encryption = this.Encryption;
+            ze.EmitTimesInWindowsFormatWhenSaving = this._emitNtfsTimes;
+            ze.EmitTimesInUnixFormatWhenSaving = this._emitUnixTimes;
+            //string key = DictionaryKeyForEntry(ze);
+            InternalAddEntry(ze.FileName,ze);
+            AfterAddEntry(ze);
+            return ze;
+        }
+
+
+
+
+        /// <summary>
+        ///   Updates the given entry in the <c>ZipFile</c>, using the given
+        ///   string as content for the <c>ZipEntry</c>.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///
+        /// <para>
+        ///   Calling this method is equivalent to removing the <c>ZipEntry</c> for
+        ///   the given file name and directory path, if it exists, and then calling
+        ///   <see cref="AddEntry(String,String)" />.  See the documentation for
+        ///   that method for further explanation. The string content is encoded
+        ///   using the default encoding for the machine, or on Silverlight, using
+        ///   UTF-8. This encoding is distinct from the encoding used for the
+        ///   filename itself.  See <see cref="AlternateEncoding"/>.
+        /// </para>
+        ///
+        /// </remarks>
+        ///
+        /// <param name="entryName">
+        ///   The name, including any path, to use within the archive for the entry.
+        /// </param>
+        ///
+        /// <param name="content">
+        ///   The content of the file, should it be extracted from the zip.
+        /// </param>
+        ///
+        /// <returns>The <c>ZipEntry</c> added.</returns>
+        ///
+        public ZipEntry UpdateEntry(string entryName, string content)
+        {
+#if SILVERLIGHT
+            return UpdateEntry(entryName, content, System.Text.Encoding.UTF8);
+#else
+            return UpdateEntry(entryName, content, System.Text.Encoding.Default);
+#endif
+        }
+
+
+        /// <summary>
+        ///   Updates the given entry in the <c>ZipFile</c>, using the given string as
+        ///   content for the <c>ZipEntry</c>.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///   Calling this method is equivalent to removing the <c>ZipEntry</c> for the
+        ///   given file name and directory path, if it exists, and then calling <see
+        ///   cref="AddEntry(String,String, System.Text.Encoding)" />.  See the
+        ///   documentation for that method for further explanation.
+        /// </remarks>
+        ///
+        /// <param name="entryName">
+        ///   The name, including any path, to use within the archive for the entry.
+        /// </param>
+        ///
+        /// <param name="content">
+        ///   The content of the file, should it be extracted from the zip.
+        /// </param>
+        ///
+        /// <param name="encoding">
+        ///   The text encoding to use when encoding the string. Be aware: This is
+        ///   distinct from the text encoding used to encode the filename. See <see
+        ///   cref="AlternateEncoding" />.
+        /// </param>
+        ///
+        /// <returns>The <c>ZipEntry</c> added.</returns>
+        ///
+        public ZipEntry UpdateEntry(string entryName, string content, System.Text.Encoding encoding)
+        {
+            RemoveEntryForUpdate(entryName);
+            return AddEntry(entryName, content, encoding);
+        }
+
+
+
+        /// <summary>
+        ///   Updates the given entry in the <c>ZipFile</c>, using the given delegate
+        ///   as the source for content for the <c>ZipEntry</c>.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///   Calling this method is equivalent to removing the <c>ZipEntry</c> for the
+        ///   given file name and directory path, if it exists, and then calling <see
+        ///   cref="AddEntry(String,WriteDelegate)" />.  See the
+        ///   documentation for that method for further explanation.
+        /// </remarks>
+        ///
+        /// <param name="entryName">
+        ///   The name, including any path, to use within the archive for the entry.
+        /// </param>
+        ///
+        /// <param name="writer">the delegate which will write the entry content.</param>
+        ///
+        /// <returns>The <c>ZipEntry</c> added.</returns>
+        ///
+        public ZipEntry UpdateEntry(string entryName, WriteDelegate writer)
+        {
+            RemoveEntryForUpdate(entryName);
+            return AddEntry(entryName, writer);
+        }
+
+
+
+        /// <summary>
+        ///   Updates the given entry in the <c>ZipFile</c>, using the given delegates
+        ///   to open and close the stream that provides the content for the <c>ZipEntry</c>.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///   Calling this method is equivalent to removing the <c>ZipEntry</c> for the
+        ///   given file name and directory path, if it exists, and then calling <see
+        ///   cref="AddEntry(String,OpenDelegate, CloseDelegate)" />.  See the
+        ///   documentation for that method for further explanation.
+        /// </remarks>
+        ///
+        /// <param name="entryName">
+        ///   The name, including any path, to use within the archive for the entry.
+        /// </param>
+        ///
+        /// <param name="opener">
+        ///  the delegate that will be invoked to open the stream
+        /// </param>
+        /// <param name="closer">
+        ///  the delegate that will be invoked to close the stream
+        /// </param>
+        ///
+        /// <returns>The <c>ZipEntry</c> added or updated.</returns>
+        ///
+        public ZipEntry UpdateEntry(string entryName, OpenDelegate opener, CloseDelegate closer)
+        {
+            RemoveEntryForUpdate(entryName);
+            return AddEntry(entryName, opener, closer);
+        }
+
+
+        /// <summary>
+        ///   Updates the given entry in the <c>ZipFile</c>, using the given stream as
+        ///   input, and the given filename and given directory Path.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   Calling the method is equivalent to calling <c>RemoveEntry()</c> if an
+        ///   entry by the same name already exists, and then calling <c>AddEntry()</c>
+        ///   with the given <c>fileName</c> and stream.
+        /// </para>
+        ///
+        /// <para>
+        ///   The stream must be open and readable during the call to
+        ///   <c>ZipFile.Save</c>.  You can dispense the stream on a just-in-time basis
+        ///   using the <see cref="ZipEntry.InputStream"/> property. Check the
+        ///   documentation of that property for more information.
+        /// </para>
+        ///
+        /// <para>
+        ///   For <c>ZipFile</c> properties including <see cref="Encryption"/>, <see
+        ///   cref="Password"/>, <see cref="SetCompression"/>, <see
+        ///   cref="ProvisionalAlternateEncoding"/>, <see cref="ExtractExistingFile"/>,
+        ///   <see cref="ZipErrorAction"/>, and <see cref="CompressionLevel"/>, their
+        ///   respective values at the time of this call will be applied to the
+        ///   <c>ZipEntry</c> added.
+        /// </para>
+        ///
+        /// </remarks>
+        ///
+        /// <seealso cref="Ionic.Zip.ZipFile.AddEntry(string, System.IO.Stream)"/>
+        /// <seealso cref="ZipEntry.InputStream"/>
+        ///
+        /// <param name="entryName">
+        ///   The name, including any path, to use within the archive for the entry.
+        /// </param>
+        ///
+        /// <param name="stream">The input stream from which to read file data.</param>
+        /// <returns>The <c>ZipEntry</c> added.</returns>
+        public ZipEntry UpdateEntry(string entryName, Stream stream)
+        {
+            RemoveEntryForUpdate(entryName);
+            return AddEntry(entryName, stream);
+        }
+
+
+        private void RemoveEntryForUpdate(string entryName)
+        {
+            if (String.IsNullOrEmpty(entryName))
+                throw new ArgumentNullException("entryName");
+
+            string directoryPathInArchive = null;
+            if (entryName.IndexOf('\\') != -1)
+            {
+                directoryPathInArchive = Path.GetDirectoryName(entryName);
+                entryName = Path.GetFileName(entryName);
+            }
+            var key = ZipEntry.NameInArchive(entryName, directoryPathInArchive);
+            if (this[key] != null)
+                this.RemoveEntry(key);
+        }
+
+
+
+
+        /// <summary>
+        ///   Add an entry into the zip archive using the given filename and
+        ///   directory path within the archive, and the given content for the
+        ///   file. No file is created in the filesystem.
+        /// </summary>
+        ///
+        /// <param name="byteContent">The data to use for the entry.</param>
+        ///
+        /// <param name="entryName">
+        ///   The name, including any path, to use within the archive for the entry.
+        /// </param>
+        ///
+        /// <returns>The <c>ZipEntry</c> added.</returns>
+        public ZipEntry AddEntry(string entryName, byte[] byteContent)
+        {
+            if (byteContent == null) throw new ArgumentException("bad argument", "byteContent");
+            var ms = new MemoryStream(byteContent);
+            return AddEntry(entryName, ms);
+        }
+
+
+        /// <summary>
+        ///   Updates the given entry in the <c>ZipFile</c>, using the given byte
+        ///   array as content for the entry.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///   Calling this method is equivalent to removing the <c>ZipEntry</c>
+        ///   for the given filename and directory path, if it exists, and then
+        ///   calling <see cref="AddEntry(String,byte[])" />.  See the
+        ///   documentation for that method for further explanation.
+        /// </remarks>
+        ///
+        /// <param name="entryName">
+        ///   The name, including any path, to use within the archive for the entry.
+        /// </param>
+        ///
+        /// <param name="byteContent">The content to use for the <c>ZipEntry</c>.</param>
+        ///
+        /// <returns>The <c>ZipEntry</c> added.</returns>
+        ///
+        public ZipEntry UpdateEntry(string entryName, byte[] byteContent)
+        {
+            RemoveEntryForUpdate(entryName);
+            return AddEntry(entryName, byteContent);
+        }
+
+
+//         private string DictionaryKeyForEntry(ZipEntry ze1)
+//         {
+//             var filename = SharedUtilities.NormalizePathForUseInZipFile(ze1.FileName);
+//             return filename;
+//         }
+
+
+        /// <summary>
+        ///   Adds the contents of a filesystem directory to a Zip file archive.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///
+        /// <para>
+        ///   The name of the directory may be a relative path or a fully-qualified
+        ///   path. Any files within the named directory are added to the archive.  Any
+        ///   subdirectories within the named directory are also added to the archive,
+        ///   recursively.
+        /// </para>
+        ///
+        /// <para>
+        ///   Top-level entries in the named directory will appear as top-level entries
+        ///   in the zip archive.  Entries in subdirectories in the named directory will
+        ///   result in entries in subdirectories in the zip archive.
+        /// </para>
+        ///
+        /// <para>
+        ///   If you want the entries to appear in a containing directory in the zip
+        ///   archive itself, then you should call the AddDirectory() overload that
+        ///   allows you to explicitly specify a directory path for use in the archive.
+        /// </para>
+        ///
+        /// <para>
+        ///   For <c>ZipFile</c> properties including <see cref="Encryption"/>, <see
+        ///   cref="Password"/>, <see cref="SetCompression"/>, <see
+        ///   cref="ProvisionalAlternateEncoding"/>, <see cref="ExtractExistingFile"/>,
+        ///   <see cref="ZipErrorAction"/>, and <see cref="CompressionLevel"/>, their
+        ///   respective values at the time of this call will be applied to each
+        ///   ZipEntry added.
+        /// </para>
+        ///
+        /// </remarks>
+        ///
+        /// <seealso cref="Ionic.Zip.ZipFile.AddItem(string)"/>
+        /// <seealso cref="Ionic.Zip.ZipFile.AddFile(string)"/>
+        /// <seealso cref="Ionic.Zip.ZipFile.UpdateDirectory(string)"/>
+        /// <seealso cref="Ionic.Zip.ZipFile.AddDirectory(string, string)"/>
+        ///
+        /// <overloads>This method has 2 overloads.</overloads>
+        ///
+        /// <param name="directoryName">The name of the directory to add.</param>
+        /// <returns>The <c>ZipEntry</c> added.</returns>
+        public ZipEntry AddDirectory(string directoryName)
+        {
+            return AddDirectory(directoryName, null);
+        }
+
+
+        /// <summary>
+        ///   Adds the contents of a filesystem directory to a Zip file archive,
+        ///   overriding the path to be used for entries in the archive.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   The name of the directory may be a relative path or a fully-qualified
+        ///   path. The add operation is recursive, so that any files or subdirectories
+        ///   within the name directory are also added to the archive.
+        /// </para>
+        ///
+        /// <para>
+        ///   Top-level entries in the named directory will appear as top-level entries
+        ///   in the zip archive.  Entries in subdirectories in the named directory will
+        ///   result in entries in subdirectories in the zip archive.
+        /// </para>
+        ///
+        /// <para>
+        ///   For <c>ZipFile</c> properties including <see cref="Encryption"/>, <see
+        ///   cref="Password"/>, <see cref="SetCompression"/>, <see
+        ///   cref="ProvisionalAlternateEncoding"/>, <see cref="ExtractExistingFile"/>,
+        ///   <see cref="ZipErrorAction"/>, and <see cref="CompressionLevel"/>, their
+        ///   respective values at the time of this call will be applied to each
+        ///   ZipEntry added.
+        /// </para>
+        ///
+        /// </remarks>
+        ///
+        /// <example>
+        /// <para>
+        ///   In this code, calling the ZipUp() method with a value of "c:\reports" for
+        ///   the directory parameter will result in a zip file structure in which all
+        ///   entries are contained in a toplevel "reports" directory.
+        /// </para>
+        ///
+        /// <code lang="C#">
+        /// public void ZipUp(string targetZip, string directory)
+        /// {
+        ///   using (var zip = new ZipFile())
+        ///   {
+        ///     zip.AddDirectory(directory, System.IO.Path.GetFileName(directory));
+        ///     zip.Save(targetZip);
+        ///   }
+        /// }
+        /// </code>
+        /// </example>
+        ///
+        /// <seealso cref="Ionic.Zip.ZipFile.AddItem(string, string)"/>
+        /// <seealso cref="Ionic.Zip.ZipFile.AddFile(string, string)"/>
+        /// <seealso cref="Ionic.Zip.ZipFile.UpdateDirectory(string, string)"/>
+        ///
+        /// <param name="directoryName">The name of the directory to add.</param>
+        ///
+        /// <param name="directoryPathInArchive">
+        ///   Specifies a directory path to use to override any path in the
+        ///   DirectoryName.  This path may, or may not, correspond to a real directory
+        ///   in the current filesystem.  If the zip is later extracted, this is the
+        ///   path used for the extracted file or directory.  Passing <c>null</c>
+        ///   (<c>Nothing</c> in VB) or the empty string ("") will insert the items at
+        ///   the root path within the archive.
+        /// </param>
+        ///
+        /// <returns>The <c>ZipEntry</c> added.</returns>
+        public ZipEntry AddDirectory(string directoryName, string directoryPathInArchive)
+        {
+            return AddOrUpdateDirectoryImpl(directoryName, directoryPathInArchive, AddOrUpdateAction.AddOnly);
+        }
+
+
+        /// <summary>
+        ///   Creates a directory in the zip archive.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///
+        /// <para>
+        ///   Use this when you want to create a directory in the archive but there is
+        ///   no corresponding filesystem representation for that directory.
+        /// </para>
+        ///
+        /// <para>
+        ///   You will probably not need to do this in your code. One of the only times
+        ///   you will want to do this is if you want an empty directory in the zip
+        ///   archive.  The reason: if you add a file to a zip archive that is stored
+        ///   within a multi-level directory, all of the directory tree is implicitly
+        ///   created in the zip archive.
+        /// </para>
+        ///
+        /// </remarks>
+        ///
+        /// <param name="directoryNameInArchive">
+        ///   The name of the directory to create in the archive.
+        /// </param>
+        /// <returns>The <c>ZipEntry</c> added.</returns>
+        public ZipEntry AddDirectoryByName(string directoryNameInArchive)
+        {
+            // workitem 9073
+            ZipEntry dir = ZipEntry.CreateFromNothing(directoryNameInArchive);
+            dir._container = new ZipContainer(this);
+            dir.MarkAsDirectory();
+            dir.AlternateEncoding = this.AlternateEncoding;  // workitem 8984
+            dir.AlternateEncodingUsage = this.AlternateEncodingUsage;
+            dir.SetEntryTimes(DateTime.Now,DateTime.Now,DateTime.Now);
+            dir.EmitTimesInWindowsFormatWhenSaving = _emitNtfsTimes;
+            dir.EmitTimesInUnixFormatWhenSaving = _emitUnixTimes;
+            dir._Source = ZipEntrySource.Stream;
+            //string key = DictionaryKeyForEntry(dir);
+            InternalAddEntry(dir.FileName,dir);
+            AfterAddEntry(dir);
+            return dir;
+        }
+
+
+
+        private ZipEntry AddOrUpdateDirectoryImpl(string directoryName,
+                                                  string rootDirectoryPathInArchive,
+                                                  AddOrUpdateAction action)
+        {
+            if (rootDirectoryPathInArchive == null)
+            {
+                rootDirectoryPathInArchive = "";
+            }
+
+            return AddOrUpdateDirectoryImpl(directoryName, rootDirectoryPathInArchive, action, true, 0);
+        }
+
+
+        internal void InternalAddEntry(String name, ZipEntry entry)
+        {
+            _entries.Add(name, entry);
+            _zipEntriesAsList = null;
+            _contentsChanged = true;
+        }
+
+
+
+        private ZipEntry AddOrUpdateDirectoryImpl(string directoryName,
+                                                  string rootDirectoryPathInArchive,
+                                                  AddOrUpdateAction action,
+                                                  bool recurse,
+                                                  int level)
+        {
+            if (Verbose)
+                StatusMessageTextWriter.WriteLine("{0} {1}...",
+                                                  (action == AddOrUpdateAction.AddOnly) ? "adding" : "Adding or updating",
+                                                  directoryName);
+
+            if (level == 0)
+            {
+                _addOperationCanceled = false;
+                OnAddStarted();
+            }
+
+            // workitem 13371
+            if (_addOperationCanceled)
+                return null;
+
+            string dirForEntries = rootDirectoryPathInArchive;
+            ZipEntry baseDir = null;
+
+            if (level > 0)
+            {
+                int f = directoryName.Length;
+                for (int i = level; i > 0; i--)
+                    f = directoryName.LastIndexOfAny("/\\".ToCharArray(), f - 1, f - 1);
+
+                dirForEntries = directoryName.Substring(f + 1);
+                dirForEntries = Path.Combine(rootDirectoryPathInArchive, dirForEntries);
+            }
+
+            // if not top level, or if the root is non-empty, then explicitly add the directory
+            if (level > 0 || rootDirectoryPathInArchive != "")
+            {
+                baseDir = ZipEntry.CreateFromFile(directoryName, dirForEntries);
+                baseDir._container = new ZipContainer(this);
+                baseDir.AlternateEncoding = this.AlternateEncoding;  // workitem 6410
+                baseDir.AlternateEncodingUsage = this.AlternateEncodingUsage;
+                baseDir.MarkAsDirectory();
+                baseDir.EmitTimesInWindowsFormatWhenSaving = _emitNtfsTimes;
+                baseDir.EmitTimesInUnixFormatWhenSaving = _emitUnixTimes;
+
+                // add the directory only if it does not exist.
+                // It's not an error if it already exists.
+                if (!_entries.ContainsKey(baseDir.FileName))
+                {
+                    InternalAddEntry(baseDir.FileName,baseDir);
+                    AfterAddEntry(baseDir);
+                }
+                dirForEntries = baseDir.FileName;
+            }
+
+            if (!_addOperationCanceled)
+            {
+
+                String[] filenames = Directory.GetFiles(directoryName);
+
+                if (recurse)
+                {
+                    // add the files:
+                    foreach (String filename in filenames)
+                    {
+                        if (_addOperationCanceled) break;
+                        if (action == AddOrUpdateAction.AddOnly)
+                            AddFile(filename, dirForEntries);
+                        else
+                            UpdateFile(filename, dirForEntries);
+                    }
+
+                    if (!_addOperationCanceled)
+                    {
+                        // add the subdirectories:
+                        String[] dirnames = Directory.GetDirectories(directoryName);
+                        foreach (String dir in dirnames)
+                        {
+                            // workitem 8617: Optionally traverse reparse points
+#if SILVERLIGHT
+#elif NETCF
+                            FileAttributes fileAttrs = (FileAttributes) NetCfFile.GetAttributes(dir);
+#else
+                            FileAttributes fileAttrs = System.IO.File.GetAttributes(dir);
+#endif
+                            if (this.AddDirectoryWillTraverseReparsePoints
+#if !SILVERLIGHT
+                                || ((fileAttrs & FileAttributes.ReparsePoint) == 0)
+#endif
+                                )
+                                AddOrUpdateDirectoryImpl(dir, rootDirectoryPathInArchive, action, recurse, level + 1);
+
+                        }
+
+                    }
+                }
+            }
+
+            if (level == 0)
+                OnAddCompleted();
+
+            return baseDir;
+        }
+
+    }
+
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ZipFile.Check.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ZipFile.Check.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ZipFile.Check.cs	(revision 12707)
@@ -0,0 +1,352 @@
+// ZipFile.Check.cs
+// ------------------------------------------------------------------
+//
+// Copyright (c) 2009-2011 Dino Chiesa.
+// All rights reserved.
+//
+// This code module is part of DotNetZip, a zipfile class library.
+//
+// ------------------------------------------------------------------
+//
+// This code is licensed under the Microsoft Public License.
+// See the file License.txt for the license details.
+// More info on: http://dotnetzip.codeplex.com
+//
+// ------------------------------------------------------------------
+//
+// last saved (in emacs):
+// Time-stamp: <2011-July-31 14:40:50>
+//
+// ------------------------------------------------------------------
+//
+// This module defines the methods for doing Checks on zip files.
+// These are not necessary to include in the Reduced or CF
+// version of the library.
+//
+// ------------------------------------------------------------------
+//
+
+
+using System;
+using System.IO;
+using System.Collections.Generic;
+
+namespace OfficeOpenXml.Packaging.Ionic.Zip
+{
+    internal partial class ZipFile
+    {
+        /// <summary>
+        ///   Checks a zip file to see if its directory is consistent.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///
+        /// <para>
+        ///   In cases of data error, the directory within a zip file can get out
+        ///   of synch with the entries in the zip file.  This method checks the
+        ///   given zip file and returns true if this has occurred.
+        /// </para>
+        ///
+        /// <para> This method may take a long time to run for large zip files.  </para>
+        ///
+        /// <para>
+        ///   This method is not supported in the Reduced or Compact Framework
+        ///   versions of DotNetZip.
+        /// </para>
+        ///
+        /// <para>
+        ///   Developers using COM can use the <see
+        ///   cref="ComHelper.CheckZip(String)">ComHelper.CheckZip(String)</see>
+        ///   method.
+        /// </para>
+        ///
+        /// </remarks>
+        ///
+        /// <param name="zipFileName">The filename to of the zip file to check.</param>
+        ///
+        /// <returns>true if the named zip file checks OK. Otherwise, false. </returns>
+        ///
+        /// <seealso cref="FixZipDirectory(string)"/>
+        /// <seealso cref="CheckZip(string,bool,System.IO.TextWriter)"/>
+        public static bool CheckZip(string zipFileName)
+        {
+            return CheckZip(zipFileName, false, null);
+        }
+
+
+        /// <summary>
+        ///   Checks a zip file to see if its directory is consistent,
+        ///   and optionally fixes the directory if necessary.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///
+        /// <para>
+        ///   In cases of data error, the directory within a zip file can get out of
+        ///   synch with the entries in the zip file.  This method checks the given
+        ///   zip file, and returns true if this has occurred. It also optionally
+        ///   fixes the zipfile, saving the fixed copy in <em>Name</em>_Fixed.zip.
+        /// </para>
+        ///
+        /// <para>
+        ///   This method may take a long time to run for large zip files.  It
+        ///   will take even longer if the file actually needs to be fixed, and if
+        ///   <c>fixIfNecessary</c> is true.
+        /// </para>
+        ///
+        /// <para>
+        ///   This method is not supported in the Reduced or Compact
+        ///   Framework versions of DotNetZip.
+        /// </para>
+        ///
+        /// </remarks>
+        ///
+        /// <param name="zipFileName">The filename to of the zip file to check.</param>
+        ///
+        /// <param name="fixIfNecessary">If true, the method will fix the zip file if
+        ///     necessary.</param>
+        ///
+        /// <param name="writer">
+        /// a TextWriter in which messages generated while checking will be written.
+        /// </param>
+        ///
+        /// <returns>true if the named zip is OK; false if the file needs to be fixed.</returns>
+        ///
+        /// <seealso cref="CheckZip(string)"/>
+        /// <seealso cref="FixZipDirectory(string)"/>
+        public static bool CheckZip(string zipFileName, bool fixIfNecessary,
+                                    TextWriter writer)
+
+        {
+            ZipFile zip1 = null, zip2 = null;
+            bool isOk = true;
+            try
+            {
+                zip1 = new ZipFile();
+                zip1.FullScan = true;
+                zip1.Initialize(zipFileName);
+
+                zip2 = ZipFile.Read(zipFileName);
+
+                foreach (var e1 in zip1)
+                {
+                    foreach (var e2 in zip2)
+                    {
+                        if (e1.FileName == e2.FileName)
+                        {
+                            if (e1._RelativeOffsetOfLocalHeader != e2._RelativeOffsetOfLocalHeader)
+                            {
+                                isOk = false;
+                                if (writer != null)
+                                writer.WriteLine("{0}: mismatch in RelativeOffsetOfLocalHeader  (0x{1:X16} != 0x{2:X16})",
+                                                        e1.FileName, e1._RelativeOffsetOfLocalHeader,
+                                                        e2._RelativeOffsetOfLocalHeader);
+                            }
+                            if (e1._CompressedSize != e2._CompressedSize)
+                            {
+                                isOk = false;
+                                if (writer != null)
+                                writer.WriteLine("{0}: mismatch in CompressedSize  (0x{1:X16} != 0x{2:X16})",
+                                                        e1.FileName, e1._CompressedSize,
+                                                        e2._CompressedSize);
+                            }
+                            if (e1._UncompressedSize != e2._UncompressedSize)
+                            {
+                                isOk = false;
+                                if (writer != null)
+                                writer.WriteLine("{0}: mismatch in UncompressedSize  (0x{1:X16} != 0x{2:X16})",
+                                                        e1.FileName, e1._UncompressedSize,
+                                                        e2._UncompressedSize);
+                            }
+                            if (e1.CompressionMethod != e2.CompressionMethod)
+                            {
+                                isOk = false;
+                                if (writer != null)
+                                writer.WriteLine("{0}: mismatch in CompressionMethod  (0x{1:X4} != 0x{2:X4})",
+                                                        e1.FileName, e1.CompressionMethod,
+                                                        e2.CompressionMethod);
+                            }
+                            if (e1.Crc != e2.Crc)
+                            {
+                                isOk = false;
+                                if (writer != null)
+                                writer.WriteLine("{0}: mismatch in Crc32  (0x{1:X4} != 0x{2:X4})",
+                                                        e1.FileName, e1.Crc,
+                                                        e2.Crc);
+                            }
+
+                            // found a match, so stop the inside loop
+                            break;
+                        }
+                    }
+                }
+
+                zip2.Dispose();
+                zip2 = null;
+
+                if (!isOk && fixIfNecessary)
+                {
+                    string newFileName = Path.GetFileNameWithoutExtension(zipFileName);
+                    newFileName = System.String.Format("{0}_fixed.zip", newFileName);
+                    zip1.Save(newFileName);
+                }
+            }
+            finally
+            {
+                if (zip1 != null) zip1.Dispose();
+                if (zip2 != null) zip2.Dispose();
+            }
+            return isOk;
+        }
+
+
+
+        /// <summary>
+        ///   Rewrite the directory within a zipfile.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///
+        /// <para>
+        ///   In cases of data error, the directory in a zip file can get out of
+        ///   synch with the entries in the zip file.  This method attempts to fix
+        ///   the zip file if this has occurred.
+        /// </para>
+        ///
+        /// <para> This can take a long time for large zip files. </para>
+        ///
+        /// <para> This won't work if the zip file uses a non-standard
+        /// code page - neither IBM437 nor UTF-8. </para>
+        ///
+        /// <para>
+        ///   This method is not supported in the Reduced or Compact Framework
+        ///   versions of DotNetZip.
+        /// </para>
+        ///
+        /// <para>
+        ///   Developers using COM can use the <see
+        ///   cref="ComHelper.FixZipDirectory(String)">ComHelper.FixZipDirectory(String)</see>
+        ///   method.
+        /// </para>
+        ///
+        /// </remarks>
+        ///
+        /// <param name="zipFileName">The filename to of the zip file to fix.</param>
+        ///
+        /// <seealso cref="CheckZip(string)"/>
+        /// <seealso cref="CheckZip(string,bool,System.IO.TextWriter)"/>
+        public static void FixZipDirectory(string zipFileName)
+        {
+            using (var zip = new ZipFile())
+            {
+                zip.FullScan = true;
+                zip.Initialize(zipFileName);
+                zip.Save(zipFileName);
+            }
+        }
+
+
+
+        /// <summary>
+        ///   Verify the password on a zip file.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///   <para>
+        ///     Keep in mind that passwords in zipfiles are applied to
+        ///     zip entries, not to the entire zip file. So testing a
+        ///     zipfile for a particular password doesn't work in the
+        ///     general case. On the other hand, it's often the case
+        ///     that a single password will be used on all entries in a
+        ///     zip file. This method works for that case.
+        ///   </para>
+        ///   <para>
+        ///     There is no way to check a password without doing the
+        ///     decryption. So this code decrypts and extracts the given
+        ///     zipfile into <see cref="System.IO.Stream.Null"/>
+        ///   </para>
+        /// </remarks>
+        ///
+        /// <param name="zipFileName">The filename to of the zip file to fix.</param>
+        ///
+        /// <param name="password">The password to check.</param>
+        ///
+        /// <returns>a bool indicating whether the password matches.</returns>
+        public static bool CheckZipPassword(string zipFileName, string password)
+        {
+            // workitem 13664
+            bool success = false;
+            try
+            {
+                using (ZipFile zip1 = ZipFile.Read(zipFileName))
+                {
+                    foreach (var e in zip1)
+                    {
+                        if (!e.IsDirectory && e.UsesEncryption)
+                        {
+                            e.ExtractWithPassword(System.IO.Stream.Null, password);
+                        }
+                    }
+                }
+                success = true;
+            }
+            catch(Ionic.Zip.BadPasswordException) { }
+            return success;
+        }
+
+
+        /// <summary>
+        ///   Provides a human-readable string with information about the ZipFile.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///   <para>
+        ///     The information string contains 10 lines or so, about each ZipEntry,
+        ///     describing whether encryption is in use, the compressed and uncompressed
+        ///     length of the entry, the offset of the entry, and so on. As a result the
+        ///     information string can be very long for zip files that contain many
+        ///     entries.
+        ///   </para>
+        ///   <para>
+        ///     This information is mostly useful for diagnostic purposes.
+        ///   </para>
+        /// </remarks>
+        public string Info
+        {
+            get
+            {
+                var builder = new System.Text.StringBuilder();
+                builder.Append(string.Format("          ZipFile: {0}\n", this.Name));
+                if (!string.IsNullOrEmpty(this._Comment))
+                {
+                    builder.Append(string.Format("          Comment: {0}\n", this._Comment));
+                }
+                if (this._versionMadeBy != 0)
+                {
+                    builder.Append(string.Format("  version made by: 0x{0:X4}\n", this._versionMadeBy));
+                }
+                if (this._versionNeededToExtract != 0)
+                {
+                    builder.Append(string.Format("needed to extract: 0x{0:X4}\n", this._versionNeededToExtract));
+                }
+
+                builder.Append(string.Format("       uses ZIP64: {0}\n", this.InputUsesZip64));
+
+                builder.Append(string.Format("     disk with CD: {0}\n", this._diskNumberWithCd));
+                if (this._OffsetOfCentralDirectory == 0xFFFFFFFF)
+                    builder.Append(string.Format("      CD64 offset: 0x{0:X16}\n", this._OffsetOfCentralDirectory64));
+                else
+                    builder.Append(string.Format("        CD offset: 0x{0:X8}\n", this._OffsetOfCentralDirectory));
+                builder.Append("\n");
+                foreach (ZipEntry entry in this._entries.Values)
+                {
+                    builder.Append(entry.Info);
+                }
+                return builder.ToString();
+            }
+        }
+
+
+    }
+
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ZipFile.Events.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ZipFile.Events.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ZipFile.Events.cs	(revision 12707)
@@ -0,0 +1,1219 @@
+// ZipFile.Events.cs
+// ------------------------------------------------------------------
+//
+// Copyright (c) 2008, 2009, 2011 Dino Chiesa .
+// All rights reserved.
+//
+// This code module is part of DotNetZip, a zipfile class library.
+//
+// ------------------------------------------------------------------
+//
+// This code is licensed under the Microsoft Public License.
+// See the file License.txt for the license details.
+// More info on: http://dotnetzip.codeplex.com
+//
+// ------------------------------------------------------------------
+//
+// last saved (in emacs):
+// Time-stamp: <2011-July-09 08:42:35>
+//
+// ------------------------------------------------------------------
+//
+// This module defines the methods for issuing events from the ZipFile class.
+//
+// ------------------------------------------------------------------
+//
+
+using System;
+using System.IO;
+
+namespace OfficeOpenXml.Packaging.Ionic.Zip
+{
+    internal partial class ZipFile
+    {
+        private string ArchiveNameForEvent
+        {
+            get
+            {
+                return (_name != null) ? _name : "(stream)";
+            }
+        }
+
+        #region Save
+
+        /// <summary>
+        ///   An event handler invoked when a Save() starts, before and after each
+        ///   entry has been written to the archive, when a Save() completes, and
+        ///   during other Save events.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   Depending on the particular event, different properties on the <see
+        ///   cref="SaveProgressEventArgs"/> parameter are set.  The following
+        ///   table summarizes the available EventTypes and the conditions under
+        ///   which this event handler is invoked with a
+        ///   <c>SaveProgressEventArgs</c> with the given EventType.
+        /// </para>
+        ///
+        /// <list type="table">
+        /// <listheader>
+        /// <term>value of EntryType</term>
+        /// <description>Meaning and conditions</description>
+        /// </listheader>
+        ///
+        /// <item>
+        /// <term>ZipProgressEventType.Saving_Started</term>
+        /// <description>Fired when ZipFile.Save() begins.
+        /// </description>
+        /// </item>
+        ///
+        /// <item>
+        /// <term>ZipProgressEventType.Saving_BeforeSaveEntry</term>
+        /// <description>
+        ///   Fired within ZipFile.Save(), just before writing data for each
+        ///   particular entry.
+        /// </description>
+        /// </item>
+        ///
+        /// <item>
+        /// <term>ZipProgressEventType.Saving_AfterSaveEntry</term>
+        /// <description>
+        ///   Fired within ZipFile.Save(), just after having finished writing data
+        ///   for each particular entry.
+        /// </description>
+        /// </item>
+        ///
+        /// <item>
+        /// <term>ZipProgressEventType.Saving_Completed</term>
+        /// <description>Fired when ZipFile.Save() has completed.
+        /// </description>
+        /// </item>
+        ///
+        /// <item>
+        /// <term>ZipProgressEventType.Saving_AfterSaveTempArchive</term>
+        /// <description>
+        ///   Fired after the temporary file has been created.  This happens only
+        ///   when saving to a disk file.  This event will not be invoked when
+        ///   saving to a stream.
+        /// </description>
+        /// </item>
+        ///
+        /// <item>
+        /// <term>ZipProgressEventType.Saving_BeforeRenameTempArchive</term>
+        /// <description>
+        ///   Fired just before renaming the temporary file to the permanent
+        ///   location.  This happens only when saving to a disk file.  This event
+        ///   will not be invoked when saving to a stream.
+        /// </description>
+        /// </item>
+        ///
+        /// <item>
+        /// <term>ZipProgressEventType.Saving_AfterRenameTempArchive</term>
+        /// <description>
+        ///   Fired just after renaming the temporary file to the permanent
+        ///   location.  This happens only when saving to a disk file.  This event
+        ///   will not be invoked when saving to a stream.
+        /// </description>
+        /// </item>
+        ///
+        /// <item>
+        /// <term>ZipProgressEventType.Saving_AfterCompileSelfExtractor</term>
+        /// <description>
+        ///   Fired after a self-extracting archive has finished compiling.  This
+        ///   EventType is used only within SaveSelfExtractor().
+        /// </description>
+        /// </item>
+        ///
+        /// <item>
+        /// <term>ZipProgressEventType.Saving_BytesRead</term>
+        /// <description>
+        ///   Set during the save of a particular entry, to update progress of the
+        ///   Save().  When this EventType is set, the BytesTransferred is the
+        ///   number of bytes that have been read from the source stream.  The
+        ///   TotalBytesToTransfer is the number of bytes in the uncompressed
+        ///   file.
+        /// </description>
+        /// </item>
+        ///
+        /// </list>
+        /// </remarks>
+        ///
+        /// <example>
+        ///
+        ///    This example uses an anonymous method to handle the
+        ///    SaveProgress event, by updating a progress bar.
+        ///
+        /// <code lang="C#">
+        /// progressBar1.Value = 0;
+        /// progressBar1.Max = listbox1.Items.Count;
+        /// using (ZipFile zip = new ZipFile())
+        /// {
+        ///    // listbox1 contains a list of filenames
+        ///    zip.AddFiles(listbox1.Items);
+        ///
+        ///    // do the progress bar:
+        ///    zip.SaveProgress += (sender, e) => {
+        ///       if (e.EventType == ZipProgressEventType.Saving_BeforeWriteEntry) {
+        ///          progressBar1.PerformStep();
+        ///       }
+        ///    };
+        ///
+        ///    zip.Save(fs);
+        /// }
+        /// </code>
+        /// </example>
+        ///
+        /// <example>
+        ///   This example uses a named method as the
+        ///   <c>SaveProgress</c> event handler, to update the user, in a
+        ///   console-based application.
+        ///
+        /// <code lang="C#">
+        /// static bool justHadByteUpdate= false;
+        /// public static void SaveProgress(object sender, SaveProgressEventArgs e)
+        /// {
+        ///     if (e.EventType == ZipProgressEventType.Saving_Started)
+        ///         Console.WriteLine("Saving: {0}", e.ArchiveName);
+        ///
+        ///     else if (e.EventType == ZipProgressEventType.Saving_Completed)
+        ///     {
+        ///         justHadByteUpdate= false;
+        ///         Console.WriteLine();
+        ///         Console.WriteLine("Done: {0}", e.ArchiveName);
+        ///     }
+        ///
+        ///     else if (e.EventType == ZipProgressEventType.Saving_BeforeWriteEntry)
+        ///     {
+        ///         if (justHadByteUpdate)
+        ///             Console.WriteLine();
+        ///         Console.WriteLine("  Writing: {0} ({1}/{2})",
+        ///                           e.CurrentEntry.FileName, e.EntriesSaved, e.EntriesTotal);
+        ///         justHadByteUpdate= false;
+        ///     }
+        ///
+        ///     else if (e.EventType == ZipProgressEventType.Saving_EntryBytesRead)
+        ///     {
+        ///         if (justHadByteUpdate)
+        ///             Console.SetCursorPosition(0, Console.CursorTop);
+        ///          Console.Write("     {0}/{1} ({2:N0}%)", e.BytesTransferred, e.TotalBytesToTransfer,
+        ///                       e.BytesTransferred / (0.01 * e.TotalBytesToTransfer ));
+        ///         justHadByteUpdate= true;
+        ///     }
+        /// }
+        ///
+        /// public static ZipUp(string targetZip, string directory)
+        /// {
+        ///   using (var zip = new ZipFile()) {
+        ///     zip.SaveProgress += SaveProgress;
+        ///     zip.AddDirectory(directory);
+        ///     zip.Save(targetZip);
+        ///   }
+        /// }
+        ///
+        /// </code>
+        ///
+        /// <code lang="VB">
+        /// Public Sub ZipUp(ByVal targetZip As String, ByVal directory As String)
+        ///     Using zip As ZipFile = New ZipFile
+        ///         AddHandler zip.SaveProgress, AddressOf MySaveProgress
+        ///         zip.AddDirectory(directory)
+        ///         zip.Save(targetZip)
+        ///     End Using
+        /// End Sub
+        ///
+        /// Private Shared justHadByteUpdate As Boolean = False
+        ///
+        /// Public Shared Sub MySaveProgress(ByVal sender As Object, ByVal e As SaveProgressEventArgs)
+        ///     If (e.EventType Is ZipProgressEventType.Saving_Started) Then
+        ///         Console.WriteLine("Saving: {0}", e.ArchiveName)
+        ///
+        ///     ElseIf (e.EventType Is ZipProgressEventType.Saving_Completed) Then
+        ///         justHadByteUpdate = False
+        ///         Console.WriteLine
+        ///         Console.WriteLine("Done: {0}", e.ArchiveName)
+        ///
+        ///     ElseIf (e.EventType Is ZipProgressEventType.Saving_BeforeWriteEntry) Then
+        ///         If justHadByteUpdate Then
+        ///             Console.WriteLine
+        ///         End If
+        ///         Console.WriteLine("  Writing: {0} ({1}/{2})", e.CurrentEntry.FileName, e.EntriesSaved, e.EntriesTotal)
+        ///         justHadByteUpdate = False
+        ///
+        ///     ElseIf (e.EventType Is ZipProgressEventType.Saving_EntryBytesRead) Then
+        ///         If justHadByteUpdate Then
+        ///             Console.SetCursorPosition(0, Console.CursorTop)
+        ///         End If
+        ///         Console.Write("     {0}/{1} ({2:N0}%)", e.BytesTransferred, _
+        ///                       e.TotalBytesToTransfer, _
+        ///                       (CDbl(e.BytesTransferred) / (0.01 * e.TotalBytesToTransfer)))
+        ///         justHadByteUpdate = True
+        ///     End If
+        /// End Sub
+        /// </code>
+        /// </example>
+        ///
+        /// <example>
+        ///
+        /// This is a more complete example of using the SaveProgress
+        /// events in a Windows Forms application, with a
+        /// Thread object.
+        ///
+        /// <code lang="C#">
+        /// delegate void SaveEntryProgress(SaveProgressEventArgs e);
+        /// delegate void ButtonClick(object sender, EventArgs e);
+        ///
+        /// internal class WorkerOptions
+        /// {
+        ///     public string ZipName;
+        ///     public string Folder;
+        ///     public string Encoding;
+        ///     public string Comment;
+        ///     public int ZipFlavor;
+        ///     public Zip64Option Zip64;
+        /// }
+        ///
+        /// private int _progress2MaxFactor;
+        /// private bool _saveCanceled;
+        /// private long _totalBytesBeforeCompress;
+        /// private long _totalBytesAfterCompress;
+        /// private Thread _workerThread;
+        ///
+        ///
+        /// private void btnZipup_Click(object sender, EventArgs e)
+        /// {
+        ///     KickoffZipup();
+        /// }
+        ///
+        /// private void btnCancel_Click(object sender, EventArgs e)
+        /// {
+        ///     if (this.lblStatus.InvokeRequired)
+        ///     {
+        ///         this.lblStatus.Invoke(new ButtonClick(this.btnCancel_Click), new object[] { sender, e });
+        ///     }
+        ///     else
+        ///     {
+        ///         _saveCanceled = true;
+        ///         lblStatus.Text = "Canceled...";
+        ///         ResetState();
+        ///     }
+        /// }
+        ///
+        /// private void KickoffZipup()
+        /// {
+        ///     _folderName = tbDirName.Text;
+        ///
+        ///     if (_folderName == null || _folderName == "") return;
+        ///     if (this.tbZipName.Text == null || this.tbZipName.Text == "") return;
+        ///
+        ///     // check for existence of the zip file:
+        ///     if (System.IO.File.Exists(this.tbZipName.Text))
+        ///     {
+        ///         var dlgResult = MessageBox.Show(String.Format("The file you have specified ({0}) already exists." +
+        ///                                                       "  Do you want to overwrite this file?", this.tbZipName.Text),
+        ///                                         "Confirmation is Required", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
+        ///         if (dlgResult != DialogResult.Yes) return;
+        ///         System.IO.File.Delete(this.tbZipName.Text);
+        ///     }
+        ///
+        ///      _saveCanceled = false;
+        ///     _nFilesCompleted = 0;
+        ///     _totalBytesAfterCompress = 0;
+        ///     _totalBytesBeforeCompress = 0;
+        ///     this.btnOk.Enabled = false;
+        ///     this.btnOk.Text = "Zipping...";
+        ///     this.btnCancel.Enabled = true;
+        ///     lblStatus.Text = "Zipping...";
+        ///
+        ///     var options = new WorkerOptions
+        ///     {
+        ///         ZipName = this.tbZipName.Text,
+        ///         Folder = _folderName,
+        ///         Encoding = "ibm437"
+        ///     };
+        ///
+        ///     if (this.comboBox1.SelectedIndex != 0)
+        ///     {
+        ///         options.Encoding = this.comboBox1.SelectedItem.ToString();
+        ///     }
+        ///
+        ///     if (this.radioFlavorSfxCmd.Checked)
+        ///         options.ZipFlavor = 2;
+        ///     else if (this.radioFlavorSfxGui.Checked)
+        ///         options.ZipFlavor = 1;
+        ///     else options.ZipFlavor = 0;
+        ///
+        ///     if (this.radioZip64AsNecessary.Checked)
+        ///         options.Zip64 = Zip64Option.AsNecessary;
+        ///     else if (this.radioZip64Always.Checked)
+        ///         options.Zip64 = Zip64Option.Always;
+        ///     else options.Zip64 = Zip64Option.Never;
+        ///
+        ///     options.Comment = String.Format("Encoding:{0} || Flavor:{1} || ZIP64:{2}\r\nCreated at {3} || {4}\r\n",
+        ///                 options.Encoding,
+        ///                 FlavorToString(options.ZipFlavor),
+        ///                 options.Zip64.ToString(),
+        ///                 System.DateTime.Now.ToString("yyyy-MMM-dd HH:mm:ss"),
+        ///                 this.Text);
+        ///
+        ///     if (this.tbComment.Text != TB_COMMENT_NOTE)
+        ///         options.Comment += this.tbComment.Text;
+        ///
+        ///     _workerThread = new Thread(this.DoSave);
+        ///     _workerThread.Name = "Zip Saver thread";
+        ///     _workerThread.Start(options);
+        ///     this.Cursor = Cursors.WaitCursor;
+        ///  }
+        ///
+        ///
+        /// private void DoSave(Object p)
+        /// {
+        ///     WorkerOptions options = p as WorkerOptions;
+        ///     try
+        ///     {
+        ///         using (var zip1 = new ZipFile())
+        ///         {
+        ///             zip1.ProvisionalAlternateEncoding = System.Text.Encoding.GetEncoding(options.Encoding);
+        ///             zip1.Comment = options.Comment;
+        ///             zip1.AddDirectory(options.Folder);
+        ///             _entriesToZip = zip1.EntryFileNames.Count;
+        ///             SetProgressBars();
+        ///             zip1.SaveProgress += this.zip1_SaveProgress;
+        ///
+        ///             zip1.UseZip64WhenSaving = options.Zip64;
+        ///
+        ///             if (options.ZipFlavor == 1)
+        ///                 zip1.SaveSelfExtractor(options.ZipName, SelfExtractorFlavor.WinFormsApplication);
+        ///             else if (options.ZipFlavor == 2)
+        ///                 zip1.SaveSelfExtractor(options.ZipName, SelfExtractorFlavor.ConsoleApplication);
+        ///             else
+        ///                 zip1.Save(options.ZipName);
+        ///         }
+        ///     }
+        ///     catch (System.Exception exc1)
+        ///     {
+        ///         MessageBox.Show(String.Format("Exception while zipping: {0}", exc1.Message));
+        ///         btnCancel_Click(null, null);
+        ///     }
+        /// }
+        ///
+        ///
+        ///
+        /// void zip1_SaveProgress(object sender, SaveProgressEventArgs e)
+        /// {
+        ///     switch (e.EventType)
+        ///     {
+        ///         case ZipProgressEventType.Saving_AfterWriteEntry:
+        ///             StepArchiveProgress(e);
+        ///             break;
+        ///         case ZipProgressEventType.Saving_EntryBytesRead:
+        ///             StepEntryProgress(e);
+        ///             break;
+        ///         case ZipProgressEventType.Saving_Completed:
+        ///             SaveCompleted();
+        ///             break;
+        ///         case ZipProgressEventType.Saving_AfterSaveTempArchive:
+        ///             // this event only occurs when saving an SFX file
+        ///             TempArchiveSaved();
+        ///             break;
+        ///     }
+        ///     if (_saveCanceled)
+        ///         e.Cancel = true;
+        /// }
+        ///
+        ///
+        ///
+        /// private void StepArchiveProgress(SaveProgressEventArgs e)
+        /// {
+        ///     if (this.progressBar1.InvokeRequired)
+        ///     {
+        ///         this.progressBar1.Invoke(new SaveEntryProgress(this.StepArchiveProgress), new object[] { e });
+        ///     }
+        ///     else
+        ///     {
+        ///         if (!_saveCanceled)
+        ///         {
+        ///             _nFilesCompleted++;
+        ///             this.progressBar1.PerformStep();
+        ///             _totalBytesAfterCompress += e.CurrentEntry.CompressedSize;
+        ///             _totalBytesBeforeCompress += e.CurrentEntry.UncompressedSize;
+        ///
+        ///             // reset the progress bar for the entry:
+        ///             this.progressBar2.Value = this.progressBar2.Maximum = 1;
+        ///
+        ///             this.Update();
+        ///         }
+        ///     }
+        /// }
+        ///
+        ///
+        /// private void StepEntryProgress(SaveProgressEventArgs e)
+        /// {
+        ///     if (this.progressBar2.InvokeRequired)
+        ///     {
+        ///         this.progressBar2.Invoke(new SaveEntryProgress(this.StepEntryProgress), new object[] { e });
+        ///     }
+        ///     else
+        ///     {
+        ///         if (!_saveCanceled)
+        ///         {
+        ///             if (this.progressBar2.Maximum == 1)
+        ///             {
+        ///                 // reset
+        ///                 Int64 max = e.TotalBytesToTransfer;
+        ///                 _progress2MaxFactor = 0;
+        ///                 while (max > System.Int32.MaxValue)
+        ///                 {
+        ///                     max /= 2;
+        ///                     _progress2MaxFactor++;
+        ///                 }
+        ///                 this.progressBar2.Maximum = (int)max;
+        ///                 lblStatus.Text = String.Format("{0} of {1} files...({2})",
+        ///                     _nFilesCompleted + 1, _entriesToZip, e.CurrentEntry.FileName);
+        ///             }
+        ///
+        ///              int xferred = e.BytesTransferred >> _progress2MaxFactor;
+        ///
+        ///              this.progressBar2.Value = (xferred >= this.progressBar2.Maximum)
+        ///                 ? this.progressBar2.Maximum
+        ///                 : xferred;
+        ///
+        ///              this.Update();
+        ///         }
+        ///     }
+        /// }
+        ///
+        /// private void SaveCompleted()
+        /// {
+        ///     if (this.lblStatus.InvokeRequired)
+        ///     {
+        ///         this.lblStatus.Invoke(new MethodInvoker(this.SaveCompleted));
+        ///     }
+        ///     else
+        ///     {
+        ///         lblStatus.Text = String.Format("Done, Compressed {0} files, {1:N0}% of original.",
+        ///             _nFilesCompleted, (100.00 * _totalBytesAfterCompress) / _totalBytesBeforeCompress);
+        ///          ResetState();
+        ///     }
+        /// }
+        ///
+        /// private void ResetState()
+        /// {
+        ///     this.btnCancel.Enabled = false;
+        ///     this.btnOk.Enabled = true;
+        ///     this.btnOk.Text = "Zip it!";
+        ///     this.progressBar1.Value = 0;
+        ///     this.progressBar2.Value = 0;
+        ///     this.Cursor = Cursors.Default;
+        ///     if (!_workerThread.IsAlive)
+        ///         _workerThread.Join();
+        /// }
+        /// </code>
+        ///
+        /// </example>
+        ///
+        /// <seealso cref="Ionic.Zip.ZipFile.ReadProgress"/>
+        /// <seealso cref="Ionic.Zip.ZipFile.AddProgress"/>
+        /// <seealso cref="Ionic.Zip.ZipFile.ExtractProgress"/>
+        internal event EventHandler<SaveProgressEventArgs> SaveProgress;
+
+
+        internal bool OnSaveBlock(ZipEntry entry, Int64 bytesXferred, Int64 totalBytesToXfer)
+        {
+            EventHandler<SaveProgressEventArgs> sp = SaveProgress;
+            if (sp != null)
+            {
+                var e = SaveProgressEventArgs.ByteUpdate(ArchiveNameForEvent, entry,
+                                                         bytesXferred, totalBytesToXfer);
+                sp(this, e);
+                if (e.Cancel)
+                    _saveOperationCanceled = true;
+            }
+            return _saveOperationCanceled;
+        }
+
+        private void OnSaveEntry(int current, ZipEntry entry, bool before)
+        {
+            EventHandler<SaveProgressEventArgs> sp = SaveProgress;
+            if (sp != null)
+            {
+                var e = new SaveProgressEventArgs(ArchiveNameForEvent, before, _entries.Count, current, entry);
+                sp(this, e);
+                if (e.Cancel)
+                    _saveOperationCanceled = true;
+            }
+        }
+
+        private void OnSaveEvent(ZipProgressEventType eventFlavor)
+        {
+            EventHandler<SaveProgressEventArgs> sp = SaveProgress;
+            if (sp != null)
+            {
+                var e = new SaveProgressEventArgs(ArchiveNameForEvent, eventFlavor);
+                sp(this, e);
+                if (e.Cancel)
+                    _saveOperationCanceled = true;
+            }
+        }
+
+        private void OnSaveStarted()
+        {
+            EventHandler<SaveProgressEventArgs> sp = SaveProgress;
+            if (sp != null)
+            {
+                var e = SaveProgressEventArgs.Started(ArchiveNameForEvent);
+                sp(this, e);
+                if (e.Cancel)
+                    _saveOperationCanceled = true;
+            }
+        }
+        private void OnSaveCompleted()
+        {
+            EventHandler<SaveProgressEventArgs> sp = SaveProgress;
+            if (sp != null)
+            {
+                var e = SaveProgressEventArgs.Completed(ArchiveNameForEvent);
+                sp(this, e);
+            }
+        }
+        #endregion
+
+
+        #region Read
+        /// <summary>
+        /// An event handler invoked before, during, and after the reading of a zip archive.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        /// Depending on the particular event being signaled, different properties on the
+        /// <see cref="ReadProgressEventArgs"/> parameter are set.  The following table
+        /// summarizes the available EventTypes and the conditions under which this
+        /// event handler is invoked with a <c>ReadProgressEventArgs</c> with the given EventType.
+        /// </para>
+        ///
+        /// <list type="table">
+        /// <listheader>
+        /// <term>value of EntryType</term>
+        /// <description>Meaning and conditions</description>
+        /// </listheader>
+        ///
+        /// <item>
+        /// <term>ZipProgressEventType.Reading_Started</term>
+        /// <description>Fired just as ZipFile.Read() begins. Meaningful properties: ArchiveName.
+        /// </description>
+        /// </item>
+        ///
+        /// <item>
+        /// <term>ZipProgressEventType.Reading_Completed</term>
+        /// <description>Fired when ZipFile.Read() has completed. Meaningful properties: ArchiveName.
+        /// </description>
+        /// </item>
+        ///
+        /// <item>
+        /// <term>ZipProgressEventType.Reading_ArchiveBytesRead</term>
+        /// <description>Fired while reading, updates the number of bytes read for the entire archive.
+        /// Meaningful properties: ArchiveName, CurrentEntry, BytesTransferred, TotalBytesToTransfer.
+        /// </description>
+        /// </item>
+        ///
+        /// <item>
+        /// <term>ZipProgressEventType.Reading_BeforeReadEntry</term>
+        /// <description>Indicates an entry is about to be read from the archive.
+        /// Meaningful properties: ArchiveName, EntriesTotal.
+        /// </description>
+        /// </item>
+        ///
+        /// <item>
+        /// <term>ZipProgressEventType.Reading_AfterReadEntry</term>
+        /// <description>Indicates an entry has just been read from the archive.
+        /// Meaningful properties: ArchiveName, EntriesTotal, CurrentEntry.
+        /// </description>
+        /// </item>
+        ///
+        /// </list>
+        /// </remarks>
+        ///
+        /// <seealso cref="Ionic.Zip.ZipFile.SaveProgress"/>
+        /// <seealso cref="Ionic.Zip.ZipFile.AddProgress"/>
+        /// <seealso cref="Ionic.Zip.ZipFile.ExtractProgress"/>
+        internal event EventHandler<ReadProgressEventArgs> ReadProgress;
+
+        private void OnReadStarted()
+        {
+            EventHandler<ReadProgressEventArgs> rp = ReadProgress;
+            if (rp != null)
+            {
+                    var e = ReadProgressEventArgs.Started(ArchiveNameForEvent);
+                    rp(this, e);
+            }
+        }
+
+        private void OnReadCompleted()
+        {
+            EventHandler<ReadProgressEventArgs> rp = ReadProgress;
+            if (rp != null)
+            {
+                    var e = ReadProgressEventArgs.Completed(ArchiveNameForEvent);
+                    rp(this, e);
+            }
+        }
+
+        internal void OnReadBytes(ZipEntry entry)
+        {
+            EventHandler<ReadProgressEventArgs> rp = ReadProgress;
+            if (rp != null)
+            {
+                    var e = ReadProgressEventArgs.ByteUpdate(ArchiveNameForEvent,
+                                        entry,
+                                        ReadStream.Position,
+                                        LengthOfReadStream);
+                    rp(this, e);
+            }
+        }
+
+        internal void OnReadEntry(bool before, ZipEntry entry)
+        {
+            EventHandler<ReadProgressEventArgs> rp = ReadProgress;
+            if (rp != null)
+            {
+                ReadProgressEventArgs e = (before)
+                    ? ReadProgressEventArgs.Before(ArchiveNameForEvent, _entries.Count)
+                    : ReadProgressEventArgs.After(ArchiveNameForEvent, entry, _entries.Count);
+                rp(this, e);
+            }
+        }
+
+        private Int64 _lengthOfReadStream = -99;
+        private Int64 LengthOfReadStream
+        {
+            get
+            {
+                if (_lengthOfReadStream == -99)
+                {
+                    _lengthOfReadStream = (_ReadStreamIsOurs)
+                        ? SharedUtilities.GetFileLength(_name)
+                        : -1L;
+                }
+                return _lengthOfReadStream;
+            }
+        }
+        #endregion
+
+
+        #region Extract
+        /// <summary>
+        ///   An event handler invoked before, during, and after extraction of
+        ///   entries in the zip archive.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   Depending on the particular event, different properties on the <see
+        ///   cref="ExtractProgressEventArgs"/> parameter are set.  The following
+        ///   table summarizes the available EventTypes and the conditions under
+        ///   which this event handler is invoked with a
+        ///   <c>ExtractProgressEventArgs</c> with the given EventType.
+        /// </para>
+        ///
+        /// <list type="table">
+        /// <listheader>
+        /// <term>value of EntryType</term>
+        /// <description>Meaning and conditions</description>
+        /// </listheader>
+        ///
+        /// <item>
+        /// <term>ZipProgressEventType.Extracting_BeforeExtractAll</term>
+        /// <description>
+        ///   Set when ExtractAll() begins. The ArchiveName, Overwrite, and
+        ///   ExtractLocation properties are meaningful.</description>
+        /// </item>
+        ///
+        /// <item>
+        /// <term>ZipProgressEventType.Extracting_AfterExtractAll</term>
+        /// <description>
+        ///   Set when ExtractAll() has completed.  The ArchiveName, Overwrite,
+        ///   and ExtractLocation properties are meaningful.
+        /// </description>
+        /// </item>
+        ///
+        /// <item>
+        /// <term>ZipProgressEventType.Extracting_BeforeExtractEntry</term>
+        /// <description>
+        ///   Set when an Extract() on an entry in the ZipFile has begun.
+        ///   Properties that are meaningful: ArchiveName, EntriesTotal,
+        ///   CurrentEntry, Overwrite, ExtractLocation, EntriesExtracted.
+        /// </description>
+        /// </item>
+        ///
+        /// <item>
+        /// <term>ZipProgressEventType.Extracting_AfterExtractEntry</term>
+        /// <description>
+        ///   Set when an Extract() on an entry in the ZipFile has completed.
+        ///   Properties that are meaningful: ArchiveName, EntriesTotal,
+        ///   CurrentEntry, Overwrite, ExtractLocation, EntriesExtracted.
+        /// </description>
+        /// </item>
+        ///
+        /// <item>
+        /// <term>ZipProgressEventType.Extracting_EntryBytesWritten</term>
+        /// <description>
+        ///   Set within a call to Extract() on an entry in the ZipFile, as data
+        ///   is extracted for the entry.  Properties that are meaningful:
+        ///   ArchiveName, CurrentEntry, BytesTransferred, TotalBytesToTransfer.
+        /// </description>
+        /// </item>
+        ///
+        /// <item>
+        /// <term>ZipProgressEventType.Extracting_ExtractEntryWouldOverwrite</term>
+        /// <description>
+        ///   Set within a call to Extract() on an entry in the ZipFile, when the
+        ///   extraction would overwrite an existing file. This event type is used
+        ///   only when <c>ExtractExistingFileAction</c> on the <c>ZipFile</c> or
+        ///   <c>ZipEntry</c> is set to <c>InvokeExtractProgressEvent</c>.
+        /// </description>
+        /// </item>
+        ///
+        /// </list>
+        ///
+        /// </remarks>
+        ///
+        /// <example>
+        /// <code>
+        /// private static bool justHadByteUpdate = false;
+        /// public static void ExtractProgress(object sender, ExtractProgressEventArgs e)
+        /// {
+        ///   if(e.EventType == ZipProgressEventType.Extracting_EntryBytesWritten)
+        ///   {
+        ///     if (justHadByteUpdate)
+        ///       Console.SetCursorPosition(0, Console.CursorTop);
+        ///
+        ///     Console.Write("   {0}/{1} ({2:N0}%)", e.BytesTransferred, e.TotalBytesToTransfer,
+        ///                   e.BytesTransferred / (0.01 * e.TotalBytesToTransfer ));
+        ///     justHadByteUpdate = true;
+        ///   }
+        ///   else if(e.EventType == ZipProgressEventType.Extracting_BeforeExtractEntry)
+        ///   {
+        ///     if (justHadByteUpdate)
+        ///       Console.WriteLine();
+        ///     Console.WriteLine("Extracting: {0}", e.CurrentEntry.FileName);
+        ///     justHadByteUpdate= false;
+        ///   }
+        /// }
+        ///
+        /// public static ExtractZip(string zipToExtract, string directory)
+        /// {
+        ///   string TargetDirectory= "extract";
+        ///   using (var zip = ZipFile.Read(zipToExtract)) {
+        ///     zip.ExtractProgress += ExtractProgress;
+        ///     foreach (var e in zip1)
+        ///     {
+        ///       e.Extract(TargetDirectory, true);
+        ///     }
+        ///   }
+        /// }
+        ///
+        /// </code>
+        /// <code lang="VB">
+        /// Public Shared Sub Main(ByVal args As String())
+        ///     Dim ZipToUnpack As String = "C1P3SML.zip"
+        ///     Dim TargetDir As String = "ExtractTest_Extract"
+        ///     Console.WriteLine("Extracting file {0} to {1}", ZipToUnpack, TargetDir)
+        ///     Using zip1 As ZipFile = ZipFile.Read(ZipToUnpack)
+        ///         AddHandler zip1.ExtractProgress, AddressOf MyExtractProgress
+        ///         Dim e As ZipEntry
+        ///         For Each e In zip1
+        ///             e.Extract(TargetDir, True)
+        ///         Next
+        ///     End Using
+        /// End Sub
+        ///
+        /// Private Shared justHadByteUpdate As Boolean = False
+        ///
+        /// Public Shared Sub MyExtractProgress(ByVal sender As Object, ByVal e As ExtractProgressEventArgs)
+        ///     If (e.EventType = ZipProgressEventType.Extracting_EntryBytesWritten) Then
+        ///         If ExtractTest.justHadByteUpdate Then
+        ///             Console.SetCursorPosition(0, Console.CursorTop)
+        ///         End If
+        ///         Console.Write("   {0}/{1} ({2:N0}%)", e.BytesTransferred, e.TotalBytesToTransfer, (CDbl(e.BytesTransferred) / (0.01 * e.TotalBytesToTransfer)))
+        ///         ExtractTest.justHadByteUpdate = True
+        ///     ElseIf (e.EventType = ZipProgressEventType.Extracting_BeforeExtractEntry) Then
+        ///         If ExtractTest.justHadByteUpdate Then
+        ///             Console.WriteLine
+        ///         End If
+        ///         Console.WriteLine("Extracting: {0}", e.CurrentEntry.FileName)
+        ///         ExtractTest.justHadByteUpdate = False
+        ///     End If
+        /// End Sub
+        /// </code>
+        /// </example>
+        ///
+        /// <seealso cref="Ionic.Zip.ZipFile.SaveProgress"/>
+        /// <seealso cref="Ionic.Zip.ZipFile.ReadProgress"/>
+        /// <seealso cref="Ionic.Zip.ZipFile.AddProgress"/>
+        internal event EventHandler<ExtractProgressEventArgs> ExtractProgress;
+
+
+
+        private void OnExtractEntry(int current, bool before, ZipEntry currentEntry, string path)
+        {
+            EventHandler<ExtractProgressEventArgs> ep = ExtractProgress;
+            if (ep != null)
+            {
+                var e = new ExtractProgressEventArgs(ArchiveNameForEvent, before, _entries.Count, current, currentEntry, path);
+                ep(this, e);
+                if (e.Cancel)
+                    _extractOperationCanceled = true;
+            }
+        }
+
+
+        // Can be called from within ZipEntry._ExtractOne.
+        internal bool OnExtractBlock(ZipEntry entry, Int64 bytesWritten, Int64 totalBytesToWrite)
+        {
+            EventHandler<ExtractProgressEventArgs> ep = ExtractProgress;
+            if (ep != null)
+            {
+                var e = ExtractProgressEventArgs.ByteUpdate(ArchiveNameForEvent, entry,
+                                                            bytesWritten, totalBytesToWrite);
+                ep(this, e);
+                if (e.Cancel)
+                    _extractOperationCanceled = true;
+            }
+            return _extractOperationCanceled;
+        }
+
+
+        // Can be called from within ZipEntry.InternalExtract.
+        internal bool OnSingleEntryExtract(ZipEntry entry, string path, bool before)
+        {
+            EventHandler<ExtractProgressEventArgs> ep = ExtractProgress;
+            if (ep != null)
+            {
+                var e = (before)
+                    ? ExtractProgressEventArgs.BeforeExtractEntry(ArchiveNameForEvent, entry, path)
+                    : ExtractProgressEventArgs.AfterExtractEntry(ArchiveNameForEvent, entry, path);
+                ep(this, e);
+                if (e.Cancel)
+                    _extractOperationCanceled = true;
+            }
+            return _extractOperationCanceled;
+        }
+
+        internal bool OnExtractExisting(ZipEntry entry, string path)
+        {
+            EventHandler<ExtractProgressEventArgs> ep = ExtractProgress;
+            if (ep != null)
+            {
+                var e = ExtractProgressEventArgs.ExtractExisting(ArchiveNameForEvent, entry, path);
+                ep(this, e);
+                if (e.Cancel)
+                    _extractOperationCanceled = true;
+            }
+            return _extractOperationCanceled;
+        }
+
+
+        private void OnExtractAllCompleted(string path)
+        {
+            EventHandler<ExtractProgressEventArgs> ep = ExtractProgress;
+            if (ep != null)
+            {
+                var e = ExtractProgressEventArgs.ExtractAllCompleted(ArchiveNameForEvent,
+                                                                     path );
+                ep(this, e);
+            }
+        }
+
+
+        private void OnExtractAllStarted(string path)
+        {
+            EventHandler<ExtractProgressEventArgs> ep = ExtractProgress;
+            if (ep != null)
+            {
+                var e = ExtractProgressEventArgs.ExtractAllStarted(ArchiveNameForEvent,
+                                                                   path );
+                ep(this, e);
+            }
+        }
+
+
+        #endregion
+
+
+
+        #region Add
+        /// <summary>
+        /// An event handler invoked before, during, and after Adding entries to a zip archive.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///     Adding a large number of entries to a zip file can take a long
+        ///     time.  For example, when calling <see cref="AddDirectory(string)"/> on a
+        ///     directory that contains 50,000 files, it could take 3 minutes or so.
+        ///     This event handler allws an application to track the progress of the Add
+        ///     operation, and to optionally cancel a lengthy Add operation.
+        /// </remarks>
+        ///
+        /// <example>
+        /// <code lang="C#">
+        ///
+        /// int _numEntriesToAdd= 0;
+        /// int _numEntriesAdded= 0;
+        /// void AddProgressHandler(object sender, AddProgressEventArgs e)
+        /// {
+        ///     switch (e.EventType)
+        ///     {
+        ///         case ZipProgressEventType.Adding_Started:
+        ///             Console.WriteLine("Adding files to the zip...");
+        ///             break;
+        ///         case ZipProgressEventType.Adding_AfterAddEntry:
+        ///             _numEntriesAdded++;
+        ///             Console.WriteLine(String.Format("Adding file {0}/{1} :: {2}",
+        ///                                      _numEntriesAdded, _numEntriesToAdd, e.CurrentEntry.FileName));
+        ///             break;
+        ///         case ZipProgressEventType.Adding_Completed:
+        ///             Console.WriteLine("Added all files");
+        ///             break;
+        ///     }
+        /// }
+        ///
+        /// void CreateTheZip()
+        /// {
+        ///     using (ZipFile zip = new ZipFile())
+        ///     {
+        ///         zip.AddProgress += AddProgressHandler;
+        ///         zip.AddDirectory(System.IO.Path.GetFileName(DirToZip));
+        ///         zip.Save(ZipFileToCreate);
+        ///     }
+        /// }
+        ///
+        /// </code>
+        ///
+        /// <code lang="VB">
+        ///
+        /// Private Sub AddProgressHandler(ByVal sender As Object, ByVal e As AddProgressEventArgs)
+        ///     Select Case e.EventType
+        ///         Case ZipProgressEventType.Adding_Started
+        ///             Console.WriteLine("Adding files to the zip...")
+        ///             Exit Select
+        ///         Case ZipProgressEventType.Adding_AfterAddEntry
+        ///             Console.WriteLine(String.Format("Adding file {0}", e.CurrentEntry.FileName))
+        ///             Exit Select
+        ///         Case ZipProgressEventType.Adding_Completed
+        ///             Console.WriteLine("Added all files")
+        ///             Exit Select
+        ///     End Select
+        /// End Sub
+        ///
+        /// Sub CreateTheZip()
+        ///     Using zip as ZipFile = New ZipFile
+        ///         AddHandler zip.AddProgress, AddressOf AddProgressHandler
+        ///         zip.AddDirectory(System.IO.Path.GetFileName(DirToZip))
+        ///         zip.Save(ZipFileToCreate);
+        ///     End Using
+        /// End Sub
+        ///
+        /// </code>
+        ///
+        /// </example>
+        ///
+        /// <seealso cref="Ionic.Zip.ZipFile.SaveProgress"/>
+        /// <seealso cref="Ionic.Zip.ZipFile.ReadProgress"/>
+        /// <seealso cref="Ionic.Zip.ZipFile.ExtractProgress"/>
+        internal event EventHandler<AddProgressEventArgs> AddProgress;
+
+        private void OnAddStarted()
+        {
+            EventHandler<AddProgressEventArgs> ap = AddProgress;
+            if (ap != null)
+            {
+                var e = AddProgressEventArgs.Started(ArchiveNameForEvent);
+                ap(this, e);
+                if (e.Cancel) // workitem 13371
+                    _addOperationCanceled = true;
+            }
+        }
+
+        private void OnAddCompleted()
+        {
+            EventHandler<AddProgressEventArgs> ap = AddProgress;
+            if (ap != null)
+            {
+                var e = AddProgressEventArgs.Completed(ArchiveNameForEvent);
+                ap(this, e);
+            }
+        }
+
+        internal void AfterAddEntry(ZipEntry entry)
+        {
+            EventHandler<AddProgressEventArgs> ap = AddProgress;
+            if (ap != null)
+            {
+                var e = AddProgressEventArgs.AfterEntry(ArchiveNameForEvent, entry, _entries.Count);
+                ap(this, e);
+                if (e.Cancel) // workitem 13371
+                    _addOperationCanceled = true;
+            }
+        }
+
+        #endregion
+
+
+
+        #region Error
+        /// <summary>
+        /// An event that is raised when an error occurs during open or read of files
+        /// while saving a zip archive.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///  <para>
+        ///     Errors can occur as a file is being saved to the zip archive.  For
+        ///     example, the File.Open may fail, or a File.Read may fail, because of
+        ///     lock conflicts or other reasons.  If you add a handler to this event,
+        ///     you can handle such errors in your own code.  If you don't add a
+        ///     handler, the library will throw an exception if it encounters an I/O
+        ///     error during a call to <c>Save()</c>.
+        ///  </para>
+        ///
+        ///  <para>
+        ///    Setting a handler implicitly sets <see cref="ZipFile.ZipErrorAction"/> to
+        ///    <c>ZipErrorAction.InvokeErrorEvent</c>.
+        ///  </para>
+        ///
+        ///  <para>
+        ///    The handler you add applies to all <see cref="ZipEntry"/> items that are
+        ///    subsequently added to the <c>ZipFile</c> instance. If you set this
+        ///    property after you have added items to the <c>ZipFile</c>, but before you
+        ///    have called <c>Save()</c>, errors that occur while saving those items
+        ///    will not cause the error handler to be invoked.
+        ///  </para>
+        ///
+        ///  <para>
+        ///    If you want to handle any errors that occur with any entry in the zip
+        ///    file using the same error handler, then add your error handler once,
+        ///    before adding any entries to the zip archive.
+        ///  </para>
+        ///
+        ///  <para>
+        ///    In the error handler method, you need to set the <see
+        ///    cref="ZipEntry.ZipErrorAction"/> property on the
+        ///    <c>ZipErrorEventArgs.CurrentEntry</c>.  This communicates back to
+        ///    DotNetZip what you would like to do with this particular error.  Within
+        ///    an error handler, if you set the <c>ZipEntry.ZipErrorAction</c> property
+        ///    on the <c>ZipEntry</c> to <c>ZipErrorAction.InvokeErrorEvent</c> or if
+        ///    you don't set it at all, the library will throw the exception. (It is the
+        ///    same as if you had set the <c>ZipEntry.ZipErrorAction</c> property on the
+        ///    <c>ZipEntry</c> to <c>ZipErrorAction.Throw</c>.) If you set the
+        ///    <c>ZipErrorEventArgs.Cancel</c> to true, the entire <c>Save()</c> will be
+        ///    canceled.
+        ///  </para>
+        ///
+        ///  <para>
+        ///    In the case that you use <c>ZipErrorAction.Skip</c>, implying that
+        ///    you want to skip the entry for which there's been an error, DotNetZip
+        ///    tries to seek backwards in the output stream, and truncate all bytes
+        ///    written on behalf of that particular entry. This works only if the
+        ///    output stream is seekable.  It will not work, for example, when using
+        ///    ASPNET's Response.OutputStream.
+        ///  </para>
+        ///
+        /// </remarks>
+        ///
+        /// <example>
+        ///
+        /// This example shows how to use an event handler to handle
+        /// errors during save of the zip file.
+        /// <code lang="C#">
+        ///
+        /// public static void MyZipError(object sender, ZipErrorEventArgs e)
+        /// {
+        ///     Console.WriteLine("Error saving {0}...", e.FileName);
+        ///     Console.WriteLine("   Exception: {0}", e.exception);
+        ///     ZipEntry entry = e.CurrentEntry;
+        ///     string response = null;
+        ///     // Ask the user whether he wants to skip this error or not
+        ///     do
+        ///     {
+        ///         Console.Write("Retry, Skip, Throw, or Cancel ? (R/S/T/C) ");
+        ///         response = Console.ReadLine();
+        ///         Console.WriteLine();
+        ///
+        ///     } while (response != null &amp;&amp;
+        ///              response[0]!='S' &amp;&amp; response[0]!='s' &amp;&amp;
+        ///              response[0]!='R' &amp;&amp; response[0]!='r' &amp;&amp;
+        ///              response[0]!='T' &amp;&amp; response[0]!='t' &amp;&amp;
+        ///              response[0]!='C' &amp;&amp; response[0]!='c');
+        ///
+        ///     e.Cancel = (response[0]=='C' || response[0]=='c');
+        ///
+        ///     if (response[0]=='S' || response[0]=='s')
+        ///         entry.ZipErrorAction = ZipErrorAction.Skip;
+        ///     else if (response[0]=='R' || response[0]=='r')
+        ///         entry.ZipErrorAction = ZipErrorAction.Retry;
+        ///     else if (response[0]=='T' || response[0]=='t')
+        ///         entry.ZipErrorAction = ZipErrorAction.Throw;
+        /// }
+        ///
+        /// public void SaveTheFile()
+        /// {
+        ///   string directoryToZip = "fodder";
+        ///   string directoryInArchive = "files";
+        ///   string zipFileToCreate = "Archive.zip";
+        ///   using (var zip = new ZipFile())
+        ///   {
+        ///     // set the event handler before adding any entries
+        ///     zip.ZipError += MyZipError;
+        ///     zip.AddDirectory(directoryToZip, directoryInArchive);
+        ///     zip.Save(zipFileToCreate);
+        ///   }
+        /// }
+        /// </code>
+        ///
+        /// <code lang="VB">
+        /// Private Sub MyZipError(ByVal sender As Object, ByVal e As Ionic.Zip.ZipErrorEventArgs)
+        ///     ' At this point, the application could prompt the user for an action to take.
+        ///     ' But in this case, this application will simply automatically skip the file, in case of error.
+        ///     Console.WriteLine("Zip Error,  entry {0}", e.CurrentEntry.FileName)
+        ///     Console.WriteLine("   Exception: {0}", e.exception)
+        ///     ' set the desired ZipErrorAction on the CurrentEntry to communicate that to DotNetZip
+        ///     e.CurrentEntry.ZipErrorAction = Zip.ZipErrorAction.Skip
+        /// End Sub
+        ///
+        /// Public Sub SaveTheFile()
+        ///     Dim directoryToZip As String = "fodder"
+        ///     Dim directoryInArchive As String = "files"
+        ///     Dim zipFileToCreate as String = "Archive.zip"
+        ///     Using zipArchive As ZipFile = New ZipFile
+        ///         ' set the event handler before adding any entries
+        ///         AddHandler zipArchive.ZipError, AddressOf MyZipError
+        ///         zipArchive.AddDirectory(directoryToZip, directoryInArchive)
+        ///         zipArchive.Save(zipFileToCreate)
+        ///     End Using
+        /// End Sub
+        ///
+        /// </code>
+        /// </example>
+        ///
+        /// <seealso cref="Ionic.Zip.ZipFile.ZipErrorAction"/>
+        internal event EventHandler<ZipErrorEventArgs> ZipError;
+
+        internal bool OnZipErrorSaving(ZipEntry entry, Exception exc)
+        {
+            if (ZipError != null)
+            {
+                lock (LOCK)
+                {
+                    var e = ZipErrorEventArgs.Saving(this.Name, entry, exc);
+                    ZipError(this, e);
+                    if (e.Cancel)
+                        _saveOperationCanceled = true;
+                }
+            }
+            return _saveOperationCanceled;
+        }
+        #endregion
+
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ZipFile.Extract.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ZipFile.Extract.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ZipFile.Extract.cs	(revision 12707)
@@ -0,0 +1,298 @@
+// ZipFile.Extract.cs
+// ------------------------------------------------------------------
+//
+// Copyright (c) 2009 Dino Chiesa.
+// All rights reserved.
+//
+// This code module is part of DotNetZip, a zipfile class library.
+//
+// ------------------------------------------------------------------
+//
+// This code is licensed under the Microsoft Public License.
+// See the file License.txt for the license details.
+// More info on: http://dotnetzip.codeplex.com
+//
+// ------------------------------------------------------------------
+//
+// last saved (in emacs):
+// Time-stamp: <2011-July-31 14:45:18>
+//
+// ------------------------------------------------------------------
+//
+// This module defines the methods for Extract operations on zip files.
+//
+// ------------------------------------------------------------------
+//
+
+
+using System;
+using System.IO;
+using System.Collections.Generic;
+
+namespace OfficeOpenXml.Packaging.Ionic.Zip
+{
+
+    internal partial class ZipFile
+    {
+
+        /// <summary>
+        /// Extracts all of the items in the zip archive, to the specified path in the
+        /// filesystem.  The path can be relative or fully-qualified.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   This method will extract all entries in the <c>ZipFile</c> to the
+        ///   specified path.
+        /// </para>
+        ///
+        /// <para>
+        ///   If an extraction of a file from the zip archive would overwrite an
+        ///   existing file in the filesystem, the action taken is dictated by the
+        ///   ExtractExistingFile property, which overrides any setting you may have
+        ///   made on individual ZipEntry instances.  By default, if you have not
+        ///   set that property on the <c>ZipFile</c> instance, the entry will not
+        ///   be extracted, the existing file will not be overwritten and an
+        ///   exception will be thrown. To change this, set the property, or use the
+        ///   <see cref="ZipFile.ExtractAll(string,
+        ///   Ionic.Zip.ExtractExistingFileAction)" /> overload that allows you to
+        ///   specify an ExtractExistingFileAction parameter.
+        /// </para>
+        ///
+        /// <para>
+        ///   The action to take when an extract would overwrite an existing file
+        ///   applies to all entries.  If you want to set this on a per-entry basis,
+        ///   then you must use one of the <see
+        ///   cref="ZipEntry.Extract()">ZipEntry.Extract</see> methods.
+        /// </para>
+        ///
+        /// <para>
+        ///   This method will send verbose output messages to the <see
+        ///   cref="StatusMessageTextWriter"/>, if it is set on the <c>ZipFile</c>
+        ///   instance.
+        /// </para>
+        ///
+        /// <para>
+        /// You may wish to take advantage of the <c>ExtractProgress</c> event.
+        /// </para>
+        ///
+        /// <para>
+        ///   About timestamps: When extracting a file entry from a zip archive, the
+        ///   extracted file gets the last modified time of the entry as stored in
+        ///   the archive. The archive may also store extended file timestamp
+        ///   information, including last accessed and created times. If these are
+        ///   present in the <c>ZipEntry</c>, then the extracted file will also get
+        ///   these times.
+        /// </para>
+        ///
+        /// <para>
+        ///   A Directory entry is somewhat different. It will get the times as
+        ///   described for a file entry, but, if there are file entries in the zip
+        ///   archive that, when extracted, appear in the just-created directory,
+        ///   then when those file entries are extracted, the last modified and last
+        ///   accessed times of the directory will change, as a side effect.  The
+        ///   result is that after an extraction of a directory and a number of
+        ///   files within the directory, the last modified and last accessed
+        ///   timestamps on the directory will reflect the time that the last file
+        ///   was extracted into the directory, rather than the time stored in the
+        ///   zip archive for the directory.
+        /// </para>
+        ///
+        /// <para>
+        ///   To compensate, when extracting an archive with <c>ExtractAll</c>,
+        ///   DotNetZip will extract all the file and directory entries as described
+        ///   above, but it will then make a second pass on the directories, and
+        ///   reset the times on the directories to reflect what is stored in the
+        ///   zip archive.
+        /// </para>
+        ///
+        /// <para>
+        ///   This compensation is performed only within the context of an
+        ///   <c>ExtractAll</c>. If you call <c>ZipEntry.Extract</c> on a directory
+        ///   entry, the timestamps on directory in the filesystem will reflect the
+        ///   times stored in the zip.  If you then call <c>ZipEntry.Extract</c> on
+        ///   a file entry, which is extracted into the directory, the timestamps on
+        ///   the directory will be updated to the current time.
+        /// </para>
+        /// </remarks>
+        ///
+        /// <example>
+        ///   This example extracts all the entries in a zip archive file, to the
+        ///   specified target directory.  The extraction will overwrite any
+        ///   existing files silently.
+        ///
+        /// <code>
+        /// String TargetDirectory= "unpack";
+        /// using(ZipFile zip= ZipFile.Read(ZipFileToExtract))
+        /// {
+        ///     zip.ExtractExistingFile= ExtractExistingFileAction.OverwriteSilently;
+        ///     zip.ExtractAll(TargetDirectory);
+        /// }
+        /// </code>
+        ///
+        /// <code lang="VB">
+        /// Dim TargetDirectory As String = "unpack"
+        /// Using zip As ZipFile = ZipFile.Read(ZipFileToExtract)
+        ///     zip.ExtractExistingFile= ExtractExistingFileAction.OverwriteSilently
+        ///     zip.ExtractAll(TargetDirectory)
+        /// End Using
+        /// </code>
+        /// </example>
+        ///
+        /// <seealso cref="Ionic.Zip.ZipFile.ExtractProgress"/>
+        /// <seealso cref="Ionic.Zip.ZipFile.ExtractExistingFile"/>
+        ///
+        /// <param name="path">
+        ///   The path to which the contents of the zipfile will be extracted.
+        ///   The path can be relative or fully-qualified.
+        /// </param>
+        ///
+        public void ExtractAll(string path)
+        {
+            _InternalExtractAll(path, true);
+        }
+
+
+
+        /// <summary>
+        /// Extracts all of the items in the zip archive, to the specified path in the
+        /// filesystem, using the specified behavior when extraction would overwrite an
+        /// existing file.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///
+        /// <para>
+        /// This method will extract all entries in the <c>ZipFile</c> to the specified
+        /// path.  For an extraction that would overwrite an existing file, the behavior
+        /// is dictated by <paramref name="extractExistingFile"/>, which overrides any
+        /// setting you may have made on individual ZipEntry instances.
+        /// </para>
+        ///
+        /// <para>
+        /// The action to take when an extract would overwrite an existing file
+        /// applies to all entries.  If you want to set this on a per-entry basis,
+        /// then you must use <see cref="ZipEntry.Extract(String,
+        /// ExtractExistingFileAction)" /> or one of the similar methods.
+        /// </para>
+        ///
+        /// <para>
+        /// Calling this method is equivalent to setting the <see
+        /// cref="ExtractExistingFile"/> property and then calling <see
+        /// cref="ExtractAll(String)"/>.
+        /// </para>
+        ///
+        /// <para>
+        /// This method will send verbose output messages to the
+        /// <see cref="StatusMessageTextWriter"/>, if it is set on the <c>ZipFile</c> instance.
+        /// </para>
+        /// </remarks>
+        ///
+        /// <example>
+        /// This example extracts all the entries in a zip archive file, to the
+        /// specified target directory.  It does not overwrite any existing files.
+        /// <code>
+        /// String TargetDirectory= "c:\\unpack";
+        /// using(ZipFile zip= ZipFile.Read(ZipFileToExtract))
+        /// {
+        ///   zip.ExtractAll(TargetDirectory, ExtractExistingFileAction.DontOverwrite);
+        /// }
+        /// </code>
+        ///
+        /// <code lang="VB">
+        /// Dim TargetDirectory As String = "c:\unpack"
+        /// Using zip As ZipFile = ZipFile.Read(ZipFileToExtract)
+        ///     zip.ExtractAll(TargetDirectory, ExtractExistingFileAction.DontOverwrite)
+        /// End Using
+        /// </code>
+        /// </example>
+        ///
+        /// <param name="path">
+        /// The path to which the contents of the zipfile will be extracted.
+        /// The path can be relative or fully-qualified.
+        /// </param>
+        ///
+        /// <param name="extractExistingFile">
+        /// The action to take if extraction would overwrite an existing file.
+        /// </param>
+        /// <seealso cref="ExtractSelectedEntries(String,ExtractExistingFileAction)"/>
+        internal void ExtractAll(string path, ExtractExistingFileAction extractExistingFile)
+        {
+            ExtractExistingFile = extractExistingFile;
+            _InternalExtractAll(path, true);
+        }
+
+
+        private void _InternalExtractAll(string path, bool overrideExtractExistingProperty)
+        {
+            bool header = Verbose;
+            _inExtractAll = true;
+            try
+            {
+                OnExtractAllStarted(path);
+
+                int n = 0;
+                foreach (ZipEntry e in _entries.Values)
+                {
+                    if (header)
+                    {
+                        StatusMessageTextWriter.WriteLine("\n{1,-22} {2,-8} {3,4}   {4,-8}  {0}",
+                                  "Name", "Modified", "Size", "Ratio", "Packed");
+                        StatusMessageTextWriter.WriteLine(new System.String('-', 72));
+                        header = false;
+                    }
+                    if (Verbose)
+                    {
+                        StatusMessageTextWriter.WriteLine("{1,-22} {2,-8} {3,4:F0}%   {4,-8} {0}",
+                                  e.FileName,
+                                  e.LastModified.ToString("yyyy-MM-dd HH:mm:ss"),
+                                  e.UncompressedSize,
+                                  e.CompressionRatio,
+                                  e.CompressedSize);
+                        if (!String.IsNullOrEmpty(e.Comment))
+                            StatusMessageTextWriter.WriteLine("  Comment: {0}", e.Comment);
+                    }
+                    e.Password = _Password;  // this may be null
+                    OnExtractEntry(n, true, e, path);
+                    if (overrideExtractExistingProperty)
+                        e.ExtractExistingFile = this.ExtractExistingFile;
+                    e.Extract(path);
+                    n++;
+                    OnExtractEntry(n, false, e, path);
+                    if (_extractOperationCanceled)
+                        break;
+                }
+
+                if (!_extractOperationCanceled)
+                {
+                    // workitem 8264:
+                    // now, set times on directory entries, again.
+                    // The problem is, extracting a file changes the times on the parent
+                    // directory.  So after all files have been extracted, we have to
+                    // run through the directories again.
+                    foreach (ZipEntry e in _entries.Values)
+                    {
+                        // check if it is a directory
+                        if ((e.IsDirectory) || (e.FileName.EndsWith("/")))
+                        {
+                            string outputFile = (e.FileName.StartsWith("/"))
+                                ? Path.Combine(path, e.FileName.Substring(1))
+                                : Path.Combine(path, e.FileName);
+
+                            e._SetTimes(outputFile, false);
+                        }
+                    }
+                    OnExtractAllCompleted(path);
+                }
+
+            }
+            finally
+            {
+
+                _inExtractAll = false;
+            }
+        }
+
+
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ZipFile.Read.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ZipFile.Read.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ZipFile.Read.cs	(revision 12707)
@@ -0,0 +1,1110 @@
+// ZipFile.Read.cs
+// ------------------------------------------------------------------
+//
+// Copyright (c) 2009-2011 Dino Chiesa.
+// All rights reserved.
+//
+// This code module is part of DotNetZip, a zipfile class library.
+//
+// ------------------------------------------------------------------
+//
+// This code is licensed under the Microsoft Public License.
+// See the file License.txt for the license details.
+// More info on: http://dotnetzip.codeplex.com
+//
+// ------------------------------------------------------------------
+//
+// last saved (in emacs):
+// Time-stamp: <2011-August-05 11:38:59>
+//
+// ------------------------------------------------------------------
+//
+// This module defines the methods for Reading zip files.
+//
+// ------------------------------------------------------------------
+//
+
+
+using System;
+using System.IO;
+using System.Collections.Generic;
+
+namespace OfficeOpenXml.Packaging.Ionic.Zip
+{
+    /// <summary>
+    ///   A class for collecting the various options that can be used when
+    ///   Reading zip files for extraction or update.
+    /// </summary>
+    ///
+    /// <remarks>
+    ///   <para>
+    ///     When reading a zip file, there are several options an
+    ///     application can set, to modify how the file is read, or what
+    ///     the library does while reading.  This class collects those
+    ///     options into one container.
+    ///   </para>
+    ///
+    ///   <para>
+    ///     Pass an instance of the <c>ReadOptions</c> class into the
+    ///     <c>ZipFile.Read()</c> method.
+    ///   </para>
+    ///
+    /// <seealso cref="ZipFile.Read(String, ReadOptions)"/>.
+    /// <seealso cref="ZipFile.Read(Stream, ReadOptions)"/>.
+    /// </remarks>
+    internal class ReadOptions
+    {
+        /// <summary>
+        /// An event handler for Read operations.  When opening large zip
+        /// archives, you may want to display a progress bar or other
+        /// indicator of status progress while reading.  This parameter
+        /// allows you to specify a ReadProgress Event Handler directly.
+        /// When you call <c>Read()</c>, the progress event is invoked as
+        /// necessary.
+        /// </summary>
+        public EventHandler<ReadProgressEventArgs> ReadProgress { get; set; }
+
+        /// <summary>
+        /// The <c>System.IO.TextWriter</c> to use for writing verbose status messages
+        /// during operations on the zip archive.  A console application may wish to
+        /// pass <c>System.Console.Out</c> to get messages on the Console. A graphical
+        /// or headless application may wish to capture the messages in a different
+        /// <c>TextWriter</c>, such as a <c>System.IO.StringWriter</c>.
+        /// </summary>
+        public TextWriter StatusMessageWriter { get; set; }
+
+        /// <summary>
+        /// The <c>System.Text.Encoding</c> to use when reading in the zip archive. Be
+        /// careful specifying the encoding.  If the value you use here is not the same
+        /// as the Encoding used when the zip archive was created (possibly by a
+        /// different archiver) you will get unexpected results and possibly exceptions.
+        /// </summary>
+        ///
+        /// <seealso cref="ZipFile.ProvisionalAlternateEncoding"/>
+        ///
+        public System.Text.Encoding @Encoding { get; set; }
+    }
+
+
+    internal partial class ZipFile
+    {
+        /// <summary>
+        /// Reads a zip file archive and returns the instance.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        /// The stream is read using the default <c>System.Text.Encoding</c>, which is the
+        /// <c>IBM437</c> codepage.
+        /// </para>
+        /// </remarks>
+        ///
+        /// <exception cref="System.Exception">
+        /// Thrown if the <c>ZipFile</c> cannot be read. The implementation of this method
+        /// relies on <c>System.IO.File.OpenRead</c>, which can throw a variety of exceptions,
+        /// including specific exceptions if a file is not found, an unauthorized access
+        /// exception, exceptions for poorly formatted filenames, and so on.
+        /// </exception>
+        ///
+        /// <param name="fileName">
+        /// The name of the zip archive to open.  This can be a fully-qualified or relative
+        /// pathname.
+        /// </param>
+        ///
+        /// <seealso cref="ZipFile.Read(String, ReadOptions)"/>.
+        ///
+        /// <returns>The instance read from the zip archive.</returns>
+        ///
+        public static ZipFile Read(string fileName)
+        {
+            return ZipFile.Read(fileName, null, null, null);
+        }
+
+
+        /// <summary>
+        ///   Reads a zip file archive from the named filesystem file using the
+        ///   specified options.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   This version of the <c>Read()</c> method allows the caller to pass
+        ///   in a <c>TextWriter</c> an <c>Encoding</c>, via an instance of the
+        ///   <c>ReadOptions</c> class.  The <c>ZipFile</c> is read in using the
+        ///   specified encoding for entries where UTF-8 encoding is not
+        ///   explicitly specified.
+        /// </para>
+        /// </remarks>
+        ///
+        /// <example>
+        ///
+        /// <para>
+        ///   This example shows how to read a zip file using the Big-5 Chinese
+        ///   code page (950), and extract each entry in the zip file, while
+        ///   sending status messages out to the Console.
+        /// </para>
+        ///
+        /// <para>
+        ///   For this code to work as intended, the zipfile must have been
+        ///   created using the big5 code page (CP950). This is typical, for
+        ///   example, when using WinRar on a machine with CP950 set as the
+        ///   default code page.  In that case, the names of entries within the
+        ///   Zip archive will be stored in that code page, and reading the zip
+        ///   archive must be done using that code page.  If the application did
+        ///   not use the correct code page in ZipFile.Read(), then names of
+        ///   entries within the zip archive would not be correctly retrieved.
+        /// </para>
+        ///
+        /// <code lang="C#">
+        /// string zipToExtract = "MyArchive.zip";
+        /// string extractDirectory = "extract";
+        /// var options = new ReadOptions
+        /// {
+        ///   StatusMessageWriter = System.Console.Out,
+        ///   Encoding = System.Text.Encoding.GetEncoding(950)
+        /// };
+        /// using (ZipFile zip = ZipFile.Read(zipToExtract, options))
+        /// {
+        ///   foreach (ZipEntry e in zip)
+        ///   {
+        ///      e.Extract(extractDirectory);
+        ///   }
+        /// }
+        /// </code>
+        ///
+        ///
+        /// <code lang="VB">
+        /// Dim zipToExtract as String = "MyArchive.zip"
+        /// Dim extractDirectory as String = "extract"
+        /// Dim options as New ReadOptions
+        /// options.Encoding = System.Text.Encoding.GetEncoding(950)
+        /// options.StatusMessageWriter = System.Console.Out
+        /// Using zip As ZipFile = ZipFile.Read(zipToExtract, options)
+        ///     Dim e As ZipEntry
+        ///     For Each e In zip
+        ///      e.Extract(extractDirectory)
+        ///     Next
+        /// End Using
+        /// </code>
+        /// </example>
+        ///
+        ///
+        /// <example>
+        ///
+        /// <para>
+        ///   This example shows how to read a zip file using the default
+        ///   code page, to remove entries that have a modified date before a given threshold,
+        ///   sending status messages out to a <c>StringWriter</c>.
+        /// </para>
+        ///
+        /// <code lang="C#">
+        /// var options = new ReadOptions
+        /// {
+        ///   StatusMessageWriter = new System.IO.StringWriter()
+        /// };
+        /// using (ZipFile zip =  ZipFile.Read("PackedDocuments.zip", options))
+        /// {
+        ///   var Threshold = new DateTime(2007,7,4);
+        ///   // We cannot remove the entry from the list, within the context of
+        ///   // an enumeration of said list.
+        ///   // So we add the doomed entry to a list to be removed later.
+        ///   // pass 1: mark the entries for removal
+        ///   var MarkedEntries = new System.Collections.Generic.List&lt;ZipEntry&gt;();
+        ///   foreach (ZipEntry e in zip)
+        ///   {
+        ///     if (e.LastModified &lt; Threshold)
+        ///       MarkedEntries.Add(e);
+        ///   }
+        ///   // pass 2: actually remove the entry.
+        ///   foreach (ZipEntry zombie in MarkedEntries)
+        ///      zip.RemoveEntry(zombie);
+        ///   zip.Comment = "This archive has been updated.";
+        ///   zip.Save();
+        /// }
+        /// // can now use contents of sw, eg store in an audit log
+        /// </code>
+        ///
+        /// <code lang="VB">
+        /// Dim options as New ReadOptions
+        /// options.StatusMessageWriter = New System.IO.StringWriter
+        /// Using zip As ZipFile = ZipFile.Read("PackedDocuments.zip", options)
+        ///     Dim Threshold As New DateTime(2007, 7, 4)
+        ///     ' We cannot remove the entry from the list, within the context of
+        ///     ' an enumeration of said list.
+        ///     ' So we add the doomed entry to a list to be removed later.
+        ///     ' pass 1: mark the entries for removal
+        ///     Dim MarkedEntries As New System.Collections.Generic.List(Of ZipEntry)
+        ///     Dim e As ZipEntry
+        ///     For Each e In zip
+        ///         If (e.LastModified &lt; Threshold) Then
+        ///             MarkedEntries.Add(e)
+        ///         End If
+        ///     Next
+        ///     ' pass 2: actually remove the entry.
+        ///     Dim zombie As ZipEntry
+        ///     For Each zombie In MarkedEntries
+        ///         zip.RemoveEntry(zombie)
+        ///     Next
+        ///     zip.Comment = "This archive has been updated."
+        ///     zip.Save
+        /// End Using
+        /// ' can now use contents of sw, eg store in an audit log
+        /// </code>
+        /// </example>
+        ///
+        /// <exception cref="System.Exception">
+        ///   Thrown if the zipfile cannot be read. The implementation of
+        ///   this method relies on <c>System.IO.File.OpenRead</c>, which
+        ///   can throw a variety of exceptions, including specific
+        ///   exceptions if a file is not found, an unauthorized access
+        ///   exception, exceptions for poorly formatted filenames, and so
+        ///   on.
+        /// </exception>
+        ///
+        /// <param name="fileName">
+        /// The name of the zip archive to open.
+        /// This can be a fully-qualified or relative pathname.
+        /// </param>
+        ///
+        /// <param name="options">
+        /// The set of options to use when reading the zip file.
+        /// </param>
+        ///
+        /// <returns>The ZipFile instance read from the zip archive.</returns>
+        ///
+        /// <seealso cref="ZipFile.Read(Stream, ReadOptions)"/>
+        ///
+        internal static ZipFile Read(string fileName,
+                                   ReadOptions options)
+        {
+            if (options == null)
+                throw new ArgumentNullException("options");
+            return Read(fileName,
+                        options.StatusMessageWriter,
+                        options.Encoding,
+                        options.ReadProgress);
+        }
+
+        /// <summary>
+        /// Reads a zip file archive using the specified text encoding,  the specified
+        /// TextWriter for status messages, and the specified ReadProgress event handler,
+        /// and returns the instance.
+        /// </summary>
+        ///
+        /// <param name="fileName">
+        /// The name of the zip archive to open.
+        /// This can be a fully-qualified or relative pathname.
+        /// </param>
+        ///
+        /// <param name="readProgress">
+        /// An event handler for Read operations.
+        /// </param>
+        ///
+        /// <param name="statusMessageWriter">
+        /// The <c>System.IO.TextWriter</c> to use for writing verbose status messages
+        /// during operations on the zip archive.  A console application may wish to
+        /// pass <c>System.Console.Out</c> to get messages on the Console. A graphical
+        /// or headless application may wish to capture the messages in a different
+        /// <c>TextWriter</c>, such as a <c>System.IO.StringWriter</c>.
+        /// </param>
+        ///
+        /// <param name="encoding">
+        /// The <c>System.Text.Encoding</c> to use when reading in the zip archive. Be
+        /// careful specifying the encoding.  If the value you use here is not the same
+        /// as the Encoding used when the zip archive was created (possibly by a
+        /// different archiver) you will get unexpected results and possibly exceptions.
+        /// </param>
+        ///
+        /// <returns>The instance read from the zip archive.</returns>
+        ///
+        private static ZipFile Read(string fileName,
+                                   TextWriter statusMessageWriter,
+                                   System.Text.Encoding encoding,
+                                   EventHandler<ReadProgressEventArgs> readProgress)
+        {
+            ZipFile zf = new ZipFile();
+            zf.AlternateEncoding = encoding ?? DefaultEncoding;
+            zf.AlternateEncodingUsage = ZipOption.Always;
+            zf._StatusMessageTextWriter = statusMessageWriter;
+            zf._name = fileName;
+            if (readProgress != null)
+                zf.ReadProgress = readProgress;
+
+            if (zf.Verbose) zf._StatusMessageTextWriter.WriteLine("reading from {0}...", fileName);
+
+            ReadIntoInstance(zf);
+            zf._fileAlreadyExists = true;
+
+            return zf;
+        }
+
+        /// <summary>
+        ///   Reads a zip archive from a stream.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///
+        /// <para>
+        ///   When reading from a file, it's probably easier to just use
+        ///   <see cref="ZipFile.Read(String,
+        ///   ReadOptions)">ZipFile.Read(String, ReadOptions)</see>.  This
+        ///   overload is useful when when the zip archive content is
+        ///   available from an already-open stream. The stream must be
+        ///   open and readable and seekable when calling this method.  The
+        ///   stream is left open when the reading is completed.
+        /// </para>
+        ///
+        /// <para>
+        ///   Using this overload, the stream is read using the default
+        ///   <c>System.Text.Encoding</c>, which is the <c>IBM437</c>
+        ///   codepage. If you want to specify the encoding to use when
+        ///   reading the zipfile content, see
+        ///   <see cref="ZipFile.Read(Stream,
+        ///   ReadOptions)">ZipFile.Read(Stream, ReadOptions)</see>.  This
+        /// </para>
+        ///
+        /// <para>
+        ///   Reading of zip content begins at the current position in the
+        ///   stream.  This means if you have a stream that concatenates
+        ///   regular data and zip data, if you position the open, readable
+        ///   stream at the start of the zip data, you will be able to read
+        ///   the zip archive using this constructor, or any of the ZipFile
+        ///   constructors that accept a <see cref="System.IO.Stream" /> as
+        ///   input. Some examples of where this might be useful: the zip
+        ///   content is concatenated at the end of a regular EXE file, as
+        ///   some self-extracting archives do.  (Note: SFX files produced
+        ///   by DotNetZip do not work this way; they can be read as normal
+        ///   ZIP files). Another example might be a stream being read from
+        ///   a database, where the zip content is embedded within an
+        ///   aggregate stream of data.
+        /// </para>
+        ///
+        /// </remarks>
+        ///
+        /// <example>
+        /// <para>
+        ///   This example shows how to Read zip content from a stream, and
+        ///   extract one entry into a different stream. In this example,
+        ///   the filename "NameOfEntryInArchive.doc", refers only to the
+        ///   name of the entry within the zip archive.  A file by that
+        ///   name is not created in the filesystem.  The I/O is done
+        ///   strictly with the given streams.
+        /// </para>
+        ///
+        /// <code>
+        /// using (ZipFile zip = ZipFile.Read(InputStream))
+        /// {
+        ///    zip.Extract("NameOfEntryInArchive.doc", OutputStream);
+        /// }
+        /// </code>
+        ///
+        /// <code lang="VB">
+        /// Using zip as ZipFile = ZipFile.Read(InputStream)
+        ///    zip.Extract("NameOfEntryInArchive.doc", OutputStream)
+        /// End Using
+        /// </code>
+        /// </example>
+        ///
+        /// <param name="zipStream">the stream containing the zip data.</param>
+        ///
+        /// <returns>The ZipFile instance read from the stream</returns>
+        ///
+        public static ZipFile Read(Stream zipStream)
+        {
+            return Read(zipStream, null, null, null);
+        }
+
+        /// <summary>
+        ///   Reads a zip file archive from the given stream using the
+        ///   specified options.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///
+        /// <para>
+        ///   When reading from a file, it's probably easier to just use
+        ///   <see cref="ZipFile.Read(String,
+        ///   ReadOptions)">ZipFile.Read(String, ReadOptions)</see>.  This
+        ///   overload is useful when when the zip archive content is
+        ///   available from an already-open stream. The stream must be
+        ///   open and readable and seekable when calling this method.  The
+        ///   stream is left open when the reading is completed.
+        /// </para>
+        ///
+        /// <para>
+        ///   Reading of zip content begins at the current position in the
+        ///   stream.  This means if you have a stream that concatenates
+        ///   regular data and zip data, if you position the open, readable
+        ///   stream at the start of the zip data, you will be able to read
+        ///   the zip archive using this constructor, or any of the ZipFile
+        ///   constructors that accept a <see cref="System.IO.Stream" /> as
+        ///   input. Some examples of where this might be useful: the zip
+        ///   content is concatenated at the end of a regular EXE file, as
+        ///   some self-extracting archives do.  (Note: SFX files produced
+        ///   by DotNetZip do not work this way; they can be read as normal
+        ///   ZIP files). Another example might be a stream being read from
+        ///   a database, where the zip content is embedded within an
+        ///   aggregate stream of data.
+        /// </para>
+        /// </remarks>
+        ///
+        /// <param name="zipStream">the stream containing the zip data.</param>
+        ///
+        /// <param name="options">
+        ///   The set of options to use when reading the zip file.
+        /// </param>
+        ///
+        /// <exception cref="System.Exception">
+        ///   Thrown if the zip archive cannot be read.
+        /// </exception>
+        ///
+        /// <returns>The ZipFile instance read from the stream.</returns>
+        ///
+        /// <seealso cref="ZipFile.Read(String, ReadOptions)"/>
+        ///
+        internal static ZipFile Read(Stream zipStream, ReadOptions options)
+        {
+            if (options == null)
+                throw new ArgumentNullException("options");
+
+            return Read(zipStream,
+                        options.StatusMessageWriter,
+                        options.Encoding,
+                        options.ReadProgress);
+        }
+
+
+
+        /// <summary>
+        /// Reads a zip archive from a stream, using the specified text Encoding, the
+        /// specified TextWriter for status messages,
+        /// and the specified ReadProgress event handler.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        /// Reading of zip content begins at the current position in the stream.  This
+        /// means if you have a stream that concatenates regular data and zip data, if
+        /// you position the open, readable stream at the start of the zip data, you
+        /// will be able to read the zip archive using this constructor, or any of the
+        /// ZipFile constructors that accept a <see cref="System.IO.Stream" /> as
+        /// input. Some examples of where this might be useful: the zip content is
+        /// concatenated at the end of a regular EXE file, as some self-extracting
+        /// archives do.  (Note: SFX files produced by DotNetZip do not work this
+        /// way). Another example might be a stream being read from a database, where
+        /// the zip content is embedded within an aggregate stream of data.
+        /// </para>
+        /// </remarks>
+        ///
+        /// <param name="zipStream">the stream containing the zip data.</param>
+        ///
+        /// <param name="statusMessageWriter">
+        /// The <c>System.IO.TextWriter</c> to which verbose status messages are written
+        /// during operations on the <c>ZipFile</c>.  For example, in a console
+        /// application, System.Console.Out works, and will get a message for each entry
+        /// added to the ZipFile.  If the TextWriter is <c>null</c>, no verbose messages
+        /// are written.
+        /// </param>
+        ///
+        /// <param name="encoding">
+        /// The text encoding to use when reading entries that do not have the UTF-8
+        /// encoding bit set.  Be careful specifying the encoding.  If the value you use
+        /// here is not the same as the Encoding used when the zip archive was created
+        /// (possibly by a different archiver) you will get unexpected results and
+        /// possibly exceptions.  See the <see cref="ProvisionalAlternateEncoding"/>
+        /// property for more information.
+        /// </param>
+        ///
+        /// <param name="readProgress">
+        /// An event handler for Read operations.
+        /// </param>
+        ///
+        /// <returns>an instance of ZipFile</returns>
+        private static ZipFile Read(Stream zipStream,
+                                   TextWriter statusMessageWriter,
+                                   System.Text.Encoding encoding,
+                                   EventHandler<ReadProgressEventArgs> readProgress)
+        {
+            if (zipStream == null)
+                throw new ArgumentNullException("zipStream");
+
+            ZipFile zf = new ZipFile();
+            zf._StatusMessageTextWriter = statusMessageWriter;
+            zf._alternateEncoding = encoding ?? ZipFile.DefaultEncoding;
+            zf._alternateEncodingUsage = ZipOption.Always;
+            if (readProgress != null)
+                zf.ReadProgress += readProgress;
+            zf._readstream = (zipStream.Position == 0L)
+                ? zipStream
+                : new OffsetStream(zipStream);
+            zf._ReadStreamIsOurs = false;
+            if (zf.Verbose) zf._StatusMessageTextWriter.WriteLine("reading from stream...");
+
+            ReadIntoInstance(zf);
+            return zf;
+        }
+
+
+
+        private static void ReadIntoInstance(ZipFile zf)
+        {
+            Stream s = zf.ReadStream;
+            try
+            {
+                zf._readName = zf._name; // workitem 13915
+                if (!s.CanSeek)
+                {
+                    ReadIntoInstance_Orig(zf);
+                    return;
+                }
+
+                zf.OnReadStarted();
+
+                // change for workitem 8098
+                //zf._originPosition = s.Position;
+
+                // Try reading the central directory, rather than scanning the file.
+
+                uint datum = ReadFirstFourBytes(s);
+
+                if (datum == ZipConstants.EndOfCentralDirectorySignature)
+                    return;
+
+
+                // start at the end of the file...
+                // seek backwards a bit, then look for the EoCD signature.
+                int nTries = 0;
+                bool success = false;
+
+                // The size of the end-of-central-directory-footer plus 2 bytes is 18.
+                // This implies an archive comment length of 0.  We'll add a margin of
+                // safety and start "in front" of that, when looking for the
+                // EndOfCentralDirectorySignature
+                long posn = s.Length - 64;
+                long maxSeekback = Math.Max(s.Length - 0x4000, 10);
+                do
+                {
+                    if (posn < 0) posn = 0;  // BOF
+                    s.Seek(posn, SeekOrigin.Begin);
+                    long bytesRead = SharedUtilities.FindSignature(s, (int)ZipConstants.EndOfCentralDirectorySignature);
+                    if (bytesRead != -1)
+                        success = true;
+                    else
+                    {
+                        if (posn==0) break; // started at the BOF and found nothing
+                        nTries++;
+                        // Weird: with NETCF, negative offsets from SeekOrigin.End DO
+                        // NOT WORK. So rather than seek a negative offset, we seek
+                        // from SeekOrigin.Begin using a smaller number.
+                        posn -= (32 * (nTries + 1) * nTries);
+                    }
+                }
+                while (!success && posn > maxSeekback);
+
+                if (success)
+                {
+                    // workitem 8299
+                    zf._locEndOfCDS = s.Position - 4;
+
+                    byte[] block = new byte[16];
+                    s.Read(block, 0, block.Length);
+
+                    zf._diskNumberWithCd = BitConverter.ToUInt16(block, 2);
+
+                    if (zf._diskNumberWithCd == 0xFFFF)
+                        throw new ZipException("Spanned archives with more than 65534 segments are not supported at this time.");
+
+                    zf._diskNumberWithCd++; // I think the number in the file differs from reality by 1
+
+                    int i = 12;
+
+                    uint offset32 = (uint) BitConverter.ToUInt32(block, i);
+                    if (offset32 == 0xFFFFFFFF)
+                    {
+                        Zip64SeekToCentralDirectory(zf);
+                    }
+                    else
+                    {
+                        zf._OffsetOfCentralDirectory = offset32;
+                        // change for workitem 8098
+                        s.Seek(offset32, SeekOrigin.Begin);
+                    }
+
+                    ReadCentralDirectory(zf);
+                }
+                else
+                {
+                    // Could not find the central directory.
+                    // Fallback to the old method.
+                    // workitem 8098: ok
+                    //s.Seek(zf._originPosition, SeekOrigin.Begin);
+                    s.Seek(0L, SeekOrigin.Begin);
+                    ReadIntoInstance_Orig(zf);
+                }
+            }
+            catch (Exception ex1)
+            {
+                if (zf._ReadStreamIsOurs && zf._readstream != null)
+                {
+                    try
+                    {
+#if NETCF
+                        zf._readstream.Close();
+#else
+                        zf._readstream.Dispose();
+#endif
+                        zf._readstream = null;
+                    }
+                    finally { }
+                }
+
+                throw new ZipException("Cannot read that as a ZipFile", ex1);
+            }
+
+            // the instance has been read in
+            zf._contentsChanged = false;
+        }
+
+
+
+        private static void Zip64SeekToCentralDirectory(ZipFile zf)
+        {
+            Stream s = zf.ReadStream;
+            byte[] block = new byte[16];
+
+            // seek back to find the ZIP64 EoCD.
+            // I think this might not work for .NET CF ?
+            s.Seek(-40, SeekOrigin.Current);
+            s.Read(block, 0, 16);
+
+            Int64 offset64 = BitConverter.ToInt64(block, 8);
+            zf._OffsetOfCentralDirectory = 0xFFFFFFFF;
+            zf._OffsetOfCentralDirectory64 = offset64;
+            // change for workitem 8098
+            s.Seek(offset64, SeekOrigin.Begin);
+            //zf.SeekFromOrigin(Offset64);
+
+            uint datum = (uint)Ionic.Zip.SharedUtilities.ReadInt(s);
+            if (datum != ZipConstants.Zip64EndOfCentralDirectoryRecordSignature)
+                throw new BadReadException(String.Format("  Bad signature (0x{0:X8}) looking for ZIP64 EoCD Record at position 0x{1:X8}", datum, s.Position));
+
+            s.Read(block, 0, 8);
+            Int64 Size = BitConverter.ToInt64(block, 0);
+
+            block = new byte[Size];
+            s.Read(block, 0, block.Length);
+
+            offset64 = BitConverter.ToInt64(block, 36);
+            // change for workitem 8098
+            s.Seek(offset64, SeekOrigin.Begin);
+            //zf.SeekFromOrigin(Offset64);
+        }
+
+
+        private static uint ReadFirstFourBytes(Stream s)
+        {
+            uint datum = (uint)Ionic.Zip.SharedUtilities.ReadInt(s);
+            return datum;
+        }
+
+
+
+        private static void ReadCentralDirectory(ZipFile zf)
+        {
+            // We must have the central directory footer record, in order to properly
+            // read zip dir entries from the central directory.  This because the logic
+            // knows when to open a spanned file when the volume number for the central
+            // directory differs from the volume number for the zip entry.  The
+            // _diskNumberWithCd was set when originally finding the offset for the
+            // start of the Central Directory.
+
+            // workitem 9214
+            bool inputUsesZip64 = false;
+            ZipEntry de;
+            // in lieu of hashset, use a dictionary
+            var previouslySeen = new Dictionary<String,object>();
+            while ((de = ZipEntry.ReadDirEntry(zf, previouslySeen)) != null)
+            {
+                de.ResetDirEntry();
+                zf.OnReadEntry(true, null);
+
+                if (zf.Verbose)
+                    zf.StatusMessageTextWriter.WriteLine("entry {0}", de.FileName);
+
+                zf._entries.Add(de.FileName,de);
+
+                // workitem 9214
+                if (de._InputUsesZip64) inputUsesZip64 = true;
+                previouslySeen.Add(de.FileName, null); // to prevent dupes
+            }
+
+            // workitem 9214; auto-set the zip64 flag
+            if (inputUsesZip64) zf.UseZip64WhenSaving = Zip64Option.Always;
+
+            // workitem 8299
+            if (zf._locEndOfCDS > 0)
+                zf.ReadStream.Seek(zf._locEndOfCDS, SeekOrigin.Begin);
+
+            ReadCentralDirectoryFooter(zf);
+
+            if (zf.Verbose && !String.IsNullOrEmpty(zf.Comment))
+                zf.StatusMessageTextWriter.WriteLine("Zip file Comment: {0}", zf.Comment);
+
+            // We keep the read stream open after reading.
+
+            if (zf.Verbose)
+                zf.StatusMessageTextWriter.WriteLine("read in {0} entries.", zf._entries.Count);
+
+            zf.OnReadCompleted();
+        }
+
+
+
+
+        // build the TOC by reading each entry in the file.
+        private static void ReadIntoInstance_Orig(ZipFile zf)
+        {
+            zf.OnReadStarted();
+            //zf._entries = new System.Collections.Generic.List<ZipEntry>();
+            zf._entries = new System.Collections.Generic.Dictionary<String,ZipEntry>();
+
+            ZipEntry e;
+            if (zf.Verbose)
+                if (zf.Name == null)
+                    zf.StatusMessageTextWriter.WriteLine("Reading zip from stream...");
+                else
+                    zf.StatusMessageTextWriter.WriteLine("Reading zip {0}...", zf.Name);
+
+            // work item 6647:  PK00 (packed to removable disk)
+            bool firstEntry = true;
+            ZipContainer zc = new ZipContainer(zf);
+            while ((e = ZipEntry.ReadEntry(zc, firstEntry)) != null)
+            {
+                if (zf.Verbose)
+                    zf.StatusMessageTextWriter.WriteLine("  {0}", e.FileName);
+
+                zf._entries.Add(e.FileName,e);
+                firstEntry = false;
+            }
+
+            // read the zipfile's central directory structure here.
+            // workitem 9912
+            // But, because it may be corrupted, ignore errors.
+            try
+            {
+                ZipEntry de;
+                // in lieu of hashset, use a dictionary
+                var previouslySeen = new Dictionary<String,Object>();
+                while ((de = ZipEntry.ReadDirEntry(zf, previouslySeen)) != null)
+                {
+                    // Housekeeping: Since ZipFile exposes ZipEntry elements in the enumerator,
+                    // we need to copy the comment that we grab from the ZipDirEntry
+                    // into the ZipEntry, so the application can access the comment.
+                    // Also since ZipEntry is used to Write zip files, we need to copy the
+                    // file attributes to the ZipEntry as appropriate.
+                    ZipEntry e1 = zf._entries[de.FileName];
+                    if (e1 != null)
+                    {
+                        e1._Comment = de.Comment;
+                        if (de.IsDirectory) e1.MarkAsDirectory();
+                    }
+                    previouslySeen.Add(de.FileName,null); // to prevent dupes
+                }
+
+                // workitem 8299
+                if (zf._locEndOfCDS > 0)
+                    zf.ReadStream.Seek(zf._locEndOfCDS, SeekOrigin.Begin);
+
+                ReadCentralDirectoryFooter(zf);
+
+                if (zf.Verbose && !String.IsNullOrEmpty(zf.Comment))
+                    zf.StatusMessageTextWriter.WriteLine("Zip file Comment: {0}", zf.Comment);
+            }
+            catch (ZipException) { }
+            catch (IOException) { }
+
+            zf.OnReadCompleted();
+        }
+
+
+
+
+        private static void ReadCentralDirectoryFooter(ZipFile zf)
+        {
+            Stream s = zf.ReadStream;
+            int signature = Ionic.Zip.SharedUtilities.ReadSignature(s);
+
+            byte[] block = null;
+            int j = 0;
+            if (signature == ZipConstants.Zip64EndOfCentralDirectoryRecordSignature)
+            {
+                // We have a ZIP64 EOCD
+                // This data block is 4 bytes sig, 8 bytes size, 44 bytes fixed data,
+                // followed by a variable-sized extension block.  We have read the sig already.
+                // 8 - datasize (64 bits)
+                // 2 - version made by
+                // 2 - version needed to extract
+                // 4 - number of this disk
+                // 4 - number of the disk with the start of the CD
+                // 8 - total number of entries in the CD on this disk
+                // 8 - total number of entries in the CD
+                // 8 - size of the CD
+                // 8 - offset of the CD
+                // -----------------------
+                // 52 bytes
+
+                block = new byte[8 + 44];
+                s.Read(block, 0, block.Length);
+
+                Int64 DataSize = BitConverter.ToInt64(block, 0);  // == 44 + the variable length
+
+                if (DataSize < 44)
+                    throw new ZipException("Bad size in the ZIP64 Central Directory.");
+
+                zf._versionMadeBy = BitConverter.ToUInt16(block, j);
+                j += 2;
+                zf._versionNeededToExtract = BitConverter.ToUInt16(block, j);
+                j += 2;
+                zf._diskNumberWithCd = BitConverter.ToUInt32(block, j);
+                j += 2;
+
+                //zf._diskNumberWithCd++; // hack!!
+
+                // read the extended block
+                block = new byte[DataSize - 44];
+                s.Read(block, 0, block.Length);
+                // discard the result
+
+                signature = Ionic.Zip.SharedUtilities.ReadSignature(s);
+                if (signature != ZipConstants.Zip64EndOfCentralDirectoryLocatorSignature)
+                    throw new ZipException("Inconsistent metadata in the ZIP64 Central Directory.");
+
+                block = new byte[16];
+                s.Read(block, 0, block.Length);
+                // discard the result
+
+                signature = Ionic.Zip.SharedUtilities.ReadSignature(s);
+            }
+
+            // Throw if this is not a signature for "end of central directory record"
+            // This is a sanity check.
+            if (signature != ZipConstants.EndOfCentralDirectorySignature)
+            {
+                s.Seek(-4, SeekOrigin.Current);
+                throw new BadReadException(String.Format("Bad signature ({0:X8}) at position 0x{1:X8}",
+                                                         signature, s.Position));
+            }
+
+            // read the End-of-Central-Directory-Record
+            block = new byte[16];
+            zf.ReadStream.Read(block, 0, block.Length);
+
+            // off sz  data
+            // -------------------------------------------------------
+            //  0   4  end of central dir signature (0x06054b50)
+            //  4   2  number of this disk
+            //  6   2  number of the disk with start of the central directory
+            //  8   2  total number of entries in the  central directory on this disk
+            // 10   2  total number of entries in  the central directory
+            // 12   4  size of the central directory
+            // 16   4  offset of start of central directory with respect to the starting disk number
+            // 20   2  ZIP file comment length
+            // 22  ??  ZIP file comment
+
+            if (zf._diskNumberWithCd == 0)
+            {
+                zf._diskNumberWithCd = BitConverter.ToUInt16(block, 2);
+                //zf._diskNumberWithCd++; // hack!!
+            }
+
+            // read the comment here
+            ReadZipFileComment(zf);
+        }
+
+
+
+        private static void ReadZipFileComment(ZipFile zf)
+        {
+            // read the comment here
+            byte[] block = new byte[2];
+            zf.ReadStream.Read(block, 0, block.Length);
+
+            Int16 commentLength = (short)(block[0] + block[1] * 256);
+            if (commentLength > 0)
+            {
+                block = new byte[commentLength];
+                zf.ReadStream.Read(block, 0, block.Length);
+
+                // workitem 10392 - prefer ProvisionalAlternateEncoding,
+                // first.  The fix for workitem 6513 tried to use UTF8
+                // only as necessary, but that is impossible to test
+                // for, in this direction. There's no way to know what
+                // characters the already-encoded bytes refer
+                // to. Therefore, must do what the user tells us.
+
+                string s1 = zf.AlternateEncoding.GetString(block, 0, block.Length);
+                zf.Comment = s1;
+            }
+        }
+
+
+        // private static bool BlocksAreEqual(byte[] a, byte[] b)
+        // {
+        //     if (a.Length != b.Length) return false;
+        //     for (int i = 0; i < a.Length; i++)
+        //     {
+        //         if (a[i] != b[i]) return false;
+        //     }
+        //     return true;
+        // }
+
+
+
+        /// <summary>
+        /// Checks the given file to see if it appears to be a valid zip file.
+        /// </summary>
+        /// <remarks>
+        ///
+        /// <para>
+        ///   Calling this method is equivalent to calling <see cref="IsZipFile(string,
+        ///   bool)"/> with the testExtract parameter set to false.
+        /// </para>
+        /// </remarks>
+        ///
+        /// <param name="fileName">The file to check.</param>
+        /// <returns>true if the file appears to be a zip file.</returns>
+        public static bool IsZipFile(string fileName)
+        {
+            return IsZipFile(fileName, false);
+        }
+
+
+        /// <summary>
+        /// Checks a file to see if it is a valid zip file.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   This method opens the specified zip file, reads in the zip archive,
+        ///   verifying the ZIP metadata as it reads.
+        /// </para>
+        ///
+        /// <para>
+        ///   If everything succeeds, then the method returns true.  If anything fails -
+        ///   for example if an incorrect signature or CRC is found, indicating a
+        ///   corrupt file, the the method returns false.  This method also returns
+        ///   false for a file that does not exist.
+        /// </para>
+        ///
+        /// <para>
+        ///   If <paramref name="testExtract"/> is true, as part of its check, this
+        ///   method reads in the content for each entry, expands it, and checks CRCs.
+        ///   This provides an additional check beyond verifying the zip header and
+        ///   directory data.
+        /// </para>
+        ///
+        /// <para>
+        ///   If <paramref name="testExtract"/> is true, and if any of the zip entries
+        ///   are protected with a password, this method will return false.  If you want
+        ///   to verify a <c>ZipFile</c> that has entries which are protected with a
+        ///   password, you will need to do that manually.
+        /// </para>
+        ///
+        /// </remarks>
+        ///
+        /// <param name="fileName">The zip file to check.</param>
+        /// <param name="testExtract">true if the caller wants to extract each entry.</param>
+        /// <returns>true if the file contains a valid zip file.</returns>
+        public static bool IsZipFile(string fileName, bool testExtract)
+        {
+            bool result = false;
+            try
+            {
+                if (!File.Exists(fileName)) return false;
+
+                using (var s = File.Open(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
+                {
+                    result = IsZipFile(s, testExtract);
+                }
+            }
+            catch (IOException) { }
+            catch (ZipException) { }
+            return result;
+        }
+
+
+        /// <summary>
+        /// Checks a stream to see if it contains a valid zip archive.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        /// This method reads the zip archive contained in the specified stream, verifying
+        /// the ZIP metadata as it reads.  If testExtract is true, this method also extracts
+        /// each entry in the archive, dumping all the bits into <see cref="Stream.Null"/>.
+        /// </para>
+        ///
+        /// <para>
+        /// If everything succeeds, then the method returns true.  If anything fails -
+        /// for example if an incorrect signature or CRC is found, indicating a corrupt
+        /// file, the the method returns false.  This method also returns false for a
+        /// file that does not exist.
+        /// </para>
+        ///
+        /// <para>
+        /// If <c>testExtract</c> is true, this method reads in the content for each
+        /// entry, expands it, and checks CRCs.  This provides an additional check
+        /// beyond verifying the zip header data.
+        /// </para>
+        ///
+        /// <para>
+        /// If <c>testExtract</c> is true, and if any of the zip entries are protected
+        /// with a password, this method will return false.  If you want to verify a
+        /// ZipFile that has entries which are protected with a password, you will need
+        /// to do that manually.
+        /// </para>
+        /// </remarks>
+        ///
+        /// <seealso cref="IsZipFile(string, bool)"/>
+        ///
+        /// <param name="stream">The stream to check.</param>
+        /// <param name="testExtract">true if the caller wants to extract each entry.</param>
+        /// <returns>true if the stream contains a valid zip archive.</returns>
+        public static bool IsZipFile(Stream stream, bool testExtract)
+        {
+            if (stream == null)
+                throw new ArgumentNullException("stream");
+
+            bool result = false;
+            try
+            {
+                if (!stream.CanRead) return false;
+
+                var bitBucket = Stream.Null;
+
+                using (ZipFile zip1 = ZipFile.Read(stream, null, null, null))
+                {
+                    if (testExtract)
+                    {
+                        foreach (var e in zip1)
+                        {
+                            if (!e.IsDirectory)
+                            {
+                                e.Extract(bitBucket);
+                            }
+                        }
+                    }
+                }
+                result = true;
+            }
+            catch (IOException) { }
+            catch (ZipException) { }
+            return result;
+        }
+
+
+
+
+    }
+
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ZipFile.Save.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ZipFile.Save.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ZipFile.Save.cs	(revision 12707)
@@ -0,0 +1,964 @@
+// ZipFile.Save.cs
+// ------------------------------------------------------------------
+//
+// Copyright (c) 2009 Dino Chiesa.
+// All rights reserved.
+//
+// This code module is part of DotNetZip, a zipfile class library.
+//
+// ------------------------------------------------------------------
+//
+// This code is licensed under the Microsoft Public License.
+// See the file License.txt for the license details.
+// More info on: http://dotnetzip.codeplex.com
+//
+// ------------------------------------------------------------------
+//
+// last saved (in emacs):
+// Time-stamp: <2011-August-05 13:31:23>
+//
+// ------------------------------------------------------------------
+//
+// This module defines the methods for Save operations on zip files.
+//
+// ------------------------------------------------------------------
+//
+
+
+using System;
+using System.IO;
+using System.Collections.Generic;
+
+namespace OfficeOpenXml.Packaging.Ionic.Zip
+{
+
+    internal partial class ZipFile
+    {
+
+        /// <summary>
+        ///   Delete file with retry on UnauthorizedAccessException.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///   <para>
+        ///     When calling File.Delete() on a file that has been "recently"
+        ///     created, the call sometimes fails with
+        ///     UnauthorizedAccessException. This method simply retries the Delete 3
+        ///     times with a sleep between tries.
+        ///   </para>
+        /// </remarks>
+        ///
+        /// <param name='filename'>the name of the file to be deleted</param>
+        private void DeleteFileWithRetry(string filename)
+        {
+            bool done = false;
+            int nRetries = 3;
+            for (int i=0; i < nRetries && !done; i++)
+            {
+                try
+                {
+                    File.Delete(filename);
+                    done = true;
+                }
+                catch (System.UnauthorizedAccessException)
+                {
+                    Console.WriteLine("************************************************** Retry delete.");
+                    System.Threading.Thread.Sleep(200+i*200);
+                }
+            }
+        }
+
+
+        /// <summary>
+        ///   Saves the Zip archive to a file, specified by the Name property of the
+        ///   <c>ZipFile</c>.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   The <c>ZipFile</c> instance is written to storage, typically a zip file
+        ///   in a filesystem, only when the caller calls <c>Save</c>.  In the typical
+        ///   case, the Save operation writes the zip content to a temporary file, and
+        ///   then renames the temporary file to the desired name. If necessary, this
+        ///   method will delete a pre-existing file before the rename.
+        /// </para>
+        ///
+        /// <para>
+        ///   The <see cref="ZipFile.Name"/> property is specified either explicitly,
+        ///   or implicitly using one of the parameterized ZipFile constructors.  For
+        ///   COM Automation clients, the <c>Name</c> property must be set explicitly,
+        ///   because COM Automation clients cannot call parameterized constructors.
+        /// </para>
+        ///
+        /// <para>
+        ///   When using a filesystem file for the Zip output, it is possible to call
+        ///   <c>Save</c> multiple times on the <c>ZipFile</c> instance. With each
+        ///   call the zip content is re-written to the same output file.
+        /// </para>
+        ///
+        /// <para>
+        ///   Data for entries that have been added to the <c>ZipFile</c> instance is
+        ///   written to the output when the <c>Save</c> method is called. This means
+        ///   that the input streams for those entries must be available at the time
+        ///   the application calls <c>Save</c>.  If, for example, the application
+        ///   adds entries with <c>AddEntry</c> using a dynamically-allocated
+        ///   <c>MemoryStream</c>, the memory stream must not have been disposed
+        ///   before the call to <c>Save</c>. See the <see
+        ///   cref="ZipEntry.InputStream"/> property for more discussion of the
+        ///   availability requirements of the input stream for an entry, and an
+        ///   approach for providing just-in-time stream lifecycle management.
+        /// </para>
+        ///
+        /// </remarks>
+        ///
+        /// <seealso cref="Ionic.Zip.ZipFile.AddEntry(String, System.IO.Stream)"/>
+        ///
+        /// <exception cref="Ionic.Zip.BadStateException">
+        ///   Thrown if you haven't specified a location or stream for saving the zip,
+        ///   either in the constructor or by setting the Name property, or if you try
+        ///   to save a regular zip archive to a filename with a .exe extension.
+        /// </exception>
+        ///
+        /// <exception cref="System.OverflowException">
+        ///   Thrown if <see cref="MaxOutputSegmentSize"/> is non-zero, and the number
+        ///   of segments that would be generated for the spanned zip file during the
+        ///   save operation exceeds 99.  If this happens, you need to increase the
+        ///   segment size.
+        /// </exception>
+        ///
+        public void Save()
+        {
+            try
+            {
+                bool thisSaveUsedZip64 = false;
+                _saveOperationCanceled = false;
+                _numberOfSegmentsForMostRecentSave = 0;
+                OnSaveStarted();
+
+                if (WriteStream == null)
+                    throw new BadStateException("You haven't specified where to save the zip.");
+
+                if (_name != null && _name.EndsWith(".exe") && !_SavingSfx)
+                    throw new BadStateException("You specified an EXE for a plain zip file.");
+
+                // check if modified, before saving.
+                if (!_contentsChanged)
+                {
+                    OnSaveCompleted();
+                    if (Verbose) StatusMessageTextWriter.WriteLine("No save is necessary....");
+                    return;
+                }
+
+                Reset(true);
+
+                if (Verbose) StatusMessageTextWriter.WriteLine("saving....");
+
+                // validate the number of entries
+                if (_entries.Count >= 0xFFFF && _zip64 == Zip64Option.Never)
+                    throw new ZipException("The number of entries is 65535 or greater. Consider setting the UseZip64WhenSaving property on the ZipFile instance.");
+
+
+                // write an entry in the zip for each file
+                int n = 0;
+                // workitem 9831
+                ICollection<ZipEntry> c = (SortEntriesBeforeSaving) ? EntriesSorted : Entries;
+                foreach (ZipEntry e in c) // _entries.Values
+                {
+                    OnSaveEntry(n, e, true);
+                    e.Write(WriteStream);
+                    if (_saveOperationCanceled)
+                        break;
+
+                    n++;
+                    OnSaveEntry(n, e, false);
+                    if (_saveOperationCanceled)
+                        break;
+
+                    // Some entries can be skipped during the save.
+                    if (e.IncludedInMostRecentSave)
+                        thisSaveUsedZip64 |= e.OutputUsedZip64.Value;
+                }
+
+
+
+                if (_saveOperationCanceled)
+                    return;
+
+                var zss = WriteStream as ZipSegmentedStream;
+
+                _numberOfSegmentsForMostRecentSave = (zss!=null)
+                    ? zss.CurrentSegment
+                    : 1;
+
+                bool directoryNeededZip64 =
+                    ZipOutput.WriteCentralDirectoryStructure
+                    (WriteStream,
+                     c,
+                     _numberOfSegmentsForMostRecentSave,
+                     _zip64,
+                     Comment,
+                     new ZipContainer(this));
+
+                OnSaveEvent(ZipProgressEventType.Saving_AfterSaveTempArchive);
+
+                _hasBeenSaved = true;
+                _contentsChanged = false;
+
+                thisSaveUsedZip64 |= directoryNeededZip64;
+                _OutputUsesZip64 = new Nullable<bool>(thisSaveUsedZip64);
+
+
+                // do the rename as necessary
+                if (_name != null &&
+                    (_temporaryFileName!=null || zss != null))
+                {
+                    // _temporaryFileName may remain null if we are writing to a stream.
+                    // only close the stream if there is a file behind it.
+#if NETCF
+                    WriteStream.Close();
+#else
+                    WriteStream.Dispose();
+#endif
+                    if (_saveOperationCanceled)
+                        return;
+
+                    if (_fileAlreadyExists && this._readstream != null)
+                    {
+                        // This means we opened and read a zip file.
+                        // If we are now saving to the same file, we need to close the
+                        // orig file, first.
+                        this._readstream.Close();
+                        this._readstream = null;
+                        // the archiveStream for each entry needs to be null
+                        foreach (var e in c)
+                        {
+                            var zss1 = e._archiveStream as ZipSegmentedStream;
+                            if (zss1 != null)
+#if NETCF
+                                zss1.Close();
+#else
+                                zss1.Dispose();
+#endif
+                            e._archiveStream = null;
+                        }
+                    }
+
+                    string tmpName = null;
+                    if (File.Exists(_name))
+                    {
+                        // the steps:
+                        //
+                        // 1. Delete tmpName
+                        // 2. move existing zip to tmpName
+                        // 3. rename (File.Move) working file to name of existing zip
+                        // 4. delete tmpName
+                        //
+                        // This series of steps avoids the exception,
+                        // System.IO.IOException:
+                        //   "Cannot create a file when that file already exists."
+                        //
+                        // Cannot just call File.Replace() here because
+                        // there is a possibility that the TEMP volume is different
+                        // that the volume for the final file (c:\ vs d:\).
+                        // So we need to do a Delete+Move pair.
+                        //
+                        // But, when doing the delete, Windows allows a process to
+                        // delete the file, even though it is held open by, say, a
+                        // virus scanner. It gets internally marked as "delete
+                        // pending". The file does not actually get removed from the
+                        // file system, it is still there after the File.Delete
+                        // call.
+                        //
+                        // Therefore, we need to move the existing zip, which may be
+                        // held open, to some other name. Then rename our working
+                        // file to the desired name, then delete (possibly delete
+                        // pending) the "other name".
+                        //
+                        // Ideally this would be transactional. It's possible that the
+                        // delete succeeds and the move fails. Lacking transactions, if
+                        // this kind of failure happens, we're hosed, and this logic will
+                        // throw on the next File.Move().
+                        //
+                        //File.Delete(_name);
+                        // workitem 10447
+#if NETCF || SILVERLIGHT
+                        tmpName = _name + "." + SharedUtilities.GenerateRandomStringImpl(8,0) + ".tmp";
+#else
+                        tmpName = _name + "." + Path.GetRandomFileName();
+#endif
+                        if (File.Exists(tmpName))
+                            DeleteFileWithRetry(tmpName);
+                        File.Move(_name, tmpName);
+                    }
+
+                    OnSaveEvent(ZipProgressEventType.Saving_BeforeRenameTempArchive);
+                    File.Move((zss != null) ? zss.CurrentTempName : _temporaryFileName,
+                              _name);
+
+                    OnSaveEvent(ZipProgressEventType.Saving_AfterRenameTempArchive);
+
+                    if (tmpName != null)
+                    {
+                        try
+                        {
+                            // not critical
+                            if (File.Exists(tmpName))
+                                File.Delete(tmpName);
+                        }
+                        catch
+                        {
+                            // don't care about exceptions here.
+                        }
+
+                    }
+                    _fileAlreadyExists = true;
+                }
+
+                NotifyEntriesSaveComplete(c);
+                OnSaveCompleted();
+                _JustSaved = true;
+            }
+
+            // workitem 5043
+            finally
+            {
+                CleanupAfterSaveOperation();
+            }
+
+            return;
+        }
+
+
+
+        private static void NotifyEntriesSaveComplete(ICollection<ZipEntry> c)
+        {
+            foreach (ZipEntry e in  c)
+            {
+                e.NotifySaveComplete();
+            }
+        }
+
+
+        private void RemoveTempFile()
+        {
+            try
+            {
+                if (File.Exists(_temporaryFileName))
+                {
+                    File.Delete(_temporaryFileName);
+                }
+            }
+            catch (IOException ex1)
+            {
+                if (Verbose)
+                    StatusMessageTextWriter.WriteLine("ZipFile::Save: could not delete temp file: {0}.", ex1.Message);
+            }
+        }
+
+
+        private void CleanupAfterSaveOperation()
+        {
+            if (_name != null)
+            {
+                // close the stream if there is a file behind it.
+                if (_writestream != null)
+                {
+                    try
+                    {
+                        // workitem 7704
+#if NETCF
+                        _writestream.Close();
+#else
+                        _writestream.Dispose();
+#endif
+                    }
+                    catch (System.IO.IOException) { }
+                }
+                _writestream = null;
+
+                if (_temporaryFileName != null)
+                {
+                    RemoveTempFile();
+                    _temporaryFileName = null;
+                }
+            }
+        }
+
+
+        /// <summary>
+        /// Save the file to a new zipfile, with the given name.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        /// This method allows the application to explicitly specify the name of the zip
+        /// file when saving. Use this when creating a new zip file, or when
+        /// updating a zip archive.
+        /// </para>
+        ///
+        /// <para>
+        /// An application can also save a zip archive in several places by calling this
+        /// method multiple times in succession, with different filenames.
+        /// </para>
+        ///
+        /// <para>
+        /// The <c>ZipFile</c> instance is written to storage, typically a zip file in a
+        /// filesystem, only when the caller calls <c>Save</c>.  The Save operation writes
+        /// the zip content to a temporary file, and then renames the temporary file
+        /// to the desired name. If necessary, this method will delete a pre-existing file
+        /// before the rename.
+        /// </para>
+        ///
+        /// </remarks>
+        ///
+        /// <exception cref="System.ArgumentException">
+        /// Thrown if you specify a directory for the filename.
+        /// </exception>
+        ///
+        /// <param name="fileName">
+        /// The name of the zip archive to save to. Existing files will
+        /// be overwritten with great prejudice.
+        /// </param>
+        ///
+        /// <example>
+        /// This example shows how to create and Save a zip file.
+        /// <code>
+        /// using (ZipFile zip = new ZipFile())
+        /// {
+        ///   zip.AddDirectory(@"c:\reports\January");
+        ///   zip.Save("January.zip");
+        /// }
+        /// </code>
+        ///
+        /// <code lang="VB">
+        /// Using zip As New ZipFile()
+        ///   zip.AddDirectory("c:\reports\January")
+        ///   zip.Save("January.zip")
+        /// End Using
+        /// </code>
+        ///
+        /// </example>
+        ///
+        /// <example>
+        /// This example shows how to update a zip file.
+        /// <code>
+        /// using (ZipFile zip = ZipFile.Read("ExistingArchive.zip"))
+        /// {
+        ///   zip.AddFile("NewData.csv");
+        ///   zip.Save("UpdatedArchive.zip");
+        /// }
+        /// </code>
+        ///
+        /// <code lang="VB">
+        /// Using zip As ZipFile = ZipFile.Read("ExistingArchive.zip")
+        ///   zip.AddFile("NewData.csv")
+        ///   zip.Save("UpdatedArchive.zip")
+        /// End Using
+        /// </code>
+        ///
+        /// </example>
+        public void Save(String fileName)
+        {
+            // Check for the case where we are re-saving a zip archive
+            // that was originally instantiated with a stream.  In that case,
+            // the _name will be null. If so, we set _writestream to null,
+            // which insures that we'll cons up a new WriteStream (with a filesystem
+            // file backing it) in the Save() method.
+            if (_name == null)
+                _writestream = null;
+
+            else _readName = _name; // workitem 13915
+
+            _name = fileName;
+            if (Directory.Exists(_name))
+                throw new ZipException("Bad Directory", new System.ArgumentException("That name specifies an existing directory. Please specify a filename.", "fileName"));
+            _contentsChanged = true;
+            _fileAlreadyExists = File.Exists(_name);
+            Save();
+        }
+
+
+        /// <summary>
+        ///   Save the zip archive to the specified stream.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   The <c>ZipFile</c> instance is written to storage - typically a zip file
+        ///   in a filesystem, but using this overload, the storage can be anything
+        ///   accessible via a writable stream - only when the caller calls <c>Save</c>.
+        /// </para>
+        ///
+        /// <para>
+        ///   Use this method to save the zip content to a stream directly.  A common
+        ///   scenario is an ASP.NET application that dynamically generates a zip file
+        ///   and allows the browser to download it. The application can call
+        ///   <c>Save(Response.OutputStream)</c> to write a zipfile directly to the
+        ///   output stream, without creating a zip file on the disk on the ASP.NET
+        ///   server.
+        /// </para>
+        ///
+        /// <para>
+        ///   Be careful when saving a file to a non-seekable stream, including
+        ///   <c>Response.OutputStream</c>. When DotNetZip writes to a non-seekable
+        ///   stream, the zip archive is formatted in such a way that may not be
+        ///   compatible with all zip tools on all platforms.  It's a perfectly legal
+        ///   and compliant zip file, but some people have reported problems opening
+        ///   files produced this way using the Mac OS archive utility.
+        /// </para>
+        ///
+        /// </remarks>
+        ///
+        /// <example>
+        ///
+        ///   This example saves the zipfile content into a MemoryStream, and
+        ///   then gets the array of bytes from that MemoryStream.
+        ///
+        /// <code lang="C#">
+        /// using (var zip = new Ionic.Zip.ZipFile())
+        /// {
+        ///     zip.CompressionLevel= Ionic.Zlib.CompressionLevel.BestCompression;
+        ///     zip.Password = "VerySecret.";
+        ///     zip.Encryption = EncryptionAlgorithm.WinZipAes128;
+        ///     zip.AddFile(sourceFileName);
+        ///     MemoryStream output = new MemoryStream();
+        ///     zip.Save(output);
+        ///
+        ///     byte[] zipbytes = output.ToArray();
+        /// }
+        /// </code>
+        /// </example>
+        ///
+        /// <example>
+        /// <para>
+        ///   This example shows a pitfall you should avoid. DO NOT read
+        ///   from a stream, then try to save to the same stream.  DO
+        ///   NOT DO THIS:
+        /// </para>
+        ///
+        /// <code lang="C#">
+        /// using (var fs = new FileSteeam(filename, FileMode.Open))
+        /// {
+        ///   using (var zip = Ionic.Zip.ZipFile.Read(inputStream))
+        ///   {
+        ///     zip.AddEntry("Name1.txt", "this is the content");
+        ///     zip.Save(inputStream);  // NO NO NO!!
+        ///   }
+        /// }
+        /// </code>
+        ///
+        /// <para>
+        ///   Better like this:
+        /// </para>
+        ///
+        /// <code lang="C#">
+        /// using (var zip = Ionic.Zip.ZipFile.Read(filename))
+        /// {
+        ///     zip.AddEntry("Name1.txt", "this is the content");
+        ///     zip.Save();  // YES!
+        /// }
+        /// </code>
+        ///
+        /// </example>
+        ///
+        /// <param name="outputStream">
+        ///   The <c>System.IO.Stream</c> to write to. It must be
+        ///   writable. If you created the ZipFile instanct by calling
+        ///   ZipFile.Read(), this stream must not be the same stream
+        ///   you passed to ZipFile.Read().
+        /// </param>
+        public void Save(Stream outputStream)
+        {
+            if (outputStream == null)
+                throw new ArgumentNullException("outputStream");
+            if (!outputStream.CanWrite)
+                throw new ArgumentException("Must be a writable stream.", "outputStream");
+
+            // if we had a filename to save to, we are now obliterating it.
+            _name = null;
+
+            _writestream = new CountingStream(outputStream);
+
+            _contentsChanged = true;
+            _fileAlreadyExists = false;
+            Save();
+        }
+
+
+    }
+
+
+
+    internal static class ZipOutput
+    {
+        public static bool WriteCentralDirectoryStructure(Stream s,
+                                                          ICollection<ZipEntry> entries,
+                                                          uint numSegments,
+                                                          Zip64Option zip64,
+                                                          String comment,
+                                                          ZipContainer container)
+        {
+            var zss = s as ZipSegmentedStream;
+            if (zss != null)
+                zss.ContiguousWrite = true;
+
+            // write to a memory stream in order to keep the
+            // CDR contiguous
+            Int64 aLength = 0;
+            using (var ms = new MemoryStream())
+            {
+                foreach (ZipEntry e in entries)
+                {
+                    if (e.IncludedInMostRecentSave)
+                    {
+                        // this writes a ZipDirEntry corresponding to the ZipEntry
+                        e.WriteCentralDirectoryEntry(ms);
+                    }
+                }
+                var a = ms.ToArray();
+                s.Write(a, 0, a.Length);
+                aLength = a.Length;
+            }
+
+
+            // We need to keep track of the start and
+            // Finish of the Central Directory Structure.
+
+            // Cannot always use WriteStream.Length or Position; some streams do
+            // not support these. (eg, ASP.NET Response.OutputStream) In those
+            // cases we have a CountingStream.
+
+            // Also, we cannot just set Start as s.Position bfore the write, and Finish
+            // as s.Position after the write.  In a split zip, the write may actually
+            // flip to the next segment.  In that case, Start will be zero.  But we
+            // don't know that til after we know the size of the thing to write.  So the
+            // answer is to compute the directory, then ask the ZipSegmentedStream which
+            // segment that directory would fall in, it it were written.  Then, include
+            // that data into the directory, and finally, write the directory to the
+            // output stream.
+
+            var output = s as CountingStream;
+            long Finish = (output != null) ? output.ComputedPosition : s.Position;  // BytesWritten
+            long Start = Finish - aLength;
+
+            // need to know which segment the EOCD record starts in
+            UInt32 startSegment = (zss != null)
+                ? zss.CurrentSegment
+                : 0;
+
+            Int64 SizeOfCentralDirectory = Finish - Start;
+
+            int countOfEntries = CountEntries(entries);
+
+            bool needZip64CentralDirectory =
+                zip64 == Zip64Option.Always ||
+                countOfEntries >= 0xFFFF ||
+                SizeOfCentralDirectory > 0xFFFFFFFF ||
+                Start > 0xFFFFFFFF;
+
+            byte[] a2 = null;
+
+            // emit ZIP64 extensions as required
+            if (needZip64CentralDirectory)
+            {
+                if (zip64 == Zip64Option.Never)
+                {
+#if NETCF
+                    throw new ZipException("The archive requires a ZIP64 Central Directory. Consider enabling ZIP64 extensions.");
+#else
+                    System.Diagnostics.StackFrame sf = new System.Diagnostics.StackFrame(1);
+                    if (sf.GetMethod().DeclaringType == typeof(ZipFile))
+                        throw new ZipException("The archive requires a ZIP64 Central Directory. Consider setting the ZipFile.UseZip64WhenSaving property.");
+                    else
+                        throw new ZipException("The archive requires a ZIP64 Central Directory. Consider setting the ZipOutputStream.EnableZip64 property.");
+#endif
+
+                }
+
+                var a = GenZip64EndOfCentralDirectory(Start, Finish, countOfEntries, numSegments);
+                a2 = GenCentralDirectoryFooter(Start, Finish, zip64, countOfEntries, comment, container);
+                if (startSegment != 0)
+                {
+                    UInt32 thisSegment = zss.ComputeSegment(a.Length + a2.Length);
+                    int i = 16;
+                    // number of this disk
+                    Array.Copy(BitConverter.GetBytes(thisSegment), 0, a, i, 4);
+                    i += 4;
+                    // number of the disk with the start of the central directory
+                    //Array.Copy(BitConverter.GetBytes(startSegment), 0, a, i, 4);
+                    Array.Copy(BitConverter.GetBytes(thisSegment), 0, a, i, 4);
+
+                    i = 60;
+                    // offset 60
+                    // number of the disk with the start of the zip64 eocd
+                    Array.Copy(BitConverter.GetBytes(thisSegment), 0, a, i, 4);
+                    i += 4;
+                    i += 8;
+
+                    // offset 72
+                    // total number of disks
+                    Array.Copy(BitConverter.GetBytes(thisSegment), 0, a, i, 4);
+                }
+                s.Write(a, 0, a.Length);
+            }
+            else
+                a2 = GenCentralDirectoryFooter(Start, Finish, zip64, countOfEntries, comment, container);
+
+
+            // now, the regular footer
+            if (startSegment != 0)
+            {
+                // The assumption is the central directory is never split across
+                // segment boundaries.
+
+                UInt16 thisSegment = (UInt16) zss.ComputeSegment(a2.Length);
+                int i = 4;
+                // number of this disk
+                Array.Copy(BitConverter.GetBytes(thisSegment), 0, a2, i, 2);
+                i += 2;
+                // number of the disk with the start of the central directory
+                //Array.Copy(BitConverter.GetBytes((UInt16)startSegment), 0, a2, i, 2);
+                Array.Copy(BitConverter.GetBytes(thisSegment), 0, a2, i, 2);
+                i += 2;
+            }
+
+            s.Write(a2, 0, a2.Length);
+
+            // reset the contiguous write property if necessary
+            if (zss != null)
+                zss.ContiguousWrite = false;
+
+            return needZip64CentralDirectory;
+        }
+
+
+        private static System.Text.Encoding GetEncoding(ZipContainer container, string t)
+        {
+            switch (container.AlternateEncodingUsage)
+            {
+                case ZipOption.Always:
+                    return container.AlternateEncoding;
+                case ZipOption.Never:
+                    return container.DefaultEncoding;
+            }
+
+            // AsNecessary is in force
+            var e = container.DefaultEncoding;
+            if (t == null) return e;
+
+            var bytes = e.GetBytes(t);
+            var t2 = e.GetString(bytes,0,bytes.Length);
+            if (t2.Equals(t)) return e;
+            return container.AlternateEncoding;
+        }
+
+
+
+        private static byte[] GenCentralDirectoryFooter(long StartOfCentralDirectory,
+                                                        long EndOfCentralDirectory,
+                                                        Zip64Option zip64,
+                                                        int entryCount,
+                                                        string comment,
+                                                        ZipContainer container)
+        {
+            System.Text.Encoding encoding = GetEncoding(container, comment);
+            int j = 0;
+            int bufferLength = 22;
+            byte[] block = null;
+            Int16 commentLength = 0;
+            if ((comment != null) && (comment.Length != 0))
+            {
+                block = encoding.GetBytes(comment);
+                commentLength = (Int16)block.Length;
+            }
+            bufferLength += commentLength;
+            byte[] bytes = new byte[bufferLength];
+
+            int i = 0;
+            // signature
+            byte[] sig = BitConverter.GetBytes(ZipConstants.EndOfCentralDirectorySignature);
+            Array.Copy(sig, 0, bytes, i, 4);
+            i+=4;
+
+            // number of this disk
+            // (this number may change later)
+            bytes[i++] = 0;
+            bytes[i++] = 0;
+
+            // number of the disk with the start of the central directory
+            // (this number may change later)
+            bytes[i++] = 0;
+            bytes[i++] = 0;
+
+            // handle ZIP64 extensions for the end-of-central-directory
+            if (entryCount >= 0xFFFF || zip64 == Zip64Option.Always)
+            {
+                // the ZIP64 version.
+                for (j = 0; j < 4; j++)
+                    bytes[i++] = 0xFF;
+            }
+            else
+            {
+                // the standard version.
+                // total number of entries in the central dir on this disk
+                bytes[i++] = (byte)(entryCount & 0x00FF);
+                bytes[i++] = (byte)((entryCount & 0xFF00) >> 8);
+
+                // total number of entries in the central directory
+                bytes[i++] = (byte)(entryCount & 0x00FF);
+                bytes[i++] = (byte)((entryCount & 0xFF00) >> 8);
+            }
+
+            // size of the central directory
+            Int64 SizeOfCentralDirectory = EndOfCentralDirectory - StartOfCentralDirectory;
+
+            if (SizeOfCentralDirectory >= 0xFFFFFFFF || StartOfCentralDirectory >= 0xFFFFFFFF)
+            {
+                // The actual data is in the ZIP64 central directory structure
+                for (j = 0; j < 8; j++)
+                    bytes[i++] = 0xFF;
+            }
+            else
+            {
+                // size of the central directory (we just get the low 4 bytes)
+                bytes[i++] = (byte)(SizeOfCentralDirectory & 0x000000FF);
+                bytes[i++] = (byte)((SizeOfCentralDirectory & 0x0000FF00) >> 8);
+                bytes[i++] = (byte)((SizeOfCentralDirectory & 0x00FF0000) >> 16);
+                bytes[i++] = (byte)((SizeOfCentralDirectory & 0xFF000000) >> 24);
+
+                // offset of the start of the central directory (we just get the low 4 bytes)
+                bytes[i++] = (byte)(StartOfCentralDirectory & 0x000000FF);
+                bytes[i++] = (byte)((StartOfCentralDirectory & 0x0000FF00) >> 8);
+                bytes[i++] = (byte)((StartOfCentralDirectory & 0x00FF0000) >> 16);
+                bytes[i++] = (byte)((StartOfCentralDirectory & 0xFF000000) >> 24);
+            }
+
+
+            // zip archive comment
+            if ((comment == null) || (comment.Length == 0))
+            {
+                // no comment!
+                bytes[i++] = (byte)0;
+                bytes[i++] = (byte)0;
+            }
+            else
+            {
+                // the size of our buffer defines the max length of the comment we can write
+                if (commentLength + i + 2 > bytes.Length) commentLength = (Int16)(bytes.Length - i - 2);
+                bytes[i++] = (byte)(commentLength & 0x00FF);
+                bytes[i++] = (byte)((commentLength & 0xFF00) >> 8);
+
+                if (commentLength != 0)
+                {
+                    // now actually write the comment itself into the byte buffer
+                    for (j = 0; (j < commentLength) && (i + j < bytes.Length); j++)
+                    {
+                        bytes[i + j] = block[j];
+                    }
+                    i += j;
+                }
+            }
+
+            //   s.Write(bytes, 0, i);
+            return bytes;
+        }
+
+
+
+        private static byte[] GenZip64EndOfCentralDirectory(long StartOfCentralDirectory,
+                                                            long EndOfCentralDirectory,
+                                                            int entryCount,
+                                                            uint numSegments)
+        {
+            const int bufferLength = 12 + 44 + 20;
+
+            byte[] bytes = new byte[bufferLength];
+
+            int i = 0;
+            // signature
+            byte[] sig = BitConverter.GetBytes(ZipConstants.Zip64EndOfCentralDirectoryRecordSignature);
+            Array.Copy(sig, 0, bytes, i, 4);
+            i+=4;
+
+            // There is a possibility to include "Extensible" data in the zip64
+            // end-of-central-dir record.  I cannot figure out what it might be used to
+            // store, so the size of this record is always fixed.  Maybe it is used for
+            // strong encryption data?  That is for another day.
+            long DataSize = 44;
+            Array.Copy(BitConverter.GetBytes(DataSize), 0, bytes, i, 8);
+            i += 8;
+
+            // offset 12
+            // VersionMadeBy = 45;
+            bytes[i++] = 45;
+            bytes[i++] = 0x00;
+
+            // VersionNeededToExtract = 45;
+            bytes[i++] = 45;
+            bytes[i++] = 0x00;
+
+            // offset 16
+            // number of the disk, and the disk with the start of the central dir.
+            // (this may change later)
+            for (int j = 0; j < 8; j++)
+                bytes[i++] = 0x00;
+
+            // offset 24
+            long numberOfEntries = entryCount;
+            Array.Copy(BitConverter.GetBytes(numberOfEntries), 0, bytes, i, 8);
+            i += 8;
+            Array.Copy(BitConverter.GetBytes(numberOfEntries), 0, bytes, i, 8);
+            i += 8;
+
+            // offset 40
+            Int64 SizeofCentraldirectory = EndOfCentralDirectory - StartOfCentralDirectory;
+            Array.Copy(BitConverter.GetBytes(SizeofCentraldirectory), 0, bytes, i, 8);
+            i += 8;
+            Array.Copy(BitConverter.GetBytes(StartOfCentralDirectory), 0, bytes, i, 8);
+            i += 8;
+
+            // offset 56
+            // now, the locator
+            // signature
+            sig = BitConverter.GetBytes(ZipConstants.Zip64EndOfCentralDirectoryLocatorSignature);
+            Array.Copy(sig, 0, bytes, i, 4);
+            i+=4;
+
+            // offset 60
+            // number of the disk with the start of the zip64 eocd
+            // (this will change later)  (it will?)
+            uint x2 = (numSegments==0)?0:(uint)(numSegments-1);
+            Array.Copy(BitConverter.GetBytes(x2), 0, bytes, i, 4);
+            i+=4;
+
+            // offset 64
+            // relative offset of the zip64 eocd
+            Array.Copy(BitConverter.GetBytes(EndOfCentralDirectory), 0, bytes, i, 8);
+            i += 8;
+
+            // offset 72
+            // total number of disks
+            // (this will change later)
+            Array.Copy(BitConverter.GetBytes(numSegments), 0, bytes, i, 4);
+            i+=4;
+
+            return bytes;
+        }
+
+
+
+        private static int CountEntries(ICollection<ZipEntry> _entries)
+        {
+            // Cannot just emit _entries.Count, because some of the entries
+            // may have been skipped.
+            int count = 0;
+            foreach (var entry in _entries)
+                if (entry.IncludedInMostRecentSave) count++;
+            return count;
+        }
+
+
+
+
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ZipFile.SaveSelfExtractor.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ZipFile.SaveSelfExtractor.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ZipFile.SaveSelfExtractor.cs	(revision 12707)
@@ -0,0 +1,1101 @@
+// ZipFile.saveSelfExtractor.cs
+// ------------------------------------------------------------------
+//
+// Copyright (c) 2008-2011 Dino Chiesa.
+// All rights reserved.
+//
+// This code module is part of DotNetZip, a zipfile class library.
+//
+// ------------------------------------------------------------------
+//
+// This code is licensed under the Microsoft Public License.
+// See the file License.txt for the license details.
+// More info on: http://dotnetzip.codeplex.com
+//
+// ------------------------------------------------------------------
+//
+// last saved (in emacs):
+// Time-stamp: <2011-August-10 19:22:46>
+//
+// ------------------------------------------------------------------
+//
+// This is a the source module that implements the stuff for saving to a
+// self-extracting Zip archive.
+//
+// ZipFile is set up as a "partial class" - defined in multiple .cs source modules.
+// This is one of the source modules for the ZipFile class.
+//
+// Here's the design: The self-extracting zip file is just a regular managed EXE
+// file, with embedded resources.  The managed code logic instantiates a ZipFile, and
+// then extracts each entry.  The embedded resources include the zip archive content,
+// as well as the Zip library itself.  The latter is required so that self-extracting
+// can work on any machine, whether or not it has the DotNetZip library installed on
+// it.
+//
+// What we need to do is create the animal I just described, within a method on the
+// ZipFile class.  This source module provides that capability. The method is
+// SaveSelfExtractor().
+//
+// The way the method works: it uses the programmatic interface to the csc.exe
+// compiler, Microsoft.CSharp.CSharpCodeProvider, to compile "boilerplate"
+// extraction logic into a new assembly.  As part of that compile, we embed within
+// that assembly the zip archive itself, as well as the Zip library.
+//
+// Therefore we need to first save to a temporary zip file, then produce the exe.
+//
+// There are a few twists.
+//
+// The Visual Studio Project structure is a little weird.  There are code files
+// that ARE NOT compiled during a normal build of the VS Solution.  They are
+// marked as embedded resources.  These are the various "boilerplate" modules that
+// are used in the self-extractor. These modules are: WinFormsSelfExtractorStub.cs
+// WinFormsSelfExtractorStub.Designer.cs CommandLineSelfExtractorStub.cs
+// PasswordDialog.cs PasswordDialog.Designer.cs
+//
+// At design time, if you want to modify the way the GUI looks, you have to
+// mark those modules to have a "compile" build action.  Then tweak em, test,
+// etc.  Then again mark them as "Embedded resource".
+//
+// ------------------------------------------------------------------
+
+using System;
+using System.Reflection;
+using System.IO;
+using System.Collections.Generic;
+
+
+namespace OfficeOpenXml.Packaging.Ionic.Zip
+{
+#if !NO_SFX
+    /// <summary>
+    /// An enum that provides the different self-extractor flavors
+    /// </summary>
+    internal enum SelfExtractorFlavor
+    {
+        /// <summary>
+        /// A self-extracting zip archive that runs from the console or
+        /// command line.
+        /// </summary>
+        ConsoleApplication = 0,
+
+        /// <summary>
+        /// A self-extracting zip archive that presents a graphical user
+        /// interface when it is executed.
+        /// </summary>
+        WinFormsApplication,
+    }
+
+    /// <summary>
+    /// The options for generating a self-extracting archive.
+    /// </summary>
+    internal class SelfExtractorSaveOptions
+    {
+        /// <summary>
+        ///   The type of SFX to create.
+        /// </summary>
+        public SelfExtractorFlavor Flavor
+        {
+            get;
+            set;
+        }
+
+        /// <summary>
+        ///   The command to run after extraction.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   This is optional. Leave it empty (<c>null</c> in C# or <c>Nothing</c> in
+        ///   VB) to run no command after extraction.
+        /// </para>
+        ///
+        /// <para>
+        ///   If it is non-empty, the SFX will execute the command specified in this
+        ///   string on the user's machine, and using the extract directory as the
+        ///   working directory for the process, after unpacking the archive. The
+        ///   program to execute can include a path, if you like. If you want to execute
+        ///   a program that accepts arguments, specify the program name, followed by a
+        ///   space, and then the arguments for the program, each separated by a space,
+        ///   just as you would on a normal command line. Example: <c>program.exe arg1
+        ///   arg2</c>.  The string prior to the first space will be taken as the
+        ///   program name, and the string following the first space specifies the
+        ///   arguments to the program.
+        /// </para>
+        ///
+        /// <para>
+        ///   If you want to execute a program that has a space in the name or path of
+        ///   the file, surround the program name in double-quotes. The first character
+        ///   of the command line should be a double-quote character, and there must be
+        ///   a matching double-quote following the end of the program file name. Any
+        ///   optional arguments to the program follow that, separated by
+        ///   spaces. Example: <c>"c:\project files\program name.exe" arg1 arg2</c>.
+        /// </para>
+        ///
+        /// <para>
+        ///   If the flavor of the SFX is <c>SelfExtractorFlavor.ConsoleApplication</c>,
+        ///   then the SFX starts a new process, using this string as the post-extract
+        ///   command line.  The SFX waits for the process to exit.  The exit code of
+        ///   the post-extract command line is returned as the exit code of the
+        ///   command-line self-extractor exe. A non-zero exit code is typically used to
+        ///   indicated a failure by the program. In the case of an SFX, a non-zero exit
+        ///   code may indicate a failure during extraction, OR, it may indicate a
+        ///   failure of the run-after-extract program if specified, OR, it may indicate
+        ///   the run-after-extract program could not be fuond. There is no way to
+        ///   distinguish these conditions from the calling shell, aside from parsing
+        ///   the output of the SFX. If you have Quiet set to <c>true</c>, you may not
+        ///   see error messages, if a problem occurs.
+        /// </para>
+        ///
+        /// <para>
+        ///   If the flavor of the SFX is
+        ///   <c>SelfExtractorFlavor.WinFormsApplication</c>, then the SFX starts a new
+        ///   process, using this string as the post-extract command line, and using the
+        ///   extract directory as the working directory for the process. The SFX does
+        ///   not wait for the command to complete, and does not check the exit code of
+        ///   the program. If the run-after-extract program cannot be fuond, a message
+        ///   box is displayed indicating that fact.
+        /// </para>
+        ///
+        /// <para>
+        ///   You can specify environment variables within this string, with a format like
+        ///   <c>%NAME%</c>. The value of these variables will be expanded at the time
+        ///   the SFX is run. Example: <c>%WINDIR%\system32\xcopy.exe</c> may expand at
+        ///   runtime to <c>c:\Windows\System32\xcopy.exe</c>.
+        /// </para>
+        ///
+        /// <para>
+        ///   By combining this with the <c>RemoveUnpackedFilesAfterExecute</c>
+        ///   flag, you can create an SFX that extracts itself, runs a file that
+        ///   was extracted, then deletes all the files that were extracted. If
+        ///   you want it to run "invisibly" then set <c>Flavor</c> to
+        ///   <c>SelfExtractorFlavor.ConsoleApplication</c>, and set <c>Quiet</c>
+        ///   to true.  The user running such an EXE will see a console window
+        ///   appear, then disappear quickly.  You may also want to specify the
+        ///   default extract location, with <c>DefaultExtractDirectory</c>.
+        /// </para>
+        ///
+        /// <para>
+        ///   If you set <c>Flavor</c> to
+        ///   <c>SelfExtractorFlavor.WinFormsApplication</c>, and set <c>Quiet</c> to
+        ///   true, then a GUI with progressbars is displayed, but it is
+        ///   "non-interactive" - it accepts no input from the user.  Instead the SFX
+        ///   just automatically unpacks and exits.
+        /// </para>
+        ///
+        /// </remarks>
+        public String PostExtractCommandLine
+        {
+            get;
+            set;
+        }
+
+        /// <summary>
+        ///   The default extract directory the user will see when
+        ///   running the self-extracting archive.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   Passing null (or Nothing in VB) here will cause the Self Extractor to use
+        ///   the the user's personal directory (<see
+        ///   cref="Environment.SpecialFolder.Personal"/>) for the default extract
+        ///   location.
+        /// </para>
+        ///
+        /// <para>
+        ///   This is only a default location.  The actual extract location will be
+        ///   settable on the command line when the SFX is executed.
+        /// </para>
+        ///
+        /// <para>
+        ///   You can specify environment variables within this string,
+        ///   with <c>%NAME%</c>. The value of these variables will be
+        ///   expanded at the time the SFX is run. Example:
+        ///   <c>%USERPROFILE%\Documents\unpack</c> may expand at runtime to
+        ///   <c>c:\users\melvin\Documents\unpack</c>.
+        /// </para>
+        /// </remarks>
+        public String DefaultExtractDirectory
+        {
+            get;
+            set;
+        }
+
+        /// <summary>
+        ///   The name of an .ico file in the filesystem to use for the application icon
+        ///   for the generated SFX.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   Normally, DotNetZip will embed an "zipped folder" icon into the generated
+        ///   SFX.  If you prefer to use a different icon, you can specify it here. It
+        ///   should be a .ico file.  This file is passed as the <c>/win32icon</c>
+        ///   option to the csc.exe compiler when constructing the SFX file.
+        /// </para>
+        /// </remarks>
+        ///
+        public string IconFile
+        {
+            get;
+            set;
+        }
+
+        /// <summary>
+        ///   Whether the ConsoleApplication SFX will be quiet during extraction.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   This option affects the way the generated SFX runs. By default it is
+        ///   false.  When you set it to true,...
+        /// </para>
+        ///
+        /// <list type="table">
+        ///   <listheader>
+        ///     <term>Flavor</term>
+        ///     <description>Behavior</description>
+        ///   </listheader>
+        ///
+        /// <item>
+        ///   <term><c>ConsoleApplication</c></term>
+        ///   <description><para>no messages will be emitted during successful
+        ///     operation.</para> <para> Double-clicking the SFX in Windows
+        ///     Explorer or as an attachment in an email will cause a console
+        ///     window to appear briefly, before it disappears. If you run the
+        ///     ConsoleApplication SFX from the cmd.exe prompt, it runs as a
+        ///     normal console app; by default, because it is quiet, it displays
+        ///     no messages to the console.  If you pass the -v+ command line
+        ///     argument to the Console SFX when you run it, you will get verbose
+        ///     messages to the console. </para>
+        ///   </description>
+        /// </item>
+        ///
+        /// <item>
+        ///   <term><c>WinFormsApplication</c></term>
+        ///   <description>the SFX extracts automatically when the application
+        ///        is launched, with no additional user input.
+        ///   </description>
+        /// </item>
+        ///
+        /// </list>
+        ///
+        /// <para>
+        ///   When you set it to false,...
+        /// </para>
+        ///
+        /// <list type="table">
+        ///   <listheader>
+        ///     <term>Flavor</term>
+        ///     <description>Behavior</description>
+        ///   </listheader>
+        ///
+        /// <item>
+        ///   <term><c>ConsoleApplication</c></term>
+        ///   <description><para>the extractor will emit a
+        ///     message to the console for each entry extracted.</para>
+        ///     <para>
+        ///       When double-clicking to launch the SFX, the console window will
+        ///       remain, and the SFX will emit a message for each file as it
+        ///       extracts. The messages fly by quickly, they won't be easily
+        ///       readable, unless the extracted files are fairly large.
+        ///     </para>
+        ///   </description>
+        /// </item>
+        ///
+        /// <item>
+        ///   <term><c>WinFormsApplication</c></term>
+        ///   <description>the SFX presents a forms UI and allows the user to select
+        ///     options before extracting.
+        ///   </description>
+        /// </item>
+        ///
+        /// </list>
+        ///
+        /// </remarks>
+        public bool Quiet
+        {
+            get;
+            set;
+        }
+
+
+        /// <summary>
+        ///   Specify what the self-extractor will do when extracting an entry
+        ///   would overwrite an existing file.
+        /// </summary>
+        /// <remarks>
+        /// <para>
+        ///   The default behavvior is to Throw.
+        /// </para>
+        /// </remarks>
+        public Ionic.Zip.ExtractExistingFileAction ExtractExistingFile
+        {
+            get;
+            set;
+        }
+
+
+        /// <summary>
+        ///   Whether to remove the files that have been unpacked, after executing the
+        ///   PostExtractCommandLine.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   If true, and if there is a <see
+        ///   cref="SelfExtractorSaveOptions.PostExtractCommandLine">
+        ///   PostExtractCommandLine</see>, and if the command runs successfully,
+        ///   then the files that the SFX unpacked will be removed, afterwards.  If
+        ///   the command does not complete successfully (non-zero return code),
+        ///   that is interpreted as a failure, and the extracted files will not be
+        ///   removed.
+        /// </para>
+        ///
+        /// <para>
+        ///   Setting this flag, and setting <c>Flavor</c> to
+        ///   <c>SelfExtractorFlavor.ConsoleApplication</c>, and setting <c>Quiet</c> to
+        ///   true, results in an SFX that extracts itself, runs a file that was
+        ///   extracted, then deletes all the files that were extracted, with no
+        ///   intervention by the user.  You may also want to specify the default
+        ///   extract location, with <c>DefaultExtractDirectory</c>.
+        /// </para>
+        ///
+        /// </remarks>
+        public bool RemoveUnpackedFilesAfterExecute
+        {
+            get;
+            set;
+        }
+
+
+        /// <summary>
+        ///   The file version number to embed into the generated EXE. It will show up, for
+        ///   example, during a mouseover in Windows Explorer.
+        /// </summary>
+        ///
+        public Version FileVersion
+        {
+            get;
+            set;
+        }
+
+        /// <summary>
+        ///   The product version to embed into the generated EXE. It will show up, for
+        ///   example, during a mouseover in Windows Explorer.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///   You can use any arbitrary string, but a human-readable version number is
+        ///   recommended. For example "v1.2 alpha" or "v4.2 RC2".  If you specify nothing,
+        ///   then there is no product version embedded into the EXE.
+        /// </remarks>
+        ///
+        public String ProductVersion
+        {
+            get;
+            set;
+        }
+
+        /// <summary>
+        ///   The copyright notice, if any, to embed into the generated EXE.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///   It will show up, for example, while viewing properties of the file in
+        ///   Windows Explorer.  You can use any arbitrary string, but typically you
+        ///   want something like "Copyright ï¿œ Dino Chiesa 2011".
+        /// </remarks>
+        ///
+        public String Copyright
+        {
+            get;
+            set;
+        }
+
+
+        /// <summary>
+        ///   The description to embed into the generated EXE.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///   Use any arbitrary string.  This text will be displayed during a
+        ///   mouseover in Windows Explorer.  If you specify nothing, then the string
+        ///   "DotNetZip SFX Archive" is embedded into the EXE as the description.
+        /// </remarks>
+        ///
+        public String Description
+        {
+            get;
+            set;
+        }
+
+        /// <summary>
+        ///   The product name to embed into the generated EXE.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///   Use any arbitrary string. This text will be displayed
+        ///   while viewing properties of the EXE file in
+        ///   Windows Explorer.
+        /// </remarks>
+        ///
+        public String ProductName
+        {
+            get;
+            set;
+        }
+
+        /// <summary>
+        ///   The title to display in the Window of a GUI SFX, while it extracts.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///   <para>
+        ///     By default the title show in the GUI window of a self-extractor
+        ///     is "DotNetZip Self-extractor (http://DotNetZip.codeplex.com/)".
+        ///     You can change that by setting this property before saving the SFX.
+        ///   </para>
+        ///
+        ///   <para>
+        ///     This property has an effect only when producing a Self-extractor
+        ///     of flavor <c>SelfExtractorFlavor.WinFormsApplication</c>.
+        ///   </para>
+        /// </remarks>
+        ///
+        public String SfxExeWindowTitle
+        {
+            // workitem 12608
+            get;
+            set;
+        }
+
+        /// <summary>
+        ///   Additional options for the csc.exe compiler, when producing the SFX
+        ///   EXE.
+        /// </summary>
+        /// <exclude/>
+        public string AdditionalCompilerSwitches
+        {
+            get; set;
+        }
+    }
+
+
+
+
+    partial class ZipFile
+    {
+        class ExtractorSettings
+        {
+            public SelfExtractorFlavor Flavor;
+            public List<string> ReferencedAssemblies;
+            public List<string> CopyThroughResources;
+            public List<string> ResourcesToCompile;
+        }
+
+
+        private static ExtractorSettings[] SettingsList = {
+            new ExtractorSettings() {
+                Flavor = SelfExtractorFlavor.WinFormsApplication,
+                ReferencedAssemblies= new List<string>{
+                    "System.dll", "System.Windows.Forms.dll", "System.Drawing.dll"},
+                CopyThroughResources = new List<string>{
+                    "Ionic.Zip.WinFormsSelfExtractorStub.resources",
+                    "Ionic.Zip.Forms.PasswordDialog.resources",
+                    "Ionic.Zip.Forms.ZipContentsDialog.resources"},
+                ResourcesToCompile = new List<string>{
+                    "WinFormsSelfExtractorStub.cs",
+                    "WinFormsSelfExtractorStub.Designer.cs", // .Designer.cs?
+                    "PasswordDialog.cs",
+                    "PasswordDialog.Designer.cs",             //.Designer.cs"
+                    "ZipContentsDialog.cs",
+                    "ZipContentsDialog.Designer.cs",             //.Designer.cs"
+                    "FolderBrowserDialogEx.cs",
+                }
+            },
+            new ExtractorSettings() {
+                Flavor = SelfExtractorFlavor.ConsoleApplication,
+                ReferencedAssemblies= new List<string> { "System.dll", },
+                CopyThroughResources = null,
+                ResourcesToCompile = new List<string>{"CommandLineSelfExtractorStub.cs"}
+            }
+        };
+
+
+
+        //string _defaultExtractLocation;
+        //string _postExtractCmdLine;
+        //         string _SetDefaultLocationCode =
+        //         "namespace OfficeOpenXml.Packaging.Ionic.Zip { internal partial class WinFormsSelfExtractorStub { partial void _SetDefaultExtractLocation() {" +
+        //         " txtExtractDirectory.Text = \"@@VALUE\"; } }}";
+
+
+
+        /// <summary>
+        /// Saves the ZipFile instance to a self-extracting zip archive.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///
+        /// <para>
+        /// The generated exe image will execute on any machine that has the .NET
+        /// Framework 2.0 installed on it.  The generated exe image is also a
+        /// valid ZIP file, readable with DotNetZip or another Zip library or tool
+        /// such as WinZip.
+        /// </para>
+        ///
+        /// <para>
+        /// There are two "flavors" of self-extracting archive.  The
+        /// <c>WinFormsApplication</c> version will pop up a GUI and allow the
+        /// user to select a target directory into which to extract. There's also
+        /// a checkbox allowing the user to specify to overwrite existing files,
+        /// and another checkbox to allow the user to request that Explorer be
+        /// opened to see the extracted files after extraction.  The other flavor
+        /// is <c>ConsoleApplication</c>.  A self-extractor generated with that
+        /// flavor setting will run from the command line. It accepts command-line
+        /// options to set the overwrite behavior, and to specify the target
+        /// extraction directory.
+        /// </para>
+        ///
+        /// <para>
+        /// There are a few temporary files created during the saving to a
+        /// self-extracting zip.  These files are created in the directory pointed
+        /// to by <see cref="ZipFile.TempFileFolder"/>, which defaults to <see
+        /// cref="System.IO.Path.GetTempPath"/>.  These temporary files are
+        /// removed upon successful completion of this method.
+        /// </para>
+        ///
+        /// <para>
+        /// When a user runs the WinForms SFX, the user's personal directory (<see
+        /// cref="Environment.SpecialFolder.Personal">Environment.SpecialFolder.Personal</see>)
+        /// will be used as the default extract location.  If you want to set the
+        /// default extract location, you should use the other overload of
+        /// <c>SaveSelfExtractor()</c>/ The user who runs the SFX will have the
+        /// opportunity to change the extract directory before extracting. When
+        /// the user runs the Command-Line SFX, the user must explicitly specify
+        /// the directory to which to extract.  The .NET Framework 2.0 is required
+        /// on the computer when the self-extracting archive is run.
+        /// </para>
+        ///
+        /// <para>
+        /// NB: This method is not available in the version of DotNetZip build for
+        /// the .NET Compact Framework, nor in the "Reduced" DotNetZip library.
+        /// </para>
+        ///
+        /// </remarks>
+        ///
+        /// <example>
+        /// <code>
+        /// string DirectoryPath = "c:\\Documents\\Project7";
+        /// using (ZipFile zip = new ZipFile())
+        /// {
+        ///     zip.AddDirectory(DirectoryPath, System.IO.Path.GetFileName(DirectoryPath));
+        ///     zip.Comment = "This will be embedded into a self-extracting console-based exe";
+        ///     zip.SaveSelfExtractor("archive.exe", SelfExtractorFlavor.ConsoleApplication);
+        /// }
+        /// </code>
+        /// <code lang="VB">
+        /// Dim DirectoryPath As String = "c:\Documents\Project7"
+        /// Using zip As New ZipFile()
+        ///     zip.AddDirectory(DirectoryPath, System.IO.Path.GetFileName(DirectoryPath))
+        ///     zip.Comment = "This will be embedded into a self-extracting console-based exe"
+        ///     zip.SaveSelfExtractor("archive.exe", SelfExtractorFlavor.ConsoleApplication)
+        /// End Using
+        /// </code>
+        /// </example>
+        ///
+        /// <param name="exeToGenerate">
+        ///   a pathname, possibly fully qualified, to be created. Typically it
+        ///   will end in an .exe extension.</param>
+        /// <param name="flavor">
+        ///   Indicates whether a Winforms or Console self-extractor is
+        ///   desired. </param>
+        internal void SaveSelfExtractor(string exeToGenerate, SelfExtractorFlavor flavor)
+        {
+            SelfExtractorSaveOptions options = new SelfExtractorSaveOptions();
+            options.Flavor = flavor;
+            SaveSelfExtractor(exeToGenerate, options);
+        }
+
+
+
+        /// <summary>
+        ///   Saves the ZipFile instance to a self-extracting zip archive, using
+        ///   the specified save options.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   This method saves a self extracting archive, using the specified save
+        ///   options. These options include the flavor of the SFX, the default extract
+        ///   directory, the icon file, and so on.  See the documentation
+        ///   for <see cref="SaveSelfExtractor(string , SelfExtractorFlavor)"/> for more
+        ///   details.
+        /// </para>
+        ///
+        /// <para>
+        ///   The user who runs the SFX will have the opportunity to change the extract
+        ///   directory before extracting. If at the time of extraction, the specified
+        ///   directory does not exist, the SFX will create the directory before
+        ///   extracting the files.
+        /// </para>
+        ///
+        /// </remarks>
+        ///
+        /// <example>
+        ///   This example saves a WinForms-based self-extracting archive EXE that
+        ///   will use c:\ExtractHere as the default extract location. The C# code
+        ///   shows syntax for .NET 3.0, which uses an object initializer for
+        ///   the SelfExtractorOptions object.
+        /// <code>
+        /// string DirectoryPath = "c:\\Documents\\Project7";
+        /// using (ZipFile zip = new ZipFile())
+        /// {
+        ///     zip.AddDirectory(DirectoryPath, System.IO.Path.GetFileName(DirectoryPath));
+        ///     zip.Comment = "This will be embedded into a self-extracting WinForms-based exe";
+        ///     var options = new SelfExtractorOptions
+        ///     {
+        ///       Flavor = SelfExtractorFlavor.WinFormsApplication,
+        ///       DefaultExtractDirectory = "%USERPROFILE%\\ExtractHere",
+        ///       PostExtractCommandLine = ExeToRunAfterExtract,
+        ///       SfxExeWindowTitle = "My Custom Window Title",
+        ///       RemoveUnpackedFilesAfterExecute = true
+        ///     };
+        ///     zip.SaveSelfExtractor("archive.exe", options);
+        /// }
+        /// </code>
+        /// <code lang="VB">
+        /// Dim DirectoryPath As String = "c:\Documents\Project7"
+        /// Using zip As New ZipFile()
+        ///     zip.AddDirectory(DirectoryPath, System.IO.Path.GetFileName(DirectoryPath))
+        ///     zip.Comment = "This will be embedded into a self-extracting console-based exe"
+        ///     Dim options As New SelfExtractorOptions()
+        ///     options.Flavor = SelfExtractorFlavor.WinFormsApplication
+        ///     options.DefaultExtractDirectory = "%USERPROFILE%\\ExtractHere"
+        ///     options.PostExtractCommandLine = ExeToRunAfterExtract
+        ///     options.SfxExeWindowTitle = "My Custom Window Title"
+        ///     options.RemoveUnpackedFilesAfterExecute = True
+        ///     zip.SaveSelfExtractor("archive.exe", options)
+        /// End Using
+        /// </code>
+        /// </example>
+        ///
+        /// <param name="exeToGenerate">The name of the EXE to generate.</param>
+        /// <param name="options">provides the options for creating the
+        /// Self-extracting archive.</param>
+        internal void SaveSelfExtractor(string exeToGenerate, SelfExtractorSaveOptions options)
+        {
+            // Save an SFX that is both an EXE and a ZIP.
+
+            // Check for the case where we are re-saving a zip archive
+            // that was originally instantiated with a stream.  In that case,
+            // the _name will be null. If so, we set _writestream to null,
+            // which insures that we'll cons up a new WriteStream (with a filesystem
+            // file backing it) in the Save() method.
+            if (_name == null)
+                _writestream = null;
+
+            _SavingSfx = true;
+            _name = exeToGenerate;
+            if (Directory.Exists(_name))
+                throw new ZipException("Bad Directory", new System.ArgumentException("That name specifies an existing directory. Please specify a filename.", "exeToGenerate"));
+            _contentsChanged = true;
+            _fileAlreadyExists = File.Exists(_name);
+
+            _SaveSfxStub(exeToGenerate, options);
+
+            Save();
+            _SavingSfx = false;
+        }
+
+
+
+
+        private static void ExtractResourceToFile(Assembly a, string resourceName, string filename)
+        {
+            int n = 0;
+            byte[] bytes = new byte[1024];
+            using (Stream instream = a.GetManifestResourceStream(resourceName))
+            {
+                if (instream == null)
+                    throw new ZipException(String.Format("missing resource '{0}'", resourceName));
+
+                using (FileStream outstream = File.OpenWrite(filename))
+                {
+                    do
+                    {
+                        n = instream.Read(bytes, 0, bytes.Length);
+                        outstream.Write(bytes, 0, n);
+                    } while (n > 0);
+                }
+            }
+        }
+
+
+        private void _SaveSfxStub(string exeToGenerate, SelfExtractorSaveOptions options)
+        {
+            string nameOfIconFile = null;
+            string stubExe = null;
+            string unpackedResourceDir = null;
+            string tmpDir = null;
+            try
+            {
+                if (File.Exists(exeToGenerate))
+                {
+                    if (Verbose) StatusMessageTextWriter.WriteLine("The existing file ({0}) will be overwritten.", exeToGenerate);
+                }
+                if (!exeToGenerate.EndsWith(".exe"))
+                {
+                    if (Verbose) StatusMessageTextWriter.WriteLine("Warning: The generated self-extracting file will not have an .exe extension.");
+                }
+
+                // workitem 10553
+                tmpDir = TempFileFolder ?? Path.GetDirectoryName(exeToGenerate);
+                stubExe = GenerateTempPathname(tmpDir, "exe");
+
+                // get the Ionic.Zip assembly
+                Assembly a1 = typeof(ZipFile).Assembly;
+
+                using (var csharp = new Microsoft.CSharp.CSharpCodeProvider
+                       (new Dictionary<string,string>() { { "CompilerVersion", "v2.0" } })) {
+
+                    // The following is a perfect opportunity for a linq query, but
+                    // I cannot use it.  DotNetZip needs to run on .NET 2.0,
+                    // and using LINQ would break that. Here's what it would look
+                    // like:
+                    //
+                    //   var settings = (from x in SettingsList
+                    //                   where x.Flavor == flavor
+                    //                   select x).First();
+
+                    ExtractorSettings settings = null;
+                    foreach (var x in SettingsList)
+                    {
+                        if (x.Flavor == options.Flavor)
+                        {
+                            settings = x;
+                            break;
+                        }
+                    }
+
+                    // sanity check; should never happen
+                    if (settings == null)
+                        throw new BadStateException(String.Format("While saving a Self-Extracting Zip, Cannot find that flavor ({0})?", options.Flavor));
+
+                    // This is the list of referenced assemblies.  Ionic.Zip is
+                    // needed here.  Also if it is the winforms (gui) extractor, we
+                    // need other referenced assemblies, like
+                    // System.Windows.Forms.dll, etc.
+                    var cp = new System.CodeDom.Compiler.CompilerParameters();
+                    cp.ReferencedAssemblies.Add(a1.Location);
+                    if (settings.ReferencedAssemblies != null)
+                        foreach (string ra in settings.ReferencedAssemblies)
+                            cp.ReferencedAssemblies.Add(ra);
+
+                    cp.GenerateInMemory = false;
+                    cp.GenerateExecutable = true;
+                    cp.IncludeDebugInformation = false;
+                    cp.CompilerOptions = "";
+
+                    Assembly a2 = Assembly.GetExecutingAssembly();
+
+                    // Use this to concatenate all the source code resources into a
+                    // single module.
+                    var sb = new System.Text.StringBuilder();
+
+                    // In case there are compiler errors later, we allocate a source
+                    // file name now. If errors are detected, we'll spool the source
+                    // code as well as the errors (in comments) into that filename,
+                    // and throw an exception with the filename.  Makes it easier to
+                    // diagnose.  This should be rare; most errors happen only
+                    // during devlpmt of DotNetZip itself, but there are rare
+                    // occasions when they occur in other cases.
+                    string sourceFile = GenerateTempPathname(tmpDir, "cs");
+
+
+                    // // debugging: enumerate the resources in this assembly
+                    // Console.WriteLine("Resources in this assembly:");
+                    // foreach (string rsrc in a2.GetManifestResourceNames())
+                    //   {
+                    //     Console.WriteLine(rsrc);
+                    //   }
+                    // Console.WriteLine();
+
+
+                    // all the source code is embedded in the DLL as a zip file.
+                    using (ZipFile zip = ZipFile.Read(a2.GetManifestResourceStream("Ionic.Zip.Resources.ZippedResources.zip")))
+                    {
+                        // // debugging: enumerate the files in the embedded zip
+                        // Console.WriteLine("Entries in the embbedded zip:");
+                        // foreach (ZipEntry entry in zip)
+                        //   {
+                        //     Console.WriteLine(entry.FileName);
+                        //   }
+                        // Console.WriteLine();
+
+                        unpackedResourceDir = GenerateTempPathname(tmpDir, "tmp");
+
+                        if (String.IsNullOrEmpty(options.IconFile))
+                        {
+                            // Use the ico file that is embedded into the Ionic.Zip
+                            // DLL itself.  To do this we must unpack the icon to
+                            // the filesystem, in order to specify it on the cmdline
+                            // of csc.exe.  This method will remove the unpacked
+                            // file later.
+                            System.IO.Directory.CreateDirectory(unpackedResourceDir);
+                            ZipEntry e = zip["zippedFile.ico"];
+                            // Must not extract a readonly file - it will be impossible to
+                            // delete later.
+                            if ((e.Attributes & FileAttributes.ReadOnly) == FileAttributes.ReadOnly)
+                                e.Attributes ^= FileAttributes.ReadOnly;
+                            e.Extract(unpackedResourceDir);
+                            nameOfIconFile = Path.Combine(unpackedResourceDir, "zippedFile.ico");
+                            cp.CompilerOptions += String.Format("/win32icon:\"{0}\"", nameOfIconFile);
+                        }
+                        else
+                            cp.CompilerOptions += String.Format("/win32icon:\"{0}\"", options.IconFile);
+
+                        cp.OutputAssembly = stubExe;
+
+                        if (options.Flavor == SelfExtractorFlavor.WinFormsApplication)
+                            cp.CompilerOptions += " /target:winexe";
+
+                        if (!String.IsNullOrEmpty(options.AdditionalCompilerSwitches))
+                            cp.CompilerOptions += " " + options.AdditionalCompilerSwitches;
+
+                        if (String.IsNullOrEmpty(cp.CompilerOptions))
+                            cp.CompilerOptions = null;
+
+                        if ((settings.CopyThroughResources != null) && (settings.CopyThroughResources.Count != 0))
+                        {
+                            if (!Directory.Exists(unpackedResourceDir)) System.IO.Directory.CreateDirectory(unpackedResourceDir);
+                            foreach (string re in settings.CopyThroughResources)
+                            {
+                                string filename = Path.Combine(unpackedResourceDir, re);
+
+                                ExtractResourceToFile(a2, re, filename);
+                                // add the file into the target assembly as an embedded resource
+                                cp.EmbeddedResources.Add(filename);
+                            }
+                        }
+
+                        // add the Ionic.Utils.Zip DLL as an embedded resource
+                        cp.EmbeddedResources.Add(a1.Location);
+
+                        // file header
+                        sb.Append("// " + Path.GetFileName(sourceFile) + "\n")
+                            .Append("// --------------------------------------------\n//\n")
+                            .Append("// This SFX source file was generated by DotNetZip ")
+                            .Append(ZipFile.LibraryVersion.ToString())
+                            .Append("\n//         at ")
+                            .Append(System.DateTime.Now.ToString("yyyy MMMM dd  HH:mm:ss"))
+                            .Append("\n//\n// --------------------------------------------\n\n\n");
+
+                        // assembly attributes
+                        if (!String.IsNullOrEmpty(options.Description))
+                            sb.Append("[assembly: System.Reflection.AssemblyTitle(\""
+                                      + options.Description.Replace("\"", "")
+                                      + "\")]\n");
+                        else
+                            sb.Append("[assembly: System.Reflection.AssemblyTitle(\"DotNetZip SFX Archive\")]\n");
+
+                        if (!String.IsNullOrEmpty(options.ProductVersion))
+                            sb.Append("[assembly: System.Reflection.AssemblyInformationalVersion(\""
+                                      + options.ProductVersion.Replace("\"", "")
+                                      + "\")]\n");
+
+                        // workitem
+                        string copyright =
+                            (String.IsNullOrEmpty(options.Copyright))
+                            ? "Extractor: Copyright ï¿œ Dino Chiesa 2008-2011"
+                            : options.Copyright.Replace("\"", "");
+
+                        if (!String.IsNullOrEmpty(options.ProductName))
+                            sb.Append("[assembly: System.Reflection.AssemblyProduct(\"")
+                                .Append(options.ProductName.Replace("\"", ""))
+                                .Append("\")]\n");
+                        else
+                            sb.Append("[assembly: System.Reflection.AssemblyProduct(\"DotNetZip\")]\n");
+
+
+                        sb.Append("[assembly: System.Reflection.AssemblyCopyright(\"" + copyright + "\")]\n")
+                            .Append(String.Format("[assembly: System.Reflection.AssemblyVersion(\"{0}\")]\n", ZipFile.LibraryVersion.ToString()));
+                        if (options.FileVersion != null)
+                            sb.Append(String.Format("[assembly: System.Reflection.AssemblyFileVersion(\"{0}\")]\n",
+                                                    options.FileVersion.ToString()));
+
+                        sb.Append("\n\n\n");
+
+                        // Set the default extract location if it is available
+                        string extractLoc = options.DefaultExtractDirectory;
+                        if (extractLoc != null)
+                        {
+                            // remove double-quotes and replace slash with double-slash.
+                            // This, because the value is going to be embedded into a
+                            // cs file as a quoted string, and it needs to be escaped.
+                            extractLoc = extractLoc.Replace("\"", "").Replace("\\", "\\\\");
+                        }
+
+                        string postExCmdLine = options.PostExtractCommandLine;
+                        if (postExCmdLine != null)
+                        {
+                            postExCmdLine = postExCmdLine.Replace("\\", "\\\\");
+                            postExCmdLine = postExCmdLine.Replace("\"", "\\\"");
+                        }
+
+
+                        foreach (string rc in settings.ResourcesToCompile)
+                        {
+                            using (Stream s = zip[rc].OpenReader())
+                            {
+                                if (s == null)
+                                    throw new ZipException(String.Format("missing resource '{0}'", rc));
+                                using (StreamReader sr = new StreamReader(s))
+                                {
+                                    while (sr.Peek() >= 0)
+                                    {
+                                        string line = sr.ReadLine();
+                                        if (extractLoc != null)
+                                            line = line.Replace("@@EXTRACTLOCATION", extractLoc);
+
+                                        line = line.Replace("@@REMOVE_AFTER_EXECUTE", options.RemoveUnpackedFilesAfterExecute.ToString());
+                                        line = line.Replace("@@QUIET", options.Quiet.ToString());
+                                        if (!String.IsNullOrEmpty(options.SfxExeWindowTitle))
+
+                                            line = line.Replace("@@SFX_EXE_WINDOW_TITLE", options.SfxExeWindowTitle);
+
+                                        line = line.Replace("@@EXTRACT_EXISTING_FILE", ((int)options.ExtractExistingFile).ToString());
+
+                                        if (postExCmdLine != null)
+                                            line = line.Replace("@@POST_UNPACK_CMD_LINE", postExCmdLine);
+
+                                        sb.Append(line).Append("\n");
+                                    }
+                                }
+                                sb.Append("\n\n");
+                            }
+                        }
+                    }
+
+                    string LiteralSource = sb.ToString();
+
+#if DEBUGSFX
+                    // for debugging only
+                    string sourceModule = GenerateTempPathname(tmpDir, "cs");
+                    using (StreamWriter sw = File.CreateText(sourceModule))
+                    {
+                        sw.Write(LiteralSource);
+                    }
+                    Console.WriteLine("source: {0}", sourceModule);
+#endif
+
+                    var cr = csharp.CompileAssemblyFromSource(cp, LiteralSource);
+
+
+                    if (cr == null)
+                        throw new SfxGenerationException("Cannot compile the extraction logic!");
+
+                    if (Verbose)
+                        foreach (string output in cr.Output)
+                            StatusMessageTextWriter.WriteLine(output);
+
+                    if (cr.Errors.Count != 0)
+                    {
+                        using (TextWriter tw = new StreamWriter(sourceFile))
+                        {
+                            // first, the source we compiled
+                            tw.Write(LiteralSource);
+
+                            // now, append the compile errors
+                            tw.Write("\n\n\n// ------------------------------------------------------------------\n");
+                            tw.Write("// Errors during compilation: \n//\n");
+                            string p = Path.GetFileName(sourceFile);
+
+                            foreach (System.CodeDom.Compiler.CompilerError error in cr.Errors)
+                            {
+                                tw.Write(String.Format("//   {0}({1},{2}): {3} {4}: {5}\n//\n",
+                                                       p,                                   // 0
+                                                       error.Line,                          // 1
+                                                       error.Column,                        // 2
+                                                       error.IsWarning ? "Warning" : "error",   // 3
+                                                       error.ErrorNumber,                   // 4
+                                                       error.ErrorText));                  // 5
+                            }
+                        }
+                        throw new SfxGenerationException(String.Format("Errors compiling the extraction logic!  {0}", sourceFile));
+                    }
+
+                    OnSaveEvent(ZipProgressEventType.Saving_AfterCompileSelfExtractor);
+
+                    // Now, copy the resulting EXE image to the _writestream.
+                    // Because this stub exe is being saved first, the effect will be to
+                    // concatenate the exe and the zip data together.
+                    using (System.IO.Stream input = System.IO.File.OpenRead(stubExe))
+                    {
+                        byte[] buffer = new byte[4000];
+                        int n = 1;
+                        while (n != 0)
+                        {
+                            n = input.Read(buffer, 0, buffer.Length);
+                            if (n != 0)
+                                WriteStream.Write(buffer, 0, n);
+                        }
+                    }
+                }
+
+                OnSaveEvent(ZipProgressEventType.Saving_AfterSaveTempArchive);
+            }
+            finally
+            {
+                try
+                {
+                    if (Directory.Exists(unpackedResourceDir))
+                    {
+                        try { Directory.Delete(unpackedResourceDir, true); }
+                        catch (System.IO.IOException exc1)
+                        {
+                            StatusMessageTextWriter.WriteLine("Warning: Exception: {0}", exc1);
+                        }
+                    }
+                    if (File.Exists(stubExe))
+                    {
+                        try { File.Delete(stubExe); }
+                        catch (System.IO.IOException exc1)
+                        {
+                            StatusMessageTextWriter.WriteLine("Warning: Exception: {0}", exc1);
+                        }
+                    }
+                }
+                catch (System.IO.IOException) { }
+            }
+
+            return;
+
+        }
+
+
+
+        internal static string GenerateTempPathname(string dir, string extension)
+        {
+            string candidate = null;
+            String AppName = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name;
+            do
+            {
+                // workitem 13475
+                string uuid = System.Guid.NewGuid().ToString();
+
+                string Name = String.Format("{0}-{1}-{2}.{3}",
+                        AppName, System.DateTime.Now.ToString("yyyyMMMdd-HHmmss"),
+                                            uuid, extension);
+                candidate = System.IO.Path.Combine(dir, Name);
+            } while (System.IO.File.Exists(candidate) || System.IO.Directory.Exists(candidate));
+
+            // The candidate path does not exist as a file or directory.
+            // It can now be created, as a file or directory.
+            return candidate;
+        }
+
+    }
+#endif
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ZipFile.Selector.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ZipFile.Selector.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ZipFile.Selector.cs	(revision 12707)
@@ -0,0 +1,1466 @@
+// ZipFile.Selector.cs
+// ------------------------------------------------------------------
+//
+// Copyright (c) 2009-2010 Dino Chiesa.
+// All rights reserved.
+//
+// This code module is part of DotNetZip, a zipfile class library.
+//
+// ------------------------------------------------------------------
+//
+// This code is licensed under the Microsoft Public License.
+// See the file License.txt for the license details.
+// More info on: http://dotnetzip.codeplex.com
+//
+// ------------------------------------------------------------------
+//
+// last saved (in emacs):
+// Time-stamp: <2011-August-06 09:35:58>
+//
+// ------------------------------------------------------------------
+//
+// This module defines methods in the ZipFile class associated to the FileFilter
+// capability - selecting files to add into the archive, or selecting entries to
+// retrieve from the archive based on criteria including the filename, size, date, or
+// attributes.  It is something like a "poor man's LINQ".  I included it into DotNetZip
+// because not everyone has .NET 3.5 yet.  When using DotNetZip on .NET 3.5, the LINQ
+// query/selection will be superior.
+//
+// These methods are segregated into a different module to facilitate easy exclusion for
+// those people who wish to have a smaller library without this function.
+//
+// ------------------------------------------------------------------
+
+
+using System;
+using System.IO;
+using System.Collections.Generic;
+using OfficeOpenXml.Packaging.Ionic.Zip;
+using System.Globalization;
+
+namespace OfficeOpenXml.Packaging.Ionic.Zip
+{
+
+    partial class ZipFile
+    {
+        /// <summary>
+        ///   Adds to the ZipFile a set of files from the current working directory on
+        ///   disk, that conform to the specified criteria.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   This method selects files from the the current working directory matching
+        ///   the specified criteria, and adds them to the ZipFile.
+        /// </para>
+        ///
+        /// <para>
+        ///   Specify the criteria in statements of 3 elements: a noun, an operator, and
+        ///   a value.  Consider the string "name != *.doc" .  The noun is "name".  The
+        ///   operator is "!=", implying "Not Equal".  The value is "*.doc".  That
+        ///   criterion, in English, says "all files with a name that does not end in
+        ///   the .doc extension."
+        /// </para>
+        ///
+        /// <para>
+        ///   Supported nouns include "name" (or "filename") for the filename; "atime",
+        ///   "mtime", and "ctime" for last access time, last modfied time, and created
+        ///   time of the file, respectively; "attributes" (or "attrs") for the file
+        ///   attributes; "size" (or "length") for the file length (uncompressed), and
+        ///   "type" for the type of object, either a file or a directory.  The
+        ///   "attributes", "name" and "type" nouns both support = and != as operators.
+        ///   The "size", "atime", "mtime", and "ctime" nouns support = and !=, and
+        ///   &gt;, &gt;=, &lt;, &lt;= as well. The times are taken to be expressed in
+        ///   local time.
+        /// </para>
+        ///
+        /// <para>
+        /// Specify values for the file attributes as a string with one or more of the
+        /// characters H,R,S,A,I,L in any order, implying file attributes of Hidden,
+        /// ReadOnly, System, Archive, NotContextIndexed, and ReparsePoint (symbolic
+        /// link) respectively.
+        /// </para>
+        ///
+        /// <para>
+        /// To specify a time, use YYYY-MM-DD-HH:mm:ss or YYYY/MM/DD-HH:mm:ss as the
+        /// format.  If you omit the HH:mm:ss portion, it is assumed to be 00:00:00
+        /// (midnight).
+        /// </para>
+        ///
+        /// <para>
+        /// The value for a size criterion is expressed in integer quantities of bytes,
+        /// kilobytes (use k or kb after the number), megabytes (m or mb), or gigabytes
+        /// (g or gb).
+        /// </para>
+        ///
+        /// <para>
+        /// The value for a name is a pattern to match against the filename, potentially
+        /// including wildcards.  The pattern follows CMD.exe glob rules: * implies one
+        /// or more of any character, while ?  implies one character.  If the name
+        /// pattern contains any slashes, it is matched to the entire filename,
+        /// including the path; otherwise, it is matched against only the filename
+        /// without the path.  This means a pattern of "*\*.*" matches all files one
+        /// directory level deep, while a pattern of "*.*" matches all files in all
+        /// directories.
+        /// </para>
+        ///
+        /// <para>
+        /// To specify a name pattern that includes spaces, use single quotes around the
+        /// pattern.  A pattern of "'* *.*'" will match all files that have spaces in
+        /// the filename.  The full criteria string for that would be "name = '* *.*'" .
+        /// </para>
+        ///
+        /// <para>
+        /// The value for a type criterion is either F (implying a file) or D (implying
+        /// a directory).
+        /// </para>
+        ///
+        /// <para>
+        /// Some examples:
+        /// </para>
+        ///
+        /// <list type="table">
+        ///   <listheader>
+        ///     <term>criteria</term>
+        ///     <description>Files retrieved</description>
+        ///   </listheader>
+        ///
+        ///   <item>
+        ///     <term>name != *.xls </term>
+        ///     <description>any file with an extension that is not .xls
+        ///     </description>
+        ///   </item>
+        ///
+        ///   <item>
+        ///     <term>name = *.mp3 </term>
+        ///     <description>any file with a .mp3 extension.
+        ///     </description>
+        ///   </item>
+        ///
+        ///   <item>
+        ///     <term>*.mp3</term>
+        ///     <description>(same as above) any file with a .mp3 extension.
+        ///     </description>
+        ///   </item>
+        ///
+        ///   <item>
+        ///     <term>attributes = A </term>
+        ///     <description>all files whose attributes include the Archive bit.
+        ///     </description>
+        ///   </item>
+        ///
+        ///   <item>
+        ///     <term>attributes != H </term>
+        ///     <description>all files whose attributes do not include the Hidden bit.
+        ///     </description>
+        ///   </item>
+        ///
+        ///   <item>
+        ///     <term>mtime > 2009-01-01</term>
+        ///     <description>all files with a last modified time after January 1st, 2009.
+        ///     </description>
+        ///   </item>
+        ///
+        ///   <item>
+        ///     <term>size > 2gb</term>
+        ///     <description>all files whose uncompressed size is greater than 2gb.
+        ///     </description>
+        ///   </item>
+        ///
+        ///   <item>
+        ///     <term>type = D</term>
+        ///     <description>all directories in the filesystem. </description>
+        ///   </item>
+        ///
+        /// </list>
+        ///
+        /// <para>
+        /// You can combine criteria with the conjunctions AND or OR. Using a string
+        /// like "name = *.txt AND size &gt;= 100k" for the selectionCriteria retrieves
+        /// entries whose names end in .txt, and whose uncompressed size is greater than
+        /// or equal to 100 kilobytes.
+        /// </para>
+        ///
+        /// <para>
+        /// For more complex combinations of criteria, you can use parenthesis to group
+        /// clauses in the boolean logic.  Without parenthesis, the precedence of the
+        /// criterion atoms is determined by order of appearance.  Unlike the C#
+        /// language, the AND conjunction does not take precendence over the logical OR.
+        /// This is important only in strings that contain 3 or more criterion atoms.
+        /// In other words, "name = *.txt and size &gt; 1000 or attributes = H" implies
+        /// "((name = *.txt AND size &gt; 1000) OR attributes = H)" while "attributes =
+        /// H OR name = *.txt and size &gt; 1000" evaluates to "((attributes = H OR name
+        /// = *.txt) AND size &gt; 1000)".  When in doubt, use parenthesis.
+        /// </para>
+        ///
+        /// <para>
+        /// Using time properties requires some extra care. If you want to retrieve all
+        /// entries that were last updated on 2009 February 14, specify a time range
+        /// like so:"mtime &gt;= 2009-02-14 AND mtime &lt; 2009-02-15".  Read this to
+        /// say: all files updated after 12:00am on February 14th, until 12:00am on
+        /// February 15th.  You can use the same bracketing approach to specify any time
+        /// period - a year, a month, a week, and so on.
+        /// </para>
+        ///
+        /// <para>
+        /// The syntax allows one special case: if you provide a string with no spaces, it is
+        /// treated as a pattern to match for the filename.  Therefore a string like "*.xls"
+        /// will be equivalent to specifying "name = *.xls".
+        /// </para>
+        ///
+        /// <para>
+        /// There is no logic in this method that insures that the file inclusion
+        /// criteria are internally consistent.  For example, it's possible to specify
+        /// criteria that says the file must have a size of less than 100 bytes, as well
+        /// as a size that is greater than 1000 bytes. Obviously no file will ever
+        /// satisfy such criteria, but this method does not detect such logical
+        /// inconsistencies. The caller is responsible for insuring the criteria are
+        /// sensible.
+        /// </para>
+        ///
+        /// <para>
+        ///   Using this method, the file selection does not recurse into
+        ///   subdirectories, and the full path of the selected files is included in the
+        ///   entries added into the zip archive.  If you don't like these behaviors,
+        ///   see the other overloads of this method.
+        /// </para>
+        /// </remarks>
+        ///
+        /// <example>
+        /// This example zips up all *.csv files in the current working directory.
+        /// <code>
+        /// using (ZipFile zip = new ZipFile())
+        /// {
+        ///     // To just match on filename wildcards,
+        ///     // use the shorthand form of the selectionCriteria string.
+        ///     zip.AddSelectedFiles("*.csv");
+        ///     zip.Save(PathToZipArchive);
+        /// }
+        /// </code>
+        /// <code lang="VB">
+        /// Using zip As ZipFile = New ZipFile()
+        ///     zip.AddSelectedFiles("*.csv")
+        ///     zip.Save(PathToZipArchive)
+        /// End Using
+        /// </code>
+        /// </example>
+        ///
+        /// <param name="selectionCriteria">The criteria for file selection</param>
+        public void AddSelectedFiles(String selectionCriteria)
+        {
+            this.AddSelectedFiles(selectionCriteria, ".", null, false);
+        }
+
+        /// <summary>
+        ///   Adds to the ZipFile a set of files from the disk that conform to the
+        ///   specified criteria, optionally recursing into subdirectories.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   This method selects files from the the current working directory matching
+        ///   the specified criteria, and adds them to the ZipFile.  If
+        ///   <c>recurseDirectories</c> is true, files are also selected from
+        ///   subdirectories, and the directory structure in the filesystem is
+        ///   reproduced in the zip archive, rooted at the current working directory.
+        /// </para>
+        ///
+        /// <para>
+        ///   Using this method, the full path of the selected files is included in the
+        ///   entries added into the zip archive.  If you don't want this behavior, use
+        ///   one of the overloads of this method that allows the specification of a
+        ///   <c>directoryInArchive</c>.
+        /// </para>
+        ///
+        /// <para>
+        ///   For details on the syntax for the selectionCriteria parameter, see <see
+        ///   cref="AddSelectedFiles(String)"/>.
+        /// </para>
+        ///
+        /// </remarks>
+        ///
+        /// <example>
+        ///
+        ///   This example zips up all *.xml files in the current working directory, or any
+        ///   subdirectory, that are larger than 1mb.
+        ///
+        /// <code>
+        /// using (ZipFile zip = new ZipFile())
+        /// {
+        ///     // Use a compound expression in the selectionCriteria string.
+        ///     zip.AddSelectedFiles("name = *.xml  and  size > 1024kb", true);
+        ///     zip.Save(PathToZipArchive);
+        /// }
+        /// </code>
+        /// <code lang="VB">
+        /// Using zip As ZipFile = New ZipFile()
+        ///     ' Use a compound expression in the selectionCriteria string.
+        ///     zip.AddSelectedFiles("name = *.xml  and  size > 1024kb", true)
+        ///     zip.Save(PathToZipArchive)
+        /// End Using
+        /// </code>
+        /// </example>
+        ///
+        /// <param name="selectionCriteria">The criteria for file selection</param>
+        ///
+        /// <param name="recurseDirectories">
+        ///   If true, the file selection will recurse into subdirectories.
+        /// </param>
+        public void AddSelectedFiles(String selectionCriteria, bool recurseDirectories)
+        {
+            this.AddSelectedFiles(selectionCriteria, ".", null, recurseDirectories);
+        }
+
+        /// <summary>
+        ///   Adds to the ZipFile a set of files from a specified directory in the
+        ///   filesystem, that conform to the specified criteria.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   This method selects files that conform to the specified criteria, from the
+        ///   the specified directory on disk, and adds them to the ZipFile.  The search
+        ///   does not recurse into subdirectores.
+        /// </para>
+        ///
+        /// <para>
+        ///   Using this method, the full filesystem path of the files on disk is
+        ///   reproduced on the entries added to the zip file.  If you don't want this
+        ///   behavior, use one of the other overloads of this method.
+        /// </para>
+        ///
+        /// <para>
+        ///   For details on the syntax for the selectionCriteria parameter, see <see
+        ///   cref="AddSelectedFiles(String)"/>.
+        /// </para>
+        ///
+        /// </remarks>
+        ///
+        /// <example>
+        ///
+        ///   This example zips up all *.xml files larger than 1mb in the directory
+        ///   given by "d:\rawdata".
+        ///
+        /// <code>
+        /// using (ZipFile zip = new ZipFile())
+        /// {
+        ///     // Use a compound expression in the selectionCriteria string.
+        ///     zip.AddSelectedFiles("name = *.xml  and  size > 1024kb", "d:\\rawdata");
+        ///     zip.Save(PathToZipArchive);
+        /// }
+        /// </code>
+        ///
+        /// <code lang="VB">
+        /// Using zip As ZipFile = New ZipFile()
+        ///     ' Use a compound expression in the selectionCriteria string.
+        ///     zip.AddSelectedFiles("name = *.xml  and  size > 1024kb", "d:\rawdata)
+        ///     zip.Save(PathToZipArchive)
+        /// End Using
+        /// </code>
+        /// </example>
+        ///
+        /// <param name="selectionCriteria">The criteria for file selection</param>
+        ///
+        /// <param name="directoryOnDisk">
+        /// The name of the directory on the disk from which to select files.
+        /// </param>
+        public void AddSelectedFiles(String selectionCriteria, String directoryOnDisk)
+        {
+            this.AddSelectedFiles(selectionCriteria, directoryOnDisk, null, false);
+        }
+
+
+        /// <summary>
+        ///   Adds to the ZipFile a set of files from the specified directory on disk,
+        ///   that conform to the specified criteria.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///
+        /// <para>
+        ///   This method selects files from the the specified disk directory matching
+        ///   the specified selection criteria, and adds them to the ZipFile.  If
+        ///   <c>recurseDirectories</c> is true, files are also selected from
+        ///   subdirectories.
+        /// </para>
+        ///
+        /// <para>
+        ///   The full directory structure in the filesystem is reproduced on the
+        ///   entries added to the zip archive.  If you don't want this behavior, use
+        ///   one of the overloads of this method that allows the specification of a
+        ///   <c>directoryInArchive</c>.
+        /// </para>
+        ///
+        /// <para>
+        ///   For details on the syntax for the selectionCriteria parameter, see <see
+        ///   cref="AddSelectedFiles(String)"/>.
+        /// </para>
+        /// </remarks>
+        ///
+        /// <example>
+        ///
+        ///   This example zips up all *.csv files in the "files" directory, or any
+        ///   subdirectory, that have been saved since 2009 February 14th.
+        ///
+        /// <code>
+        /// using (ZipFile zip = new ZipFile())
+        /// {
+        ///     // Use a compound expression in the selectionCriteria string.
+        ///     zip.AddSelectedFiles("name = *.csv  and  mtime > 2009-02-14", "files", true);
+        ///     zip.Save(PathToZipArchive);
+        /// }
+        /// </code>
+        /// <code lang="VB">
+        /// Using zip As ZipFile = New ZipFile()
+        ///     ' Use a compound expression in the selectionCriteria string.
+        ///     zip.AddSelectedFiles("name = *.csv  and  mtime > 2009-02-14", "files", true)
+        ///     zip.Save(PathToZipArchive)
+        /// End Using
+        /// </code>
+        /// </example>
+        ///
+        /// <example>
+        ///   This example zips up all files in the current working
+        ///   directory, and all its child directories, except those in
+        ///   the <c>excludethis</c> subdirectory.
+        /// <code lang="VB">
+        /// Using Zip As ZipFile = New ZipFile(zipfile)
+        ///   Zip.AddSelectedFfiles("name != 'excludethis\*.*'", datapath, True)
+        ///   Zip.Save()
+        /// End Using
+        /// </code>
+        /// </example>
+        ///
+        /// <param name="selectionCriteria">The criteria for file selection</param>
+        ///
+        /// <param name="directoryOnDisk">
+        ///   The filesystem path from which to select files.
+        /// </param>
+        ///
+        /// <param name="recurseDirectories">
+        ///   If true, the file selection will recurse into subdirectories.
+        /// </param>
+        public void AddSelectedFiles(String selectionCriteria, String directoryOnDisk, bool recurseDirectories)
+        {
+            this.AddSelectedFiles(selectionCriteria, directoryOnDisk, null, recurseDirectories);
+        }
+
+
+        /// <summary>
+        ///   Adds to the ZipFile a selection of files from the specified directory on
+        ///   disk, that conform to the specified criteria, and using a specified root
+        ///   path for entries added to the zip archive.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   This method selects files from the specified disk directory matching the
+        ///   specified selection criteria, and adds those files to the ZipFile, using
+        ///   the specified directory path in the archive.  The search does not recurse
+        ///   into subdirectories.  For details on the syntax for the selectionCriteria
+        ///   parameter, see <see cref="AddSelectedFiles(String)" />.
+        /// </para>
+        ///
+        /// </remarks>
+        ///
+        /// <example>
+        ///
+        ///   This example zips up all *.psd files in the "photos" directory that have
+        ///   been saved since 2009 February 14th, and puts them all in a zip file,
+        ///   using the directory name of "content" in the zip archive itself. When the
+        ///   zip archive is unzipped, the folder containing the .psd files will be
+        ///   named "content".
+        ///
+        /// <code>
+        /// using (ZipFile zip = new ZipFile())
+        /// {
+        ///     // Use a compound expression in the selectionCriteria string.
+        ///     zip.AddSelectedFiles("name = *.psd  and  mtime > 2009-02-14", "photos", "content");
+        ///     zip.Save(PathToZipArchive);
+        /// }
+        /// </code>
+        /// <code lang="VB">
+        /// Using zip As ZipFile = New ZipFile
+        ///     zip.AddSelectedFiles("name = *.psd  and  mtime > 2009-02-14", "photos", "content")
+        ///     zip.Save(PathToZipArchive)
+        /// End Using
+        /// </code>
+        /// </example>
+        ///
+        /// <param name="selectionCriteria">
+        ///   The criteria for selection of files to add to the <c>ZipFile</c>.
+        /// </param>
+        ///
+        /// <param name="directoryOnDisk">
+        ///   The path to the directory in the filesystem from which to select files.
+        /// </param>
+        ///
+        /// <param name="directoryPathInArchive">
+        ///   Specifies a directory path to use to in place of the
+        ///   <c>directoryOnDisk</c>.  This path may, or may not, correspond to a real
+        ///   directory in the current filesystem.  If the files within the zip are
+        ///   later extracted, this is the path used for the extracted file.  Passing
+        ///   null (nothing in VB) will use the path on the file name, if any; in other
+        ///   words it would use <c>directoryOnDisk</c>, plus any subdirectory.  Passing
+        ///   the empty string ("") will insert the item at the root path within the
+        ///   archive.
+        /// </param>
+        public void AddSelectedFiles(String selectionCriteria,
+                                     String directoryOnDisk,
+                                     String directoryPathInArchive)
+        {
+            this.AddSelectedFiles(selectionCriteria, directoryOnDisk, directoryPathInArchive, false);
+        }
+
+        /// <summary>
+        ///   Adds to the ZipFile a selection of files from the specified directory on
+        ///   disk, that conform to the specified criteria, optionally recursing through
+        ///   subdirectories, and using a specified root path for entries added to the
+        ///   zip archive.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///   This method selects files from the specified disk directory that match the
+        ///   specified selection criteria, and adds those files to the ZipFile, using
+        ///   the specified directory path in the archive. If <c>recurseDirectories</c>
+        ///   is true, files are also selected from subdirectories, and the directory
+        ///   structure in the filesystem is reproduced in the zip archive, rooted at
+        ///   the directory specified by <c>directoryOnDisk</c>.  For details on the
+        ///   syntax for the selectionCriteria parameter, see <see
+        ///   cref="AddSelectedFiles(String)" />.
+        /// </remarks>
+        ///
+        /// <example>
+        ///
+        ///   This example zips up all files that are NOT *.pst files, in the current
+        ///   working directory and any subdirectories.
+        ///
+        /// <code>
+        /// using (ZipFile zip = new ZipFile())
+        /// {
+        ///     zip.AddSelectedFiles("name != *.pst", SourceDirectory, "backup", true);
+        ///     zip.Save(PathToZipArchive);
+        /// }
+        /// </code>
+        /// <code lang="VB">
+        /// Using zip As ZipFile = New ZipFile
+        ///     zip.AddSelectedFiles("name != *.pst", SourceDirectory, "backup", true)
+        ///     zip.Save(PathToZipArchive)
+        /// End Using
+        /// </code>
+        /// </example>
+        ///
+        /// <param name="selectionCriteria">
+        ///   The criteria for selection of files to add to the <c>ZipFile</c>.
+        /// </param>
+        ///
+        /// <param name="directoryOnDisk">
+        ///   The path to the directory in the filesystem from which to select files.
+        /// </param>
+        ///
+        /// <param name="directoryPathInArchive">
+        ///   Specifies a directory path to use to in place of the
+        ///   <c>directoryOnDisk</c>.  This path may, or may not, correspond to a real
+        ///   directory in the current filesystem.  If the files within the zip are
+        ///   later extracted, this is the path used for the extracted file.  Passing
+        ///   null (nothing in VB) will use the path on the file name, if any; in other
+        ///   words it would use <c>directoryOnDisk</c>, plus any subdirectory.  Passing
+        ///   the empty string ("") will insert the item at the root path within the
+        ///   archive.
+        /// </param>
+        ///
+        /// <param name="recurseDirectories">
+        ///   If true, the method also scans subdirectories for files matching the
+        ///   criteria.
+        /// </param>
+        public void AddSelectedFiles(String selectionCriteria,
+                                     String directoryOnDisk,
+                                     String directoryPathInArchive,
+                                     bool recurseDirectories)
+        {
+            _AddOrUpdateSelectedFiles(selectionCriteria,
+                                      directoryOnDisk,
+                                      directoryPathInArchive,
+                                      recurseDirectories,
+                                      false);
+        }
+
+        /// <summary>
+        ///   Updates the ZipFile with a selection of files from the disk that conform
+        ///   to the specified criteria.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///   This method selects files from the specified disk directory that match the
+        ///   specified selection criteria, and Updates the <c>ZipFile</c> with those
+        ///   files, using the specified directory path in the archive. If
+        ///   <c>recurseDirectories</c> is true, files are also selected from
+        ///   subdirectories, and the directory structure in the filesystem is
+        ///   reproduced in the zip archive, rooted at the directory specified by
+        ///   <c>directoryOnDisk</c>.  For details on the syntax for the
+        ///   selectionCriteria parameter, see <see cref="AddSelectedFiles(String)" />.
+        /// </remarks>
+        ///
+        /// <param name="selectionCriteria">
+        ///   The criteria for selection of files to add to the <c>ZipFile</c>.
+        /// </param>
+        ///
+        /// <param name="directoryOnDisk">
+        ///   The path to the directory in the filesystem from which to select files.
+        /// </param>
+        ///
+        /// <param name="directoryPathInArchive">
+        ///   Specifies a directory path to use to in place of the
+        ///   <c>directoryOnDisk</c>. This path may, or may not, correspond to a
+        ///   real directory in the current filesystem. If the files within the zip
+        ///   are later extracted, this is the path used for the extracted file.
+        ///   Passing null (nothing in VB) will use the path on the file name, if
+        ///   any; in other words it would use <c>directoryOnDisk</c>, plus any
+        ///   subdirectory.  Passing the empty string ("") will insert the item at
+        ///   the root path within the archive.
+        /// </param>
+        ///
+        /// <param name="recurseDirectories">
+        ///   If true, the method also scans subdirectories for files matching the criteria.
+        /// </param>
+        ///
+        /// <seealso cref="AddSelectedFiles(String, String, String, bool)" />
+        public void UpdateSelectedFiles(String selectionCriteria,
+                                     String directoryOnDisk,
+                                     String directoryPathInArchive,
+                                     bool recurseDirectories)
+        {
+            _AddOrUpdateSelectedFiles(selectionCriteria,
+                                      directoryOnDisk,
+                                      directoryPathInArchive,
+                                      recurseDirectories,
+                                      true);
+        }
+
+
+        private string EnsureendInSlash(string s)
+        {
+            if (s.EndsWith("\\")) return s;
+            return s + "\\";
+        }
+
+        private void _AddOrUpdateSelectedFiles(String selectionCriteria,
+                                               String directoryOnDisk,
+                                               String directoryPathInArchive,
+                                               bool recurseDirectories,
+                                               bool wantUpdate)
+        {
+            if (directoryOnDisk == null && (Directory.Exists(selectionCriteria)))
+            {
+                directoryOnDisk = selectionCriteria;
+                selectionCriteria = "*.*";
+            }
+            else if (String.IsNullOrEmpty(directoryOnDisk))
+            {
+                directoryOnDisk = ".";
+            }
+
+            // workitem 9176
+            while (directoryOnDisk.EndsWith("\\")) directoryOnDisk = directoryOnDisk.Substring(0, directoryOnDisk.Length - 1);
+            if (Verbose) StatusMessageTextWriter.WriteLine("adding selection '{0}' from dir '{1}'...",
+                                                               selectionCriteria, directoryOnDisk);
+            Ionic.FileSelector ff = new Ionic.FileSelector(selectionCriteria,
+                                                           AddDirectoryWillTraverseReparsePoints);
+            var itemsToAdd = ff.SelectFiles(directoryOnDisk, recurseDirectories);
+
+            if (Verbose) StatusMessageTextWriter.WriteLine("found {0} files...", itemsToAdd.Count);
+
+            OnAddStarted();
+
+            AddOrUpdateAction action = (wantUpdate) ? AddOrUpdateAction.AddOrUpdate : AddOrUpdateAction.AddOnly;
+            foreach (var item in itemsToAdd)
+            {
+                // workitem 10153
+                string dirInArchive = (directoryPathInArchive == null)
+                    ? null
+                    // workitem 12260
+                    : ReplaceLeadingDirectory(Path.GetDirectoryName(item),
+                                              directoryOnDisk,
+                                              directoryPathInArchive);
+
+                if (File.Exists(item))
+                {
+                    if (wantUpdate)
+                        this.UpdateFile(item, dirInArchive);
+                    else
+                        this.AddFile(item, dirInArchive);
+                }
+                else
+                {
+                    // this adds "just" the directory, without recursing to the contained files
+                    AddOrUpdateDirectoryImpl(item, dirInArchive, action, false, 0);
+                }
+            }
+
+            OnAddCompleted();
+        }
+
+
+        // workitem 12260
+        private static string ReplaceLeadingDirectory(string original,
+                                                      string pattern,
+                                                      string replacement)
+        {
+            string upperString = original.ToUpper(CultureInfo.InvariantCulture);
+            string upperPattern = pattern.ToUpper(CultureInfo.InvariantCulture);
+            int p1 = upperString.IndexOf(upperPattern);
+            if (p1 != 0) return original;
+            return replacement + original.Substring(upperPattern.Length);
+        }
+
+#if NOT
+        private static string ReplaceEx(string original,
+                                                      string pattern,
+                                                      string replacement)
+        {
+            int count, position0, position1;
+            count = position0 = position1 = 0;
+            string upperString = original.ToUpper();
+            string upperPattern = pattern.ToUpper();
+            int inc = (original.Length/pattern.Length) *
+                (replacement.Length-pattern.Length);
+            char [] chars = new char[original.Length + Math.Max(0, inc)];
+            while( (position1 = upperString.IndexOf(upperPattern,
+                                                    position0)) != -1 )
+            {
+                for ( int i=position0 ; i < position1 ; ++i )
+                    chars[count++] = original[i];
+                for ( int i=0 ; i < replacement.Length ; ++i )
+                    chars[count++] = replacement[i];
+                position0 = position1+pattern.Length;
+            }
+            if ( position0 == 0 ) return original;
+            for ( int i=position0 ; i < original.Length ; ++i )
+                chars[count++] = original[i];
+            return new string(chars, 0, count);
+        }
+#endif
+
+        /// <summary>
+        /// Retrieve entries from the zipfile by specified criteria.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        /// This method allows callers to retrieve the collection of entries from the zipfile
+        /// that fit the specified criteria.  The criteria are described in a string format, and
+        /// can include patterns for the filename; constraints on the size of the entry;
+        /// constraints on the last modified, created, or last accessed time for the file
+        /// described by the entry; or the attributes of the entry.
+        /// </para>
+        ///
+        /// <para>
+        /// For details on the syntax for the selectionCriteria parameter, see <see
+        /// cref="AddSelectedFiles(String)"/>.
+        /// </para>
+        ///
+        /// <para>
+        /// This method is intended for use with a ZipFile that has been read from storage.
+        /// When creating a new ZipFile, this method will work only after the ZipArchive has
+        /// been Saved to the disk (the ZipFile class subsequently and implicitly reads the Zip
+        /// archive from storage.)  Calling SelectEntries on a ZipFile that has not yet been
+        /// saved will deliver undefined results.
+        /// </para>
+        /// </remarks>
+        ///
+        /// <exception cref="System.Exception">
+        /// Thrown if selectionCriteria has an invalid syntax.
+        /// </exception>
+        ///
+        /// <example>
+        /// This example selects all the PhotoShop files from within an archive, and extracts them
+        /// to the current working directory.
+        /// <code>
+        /// using (ZipFile zip1 = ZipFile.Read(ZipFileName))
+        /// {
+        ///     var PhotoShopFiles = zip1.SelectEntries("*.psd");
+        ///     foreach (ZipEntry psd in PhotoShopFiles)
+        ///     {
+        ///         psd.Extract();
+        ///     }
+        /// }
+        /// </code>
+        /// <code lang="VB">
+        /// Using zip1 As ZipFile = ZipFile.Read(ZipFileName)
+        ///     Dim PhotoShopFiles as ICollection(Of ZipEntry)
+        ///     PhotoShopFiles = zip1.SelectEntries("*.psd")
+        ///     Dim psd As ZipEntry
+        ///     For Each psd In PhotoShopFiles
+        ///         psd.Extract
+        ///     Next
+        /// End Using
+        /// </code>
+        /// </example>
+        /// <param name="selectionCriteria">the string that specifies which entries to select</param>
+        /// <returns>a collection of ZipEntry objects that conform to the inclusion spec</returns>
+        public ICollection<ZipEntry> SelectEntries(String selectionCriteria)
+        {
+            Ionic.FileSelector ff = new Ionic.FileSelector(selectionCriteria,
+                                                           AddDirectoryWillTraverseReparsePoints);
+            return ff.SelectEntries(this);
+        }
+
+
+        /// <summary>
+        /// Retrieve entries from the zipfile by specified criteria.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        /// This method allows callers to retrieve the collection of entries from the zipfile
+        /// that fit the specified criteria.  The criteria are described in a string format, and
+        /// can include patterns for the filename; constraints on the size of the entry;
+        /// constraints on the last modified, created, or last accessed time for the file
+        /// described by the entry; or the attributes of the entry.
+        /// </para>
+        ///
+        /// <para>
+        /// For details on the syntax for the selectionCriteria parameter, see <see
+        /// cref="AddSelectedFiles(String)"/>.
+        /// </para>
+        ///
+        /// <para>
+        /// This method is intended for use with a ZipFile that has been read from storage.
+        /// When creating a new ZipFile, this method will work only after the ZipArchive has
+        /// been Saved to the disk (the ZipFile class subsequently and implicitly reads the Zip
+        /// archive from storage.)  Calling SelectEntries on a ZipFile that has not yet been
+        /// saved will deliver undefined results.
+        /// </para>
+        /// </remarks>
+        ///
+        /// <exception cref="System.Exception">
+        /// Thrown if selectionCriteria has an invalid syntax.
+        /// </exception>
+        ///
+        /// <example>
+        /// <code>
+        /// using (ZipFile zip1 = ZipFile.Read(ZipFileName))
+        /// {
+        ///     var UpdatedPhotoShopFiles = zip1.SelectEntries("*.psd", "UpdatedFiles");
+        ///     foreach (ZipEntry e in UpdatedPhotoShopFiles)
+        ///     {
+        ///         // prompt for extract here
+        ///         if (WantExtract(e.FileName))
+        ///             e.Extract();
+        ///     }
+        /// }
+        /// </code>
+        /// <code lang="VB">
+        /// Using zip1 As ZipFile = ZipFile.Read(ZipFileName)
+        ///     Dim UpdatedPhotoShopFiles As ICollection(Of ZipEntry) = zip1.SelectEntries("*.psd", "UpdatedFiles")
+        ///     Dim e As ZipEntry
+        ///     For Each e In UpdatedPhotoShopFiles
+        ///         ' prompt for extract here
+        ///         If Me.WantExtract(e.FileName) Then
+        ///             e.Extract
+        ///         End If
+        ///     Next
+        /// End Using
+        /// </code>
+        /// </example>
+        /// <param name="selectionCriteria">the string that specifies which entries to select</param>
+        ///
+        /// <param name="directoryPathInArchive">
+        /// the directory in the archive from which to select entries. If null, then
+        /// all directories in the archive are used.
+        /// </param>
+        ///
+        /// <returns>a collection of ZipEntry objects that conform to the inclusion spec</returns>
+        public ICollection<ZipEntry> SelectEntries(String selectionCriteria, string directoryPathInArchive)
+        {
+            Ionic.FileSelector ff = new Ionic.FileSelector(selectionCriteria,
+                                                           AddDirectoryWillTraverseReparsePoints);
+            return ff.SelectEntries(this, directoryPathInArchive);
+        }
+
+
+
+        /// <summary>
+        /// Remove entries from the zipfile by specified criteria.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        /// This method allows callers to remove the collection of entries from the zipfile
+        /// that fit the specified criteria.  The criteria are described in a string format, and
+        /// can include patterns for the filename; constraints on the size of the entry;
+        /// constraints on the last modified, created, or last accessed time for the file
+        /// described by the entry; or the attributes of the entry.
+        /// </para>
+        ///
+        /// <para>
+        /// For details on the syntax for the selectionCriteria parameter, see <see
+        /// cref="AddSelectedFiles(String)"/>.
+        /// </para>
+        ///
+        /// <para>
+        /// This method is intended for use with a ZipFile that has been read from storage.
+        /// When creating a new ZipFile, this method will work only after the ZipArchive has
+        /// been Saved to the disk (the ZipFile class subsequently and implicitly reads the Zip
+        /// archive from storage.)  Calling SelectEntries on a ZipFile that has not yet been
+        /// saved will deliver undefined results.
+        /// </para>
+        /// </remarks>
+        ///
+        /// <exception cref="System.Exception">
+        /// Thrown if selectionCriteria has an invalid syntax.
+        /// </exception>
+        ///
+        /// <example>
+        /// This example removes all entries in a zip file that were modified prior to January 1st, 2008.
+        /// <code>
+        /// using (ZipFile zip1 = ZipFile.Read(ZipFileName))
+        /// {
+        ///     // remove all entries from prior to Jan 1, 2008
+        ///     zip1.RemoveEntries("mtime &lt; 2008-01-01");
+        ///     // don't forget to save the archive!
+        ///     zip1.Save();
+        /// }
+        /// </code>
+        /// <code lang="VB">
+        /// Using zip As ZipFile = ZipFile.Read(ZipFileName)
+        ///     ' remove all entries from prior to Jan 1, 2008
+        ///     zip1.RemoveEntries("mtime &lt; 2008-01-01")
+        ///     ' do not forget to save the archive!
+        ///     zip1.Save
+        /// End Using
+        /// </code>
+        /// </example>
+        /// <param name="selectionCriteria">the string that specifies which entries to select</param>
+        /// <returns>the number of entries removed</returns>
+        public int RemoveSelectedEntries(String selectionCriteria)
+        {
+            var selection = this.SelectEntries(selectionCriteria);
+            this.RemoveEntries(selection);
+            return selection.Count;
+        }
+
+
+        /// <summary>
+        /// Remove entries from the zipfile by specified criteria, and within the specified
+        /// path in the archive.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        /// This method allows callers to remove the collection of entries from the zipfile
+        /// that fit the specified criteria.  The criteria are described in a string format, and
+        /// can include patterns for the filename; constraints on the size of the entry;
+        /// constraints on the last modified, created, or last accessed time for the file
+        /// described by the entry; or the attributes of the entry.
+        /// </para>
+        ///
+        /// <para>
+        /// For details on the syntax for the selectionCriteria parameter, see <see
+        /// cref="AddSelectedFiles(String)"/>.
+        /// </para>
+        ///
+        /// <para>
+        /// This method is intended for use with a ZipFile that has been read from storage.
+        /// When creating a new ZipFile, this method will work only after the ZipArchive has
+        /// been Saved to the disk (the ZipFile class subsequently and implicitly reads the Zip
+        /// archive from storage.)  Calling SelectEntries on a ZipFile that has not yet been
+        /// saved will deliver undefined results.
+        /// </para>
+        /// </remarks>
+        ///
+        /// <exception cref="System.Exception">
+        /// Thrown if selectionCriteria has an invalid syntax.
+        /// </exception>
+        ///
+        /// <example>
+        /// <code>
+        /// using (ZipFile zip1 = ZipFile.Read(ZipFileName))
+        /// {
+        ///     // remove all entries from prior to Jan 1, 2008
+        ///     zip1.RemoveEntries("mtime &lt; 2008-01-01", "documents");
+        ///     // a call to ZipFile.Save will make the modifications permanent
+        ///     zip1.Save();
+        /// }
+        /// </code>
+        /// <code lang="VB">
+        /// Using zip As ZipFile = ZipFile.Read(ZipFileName)
+        ///     ' remove all entries from prior to Jan 1, 2008
+        ///     zip1.RemoveEntries("mtime &lt; 2008-01-01", "documents")
+        ///     ' a call to ZipFile.Save will make the modifications permanent
+        ///     zip1.Save
+        /// End Using
+        /// </code>
+        /// </example>
+        ///
+        /// <param name="selectionCriteria">the string that specifies which entries to select</param>
+        /// <param name="directoryPathInArchive">
+        /// the directory in the archive from which to select entries. If null, then
+        /// all directories in the archive are used.
+        /// </param>
+        /// <returns>the number of entries removed</returns>
+        public int RemoveSelectedEntries(String selectionCriteria, string directoryPathInArchive)
+        {
+            var selection = this.SelectEntries(selectionCriteria, directoryPathInArchive);
+            this.RemoveEntries(selection);
+            return selection.Count;
+        }
+
+
+        /// <summary>
+        /// Selects and Extracts a set of Entries from the ZipFile.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        /// The entries are extracted into the current working directory.
+        /// </para>
+        ///
+        /// <para>
+        /// If any of the files to be extracted already exist, then the action taken is as
+        /// specified in the <see cref="ZipEntry.ExtractExistingFile"/> property on the
+        /// corresponding ZipEntry instance.  By default, the action taken in this case is to
+        /// throw an exception.
+        /// </para>
+        ///
+        /// <para>
+        /// For information on the syntax of the selectionCriteria string,
+        /// see <see cref="AddSelectedFiles(String)" />.
+        /// </para>
+        /// </remarks>
+        ///
+        /// <example>
+        /// This example shows how extract all XML files modified after 15 January 2009.
+        /// <code>
+        /// using (ZipFile zip = ZipFile.Read(zipArchiveName))
+        /// {
+        ///   zip.ExtractSelectedEntries("name = *.xml  and  mtime &gt; 2009-01-15");
+        /// }
+        /// </code>
+        /// </example>
+        /// <param name="selectionCriteria">the selection criteria for entries to extract.</param>
+        ///
+        /// <seealso cref="ExtractSelectedEntries(String,ExtractExistingFileAction)"/>
+        public void ExtractSelectedEntries(String selectionCriteria)
+        {
+            foreach (ZipEntry e in SelectEntries(selectionCriteria))
+            {
+                e.Password = _Password; // possibly null
+                e.Extract();
+            }
+        }
+
+
+        /// <summary>
+        /// Selects and Extracts a set of Entries from the ZipFile.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        /// The entries are extracted into the current working directory. When extraction would would
+        /// overwrite an existing filesystem file, the action taken is as specified in the
+        /// <paramref name="extractExistingFile"/> parameter.
+        /// </para>
+        ///
+        /// <para>
+        /// For information on the syntax of the string describing the entry selection criteria,
+        /// see <see cref="AddSelectedFiles(String)" />.
+        /// </para>
+        /// </remarks>
+        ///
+        /// <example>
+        /// This example shows how extract all XML files modified after 15 January 2009,
+        /// overwriting any existing files.
+        /// <code>
+        /// using (ZipFile zip = ZipFile.Read(zipArchiveName))
+        /// {
+        ///   zip.ExtractSelectedEntries("name = *.xml  and  mtime &gt; 2009-01-15",
+        ///                              ExtractExistingFileAction.OverwriteSilently);
+        /// }
+        /// </code>
+        /// </example>
+        ///
+        /// <param name="selectionCriteria">the selection criteria for entries to extract.</param>
+        ///
+        /// <param name="extractExistingFile">
+        /// The action to take if extraction would overwrite an existing file.
+        /// </param>
+        internal void ExtractSelectedEntries(String selectionCriteria, ExtractExistingFileAction extractExistingFile)
+        {
+            foreach (ZipEntry e in SelectEntries(selectionCriteria))
+            {
+                e.Password = _Password; // possibly null
+                e.Extract(extractExistingFile);
+            }
+        }
+
+
+        /// <summary>
+        /// Selects and Extracts a set of Entries from the ZipFile.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        /// The entries are selected from the specified directory within the archive, and then
+        /// extracted into the current working directory.
+        /// </para>
+        ///
+        /// <para>
+        /// If any of the files to be extracted already exist, then the action taken is as
+        /// specified in the <see cref="ZipEntry.ExtractExistingFile"/> property on the
+        /// corresponding ZipEntry instance.  By default, the action taken in this case is to
+        /// throw an exception.
+        /// </para>
+        ///
+        /// <para>
+        /// For information on the syntax of the string describing the entry selection criteria,
+        /// see <see cref="AddSelectedFiles(String)" />.
+        /// </para>
+        /// </remarks>
+        ///
+        /// <example>
+        /// This example shows how extract all XML files modified after 15 January 2009,
+        /// and writes them to the "unpack" directory.
+        /// <code>
+        /// using (ZipFile zip = ZipFile.Read(zipArchiveName))
+        /// {
+        ///   zip.ExtractSelectedEntries("name = *.xml  and  mtime &gt; 2009-01-15","unpack");
+        /// }
+        /// </code>
+        /// </example>
+        ///
+        /// <param name="selectionCriteria">the selection criteria for entries to extract.</param>
+        ///
+        /// <param name="directoryPathInArchive">
+        /// the directory in the archive from which to select entries. If null, then
+        /// all directories in the archive are used.
+        /// </param>
+        ///
+        /// <seealso cref="ExtractSelectedEntries(String,String,String,ExtractExistingFileAction)"/>
+        public void ExtractSelectedEntries(String selectionCriteria, String directoryPathInArchive)
+        {
+            foreach (ZipEntry e in SelectEntries(selectionCriteria, directoryPathInArchive))
+            {
+                e.Password = _Password; // possibly null
+                e.Extract();
+            }
+        }
+
+
+        /// <summary>
+        /// Selects and Extracts a set of Entries from the ZipFile.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        /// The entries are extracted into the specified directory. If any of the files to be
+        /// extracted already exist, an exception will be thrown.
+        /// </para>
+        /// <para>
+        /// For information on the syntax of the string describing the entry selection criteria,
+        /// see <see cref="AddSelectedFiles(String)" />.
+        /// </para>
+        /// </remarks>
+        ///
+        /// <param name="selectionCriteria">the selection criteria for entries to extract.</param>
+        ///
+        /// <param name="directoryInArchive">
+        /// the directory in the archive from which to select entries. If null, then
+        /// all directories in the archive are used.
+        /// </param>
+        ///
+        /// <param name="extractDirectory">
+        /// the directory on the disk into which to extract. It will be created
+        /// if it does not exist.
+        /// </param>
+        public void ExtractSelectedEntries(String selectionCriteria, string directoryInArchive, string extractDirectory)
+        {
+            foreach (ZipEntry e in SelectEntries(selectionCriteria, directoryInArchive))
+            {
+                e.Password = _Password; // possibly null
+                e.Extract(extractDirectory);
+            }
+        }
+
+
+        /// <summary>
+        /// Selects and Extracts a set of Entries from the ZipFile.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        /// The entries are extracted into the specified directory. When extraction would would
+        /// overwrite an existing filesystem file, the action taken is as specified in the
+        /// <paramref name="extractExistingFile"/> parameter.
+        /// </para>
+        ///
+        /// <para>
+        /// For information on the syntax of the string describing the entry selection criteria,
+        /// see <see cref="AddSelectedFiles(String)" />.
+        /// </para>
+        /// </remarks>
+        ///
+        /// <example>
+        /// This example shows how extract all files  with an XML extension or with  a size larger than 100,000 bytes,
+        /// and puts them in the unpack directory.  For any files that already exist in
+        /// that destination directory, they will not be overwritten.
+        /// <code>
+        /// using (ZipFile zip = ZipFile.Read(zipArchiveName))
+        /// {
+        ///   zip.ExtractSelectedEntries("name = *.xml  or  size &gt; 100000",
+        ///                              null,
+        ///                              "unpack",
+        ///                              ExtractExistingFileAction.DontOverwrite);
+        /// }
+        /// </code>
+        /// </example>
+        ///
+        /// <param name="selectionCriteria">the selection criteria for entries to extract.</param>
+        ///
+        /// <param name="extractDirectory">
+        /// The directory on the disk into which to extract. It will be created if it does not exist.
+        /// </param>
+        ///
+        /// <param name="directoryPathInArchive">
+        /// The directory in the archive from which to select entries. If null, then
+        /// all directories in the archive are used.
+        /// </param>
+        ///
+        /// <param name="extractExistingFile">
+        /// The action to take if extraction would overwrite an existing file.
+        /// </param>
+        ///
+        internal void ExtractSelectedEntries(String selectionCriteria, string directoryPathInArchive, string extractDirectory, ExtractExistingFileAction extractExistingFile)
+        {
+            foreach (ZipEntry e in SelectEntries(selectionCriteria, directoryPathInArchive))
+            {
+                e.Password = _Password; // possibly null
+                e.Extract(extractDirectory, extractExistingFile);
+            }
+        }
+
+    }
+
+}
+
+
+
+namespace OfficeOpenXml.Packaging.Ionic
+{
+    internal abstract partial class SelectionCriterion
+    {
+        internal abstract bool Evaluate(ZipEntry entry);
+    }
+
+
+    internal partial class NameCriterion : SelectionCriterion
+    {
+        internal override bool Evaluate(ZipEntry entry)
+        {
+            // swap forward slashes in the entry.FileName for backslashes
+            string transformedFileName = entry.FileName.Replace("/", "\\");
+
+            return _Evaluate(transformedFileName);
+        }
+    }
+
+
+    internal partial class SizeCriterion : SelectionCriterion
+    {
+        internal override bool Evaluate(ZipEntry entry)
+        {
+            return _Evaluate(entry.UncompressedSize);
+        }
+    }
+
+    internal partial class TimeCriterion : SelectionCriterion
+    {
+        internal override bool Evaluate(ZipEntry entry)
+        {
+            DateTime x;
+            switch (Which)
+            {
+                case WhichTime.atime:
+                    x = entry.AccessedTime;
+                    break;
+                case WhichTime.mtime:
+                    x = entry.ModifiedTime;
+                    break;
+                case WhichTime.ctime:
+                    x = entry.CreationTime;
+                    break;
+                default: throw new ArgumentException("??time");
+            }
+            return _Evaluate(x);
+        }
+    }
+
+
+    internal partial class TypeCriterion : SelectionCriterion
+    {
+        internal override bool Evaluate(ZipEntry entry)
+        {
+            bool result = (ObjectType == 'D')
+                ? entry.IsDirectory
+                : !entry.IsDirectory;
+
+            if (Operator != ComparisonOperator.EqualTo)
+                result = !result;
+            return result;
+        }
+    }
+
+#if !SILVERLIGHT
+    internal partial class AttributesCriterion : SelectionCriterion
+    {
+        internal override bool Evaluate(ZipEntry entry)
+        {
+            FileAttributes fileAttrs = entry.Attributes;
+            return _Evaluate(fileAttrs);
+        }
+    }
+#endif
+
+    internal partial class CompoundCriterion : SelectionCriterion
+    {
+        internal override bool Evaluate(ZipEntry entry)
+        {
+            bool result = Left.Evaluate(entry);
+            switch (Conjunction)
+            {
+                case LogicalConjunction.AND:
+                    if (result)
+                        result = Right.Evaluate(entry);
+                    break;
+                case LogicalConjunction.OR:
+                    if (!result)
+                        result = Right.Evaluate(entry);
+                    break;
+                case LogicalConjunction.XOR:
+                    result ^= Right.Evaluate(entry);
+                    break;
+            }
+            return result;
+        }
+    }
+
+
+
+    internal partial class FileSelector
+    {
+        private bool Evaluate(ZipEntry entry)
+        {
+            bool result = _Criterion.Evaluate(entry);
+            return result;
+        }
+
+        /// <summary>
+        /// Retrieve the ZipEntry items in the ZipFile that conform to the specified criteria.
+        /// </summary>
+        /// <remarks>
+        ///
+        /// <para>
+        /// This method applies the criteria set in the FileSelector instance (as described in
+        /// the <see cref="FileSelector.SelectionCriteria"/>) to the specified ZipFile.  Using this
+        /// method, for example, you can retrieve all entries from the given ZipFile that
+        /// have filenames ending in .txt.
+        /// </para>
+        ///
+        /// <para>
+        /// Normally, applications would not call this method directly.  This method is used
+        /// by the ZipFile class.
+        /// </para>
+        ///
+        /// <para>
+        /// Using the appropriate SelectionCriteria, you can retrieve entries based on size,
+        /// time, and attributes. See <see cref="FileSelector.SelectionCriteria"/> for a
+        /// description of the syntax of the SelectionCriteria string.
+        /// </para>
+        ///
+        /// </remarks>
+        ///
+        /// <param name="zip">The ZipFile from which to retrieve entries.</param>
+        ///
+        /// <returns>a collection of ZipEntry objects that conform to the criteria.</returns>
+        public ICollection<ZipEntry> SelectEntries(ZipFile zip)
+        {
+            if (zip == null)
+                throw new ArgumentNullException("zip");
+
+            var list = new List<ZipEntry>();
+
+            foreach (ZipEntry e in zip)
+            {
+                if (this.Evaluate(e))
+                    list.Add(e);
+            }
+
+            return list;
+        }
+
+
+        /// <summary>
+        /// Retrieve the ZipEntry items in the ZipFile that conform to the specified criteria.
+        /// </summary>
+        /// <remarks>
+        ///
+        /// <para>
+        /// This method applies the criteria set in the FileSelector instance (as described in
+        /// the <see cref="FileSelector.SelectionCriteria"/>) to the specified ZipFile.  Using this
+        /// method, for example, you can retrieve all entries from the given ZipFile that
+        /// have filenames ending in .txt.
+        /// </para>
+        ///
+        /// <para>
+        /// Normally, applications would not call this method directly.  This method is used
+        /// by the ZipFile class.
+        /// </para>
+        ///
+        /// <para>
+        /// This overload allows the selection of ZipEntry instances from the ZipFile to be restricted
+        /// to entries contained within a particular directory in the ZipFile.
+        /// </para>
+        ///
+        /// <para>
+        /// Using the appropriate SelectionCriteria, you can retrieve entries based on size,
+        /// time, and attributes. See <see cref="FileSelector.SelectionCriteria"/> for a
+        /// description of the syntax of the SelectionCriteria string.
+        /// </para>
+        ///
+        /// </remarks>
+        ///
+        /// <param name="zip">The ZipFile from which to retrieve entries.</param>
+        ///
+        /// <param name="directoryPathInArchive">
+        /// the directory in the archive from which to select entries. If null, then
+        /// all directories in the archive are used.
+        /// </param>
+        ///
+        /// <returns>a collection of ZipEntry objects that conform to the criteria.</returns>
+        public ICollection<ZipEntry> SelectEntries(ZipFile zip, string directoryPathInArchive)
+        {
+            if (zip == null)
+                throw new ArgumentNullException("zip");
+
+            var list = new List<ZipEntry>();
+            // workitem 8559
+            string slashSwapped = (directoryPathInArchive == null) ? null : directoryPathInArchive.Replace("/", "\\");
+            // workitem 9174
+            if (slashSwapped != null)
+            {
+                while (slashSwapped.EndsWith("\\"))
+                    slashSwapped = slashSwapped.Substring(0, slashSwapped.Length - 1);
+            }
+            foreach (ZipEntry e in zip)
+            {
+                if (directoryPathInArchive == null || (Path.GetDirectoryName(e.FileName) == directoryPathInArchive)
+                    || (Path.GetDirectoryName(e.FileName) == slashSwapped)) // workitem 8559
+                    if (this.Evaluate(e))
+                        list.Add(e);
+            }
+
+            return list;
+        }
+
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ZipFile.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ZipFile.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ZipFile.cs	(revision 12707)
@@ -0,0 +1,3909 @@
+// ZipFile.cs
+//
+// Copyright (c) 2006-2010 Dino Chiesa
+// All rights reserved.
+//
+// This module is part of DotNetZip, a zipfile class library.
+// The class library reads and writes zip files, according to the format
+// described by PKware, at:
+// http://www.pkware.com/business_and_developers/developer/popups/appnote.txt
+//
+//
+// There are other Zip class libraries available.
+//
+// - it is possible to read and write zip files within .NET via the J# runtime.
+//   But some people don't like to install the extra DLL, which is no longer
+//   supported by MS. And also, the J# libraries don't support advanced zip
+//   features, like ZIP64, spanned archives, or AES encryption.
+//
+// - There are third-party GPL and LGPL libraries available. Some people don't
+//   like the license, and some of them don't support all the ZIP features, like AES.
+//
+// - Finally, there are commercial tools (From ComponentOne, XCeed, etc).  But
+//   some people don't want to incur the cost.
+//
+// This alternative implementation is **not** GPL licensed. It is free of cost, and
+// does not require J#. It does require .NET 2.0.  It balances a good set of
+// features, with ease of use and speed of performance.
+//
+// This code is released under the Microsoft Public License .
+// See the License.txt for details.
+//
+//
+// NB: This implementation originally relied on the
+// System.IO.Compression.DeflateStream base class in the .NET Framework
+// v2.0 base class library, but now includes a managed-code port of Zlib.
+//
+// Thu, 08 Oct 2009  17:04
+//
+
+
+using System;
+using System.IO;
+using System.Collections.Generic;
+using Interop = System.Runtime.InteropServices;
+using OfficeOpenXml.Packaging.Ionic.Zlib;
+namespace OfficeOpenXml.Packaging.Ionic.Zip
+{
+    /// <summary>
+    ///   The ZipFile type represents a zip archive file.
+    /// </summary>
+    ///
+    /// <remarks>
+    /// <para>
+    ///   This is the main type in the DotNetZip class library. This class reads and
+    ///   writes zip files, as defined in the <see
+    ///   href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT">specification
+    ///   for zip files described by PKWare</see>.  The compression for this
+    ///   implementation is provided by a managed-code version of Zlib, included with
+    ///   DotNetZip in the classes in the Ionic.Zlib namespace.
+    /// </para>
+    ///
+    /// <para>
+    ///   This class provides a general purpose zip file capability.  Use it to read,
+    ///   create, or update zip files.  When you want to create zip files using a
+    ///   <c>Stream</c> type to write the zip file, you may want to consider the <see
+    ///   cref="ZipOutputStream"/> class.
+    /// </para>
+    ///
+    /// <para>
+    ///   Both the <c>ZipOutputStream</c> class and the <c>ZipFile</c> class can
+    ///   be used to create zip files. Both of them support many of the common zip
+    ///   features, including Unicode, different compression methods and levels,
+    ///   and ZIP64. They provide very similar performance when creating zip
+    ///   files.
+    /// </para>
+    ///
+    /// <para>
+    ///   The <c>ZipFile</c> class is generally easier to use than
+    ///   <c>ZipOutputStream</c> and should be considered a higher-level interface.  For
+    ///   example, when creating a zip file via calls to the <c>PutNextEntry()</c> and
+    ///   <c>Write()</c> methods on the <c>ZipOutputStream</c> class, the caller is
+    ///   responsible for opening the file, reading the bytes from the file, writing
+    ///   those bytes into the <c>ZipOutputStream</c>, setting the attributes on the
+    ///   <c>ZipEntry</c>, and setting the created, last modified, and last accessed
+    ///   timestamps on the zip entry. All of these things are done automatically by a
+    ///   call to <see cref="ZipFile.AddFile(string,string)">ZipFile.AddFile()</see>.
+    ///   For this reason, the <c>ZipOutputStream</c> is generally recommended for use
+    ///   only when your application emits arbitrary data, not necessarily data from a
+    ///   filesystem file, directly into a zip file, and does so using a <c>Stream</c>
+    ///   metaphor.
+    /// </para>
+    ///
+    /// <para>
+    ///   Aside from the differences in programming model, there are other
+    ///   differences in capability between the two classes.
+    /// </para>
+    ///
+    /// <list type="bullet">
+    ///   <item>
+    ///     <c>ZipFile</c> can be used to read and extract zip files, in addition to
+    ///     creating zip files. <c>ZipOutputStream</c> cannot read zip files. If you want
+    ///     to use a stream to read zip files, check out the ZipInputStream class.
+    ///   </item>
+    ///
+    ///   <item>
+    ///     <c>ZipOutputStream</c> does not support the creation of segmented or spanned
+    ///     zip files.
+    ///   </item>
+    ///
+    ///   <item>
+    ///     <c>ZipOutputStream</c> cannot produce a self-extracting archive.
+    ///   </item>
+    /// </list>
+    ///
+    /// <para>
+    ///   Be aware that the <c>ZipFile</c> class implements the <see
+    ///   cref="System.IDisposable"/> interface.  In order for <c>ZipFile</c> to
+    ///   produce a valid zip file, you use use it within a using clause (<c>Using</c>
+    ///   in VB), or call the <c>Dispose()</c> method explicitly.  See the examples
+    ///   for how to employ a using clause.
+    /// </para>
+    ///
+    /// </remarks>
+    [Interop.GuidAttribute("ebc25cf6-9120-4283-b972-0e5520d00005")]
+    [Interop.ComVisible(true)]
+#if !NETCF
+    [Interop.ClassInterface(Interop.ClassInterfaceType.AutoDispatch)]
+#endif
+    internal partial class ZipFile :
+    System.Collections.IEnumerable,
+    System.Collections.Generic.IEnumerable<ZipEntry>,
+    IDisposable
+    {
+
+        #region public properties
+
+        /// <summary>
+        /// Indicates whether to perform a full scan of the zip file when reading it.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///
+        /// <para>
+        ///   You almost never want to use this property.
+        /// </para>
+        ///
+        /// <para>
+        ///   When reading a zip file, if this flag is <c>true</c> (<c>True</c> in
+        ///   VB), the entire zip archive will be scanned and searched for entries.
+        ///   For large archives, this can take a very, long time. The much more
+        ///   efficient default behavior is to read the zip directory, which is
+        ///   stored at the end of the zip file. But, in some cases the directory is
+        ///   corrupted and you need to perform a full scan of the zip file to
+        ///   determine the contents of the zip file. This property lets you do
+        ///   that, when necessary.
+        /// </para>
+        ///
+        /// <para>
+        ///   This flag is effective only when calling <see
+        ///   cref="Initialize(string)"/>. Normally you would read a ZipFile with the
+        ///   static <see cref="ZipFile.Read(String)">ZipFile.Read</see>
+        ///   method. But you can't set the <c>FullScan</c> property on the
+        ///   <c>ZipFile</c> instance when you use a static factory method like
+        ///   <c>ZipFile.Read</c>.
+        /// </para>
+        ///
+        /// </remarks>
+        ///
+        /// <example>
+        ///
+        ///   This example shows how to read a zip file using the full scan approach,
+        ///   and then save it, thereby producing a corrected zip file.
+        ///
+        /// <code lang="C#">
+        /// using (var zip = new ZipFile())
+        /// {
+        ///     zip.FullScan = true;
+        ///     zip.Initialize(zipFileName);
+        ///     zip.Save(newName);
+        /// }
+        /// </code>
+        ///
+        /// <code lang="VB">
+        /// Using zip As New ZipFile
+        ///     zip.FullScan = True
+        ///     zip.Initialize(zipFileName)
+        ///     zip.Save(newName)
+        /// End Using
+        /// </code>
+        /// </example>
+        ///
+        public bool FullScan
+        {
+            get;
+            set;
+        }
+
+
+        /// <summary>
+        ///   Whether to sort the ZipEntries before saving the file.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///   The default is false.  If you have a large number of zip entries, the sort
+        ///   alone can consume significant time.
+        /// </remarks>
+        ///
+        /// <example>
+        /// <code lang="C#">
+        /// using (var zip = new ZipFile())
+        /// {
+        ///     zip.AddFiles(filesToAdd);
+        ///     zip.SortEntriesBeforeSaving = true;
+        ///     zip.Save(name);
+        /// }
+        /// </code>
+        ///
+        /// <code lang="VB">
+        /// Using zip As New ZipFile
+        ///     zip.AddFiles(filesToAdd)
+        ///     zip.SortEntriesBeforeSaving = True
+        ///     zip.Save(name)
+        /// End Using
+        /// </code>
+        /// </example>
+        ///
+        public bool SortEntriesBeforeSaving
+        {
+            get;
+            set;
+        }
+
+
+
+        /// <summary>
+        ///   Indicates whether NTFS Reparse Points, like junctions, should be
+        ///   traversed during calls to <c>AddDirectory()</c>.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///   By default, calls to AddDirectory() will traverse NTFS reparse
+        ///   points, like mounted volumes, and directory junctions.  An example
+        ///   of a junction is the "My Music" directory in Windows Vista.  In some
+        ///   cases you may not want DotNetZip to traverse those directories.  In
+        ///   that case, set this property to false.
+        /// </remarks>
+        ///
+        /// <example>
+        /// <code lang="C#">
+        /// using (var zip = new ZipFile())
+        /// {
+        ///     zip.AddDirectoryWillTraverseReparsePoints = false;
+        ///     zip.AddDirectory(dirToZip,"fodder");
+        ///     zip.Save(zipFileToCreate);
+        /// }
+        /// </code>
+        /// </example>
+        public bool AddDirectoryWillTraverseReparsePoints { get; set; }
+
+
+        /// <summary>
+        ///   Size of the IO buffer used while saving.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///
+        /// <para>
+        ///   First, let me say that you really don't need to bother with this.  It is
+        ///   here to allow for optimizations that you probably won't make! It will work
+        ///   fine if you don't set or get this property at all. Ok?
+        /// </para>
+        ///
+        /// <para>
+        ///   Now that we have <em>that</em> out of the way, the fine print: This
+        ///   property affects the size of the buffer that is used for I/O for each
+        ///   entry contained in the zip file. When a file is read in to be compressed,
+        ///   it uses a buffer given by the size here.  When you update a zip file, the
+        ///   data for unmodified entries is copied from the first zip file to the
+        ///   other, through a buffer given by the size here.
+        /// </para>
+        ///
+        /// <para>
+        ///   Changing the buffer size affects a few things: first, for larger buffer
+        ///   sizes, the memory used by the <c>ZipFile</c>, obviously, will be larger
+        ///   during I/O operations.  This may make operations faster for very much
+        ///   larger files.  Last, for any given entry, when you use a larger buffer
+        ///   there will be fewer progress events during I/O operations, because there's
+        ///   one progress event generated for each time the buffer is filled and then
+        ///   emptied.
+        /// </para>
+        ///
+        /// <para>
+        ///   The default buffer size is 8k.  Increasing the buffer size may speed
+        ///   things up as you compress larger files.  But there are no hard-and-fast
+        ///   rules here, eh?  You won't know til you test it.  And there will be a
+        ///   limit where ever larger buffers actually slow things down.  So as I said
+        ///   in the beginning, it's probably best if you don't set or get this property
+        ///   at all.
+        /// </para>
+        ///
+        /// </remarks>
+        ///
+        /// <example>
+        /// This example shows how you might set a large buffer size for efficiency when
+        /// dealing with zip entries that are larger than 1gb.
+        /// <code lang="C#">
+        /// using (ZipFile zip = new ZipFile())
+        /// {
+        ///     zip.SaveProgress += this.zip1_SaveProgress;
+        ///     zip.AddDirectory(directoryToZip, "");
+        ///     zip.UseZip64WhenSaving = Zip64Option.Always;
+        ///     zip.BufferSize = 65536*8; // 65536 * 8 = 512k
+        ///     zip.Save(ZipFileToCreate);
+        /// }
+        /// </code>
+        /// </example>
+
+        public int BufferSize
+        {
+            get { return _BufferSize; }
+            set { _BufferSize = value; }
+        }
+
+        /// <summary>
+        ///   Size of the work buffer to use for the ZLIB codec during compression.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///   <para>
+        ///     When doing ZLIB or Deflate compression, the library fills a buffer,
+        ///     then passes it to the compressor for compression. Then the library
+        ///     reads out the compressed bytes. This happens repeatedly until there
+        ///     is no more uncompressed data to compress. This property sets the
+        ///     size of the buffer that will be used for chunk-wise compression. In
+        ///     order for the setting to take effect, your application needs to set
+        ///     this property before calling one of the <c>ZipFile.Save()</c>
+        ///     overloads.
+        ///   </para>
+        ///   <para>
+        ///     Setting this affects the performance and memory efficiency of
+        ///     compression and decompression. For larger files, setting this to a
+        ///     larger size may improve compression performance, but the exact
+        ///     numbers vary depending on available memory, the size of the streams
+        ///     you are compressing, and a bunch of other variables. I don't have
+        ///     good firm recommendations on how to set it.  You'll have to test it
+        ///     yourself. Or just leave it alone and accept the default.
+        ///   </para>
+        /// </remarks>
+        public int CodecBufferSize
+        {
+            get;
+            set;
+        }
+
+        /// <summary>
+        ///   Indicates whether extracted files should keep their paths as
+        ///   stored in the zip archive.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///  <para>
+        ///    This property affects Extraction.  It is not used when creating zip
+        ///    archives.
+        ///  </para>
+        ///
+        ///  <para>
+        ///    With this property set to <c>false</c>, the default, extracting entries
+        ///    from a zip file will create files in the filesystem that have the full
+        ///    path associated to the entry within the zip file.  With this property set
+        ///    to <c>true</c>, extracting entries from the zip file results in files
+        ///    with no path: the folders are "flattened."
+        ///  </para>
+        ///
+        ///  <para>
+        ///    An example: suppose the zip file contains entries /directory1/file1.txt and
+        ///    /directory2/file2.txt.  With <c>FlattenFoldersOnExtract</c> set to false,
+        ///    the files created will be \directory1\file1.txt and \directory2\file2.txt.
+        ///    With the property set to true, the files created are file1.txt and file2.txt.
+        ///  </para>
+        ///
+        /// </remarks>
+        public bool FlattenFoldersOnExtract
+        {
+            get;
+            set;
+        }
+
+
+        /// <summary>
+        ///   The compression strategy to use for all entries.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///   Set the Strategy used by the ZLIB-compatible compressor, when
+        ///   compressing entries using the DEFLATE method. Different compression
+        ///   strategies work better on different sorts of data. The strategy
+        ///   parameter can affect the compression ratio and the speed of
+        ///   compression but not the correctness of the compresssion.  For more
+        ///   information see <see
+        ///   cref="Ionic.Zlib.CompressionStrategy">Ionic.Zlib.CompressionStrategy</see>.
+        /// </remarks>
+        public CompressionStrategy Strategy
+        {
+            get { return _Strategy; }
+            set { _Strategy = value; }
+        }
+
+
+        /// <summary>
+        ///   The name of the <c>ZipFile</c>, on disk.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///
+        /// <para>
+        ///   When the <c>ZipFile</c> instance was created by reading an archive using
+        ///   one of the <c>ZipFile.Read</c> methods, this property represents the name
+        ///   of the zip file that was read.  When the <c>ZipFile</c> instance was
+        ///   created by using the no-argument constructor, this value is <c>null</c>
+        ///   (<c>Nothing</c> in VB).
+        /// </para>
+        ///
+        /// <para>
+        ///   If you use the no-argument constructor, and you then explicitly set this
+        ///   property, when you call <see cref="ZipFile.Save()"/>, this name will
+        ///   specify the name of the zip file created.  Doing so is equivalent to
+        ///   calling <see cref="ZipFile.Save(String)"/>.  When instantiating a
+        ///   <c>ZipFile</c> by reading from a stream or byte array, the <c>Name</c>
+        ///   property remains <c>null</c>.  When saving to a stream, the <c>Name</c>
+        ///   property is implicitly set to <c>null</c>.
+        /// </para>
+        /// </remarks>
+        public string Name
+        {
+            get { return _name; }
+            set { _name = value; }
+        }
+
+
+        /// <summary>
+        ///   Sets the compression level to be used for entries subsequently added to
+        ///   the zip archive.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///  <para>
+        ///    Varying the compression level used on entries can affect the
+        ///    size-vs-speed tradeoff when compression and decompressing data streams
+        ///    or files.
+        ///  </para>
+        ///
+        ///  <para>
+        ///    As with some other properties on the <c>ZipFile</c> class, like <see
+        ///    cref="Password"/>, <see cref="Encryption"/>, and <see
+        ///    cref="ZipErrorAction"/>, setting this property on a <c>ZipFile</c>
+        ///    instance will cause the specified <c>CompressionLevel</c> to be used on all
+        ///    <see cref="ZipEntry"/> items that are subsequently added to the
+        ///    <c>ZipFile</c> instance. If you set this property after you have added
+        ///    items to the <c>ZipFile</c>, but before you have called <c>Save()</c>,
+        ///    those items will not use the specified compression level.
+        ///  </para>
+        ///
+        ///  <para>
+        ///    If you do not set this property, the default compression level is used,
+        ///    which normally gives a good balance of compression efficiency and
+        ///    compression speed.  In some tests, using <c>BestCompression</c> can
+        ///    double the time it takes to compress, while delivering just a small
+        ///    increase in compression efficiency.  This behavior will vary with the
+        ///    type of data you compress.  If you are in doubt, just leave this setting
+        ///    alone, and accept the default.
+        ///  </para>
+        /// </remarks>
+        public OfficeOpenXml.Packaging.Ionic.Zlib.CompressionLevel CompressionLevel
+        {
+            get;
+            set;
+        }
+
+        /// <summary>
+        ///   The compression method for the zipfile.
+        /// </summary>
+        /// <remarks>
+        ///   <para>
+        ///     By default, the compression method is <c>CompressionMethod.Deflate.</c>
+        ///   </para>
+        /// </remarks>
+        /// <seealso cref="Ionic.Zip.CompressionMethod" />
+        internal Ionic.Zip.CompressionMethod CompressionMethod
+        {
+            get
+            {
+                return _compressionMethod;
+            }
+            set
+            {
+                _compressionMethod = value;
+            }
+        }
+
+
+
+        /// <summary>
+        ///   A comment attached to the zip archive.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///
+        /// <para>
+        ///   This property is read/write. It allows the application to specify a
+        ///   comment for the <c>ZipFile</c>, or read the comment for the
+        ///   <c>ZipFile</c>.  After setting this property, changes are only made
+        ///   permanent when you call a <c>Save()</c> method.
+        /// </para>
+        ///
+        /// <para>
+        ///   According to <see
+        ///   href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT">PKWARE's
+        ///   zip specification</see>, the comment is not encrypted, even if there is a
+        ///   password set on the zip file.
+        /// </para>
+        ///
+        /// <para>
+        ///   The specification does not describe how to indicate the encoding used
+        ///   on a comment string. Many "compliant" zip tools and libraries use
+        ///   IBM437 as the code page for comments; DotNetZip, too, follows that
+        ///   practice.  On the other hand, there are situations where you want a
+        ///   Comment to be encoded with something else, for example using code page
+        ///   950 "Big-5 Chinese". To fill that need, DotNetZip will encode the
+        ///   comment following the same procedure it follows for encoding
+        ///   filenames: (a) if <see cref="AlternateEncodingUsage"/> is
+        ///   <c>Never</c>, it uses the default encoding (IBM437). (b) if <see
+        ///   cref="AlternateEncodingUsage"/> is <c>Always</c>, it always uses the
+        ///   alternate encoding (<see cref="AlternateEncoding"/>). (c) if <see
+        ///   cref="AlternateEncodingUsage"/> is <c>AsNecessary</c>, it uses the
+        ///   alternate encoding only if the default encoding is not sufficient for
+        ///   encoding the comment - in other words if decoding the result does not
+        ///   produce the original string.  This decision is taken at the time of
+        ///   the call to <c>ZipFile.Save()</c>.
+        /// </para>
+        ///
+        /// <para>
+        ///   When creating a zip archive using this library, it is possible to change
+        ///   the value of <see cref="AlternateEncoding" /> between each
+        ///   entry you add, and between adding entries and the call to
+        ///   <c>Save()</c>. Don't do this.  It will likely result in a zip file that is
+        ///   not readable by any tool or application.  For best interoperability, leave
+        ///   <see cref="AlternateEncoding"/> alone, or specify it only
+        ///   once, before adding any entries to the <c>ZipFile</c> instance.
+        /// </para>
+        ///
+        /// </remarks>
+        public string Comment
+        {
+            get { return _Comment; }
+            set
+            {
+                _Comment = value;
+                _contentsChanged = true;
+            }
+        }
+
+
+
+
+        /// <summary>
+        ///   Specifies whether the Creation, Access, and Modified times for entries
+        ///   added to the zip file will be emitted in &#147;Windows format&#148;
+        ///   when the zip archive is saved.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   An application creating a zip archive can use this flag to explicitly
+        ///   specify that the file times for the entries should or should not be stored
+        ///   in the zip archive in the format used by Windows. By default this flag is
+        ///   <c>true</c>, meaning the Windows-format times are stored in the zip
+        ///   archive.
+        /// </para>
+        ///
+        /// <para>
+        ///   When adding an entry from a file or directory, the Creation (<see
+        ///   cref="ZipEntry.CreationTime"/>), Access (<see
+        ///   cref="ZipEntry.AccessedTime"/>), and Modified (<see
+        ///   cref="ZipEntry.ModifiedTime"/>) times for the given entry are
+        ///   automatically set from the filesystem values. When adding an entry from a
+        ///   stream or string, all three values are implicitly set to
+        ///   <c>DateTime.Now</c>.  Applications can also explicitly set those times by
+        ///   calling <see cref="ZipEntry.SetEntryTimes(DateTime, DateTime,
+        ///   DateTime)"/>.
+        /// </para>
+        ///
+        /// <para>
+        ///   <see
+        ///   href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT">PKWARE's
+        ///   zip specification</see> describes multiple ways to format these times in a
+        ///   zip file. One is the format Windows applications normally use: 100ns ticks
+        ///   since January 1, 1601 UTC.  The other is a format Unix applications typically
+        ///   use: seconds since January 1, 1970 UTC.  Each format can be stored in an
+        ///   "extra field" in the zip entry when saving the zip archive. The former
+        ///   uses an extra field with a Header Id of 0x000A, while the latter uses a
+        ///   header ID of 0x5455, although you probably don't need to know that.
+        /// </para>
+        ///
+        /// <para>
+        ///   Not all tools and libraries can interpret these fields.  Windows
+        ///   compressed folders is one that can read the Windows Format timestamps,
+        ///   while I believe <see href="http://www.info-zip.org/">the Infozip
+        ///   tools</see> can read the Unix format timestamps. Some tools and libraries
+        ///   may be able to read only one or the other. DotNetZip can read or write
+        ///   times in either or both formats.
+        /// </para>
+        ///
+        /// <para>
+        ///   The times stored are taken from <see cref="ZipEntry.ModifiedTime"/>, <see
+        ///   cref="ZipEntry.AccessedTime"/>, and <see cref="ZipEntry.CreationTime"/>.
+        /// </para>
+        ///
+        /// <para>
+        ///   The value set here applies to all entries subsequently added to the
+        ///   <c>ZipFile</c>.
+        /// </para>
+        ///
+        /// <para>
+        ///   This property is not mutually exclusive of the <see
+        ///   cref="EmitTimesInUnixFormatWhenSaving" /> property. It is possible and
+        ///   legal and valid to produce a zip file that contains timestamps encoded in
+        ///   the Unix format as well as in the Windows format, in addition to the <see
+        ///   cref="ZipEntry.LastModified">LastModified</see> time attached to each
+        ///   entry in the archive, a time that is always stored in "DOS format". And,
+        ///   notwithstanding the names PKWare uses for these time formats, any of them
+        ///   can be read and written by any computer, on any operating system.  But,
+        ///   there are no guarantees that a program running on Mac or Linux will
+        ///   gracefully handle a zip file with "Windows" formatted times, or that an
+        ///   application that does not use DotNetZip but runs on Windows will be able to
+        ///   handle file times in Unix format.
+        /// </para>
+        ///
+        /// <para>
+        ///   When in doubt, test.  Sorry, I haven't got a complete list of tools and
+        ///   which sort of timestamps they can use and will tolerate.  If you get any
+        ///   good information and would like to pass it on, please do so and I will
+        ///   include that information in this documentation.
+        /// </para>
+        /// </remarks>
+        ///
+        /// <example>
+        ///   This example shows how to save a zip file that contains file timestamps
+        ///   in a format normally used by Unix.
+        /// <code lang="C#">
+        /// using (var zip = new ZipFile())
+        /// {
+        ///     // produce a zip file the Mac will like
+        ///     zip.EmitTimesInWindowsFormatWhenSaving = false;
+        ///     zip.EmitTimesInUnixFormatWhenSaving = true;
+        ///     zip.AddDirectory(directoryToZip, "files");
+        ///     zip.Save(outputFile);
+        /// }
+        /// </code>
+        ///
+        /// <code lang="VB">
+        /// Using zip As New ZipFile
+        ///     '' produce a zip file the Mac will like
+        ///     zip.EmitTimesInWindowsFormatWhenSaving = False
+        ///     zip.EmitTimesInUnixFormatWhenSaving = True
+        ///     zip.AddDirectory(directoryToZip, "files")
+        ///     zip.Save(outputFile)
+        /// End Using
+        /// </code>
+        /// </example>
+        ///
+        /// <seealso cref="ZipEntry.EmitTimesInWindowsFormatWhenSaving" />
+        /// <seealso cref="EmitTimesInUnixFormatWhenSaving" />
+        public bool EmitTimesInWindowsFormatWhenSaving
+        {
+            get
+            {
+                return _emitNtfsTimes;
+            }
+            set
+            {
+                _emitNtfsTimes = value;
+            }
+        }
+
+
+        /// <summary>
+        /// Specifies whether the Creation, Access, and Modified times
+        /// for entries added to the zip file will be emitted in "Unix(tm)
+        /// format" when the zip archive is saved.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   An application creating a zip archive can use this flag to explicitly
+        ///   specify that the file times for the entries should or should not be stored
+        ///   in the zip archive in the format used by Unix. By default this flag is
+        ///   <c>false</c>, meaning the Unix-format times are not stored in the zip
+        ///   archive.
+        /// </para>
+        ///
+        /// <para>
+        ///   When adding an entry from a file or directory, the Creation (<see
+        ///   cref="ZipEntry.CreationTime"/>), Access (<see
+        ///   cref="ZipEntry.AccessedTime"/>), and Modified (<see
+        ///   cref="ZipEntry.ModifiedTime"/>) times for the given entry are
+        ///   automatically set from the filesystem values. When adding an entry from a
+        ///   stream or string, all three values are implicitly set to DateTime.Now.
+        ///   Applications can also explicitly set those times by calling <see
+        ///   cref="ZipEntry.SetEntryTimes(DateTime, DateTime, DateTime)"/>.
+        /// </para>
+        ///
+        /// <para>
+        ///   <see
+        ///   href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT">PKWARE's
+        ///   zip specification</see> describes multiple ways to format these times in a
+        ///   zip file. One is the format Windows applications normally use: 100ns ticks
+        ///   since January 1, 1601 UTC.  The other is a format Unix applications
+        ///   typically use: seconds since January 1, 1970 UTC.  Each format can be
+        ///   stored in an "extra field" in the zip entry when saving the zip
+        ///   archive. The former uses an extra field with a Header Id of 0x000A, while
+        ///   the latter uses a header ID of 0x5455, although you probably don't need to
+        ///   know that.
+        /// </para>
+        ///
+        /// <para>
+        ///   Not all tools and libraries can interpret these fields.  Windows
+        ///   compressed folders is one that can read the Windows Format timestamps,
+        ///   while I believe the <see href="http://www.info-zip.org/">Infozip</see>
+        ///   tools can read the Unix format timestamps. Some tools and libraries may be
+        ///   able to read only one or the other.  DotNetZip can read or write times in
+        ///   either or both formats.
+        /// </para>
+        ///
+        /// <para>
+        ///   The times stored are taken from <see cref="ZipEntry.ModifiedTime"/>, <see
+        ///   cref="ZipEntry.AccessedTime"/>, and <see cref="ZipEntry.CreationTime"/>.
+        /// </para>
+        ///
+        /// <para>
+        ///   This property is not mutually exclusive of the <see
+        ///   cref="EmitTimesInWindowsFormatWhenSaving" /> property. It is possible and
+        ///   legal and valid to produce a zip file that contains timestamps encoded in
+        ///   the Unix format as well as in the Windows format, in addition to the <see
+        ///   cref="ZipEntry.LastModified">LastModified</see> time attached to each
+        ///   entry in the zip archive, a time that is always stored in "DOS
+        ///   format". And, notwithstanding the names PKWare uses for these time
+        ///   formats, any of them can be read and written by any computer, on any
+        ///   operating system.  But, there are no guarantees that a program running on
+        ///   Mac or Linux will gracefully handle a zip file with "Windows" formatted
+        ///   times, or that an application that does not use DotNetZip but runs on
+        ///   Windows will be able to handle file times in Unix format.
+        /// </para>
+        ///
+        /// <para>
+        ///   When in doubt, test.  Sorry, I haven't got a complete list of tools and
+        ///   which sort of timestamps they can use and will tolerate.  If you get any
+        ///   good information and would like to pass it on, please do so and I will
+        ///   include that information in this documentation.
+        /// </para>
+        /// </remarks>
+        ///
+        /// <seealso cref="ZipEntry.EmitTimesInUnixFormatWhenSaving" />
+        /// <seealso cref="EmitTimesInWindowsFormatWhenSaving" />
+        public bool EmitTimesInUnixFormatWhenSaving
+        {
+            get
+            {
+                return _emitUnixTimes;
+            }
+            set
+            {
+                _emitUnixTimes = value;
+            }
+        }
+
+
+
+        /// <summary>
+        ///   Indicates whether verbose output is sent to the <see
+        ///   cref="StatusMessageTextWriter"/> during <c>AddXxx()</c> and
+        ///   <c>ReadXxx()</c> operations.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///   This is a <em>synthetic</em> property.  It returns true if the <see
+        ///   cref="StatusMessageTextWriter"/> is non-null.
+        /// </remarks>
+        internal bool Verbose
+        {
+            get { return (_StatusMessageTextWriter != null); }
+        }
+
+
+        /// <summary>
+        ///   Returns true if an entry by the given name exists in the ZipFile.
+        /// </summary>
+        ///
+        /// <param name='name'>the name of the entry to find</param>
+        /// <returns>true if an entry with the given name exists; otherwise false.
+        /// </returns>
+        public bool ContainsEntry(string name)
+        {
+            // workitem 12534
+            return _entries.ContainsKey(SharedUtilities.NormalizePathForUseInZipFile(name));
+        }
+
+
+
+        /// <summary>
+        ///   Indicates whether to perform case-sensitive matching on the filename when
+        ///   retrieving entries in the zipfile via the string-based indexer.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///   The default value is <c>false</c>, which means don't do case-sensitive
+        ///   matching. In other words, retrieving zip["ReadMe.Txt"] is the same as
+        ///   zip["readme.txt"].  It really makes sense to set this to <c>true</c> only
+        ///   if you are not running on Windows, which has case-insensitive
+        ///   filenames. But since this library is not built for non-Windows platforms,
+        ///   in most cases you should just leave this property alone.
+        /// </remarks>
+        public bool CaseSensitiveRetrieval
+        {
+            get
+            {
+                return _CaseSensitiveRetrieval;
+            }
+
+            set
+            {
+                // workitem 9868
+                if (value != _CaseSensitiveRetrieval)
+                {
+                    _CaseSensitiveRetrieval = value;
+                    _initEntriesDictionary();
+                }
+            }
+        }
+
+
+        /// <summary>
+        ///   Indicates whether to encode entry filenames and entry comments using Unicode
+        ///   (UTF-8).
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   <see href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT">The
+        ///   PKWare zip specification</see> provides for encoding file names and file
+        ///   comments in either the IBM437 code page, or in UTF-8.  This flag selects
+        ///   the encoding according to that specification.  By default, this flag is
+        ///   false, and filenames and comments are encoded into the zip file in the
+        ///   IBM437 codepage.  Setting this flag to true will specify that filenames
+        ///   and comments that cannot be encoded with IBM437 will be encoded with
+        ///   UTF-8.
+        /// </para>
+        ///
+        /// <para>
+        ///   Zip files created with strict adherence to the PKWare specification with
+        ///   respect to UTF-8 encoding can contain entries with filenames containing
+        ///   any combination of Unicode characters, including the full range of
+        ///   characters from Chinese, Latin, Hebrew, Greek, Cyrillic, and many other
+        ///   alphabets.  However, because at this time, the UTF-8 portion of the PKWare
+        ///   specification is not broadly supported by other zip libraries and
+        ///   utilities, such zip files may not be readable by your favorite zip tool or
+        ///   archiver. In other words, interoperability will decrease if you set this
+        ///   flag to true.
+        /// </para>
+        ///
+        /// <para>
+        ///   In particular, Zip files created with strict adherence to the PKWare
+        ///   specification with respect to UTF-8 encoding will not work well with
+        ///   Explorer in Windows XP or Windows Vista, because Windows compressed
+        ///   folders, as far as I know, do not support UTF-8 in zip files.  Vista can
+        ///   read the zip files, but shows the filenames incorrectly. Unpacking from
+        ///   Windows Vista Explorer will result in filenames that have rubbish
+        ///   characters in place of the high-order UTF-8 bytes.
+        /// </para>
+        ///
+        /// <para>
+        ///   Also, zip files that use UTF-8 encoding will not work well with Java
+        ///   applications that use the java.util.zip classes, as of v5.0 of the Java
+        ///   runtime. The Java runtime does not correctly implement the PKWare
+        ///   specification in this regard.
+        /// </para>
+        ///
+        /// <para>
+        ///   As a result, we have the unfortunate situation that "correct" behavior by
+        ///   the DotNetZip library with regard to Unicode encoding of filenames during
+        ///   zip creation will result in zip files that are readable by strictly
+        ///   compliant and current tools (for example the most recent release of the
+        ///   commercial WinZip tool); but these zip files will not be readable by
+        ///   various other tools or libraries, including Windows Explorer.
+        /// </para>
+        ///
+        /// <para>
+        ///   The DotNetZip library can read and write zip files with UTF8-encoded
+        ///   entries, according to the PKware spec.  If you use DotNetZip for both
+        ///   creating and reading the zip file, and you use UTF-8, there will be no
+        ///   loss of information in the filenames. For example, using a self-extractor
+        ///   created by this library will allow you to unpack files correctly with no
+        ///   loss of information in the filenames.
+        /// </para>
+        ///
+        /// <para>
+        ///   If you do not set this flag, it will remain false.  If this flag is false,
+        ///   your <c>ZipFile</c> will encode all filenames and comments using the
+        ///   IBM437 codepage.  This can cause "loss of information" on some filenames,
+        ///   but the resulting zipfile will be more interoperable with other
+        ///   utilities. As an example of the loss of information, diacritics can be
+        ///   lost.  The o-tilde character will be down-coded to plain o.  The c with a
+        ///   cedilla (Unicode 0xE7) used in Portugese will be downcoded to a c.
+        ///   Likewise, the O-stroke character (Unicode 248), used in Danish and
+        ///   Norwegian, will be down-coded to plain o. Chinese characters cannot be
+        ///   represented in codepage IBM437; when using the default encoding, Chinese
+        ///   characters in filenames will be represented as ?. These are all examples
+        ///   of "information loss".
+        /// </para>
+        ///
+        /// <para>
+        ///   The loss of information associated to the use of the IBM437 encoding is
+        ///   inconvenient, and can also lead to runtime errors. For example, using
+        ///   IBM437, any sequence of 4 Chinese characters will be encoded as ????.  If
+        ///   your application creates a <c>ZipFile</c>, then adds two files, each with
+        ///   names of four Chinese characters each, this will result in a duplicate
+        ///   filename exception.  In the case where you add a single file with a name
+        ///   containing four Chinese characters, calling Extract() on the entry that
+        ///   has question marks in the filename will result in an exception, because
+        ///   the question mark is not legal for use within filenames on Windows.  These
+        ///   are just a few examples of the problems associated to loss of information.
+        /// </para>
+        ///
+        /// <para>
+        ///   This flag is independent of the encoding of the content within the entries
+        ///   in the zip file. Think of the zip file as a container - it supports an
+        ///   encoding.  Within the container are other "containers" - the file entries
+        ///   themselves.  The encoding within those entries is independent of the
+        ///   encoding of the zip archive container for those entries.
+        /// </para>
+        ///
+        /// <para>
+        ///   Rather than specify the encoding in a binary fashion using this flag, an
+        ///   application can specify an arbitrary encoding via the <see
+        ///   cref="ProvisionalAlternateEncoding"/> property.  Setting the encoding
+        ///   explicitly when creating zip archives will result in non-compliant zip
+        ///   files that, curiously, are fairly interoperable.  The challenge is, the
+        ///   PKWare specification does not provide for a way to specify that an entry
+        ///   in a zip archive uses a code page that is neither IBM437 nor UTF-8.
+        ///   Therefore if you set the encoding explicitly when creating a zip archive,
+        ///   you must take care upon reading the zip archive to use the same code page.
+        ///   If you get it wrong, the behavior is undefined and may result in incorrect
+        ///   filenames, exceptions, stomach upset, hair loss, and acne.
+        /// </para>
+        /// </remarks>
+        /// <seealso cref="ProvisionalAlternateEncoding"/>
+        [Obsolete("Beginning with v1.9.1.6 of DotNetZip, this property is obsolete.  It will be removed in a future version of the library. Your applications should  use AlternateEncoding and AlternateEncodingUsage instead.")]
+        public bool UseUnicodeAsNecessary
+        {
+            get
+            {
+                return (_alternateEncoding == System.Text.Encoding.GetEncoding("UTF-8")) &&
+                    (_alternateEncodingUsage == ZipOption.AsNecessary);
+            }
+            set
+            {
+                if (value)
+                {
+                    _alternateEncoding = System.Text.Encoding.GetEncoding("UTF-8");
+                    _alternateEncodingUsage = ZipOption.AsNecessary;
+
+                }
+                else
+                {
+                    _alternateEncoding = Ionic.Zip.ZipFile.DefaultEncoding;
+                    _alternateEncodingUsage = ZipOption.Never;
+                }
+            }
+        }
+
+
+        /// <summary>
+        ///   Specify whether to use ZIP64 extensions when saving a zip archive.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///
+        /// <para>
+        ///   When creating a zip file, the default value for the property is <see
+        ///   cref="Zip64Option.Never"/>. <see cref="Zip64Option.AsNecessary"/> is
+        ///   safest, in the sense that you will not get an Exception if a pre-ZIP64
+        ///   limit is exceeded.
+        /// </para>
+        ///
+        /// <para>
+        ///   You may set the property at any time before calling Save().
+        /// </para>
+        ///
+        /// <para>
+        ///   When reading a zip file via the <c>Zipfile.Read()</c> method, DotNetZip
+        ///   will properly read ZIP64-endowed zip archives, regardless of the value of
+        ///   this property.  DotNetZip will always read ZIP64 archives.  This property
+        ///   governs only whether DotNetZip will write them. Therefore, when updating
+        ///   archives, be careful about setting this property after reading an archive
+        ///   that may use ZIP64 extensions.
+        /// </para>
+        ///
+        /// <para>
+        ///   An interesting question is, if you have set this property to
+        ///   <c>AsNecessary</c>, and then successfully saved, does the resulting
+        ///   archive use ZIP64 extensions or not?  To learn this, check the <see
+        ///   cref="OutputUsedZip64"/> property, after calling <c>Save()</c>.
+        /// </para>
+        ///
+        /// <para>
+        ///   Have you thought about
+        ///   <see href="http://cheeso.members.winisp.net/DotNetZipDonate.aspx">donating</see>?
+        /// </para>
+        ///
+        /// </remarks>
+        /// <seealso cref="RequiresZip64"/>
+        internal Zip64Option UseZip64WhenSaving
+        {
+            get
+            {
+                return _zip64;
+            }
+            set
+            {
+                _zip64 = value;
+            }
+        }
+
+
+
+        /// <summary>
+        ///   Indicates whether the archive requires ZIP64 extensions.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///
+        /// <para>
+        ///   This property is <c>null</c> (or <c>Nothing</c> in VB) if the archive has
+        ///   not been saved, and there are fewer than 65334 <c>ZipEntry</c> items
+        ///   contained in the archive.
+        /// </para>
+        ///
+        /// <para>
+        ///   The <c>Value</c> is true if any of the following four conditions holds:
+        ///   the uncompressed size of any entry is larger than 0xFFFFFFFF; the
+        ///   compressed size of any entry is larger than 0xFFFFFFFF; the relative
+        ///   offset of any entry within the zip archive is larger than 0xFFFFFFFF; or
+        ///   there are more than 65534 entries in the archive.  (0xFFFFFFFF =
+        ///   4,294,967,295).  The result may not be known until a <c>Save()</c> is attempted
+        ///   on the zip archive.  The Value of this <see cref="System.Nullable"/>
+        ///   property may be set only AFTER one of the Save() methods has been called.
+        /// </para>
+        ///
+        /// <para>
+        ///   If none of the four conditions holds, and the archive has been saved, then
+        ///   the <c>Value</c> is false.
+        /// </para>
+        ///
+        /// <para>
+        ///   A <c>Value</c> of false does not indicate that the zip archive, as saved,
+        ///   does not use ZIP64.  It merely indicates that ZIP64 is not required.  An
+        ///   archive may use ZIP64 even when not required if the <see
+        ///   cref="ZipFile.UseZip64WhenSaving"/> property is set to <see
+        ///   cref="Zip64Option.Always"/>, or if the <see
+        ///   cref="ZipFile.UseZip64WhenSaving"/> property is set to <see
+        ///   cref="Zip64Option.AsNecessary"/> and the output stream was not
+        ///   seekable. Use the <see cref="OutputUsedZip64"/> property to determine if
+        ///   the most recent <c>Save()</c> method resulted in an archive that utilized
+        ///   the ZIP64 extensions.
+        /// </para>
+        ///
+        /// </remarks>
+        /// <seealso cref="UseZip64WhenSaving"/>
+        /// <seealso cref="OutputUsedZip64"/>
+        public Nullable<bool> RequiresZip64
+        {
+            get
+            {
+                if (_entries.Count > 65534)
+                    return new Nullable<bool>(true);
+
+                // If the <c>ZipFile</c> has not been saved or if the contents have changed, then
+                // it is not known if ZIP64 is required.
+                if (!_hasBeenSaved || _contentsChanged) return null;
+
+                // Whether ZIP64 is required is knowable.
+                foreach (ZipEntry e in _entries.Values)
+                {
+                    if (e.RequiresZip64.Value) return new Nullable<bool>(true);
+                }
+
+                return new Nullable<bool>(false);
+            }
+        }
+
+
+        /// <summary>
+        ///   Indicates whether the most recent <c>Save()</c> operation used ZIP64 extensions.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   The use of ZIP64 extensions within an archive is not always necessary, and
+        ///   for interoperability concerns, it may be desired to NOT use ZIP64 if
+        ///   possible.  The <see cref="ZipFile.UseZip64WhenSaving"/> property can be
+        ///   set to use ZIP64 extensions only when necessary.  In those cases,
+        ///   Sometimes applications want to know whether a Save() actually used ZIP64
+        ///   extensions.  Applications can query this read-only property to learn
+        ///   whether ZIP64 has been used in a just-saved <c>ZipFile</c>.
+        /// </para>
+        ///
+        /// <para>
+        ///   The value is <c>null</c> (or <c>Nothing</c> in VB) if the archive has not
+        ///   been saved.
+        /// </para>
+        ///
+        /// <para>
+        ///   Non-null values (<c>HasValue</c> is true) indicate whether ZIP64
+        ///   extensions were used during the most recent <c>Save()</c> operation.  The
+        ///   ZIP64 extensions may have been used as required by any particular entry
+        ///   because of its uncompressed or compressed size, or because the archive is
+        ///   larger than 4294967295 bytes, or because there are more than 65534 entries
+        ///   in the archive, or because the <c>UseZip64WhenSaving</c> property was set
+        ///   to <see cref="Zip64Option.Always"/>, or because the
+        ///   <c>UseZip64WhenSaving</c> property was set to <see
+        ///   cref="Zip64Option.AsNecessary"/> and the output stream was not seekable.
+        ///   The value of this property does not indicate the reason the ZIP64
+        ///   extensions were used.
+        /// </para>
+        ///
+        /// </remarks>
+        /// <seealso cref="UseZip64WhenSaving"/>
+        /// <seealso cref="RequiresZip64"/>
+        public Nullable<bool> OutputUsedZip64
+        {
+            get
+            {
+                return _OutputUsesZip64;
+            }
+        }
+
+
+        /// <summary>
+        ///   Indicates whether the most recent <c>Read()</c> operation read a zip file that uses
+        ///   ZIP64 extensions.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///   This property will return null (Nothing in VB) if you've added an entry after reading
+        ///   the zip file.
+        /// </remarks>
+        public Nullable<bool> InputUsesZip64
+        {
+            get
+            {
+                if (_entries.Count > 65534)
+                    return true;
+
+                foreach (ZipEntry e in this)
+                {
+                    // if any entry was added after reading the zip file, then the result is null
+                    if (e.Source != ZipEntrySource.ZipFile) return null;
+
+                    // if any entry read from the zip used zip64, then the result is true
+                    if (e._InputUsesZip64) return true;
+                }
+                return false;
+            }
+        }
+
+
+        /// <summary>
+        ///   The text encoding to use when writing new entries to the <c>ZipFile</c>,
+        ///   for those entries that cannot be encoded with the default (IBM437)
+        ///   encoding; or, the text encoding that was used when reading the entries
+        ///   from the <c>ZipFile</c>.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   In <see href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT">its
+        ///   zip specification</see>, PKWare describes two options for encoding
+        ///   filenames and comments: using IBM437 or UTF-8.  But, some archiving tools
+        ///   or libraries do not follow the specification, and instead encode
+        ///   characters using the system default code page.  For example, WinRAR when
+        ///   run on a machine in Shanghai may encode filenames with the Big-5 Chinese
+        ///   (950) code page.  This behavior is contrary to the Zip specification, but
+        ///   it occurs anyway.
+        /// </para>
+        ///
+        /// <para>
+        ///   When using DotNetZip to write zip archives that will be read by one of
+        ///   these other archivers, set this property to specify the code page to use
+        ///   when encoding the <see cref="ZipEntry.FileName"/> and <see
+        ///   cref="ZipEntry.Comment"/> for each <c>ZipEntry</c> in the zip file, for
+        ///   values that cannot be encoded with the default codepage for zip files,
+        ///   IBM437.  This is why this property is "provisional".  In all cases, IBM437
+        ///   is used where possible, in other words, where no loss of data would
+        ///   result. It is possible, therefore, to have a given entry with a
+        ///   <c>Comment</c> encoded in IBM437 and a <c>FileName</c> encoded with the
+        ///   specified "provisional" codepage.
+        /// </para>
+        ///
+        /// <para>
+        ///   Be aware that a zip file created after you've explicitly set the <see
+        ///   cref="ProvisionalAlternateEncoding" /> property to a value other than
+        ///   IBM437 may not be compliant to the PKWare specification, and may not be
+        ///   readable by compliant archivers.  On the other hand, many (most?)
+        ///   archivers are non-compliant and can read zip files created in arbitrary
+        ///   code pages.  The trick is to use or specify the proper codepage when
+        ///   reading the zip.
+        /// </para>
+        ///
+        /// <para>
+        ///   When creating a zip archive using this library, it is possible to change
+        ///   the value of <see cref="ProvisionalAlternateEncoding" /> between each
+        ///   entry you add, and between adding entries and the call to
+        ///   <c>Save()</c>. Don't do this. It will likely result in a zipfile that is
+        ///   not readable.  For best interoperability, either leave <see
+        ///   cref="ProvisionalAlternateEncoding" /> alone, or specify it only once,
+        ///   before adding any entries to the <c>ZipFile</c> instance.  There is one
+        ///   exception to this recommendation, described later.
+        /// </para>
+        ///
+        /// <para>
+        ///   When using an arbitrary, non-UTF8 code page for encoding, there is no
+        ///   standard way for the creator application - whether DotNetZip, WinZip,
+        ///   WinRar, or something else - to formally specify in the zip file which
+        ///   codepage has been used for the entries. As a result, readers of zip files
+        ///   are not able to inspect the zip file and determine the codepage that was
+        ///   used for the entries contained within it.  It is left to the application
+        ///   or user to determine the necessary codepage when reading zip files encoded
+        ///   this way.  In other words, if you explicitly specify the codepage when you
+        ///   create the zipfile, you must explicitly specify the same codepage when
+        ///   reading the zipfile.
+        /// </para>
+        ///
+        /// <para>
+        ///   The way you specify the code page to use when reading a zip file varies
+        ///   depending on the tool or library you use to read the zip.  In DotNetZip,
+        ///   you use a ZipFile.Read() method that accepts an encoding parameter.  It
+        ///   isn't possible with Windows Explorer, as far as I know, to specify an
+        ///   explicit codepage to use when reading a zip.  If you use an incorrect
+        ///   codepage when reading a zipfile, you will get entries with filenames that
+        ///   are incorrect, and the incorrect filenames may even contain characters
+        ///   that are not legal for use within filenames in Windows. Extracting entries
+        ///   with illegal characters in the filenames will lead to exceptions. It's too
+        ///   bad, but this is just the way things are with code pages in zip
+        ///   files. Caveat Emptor.
+        /// </para>
+        ///
+        /// <para>
+        ///   Example: Suppose you create a zipfile that contains entries with
+        ///   filenames that have Danish characters.  If you use <see
+        ///   cref="ProvisionalAlternateEncoding" /> equal to "iso-8859-1" (cp 28591),
+        ///   the filenames will be correctly encoded in the zip.  But, to read that
+        ///   zipfile correctly, you have to specify the same codepage at the time you
+        ///   read it. If try to read that zip file with Windows Explorer or another
+        ///   application that is not flexible with respect to the codepage used to
+        ///   decode filenames in zipfiles, you will get a filename like "Infï¿œ.txt".
+        /// </para>
+        ///
+        /// <para>
+        ///   When using DotNetZip to read a zip archive, and the zip archive uses an
+        ///   arbitrary code page, you must specify the encoding to use before or when
+        ///   the <c>Zipfile</c> is READ.  This means you must use a <c>ZipFile.Read()</c>
+        ///   method that allows you to specify a System.Text.Encoding parameter.  Setting
+        ///   the ProvisionalAlternateEncoding property after your application has read in
+        ///   the zip archive will not affect the entry names of entries that have already
+        ///   been read in.
+        /// </para>
+        ///
+        /// <para>
+        ///   And now, the exception to the rule described above.  One strategy for
+        ///   specifying the code page for a given zip file is to describe the code page
+        ///   in a human-readable form in the Zip comment. For example, the comment may
+        ///   read "Entries in this archive are encoded in the Big5 code page".  For
+        ///   maximum interoperability, the zip comment in this case should be encoded
+        ///   in the default, IBM437 code page.  In this case, the zip comment is
+        ///   encoded using a different page than the filenames.  To do this, Specify
+        ///   <c>ProvisionalAlternateEncoding</c> to your desired region-specific code
+        ///   page, once before adding any entries, and then reset
+        ///   <c>ProvisionalAlternateEncoding</c> to IBM437 before setting the <see
+        ///   cref="Comment"/> property and calling Save().
+        /// </para>
+        /// </remarks>
+        ///
+        /// <example>
+        /// This example shows how to read a zip file using the Big-5 Chinese code page
+        /// (950), and extract each entry in the zip file.  For this code to work as
+        /// desired, the <c>Zipfile</c> must have been created using the big5 code page
+        /// (CP950). This is typical, for example, when using WinRar on a machine with
+        /// CP950 set as the default code page.  In that case, the names of entries
+        /// within the Zip archive will be stored in that code page, and reading the zip
+        /// archive must be done using that code page.  If the application did not use
+        /// the correct code page in <c>ZipFile.Read()</c>, then names of entries within the
+        /// zip archive would not be correctly retrieved.
+        /// <code>
+        /// using (var zip = ZipFile.Read(zipFileName, System.Text.Encoding.GetEncoding("big5")))
+        /// {
+        ///     // retrieve and extract an entry using a name encoded with CP950
+        ///     zip[MyDesiredEntry].Extract("unpack");
+        /// }
+        /// </code>
+        ///
+        /// <code lang="VB">
+        /// Using zip As ZipFile = ZipFile.Read(ZipToExtract, System.Text.Encoding.GetEncoding("big5"))
+        ///     ' retrieve and extract an entry using a name encoded with CP950
+        ///     zip(MyDesiredEntry).Extract("unpack")
+        /// End Using
+        /// </code>
+        /// </example>
+        ///
+        /// <seealso cref="Ionic.Zip.ZipFile.DefaultEncoding">DefaultEncoding</seealso>
+        [Obsolete("use AlternateEncoding instead.")]
+        public System.Text.Encoding ProvisionalAlternateEncoding
+        {
+            get
+            {
+                if (_alternateEncodingUsage == ZipOption.AsNecessary)
+                    return _alternateEncoding;
+                return null;
+            }
+            set
+            {
+                _alternateEncoding = value;
+                _alternateEncodingUsage = ZipOption.AsNecessary;
+            }
+        }
+
+
+        /// <summary>
+        ///   A Text Encoding to use when encoding the filenames and comments for
+        ///   all the ZipEntry items, during a ZipFile.Save() operation.
+        /// </summary>
+        /// <remarks>
+        ///   <para>
+        ///     Whether the encoding specified here is used during the save depends
+        ///     on <see cref="AlternateEncodingUsage"/>.
+        ///   </para>
+        /// </remarks>
+        public System.Text.Encoding AlternateEncoding
+        {
+            get
+            {
+                return _alternateEncoding;
+            }
+            set
+            {
+                _alternateEncoding = value;
+            }
+        }
+
+
+        /// <summary>
+        ///   A flag that tells if and when this instance should apply
+        ///   AlternateEncoding to encode the filenames and comments associated to
+        ///   of ZipEntry objects contained within this instance.
+        /// </summary>
+        internal ZipOption AlternateEncodingUsage
+        {
+            get
+            {
+                return _alternateEncodingUsage;
+            }
+            set
+            {
+                _alternateEncodingUsage = value;
+            }
+        }
+
+
+        /// <summary>
+        /// The default text encoding used in zip archives.  It is numeric 437, also
+        /// known as IBM437.
+        /// </summary>
+        /// <seealso cref="Ionic.Zip.ZipFile.ProvisionalAlternateEncoding"/>
+        public static System.Text.Encoding DefaultEncoding
+        {
+            get
+            {
+                return _defaultEncoding;
+            }
+        }
+
+
+        /// <summary>
+        /// Gets or sets the <c>TextWriter</c> to which status messages are delivered
+        /// for the instance.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///   If the TextWriter is set to a non-null value, then verbose output is sent
+        ///   to the <c>TextWriter</c> during <c>Add</c><c>, Read</c><c>, Save</c> and
+        ///   <c>Extract</c> operations.  Typically, console applications might use
+        ///   <c>Console.Out</c> and graphical or headless applications might use a
+        ///   <c>System.IO.StringWriter</c>. The output of this is suitable for viewing
+        ///   by humans.
+        /// </remarks>
+        ///
+        /// <example>
+        /// <para>
+        ///   In this example, a console application instantiates a <c>ZipFile</c>, then
+        ///   sets the <c>StatusMessageTextWriter</c> to <c>Console.Out</c>.  At that
+        ///   point, all verbose status messages for that <c>ZipFile</c> are sent to the
+        ///   console.
+        /// </para>
+        ///
+        /// <code lang="C#">
+        /// using (ZipFile zip= ZipFile.Read(FilePath))
+        /// {
+        ///   zip.StatusMessageTextWriter= System.Console.Out;
+        ///   // messages are sent to the console during extraction
+        ///   zip.ExtractAll();
+        /// }
+        /// </code>
+        ///
+        /// <code lang="VB">
+        /// Using zip As ZipFile = ZipFile.Read(FilePath)
+        ///   zip.StatusMessageTextWriter= System.Console.Out
+        ///   'Status Messages will be sent to the console during extraction
+        ///   zip.ExtractAll()
+        /// End Using
+        /// </code>
+        ///
+        /// <para>
+        ///   In this example, a Windows Forms application instantiates a
+        ///   <c>ZipFile</c>, then sets the <c>StatusMessageTextWriter</c> to a
+        ///   <c>StringWriter</c>.  At that point, all verbose status messages for that
+        ///   <c>ZipFile</c> are sent to the <c>StringWriter</c>.
+        /// </para>
+        ///
+        /// <code lang="C#">
+        /// var sw = new System.IO.StringWriter();
+        /// using (ZipFile zip= ZipFile.Read(FilePath))
+        /// {
+        ///   zip.StatusMessageTextWriter= sw;
+        ///   zip.ExtractAll();
+        /// }
+        /// Console.WriteLine("{0}", sw.ToString());
+        /// </code>
+        ///
+        /// <code lang="VB">
+        /// Dim sw as New System.IO.StringWriter
+        /// Using zip As ZipFile = ZipFile.Read(FilePath)
+        ///   zip.StatusMessageTextWriter= sw
+        ///   zip.ExtractAll()
+        /// End Using
+        /// 'Status Messages are now available in sw
+        ///
+        /// </code>
+        /// </example>
+        public TextWriter StatusMessageTextWriter
+        {
+            get { return _StatusMessageTextWriter; }
+            set { _StatusMessageTextWriter = value; }
+        }
+
+
+
+
+        /// <summary>
+        ///   Gets or sets the name for the folder to store the temporary file
+        ///   this library writes when saving a zip archive.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   This library will create a temporary file when saving a Zip archive to a
+        ///   file.  This file is written when calling one of the <c>Save()</c> methods
+        ///   that does not save to a stream, or one of the <c>SaveSelfExtractor()</c>
+        ///   methods.
+        /// </para>
+        ///
+        /// <para>
+        ///   By default, the library will create the temporary file in the directory
+        ///   specified for the file itself, via the <see cref="Name"/> property or via
+        ///   the <see cref="ZipFile.Save(String)"/> method.
+        /// </para>
+        ///
+        /// <para>
+        ///   Setting this property allows applications to override this default
+        ///   behavior, so that the library will create the temporary file in the
+        ///   specified folder. For example, to have the library create the temporary
+        ///   file in the current working directory, regardless where the <c>ZipFile</c>
+        ///   is saved, specfy ".".  To revert to the default behavior, set this
+        ///   property to <c>null</c> (<c>Nothing</c> in VB).
+        /// </para>
+        ///
+        /// <para>
+        ///   When setting the property to a non-null value, the folder specified must
+        ///   exist; if it does not an exception is thrown.  The application should have
+        ///   write and delete permissions on the folder.  The permissions are not
+        ///   explicitly checked ahead of time; if the application does not have the
+        ///   appropriate rights, an exception will be thrown at the time <c>Save()</c>
+        ///   is called.
+        /// </para>
+        ///
+        /// <para>
+        ///   There is no temporary file created when reading a zip archive.  When
+        ///   saving to a Stream, there is no temporary file created.  For example, if
+        ///   the application is an ASP.NET application and calls <c>Save()</c>
+        ///   specifying the <c>Response.OutputStream</c> as the output stream, there is
+        ///   no temporary file created.
+        /// </para>
+        /// </remarks>
+        ///
+        /// <exception cref="System.IO.FileNotFoundException">
+        /// Thrown when setting the property if the directory does not exist.
+        /// </exception>
+        ///
+        public String TempFileFolder
+        {
+            get { return _TempFileFolder; }
+
+            set
+            {
+                _TempFileFolder = value;
+                if (value == null) return;
+
+                if (!Directory.Exists(value))
+                    throw new FileNotFoundException(String.Format("That directory ({0}) does not exist.", value));
+
+            }
+        }
+
+        /// <summary>
+        /// Sets the password to be used on the <c>ZipFile</c> instance.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///
+        /// <para>
+        ///   When writing a zip archive, this password is applied to the entries, not
+        ///   to the zip archive itself. It applies to any <c>ZipEntry</c> subsequently
+        ///   added to the <c>ZipFile</c>, using one of the <c>AddFile</c>,
+        ///   <c>AddDirectory</c>, <c>AddEntry</c>, or <c>AddItem</c> methods, etc.
+        ///   When reading a zip archive, this property applies to any entry
+        ///   subsequently extracted from the <c>ZipFile</c> using one of the Extract
+        ///   methods on the <c>ZipFile</c> class.
+        /// </para>
+        ///
+        /// <para>
+        ///   When writing a zip archive, keep this in mind: though the password is set
+        ///   on the ZipFile object, according to the Zip spec, the "directory" of the
+        ///   archive - in other words the list of entries or files contained in the archive - is
+        ///   not encrypted with the password, or protected in any way.  If you set the
+        ///   Password property, the password actually applies to individual entries
+        ///   that are added to the archive, subsequent to the setting of this property.
+        ///   The list of filenames in the archive that is eventually created will
+        ///   appear in clear text, but the contents of the individual files are
+        ///   encrypted.  This is how Zip encryption works.
+        /// </para>
+        ///
+        /// <para>
+        ///   One simple way around this limitation is to simply double-wrap sensitive
+        ///   filenames: Store the files in a zip file, and then store that zip file
+        ///   within a second, "outer" zip file.  If you apply a password to the outer
+        ///   zip file, then readers will be able to see that the outer zip file
+        ///   contains an inner zip file.  But readers will not be able to read the
+        ///   directory or file list of the inner zip file.
+        /// </para>
+        ///
+        /// <para>
+        ///   If you set the password on the <c>ZipFile</c>, and then add a set of files
+        ///   to the archive, then each entry is encrypted with that password.  You may
+        ///   also want to change the password between adding different entries. If you
+        ///   set the password, add an entry, then set the password to <c>null</c>
+        ///   (<c>Nothing</c> in VB), and add another entry, the first entry is
+        ///   encrypted and the second is not.  If you call <c>AddFile()</c>, then set
+        ///   the <c>Password</c> property, then call <c>ZipFile.Save</c>, the file
+        ///   added will not be password-protected, and no warning will be generated.
+        /// </para>
+        ///
+        /// <para>
+        ///   When setting the Password, you may also want to explicitly set the <see
+        ///   cref="Encryption"/> property, to specify how to encrypt the entries added
+        ///   to the ZipFile.  If you set the Password to a non-null value and do not
+        ///   set <see cref="Encryption"/>, then PKZip 2.0 ("Weak") encryption is used.
+        ///   This encryption is relatively weak but is very interoperable. If you set
+        ///   the password to a <c>null</c> value (<c>Nothing</c> in VB), Encryption is
+        ///   reset to None.
+        /// </para>
+        ///
+        /// <para>
+        ///   All of the preceding applies to writing zip archives, in other words when
+        ///   you use one of the Save methods.  To use this property when reading or an
+        ///   existing ZipFile, do the following: set the Password property on the
+        ///   <c>ZipFile</c>, then call one of the Extract() overloads on the <see
+        ///   cref="ZipEntry" />. In this case, the entry is extracted using the
+        ///   <c>Password</c> that is specified on the <c>ZipFile</c> instance. If you
+        ///   have not set the <c>Password</c> property, then the password is
+        ///   <c>null</c>, and the entry is extracted with no password.
+        /// </para>
+        ///
+        /// <para>
+        ///   If you set the Password property on the <c>ZipFile</c>, then call
+        ///   <c>Extract()</c> an entry that has not been encrypted with a password, the
+        ///   password is not used for that entry, and the <c>ZipEntry</c> is extracted
+        ///   as normal. In other words, the password is used only if necessary.
+        /// </para>
+        ///
+        /// <para>
+        ///   The <see cref="ZipEntry"/> class also has a <see
+        ///   cref="ZipEntry.Password">Password</see> property.  It takes precedence
+        ///   over this property on the <c>ZipFile</c>.  Typically, you would use the
+        ///   per-entry Password when most entries in the zip archive use one password,
+        ///   and a few entries use a different password.  If all entries in the zip
+        ///   file use the same password, then it is simpler to just set this property
+        ///   on the <c>ZipFile</c> itself, whether creating a zip archive or extracting
+        ///   a zip archive.
+        /// </para>
+        ///
+        /// </remarks>
+        ///
+        /// <example>
+        /// <para>
+        ///   This example creates a zip file, using password protection for the
+        ///   entries, and then extracts the entries from the zip file.  When creating
+        ///   the zip file, the Readme.txt file is not protected with a password, but
+        ///   the other two are password-protected as they are saved. During extraction,
+        ///   each file is extracted with the appropriate password.
+        /// </para>
+        /// <code>
+        /// // create a file with encryption
+        /// using (ZipFile zip = new ZipFile())
+        /// {
+        ///     zip.AddFile("ReadMe.txt");
+        ///     zip.Password= "!Secret1";
+        ///     zip.AddFile("MapToTheSite-7440-N49th.png");
+        ///     zip.AddFile("2008-Regional-Sales-Report.pdf");
+        ///     zip.Save("EncryptedArchive.zip");
+        /// }
+        ///
+        /// // extract entries that use encryption
+        /// using (ZipFile zip = ZipFile.Read("EncryptedArchive.zip"))
+        /// {
+        ///     zip.Password= "!Secret1";
+        ///     zip.ExtractAll("extractDir");
+        /// }
+        ///
+        /// </code>
+        ///
+        /// <code lang="VB">
+        /// Using zip As New ZipFile
+        ///     zip.AddFile("ReadMe.txt")
+        ///     zip.Password = "123456!"
+        ///     zip.AddFile("MapToTheSite-7440-N49th.png")
+        ///     zip.Password= "!Secret1";
+        ///     zip.AddFile("2008-Regional-Sales-Report.pdf")
+        ///     zip.Save("EncryptedArchive.zip")
+        /// End Using
+        ///
+        ///
+        /// ' extract entries that use encryption
+        /// Using (zip as ZipFile = ZipFile.Read("EncryptedArchive.zip"))
+        ///     zip.Password= "!Secret1"
+        ///     zip.ExtractAll("extractDir")
+        /// End Using
+        ///
+        /// </code>
+        ///
+        /// </example>
+        ///
+        /// <seealso cref="Ionic.Zip.ZipFile.Encryption">ZipFile.Encryption</seealso>
+        /// <seealso cref="ZipEntry.Password">ZipEntry.Password</seealso>
+        public String Password
+        {
+            set
+            {
+                _Password = value;
+                if (_Password == null)
+                {
+                    Encryption = EncryptionAlgorithm.None;
+                }
+                else if (Encryption == EncryptionAlgorithm.None)
+                {
+                    Encryption = EncryptionAlgorithm.PkzipWeak;
+                }
+            }
+            private get
+            {
+                return _Password;
+            }
+        }
+
+
+
+
+
+        /// <summary>
+        ///   The action the library should take when extracting a file that already
+        ///   exists.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   This property affects the behavior of the Extract methods (one of the
+        ///   <c>Extract()</c> or <c>ExtractWithPassword()</c> overloads), when
+        ///   extraction would would overwrite an existing filesystem file. If you do
+        ///   not set this property, the library throws an exception when extracting an
+        ///   entry would overwrite an existing file.
+        /// </para>
+        ///
+        /// <para>
+        ///   This property has no effect when extracting to a stream, or when the file
+        ///   to be extracted does not already exist.
+        /// </para>
+        /// </remarks>
+        /// <seealso cref="ZipEntry.ExtractExistingFile"/>
+        internal ExtractExistingFileAction ExtractExistingFile
+        {
+            get;
+            set;
+        }
+
+
+        /// <summary>
+        ///   The action the library should take when an error is encountered while
+        ///   opening or reading files as they are saved into a zip archive.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///  <para>
+        ///    Errors can occur as a file is being saved to the zip archive.  For
+        ///    example, the File.Open may fail, or a File.Read may fail, because of
+        ///    lock conflicts or other reasons.
+        ///  </para>
+        ///
+        ///  <para>
+        ///    The first problem might occur after having called AddDirectory() on a
+        ///    directory that contains a Clipper .dbf file; the file is locked by
+        ///    Clipper and cannot be opened for read by another process. An example of
+        ///    the second problem might occur when trying to zip a .pst file that is in
+        ///    use by Microsoft Outlook. Outlook locks a range on the file, which allows
+        ///    other processes to open the file, but not read it in its entirety.
+        ///  </para>
+        ///
+        ///  <para>
+        ///    This property tells DotNetZip what you would like to do in the case of
+        ///    these errors.  The primary options are: <c>ZipErrorAction.Throw</c> to
+        ///    throw an exception (this is the default behavior if you don't set this
+        ///    property); <c>ZipErrorAction.Skip</c> to Skip the file for which there
+        ///    was an error and continue saving; <c>ZipErrorAction.Retry</c> to Retry
+        ///    the entry that caused the problem; or
+        ///    <c>ZipErrorAction.InvokeErrorEvent</c> to invoke an event handler.
+        ///  </para>
+        ///
+        ///  <para>
+        ///    This property is implicitly set to <c>ZipErrorAction.InvokeErrorEvent</c>
+        ///    if you add a handler to the <see cref="ZipError" /> event.  If you set
+        ///    this property to something other than
+        ///    <c>ZipErrorAction.InvokeErrorEvent</c>, then the <c>ZipError</c>
+        ///    event is implicitly cleared.  What it means is you can set one or the
+        ///    other (or neither), depending on what you want, but you never need to set
+        ///    both.
+        ///  </para>
+        ///
+        ///  <para>
+        ///    As with some other properties on the <c>ZipFile</c> class, like <see
+        ///    cref="Password"/>, <see cref="Encryption"/>, and <see
+        ///    cref="CompressionLevel"/>, setting this property on a <c>ZipFile</c>
+        ///    instance will cause the specified <c>ZipErrorAction</c> to be used on all
+        ///    <see cref="ZipEntry"/> items that are subsequently added to the
+        ///    <c>ZipFile</c> instance. If you set this property after you have added
+        ///    items to the <c>ZipFile</c>, but before you have called <c>Save()</c>,
+        ///    those items will not use the specified error handling action.
+        ///  </para>
+        ///
+        ///  <para>
+        ///    If you want to handle any errors that occur with any entry in the zip
+        ///    file in the same way, then set this property once, before adding any
+        ///    entries to the zip archive.
+        ///  </para>
+        ///
+        ///  <para>
+        ///    If you set this property to <c>ZipErrorAction.Skip</c> and you'd like to
+        ///    learn which files may have been skipped after a <c>Save()</c>, you can
+        ///    set the <see cref="StatusMessageTextWriter" /> on the ZipFile before
+        ///    calling <c>Save()</c>. A message will be emitted into that writer for
+        ///    each skipped file, if any.
+        ///  </para>
+        ///
+        /// </remarks>
+        ///
+        /// <example>
+        ///   This example shows how to tell DotNetZip to skip any files for which an
+        ///   error is generated during the Save().
+        /// <code lang="VB">
+        /// Public Sub SaveZipFile()
+        ///     Dim SourceFolder As String = "fodder"
+        ///     Dim DestFile As String =  "eHandler.zip"
+        ///     Dim sw as New StringWriter
+        ///     Using zipArchive As ZipFile = New ZipFile
+        ///         ' Tell DotNetZip to skip any files for which it encounters an error
+        ///         zipArchive.ZipErrorAction = ZipErrorAction.Skip
+        ///         zipArchive.StatusMessageTextWriter = sw
+        ///         zipArchive.AddDirectory(SourceFolder)
+        ///         zipArchive.Save(DestFile)
+        ///     End Using
+        ///     ' examine sw here to see any messages
+        /// End Sub
+        ///
+        /// </code>
+        /// </example>
+        ///
+        /// <seealso cref="ZipEntry.ZipErrorAction"/>
+        /// <seealso cref="Ionic.Zip.ZipFile.ZipError"/>
+
+        internal ZipErrorAction ZipErrorAction
+        {
+            get
+            {
+                if (ZipError != null)
+                    _zipErrorAction = ZipErrorAction.InvokeErrorEvent;
+                return _zipErrorAction;
+            }
+            set
+            {
+                _zipErrorAction = value;
+                if (_zipErrorAction != ZipErrorAction.InvokeErrorEvent && ZipError != null)
+                    ZipError = null;
+            }
+        }
+
+
+        /// <summary>
+        ///   The Encryption to use for entries added to the <c>ZipFile</c>.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   Set this when creating a zip archive, or when updating a zip archive. The
+        ///   specified Encryption is applied to the entries subsequently added to the
+        ///   <c>ZipFile</c> instance.  Applications do not need to set the
+        ///   <c>Encryption</c> property when reading or extracting a zip archive.
+        /// </para>
+        ///
+        /// <para>
+        ///   If you set this to something other than EncryptionAlgorithm.None, you
+        ///   will also need to set the <see cref="Password"/>.
+        /// </para>
+        ///
+        /// <para>
+        ///   As with some other properties on the <c>ZipFile</c> class, like <see
+        ///   cref="Password"/> and <see cref="CompressionLevel"/>, setting this
+        ///   property on a <c>ZipFile</c> instance will cause the specified
+        ///   <c>EncryptionAlgorithm</c> to be used on all <see cref="ZipEntry"/> items
+        ///   that are subsequently added to the <c>ZipFile</c> instance. In other
+        ///   words, if you set this property after you have added items to the
+        ///   <c>ZipFile</c>, but before you have called <c>Save()</c>, those items will
+        ///   not be encrypted or protected with a password in the resulting zip
+        ///   archive. To get a zip archive with encrypted entries, set this property,
+        ///   along with the <see cref="Password"/> property, before calling
+        ///   <c>AddFile</c>, <c>AddItem</c>, or <c>AddDirectory</c> (etc.) on the
+        ///   <c>ZipFile</c> instance.
+        /// </para>
+        ///
+        /// <para>
+        ///   If you read a <c>ZipFile</c>, you can modify the <c>Encryption</c> on an
+        ///   encrypted entry, only by setting the <c>Encryption</c> property on the
+        ///   <c>ZipEntry</c> itself.  Setting the <c>Encryption</c> property on the
+        ///   <c>ZipFile</c>, once it has been created via a call to
+        ///   <c>ZipFile.Read()</c>, does not affect entries that were previously read.
+        /// </para>
+        ///
+        /// <para>
+        ///   For example, suppose you read a <c>ZipFile</c>, and there is an encrypted
+        ///   entry.  Setting the <c>Encryption</c> property on that <c>ZipFile</c> and
+        ///   then calling <c>Save()</c> on the <c>ZipFile</c> does not update the
+        ///   <c>Encryption</c> used for the entries in the archive.  Neither is an
+        ///   exception thrown. Instead, what happens during the <c>Save()</c> is that
+        ///   all previously existing entries are copied through to the new zip archive,
+        ///   with whatever encryption and password that was used when originally
+        ///   creating the zip archive. Upon re-reading that archive, to extract
+        ///   entries, applications should use the original password or passwords, if
+        ///   any.
+        /// </para>
+        ///
+        /// <para>
+        ///   Suppose an application reads a <c>ZipFile</c>, and there is an encrypted
+        ///   entry.  Setting the <c>Encryption</c> property on that <c>ZipFile</c> and
+        ///   then adding new entries (via <c>AddFile()</c>, <c>AddEntry()</c>, etc)
+        ///   and then calling <c>Save()</c> on the <c>ZipFile</c> does not update the
+        ///   <c>Encryption</c> on any of the entries that had previously been in the
+        ///   <c>ZipFile</c>.  The <c>Encryption</c> property applies only to the
+        ///   newly-added entries.
+        /// </para>
+        ///
+        /// </remarks>
+        ///
+        /// <example>
+        /// <para>
+        ///   This example creates a zip archive that uses encryption, and then extracts
+        ///   entries from the archive.  When creating the zip archive, the ReadMe.txt
+        ///   file is zipped without using a password or encryption.  The other files
+        ///   use encryption.
+        /// </para>
+        ///
+        /// <code>
+        /// // Create a zip archive with AES Encryption.
+        /// using (ZipFile zip = new ZipFile())
+        /// {
+        ///     zip.AddFile("ReadMe.txt");
+        ///     zip.Encryption= EncryptionAlgorithm.WinZipAes256;
+        ///     zip.Password= "Top.Secret.No.Peeking!";
+        ///     zip.AddFile("7440-N49th.png");
+        ///     zip.AddFile("2008-Regional-Sales-Report.pdf");
+        ///     zip.Save("EncryptedArchive.zip");
+        /// }
+        ///
+        /// // Extract a zip archive that uses AES Encryption.
+        /// // You do not need to specify the algorithm during extraction.
+        /// using (ZipFile zip = ZipFile.Read("EncryptedArchive.zip"))
+        /// {
+        ///     zip.Password= "Top.Secret.No.Peeking!";
+        ///     zip.ExtractAll("extractDirectory");
+        /// }
+        /// </code>
+        ///
+        /// <code lang="VB">
+        /// ' Create a zip that uses Encryption.
+        /// Using zip As New ZipFile()
+        ///     zip.Encryption= EncryptionAlgorithm.WinZipAes256
+        ///     zip.Password= "Top.Secret.No.Peeking!"
+        ///     zip.AddFile("ReadMe.txt")
+        ///     zip.AddFile("7440-N49th.png")
+        ///     zip.AddFile("2008-Regional-Sales-Report.pdf")
+        ///     zip.Save("EncryptedArchive.zip")
+        /// End Using
+        ///
+        /// ' Extract a zip archive that uses AES Encryption.
+        /// ' You do not need to specify the algorithm during extraction.
+        /// Using (zip as ZipFile = ZipFile.Read("EncryptedArchive.zip"))
+        ///     zip.Password= "Top.Secret.No.Peeking!"
+        ///     zip.ExtractAll("extractDirectory")
+        /// End Using
+        /// </code>
+        ///
+        /// </example>
+        ///
+        /// <seealso cref="Ionic.Zip.ZipFile.Password">ZipFile.Password</seealso>
+        /// <seealso cref="ZipEntry.Encryption">ZipEntry.Encryption</seealso>
+        internal EncryptionAlgorithm Encryption
+        {
+            get
+            {
+                return _Encryption;
+            }
+            set
+            {
+                if (value == EncryptionAlgorithm.Unsupported)
+                    throw new InvalidOperationException("You may not set Encryption to that value.");
+                _Encryption = value;
+            }
+        }
+
+
+
+        /// <summary>
+        ///   A callback that allows the application to specify the compression level
+        ///   to use for entries subsequently added to the zip archive.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///
+        /// <para>
+        ///   With this callback, the DotNetZip library allows the application to
+        ///   determine whether compression will be used, at the time of the
+        ///   <c>Save</c>. This may be useful if the application wants to favor
+        ///   speed over size, and wants to defer the decision until the time of
+        ///   <c>Save</c>.
+        /// </para>
+        ///
+        /// <para>
+        ///   Typically applications set the <see cref="CompressionLevel"/> property on
+        ///   the <c>ZipFile</c> or on each <c>ZipEntry</c> to determine the level of
+        ///   compression used. This is done at the time the entry is added to the
+        ///   <c>ZipFile</c>. Setting the property to
+        ///   <c>Ionic.Zlib.CompressionLevel.None</c> means no compression will be used.
+        /// </para>
+        ///
+        /// <para>
+        ///   This callback allows the application to defer the decision on the
+        ///   <c>CompressionLevel</c> to use, until the time of the call to
+        ///   <c>ZipFile.Save()</c>. The callback is invoked once per <c>ZipEntry</c>,
+        ///   at the time the data for the entry is being written out as part of a
+        ///   <c>Save()</c> operation. The application can use whatever criteria it
+        ///   likes in determining the level to return.  For example, an application may
+        ///   wish that no .mp3 files should be compressed, because they are already
+        ///   compressed and the extra compression is not worth the CPU time incurred,
+        ///   and so can return <c>None</c> for all .mp3 entries.
+        /// </para>
+        ///
+        /// <para>
+        ///   The library determines whether compression will be attempted for an entry
+        ///   this way: If the entry is a zero length file, or a directory, no
+        ///   compression is used.  Otherwise, if this callback is set, it is invoked
+        ///   and the <c>CompressionLevel</c> is set to the return value. If this
+        ///   callback has not been set, then the previously set value for
+        ///   <c>CompressionLevel</c> is used.
+        /// </para>
+        ///
+        /// </remarks>
+        public SetCompressionCallback SetCompression
+        {
+            get;
+            set;
+        }
+
+
+        /// <summary>
+        /// The maximum size of an output segment, when saving a split Zip file.
+        /// </summary>
+        /// <remarks>
+        ///   <para>
+        ///     Set this to a non-zero value before calling <see cref="Save()"/> or <see
+        ///     cref="Save(String)"/> to specify that the ZipFile should be saved as a
+        ///     split archive, also sometimes called a spanned archive. Some also
+        ///     call them multi-file archives.
+        ///   </para>
+        ///
+        ///   <para>
+        ///     A split zip archive is saved in a set of discrete filesystem files,
+        ///     rather than in a single file. This is handy when transmitting the
+        ///     archive in email or some other mechanism that has a limit to the size of
+        ///     each file.  The first file in a split archive will be named
+        ///     <c>basename.z01</c>, the second will be named <c>basename.z02</c>, and
+        ///     so on. The final file is named <c>basename.zip</c>. According to the zip
+        ///     specification from PKWare, the minimum value is 65536, for a 64k segment
+        ///     size. The maximum number of segments allows in a split archive is 99.
+        ///   </para>
+        ///
+        ///   <para>
+        ///     The value of this property determines the maximum size of a split
+        ///     segment when writing a split archive.  For example, suppose you have a
+        ///     <c>ZipFile</c> that would save to a single file of 200k. If you set the
+        ///     <c>MaxOutputSegmentSize</c> to 65536 before calling <c>Save()</c>, you
+        ///     will get four distinct output files. On the other hand if you set this
+        ///     property to 256k, then you will get a single-file archive for that
+        ///     <c>ZipFile</c>.
+        ///   </para>
+        ///
+        ///   <para>
+        ///     The size of each split output file will be as large as possible, up to
+        ///     the maximum size set here. The zip specification requires that some data
+        ///     fields in a zip archive may not span a split boundary, and an output
+        ///     segment may be smaller than the maximum if necessary to avoid that
+        ///     problem. Also, obviously the final segment of the archive may be smaller
+        ///     than the maximum segment size. Segments will never be larger than the
+        ///     value set with this property.
+        ///   </para>
+        ///
+        ///   <para>
+        ///     You can save a split Zip file only when saving to a regular filesystem
+        ///     file. It's not possible to save a split zip file as a self-extracting
+        ///     archive, nor is it possible to save a split zip file to a stream. When
+        ///     saving to a SFX or to a Stream, this property is ignored.
+        ///   </para>
+        ///
+        ///   <para>
+        ///     About interoperability: Split or spanned zip files produced by DotNetZip
+        ///     can be read by WinZip or PKZip, and vice-versa. Segmented zip files may
+        ///     not be readable by other tools, if those other tools don't support zip
+        ///     spanning or splitting.  When in doubt, test.  I don't believe Windows
+        ///     Explorer can extract a split archive.
+        ///   </para>
+        ///
+        ///   <para>
+        ///     This property has no effect when reading a split archive. You can read
+        ///     a split archive in the normal way with DotNetZip.
+        ///   </para>
+        ///
+        ///   <para>
+        ///     When saving a zip file, if you want a regular zip file rather than a
+        ///     split zip file, don't set this property, or set it to Zero.
+        ///   </para>
+        ///
+        ///   <para>
+        ///     If you read a split archive, with <see cref="ZipFile.Read(string)"/> and
+        ///     then subsequently call <c>ZipFile.Save()</c>, unless you set this
+        ///     property before calling <c>Save()</c>, you will get a normal,
+        ///     single-file archive.
+        ///   </para>
+        /// </remarks>
+        ///
+        /// <seealso cref="NumberOfSegmentsForMostRecentSave"/>
+        public Int32 MaxOutputSegmentSize
+        {
+            get
+            {
+                return _maxOutputSegmentSize;
+            }
+            set
+            {
+                if (value < 65536 && value != 0)
+                    throw new ZipException("The minimum acceptable segment size is 65536.");
+                _maxOutputSegmentSize = value;
+            }
+        }
+
+
+        /// <summary>
+        ///   Returns the number of segments used in the most recent Save() operation.
+        /// </summary>
+        /// <remarks>
+        ///   <para>
+        ///     This is normally zero, unless you have set the <see
+        ///     cref="MaxOutputSegmentSize"/> property.  If you have set <see
+        ///     cref="MaxOutputSegmentSize"/>, and then you save a file, after the call to
+        ///     Save() completes, you can read this value to learn the number of segments that
+        ///     were created.
+        ///   </para>
+        ///   <para>
+        ///     If you call Save("Archive.zip"), and it creates 5 segments, then you
+        ///     will have filesystem files named Archive.z01, Archive.z02, Archive.z03,
+        ///     Archive.z04, and Archive.zip, and the value of this property will be 5.
+        ///   </para>
+        /// </remarks>
+        /// <seealso cref="MaxOutputSegmentSize"/>
+        public Int32 NumberOfSegmentsForMostRecentSave
+        {
+            get
+            {
+                return unchecked((Int32)_numberOfSegmentsForMostRecentSave + 1);
+            }
+        }
+
+
+#if !NETCF
+        /// <summary>
+        ///   The size threshold for an entry, above which a parallel deflate is used.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///
+        ///   <para>
+        ///     DotNetZip will use multiple threads to compress any ZipEntry,
+        ///     if the entry is larger than the given size.  Zero means "always
+        ///     use parallel deflate", while -1 means "never use parallel
+        ///     deflate". The default value for this property is 512k. Aside
+        ///     from the special values of 0 and 1, the minimum value is 65536.
+        ///   </para>
+        ///
+        ///   <para>
+        ///     If the entry size cannot be known before compression, as with a
+        ///     read-forward stream, then Parallel deflate will never be
+        ///     performed, unless the value of this property is zero.
+        ///   </para>
+        ///
+        ///   <para>
+        ///     A parallel deflate operations will speed up the compression of
+        ///     large files, on computers with multiple CPUs or multiple CPU
+        ///     cores.  For files above 1mb, on a dual core or dual-cpu (2p)
+        ///     machine, the time required to compress the file can be 70% of the
+        ///     single-threaded deflate.  For very large files on 4p machines the
+        ///     compression can be done in 30% of the normal time.  The downside
+        ///     is that parallel deflate consumes extra memory during the deflate,
+        ///     and the deflation is not as effective.
+        ///   </para>
+        ///
+        ///   <para>
+        ///     Parallel deflate tends to yield slightly less compression when
+        ///     compared to as single-threaded deflate; this is because the original
+        ///     data stream is split into multiple independent buffers, each of which
+        ///     is compressed in parallel.  But because they are treated
+        ///     independently, there is no opportunity to share compression
+        ///     dictionaries.  For that reason, a deflated stream may be slightly
+        ///     larger when compressed using parallel deflate, as compared to a
+        ///     traditional single-threaded deflate. Sometimes the increase over the
+        ///     normal deflate is as much as 5% of the total compressed size. For
+        ///     larger files it can be as small as 0.1%.
+        ///   </para>
+        ///
+        ///   <para>
+        ///     Multi-threaded compression does not give as much an advantage when
+        ///     using Encryption. This is primarily because encryption tends to slow
+        ///     down the entire pipeline. Also, multi-threaded compression gives less
+        ///     of an advantage when using lower compression levels, for example <see
+        ///     cref="Ionic.Zlib.CompressionLevel.BestSpeed"/>.  You may have to
+        ///     perform some tests to determine the best approach for your situation.
+        ///   </para>
+        ///
+        /// </remarks>
+        ///
+        /// <seealso cref="ParallelDeflateMaxBufferPairs"/>
+        ///
+        public long ParallelDeflateThreshold
+        {
+            set
+            {
+                if ((value != 0) && (value != -1) && (value < 64 * 1024))
+                    throw new ArgumentOutOfRangeException("ParallelDeflateThreshold should be -1, 0, or > 65536");
+                _ParallelDeflateThreshold = value;
+            }
+            get
+            {
+                return _ParallelDeflateThreshold;
+            }
+        }
+
+        /// <summary>
+        ///   The maximum number of buffer pairs to use when performing
+        ///   parallel compression.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   This property sets an upper limit on the number of memory
+        ///   buffer pairs to create when performing parallel
+        ///   compression.  The implementation of the parallel
+        ///   compression stream allocates multiple buffers to
+        ///   facilitate parallel compression.  As each buffer fills up,
+        ///   the stream uses <see
+        ///   cref="System.Threading.ThreadPool.QueueUserWorkItem(System.Threading.WaitCallback)">
+        ///   ThreadPool.QueueUserWorkItem()</see> to compress those
+        ///   buffers in a background threadpool thread. After a buffer
+        ///   is compressed, it is re-ordered and written to the output
+        ///   stream.
+        /// </para>
+        ///
+        /// <para>
+        ///   A higher number of buffer pairs enables a higher degree of
+        ///   parallelism, which tends to increase the speed of compression on
+        ///   multi-cpu computers.  On the other hand, a higher number of buffer
+        ///   pairs also implies a larger memory consumption, more active worker
+        ///   threads, and a higher cpu utilization for any compression. This
+        ///   property enables the application to limit its memory consumption and
+        ///   CPU utilization behavior depending on requirements.
+        /// </para>
+        ///
+        /// <para>
+        ///   For each compression "task" that occurs in parallel, there are 2
+        ///   buffers allocated: one for input and one for output.  This property
+        ///   sets a limit for the number of pairs.  The total amount of storage
+        ///   space allocated for buffering will then be (N*S*2), where N is the
+        ///   number of buffer pairs, S is the size of each buffer (<see
+        ///   cref="BufferSize"/>).  By default, DotNetZip allocates 4 buffer
+        ///   pairs per CPU core, so if your machine has 4 cores, and you retain
+        ///   the default buffer size of 128k, then the
+        ///   ParallelDeflateOutputStream will use 4 * 4 * 2 * 128kb of buffer
+        ///   memory in total, or 4mb, in blocks of 128kb.  If you then set this
+        ///   property to 8, then the number will be 8 * 2 * 128kb of buffer
+        ///   memory, or 2mb.
+        /// </para>
+        ///
+        /// <para>
+        ///   CPU utilization will also go up with additional buffers, because a
+        ///   larger number of buffer pairs allows a larger number of background
+        ///   threads to compress in parallel. If you find that parallel
+        ///   compression is consuming too much memory or CPU, you can adjust this
+        ///   value downward.
+        /// </para>
+        ///
+        /// <para>
+        ///   The default value is 16. Different values may deliver better or
+        ///   worse results, depending on your priorities and the dynamic
+        ///   performance characteristics of your storage and compute resources.
+        /// </para>
+        ///
+        /// <para>
+        ///   This property is not the number of buffer pairs to use; it is an
+        ///   upper limit. An illustration: Suppose you have an application that
+        ///   uses the default value of this property (which is 16), and it runs
+        ///   on a machine with 2 CPU cores. In that case, DotNetZip will allocate
+        ///   4 buffer pairs per CPU core, for a total of 8 pairs.  The upper
+        ///   limit specified by this property has no effect.
+        /// </para>
+        ///
+        /// <para>
+        ///   The application can set this value at any time
+        ///   before calling <c>ZipFile.Save()</c>.
+        /// </para>
+        /// </remarks>
+        ///
+        /// <seealso cref="ParallelDeflateThreshold"/>
+        ///
+        public int ParallelDeflateMaxBufferPairs
+        {
+            get
+            {
+                return _maxBufferPairs;
+            }
+            set
+            {
+                if (value < 4)
+                    throw new ArgumentOutOfRangeException("ParallelDeflateMaxBufferPairs",
+                                                "Value must be 4 or greater.");
+                _maxBufferPairs = value;
+            }
+        }
+#endif
+
+
+        /// <summary>Provides a string representation of the instance.</summary>
+        /// <returns>a string representation of the instance.</returns>
+        public override String ToString()
+        {
+            return String.Format("ZipFile::{0}", Name);
+        }
+
+
+        /// <summary>
+        /// Returns the version number on the DotNetZip assembly.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///   <para>
+        ///     This property is exposed as a convenience.  Callers could also get the
+        ///     version value by retrieving GetName().Version on the
+        ///     System.Reflection.Assembly object pointing to the DotNetZip
+        ///     assembly. But sometimes it is not clear which assembly is being loaded.
+        ///     This property makes it clear.
+        ///   </para>
+        ///   <para>
+        ///     This static property is primarily useful for diagnostic purposes.
+        ///   </para>
+        /// </remarks>
+        public static System.Version LibraryVersion
+        {
+            get
+            {
+                return System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
+            }
+        }
+
+        internal void NotifyEntryChanged()
+        {
+            _contentsChanged = true;
+        }
+
+
+        internal Stream StreamForDiskNumber(uint diskNumber)
+        {
+            if (diskNumber + 1 == this._diskNumberWithCd ||
+                (diskNumber == 0 && this._diskNumberWithCd == 0))
+            {
+                //return (this.ReadStream as FileStream);
+                return this.ReadStream;
+            }
+            return ZipSegmentedStream.ForReading(this._readName ?? this._name,
+                                                 diskNumber, _diskNumberWithCd);
+        }
+
+
+
+        // called by ZipEntry in ZipEntry.Extract(), when there is no stream set for the
+        // ZipEntry.
+        internal void Reset(bool whileSaving)
+        {
+            if (_JustSaved)
+            {
+                // read in the just-saved zip archive
+                using (ZipFile x = new ZipFile())
+                {
+                    // workitem 10735
+                    x._readName = x._name = whileSaving
+                        ? (this._readName ?? this._name)
+                        : this._name;
+                    x.AlternateEncoding = this.AlternateEncoding;
+                    x.AlternateEncodingUsage = this.AlternateEncodingUsage;
+                    ReadIntoInstance(x);
+                    // copy the contents of the entries.
+                    // cannot just replace the entries - the app may be holding them
+                    foreach (ZipEntry e1 in x)
+                    {
+                        foreach (ZipEntry e2 in this)
+                        {
+                            if (e1.FileName == e2.FileName)
+                            {
+                                e2.CopyMetaData(e1);
+                                break;
+                            }
+                        }
+                    }
+                }
+                _JustSaved = false;
+            }
+        }
+
+
+        #endregion
+
+        #region Constructors
+
+        /// <summary>
+        ///   Creates a new <c>ZipFile</c> instance, using the specified filename.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   Applications can use this constructor to create a new ZipFile for writing,
+        ///   or to slurp in an existing zip archive for read and update purposes.
+        /// </para>
+        ///
+        /// <para>
+        ///   To create a new zip archive, an application can call this constructor,
+        ///   passing the name of a file that does not exist.  The name may be a fully
+        ///   qualified path. Then the application can add directories or files to the
+        ///   <c>ZipFile</c> via <c>AddDirectory()</c>, <c>AddFile()</c>, <c>AddItem()</c>
+        ///   and then write the zip archive to the disk by calling <c>Save()</c>. The
+        ///   zip file is not actually opened and written to the disk until the
+        ///   application calls <c>ZipFile.Save()</c>.  At that point the new zip file
+        ///   with the given name is created.
+        /// </para>
+        ///
+        /// <para>
+        ///   If you won't know the name of the <c>Zipfile</c> until the time you call
+        ///   <c>ZipFile.Save()</c>, or if you plan to save to a stream (which has no
+        ///   name), then you should use the no-argument constructor.
+        /// </para>
+        ///
+        /// <para>
+        ///   The application can also call this constructor to read an existing zip
+        ///   archive.  passing the name of a valid zip file that does exist. But, it's
+        ///   better form to use the static <see cref="ZipFile.Read(String)"/> method,
+        ///   passing the name of the zip file, because using <c>ZipFile.Read()</c> in
+        ///   your code communicates very clearly what you are doing.  In either case,
+        ///   the file is then read into the <c>ZipFile</c> instance.  The app can then
+        ///   enumerate the entries or can modify the zip file, for example adding
+        ///   entries, removing entries, changing comments, and so on.
+        /// </para>
+        ///
+        /// <para>
+        ///   One advantage to this parameterized constructor: it allows applications to
+        ///   use the same code to add items to a zip archive, regardless of whether the
+        ///   zip file exists.
+        /// </para>
+        ///
+        /// <para>
+        ///   Instances of the <c>ZipFile</c> class are not multi-thread safe.  You may
+        ///   not party on a single instance with multiple threads.  You may have
+        ///   multiple threads that each use a distinct <c>ZipFile</c> instance, or you
+        ///   can synchronize multi-thread access to a single instance.
+        /// </para>
+        ///
+        /// <para>
+        ///   By the way, since DotNetZip is so easy to use, don't you think <see
+        ///   href="http://cheeso.members.winisp.net/DotNetZipDonate.aspx">you should
+        ///   donate $5 or $10</see>?
+        /// </para>
+        ///
+        /// </remarks>
+        ///
+        /// <exception cref="Ionic.Zip.ZipException">
+        /// Thrown if name refers to an existing file that is not a valid zip file.
+        /// </exception>
+        ///
+        /// <example>
+        /// This example shows how to create a zipfile, and add a few files into it.
+        /// <code>
+        /// String ZipFileToCreate = "archive1.zip";
+        /// String DirectoryToZip  = "c:\\reports";
+        /// using (ZipFile zip = new ZipFile())
+        /// {
+        ///   // Store all files found in the top level directory, into the zip archive.
+        ///   String[] filenames = System.IO.Directory.GetFiles(DirectoryToZip);
+        ///   zip.AddFiles(filenames, "files");
+        ///   zip.Save(ZipFileToCreate);
+        /// }
+        /// </code>
+        ///
+        /// <code lang="VB">
+        /// Dim ZipFileToCreate As String = "archive1.zip"
+        /// Dim DirectoryToZip As String = "c:\reports"
+        /// Using zip As ZipFile = New ZipFile()
+        ///     Dim filenames As String() = System.IO.Directory.GetFiles(DirectoryToZip)
+        ///     zip.AddFiles(filenames, "files")
+        ///     zip.Save(ZipFileToCreate)
+        /// End Using
+        /// </code>
+        /// </example>
+        ///
+        /// <param name="fileName">The filename to use for the new zip archive.</param>
+        ///
+        public ZipFile(string fileName)
+        {
+            try
+            {
+                _InitInstance(fileName, null);
+            }
+            catch (Exception e1)
+            {
+                throw new ZipException(String.Format("Could not read {0} as a zip file", fileName), e1);
+            }
+        }
+
+
+        /// <summary>
+        ///   Creates a new <c>ZipFile</c> instance, using the specified name for the
+        ///   filename, and the specified Encoding.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   See the documentation on the <see cref="ZipFile(String)">ZipFile
+        ///   constructor that accepts a single string argument</see> for basic
+        ///   information on all the <c>ZipFile</c> constructors.
+        /// </para>
+        ///
+        /// <para>
+        ///   The Encoding is used as the default alternate encoding for entries with
+        ///   filenames or comments that cannot be encoded with the IBM437 code page.
+        ///   This is equivalent to setting the <see
+        ///   cref="ProvisionalAlternateEncoding"/> property on the <c>ZipFile</c>
+        ///   instance after construction.
+        /// </para>
+        ///
+        /// <para>
+        ///   Instances of the <c>ZipFile</c> class are not multi-thread safe.  You may
+        ///   not party on a single instance with multiple threads.  You may have
+        ///   multiple threads that each use a distinct <c>ZipFile</c> instance, or you
+        ///   can synchronize multi-thread access to a single instance.
+        /// </para>
+        ///
+        /// </remarks>
+        ///
+        /// <exception cref="Ionic.Zip.ZipException">
+        /// Thrown if name refers to an existing file that is not a valid zip file.
+        /// </exception>
+        ///
+        /// <param name="fileName">The filename to use for the new zip archive.</param>
+        /// <param name="encoding">The Encoding is used as the default alternate
+        /// encoding for entries with filenames or comments that cannot be encoded
+        /// with the IBM437 code page. </param>
+        public ZipFile(string fileName, System.Text.Encoding encoding)
+        {
+            try
+            {
+                AlternateEncoding = encoding;
+                AlternateEncodingUsage = ZipOption.Always;
+                _InitInstance(fileName, null);
+            }
+            catch (Exception e1)
+            {
+                throw new ZipException(String.Format("{0} is not a valid zip file", fileName), e1);
+            }
+        }
+
+
+
+        /// <summary>
+        ///   Create a zip file, without specifying a target filename or stream to save to.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   See the documentation on the <see cref="ZipFile(String)">ZipFile
+        ///   constructor that accepts a single string argument</see> for basic
+        ///   information on all the <c>ZipFile</c> constructors.
+        /// </para>
+        ///
+        /// <para>
+        ///   After instantiating with this constructor and adding entries to the
+        ///   archive, the application should call <see cref="ZipFile.Save(String)"/> or
+        ///   <see cref="ZipFile.Save(System.IO.Stream)"/> to save to a file or a
+        ///   stream, respectively.  The application can also set the <see cref="Name"/>
+        ///   property and then call the no-argument <see cref="Save()"/> method.  (This
+        ///   is the preferred approach for applications that use the library through
+        ///   COM interop.)  If you call the no-argument <see cref="Save()"/> method
+        ///   without having set the <c>Name</c> of the <c>ZipFile</c>, either through
+        ///   the parameterized constructor or through the explicit property , the
+        ///   Save() will throw, because there is no place to save the file.  </para>
+        ///
+        /// <para>
+        ///   Instances of the <c>ZipFile</c> class are not multi-thread safe.  You may
+        ///   have multiple threads that each use a distinct <c>ZipFile</c> instance, or
+        ///   you can synchronize multi-thread access to a single instance.  </para>
+        ///
+        /// </remarks>
+        ///
+        /// <example>
+        /// This example creates a Zip archive called Backup.zip, containing all the files
+        /// in the directory DirectoryToZip. Files within subdirectories are not zipped up.
+        /// <code>
+        /// using (ZipFile zip = new ZipFile())
+        /// {
+        ///   // Store all files found in the top level directory, into the zip archive.
+        ///   // note: this code does not recurse subdirectories!
+        ///   String[] filenames = System.IO.Directory.GetFiles(DirectoryToZip);
+        ///   zip.AddFiles(filenames, "files");
+        ///   zip.Save("Backup.zip");
+        /// }
+        /// </code>
+        ///
+        /// <code lang="VB">
+        /// Using zip As New ZipFile
+        ///     ' Store all files found in the top level directory, into the zip archive.
+        ///     ' note: this code does not recurse subdirectories!
+        ///     Dim filenames As String() = System.IO.Directory.GetFiles(DirectoryToZip)
+        ///     zip.AddFiles(filenames, "files")
+        ///     zip.Save("Backup.zip")
+        /// End Using
+        /// </code>
+        /// </example>
+        public ZipFile()
+        {
+            _InitInstance(null, null);
+        }
+
+
+        /// <summary>
+        ///   Create a zip file, specifying a text Encoding, but without specifying a
+        ///   target filename or stream to save to.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   See the documentation on the <see cref="ZipFile(String)">ZipFile
+        ///   constructor that accepts a single string argument</see> for basic
+        ///   information on all the <c>ZipFile</c> constructors.
+        /// </para>
+        ///
+        /// </remarks>
+        ///
+        /// <param name="encoding">
+        /// The Encoding is used as the default alternate encoding for entries with
+        /// filenames or comments that cannot be encoded with the IBM437 code page.
+        /// </param>
+        public ZipFile(System.Text.Encoding encoding)
+        {
+            AlternateEncoding = encoding;
+            AlternateEncodingUsage = ZipOption.Always;
+            _InitInstance(null, null);
+        }
+
+
+        /// <summary>
+        ///   Creates a new <c>ZipFile</c> instance, using the specified name for the
+        ///   filename, and the specified status message writer.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   See the documentation on the <see cref="ZipFile(String)">ZipFile
+        ///   constructor that accepts a single string argument</see> for basic
+        ///   information on all the <c>ZipFile</c> constructors.
+        /// </para>
+        ///
+        /// <para>
+        ///   This version of the constructor allows the caller to pass in a TextWriter,
+        ///   to which verbose messages will be written during extraction or creation of
+        ///   the zip archive.  A console application may wish to pass
+        ///   System.Console.Out to get messages on the Console. A graphical or headless
+        ///   application may wish to capture the messages in a different
+        ///   <c>TextWriter</c>, for example, a <c>StringWriter</c>, and then display
+        ///   the messages in a TextBox, or generate an audit log of ZipFile operations.
+        /// </para>
+        ///
+        /// <para>
+        ///   To encrypt the data for the files added to the <c>ZipFile</c> instance,
+        ///   set the Password property after creating the <c>ZipFile</c> instance.
+        /// </para>
+        ///
+        /// <para>
+        ///   Instances of the <c>ZipFile</c> class are not multi-thread safe.  You may
+        ///   not party on a single instance with multiple threads.  You may have
+        ///   multiple threads that each use a distinct <c>ZipFile</c> instance, or you
+        ///   can synchronize multi-thread access to a single instance.
+        /// </para>
+        ///
+        /// </remarks>
+        ///
+        /// <exception cref="Ionic.Zip.ZipException">
+        /// Thrown if name refers to an existing file that is not a valid zip file.
+        /// </exception>
+        ///
+        /// <example>
+        /// <code>
+        /// using (ZipFile zip = new ZipFile("Backup.zip", Console.Out))
+        /// {
+        ///   // Store all files found in the top level directory, into the zip archive.
+        ///   // note: this code does not recurse subdirectories!
+        ///   // Status messages will be written to Console.Out
+        ///   String[] filenames = System.IO.Directory.GetFiles(DirectoryToZip);
+        ///   zip.AddFiles(filenames);
+        ///   zip.Save();
+        /// }
+        /// </code>
+        ///
+        /// <code lang="VB">
+        /// Using zip As New ZipFile("Backup.zip", Console.Out)
+        ///     ' Store all files found in the top level directory, into the zip archive.
+        ///     ' note: this code does not recurse subdirectories!
+        ///     ' Status messages will be written to Console.Out
+        ///     Dim filenames As String() = System.IO.Directory.GetFiles(DirectoryToZip)
+        ///     zip.AddFiles(filenames)
+        ///     zip.Save()
+        /// End Using
+        /// </code>
+        /// </example>
+        ///
+        /// <param name="fileName">The filename to use for the new zip archive.</param>
+        /// <param name="statusMessageWriter">A TextWriter to use for writing
+        /// verbose status messages.</param>
+        public ZipFile(string fileName, TextWriter statusMessageWriter)
+        {
+            try
+            {
+                _InitInstance(fileName, statusMessageWriter);
+            }
+            catch (Exception e1)
+            {
+                throw new ZipException(String.Format("{0} is not a valid zip file", fileName), e1);
+            }
+        }
+
+
+        /// <summary>
+        ///   Creates a new <c>ZipFile</c> instance, using the specified name for the
+        ///   filename, the specified status message writer, and the specified Encoding.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   This constructor works like the <see cref="ZipFile(String)">ZipFile
+        ///   constructor that accepts a single string argument.</see> See that
+        ///   reference for detail on what this constructor does.
+        /// </para>
+        ///
+        /// <para>
+        ///   This version of the constructor allows the caller to pass in a
+        ///   <c>TextWriter</c>, and an Encoding.  The <c>TextWriter</c> will collect
+        ///   verbose messages that are generated by the library during extraction or
+        ///   creation of the zip archive.  A console application may wish to pass
+        ///   <c>System.Console.Out</c> to get messages on the Console. A graphical or
+        ///   headless application may wish to capture the messages in a different
+        ///   <c>TextWriter</c>, for example, a <c>StringWriter</c>, and then display
+        ///   the messages in a <c>TextBox</c>, or generate an audit log of
+        ///   <c>ZipFile</c> operations.
+        /// </para>
+        ///
+        /// <para>
+        ///   The <c>Encoding</c> is used as the default alternate encoding for entries
+        ///   with filenames or comments that cannot be encoded with the IBM437 code
+        ///   page.  This is a equivalent to setting the <see
+        ///   cref="ProvisionalAlternateEncoding"/> property on the <c>ZipFile</c>
+        ///   instance after construction.
+        /// </para>
+        ///
+        /// <para>
+        ///   To encrypt the data for the files added to the <c>ZipFile</c> instance,
+        ///   set the <c>Password</c> property after creating the <c>ZipFile</c>
+        ///   instance.
+        /// </para>
+        ///
+        /// <para>
+        ///   Instances of the <c>ZipFile</c> class are not multi-thread safe.  You may
+        ///   not party on a single instance with multiple threads.  You may have
+        ///   multiple threads that each use a distinct <c>ZipFile</c> instance, or you
+        ///   can synchronize multi-thread access to a single instance.
+        /// </para>
+        ///
+        /// </remarks>
+        ///
+        /// <exception cref="Ionic.Zip.ZipException">
+        /// Thrown if <c>fileName</c> refers to an existing file that is not a valid zip file.
+        /// </exception>
+        ///
+        /// <param name="fileName">The filename to use for the new zip archive.</param>
+        /// <param name="statusMessageWriter">A TextWriter to use for writing verbose
+        /// status messages.</param>
+        /// <param name="encoding">
+        /// The Encoding is used as the default alternate encoding for entries with
+        /// filenames or comments that cannot be encoded with the IBM437 code page.
+        /// </param>
+        public ZipFile(string fileName, TextWriter statusMessageWriter,
+                       System.Text.Encoding encoding)
+        {
+            try
+            {
+                AlternateEncoding = encoding;
+                AlternateEncodingUsage = ZipOption.Always;
+                _InitInstance(fileName, statusMessageWriter);
+            }
+            catch (Exception e1)
+            {
+                throw new ZipException(String.Format("{0} is not a valid zip file", fileName), e1);
+            }
+        }
+
+
+
+
+        /// <summary>
+        ///   Initialize a <c>ZipFile</c> instance by reading in a zip file.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///
+        /// <para>
+        ///   This method is primarily useful from COM Automation environments, when
+        ///   reading or extracting zip files. In COM, it is not possible to invoke
+        ///   parameterized constructors for a class. A COM Automation application can
+        ///   update a zip file by using the <see cref="ZipFile()">default (no argument)
+        ///   constructor</see>, then calling <c>Initialize()</c> to read the contents
+        ///   of an on-disk zip archive into the <c>ZipFile</c> instance.
+        /// </para>
+        ///
+        /// <para>
+        ///   .NET applications are encouraged to use the <c>ZipFile.Read()</c> methods
+        ///   for better clarity.
+        /// </para>
+        ///
+        /// </remarks>
+        /// <param name="fileName">the name of the existing zip file to read in.</param>
+        public void Initialize(string fileName)
+        {
+            try
+            {
+                _InitInstance(fileName, null);
+            }
+            catch (Exception e1)
+            {
+                throw new ZipException(String.Format("{0} is not a valid zip file", fileName), e1);
+            }
+        }
+
+
+
+        private void _initEntriesDictionary()
+        {
+            // workitem 9868
+            StringComparer sc = (CaseSensitiveRetrieval) ? StringComparer.Ordinal : StringComparer.OrdinalIgnoreCase;
+            _entries = (_entries == null)
+                ? new Dictionary<String, ZipEntry>(sc)
+                : new Dictionary<String, ZipEntry>(_entries, sc);
+        }
+
+
+        private void _InitInstance(string zipFileName, TextWriter statusMessageWriter)
+        {
+            // create a new zipfile
+            _name = zipFileName;
+            _StatusMessageTextWriter = statusMessageWriter;
+            _contentsChanged = true;
+            AddDirectoryWillTraverseReparsePoints = true;  // workitem 8617
+            CompressionLevel = OfficeOpenXml.Packaging.Ionic.Zlib.CompressionLevel.Default;
+#if !NETCF
+            ParallelDeflateThreshold = 512 * 1024;
+#endif
+            // workitem 7685, 9868
+            _initEntriesDictionary();
+
+            if (File.Exists(_name))
+            {
+                if (FullScan)
+                    ReadIntoInstance_Orig(this);
+                else
+                    ReadIntoInstance(this);
+                this._fileAlreadyExists = true;
+            }
+
+            return;
+        }
+        #endregion
+
+
+
+        #region Indexers and Collections
+
+        private List<ZipEntry> ZipEntriesAsList
+        {
+            get
+            {
+                if (_zipEntriesAsList == null)
+                    _zipEntriesAsList = new List<ZipEntry>(_entries.Values);
+                return _zipEntriesAsList;
+            }
+        }
+
+        /// <summary>
+        ///   This is an integer indexer into the Zip archive.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   This property is read-only.
+        /// </para>
+        ///
+        /// <para>
+        ///   Internally, the <c>ZipEntry</c> instances that belong to the
+        ///   <c>ZipFile</c> are stored in a Dictionary.  When you use this
+        ///   indexer the first time, it creates a read-only
+        ///   <c>List&lt;ZipEntry&gt;</c> from the Dictionary.Values Collection.
+        ///   If at any time you modify the set of entries in the <c>ZipFile</c>,
+        ///   either by adding an entry, removing an entry, or renaming an
+        ///   entry, a new List will be created, and the numeric indexes for the
+        ///   remaining entries may be different.
+        /// </para>
+        ///
+        /// <para>
+        ///   This means you cannot rename any ZipEntry from
+        ///   inside an enumeration of the zip file.
+        /// </para>
+        ///
+        /// <param name="ix">
+        ///   The index value.
+        /// </param>
+        ///
+        /// </remarks>
+        ///
+        /// <returns>
+        ///   The <c>ZipEntry</c> within the Zip archive at the specified index. If the
+        ///   entry does not exist in the archive, this indexer throws.
+        /// </returns>
+        ///
+        public ZipEntry this[int ix]
+        {
+            // workitem 6402
+            get
+            {
+                return ZipEntriesAsList[ix];
+            }
+        }
+
+
+        /// <summary>
+        ///   This is a name-based indexer into the Zip archive.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   This property is read-only.
+        /// </para>
+        ///
+        /// <para>
+        ///   The <see cref="CaseSensitiveRetrieval"/> property on the <c>ZipFile</c>
+        ///   determines whether retrieval via this indexer is done via case-sensitive
+        ///   comparisons. By default, retrieval is not case sensitive.  This makes
+        ///   sense on Windows, in which filesystems are not case sensitive.
+        /// </para>
+        ///
+        /// <para>
+        ///   Regardless of case-sensitivity, it is not always the case that
+        ///   <c>this[value].FileName == value</c>. In other words, the <c>FileName</c>
+        ///   property of the <c>ZipEntry</c> retrieved with this indexer, may or may
+        ///   not be equal to the index value.
+        /// </para>
+        ///
+        /// <para>
+        ///   This is because DotNetZip performs a normalization of filenames passed to
+        ///   this indexer, before attempting to retrieve the item.  That normalization
+        ///   includes: removal of a volume letter and colon, swapping backward slashes
+        ///   for forward slashes.  So, <c>zip["dir1\\entry1.txt"].FileName ==
+        ///   "dir1/entry.txt"</c>.
+        /// </para>
+        ///
+        /// <para>
+        ///   Directory entries in the zip file may be retrieved via this indexer only
+        ///   with names that have a trailing slash. DotNetZip automatically appends a
+        ///   trailing slash to the names of any directory entries added to a zip.
+        /// </para>
+        ///
+        /// </remarks>
+        ///
+        /// <example>
+        /// This example extracts only the entries in a zip file that are .txt files.
+        /// <code>
+        /// using (ZipFile zip = ZipFile.Read("PackedDocuments.zip"))
+        /// {
+        ///   foreach (string s1 in zip.EntryFilenames)
+        ///   {
+        ///     if (s1.EndsWith(".txt"))
+        ///       zip[s1].Extract("textfiles");
+        ///   }
+        /// }
+        /// </code>
+        /// <code lang="VB">
+        ///   Using zip As ZipFile = ZipFile.Read("PackedDocuments.zip")
+        ///       Dim s1 As String
+        ///       For Each s1 In zip.EntryFilenames
+        ///           If s1.EndsWith(".txt") Then
+        ///               zip(s1).Extract("textfiles")
+        ///           End If
+        ///       Next
+        ///   End Using
+        /// </code>
+        /// </example>
+        /// <seealso cref="Ionic.Zip.ZipFile.RemoveEntry(string)"/>
+        ///
+        /// <exception cref="System.ArgumentException">
+        ///   Thrown if the caller attempts to assign a non-null value to the indexer.
+        /// </exception>
+        ///
+        /// <param name="fileName">
+        ///   The name of the file, including any directory path, to retrieve from the
+        ///   zip.  The filename match is not case-sensitive by default; you can use the
+        ///   <see cref="CaseSensitiveRetrieval"/> property to change this behavior. The
+        ///   pathname can use forward-slashes or backward slashes.
+        /// </param>
+        ///
+        /// <returns>
+        ///   The <c>ZipEntry</c> within the Zip archive, given by the specified
+        ///   filename. If the named entry does not exist in the archive, this indexer
+        ///   returns <c>null</c> (<c>Nothing</c> in VB).
+        /// </returns>
+        ///
+        public ZipEntry this[String fileName]
+        {
+            get
+            {
+                var key = SharedUtilities.NormalizePathForUseInZipFile(fileName);
+                if (_entries.ContainsKey(key))
+                    return _entries[key];
+                // workitem 11056
+                key = key.Replace("/", "\\");
+                if (_entries.ContainsKey(key))
+                    return _entries[key];
+                return null;
+
+#if MESSY
+                foreach (ZipEntry e in _entries.Values)
+                {
+                    if (this.CaseSensitiveRetrieval)
+                    {
+                        // check for the file match with a case-sensitive comparison.
+                        if (e.FileName == fileName) return e;
+                        // also check for equivalence
+                        if (fileName.Replace("\\", "/") == e.FileName) return e;
+                        if (e.FileName.Replace("\\", "/") == fileName) return e;
+
+                        // check for a difference only in trailing slash
+                        if (e.FileName.EndsWith("/"))
+                        {
+                            var fileNameNoSlash = e.FileName.Trim("/".ToCharArray());
+                            if (fileNameNoSlash == fileName) return e;
+                            // also check for equivalence
+                            if (fileName.Replace("\\", "/") == fileNameNoSlash) return e;
+                            if (fileNameNoSlash.Replace("\\", "/") == fileName) return e;
+                        }
+
+                    }
+                    else
+                    {
+                        // check for the file match in a case-insensitive manner.
+                        if (String.Compare(e.FileName, fileName, StringComparison.CurrentCultureIgnoreCase) == 0) return e;
+                        // also check for equivalence
+                        if (String.Compare(fileName.Replace("\\", "/"), e.FileName, StringComparison.CurrentCultureIgnoreCase) == 0) return e;
+                        if (String.Compare(e.FileName.Replace("\\", "/"), fileName, StringComparison.CurrentCultureIgnoreCase) == 0) return e;
+
+                        // check for a difference only in trailing slash
+                        if (e.FileName.EndsWith("/"))
+                        {
+                            var fileNameNoSlash = e.FileName.Trim("/".ToCharArray());
+
+                            if (String.Compare(fileNameNoSlash, fileName, StringComparison.CurrentCultureIgnoreCase) == 0) return e;
+                            // also check for equivalence
+                            if (String.Compare(fileName.Replace("\\", "/"), fileNameNoSlash, StringComparison.CurrentCultureIgnoreCase) == 0) return e;
+                            if (String.Compare(fileNameNoSlash.Replace("\\", "/"), fileName, StringComparison.CurrentCultureIgnoreCase) == 0) return e;
+
+                        }
+
+                    }
+
+                }
+                return null;
+
+#endif
+            }
+        }
+
+
+        /// <summary>
+        ///   The list of filenames for the entries contained within the zip archive.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///   According to the ZIP specification, the names of the entries use forward
+        ///   slashes in pathnames.  If you are scanning through the list, you may have
+        ///   to swap forward slashes for backslashes.
+        /// </remarks>
+        ///
+        /// <seealso cref="Ionic.Zip.ZipFile.this[string]"/>
+        ///
+        /// <example>
+        ///   This example shows one way to test if a filename is already contained
+        ///   within a zip archive.
+        /// <code>
+        /// String zipFileToRead= "PackedDocuments.zip";
+        /// string candidate = "DatedMaterial.xps";
+        /// using (ZipFile zip = new ZipFile(zipFileToRead))
+        /// {
+        ///   if (zip.EntryFilenames.Contains(candidate))
+        ///     Console.WriteLine("The file '{0}' exists in the zip archive '{1}'",
+        ///                       candidate,
+        ///                       zipFileName);
+        ///   else
+        ///     Console.WriteLine("The file, '{0}', does not exist in the zip archive '{1}'",
+        ///                       candidate,
+        ///                       zipFileName);
+        ///   Console.WriteLine();
+        /// }
+        /// </code>
+        /// <code lang="VB">
+        ///   Dim zipFileToRead As String = "PackedDocuments.zip"
+        ///   Dim candidate As String = "DatedMaterial.xps"
+        ///   Using zip As ZipFile.Read(ZipFileToRead)
+        ///       If zip.EntryFilenames.Contains(candidate) Then
+        ///           Console.WriteLine("The file '{0}' exists in the zip archive '{1}'", _
+        ///                       candidate, _
+        ///                       zipFileName)
+        ///       Else
+        ///         Console.WriteLine("The file, '{0}', does not exist in the zip archive '{1}'", _
+        ///                       candidate, _
+        ///                       zipFileName)
+        ///       End If
+        ///       Console.WriteLine
+        ///   End Using
+        /// </code>
+        /// </example>
+        ///
+        /// <returns>
+        ///   The list of strings for the filenames contained within the Zip archive.
+        /// </returns>
+        ///
+        public System.Collections.Generic.ICollection<String> EntryFileNames
+        {
+            get
+            {
+                return _entries.Keys;
+            }
+        }
+
+
+        /// <summary>
+        ///   Returns the readonly collection of entries in the Zip archive.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///
+        /// <para>
+        ///   If there are no entries in the current <c>ZipFile</c>, the value returned is a
+        ///   non-null zero-element collection.  If there are entries in the zip file,
+        ///   the elements are returned in no particular order.
+        /// </para>
+        /// <para>
+        ///   This is the implied enumerator on the <c>ZipFile</c> class.  If you use a
+        ///   <c>ZipFile</c> instance in a context that expects an enumerator, you will
+        ///   get this collection.
+        /// </para>
+        /// </remarks>
+        /// <seealso cref="EntriesSorted"/>
+        public System.Collections.Generic.ICollection<ZipEntry> Entries
+        {
+            get
+            {
+                return _entries.Values;
+            }
+        }
+
+
+        /// <summary>
+        ///   Returns a readonly collection of entries in the Zip archive, sorted by FileName.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///   If there are no entries in the current <c>ZipFile</c>, the value returned
+        ///   is a non-null zero-element collection.  If there are entries in the zip
+        ///   file, the elements are returned sorted by the name of the entry.
+        /// </remarks>
+        ///
+        /// <example>
+        ///
+        ///   This example fills a Windows Forms ListView with the entries in a zip file.
+        ///
+        /// <code lang="C#">
+        /// using (ZipFile zip = ZipFile.Read(zipFile))
+        /// {
+        ///     foreach (ZipEntry entry in zip.EntriesSorted)
+        ///     {
+        ///         ListViewItem item = new ListViewItem(n.ToString());
+        ///         n++;
+        ///         string[] subitems = new string[] {
+        ///             entry.FileName.Replace("/","\\"),
+        ///             entry.LastModified.ToString("yyyy-MM-dd HH:mm:ss"),
+        ///             entry.UncompressedSize.ToString(),
+        ///             String.Format("{0,5:F0}%", entry.CompressionRatio),
+        ///             entry.CompressedSize.ToString(),
+        ///             (entry.UsesEncryption) ? "Y" : "N",
+        ///             String.Format("{0:X8}", entry.Crc)};
+        ///
+        ///         foreach (String s in subitems)
+        ///         {
+        ///             ListViewItem.ListViewSubItem subitem = new ListViewItem.ListViewSubItem();
+        ///             subitem.Text = s;
+        ///             item.SubItems.Add(subitem);
+        ///         }
+        ///
+        ///         this.listView1.Items.Add(item);
+        ///     }
+        /// }
+        /// </code>
+        /// </example>
+        ///
+        /// <seealso cref="Entries"/>
+        public System.Collections.Generic.ICollection<ZipEntry> EntriesSorted
+        {
+            get
+            {
+                var coll = new System.Collections.Generic.List<ZipEntry>();
+                foreach (var e in this.Entries)
+                {
+                    coll.Add(e);
+                }
+                StringComparison sc = (CaseSensitiveRetrieval) ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase;
+
+                coll.Sort((x, y) => { return String.Compare(x.FileName, y.FileName, sc); });
+                return coll.AsReadOnly();
+            }
+        }
+
+
+        /// <summary>
+        /// Returns the number of entries in the Zip archive.
+        /// </summary>
+        public int Count
+        {
+            get
+            {
+                return _entries.Count;
+            }
+        }
+
+
+
+        /// <summary>
+        ///   Removes the given <c>ZipEntry</c> from the zip archive.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   After calling <c>RemoveEntry</c>, the application must call <c>Save</c> to
+        ///   make the changes permanent.
+        /// </para>
+        /// </remarks>
+        ///
+        /// <exception cref="System.ArgumentException">
+        ///   Thrown if the specified <c>ZipEntry</c> does not exist in the <c>ZipFile</c>.
+        /// </exception>
+        ///
+        /// <example>
+        ///   In this example, all entries in the zip archive dating from before
+        ///   December 31st, 2007, are removed from the archive.  This is actually much
+        ///   easier if you use the RemoveSelectedEntries method.  But I needed an
+        ///   example for RemoveEntry, so here it is.
+        /// <code>
+        /// String ZipFileToRead = "ArchiveToModify.zip";
+        /// System.DateTime Threshold = new System.DateTime(2007,12,31);
+        /// using (ZipFile zip = ZipFile.Read(ZipFileToRead))
+        /// {
+        ///   var EntriesToRemove = new System.Collections.Generic.List&lt;ZipEntry&gt;();
+        ///   foreach (ZipEntry e in zip)
+        ///   {
+        ///     if (e.LastModified &lt; Threshold)
+        ///     {
+        ///       // We cannot remove the entry from the list, within the context of
+        ///       // an enumeration of said list.
+        ///       // So we add the doomed entry to a list to be removed later.
+        ///       EntriesToRemove.Add(e);
+        ///     }
+        ///   }
+        ///
+        ///   // actually remove the doomed entries.
+        ///   foreach (ZipEntry zombie in EntriesToRemove)
+        ///     zip.RemoveEntry(zombie);
+        ///
+        ///   zip.Comment= String.Format("This zip archive was updated at {0}.",
+        ///                              System.DateTime.Now.ToString("G"));
+        ///
+        ///   // save with a different name
+        ///   zip.Save("Archive-Updated.zip");
+        /// }
+        /// </code>
+        ///
+        /// <code lang="VB">
+        ///   Dim ZipFileToRead As String = "ArchiveToModify.zip"
+        ///   Dim Threshold As New DateTime(2007, 12, 31)
+        ///   Using zip As ZipFile = ZipFile.Read(ZipFileToRead)
+        ///       Dim EntriesToRemove As New System.Collections.Generic.List(Of ZipEntry)
+        ///       Dim e As ZipEntry
+        ///       For Each e In zip
+        ///           If (e.LastModified &lt; Threshold) Then
+        ///               ' We cannot remove the entry from the list, within the context of
+        ///               ' an enumeration of said list.
+        ///               ' So we add the doomed entry to a list to be removed later.
+        ///               EntriesToRemove.Add(e)
+        ///           End If
+        ///       Next
+        ///
+        ///       ' actually remove the doomed entries.
+        ///       Dim zombie As ZipEntry
+        ///       For Each zombie In EntriesToRemove
+        ///           zip.RemoveEntry(zombie)
+        ///       Next
+        ///       zip.Comment = String.Format("This zip archive was updated at {0}.", DateTime.Now.ToString("G"))
+        ///       'save as a different name
+        ///       zip.Save("Archive-Updated.zip")
+        ///   End Using
+        /// </code>
+        /// </example>
+        ///
+        /// <param name="entry">
+        /// The <c>ZipEntry</c> to remove from the zip.
+        /// </param>
+        ///
+        /// <seealso cref="Ionic.Zip.ZipFile.RemoveSelectedEntries(string)"/>
+        ///
+        public void RemoveEntry(ZipEntry entry)
+        {
+            //if (!_entries.Values.Contains(entry))
+            //    throw new ArgumentException("The entry you specified does not exist in the zip archive.");
+            if (entry == null)
+                throw new ArgumentNullException("entry");
+
+            _entries.Remove(SharedUtilities.NormalizePathForUseInZipFile(entry.FileName));
+            _zipEntriesAsList = null;
+
+#if NOTNEEDED
+            if (_direntries != null)
+            {
+                bool FoundAndRemovedDirEntry = false;
+                foreach (ZipDirEntry de1 in _direntries)
+                {
+                    if (entry.FileName == de1.FileName)
+                    {
+                        _direntries.Remove(de1);
+                        FoundAndRemovedDirEntry = true;
+                        break;
+                    }
+                }
+
+                if (!FoundAndRemovedDirEntry)
+                    throw new BadStateException("The entry to be removed was not found in the directory.");
+            }
+#endif
+            _contentsChanged = true;
+        }
+
+
+
+
+        /// <summary>
+        /// Removes the <c>ZipEntry</c> with the given filename from the zip archive.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   After calling <c>RemoveEntry</c>, the application must call <c>Save</c> to
+        ///   make the changes permanent.
+        /// </para>
+        ///
+        /// </remarks>
+        ///
+        /// <exception cref="System.InvalidOperationException">
+        ///   Thrown if the <c>ZipFile</c> is not updatable.
+        /// </exception>
+        ///
+        /// <exception cref="System.ArgumentException">
+        ///   Thrown if a <c>ZipEntry</c> with the specified filename does not exist in
+        ///   the <c>ZipFile</c>.
+        /// </exception>
+        ///
+        /// <example>
+        ///
+        ///   This example shows one way to remove an entry with a given filename from
+        ///   an existing zip archive.
+        ///
+        /// <code>
+        /// String zipFileToRead= "PackedDocuments.zip";
+        /// string candidate = "DatedMaterial.xps";
+        /// using (ZipFile zip = ZipFile.Read(zipFileToRead))
+        /// {
+        ///   if (zip.EntryFilenames.Contains(candidate))
+        ///   {
+        ///     zip.RemoveEntry(candidate);
+        ///     zip.Comment= String.Format("The file '{0}' has been removed from this archive.",
+        ///                                Candidate);
+        ///     zip.Save();
+        ///   }
+        /// }
+        /// </code>
+        /// <code lang="VB">
+        ///   Dim zipFileToRead As String = "PackedDocuments.zip"
+        ///   Dim candidate As String = "DatedMaterial.xps"
+        ///   Using zip As ZipFile = ZipFile.Read(zipFileToRead)
+        ///       If zip.EntryFilenames.Contains(candidate) Then
+        ///           zip.RemoveEntry(candidate)
+        ///           zip.Comment = String.Format("The file '{0}' has been removed from this archive.", Candidate)
+        ///           zip.Save
+        ///       End If
+        ///   End Using
+        /// </code>
+        /// </example>
+        ///
+        /// <param name="fileName">
+        /// The name of the file, including any directory path, to remove from the zip.
+        /// The filename match is not case-sensitive by default; you can use the
+        /// <c>CaseSensitiveRetrieval</c> property to change this behavior. The
+        /// pathname can use forward-slashes or backward slashes.
+        /// </param>
+        ///
+        public void RemoveEntry(String fileName)
+        {
+            string modifiedName = ZipEntry.NameInArchive(fileName, null);
+            ZipEntry e = this[modifiedName];
+            if (e == null)
+                throw new ArgumentException("The entry you specified was not found in the zip archive.");
+
+            RemoveEntry(e);
+        }
+
+
+        #endregion
+
+        #region Destructors and Disposers
+
+        //         /// <summary>
+        //         /// This is the class Destructor, which gets called implicitly when the instance
+        //         /// is destroyed.  Because the <c>ZipFile</c> type implements IDisposable, this
+        //         /// method calls Dispose(false).
+        //         /// </summary>
+        //         ~ZipFile()
+        //         {
+        //             // call Dispose with false.  Since we're in the
+        //             // destructor call, the managed resources will be
+        //             // disposed of anyways.
+        //             Dispose(false);
+        //         }
+
+        /// <summary>
+        ///   Closes the read and write streams associated
+        ///   to the <c>ZipFile</c>, if necessary.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///   The Dispose() method is generally employed implicitly, via a <c>using(..) {..}</c>
+        ///   statement. (<c>Using...End Using</c> in VB) If you do not employ a using
+        ///   statement, insure that your application calls Dispose() explicitly.  For
+        ///   example, in a Powershell application, or an application that uses the COM
+        ///   interop interface, you must call Dispose() explicitly.
+        /// </remarks>
+        ///
+        /// <example>
+        /// This example extracts an entry selected by name, from the Zip file to the
+        /// Console.
+        /// <code>
+        /// using (ZipFile zip = ZipFile.Read(zipfile))
+        /// {
+        ///   foreach (ZipEntry e in zip)
+        ///   {
+        ///     if (WantThisEntry(e.FileName))
+        ///       zip.Extract(e.FileName, Console.OpenStandardOutput());
+        ///   }
+        /// } // Dispose() is called implicitly here.
+        /// </code>
+        ///
+        /// <code lang="VB">
+        /// Using zip As ZipFile = ZipFile.Read(zipfile)
+        ///     Dim e As ZipEntry
+        ///     For Each e In zip
+        ///       If WantThisEntry(e.FileName) Then
+        ///           zip.Extract(e.FileName, Console.OpenStandardOutput())
+        ///       End If
+        ///     Next
+        /// End Using ' Dispose is implicity called here
+        /// </code>
+        /// </example>
+        public void Dispose()
+        {
+            // dispose of the managed and unmanaged resources
+            Dispose(true);
+
+            // tell the GC that the Finalize process no longer needs
+            // to be run for this object.
+            GC.SuppressFinalize(this);
+        }
+
+        /// <summary>
+        ///   Disposes any managed resources, if the flag is set, then marks the
+        ///   instance disposed.  This method is typically not called explicitly from
+        ///   application code.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///   Applications should call <see cref="Dispose()">the no-arg Dispose method</see>.
+        /// </remarks>
+        ///
+        /// <param name="disposeManagedResources">
+        ///   indicates whether the method should dispose streams or not.
+        /// </param>
+        protected virtual void Dispose(bool disposeManagedResources)
+        {
+            if (!this._disposed)
+            {
+                if (disposeManagedResources)
+                {
+                    // dispose managed resources
+                    if (_ReadStreamIsOurs)
+                    {
+                        if (_readstream != null)
+                        {
+                            // workitem 7704
+#if NETCF
+                            _readstream.Close();
+#else
+                            _readstream.Dispose();
+#endif
+                            _readstream = null;
+                        }
+                    }
+                    // only dispose the writestream if there is a backing file
+                    if ((_temporaryFileName != null) && (_name != null))
+                        if (_writestream != null)
+                        {
+                            // workitem 7704
+#if NETCF
+                            _writestream.Close();
+#else
+                            _writestream.Dispose();
+#endif
+                            _writestream = null;
+                        }
+
+#if !NETCF
+                    // workitem 10030
+                    if (this.ParallelDeflater != null)
+                    {
+                        this.ParallelDeflater.Dispose();
+                        this.ParallelDeflater = null;
+                    }
+#endif
+                }
+                this._disposed = true;
+            }
+        }
+        #endregion
+
+
+        #region private properties
+
+        internal Stream ReadStream
+        {
+            get
+            {
+                if (_readstream == null)
+                {
+                    if (_readName != null || _name !=null)
+                    {
+                        _readstream = File.Open(_readName ?? _name,
+                                                FileMode.Open,
+                                                FileAccess.Read,
+                                                FileShare.Read | FileShare.Write);
+                        _ReadStreamIsOurs = true;
+                    }
+                }
+                return _readstream;
+            }
+        }
+
+
+
+        private Stream WriteStream
+        {
+            // workitem 9763
+            get
+            {
+                if (_writestream != null) return _writestream;
+                if (_name == null) return _writestream;
+
+                if (_maxOutputSegmentSize != 0)
+                {
+                    _writestream = ZipSegmentedStream.ForWriting(this._name, _maxOutputSegmentSize);
+                    return _writestream;
+                }
+
+                SharedUtilities.CreateAndOpenUniqueTempFile(TempFileFolder ?? Path.GetDirectoryName(_name),
+                                                            out _writestream,
+                                                            out _temporaryFileName);
+                return _writestream;
+            }
+            set
+            {
+                if (value != null)
+                    throw new ZipException("Cannot set the stream to a non-null value.");
+                _writestream = null;
+            }
+        }
+        #endregion
+
+        #region private fields
+        private TextWriter _StatusMessageTextWriter;
+        private bool _CaseSensitiveRetrieval;
+        private Stream _readstream;
+        private Stream _writestream;
+        private UInt16 _versionMadeBy;
+        private UInt16 _versionNeededToExtract;
+        private UInt32 _diskNumberWithCd;
+        private Int32 _maxOutputSegmentSize;
+        private UInt32 _numberOfSegmentsForMostRecentSave;
+        private ZipErrorAction _zipErrorAction;
+        private bool _disposed;
+        //private System.Collections.Generic.List<ZipEntry> _entries;
+        private System.Collections.Generic.Dictionary<String, ZipEntry> _entries;
+        private List<ZipEntry> _zipEntriesAsList;
+        private string _name;
+        private string _readName;
+        private string _Comment;
+        internal string _Password;
+        private bool _emitNtfsTimes = true;
+        private bool _emitUnixTimes;
+        private Ionic.Zlib.CompressionStrategy _Strategy = Ionic.Zlib.CompressionStrategy.Default;
+        private Ionic.Zip.CompressionMethod _compressionMethod = Ionic.Zip.CompressionMethod.Deflate;
+        private bool _fileAlreadyExists;
+        private string _temporaryFileName;
+        private bool _contentsChanged;
+        private bool _hasBeenSaved;
+        private String _TempFileFolder;
+        private bool _ReadStreamIsOurs = true;
+        private object LOCK = new object();
+        private bool _saveOperationCanceled;
+        private bool _extractOperationCanceled;
+        private bool _addOperationCanceled;
+        private EncryptionAlgorithm _Encryption;
+        private bool _JustSaved;
+        private long _locEndOfCDS = -1;
+        private uint _OffsetOfCentralDirectory;
+        private Int64 _OffsetOfCentralDirectory64;
+        private Nullable<bool> _OutputUsesZip64;
+        internal bool _inExtractAll;
+        private System.Text.Encoding _alternateEncoding = System.Text.Encoding.GetEncoding("IBM437"); // UTF-8
+        private ZipOption _alternateEncodingUsage = ZipOption.Never;
+        private static System.Text.Encoding _defaultEncoding = System.Text.Encoding.GetEncoding("IBM437");
+
+        private int _BufferSize = BufferSizeDefault;
+
+#if !NETCF
+        internal Ionic.Zlib.ParallelDeflateOutputStream ParallelDeflater;
+        private long _ParallelDeflateThreshold;
+        private int _maxBufferPairs = 16;
+#endif
+
+        internal Zip64Option _zip64 = Zip64Option.Default;
+#pragma warning disable 649
+        private bool _SavingSfx;
+#pragma warning restore 649
+
+        /// <summary>
+        ///   Default size of the buffer used for IO.
+        /// </summary>
+        public static readonly int BufferSizeDefault = 32768;
+
+        #endregion
+    }
+
+    /// <summary>
+    ///   Options for using ZIP64 extensions when saving zip archives.
+    /// </summary>
+    ///
+    /// <remarks>
+    ///
+    /// <para>
+    ///   Designed many years ago, the <see
+    ///   href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT">original zip
+    ///   specification from PKWARE</see> allowed for 32-bit quantities for the
+    ///   compressed and uncompressed sizes of zip entries, as well as a 32-bit quantity
+    ///   for specifying the length of the zip archive itself, and a maximum of 65535
+    ///   entries.  These limits are now regularly exceeded in many backup and archival
+    ///   scenarios.  Recently, PKWare added extensions to the original zip spec, called
+    ///   "ZIP64 extensions", to raise those limitations.  This property governs whether
+    ///   DotNetZip will use those extensions when writing zip archives. The use of
+    ///   these extensions is optional and explicit in DotNetZip because, despite the
+    ///   status of ZIP64 as a bona fide standard, many other zip tools and libraries do
+    ///   not support ZIP64, and therefore a zip file with ZIP64 extensions may be
+    ///   unreadable by some of those other tools.
+    /// </para>
+    ///
+    /// <para>
+    ///   Set this property to <see cref="Zip64Option.Always"/> to always use ZIP64
+    ///   extensions when saving, regardless of whether your zip archive needs it.
+    ///   Suppose you add 5 files, each under 100k, to a ZipFile. If you specify Always
+    ///   for this flag, you will get a ZIP64 archive, though the archive does not need
+    ///   to use ZIP64 because none of the original zip limits had been exceeded.
+    /// </para>
+    ///
+    /// <para>
+    ///   Set this property to <see cref="Zip64Option.Never"/> to tell the DotNetZip
+    ///   library to never use ZIP64 extensions.  This is useful for maximum
+    ///   compatibility and interoperability, at the expense of the capability of
+    ///   handling large files or large archives.  NB: Windows Explorer in Windows XP
+    ///   and Windows Vista cannot currently extract files from a zip64 archive, so if
+    ///   you want to guarantee that a zip archive produced by this library will work in
+    ///   Windows Explorer, use <c>Never</c>. If you set this property to <see
+    ///   cref="Zip64Option.Never"/>, and your application creates a zip that would
+    ///   exceed one of the Zip limits, the library will throw an exception while saving
+    ///   the zip file.
+    /// </para>
+    ///
+    /// <para>
+    ///   Set this property to <see cref="Zip64Option.AsNecessary"/> to tell the
+    ///   DotNetZip library to use the ZIP64 extensions when required by the
+    ///   entry. After the file is compressed, the original and compressed sizes are
+    ///   checked, and if they exceed the limits described above, then zip64 can be
+    ///   used. That is the general idea, but there is an additional wrinkle when saving
+    ///   to a non-seekable device, like the ASP.NET <c>Response.OutputStream</c>, or
+    ///   <c>Console.Out</c>.  When using non-seekable streams for output, the entry
+    ///   header - which indicates whether zip64 is in use - is emitted before it is
+    ///   known if zip64 is necessary.  It is only after all entries have been saved
+    ///   that it can be known if ZIP64 will be required.  On seekable output streams,
+    ///   after saving all entries, the library can seek backward and re-emit the zip
+    ///   file header to be consistent with the actual ZIP64 requirement.  But using a
+    ///   non-seekable output stream, the library cannot seek backward, so the header
+    ///   can never be changed. In other words, the archive's use of ZIP64 extensions is
+    ///   not alterable after the header is emitted.  Therefore, when saving to
+    ///   non-seekable streams, using <see cref="Zip64Option.AsNecessary"/> is the same
+    ///   as using <see cref="Zip64Option.Always"/>: it will always produce a zip
+    ///   archive that uses ZIP64 extensions.
+    /// </para>
+    ///
+    /// </remarks>
+    internal enum Zip64Option
+    {
+        /// <summary>
+        /// The default behavior, which is "Never".
+        /// (For COM clients, this is a 0 (zero).)
+        /// </summary>
+        Default = 0,
+        /// <summary>
+        /// Do not use ZIP64 extensions when writing zip archives.
+        /// (For COM clients, this is a 0 (zero).)
+        /// </summary>
+        Never = 0,
+        /// <summary>
+        /// Use ZIP64 extensions when writing zip archives, as necessary.
+        /// For example, when a single entry exceeds 0xFFFFFFFF in size, or when the archive as a whole
+        /// exceeds 0xFFFFFFFF in size, or when there are more than 65535 entries in an archive.
+        /// (For COM clients, this is a 1.)
+        /// </summary>
+        AsNecessary = 1,
+        /// <summary>
+        /// Always use ZIP64 extensions when writing zip archives, even when unnecessary.
+        /// (For COM clients, this is a 2.)
+        /// </summary>
+        Always
+    }
+
+
+    /// <summary>
+    ///  An enum representing the values on a three-way toggle switch
+    ///  for various options in the library. This might be used to
+    ///  specify whether to employ a particular text encoding, or to use
+    ///  ZIP64 extensions, or some other option.
+    /// </summary>
+    internal enum ZipOption
+    {
+        /// <summary>
+        /// The default behavior. This is the same as "Never".
+        /// (For COM clients, this is a 0 (zero).)
+        /// </summary>
+        Default = 0,
+        /// <summary>
+        /// Never use the associated option.
+        /// (For COM clients, this is a 0 (zero).)
+        /// </summary>
+        Never = 0,
+        /// <summary>
+        /// Use the associated behavior "as necessary."
+        /// (For COM clients, this is a 1.)
+        /// </summary>
+        AsNecessary = 1,
+        /// <summary>
+        /// Use the associated behavior Always, whether necessary or not.
+        /// (For COM clients, this is a 2.)
+        /// </summary>
+        Always
+    }
+
+
+    enum AddOrUpdateAction
+    {
+        AddOnly = 0,
+        AddOrUpdate
+    }
+
+}
+
+
+
+// ==================================================================
+//
+// Information on the ZIP format:
+//
+// From
+// http://www.pkware.com/documents/casestudies/APPNOTE.TXT
+//
+//  Overall .ZIP file format:
+//
+//     [local file header 1]
+//     [file data 1]
+//     [data descriptor 1]  ** sometimes
+//     .
+//     .
+//     .
+//     [local file header n]
+//     [file data n]
+//     [data descriptor n]   ** sometimes
+//     [archive decryption header]
+//     [archive extra data record]
+//     [central directory]
+//     [zip64 end of central directory record]
+//     [zip64 end of central directory locator]
+//     [end of central directory record]
+//
+// Local File Header format:
+//         local file header signature ... 4 bytes  (0x04034b50)
+//         version needed to extract ..... 2 bytes
+//         general purpose bit field ..... 2 bytes
+//         compression method ............ 2 bytes
+//         last mod file time ............ 2 bytes
+//         last mod file date............. 2 bytes
+//         crc-32 ........................ 4 bytes
+//         compressed size................ 4 bytes
+//         uncompressed size.............. 4 bytes
+//         file name length............... 2 bytes
+//         extra field length ............ 2 bytes
+//         file name                       varies
+//         extra field                     varies
+//
+//
+// Data descriptor:  (used only when bit 3 of the general purpose bitfield is set)
+//         (although, I have found zip files where bit 3 is not set, yet this descriptor is present!)
+//         local file header signature     4 bytes  (0x08074b50)  ** sometimes!!! Not always
+//         crc-32                          4 bytes
+//         compressed size                 4 bytes
+//         uncompressed size               4 bytes
+//
+//
+//   Central directory structure:
+//
+//       [file header 1]
+//       .
+//       .
+//       .
+//       [file header n]
+//       [digital signature]
+//
+//
+//       File header:  (This is a ZipDirEntry)
+//         central file header signature   4 bytes  (0x02014b50)
+//         version made by                 2 bytes
+//         version needed to extract       2 bytes
+//         general purpose bit flag        2 bytes
+//         compression method              2 bytes
+//         last mod file time              2 bytes
+//         last mod file date              2 bytes
+//         crc-32                          4 bytes
+//         compressed size                 4 bytes
+//         uncompressed size               4 bytes
+//         file name length                2 bytes
+//         extra field length              2 bytes
+//         file comment length             2 bytes
+//         disk number start               2 bytes
+//         internal file attributes **     2 bytes
+//         external file attributes ***    4 bytes
+//         relative offset of local header 4 bytes
+//         file name (variable size)
+//         extra field (variable size)
+//         file comment (variable size)
+//
+// ** The internal file attributes, near as I can tell,
+// uses 0x01 for a file and a 0x00 for a directory.
+//
+// ***The external file attributes follows the MS-DOS file attribute byte, described here:
+// at http://support.microsoft.com/kb/q125019/
+// 0x0010 => directory
+// 0x0020 => file
+//
+//
+// End of central directory record:
+//
+//         end of central dir signature    4 bytes  (0x06054b50)
+//         number of this disk             2 bytes
+//         number of the disk with the
+//         start of the central directory  2 bytes
+//         total number of entries in the
+//         central directory on this disk  2 bytes
+//         total number of entries in
+//         the central directory           2 bytes
+//         size of the central directory   4 bytes
+//         offset of start of central
+//         directory with respect to
+//         the starting disk number        4 bytes
+//         .ZIP file comment length        2 bytes
+//         .ZIP file comment       (variable size)
+//
+// date and time are packed values, as MSDOS did them
+// time: bits 0-4 : seconds (divided by 2)
+//            5-10: minute
+//            11-15: hour
+// date  bits 0-4 : day
+//            5-8: month
+//            9-15 year (since 1980)
+//
+// see http://msdn.microsoft.com/en-us/library/ms724274(VS.85).aspx
+
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ZipFile.x-IEnumerable.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ZipFile.x-IEnumerable.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ZipFile.x-IEnumerable.cs	(revision 12707)
@@ -0,0 +1,154 @@
+// ZipFile.x-IEnumerable.cs
+// ------------------------------------------------------------------
+//
+// Copyright (c) 2006, 2007, 2008, 2009 Dino Chiesa and Microsoft Corporation.
+// All rights reserved.
+//
+// This code module is part of DotNetZip, a zipfile class library.
+//
+// ------------------------------------------------------------------
+//
+// This code is licensed under the Microsoft Public License.
+// See the file License.txt for the license details.
+// More info on: http://dotnetzip.codeplex.com
+//
+// ------------------------------------------------------------------
+//
+// last saved (in emacs):
+// Time-stamp: <2009-December-26 15:13:26>
+//
+// ------------------------------------------------------------------
+//
+// This module defines smoe methods for IEnumerable support. It is
+// particularly important for COM to have these things in a separate module.
+//
+// ------------------------------------------------------------------
+
+
+namespace OfficeOpenXml.Packaging.Ionic.Zip
+{
+
+    // For some weird reason, the method with the DispId(-4) attribute, which is used as
+    // the _NewEnum() method, and which is required to get enumeration to work from COM
+    // environments like VBScript and Javascript (etc) must be the LAST MEMBER in the
+    // source.  In the event of Partial classes, it needs to be the last member defined
+    // in the last source module.  The source modules are ordered alphabetically by
+    // filename.  Not sure why this is true. In any case, we put the enumeration stuff
+    // here in this oddly-named module, for this reason.
+    //
+
+
+
+    internal partial class ZipFile
+    {
+
+
+
+
+        /// <summary>
+        /// Generic IEnumerator support, for use of a ZipFile in an enumeration.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// You probably do not want to call <c>GetEnumerator</c> explicitly. Instead
+        /// it is implicitly called when you use a <see langword="foreach"/> loop in C#, or a
+        /// <c>For Each</c> loop in VB.NET.
+        /// </remarks>
+        ///
+        /// <example>
+        /// This example reads a zipfile of a given name, then enumerates the
+        /// entries in that zip file, and displays the information about each
+        /// entry on the Console.
+        /// <code>
+        /// using (ZipFile zip = ZipFile.Read(zipfile))
+        /// {
+        ///   bool header = true;
+        ///   foreach (ZipEntry e in zip)
+        ///   {
+        ///     if (header)
+        ///     {
+        ///        System.Console.WriteLine("Zipfile: {0}", zip.Name);
+        ///        System.Console.WriteLine("Version Needed: 0x{0:X2}", e.VersionNeeded);
+        ///        System.Console.WriteLine("BitField: 0x{0:X2}", e.BitField);
+        ///        System.Console.WriteLine("Compression Method: 0x{0:X2}", e.CompressionMethod);
+        ///        System.Console.WriteLine("\n{1,-22} {2,-6} {3,4}   {4,-8}  {0}",
+        ///                     "Filename", "Modified", "Size", "Ratio", "Packed");
+        ///        System.Console.WriteLine(new System.String('-', 72));
+        ///        header = false;
+        ///     }
+        ///
+        ///     System.Console.WriteLine("{1,-22} {2,-6} {3,4:F0}%   {4,-8}  {0}",
+        ///                 e.FileName,
+        ///                 e.LastModified.ToString("yyyy-MM-dd HH:mm:ss"),
+        ///                 e.UncompressedSize,
+        ///                 e.CompressionRatio,
+        ///                 e.CompressedSize);
+        ///
+        ///     e.Extract();
+        ///   }
+        /// }
+        /// </code>
+        ///
+        /// <code lang="VB">
+        ///   Dim ZipFileToExtract As String = "c:\foo.zip"
+        ///   Using zip As ZipFile = ZipFile.Read(ZipFileToExtract)
+        ///       Dim header As Boolean = True
+        ///       Dim e As ZipEntry
+        ///       For Each e In zip
+        ///           If header Then
+        ///               Console.WriteLine("Zipfile: {0}", zip.Name)
+        ///               Console.WriteLine("Version Needed: 0x{0:X2}", e.VersionNeeded)
+        ///               Console.WriteLine("BitField: 0x{0:X2}", e.BitField)
+        ///               Console.WriteLine("Compression Method: 0x{0:X2}", e.CompressionMethod)
+        ///               Console.WriteLine(ChrW(10) &amp; "{1,-22} {2,-6} {3,4}   {4,-8}  {0}", _
+        ///                 "Filename", "Modified", "Size", "Ratio", "Packed" )
+        ///               Console.WriteLine(New String("-"c, 72))
+        ///               header = False
+        ///           End If
+        ///           Console.WriteLine("{1,-22} {2,-6} {3,4:F0}%   {4,-8}  {0}", _
+        ///             e.FileName, _
+        ///             e.LastModified.ToString("yyyy-MM-dd HH:mm:ss"), _
+        ///             e.UncompressedSize, _
+        ///             e.CompressionRatio, _
+        ///             e.CompressedSize )
+        ///           e.Extract
+        ///       Next
+        ///   End Using
+        /// </code>
+        /// </example>
+        ///
+        /// <returns>A generic enumerator suitable for use  within a foreach loop.</returns>
+        public System.Collections.Generic.IEnumerator<ZipEntry> GetEnumerator()
+        {
+            foreach (ZipEntry e in _entries.Values)
+                yield return e;
+        }
+
+        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
+        {
+            return GetEnumerator();
+        }
+
+
+        /// <summary>
+        /// An IEnumerator, for use of a ZipFile in a foreach construct.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// This method is included for COM support.  An application generally does not call
+        /// this method directly.  It is called implicitly by COM clients when enumerating
+        /// the entries in the ZipFile instance.  In VBScript, this is done with a <c>For Each</c>
+        /// statement.  In Javascript, this is done with <c>new Enumerator(zipfile)</c>.
+        /// </remarks>
+        ///
+        /// <returns>
+        /// The IEnumerator over the entries in the ZipFile.
+        /// </returns>
+        [System.Runtime.InteropServices.DispId(-4)]
+        public System.Collections.IEnumerator GetNewEnum()          // the name of this method is not significant
+        {
+            return GetEnumerator();
+        }
+
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ZipInputStream.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ZipInputStream.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ZipInputStream.cs	(revision 12707)
@@ -0,0 +1,829 @@
+// ZipInputStream.cs
+//
+// ------------------------------------------------------------------
+//
+// Copyright (c) 2009-2010 Dino Chiesa.
+// All rights reserved.
+//
+// This code module is part of DotNetZip, a zipfile class library.
+//
+// ------------------------------------------------------------------
+//
+// This code is licensed under the Microsoft Public License.
+// See the file License.txt for the license details.
+// More info on: http://dotnetzip.codeplex.com
+//
+// ------------------------------------------------------------------
+//
+// last saved (in emacs):
+// Time-stamp: <2011-July-31 14:48:30>
+//
+// ------------------------------------------------------------------
+//
+// This module defines the ZipInputStream class, which is a stream metaphor for
+// reading zip files.  This class does not depend on Ionic.Zip.ZipFile, but rather
+// stands alongside it as an alternative "container" for ZipEntry, when reading zips.
+//
+// It adds one interesting method to the normal "stream" interface: GetNextEntry.
+//
+// ------------------------------------------------------------------
+//
+
+using System;
+using System.Threading;
+using System.Collections.Generic;
+using System.IO;
+using Ionic.Zip;
+using OfficeOpenXml.Packaging.Ionic.Zip;
+using OfficeOpenXml.Packaging.Ionic.Crc;
+
+namespace  Ionic.Zip
+{
+    /// <summary>
+    ///   Provides a stream metaphor for reading zip files.
+    /// </summary>
+    ///
+    /// <remarks>
+    /// <para>
+    ///   This class provides an alternative programming model for reading zip files to
+    ///   the one enabled by the <see cref="ZipFile"/> class.  Use this when reading zip
+    ///   files, as an alternative to the <see cref="ZipFile"/> class, when you would
+    ///   like to use a Stream class to read the file.
+    /// </para>
+    ///
+    /// <para>
+    ///   Some application designs require a readable stream for input. This stream can
+    ///   be used to read a zip file, and extract entries.
+    /// </para>
+    ///
+    /// <para>
+    ///   Both the <c>ZipInputStream</c> class and the <c>ZipFile</c> class can be used
+    ///   to read and extract zip files.  Both of them support many of the common zip
+    ///   features, including Unicode, different compression levels, and ZIP64.  The
+    ///   programming models differ. For example, when extracting entries via calls to
+    ///   the <c>GetNextEntry()</c> and <c>Read()</c> methods on the
+    ///   <c>ZipInputStream</c> class, the caller is responsible for creating the file,
+    ///   writing the bytes into the file, setting the attributes on the file, and
+    ///   setting the created, last modified, and last accessed timestamps on the
+    ///   file. All of these things are done automatically by a call to <see
+    ///   cref="ZipEntry.Extract()">ZipEntry.Extract()</see>.  For this reason, the
+    ///   <c>ZipInputStream</c> is generally recommended for when your application wants
+    ///   to extract the data, without storing that data into a file.
+    /// </para>
+    ///
+    /// <para>
+    ///   Aside from the obvious differences in programming model, there are some
+    ///   differences in capability between the <c>ZipFile</c> class and the
+    ///   <c>ZipInputStream</c> class.
+    /// </para>
+    ///
+    /// <list type="bullet">
+    ///   <item>
+    ///     <c>ZipFile</c> can be used to create or update zip files, or read and
+    ///     extract zip files. <c>ZipInputStream</c> can be used only to read and
+    ///     extract zip files. If you want to use a stream to create zip files, check
+    ///     out the <see cref="ZipOutputStream"/>.
+    ///   </item>
+    ///
+    ///   <item>
+    ///     <c>ZipInputStream</c> cannot read segmented or spanned
+    ///     zip files.
+    ///   </item>
+    ///
+    ///   <item>
+    ///     <c>ZipInputStream</c> will not read Zip file comments.
+    ///   </item>
+    ///
+    ///   <item>
+    ///     When reading larger files, <c>ZipInputStream</c> will always underperform
+    ///     <c>ZipFile</c>. This is because the <c>ZipInputStream</c> does a full scan on the
+    ///     zip file, while the <c>ZipFile</c> class reads the central directory of the
+    ///     zip file.
+    ///   </item>
+    ///
+    /// </list>
+    ///
+    /// </remarks>
+    internal class ZipInputStream : Stream
+    {
+        /// <summary>
+        ///   Create a <c>ZipInputStream</c>, wrapping it around an existing stream.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///
+        /// <para>
+        ///   While the <see cref="ZipFile"/> class is generally easier
+        ///   to use, this class provides an alternative to those
+        ///   applications that want to read from a zipfile directly,
+        ///   using a <see cref="System.IO.Stream"/>.
+        /// </para>
+        ///
+        /// <para>
+        ///   Both the <c>ZipInputStream</c> class and the <c>ZipFile</c> class can be used
+        ///   to read and extract zip files.  Both of them support many of the common zip
+        ///   features, including Unicode, different compression levels, and ZIP64.  The
+        ///   programming models differ. For example, when extracting entries via calls to
+        ///   the <c>GetNextEntry()</c> and <c>Read()</c> methods on the
+        ///   <c>ZipInputStream</c> class, the caller is responsible for creating the file,
+        ///   writing the bytes into the file, setting the attributes on the file, and
+        ///   setting the created, last modified, and last accessed timestamps on the
+        ///   file. All of these things are done automatically by a call to <see
+        ///   cref="ZipEntry.Extract()">ZipEntry.Extract()</see>.  For this reason, the
+        ///   <c>ZipInputStream</c> is generally recommended for when your application wants
+        ///   to extract the data, without storing that data into a file.
+        /// </para>
+        ///
+        /// <para>
+        ///   Aside from the obvious differences in programming model, there are some
+        ///   differences in capability between the <c>ZipFile</c> class and the
+        ///   <c>ZipInputStream</c> class.
+        /// </para>
+        ///
+        /// <list type="bullet">
+        ///   <item>
+        ///   <c>ZipFile</c> can be used to create or update zip files, or read and extract
+        ///   zip files. <c>ZipInputStream</c> can be used only to read and extract zip
+        ///     files. If you want to use a stream to create zip files, check out the <see
+        ///     cref="ZipOutputStream"/>.
+        ///   </item>
+        ///
+        ///   <item>
+        ///     <c>ZipInputStream</c> cannot read segmented or spanned
+        ///     zip files.
+        ///   </item>
+        ///
+        ///   <item>
+        ///     <c>ZipInputStream</c> will not read Zip file comments.
+        ///   </item>
+        ///
+        ///   <item>
+        ///     When reading larger files, <c>ZipInputStream</c> will always underperform
+        ///     <c>ZipFile</c>. This is because the <c>ZipInputStream</c> does a full scan on the
+        ///     zip file, while the <c>ZipFile</c> class reads the central directory of the
+        ///     zip file.
+        ///   </item>
+        ///
+        /// </list>
+        ///
+        /// </remarks>
+        ///
+        /// <param name="stream">
+        ///   The stream to read. It must be readable. This stream will be closed at
+        ///   the time the <c>ZipInputStream</c> is closed.
+        /// </param>
+        ///
+        /// <example>
+        ///
+        ///   This example shows how to read a zip file, and extract entries, using the
+        ///   <c>ZipInputStream</c> class.
+        ///
+        /// <code lang="C#">
+        /// private void Unzip()
+        /// {
+        ///     byte[] buffer= new byte[2048];
+        ///     int n;
+        ///     using (var raw = File.Open(inputFileName, FileMode.Open, FileAccess.Read))
+        ///     {
+        ///         using (var input= new ZipInputStream(raw))
+        ///         {
+        ///             ZipEntry e;
+        ///             while (( e = input.GetNextEntry()) != null)
+        ///             {
+        ///                 if (e.IsDirectory) continue;
+        ///                 string outputPath = Path.Combine(extractDir, e.FileName);
+        ///                 using (var output = File.Open(outputPath, FileMode.Create, FileAccess.ReadWrite))
+        ///                 {
+        ///                     while ((n= input.Read(buffer, 0, buffer.Length)) > 0)
+        ///                     {
+        ///                         output.Write(buffer,0,n);
+        ///                     }
+        ///                 }
+        ///             }
+        ///         }
+        ///     }
+        /// }
+        /// </code>
+        ///
+        /// <code lang="VB">
+        /// Private Sub UnZip()
+        ///     Dim inputFileName As String = "MyArchive.zip"
+        ///     Dim extractDir As String = "extract"
+        ///     Dim buffer As Byte() = New Byte(2048) {}
+        ///     Using raw As FileStream = File.Open(inputFileName, FileMode.Open, FileAccess.Read)
+        ///         Using input As ZipInputStream = New ZipInputStream(raw)
+        ///             Dim e As ZipEntry
+        ///             Do While (Not e = input.GetNextEntry Is Nothing)
+        ///                 If Not e.IsDirectory Then
+        ///                     Using output As FileStream = File.Open(Path.Combine(extractDir, e.FileName), _
+        ///                                                            FileMode.Create, FileAccess.ReadWrite)
+        ///                         Dim n As Integer
+        ///                         Do While (n = input.Read(buffer, 0, buffer.Length) > 0)
+        ///                             output.Write(buffer, 0, n)
+        ///                         Loop
+        ///                     End Using
+        ///                 End If
+        ///             Loop
+        ///         End Using
+        ///     End Using
+        /// End Sub
+        /// </code>
+        /// </example>
+        public ZipInputStream(Stream stream)  : this (stream, false) { }
+
+
+
+        /// <summary>
+        ///   Create a <c>ZipInputStream</c>, given the name of an existing zip file.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///
+        /// <para>
+        ///   This constructor opens a <c>FileStream</c> for the given zipfile, and
+        ///   wraps a <c>ZipInputStream</c> around that.  See the documentation for the
+        ///   <see cref="ZipInputStream(Stream)"/> constructor for full details.
+        /// </para>
+        ///
+        /// <para>
+        ///   While the <see cref="ZipFile"/> class is generally easier
+        ///   to use, this class provides an alternative to those
+        ///   applications that want to read from a zipfile directly,
+        ///   using a <see cref="System.IO.Stream"/>.
+        /// </para>
+        ///
+        /// </remarks>
+        ///
+        /// <param name="fileName">
+        ///   The name of the filesystem file to read.
+        /// </param>
+        ///
+        /// <example>
+        ///
+        ///   This example shows how to read a zip file, and extract entries, using the
+        ///   <c>ZipInputStream</c> class.
+        ///
+        /// <code lang="C#">
+        /// private void Unzip()
+        /// {
+        ///     byte[] buffer= new byte[2048];
+        ///     int n;
+        ///     using (var input= new ZipInputStream(inputFileName))
+        ///     {
+        ///         ZipEntry e;
+        ///         while (( e = input.GetNextEntry()) != null)
+        ///         {
+        ///             if (e.IsDirectory) continue;
+        ///             string outputPath = Path.Combine(extractDir, e.FileName);
+        ///             using (var output = File.Open(outputPath, FileMode.Create, FileAccess.ReadWrite))
+        ///             {
+        ///                 while ((n= input.Read(buffer, 0, buffer.Length)) > 0)
+        ///                 {
+        ///                     output.Write(buffer,0,n);
+        ///                 }
+        ///             }
+        ///         }
+        ///     }
+        /// }
+        /// </code>
+        ///
+        /// <code lang="VB">
+        /// Private Sub UnZip()
+        ///     Dim inputFileName As String = "MyArchive.zip"
+        ///     Dim extractDir As String = "extract"
+        ///     Dim buffer As Byte() = New Byte(2048) {}
+        ///     Using input As ZipInputStream = New ZipInputStream(inputFileName)
+        ///         Dim e As ZipEntry
+        ///         Do While (Not e = input.GetNextEntry Is Nothing)
+        ///             If Not e.IsDirectory Then
+        ///                 Using output As FileStream = File.Open(Path.Combine(extractDir, e.FileName), _
+        ///                                                        FileMode.Create, FileAccess.ReadWrite)
+        ///                     Dim n As Integer
+        ///                     Do While (n = input.Read(buffer, 0, buffer.Length) > 0)
+        ///                         output.Write(buffer, 0, n)
+        ///                     Loop
+        ///                 End Using
+        ///             End If
+        ///         Loop
+        ///     End Using
+        /// End Sub
+        /// </code>
+        /// </example>
+        public ZipInputStream(String fileName)
+        {
+            Stream stream = File.Open(fileName, FileMode.Open, FileAccess.Read, FileShare.Read );
+            _Init(stream, false, fileName);
+        }
+
+
+        /// <summary>
+        ///   Create a <c>ZipInputStream</c>, explicitly specifying whether to
+        ///   keep the underlying stream open.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///   See the documentation for the <see
+        ///   cref="ZipInputStream(Stream)">ZipInputStream(Stream)</see>
+        ///   constructor for a discussion of the class, and an example of how to use the class.
+        /// </remarks>
+        ///
+        /// <param name="stream">
+        ///   The stream to read from. It must be readable.
+        /// </param>
+        ///
+        /// <param name="leaveOpen">
+        ///   true if the application would like the stream
+        ///   to remain open after the <c>ZipInputStream</c> has been closed.
+        /// </param>
+        public ZipInputStream(Stream stream, bool leaveOpen)
+        {
+            _Init(stream, leaveOpen, null);
+        }
+
+        private void _Init(Stream stream, bool leaveOpen, string name)
+        {
+            _inputStream = stream;
+            if (!_inputStream.CanRead)
+                throw new ZipException("The stream must be readable.");
+            _container= new ZipContainer(this);
+            _provisionalAlternateEncoding = System.Text.Encoding.GetEncoding("IBM437");
+            _leaveUnderlyingStreamOpen = leaveOpen;
+            _findRequired= true;
+            _name = name ?? "(stream)";
+        }
+
+
+        /// <summary>Provides a string representation of the instance.</summary>
+        /// <remarks>
+        ///   <para>
+        ///     This can be useful for debugging purposes.
+        ///   </para>
+        /// </remarks>
+        /// <returns>a string representation of the instance.</returns>
+        public override String ToString()
+        {
+            return String.Format ("ZipInputStream::{0}(leaveOpen({1})))", _name, _leaveUnderlyingStreamOpen);
+        }
+
+
+        /// <summary>
+        ///   The text encoding to use when reading entries into the zip archive, for
+        ///   those entries whose filenames or comments cannot be encoded with the
+        ///   default (IBM437) encoding.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   In <see href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT">its
+        ///   zip specification</see>, PKWare describes two options for encoding
+        ///   filenames and comments: using IBM437 or UTF-8.  But, some archiving tools
+        ///   or libraries do not follow the specification, and instead encode
+        ///   characters using the system default code page.  For example, WinRAR when
+        ///   run on a machine in Shanghai may encode filenames with the Big-5 Chinese
+        ///   (950) code page.  This behavior is contrary to the Zip specification, but
+        ///   it occurs anyway.
+        /// </para>
+        ///
+        /// <para>
+        ///   When using DotNetZip to read zip archives that use something other than
+        ///   UTF-8 or IBM437, set this property to specify the code page to use when
+        ///   reading encoded filenames and comments for each <c>ZipEntry</c> in the zip
+        ///   file.
+        /// </para>
+        ///
+        /// <para>
+        ///   This property is "provisional". When the entry in the zip archive is not
+        ///   explicitly marked as using UTF-8, then IBM437 is used to decode filenames
+        ///   and comments. If a loss of data would result from using IBM436 -
+        ///   specifically when encoding and decoding is not reflexive - the codepage
+        ///   specified here is used. It is possible, therefore, to have a given entry
+        ///   with a <c>Comment</c> encoded in IBM437 and a <c>FileName</c> encoded with
+        ///   the specified "provisional" codepage.
+        /// </para>
+        ///
+        /// <para>
+        ///   When a zip file uses an arbitrary, non-UTF8 code page for encoding, there
+        ///   is no standard way for the reader application - whether DotNetZip, WinZip,
+        ///   WinRar, or something else - to know which codepage has been used for the
+        ///   entries. Readers of zip files are not able to inspect the zip file and
+        ///   determine the codepage that was used for the entries contained within it.
+        ///   It is left to the application or user to determine the necessary codepage
+        ///   when reading zip files encoded this way.  If you use an incorrect codepage
+        ///   when reading a zipfile, you will get entries with filenames that are
+        ///   incorrect, and the incorrect filenames may even contain characters that
+        ///   are not legal for use within filenames in Windows. Extracting entries with
+        ///   illegal characters in the filenames will lead to exceptions. It's too bad,
+        ///   but this is just the way things are with code pages in zip files. Caveat
+        ///   Emptor.
+        /// </para>
+        ///
+        /// </remarks>
+        public System.Text.Encoding ProvisionalAlternateEncoding
+        {
+            get
+            {
+                return _provisionalAlternateEncoding;
+            }
+            set
+            {
+                _provisionalAlternateEncoding = value;
+            }
+        }
+
+
+        /// <summary>
+        ///   Size of the work buffer to use for the ZLIB codec during decompression.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///   Setting this affects the performance and memory efficiency of compression
+        ///   and decompression.  For larger files, setting this to a larger size may
+        ///   improve performance, but the exact numbers vary depending on available
+        ///   memory, and a bunch of other variables. I don't have good firm
+        ///   recommendations on how to set it.  You'll have to test it yourself. Or
+        ///   just leave it alone and accept the default.
+        /// </remarks>
+        public int CodecBufferSize
+        {
+            get;
+            set;
+        }
+
+
+        /// <summary>
+        ///   Sets the password to be used on the <c>ZipInputStream</c> instance.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///
+        /// <para>
+        ///   When reading a zip archive, this password is used to read and decrypt the
+        ///   entries that are encrypted within the zip file. When entries within a zip
+        ///   file use different passwords, set the appropriate password for the entry
+        ///   before the first call to <c>Read()</c> for each entry.
+        /// </para>
+        ///
+        /// <para>
+        ///   When reading an entry that is not encrypted, the value of this property is
+        ///   ignored.
+        /// </para>
+        ///
+        /// </remarks>
+        ///
+        /// <example>
+        ///
+        ///   This example uses the ZipInputStream to read and extract entries from a
+        ///   zip file, using a potentially different password for each entry.
+        ///
+        /// <code lang="C#">
+        /// byte[] buffer= new byte[2048];
+        /// int n;
+        /// using (var raw = File.Open(_inputFileName, FileMode.Open, FileAccess.Read ))
+        /// {
+        ///     using (var input= new ZipInputStream(raw))
+        ///     {
+        ///         ZipEntry e;
+        ///         while (( e = input.GetNextEntry()) != null)
+        ///         {
+        ///             input.Password = PasswordForEntry(e.FileName);
+        ///             if (e.IsDirectory) continue;
+        ///             string outputPath = Path.Combine(_extractDir, e.FileName);
+        ///             using (var output = File.Open(outputPath, FileMode.Create, FileAccess.ReadWrite))
+        ///             {
+        ///                 while ((n= input.Read(buffer,0,buffer.Length)) > 0)
+        ///                 {
+        ///                     output.Write(buffer,0,n);
+        ///                 }
+        ///             }
+        ///         }
+        ///     }
+        /// }
+        ///
+        /// </code>
+        /// </example>
+        public String Password
+        {
+            set
+            {
+                if (_closed)
+                {
+                    _exceptionPending = true;
+                    throw new System.InvalidOperationException("The stream has been closed.");
+                }
+                _Password = value;
+            }
+        }
+
+
+        private void SetupStream()
+        {
+            // Seek to the correct posn in the file, and open a
+            // stream that can be read.
+            _crcStream= _currentEntry.InternalOpenReader(_Password);
+            _LeftToRead = _crcStream.Length;
+            _needSetup = false;
+        }
+
+
+
+        internal Stream ReadStream
+        {
+            get
+            {
+                return _inputStream;
+            }
+        }
+
+
+        /// <summary>
+        ///   Read the data from the stream into the buffer.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   The data for the zipentry will be decrypted and uncompressed, as
+        ///   necessary, before being copied into the buffer.
+        /// </para>
+        ///
+        /// <para>
+        ///   You must set the <see cref="Password"/> property before calling
+        ///   <c>Read()</c> the first time for an encrypted entry.  To determine if an
+        ///   entry is encrypted and requires a password, check the <see
+        ///   cref="ZipEntry.Encryption">ZipEntry.Encryption</see> property.
+        /// </para>
+        /// </remarks>
+        ///
+        /// <param name="buffer">The buffer to hold the data read from the stream.</param>
+        /// <param name="offset">the offset within the buffer to copy the first byte read.</param>
+        /// <param name="count">the number of bytes to read.</param>
+        /// <returns>the number of bytes read, after decryption and decompression.</returns>
+        public override int Read(byte[] buffer, int offset, int count)
+        {
+            if (_closed)
+            {
+                _exceptionPending = true;
+                throw new System.InvalidOperationException("The stream has been closed.");
+            }
+
+            if (_needSetup)
+                SetupStream();
+
+            if (_LeftToRead == 0) return 0;
+
+            int len = (_LeftToRead > count) ? count : (int)_LeftToRead;
+            int n = _crcStream.Read(buffer, offset, len);
+
+            _LeftToRead -= n;
+
+            if (_LeftToRead == 0)
+            {
+                int CrcResult = _crcStream.Crc;
+                _currentEntry.VerifyCrcAfterExtract(CrcResult);
+                _inputStream.Seek(_endOfEntry, SeekOrigin.Begin);
+                // workitem 10178
+                SharedUtilities.Workaround_Ladybug318918(_inputStream);
+            }
+
+            return n;
+        }
+
+
+
+        /// <summary>
+        ///   Read the next entry from the zip file.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   Call this method just before calling <see cref="Read(byte[], int, int)"/>,
+        ///   to position the pointer in the zip file to the next entry that can be
+        ///   read.  Subsequent calls to <c>Read()</c>, will decrypt and decompress the
+        ///   data in the zip file, until <c>Read()</c> returns 0.
+        /// </para>
+        ///
+        /// <para>
+        ///   Each time you call <c>GetNextEntry()</c>, the pointer in the wrapped
+        ///   stream is moved to the next entry in the zip file.  If you call <see
+        ///   cref="Seek(long, SeekOrigin)"/>, and thus re-position the pointer within
+        ///   the file, you will need to call <c>GetNextEntry()</c> again, to insure
+        ///   that the file pointer is positioned at the beginning of a zip entry.
+        /// </para>
+        ///
+        /// <para>
+        ///   This method returns the <c>ZipEntry</c>. Using a stream approach, you will
+        ///   read the raw bytes for an entry in a zip file via calls to <c>Read()</c>.
+        ///   Alternatively, you can extract an entry into a file, or a stream, by
+        ///   calling <see cref="ZipEntry.Extract()"/>, or one of its siblings.
+        /// </para>
+        ///
+        /// </remarks>
+        ///
+        /// <returns>
+        ///   The <c>ZipEntry</c> read. Returns null (or Nothing in VB) if there are no more
+        ///   entries in the zip file.
+        /// </returns>
+        ///
+        public ZipEntry GetNextEntry()
+        {
+            if (_findRequired)
+            {
+                // find the next signature
+                long d = SharedUtilities.FindSignature(_inputStream, ZipConstants.ZipEntrySignature);
+                if (d == -1) return null;
+                // back up 4 bytes: ReadEntry assumes the file pointer is positioned before the entry signature
+                _inputStream.Seek(-4, SeekOrigin.Current);
+                // workitem 10178
+                SharedUtilities.Workaround_Ladybug318918(_inputStream);
+            }
+            // workitem 10923
+            else if (_firstEntry)
+            {
+                // we've already read one entry.
+                // Seek to the end of it.
+                _inputStream.Seek(_endOfEntry, SeekOrigin.Begin);
+                SharedUtilities.Workaround_Ladybug318918(_inputStream);
+            }
+
+            _currentEntry = ZipEntry.ReadEntry(_container, !_firstEntry);
+            // ReadEntry leaves the file position after all the entry
+            // data and the optional bit-3 data descriptpr.  This is
+            // where the next entry would normally start.
+            _endOfEntry = _inputStream.Position;
+            _firstEntry = true;
+            _needSetup = true;
+            _findRequired= false;
+            return _currentEntry;
+        }
+
+
+        /// <summary>
+        ///   Dispose the stream.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   This method disposes the ZipInputStream.  It may also close the
+        ///   underlying stream, depending on which constructor was used.
+        /// </para>
+        ///
+        /// <para>
+        ///   Typically the application will call <c>Dispose()</c> implicitly, via
+        ///   a <c>using</c> statement in C#, or a <c>Using</c> statement in VB.
+        /// </para>
+        ///
+        ///   <para>
+        ///     Application code won't call this code directly.  This method may
+        ///     be invoked in two distinct scenarios.  If disposing == true, the
+        ///     method has been called directly or indirectly by a user's code,
+        ///     for example via the public Dispose() method. In this case, both
+        ///     managed and unmanaged resources can be referenced and disposed.
+        ///     If disposing == false, the method has been called by the runtime
+        ///     from inside the object finalizer and this method should not
+        ///     reference other objects; in that case only unmanaged resources
+        ///     must be referenced or disposed.
+        ///   </para>
+        /// </remarks>
+        ///
+        /// <param name="disposing">
+        ///   true if the Dispose method was invoked by user code.
+        /// </param>
+        protected override void Dispose(bool disposing)
+        {
+            if (_closed) return;
+
+            if (disposing) // not called from finalizer
+            {
+                // When ZipInputStream is used within a using clause, and an
+                // exception is thrown, Close() is invoked.  But we don't want to
+                // try to write anything in that case.  Eventually the exception
+                // will be propagated to the application.
+                if (_exceptionPending) return;
+
+                if (!_leaveUnderlyingStreamOpen)
+                {
+#if NETCF
+                    _inputStream.Close();
+#else
+                    _inputStream.Dispose();
+#endif
+                }
+            }
+            _closed= true;
+        }
+
+
+        /// <summary>
+        /// Always returns true.
+        /// </summary>
+        public override bool CanRead  { get { return true; }}
+
+        /// <summary>
+        /// Returns the value of <c>CanSeek</c> for the underlying (wrapped) stream.
+        /// </summary>
+        public override bool CanSeek  { get { return _inputStream.CanSeek; } }
+
+        /// <summary>
+        /// Always returns false.
+        /// </summary>
+        public override bool CanWrite { get { return false; } }
+
+        /// <summary>
+        /// Returns the length of the underlying stream.
+        /// </summary>
+        public override long Length   { get { return _inputStream.Length; }}
+
+        /// <summary>
+        /// Gets or sets the position of the underlying stream.
+        /// </summary>
+        /// <remarks>
+        /// Setting the position is equivalent to calling <c>Seek(value, SeekOrigin.Begin)</c>.
+        /// </remarks>
+        public override long Position
+        {
+            get { return _inputStream.Position;}
+            set { Seek(value, SeekOrigin.Begin); }
+        }
+
+        /// <summary>
+        /// This is a no-op.
+        /// </summary>
+        public override void Flush()
+        {
+            throw new NotSupportedException("Flush");
+        }
+
+
+        /// <summary>
+        /// This method always throws a NotSupportedException.
+        /// </summary>
+        /// <param name="buffer">ignored</param>
+        /// <param name="offset">ignored</param>
+        /// <param name="count">ignored</param>
+        public override void Write(byte[] buffer, int offset, int count)
+        {
+            throw new NotSupportedException("Write");
+        }
+
+
+        /// <summary>
+        ///   This method seeks in the underlying stream.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   Call this method if you want to seek around within the zip file for random access.
+        /// </para>
+        ///
+        /// <para>
+        ///   Applications can intermix calls to <c>Seek()</c> with calls to <see
+        ///   cref="GetNextEntry()"/>.  After a call to <c>Seek()</c>,
+        ///   <c>GetNextEntry()</c> will get the next <c>ZipEntry</c> that falls after
+        ///   the current position in the input stream. You're on your own for finding
+        ///   out just where to seek in the stream, to get to the various entries.
+        /// </para>
+        ///
+        /// </remarks>
+        ///
+        /// <param name="offset">the offset point to seek to</param>
+        /// <param name="origin">the reference point from which to seek</param>
+        /// <returns>The new position</returns>
+        public override long Seek(long offset, SeekOrigin origin)
+        {
+            _findRequired= true;
+            var x = _inputStream.Seek(offset, origin);
+            // workitem 10178
+            SharedUtilities.Workaround_Ladybug318918(_inputStream);
+            return x;
+        }
+
+        /// <summary>
+        /// This method always throws a NotSupportedException.
+        /// </summary>
+        /// <param name="value">ignored</param>
+        public override void SetLength(long value)
+        {
+            throw new NotSupportedException();
+        }
+
+
+        private Stream _inputStream;
+        private System.Text.Encoding _provisionalAlternateEncoding;
+        private ZipEntry _currentEntry;
+        private bool _firstEntry;
+        private bool _needSetup;
+        private ZipContainer _container;
+        private CrcCalculatorStream _crcStream;
+        private Int64 _LeftToRead;
+        internal String _Password;
+        private Int64 _endOfEntry;
+        private string _name;
+
+        private bool _leaveUnderlyingStreamOpen;
+        private bool _closed;
+        private bool _findRequired;
+        private bool _exceptionPending;
+    }
+
+
+
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ZipOutputStream.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ZipOutputStream.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ZipOutputStream.cs	(revision 12707)
@@ -0,0 +1,1818 @@
+// ZipOutputStream.cs
+//
+// ------------------------------------------------------------------
+//
+// Copyright (c) 2009 Dino Chiesa.
+// All rights reserved.
+//
+// This code module is part of DotNetZip, a zipfile class library.
+//
+// ------------------------------------------------------------------
+//
+// This code is licensed under the Microsoft Public License.
+// See the file License.txt for the license details.
+// More info on: http://dotnetzip.codeplex.com
+//
+// ------------------------------------------------------------------
+//
+// last saved (in emacs):
+// Time-stamp: <2011-July-28 06:34:30>
+//
+// ------------------------------------------------------------------
+//
+// This module defines the ZipOutputStream class, which is a stream metaphor for
+// generating zip files.  This class does not depend on Ionic.Zip.ZipFile, but rather
+// stands alongside it as an alternative "container" for ZipEntry.  It replicates a
+// subset of the properties, including these:
+//
+//  - Comment
+//  - Encryption
+//  - Password
+//  - CodecBufferSize
+//  - CompressionLevel
+//  - CompressionMethod
+//  - EnableZip64 (UseZip64WhenSaving)
+//  - IgnoreCase (!CaseSensitiveRetrieval)
+//
+// It adds these novel methods:
+//
+//  - PutNextEntry
+//
+//
+// ------------------------------------------------------------------
+//
+
+using System;
+using System.Threading;
+using System.Collections.Generic;
+using System.IO;
+using Ionic.Zip;
+using OfficeOpenXml.Packaging.Ionic.Zlib;
+
+namespace OfficeOpenXml.Packaging.Ionic.Zip
+{
+    /// <summary>
+    ///   Provides a stream metaphor for generating zip files.
+    /// </summary>
+    ///
+    /// <remarks>
+    /// <para>
+    ///   This class writes zip files, as defined in the <see
+    ///   href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT">specification
+    ///   for zip files described by PKWare</see>.  The compression for this
+    ///   implementation is provided by a managed-code version of Zlib, included with
+    ///   DotNetZip in the classes in the Ionic.Zlib namespace.
+    /// </para>
+    ///
+    /// <para>
+    ///   This class provides an alternative programming model to the one enabled by the
+    ///   <see cref="ZipFile"/> class. Use this when creating zip files, as an
+    ///   alternative to the <see cref="ZipFile"/> class, when you would like to use a
+    ///   <c>Stream</c> type to write the zip file.
+    /// </para>
+    ///
+    /// <para>
+    ///   Both the <c>ZipOutputStream</c> class and the <c>ZipFile</c> class can be used
+    ///   to create zip files. Both of them support many of the common zip features,
+    ///   including Unicode, different compression levels, and ZIP64.   They provide
+    ///   very similar performance when creating zip files.
+    /// </para>
+    ///
+    /// <para>
+    ///   The <c>ZipFile</c> class is generally easier to use than
+    ///   <c>ZipOutputStream</c> and should be considered a higher-level interface.  For
+    ///   example, when creating a zip file via calls to the <c>PutNextEntry()</c> and
+    ///   <c>Write()</c> methods on the <c>ZipOutputStream</c> class, the caller is
+    ///   responsible for opening the file, reading the bytes from the file, writing
+    ///   those bytes into the <c>ZipOutputStream</c>, setting the attributes on the
+    ///   <c>ZipEntry</c>, and setting the created, last modified, and last accessed
+    ///   timestamps on the zip entry. All of these things are done automatically by a
+    ///   call to <see cref="ZipFile.AddFile(string,string)">ZipFile.AddFile()</see>.
+    ///   For this reason, the <c>ZipOutputStream</c> is generally recommended for use
+    ///   only when your application emits arbitrary data, not necessarily data from a
+    ///   filesystem file, directly into a zip file, and does so using a <c>Stream</c>
+    ///   metaphor.
+    /// </para>
+    ///
+    /// <para>
+    ///   Aside from the differences in programming model, there are other
+    ///   differences in capability between the two classes.
+    /// </para>
+    ///
+    /// <list type="bullet">
+    ///   <item>
+    ///     <c>ZipFile</c> can be used to read and extract zip files, in addition to
+    ///     creating zip files. <c>ZipOutputStream</c> cannot read zip files. If you want
+    ///     to use a stream to read zip files, check out the <see cref="ZipInputStream"/> class.
+    ///   </item>
+    ///
+    ///   <item>
+    ///     <c>ZipOutputStream</c> does not support the creation of segmented or spanned
+    ///     zip files.
+    ///   </item>
+    ///
+    ///   <item>
+    ///     <c>ZipOutputStream</c> cannot produce a self-extracting archive.
+    ///   </item>
+    /// </list>
+    ///
+    /// <para>
+    ///   Be aware that the <c>ZipOutputStream</c> class implements the <see
+    ///   cref="System.IDisposable"/> interface.  In order for
+    ///   <c>ZipOutputStream</c> to produce a valid zip file, you use use it within
+    ///   a using clause (<c>Using</c> in VB), or call the <c>Dispose()</c> method
+    ///   explicitly.  See the examples for how to employ a using clause.
+    /// </para>
+    ///
+    /// <para>
+    ///   Also, a note regarding compression performance: On the desktop .NET
+    ///   Framework, DotNetZip can use a multi-threaded compression implementation
+    ///   that provides significant speed increases on large files, over 300k or so,
+    ///   at the cost of increased memory use at runtime.  (The output of the
+    ///   compression is almost exactly the same size).  But, the multi-threaded
+    ///   approach incurs a performance hit on smaller files. There's no way for the
+    ///   ZipOutputStream to know whether parallel compression will be beneficial,
+    ///   because the ZipOutputStream does not know how much data you will write
+    ///   through the stream.  You may wish to set the <see
+    ///   cref="ParallelDeflateThreshold"/> property to zero, if you are compressing
+    ///   large files through <c>ZipOutputStream</c>.  This will cause parallel
+    ///   compression to be used, always.
+    /// </para>
+    /// </remarks>
+    internal class ZipOutputStream : Stream
+    {
+        /// <summary>
+        ///   Create a ZipOutputStream, wrapping an existing stream.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   The <see cref="ZipFile"/> class is generally easier to use when creating
+        ///   zip files. The ZipOutputStream offers a different metaphor for creating a
+        ///   zip file, based on the <see cref="System.IO.Stream"/> class.
+        /// </para>
+        ///
+        /// </remarks>
+        ///
+        /// <param name="stream">
+        /// The stream to wrap. It must be writable. This stream will be closed at
+        /// the time the ZipOutputStream is closed.
+        /// </param>
+        ///
+        /// <example>
+        ///
+        ///   This example shows how to create a zip file, using the
+        ///   ZipOutputStream class.
+        ///
+        /// <code lang="C#">
+        /// private void Zipup()
+        /// {
+        ///     if (filesToZip.Count == 0)
+        ///     {
+        ///         System.Console.WriteLine("Nothing to do.");
+        ///         return;
+        ///     }
+        ///
+        ///     using (var raw = File.Open(_outputFileName, FileMode.Create, FileAccess.ReadWrite ))
+        ///     {
+        ///         using (var output= new ZipOutputStream(raw))
+        ///         {
+        ///             output.Password = "VerySecret!";
+        ///             output.Encryption = EncryptionAlgorithm.WinZipAes256;
+        ///
+        ///             foreach (string inputFileName in filesToZip)
+        ///             {
+        ///                 System.Console.WriteLine("file: {0}", inputFileName);
+        ///
+        ///                 output.PutNextEntry(inputFileName);
+        ///                 using (var input = File.Open(inputFileName, FileMode.Open, FileAccess.Read, FileShare.Read | FileShare.Write ))
+        ///                 {
+        ///                     byte[] buffer= new byte[2048];
+        ///                     int n;
+        ///                     while ((n= input.Read(buffer,0,buffer.Length)) > 0)
+        ///                     {
+        ///                         output.Write(buffer,0,n);
+        ///                     }
+        ///                 }
+        ///             }
+        ///         }
+        ///     }
+        /// }
+        /// </code>
+        ///
+        /// <code lang="VB">
+        /// Private Sub Zipup()
+        ///     Dim outputFileName As String = "XmlData.zip"
+        ///     Dim filesToZip As String() = Directory.GetFiles(".", "*.xml")
+        ///     If (filesToZip.Length = 0) Then
+        ///         Console.WriteLine("Nothing to do.")
+        ///     Else
+        ///         Using raw As FileStream = File.Open(outputFileName, FileMode.Create, FileAccess.ReadWrite)
+        ///             Using output As ZipOutputStream = New ZipOutputStream(raw)
+        ///                 output.Password = "VerySecret!"
+        ///                 output.Encryption = EncryptionAlgorithm.WinZipAes256
+        ///                 Dim inputFileName As String
+        ///                 For Each inputFileName In filesToZip
+        ///                     Console.WriteLine("file: {0}", inputFileName)
+        ///                     output.PutNextEntry(inputFileName)
+        ///                     Using input As FileStream = File.Open(inputFileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)
+        ///                         Dim n As Integer
+        ///                         Dim buffer As Byte() = New Byte(2048) {}
+        ///                         Do While (n = input.Read(buffer, 0, buffer.Length) > 0)
+        ///                             output.Write(buffer, 0, n)
+        ///                         Loop
+        ///                     End Using
+        ///                 Next
+        ///             End Using
+        ///         End Using
+        ///     End If
+        /// End Sub
+        /// </code>
+        /// </example>
+        public ZipOutputStream(Stream stream) : this(stream, false) { }
+
+
+        /// <summary>
+        ///   Create a ZipOutputStream that writes to a filesystem file.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///   The <see cref="ZipFile"/> class is generally easier to use when creating
+        ///   zip files. The ZipOutputStream offers a different metaphor for creating a
+        ///   zip file, based on the <see cref="System.IO.Stream"/> class.
+        /// </remarks>
+        ///
+        /// <param name="fileName">
+        ///   The name of the zip file to create.
+        /// </param>
+        ///
+        /// <example>
+        ///
+        ///   This example shows how to create a zip file, using the
+        ///   ZipOutputStream class.
+        ///
+        /// <code lang="C#">
+        /// private void Zipup()
+        /// {
+        ///     if (filesToZip.Count == 0)
+        ///     {
+        ///         System.Console.WriteLine("Nothing to do.");
+        ///         return;
+        ///     }
+        ///
+        ///     using (var output= new ZipOutputStream(outputFileName))
+        ///     {
+        ///         output.Password = "VerySecret!";
+        ///         output.Encryption = EncryptionAlgorithm.WinZipAes256;
+        ///
+        ///         foreach (string inputFileName in filesToZip)
+        ///         {
+        ///             System.Console.WriteLine("file: {0}", inputFileName);
+        ///
+        ///             output.PutNextEntry(inputFileName);
+        ///             using (var input = File.Open(inputFileName, FileMode.Open, FileAccess.Read,
+        ///                                          FileShare.Read | FileShare.Write ))
+        ///             {
+        ///                 byte[] buffer= new byte[2048];
+        ///                 int n;
+        ///                 while ((n= input.Read(buffer,0,buffer.Length)) > 0)
+        ///                 {
+        ///                     output.Write(buffer,0,n);
+        ///                 }
+        ///             }
+        ///         }
+        ///     }
+        /// }
+        /// </code>
+        ///
+        /// <code lang="VB">
+        /// Private Sub Zipup()
+        ///     Dim outputFileName As String = "XmlData.zip"
+        ///     Dim filesToZip As String() = Directory.GetFiles(".", "*.xml")
+        ///     If (filesToZip.Length = 0) Then
+        ///         Console.WriteLine("Nothing to do.")
+        ///     Else
+        ///         Using output As ZipOutputStream = New ZipOutputStream(outputFileName)
+        ///             output.Password = "VerySecret!"
+        ///             output.Encryption = EncryptionAlgorithm.WinZipAes256
+        ///             Dim inputFileName As String
+        ///             For Each inputFileName In filesToZip
+        ///                 Console.WriteLine("file: {0}", inputFileName)
+        ///                 output.PutNextEntry(inputFileName)
+        ///                 Using input As FileStream = File.Open(inputFileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)
+        ///                     Dim n As Integer
+        ///                     Dim buffer As Byte() = New Byte(2048) {}
+        ///                     Do While (n = input.Read(buffer, 0, buffer.Length) > 0)
+        ///                         output.Write(buffer, 0, n)
+        ///                     Loop
+        ///                 End Using
+        ///             Next
+        ///         End Using
+        ///     End If
+        /// End Sub
+        /// </code>
+        /// </example>
+        public ZipOutputStream(String fileName)
+        {
+            Stream stream = File.Open(fileName, FileMode.Create, FileAccess.ReadWrite, FileShare.None);
+            _Init(stream, false, fileName);
+        }
+
+
+        /// <summary>
+        ///   Create a ZipOutputStream.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///   See the documentation for the <see
+        ///   cref="ZipOutputStream(Stream)">ZipOutputStream(Stream)</see>
+        ///   constructor for an example.
+        /// </remarks>
+        ///
+        /// <param name="stream">
+        ///   The stream to wrap. It must be writable.
+        /// </param>
+        ///
+        /// <param name="leaveOpen">
+        ///   true if the application would like the stream
+        ///   to remain open after the <c>ZipOutputStream</c> has been closed.
+        /// </param>
+        public ZipOutputStream(Stream stream, bool leaveOpen)
+        {
+            _Init(stream, leaveOpen, null);
+        }
+
+        private void _Init(Stream stream, bool leaveOpen, string name)
+        {
+            // workitem 9307
+            _outputStream = stream.CanRead ? stream : new CountingStream(stream);
+            CompressionLevel = OfficeOpenXml.Packaging.Ionic.Zlib.CompressionLevel.Default;
+            CompressionMethod = OfficeOpenXml.Packaging.Ionic.Zip.CompressionMethod.Deflate;
+            _encryption = EncryptionAlgorithm.None;
+            _entriesWritten = new Dictionary<String, ZipEntry>(StringComparer.Ordinal);
+            _zip64 = Zip64Option.Never;
+            _leaveUnderlyingStreamOpen = leaveOpen;
+            Strategy = Ionic.Zlib.CompressionStrategy.Default;
+            _name = name ?? "(stream)";
+#if !NETCF
+            ParallelDeflateThreshold = -1L;
+#endif
+        }
+
+
+        /// <summary>Provides a string representation of the instance.</summary>
+        /// <remarks>
+        ///   <para>
+        ///     This can be useful for debugging purposes.
+        ///   </para>
+        /// </remarks>
+        /// <returns>a string representation of the instance.</returns>
+        public override String ToString()
+        {
+            return String.Format ("ZipOutputStream::{0}(leaveOpen({1})))", _name, _leaveUnderlyingStreamOpen);
+        }
+
+
+        /// <summary>
+        ///   Sets the password to be used on the <c>ZipOutputStream</c> instance.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///
+        /// <para>
+        ///   When writing a zip archive, this password is applied to the entries, not
+        ///   to the zip archive itself. It applies to any <c>ZipEntry</c> subsequently
+        ///   written to the <c>ZipOutputStream</c>.
+        /// </para>
+        ///
+        /// <para>
+        ///   Using a password does not encrypt or protect the "directory" of the
+        ///   archive - the list of entries contained in the archive.  If you set the
+        ///   <c>Password</c> property, the password actually applies to individual
+        ///   entries that are added to the archive, subsequent to the setting of this
+        ///   property.  The list of filenames in the archive that is eventually created
+        ///   will appear in clear text, but the contents of the individual files are
+        ///   encrypted.  This is how Zip encryption works.
+        /// </para>
+        ///
+        /// <para>
+        ///   If you set this property, and then add a set of entries to the archive via
+        ///   calls to <c>PutNextEntry</c>, then each entry is encrypted with that
+        ///   password.  You may also want to change the password between adding
+        ///   different entries. If you set the password, add an entry, then set the
+        ///   password to <c>null</c> (<c>Nothing</c> in VB), and add another entry, the
+        ///   first entry is encrypted and the second is not.
+        /// </para>
+        ///
+        /// <para>
+        ///   When setting the <c>Password</c>, you may also want to explicitly set the <see
+        ///   cref="Encryption"/> property, to specify how to encrypt the entries added
+        ///   to the ZipFile.  If you set the <c>Password</c> to a non-null value and do not
+        ///   set <see cref="Encryption"/>, then PKZip 2.0 ("Weak") encryption is used.
+        ///   This encryption is relatively weak but is very interoperable. If
+        ///   you set the password to a <c>null</c> value (<c>Nothing</c> in VB),
+        ///   <c>Encryption</c> is reset to None.
+        /// </para>
+        ///
+        /// <para>
+        ///   Special case: if you wrap a ZipOutputStream around a non-seekable stream,
+        ///   and use encryption, and emit an entry of zero bytes, the <c>Close()</c> or
+        ///   <c>PutNextEntry()</c> following the entry will throw an exception.
+        /// </para>
+        ///
+        /// </remarks>
+        public String Password
+        {
+            set
+            {
+                if (_disposed)
+                {
+                    _exceptionPending = true;
+                    throw new System.InvalidOperationException("The stream has been closed.");
+                }
+
+                _password = value;
+                if (_password == null)
+                {
+                    _encryption = EncryptionAlgorithm.None;
+                }
+                else if (_encryption == EncryptionAlgorithm.None)
+                {
+                    _encryption = EncryptionAlgorithm.PkzipWeak;
+                }
+            }
+        }
+
+
+        /// <summary>
+        ///   The Encryption to use for entries added to the <c>ZipOutputStream</c>.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   The specified Encryption is applied to the entries subsequently
+        ///   written to the <c>ZipOutputStream</c> instance.
+        /// </para>
+        ///
+        /// <para>
+        ///   If you set this to something other than
+        ///   EncryptionAlgorithm.None, you will also need to set the
+        ///   <see cref="Password"/> to a non-null, non-empty value in
+        ///   order to actually get encryption on the entry.
+        /// </para>
+        ///
+        /// </remarks>
+        ///
+        /// <seealso cref="Password">ZipOutputStream.Password</seealso>
+        /// <seealso cref="ZipEntry.Encryption">ZipEntry.Encryption</seealso>
+        public EncryptionAlgorithm Encryption
+        {
+            get
+            {
+                return _encryption;
+            }
+            set
+            {
+                if (_disposed)
+                {
+                    _exceptionPending = true;
+                    throw new System.InvalidOperationException("The stream has been closed.");
+                }
+                if (value == EncryptionAlgorithm.Unsupported)
+                {
+                    _exceptionPending = true;
+                    throw new InvalidOperationException("You may not set Encryption to that value.");
+                }
+                _encryption = value;
+            }
+        }
+
+
+        /// <summary>
+        ///   Size of the work buffer to use for the ZLIB codec during compression.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///   Setting this may affect performance.  For larger files, setting this to a
+        ///   larger size may improve performance, but I'm not sure.  Sorry, I don't
+        ///   currently have good recommendations on how to set it.  You can test it if
+        ///   you like.
+        /// </remarks>
+        public int CodecBufferSize
+        {
+            get;
+            set;
+        }
+
+
+        /// <summary>
+        ///   The compression strategy to use for all entries.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///   Set the Strategy used by the ZLIB-compatible compressor, when compressing
+        ///   data for the entries in the zip archive. Different compression strategies
+        ///   work better on different sorts of data. The strategy parameter can affect
+        ///   the compression ratio and the speed of compression but not the correctness
+        ///   of the compresssion.  For more information see <see
+        ///   cref="Ionic.Zlib.CompressionStrategy "/>.
+        /// </remarks>
+        public CompressionStrategy Strategy
+        {
+            get;
+            set;
+        }
+
+
+        /// <summary>
+        ///   The type of timestamp attached to the ZipEntry.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///   Set this in order to specify the kind of timestamp that should be emitted
+        ///   into the zip file for each entry.
+        /// </remarks>
+        public ZipEntryTimestamp Timestamp
+        {
+            get
+            {
+                return _timestamp;
+            }
+            set
+            {
+                if (_disposed)
+                {
+                    _exceptionPending = true;
+                    throw new System.InvalidOperationException("The stream has been closed.");
+                }
+                _timestamp = value;
+            }
+        }
+
+
+        /// <summary>
+        ///   Sets the compression level to be used for entries subsequently added to
+        ///   the zip archive.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///  <para>
+        ///    Varying the compression level used on entries can affect the
+        ///    size-vs-speed tradeoff when compression and decompressing data streams
+        ///    or files.
+        ///  </para>
+        ///
+        ///  <para>
+        ///    As with some other properties on the <c>ZipOutputStream</c> class, like <see
+        ///    cref="Password"/>, and <see cref="Encryption"/>,
+        ///    setting this property on a <c>ZipOutputStream</c>
+        ///    instance will cause the specified <c>CompressionLevel</c> to be used on all
+        ///    <see cref="ZipEntry"/> items that are subsequently added to the
+        ///    <c>ZipOutputStream</c> instance.
+        ///  </para>
+        ///
+        ///  <para>
+        ///    If you do not set this property, the default compression level is used,
+        ///    which normally gives a good balance of compression efficiency and
+        ///    compression speed.  In some tests, using <c>BestCompression</c> can
+        ///    double the time it takes to compress, while delivering just a small
+        ///    increase in compression efficiency.  This behavior will vary with the
+        ///    type of data you compress.  If you are in doubt, just leave this setting
+        ///    alone, and accept the default.
+        ///  </para>
+        /// </remarks>
+        public OfficeOpenXml.Packaging.Ionic.Zlib.CompressionLevel CompressionLevel
+        {
+            get;
+            set;
+        }
+
+        /// <summary>
+        ///   The compression method used on each entry added to the ZipOutputStream.
+        /// </summary>
+        public CompressionMethod CompressionMethod
+        {
+            get;
+            set;
+        }
+
+
+        /// <summary>
+        ///   A comment attached to the zip archive.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///
+        /// <para>
+        ///   The application sets this property to specify a comment to be embedded
+        ///   into the generated zip archive.
+        /// </para>
+        ///
+        /// <para>
+        ///   According to <see
+        ///   href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT">PKWARE's
+        ///   zip specification</see>, the comment is not encrypted, even if there is a
+        ///   password set on the zip file.
+        /// </para>
+        ///
+        /// <para>
+        ///   The specification does not describe how to indicate the encoding used
+        ///   on a comment string. Many "compliant" zip tools and libraries use
+        ///   IBM437 as the code page for comments; DotNetZip, too, follows that
+        ///   practice.  On the other hand, there are situations where you want a
+        ///   Comment to be encoded with something else, for example using code page
+        ///   950 "Big-5 Chinese". To fill that need, DotNetZip will encode the
+        ///   comment following the same procedure it follows for encoding
+        ///   filenames: (a) if <see cref="AlternateEncodingUsage"/> is
+        ///   <c>Never</c>, it uses the default encoding (IBM437). (b) if <see
+        ///   cref="AlternateEncodingUsage"/> is <c>Always</c>, it always uses the
+        ///   alternate encoding (<see cref="AlternateEncoding"/>). (c) if <see
+        ///   cref="AlternateEncodingUsage"/> is <c>AsNecessary</c>, it uses the
+        ///   alternate encoding only if the default encoding is not sufficient for
+        ///   encoding the comment - in other words if decoding the result does not
+        ///   produce the original string.  This decision is taken at the time of
+        ///   the call to <c>ZipFile.Save()</c>.
+        /// </para>
+        ///
+        /// </remarks>
+        public string Comment
+        {
+            get { return _comment; }
+            set
+            {
+                if (_disposed)
+                {
+                    _exceptionPending = true;
+                    throw new System.InvalidOperationException("The stream has been closed.");
+                }
+                _comment = value;
+            }
+        }
+
+
+
+        /// <summary>
+        ///   Specify whether to use ZIP64 extensions when saving a zip archive.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   The default value for the property is <see
+        ///   cref="Zip64Option.Never"/>. <see cref="Zip64Option.AsNecessary"/> is
+        ///   safest, in the sense that you will not get an Exception if a
+        ///   pre-ZIP64 limit is exceeded.
+        /// </para>
+        ///
+        /// <para>
+        ///   You must set this property before calling <c>Write()</c>.
+        /// </para>
+        ///
+        /// </remarks>
+        public Zip64Option EnableZip64
+        {
+            get
+            {
+                return _zip64;
+            }
+            set
+            {
+                if (_disposed)
+                {
+                    _exceptionPending = true;
+                    throw new System.InvalidOperationException("The stream has been closed.");
+                }
+                _zip64 = value;
+            }
+        }
+
+
+        /// <summary>
+        ///   Indicates whether ZIP64 extensions were used when saving the zip archive.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///   The value is defined only after the <c>ZipOutputStream</c> has been closed.
+        /// </remarks>
+        public bool OutputUsedZip64
+        {
+            get
+            {
+                return _anyEntriesUsedZip64 || _directoryNeededZip64;
+            }
+        }
+
+
+        /// <summary>
+        ///   Whether the ZipOutputStream should use case-insensitive comparisons when
+        ///   checking for uniqueness of zip entries.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///   <para>
+        ///   Though the zip specification doesn't prohibit zipfiles with duplicate
+        ///   entries, Sane zip files have no duplicates, and the DotNetZip library
+        ///   cannot create zip files with duplicate entries. If an application attempts
+        ///   to call <see cref="PutNextEntry(String)"/> with a name that duplicates one
+        ///   already used within the archive, the library will throw an Exception.
+        ///   </para>
+        ///   <para>
+        ///   This property allows the application to specify whether the
+        ///   ZipOutputStream instance considers ordinal case when checking for
+        ///   uniqueness of zip entries.
+        ///   </para>
+        /// </remarks>
+        public bool IgnoreCase
+        {
+          get
+          {
+              return !_DontIgnoreCase;
+          }
+
+          set
+          {
+              _DontIgnoreCase = !value;
+          }
+
+        }
+
+
+        /// <summary>
+        ///   Indicates whether to encode entry filenames and entry comments using
+        ///   Unicode (UTF-8).
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   <see href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT">The
+        ///   PKWare zip specification</see> provides for encoding file names and file
+        ///   comments in either the IBM437 code page, or in UTF-8.  This flag selects
+        ///   the encoding according to that specification.  By default, this flag is
+        ///   false, and filenames and comments are encoded into the zip file in the
+        ///   IBM437 codepage.  Setting this flag to true will specify that filenames
+        ///   and comments that cannot be encoded with IBM437 will be encoded with
+        ///   UTF-8.
+        /// </para>
+        ///
+        /// <para>
+        ///   Zip files created with strict adherence to the PKWare specification with
+        ///   respect to UTF-8 encoding can contain entries with filenames containing
+        ///   any combination of Unicode characters, including the full range of
+        ///   characters from Chinese, Latin, Hebrew, Greek, Cyrillic, and many other
+        ///   alphabets.  However, because at this time, the UTF-8 portion of the PKWare
+        ///   specification is not broadly supported by other zip libraries and
+        ///   utilities, such zip files may not be readable by your favorite zip tool or
+        ///   archiver. In other words, interoperability will decrease if you set this
+        ///   flag to true.
+        /// </para>
+        ///
+        /// <para>
+        ///   In particular, Zip files created with strict adherence to the PKWare
+        ///   specification with respect to UTF-8 encoding will not work well with
+        ///   Explorer in Windows XP or Windows Vista, because Windows compressed
+        ///   folders, as far as I know, do not support UTF-8 in zip files.  Vista can
+        ///   read the zip files, but shows the filenames incorrectly. Unpacking from
+        ///   Windows Vista Explorer will result in filenames that have rubbish
+        ///   characters in place of the high-order UTF-8 bytes.
+        /// </para>
+        ///
+        /// <para>
+        ///   Also, zip files that use UTF-8 encoding will not work well with Java
+        ///   applications that use the java.util.zip classes, as of v5.0 of the Java
+        ///   runtime. The Java runtime does not correctly implement the PKWare
+        ///   specification in this regard.
+        /// </para>
+        ///
+        /// <para>
+        ///   As a result, we have the unfortunate situation that "correct" behavior by
+        ///   the DotNetZip library with regard to Unicode encoding of filenames during
+        ///   zip creation will result in zip files that are readable by strictly
+        ///   compliant and current tools (for example the most recent release of the
+        ///   commercial WinZip tool); but these zip files will not be readable by
+        ///   various other tools or libraries, including Windows Explorer.
+        /// </para>
+        ///
+        /// <para>
+        ///   The DotNetZip library can read and write zip files with UTF8-encoded
+        ///   entries, according to the PKware spec.  If you use DotNetZip for both
+        ///   creating and reading the zip file, and you use UTF-8, there will be no
+        ///   loss of information in the filenames. For example, using a self-extractor
+        ///   created by this library will allow you to unpack files correctly with no
+        ///   loss of information in the filenames.
+        /// </para>
+        ///
+        /// <para>
+        ///   If you do not set this flag, it will remain false.  If this flag is false,
+        ///   the <c>ZipOutputStream</c> will encode all filenames and comments using
+        ///   the IBM437 codepage.  This can cause "loss of information" on some
+        ///   filenames, but the resulting zipfile will be more interoperable with other
+        ///   utilities. As an example of the loss of information, diacritics can be
+        ///   lost.  The o-tilde character will be down-coded to plain o.  The c with a
+        ///   cedilla (Unicode 0xE7) used in Portugese will be downcoded to a c.
+        ///   Likewise, the O-stroke character (Unicode 248), used in Danish and
+        ///   Norwegian, will be down-coded to plain o. Chinese characters cannot be
+        ///   represented in codepage IBM437; when using the default encoding, Chinese
+        ///   characters in filenames will be represented as ?. These are all examples
+        ///   of "information loss".
+        /// </para>
+        ///
+        /// <para>
+        ///   The loss of information associated to the use of the IBM437 encoding is
+        ///   inconvenient, and can also lead to runtime errors. For example, using
+        ///   IBM437, any sequence of 4 Chinese characters will be encoded as ????.  If
+        ///   your application creates a <c>ZipOutputStream</c>, does not set the
+        ///   encoding, then adds two files, each with names of four Chinese characters
+        ///   each, this will result in a duplicate filename exception.  In the case
+        ///   where you add a single file with a name containing four Chinese
+        ///   characters, the zipfile will save properly, but extracting that file
+        ///   later, with any zip tool, will result in an error, because the question
+        ///   mark is not legal for use within filenames on Windows.  These are just a
+        ///   few examples of the problems associated to loss of information.
+        /// </para>
+        ///
+        /// <para>
+        ///   This flag is independent of the encoding of the content within the entries
+        ///   in the zip file. Think of the zip file as a container - it supports an
+        ///   encoding.  Within the container are other "containers" - the file entries
+        ///   themselves.  The encoding within those entries is independent of the
+        ///   encoding of the zip archive container for those entries.
+        /// </para>
+        ///
+        /// <para>
+        ///   Rather than specify the encoding in a binary fashion using this flag, an
+        ///   application can specify an arbitrary encoding via the <see
+        ///   cref="ProvisionalAlternateEncoding"/> property.  Setting the encoding
+        ///   explicitly when creating zip archives will result in non-compliant zip
+        ///   files that, curiously, are fairly interoperable.  The challenge is, the
+        ///   PKWare specification does not provide for a way to specify that an entry
+        ///   in a zip archive uses a code page that is neither IBM437 nor UTF-8.
+        ///   Therefore if you set the encoding explicitly when creating a zip archive,
+        ///   you must take care upon reading the zip archive to use the same code page.
+        ///   If you get it wrong, the behavior is undefined and may result in incorrect
+        ///   filenames, exceptions, stomach upset, hair loss, and acne.
+        /// </para>
+        /// </remarks>
+        /// <seealso cref="ProvisionalAlternateEncoding"/>
+        [Obsolete("Beginning with v1.9.1.6 of DotNetZip, this property is obsolete. It will be removed in a future version of the library. Use AlternateEncoding and AlternateEncodingUsage instead.")]
+        public bool UseUnicodeAsNecessary
+        {
+            get
+            {
+                return (_alternateEncoding == System.Text.Encoding.UTF8) &&
+                    (AlternateEncodingUsage == ZipOption.AsNecessary);
+            }
+            set
+            {
+                if (value)
+                {
+                    _alternateEncoding = System.Text.Encoding.UTF8;
+                    _alternateEncodingUsage = ZipOption.AsNecessary;
+
+                }
+                else
+                {
+                    _alternateEncoding = Ionic.Zip.ZipOutputStream.DefaultEncoding;
+                    _alternateEncodingUsage = ZipOption.Never;
+                }
+            }
+        }
+
+
+        /// <summary>
+        ///   The text encoding to use when emitting entries into the zip archive, for
+        ///   those entries whose filenames or comments cannot be encoded with the
+        ///   default (IBM437) encoding.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   In <see href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT">its
+        ///   zip specification</see>, PKWare describes two options for encoding
+        ///   filenames and comments: using IBM437 or UTF-8.  But, some archiving tools
+        ///   or libraries do not follow the specification, and instead encode
+        ///   characters using the system default code page.  For example, WinRAR when
+        ///   run on a machine in Shanghai may encode filenames with the Big-5 Chinese
+        ///   (950) code page.  This behavior is contrary to the Zip specification, but
+        ///   it occurs anyway.
+        /// </para>
+        ///
+        /// <para>
+        ///   When using DotNetZip to write zip archives that will be read by one of
+        ///   these other archivers, set this property to specify the code page to use
+        ///   when encoding the <see cref="ZipEntry.FileName"/> and <see
+        ///   cref="ZipEntry.Comment"/> for each <c>ZipEntry</c> in the zip file, for
+        ///   values that cannot be encoded with the default codepage for zip files,
+        ///   IBM437.  This is why this property is "provisional".  In all cases, IBM437
+        ///   is used where possible, in other words, where no loss of data would
+        ///   result. It is possible, therefore, to have a given entry with a
+        ///   <c>Comment</c> encoded in IBM437 and a <c>FileName</c> encoded with the
+        ///   specified "provisional" codepage.
+        /// </para>
+        ///
+        /// <para>
+        ///   Be aware that a zip file created after you've explicitly set the
+        ///   <c>ProvisionalAlternateEncoding</c> property to a value other than
+        ///   IBM437 may not be compliant to the PKWare specification, and may not be
+        ///   readable by compliant archivers.  On the other hand, many (most?)
+        ///   archivers are non-compliant and can read zip files created in arbitrary
+        ///   code pages.  The trick is to use or specify the proper codepage when
+        ///   reading the zip.
+        /// </para>
+        ///
+        /// <para>
+        ///   When creating a zip archive using this library, it is possible to change
+        ///   the value of <c>ProvisionalAlternateEncoding</c> between each entry you
+        ///   add, and between adding entries and the call to <c>Close()</c>. Don't do
+        ///   this. It will likely result in a zipfile that is not readable.  For best
+        ///   interoperability, either leave <c>ProvisionalAlternateEncoding</c>
+        ///   alone, or specify it only once, before adding any entries to the
+        ///   <c>ZipOutputStream</c> instance.  There is one exception to this
+        ///   recommendation, described later.
+        /// </para>
+        ///
+        /// <para>
+        ///   When using an arbitrary, non-UTF8 code page for encoding, there is no
+        ///   standard way for the creator application - whether DotNetZip, WinZip,
+        ///   WinRar, or something else - to formally specify in the zip file which
+        ///   codepage has been used for the entries. As a result, readers of zip files
+        ///   are not able to inspect the zip file and determine the codepage that was
+        ///   used for the entries contained within it.  It is left to the application
+        ///   or user to determine the necessary codepage when reading zip files encoded
+        ///   this way.  If you use an incorrect codepage when reading a zipfile, you
+        ///   will get entries with filenames that are incorrect, and the incorrect
+        ///   filenames may even contain characters that are not legal for use within
+        ///   filenames in Windows. Extracting entries with illegal characters in the
+        ///   filenames will lead to exceptions. It's too bad, but this is just the way
+        ///   things are with code pages in zip files. Caveat Emptor.
+        /// </para>
+        ///
+        /// <para>
+        ///   One possible approach for specifying the code page for a given zip file is
+        ///   to describe the code page in a human-readable form in the Zip comment. For
+        ///   example, the comment may read "Entries in this archive are encoded in the
+        ///   Big5 code page".  For maximum interoperability, the zip comment in this
+        ///   case should be encoded in the default, IBM437 code page.  In this case,
+        ///   the zip comment is encoded using a different page than the filenames.  To
+        ///   do this, Specify <c>ProvisionalAlternateEncoding</c> to your desired
+        ///   region-specific code page, once before adding any entries, and then set
+        ///   the <see cref="Comment"/> property and reset
+        ///   <c>ProvisionalAlternateEncoding</c> to IBM437 before calling <c>Close()</c>.
+        /// </para>
+        /// </remarks>
+        [Obsolete("use AlternateEncoding and AlternateEncodingUsage instead.")]
+        public System.Text.Encoding ProvisionalAlternateEncoding
+        {
+            get
+            {
+                if (_alternateEncodingUsage == ZipOption.AsNecessary)
+                    return _alternateEncoding;
+                return null;
+            }
+            set
+            {
+                _alternateEncoding = value;
+                _alternateEncodingUsage = ZipOption.AsNecessary;
+            }
+        }
+
+        /// <summary>
+        ///   A Text Encoding to use when encoding the filenames and comments for
+        ///   all the ZipEntry items, during a ZipFile.Save() operation.
+        /// </summary>
+        /// <remarks>
+        ///   <para>
+        ///     Whether the encoding specified here is used during the save depends
+        ///     on <see cref="AlternateEncodingUsage"/>.
+        ///   </para>
+        /// </remarks>
+        public System.Text.Encoding AlternateEncoding
+        {
+            get
+            {
+                return _alternateEncoding;
+            }
+            set
+            {
+                _alternateEncoding = value;
+            }
+        }
+
+        /// <summary>
+        ///   A flag that tells if and when this instance should apply
+        ///   AlternateEncoding to encode the filenames and comments associated to
+        ///   of ZipEntry objects contained within this instance.
+        /// </summary>
+        public ZipOption AlternateEncodingUsage
+        {
+            get
+            {
+                return _alternateEncodingUsage;
+            }
+            set
+            {
+                _alternateEncodingUsage = value;
+            }
+        }
+
+        /// <summary>
+        /// The default text encoding used in zip archives.  It is numeric 437, also
+        /// known as IBM437.
+        /// </summary>
+        /// <seealso cref="Ionic.Zip.ZipFile.ProvisionalAlternateEncoding"/>
+        public static System.Text.Encoding DefaultEncoding
+        {
+            get
+            {
+                return System.Text.Encoding.GetEncoding("IBM437");
+            }
+        }
+
+
+#if !NETCF
+        /// <summary>
+        ///   The size threshold for an entry, above which a parallel deflate is used.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///
+        ///   <para>
+        ///     DotNetZip will use multiple threads to compress any ZipEntry, when
+        ///     the <c>CompressionMethod</c> is Deflate, and if the entry is
+        ///     larger than the given size.  Zero means "always use parallel
+        ///     deflate", while -1 means "never use parallel deflate".
+        ///   </para>
+        ///
+        ///   <para>
+        ///     If the entry size cannot be known before compression, as with any entry
+        ///     added via a ZipOutputStream, then Parallel deflate will never be
+        ///     performed, unless the value of this property is zero.
+        ///   </para>
+        ///
+        ///   <para>
+        ///     A parallel deflate operations will speed up the compression of
+        ///     large files, on computers with multiple CPUs or multiple CPU
+        ///     cores.  For files above 1mb, on a dual core or dual-cpu (2p)
+        ///     machine, the time required to compress the file can be 70% of the
+        ///     single-threaded deflate.  For very large files on 4p machines the
+        ///     compression can be done in 30% of the normal time.  The downside
+        ///     is that parallel deflate consumes extra memory during the deflate,
+        ///     and the deflation is slightly less effective.
+        ///   </para>
+        ///
+        ///   <para>
+        ///     Parallel deflate tends to not be as effective as single-threaded deflate
+        ///     because the original data stream is split into multiple independent
+        ///     buffers, each of which is compressed in parallel.  But because they are
+        ///     treated independently, there is no opportunity to share compression
+        ///     dictionaries, and additional framing bytes must be added to the output
+        ///     stream.  For that reason, a deflated stream may be slightly larger when
+        ///     compressed using parallel deflate, as compared to a traditional
+        ///     single-threaded deflate. For files of about 512k, the increase over the
+        ///     normal deflate is as much as 5% of the total compressed size. For larger
+        ///     files, the difference can be as small as 0.1%.
+        ///   </para>
+        ///
+        ///   <para>
+        ///     Multi-threaded compression does not give as much an advantage when using
+        ///     Encryption. This is primarily because encryption tends to slow down
+        ///     the entire pipeline. Also, multi-threaded compression gives less of an
+        ///     advantage when using lower compression levels, for example <see
+        ///     cref="Ionic.Zlib.CompressionLevel.BestSpeed"/>.  You may have to perform
+        ///     some tests to determine the best approach for your situation.
+        ///   </para>
+        ///
+        ///   <para>
+        ///     The default value for this property is -1, which means parallel
+        ///     compression will not be performed unless you set it to zero.
+        ///   </para>
+        ///
+        /// </remarks>
+        public long ParallelDeflateThreshold
+        {
+            set
+            {
+                if ((value != 0) && (value != -1) && (value < 64 * 1024))
+                    throw new ArgumentOutOfRangeException("value must be greater than 64k, or 0, or -1");
+                _ParallelDeflateThreshold = value;
+            }
+            get
+            {
+                return _ParallelDeflateThreshold;
+            }
+        }
+
+
+        /// <summary>
+        ///   The maximum number of buffer pairs to use when performing
+        ///   parallel compression.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   This property sets an upper limit on the number of memory
+        ///   buffer pairs to create when performing parallel
+        ///   compression.  The implementation of the parallel
+        ///   compression stream allocates multiple buffers to
+        ///   facilitate parallel compression.  As each buffer fills up,
+        ///   the stream uses <see
+        ///   cref="System.Threading.ThreadPool.QueueUserWorkItem(WaitCallback)">
+        ///   ThreadPool.QueueUserWorkItem()</see> to compress those
+        ///   buffers in a background threadpool thread. After a buffer
+        ///   is compressed, it is re-ordered and written to the output
+        ///   stream.
+        /// </para>
+        ///
+        /// <para>
+        ///   A higher number of buffer pairs enables a higher degree of
+        ///   parallelism, which tends to increase the speed of compression on
+        ///   multi-cpu computers.  On the other hand, a higher number of buffer
+        ///   pairs also implies a larger memory consumption, more active worker
+        ///   threads, and a higher cpu utilization for any compression. This
+        ///   property enables the application to limit its memory consumption and
+        ///   CPU utilization behavior depending on requirements.
+        /// </para>
+        ///
+        /// <para>
+        ///   For each compression "task" that occurs in parallel, there are 2
+        ///   buffers allocated: one for input and one for output.  This property
+        ///   sets a limit for the number of pairs.  The total amount of storage
+        ///   space allocated for buffering will then be (N*S*2), where N is the
+        ///   number of buffer pairs, S is the size of each buffer (<see
+        ///   cref="CodecBufferSize"/>).  By default, DotNetZip allocates 4 buffer
+        ///   pairs per CPU core, so if your machine has 4 cores, and you retain
+        ///   the default buffer size of 128k, then the
+        ///   ParallelDeflateOutputStream will use 4 * 4 * 2 * 128kb of buffer
+        ///   memory in total, or 4mb, in blocks of 128kb.  If you then set this
+        ///   property to 8, then the number will be 8 * 2 * 128kb of buffer
+        ///   memory, or 2mb.
+        /// </para>
+        ///
+        /// <para>
+        ///   CPU utilization will also go up with additional buffers, because a
+        ///   larger number of buffer pairs allows a larger number of background
+        ///   threads to compress in parallel. If you find that parallel
+        ///   compression is consuming too much memory or CPU, you can adjust this
+        ///   value downward.
+        /// </para>
+        ///
+        /// <para>
+        ///   The default value is 16. Different values may deliver better or
+        ///   worse results, depending on your priorities and the dynamic
+        ///   performance characteristics of your storage and compute resources.
+        /// </para>
+        ///
+        /// <para>
+        ///   This property is not the number of buffer pairs to use; it is an
+        ///   upper limit. An illustration: Suppose you have an application that
+        ///   uses the default value of this property (which is 16), and it runs
+        ///   on a machine with 2 CPU cores. In that case, DotNetZip will allocate
+        ///   4 buffer pairs per CPU core, for a total of 8 pairs.  The upper
+        ///   limit specified by this property has no effect.
+        /// </para>
+        ///
+        /// <para>
+        ///   The application can set this value at any time, but it is
+        ///   effective only if set before calling
+        ///   <c>ZipOutputStream.Write()</c> for the first time.
+        /// </para>
+        /// </remarks>
+        ///
+        /// <seealso cref="ParallelDeflateThreshold"/>
+        ///
+        public int ParallelDeflateMaxBufferPairs
+        {
+            get
+            {
+                return _maxBufferPairs;
+            }
+            set
+            {
+                if (value < 4)
+                    throw new ArgumentOutOfRangeException("ParallelDeflateMaxBufferPairs",
+                                                "Value must be 4 or greater.");
+                _maxBufferPairs = value;
+            }
+        }
+#endif
+
+
+        private void InsureUniqueEntry(ZipEntry ze1)
+        {
+            if (_entriesWritten.ContainsKey(ze1.FileName))
+            {
+                _exceptionPending = true;
+                throw new ArgumentException(String.Format("The entry '{0}' already exists in the zip archive.", ze1.FileName));
+            }
+        }
+
+
+        internal Stream OutputStream
+        {
+            get
+            {
+                return _outputStream;
+            }
+        }
+
+        internal String Name
+        {
+            get
+            {
+                return _name;
+            }
+        }
+
+        /// <summary>
+        ///   Returns true if an entry by the given name has already been written
+        ///   to the ZipOutputStream.
+        /// </summary>
+        ///
+        /// <param name="name">
+        ///   The name of the entry to scan for.
+        /// </param>
+        ///
+        /// <returns>
+        /// true if an entry by the given name has already been written.
+        /// </returns>
+        public bool ContainsEntry(string name)
+        {
+            return _entriesWritten.ContainsKey(SharedUtilities.NormalizePathForUseInZipFile(name));
+        }
+
+
+        /// <summary>
+        ///   Write the data from the buffer to the stream.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///   As the application writes data into this stream, the data may be
+        ///   compressed and encrypted before being written out to the underlying
+        ///   stream, depending on the settings of the <see cref="CompressionLevel"/>
+        ///   and the <see cref="Encryption"/> properties.
+        /// </remarks>
+        ///
+        /// <param name="buffer">The buffer holding data to write to the stream.</param>
+        /// <param name="offset">the offset within that data array to find the first byte to write.</param>
+        /// <param name="count">the number of bytes to write.</param>
+        public override void Write(byte[] buffer, int offset, int count)
+        {
+            if (_disposed)
+            {
+                _exceptionPending = true;
+                throw new System.InvalidOperationException("The stream has been closed.");
+            }
+
+            if (buffer==null)
+            {
+                _exceptionPending = true;
+                throw new System.ArgumentNullException("buffer");
+            }
+
+            if (_currentEntry == null)
+            {
+                _exceptionPending = true;
+                throw new System.InvalidOperationException("You must call PutNextEntry() before calling Write().");
+            }
+
+            if (_currentEntry.IsDirectory)
+            {
+                _exceptionPending = true;
+                throw new System.InvalidOperationException("You cannot Write() data for an entry that is a directory.");
+            }
+
+            if (_needToWriteEntryHeader)
+                _InitiateCurrentEntry(false);
+
+            if (count != 0)
+                _entryOutputStream.Write(buffer, offset, count);
+        }
+
+
+
+        /// <summary>
+        ///   Specify the name of the next entry that will be written to the zip file.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   Call this method just before calling <see cref="Write(byte[], int, int)"/>, to
+        ///   specify the name of the entry that the next set of bytes written to
+        ///   the <c>ZipOutputStream</c> belongs to. All subsequent calls to <c>Write</c>,
+        ///   until the next call to <c>PutNextEntry</c>,
+        ///   will be inserted into the named entry in the zip file.
+        /// </para>
+        ///
+        /// <para>
+        ///   If the <paramref name="entryName"/> used in <c>PutNextEntry()</c> ends in
+        ///   a slash, then the entry added is marked as a directory. Because directory
+        ///   entries do not contain data, a call to <c>Write()</c>, before an
+        ///   intervening additional call to <c>PutNextEntry()</c>, will throw an
+        ///   exception.
+        /// </para>
+        ///
+        /// <para>
+        ///   If you don't call <c>Write()</c> between two calls to
+        ///   <c>PutNextEntry()</c>, the first entry is inserted into the zip file as a
+        ///   file of zero size.  This may be what you want.
+        /// </para>
+        ///
+        /// <para>
+        ///   Because <c>PutNextEntry()</c> closes out the prior entry, if any, this
+        ///   method may throw if there is a problem with the prior entry.
+        /// </para>
+        ///
+        /// <para>
+        ///   This method returns the <c>ZipEntry</c>.  You can modify public properties
+        ///   on the <c>ZipEntry</c>, such as <see cref="ZipEntry.Encryption"/>, <see
+        ///   cref="ZipEntry.Password"/>, and so on, until the first call to
+        ///   <c>ZipOutputStream.Write()</c>, or until the next call to
+        ///   <c>PutNextEntry()</c>.  If you modify the <c>ZipEntry</c> <em>after</em>
+        ///   having called <c>Write()</c>, you may get a runtime exception, or you may
+        ///   silently get an invalid zip archive.
+        /// </para>
+        ///
+        /// </remarks>
+        ///
+        /// <example>
+        ///
+        ///   This example shows how to create a zip file, using the
+        ///   <c>ZipOutputStream</c> class.
+        ///
+        /// <code>
+        /// private void Zipup()
+        /// {
+        ///     using (FileStream fs raw = File.Open(_outputFileName, FileMode.Create, FileAccess.ReadWrite ))
+        ///     {
+        ///         using (var output= new ZipOutputStream(fs))
+        ///         {
+        ///             output.Password = "VerySecret!";
+        ///             output.Encryption = EncryptionAlgorithm.WinZipAes256;
+        ///             output.PutNextEntry("entry1.txt");
+        ///             byte[] buffer= System.Text.Encoding.ASCII.GetBytes("This is the content for entry #1.");
+        ///             output.Write(buffer,0,buffer.Length);
+        ///             output.PutNextEntry("entry2.txt");  // this will be zero length
+        ///             output.PutNextEntry("entry3.txt");
+        ///             buffer= System.Text.Encoding.ASCII.GetBytes("This is the content for entry #3.");
+        ///             output.Write(buffer,0,buffer.Length);
+        ///         }
+        ///     }
+        /// }
+        /// </code>
+        /// </example>
+        ///
+        /// <param name="entryName">
+        ///   The name of the entry to be added, including any path to be used
+        ///   within the zip file.
+        /// </param>
+        ///
+        /// <returns>
+        ///   The ZipEntry created.
+        /// </returns>
+        ///
+        public ZipEntry PutNextEntry(String entryName)
+        {
+            if (String.IsNullOrEmpty(entryName))
+                throw new ArgumentNullException("entryName");
+
+            if (_disposed)
+            {
+                _exceptionPending = true;
+                throw new System.InvalidOperationException("The stream has been closed.");
+            }
+
+            _FinishCurrentEntry();
+            _currentEntry = ZipEntry.CreateForZipOutputStream(entryName);
+            _currentEntry._container = new ZipContainer(this);
+            _currentEntry._BitField |= 0x0008;  // workitem 8932
+            _currentEntry.SetEntryTimes(DateTime.Now, DateTime.Now, DateTime.Now);
+            _currentEntry.CompressionLevel = this.CompressionLevel;
+            _currentEntry.CompressionMethod = this.CompressionMethod;
+            _currentEntry.Password = _password; // workitem 13909
+            _currentEntry.Encryption = this.Encryption;
+            // workitem 12634
+            _currentEntry.AlternateEncoding = this.AlternateEncoding;
+            _currentEntry.AlternateEncodingUsage = this.AlternateEncodingUsage;
+
+            if (entryName.EndsWith("/"))  _currentEntry.MarkAsDirectory();
+
+            _currentEntry.EmitTimesInWindowsFormatWhenSaving = ((_timestamp & ZipEntryTimestamp.Windows) != 0);
+            _currentEntry.EmitTimesInUnixFormatWhenSaving = ((_timestamp & ZipEntryTimestamp.Unix) != 0);
+            InsureUniqueEntry(_currentEntry);
+            _needToWriteEntryHeader = true;
+
+            return _currentEntry;
+        }
+
+
+
+        private void _InitiateCurrentEntry(bool finishing)
+        {
+            // If finishing==true, this means we're initiating the entry at the time of
+            // Close() or PutNextEntry().  If this happens, it means no data was written
+            // for the entry - Write() was never called.  (The usual case us to call
+            // _InitiateCurrentEntry(bool) from within Write().)  If finishing==true,
+            // the entry could be either a zero-byte file or a directory.
+
+            _entriesWritten.Add(_currentEntry.FileName,_currentEntry);
+            _entryCount++; // could use _entriesWritten.Count, but I don't want to incur
+            // the cost.
+
+            if (_entryCount > 65534 && _zip64 == Zip64Option.Never)
+            {
+                _exceptionPending = true;
+                throw new System.InvalidOperationException("Too many entries. Consider setting ZipOutputStream.EnableZip64.");
+            }
+
+            // Write out the header.
+            //
+            // If finishing, and encryption is in use, then we don't want to emit the
+            // normal encryption header.  Signal that with a cycle=99 to turn off
+            // encryption for zero-byte entries or directories.
+            //
+            // If finishing, then we know the stream length is zero.  Else, unknown
+            // stream length.  Passing stream length == 0 allows an optimization so as
+            // not to setup an encryption or deflation stream, when stream length is
+            // zero.
+
+            _currentEntry.WriteHeader(_outputStream, finishing ? 99 : 0);
+            _currentEntry.StoreRelativeOffset();
+
+            if (!_currentEntry.IsDirectory)
+            {
+                _currentEntry.WriteSecurityMetadata(_outputStream);
+                _currentEntry.PrepOutputStream(_outputStream,
+                                               finishing ? 0 : -1,
+                                               out _outputCounter,
+                                               out _encryptor,
+                                               out _deflater,
+                                               out _entryOutputStream);
+            }
+            _needToWriteEntryHeader = false;
+        }
+
+
+
+        private void _FinishCurrentEntry()
+        {
+            if (_currentEntry != null)
+            {
+                if (_needToWriteEntryHeader)
+                    _InitiateCurrentEntry(true); // an empty entry - no writes
+
+                _currentEntry.FinishOutputStream(_outputStream, _outputCounter, _encryptor, _deflater, _entryOutputStream);
+                _currentEntry.PostProcessOutput(_outputStream);
+                // workitem 12964
+                if (_currentEntry.OutputUsedZip64!=null)
+                    _anyEntriesUsedZip64 |= _currentEntry.OutputUsedZip64.Value;
+
+                // reset all the streams
+                _outputCounter = null; _encryptor = _deflater = null; _entryOutputStream = null;
+            }
+        }
+
+
+
+        /// <summary>
+        /// Dispose the stream
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   This method writes the Zip Central directory, then closes the stream.  The
+        ///   application must call Dispose() (or Close) in order to produce a valid zip file.
+        /// </para>
+        ///
+        /// <para>
+        ///   Typically the application will call <c>Dispose()</c> implicitly, via a <c>using</c>
+        ///   statement in C#, or a <c>Using</c> statement in VB.
+        /// </para>
+        ///
+        /// </remarks>
+        ///
+        /// <param name="disposing">set this to true, always.</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (_disposed) return;
+
+            if (disposing) // not called from finalizer
+            {
+                // handle pending exceptions
+                if (!_exceptionPending)
+                {
+                    _FinishCurrentEntry();
+                    _directoryNeededZip64 = ZipOutput.WriteCentralDirectoryStructure(_outputStream,
+                                                                                     _entriesWritten.Values,
+                                                                                     1, // _numberOfSegmentsForMostRecentSave,
+                                                                                     _zip64,
+                                                                                     Comment,
+                                                                                     new ZipContainer(this));
+                    Stream wrappedStream = null;
+                    CountingStream cs = _outputStream as CountingStream;
+                    if (cs != null)
+                    {
+                        wrappedStream = cs.WrappedStream;
+#if NETCF
+                    cs.Close();
+#else
+                        cs.Dispose();
+#endif
+                    }
+                    else
+                    {
+                        wrappedStream = _outputStream;
+                    }
+
+                    if (!_leaveUnderlyingStreamOpen)
+                    {
+#if NETCF
+                    wrappedStream.Close();
+#else
+                        wrappedStream.Dispose();
+#endif
+                    }
+                    _outputStream = null;
+                }
+            }
+            _disposed = true;
+        }
+
+
+
+        /// <summary>
+        /// Always returns false.
+        /// </summary>
+        public override bool CanRead { get { return false; } }
+
+        /// <summary>
+        /// Always returns false.
+        /// </summary>
+        public override bool CanSeek { get { return false; } }
+
+        /// <summary>
+        /// Always returns true.
+        /// </summary>
+        public override bool CanWrite { get { return true; } }
+
+        /// <summary>
+        /// Always returns a NotSupportedException.
+        /// </summary>
+        public override long Length { get { throw new NotSupportedException(); } }
+
+        /// <summary>
+        /// Setting this property always returns a NotSupportedException. Getting it
+        /// returns the value of the Position on the underlying stream.
+        /// </summary>
+        public override long Position
+        {
+            get { return _outputStream.Position; }
+            set { throw new NotSupportedException(); }
+        }
+
+        /// <summary>
+        /// This is a no-op.
+        /// </summary>
+        public override void Flush() { }
+
+        /// <summary>
+        /// This method always throws a NotSupportedException.
+        /// </summary>
+        /// <param name="buffer">ignored</param>
+        /// <param name="offset">ignored</param>
+        /// <param name="count">ignored</param>
+        /// <returns>nothing</returns>
+        public override int Read(byte[] buffer, int offset, int count)
+        {
+            throw new NotSupportedException("Read");
+        }
+
+        /// <summary>
+        /// This method always throws a NotSupportedException.
+        /// </summary>
+        /// <param name="offset">ignored</param>
+        /// <param name="origin">ignored</param>
+        /// <returns>nothing</returns>
+        public override long Seek(long offset, SeekOrigin origin)
+        {
+            throw new NotSupportedException("Seek");
+        }
+
+        /// <summary>
+        /// This method always throws a NotSupportedException.
+        /// </summary>
+        /// <param name="value">ignored</param>
+        public override void SetLength(long value)
+        {
+            throw new NotSupportedException();
+        }
+
+
+        private EncryptionAlgorithm _encryption;
+        private ZipEntryTimestamp _timestamp;
+        internal String _password;
+        private String _comment;
+        private Stream _outputStream;
+        private ZipEntry _currentEntry;
+        internal Zip64Option _zip64;
+        private Dictionary<String, ZipEntry> _entriesWritten;
+        private int _entryCount;
+        private ZipOption _alternateEncodingUsage = ZipOption.Never;
+        private System.Text.Encoding _alternateEncoding
+            = System.Text.Encoding.GetEncoding("IBM437"); // default = IBM437
+
+        private bool _leaveUnderlyingStreamOpen;
+        private bool _disposed;
+        private bool _exceptionPending; // **see note below
+        private bool _anyEntriesUsedZip64, _directoryNeededZip64;
+        private CountingStream _outputCounter;
+        private Stream _encryptor;
+        private Stream _deflater;
+        private Ionic.Crc.CrcCalculatorStream _entryOutputStream;
+        private bool _needToWriteEntryHeader;
+        private string _name;
+        private bool _DontIgnoreCase;
+#if !NETCF
+        internal ParallelDeflateOutputStream ParallelDeflater;
+        private long _ParallelDeflateThreshold;
+        private int _maxBufferPairs = 16;
+#endif
+
+        // **Note regarding exceptions:
+
+        // When ZipOutputStream is employed within a using clause, which
+        // is the typical scenario, and an exception is thrown within
+        // the scope of the using, Close()/Dispose() is invoked
+        // implicitly before processing the initial exception.  In that
+        // case, _exceptionPending is true, and we don't want to try to
+        // write anything in the Close/Dispose logic.  Doing so can
+        // cause additional exceptions that mask the original one. So,
+        // the _exceptionPending flag is used to track that, and to
+        // allow the original exception to be propagated to the
+        // application without extra "noise."
+
+    }
+
+
+
+    internal class ZipContainer
+    {
+        private ZipFile _zf;
+        private ZipOutputStream _zos;
+        private ZipInputStream _zis;
+
+        public ZipContainer(Object o)
+        {
+            _zf = (o as ZipFile);
+            _zos = (o as ZipOutputStream);
+            _zis = (o as ZipInputStream);
+        }
+
+        public ZipFile ZipFile
+        {
+            get { return _zf; }
+        }
+
+        public ZipOutputStream ZipOutputStream
+        {
+            get { return _zos; }
+        }
+
+        public string Name
+        {
+            get
+            {
+                if (_zf != null) return _zf.Name;
+                if (_zis != null) throw new NotSupportedException();
+                return _zos.Name;
+            }
+        }
+
+        public string Password
+        {
+            get
+            {
+                if (_zf != null) return _zf._Password;
+                if (_zis != null) return _zis._Password;
+                return _zos._password;
+            }
+        }
+
+        public Zip64Option Zip64
+        {
+            get
+            {
+                if (_zf != null) return _zf._zip64;
+                if (_zis != null) throw new NotSupportedException();
+                return _zos._zip64;
+            }
+        }
+
+        public int BufferSize
+        {
+            get
+            {
+                if (_zf != null) return _zf.BufferSize;
+                if (_zis != null) throw new NotSupportedException();
+                return 0;
+            }
+        }
+
+#if !NETCF
+        public Ionic.Zlib.ParallelDeflateOutputStream ParallelDeflater
+        {
+            get
+            {
+                if (_zf != null) return _zf.ParallelDeflater;
+                if (_zis != null) return null;
+                return _zos.ParallelDeflater;
+            }
+            set
+            {
+                if (_zf != null) _zf.ParallelDeflater = value;
+                else if (_zos != null) _zos.ParallelDeflater = value;
+            }
+        }
+
+        public long ParallelDeflateThreshold
+        {
+            get
+            {
+                if (_zf != null) return _zf.ParallelDeflateThreshold;
+                return _zos.ParallelDeflateThreshold;
+            }
+        }
+        public int ParallelDeflateMaxBufferPairs
+        {
+            get
+            {
+                if (_zf != null) return _zf.ParallelDeflateMaxBufferPairs;
+                return _zos.ParallelDeflateMaxBufferPairs;
+            }
+        }
+#endif
+
+        public int CodecBufferSize
+        {
+            get
+            {
+                if (_zf != null) return _zf.CodecBufferSize;
+                if (_zis != null) return _zis.CodecBufferSize;
+                return _zos.CodecBufferSize;
+            }
+        }
+
+        public Ionic.Zlib.CompressionStrategy Strategy
+        {
+            get
+            {
+                if (_zf != null) return _zf.Strategy;
+                return _zos.Strategy;
+            }
+        }
+
+        public Zip64Option UseZip64WhenSaving
+        {
+            get
+            {
+                if (_zf != null) return _zf.UseZip64WhenSaving;
+                return _zos.EnableZip64;
+            }
+        }
+
+        public System.Text.Encoding AlternateEncoding
+        {
+            get
+            {
+                if (_zf != null) return _zf.AlternateEncoding;
+                if (_zos!=null) return _zos.AlternateEncoding;
+                return null;
+            }
+        }
+        public System.Text.Encoding DefaultEncoding
+        {
+            get
+            {
+                if (_zf != null) return ZipFile.DefaultEncoding;
+                if (_zos!=null) return ZipOutputStream.DefaultEncoding;
+                return null;
+            }
+        }
+        public ZipOption AlternateEncodingUsage
+        {
+            get
+            {
+                if (_zf != null) return _zf.AlternateEncodingUsage;
+                if (_zos!=null) return _zos.AlternateEncodingUsage;
+                return ZipOption.Never; // n/a
+            }
+        }
+
+        public Stream ReadStream
+        {
+            get
+            {
+                if (_zf != null) return _zf.ReadStream;
+                return _zis.ReadStream;
+            }
+        }
+    }
+
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ZipSegmentedStream.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ZipSegmentedStream.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/ZipSegmentedStream.cs	(revision 12707)
@@ -0,0 +1,571 @@
+// ZipSegmentedStream.cs
+// ------------------------------------------------------------------
+//
+// Copyright (c) 2009-2011 Dino Chiesa.
+// All rights reserved.
+//
+// This code module is part of DotNetZip, a zipfile class library.
+//
+// ------------------------------------------------------------------
+//
+// This code is licensed under the Microsoft Public License.
+// See the file License.txt for the license details.
+// More info on: http://dotnetzip.codeplex.com
+//
+// ------------------------------------------------------------------
+//
+// last saved (in emacs):
+// Time-stamp: <2011-July-13 22:25:45>
+//
+// ------------------------------------------------------------------
+//
+// This module defines logic for zip streams that span disk files.
+//
+// ------------------------------------------------------------------
+
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+
+namespace OfficeOpenXml.Packaging.Ionic.Zip
+{
+    internal class ZipSegmentedStream : System.IO.Stream
+    {
+        enum RwMode
+        {
+            None = 0,
+            ReadOnly = 1,
+            Write = 2,
+            //Update = 3
+        }
+
+        private RwMode rwMode;
+        private bool _exceptionPending; // **see note below
+        private string _baseName;
+        private string _baseDir;
+        //private bool _isDisposed;
+        private string _currentName;
+        private string _currentTempName;
+        private uint _currentDiskNumber;
+        private uint _maxDiskNumber;
+        private int _maxSegmentSize;
+        private System.IO.Stream _innerStream;
+
+        // **Note regarding exceptions:
+        //
+        // When ZipSegmentedStream is employed within a using clause,
+        // which is the typical scenario, and an exception is thrown
+        // within the scope of the using, Dispose() is invoked
+        // implicitly before processing the initial exception.  If that
+        // happens, this class sets _exceptionPending to true, and then
+        // within the Dispose(bool), takes special action as
+        // appropriate. Need to be careful: any additional exceptions
+        // will mask the original one.
+
+        private ZipSegmentedStream() : base()
+        {
+            _exceptionPending = false;
+        }
+
+        public static ZipSegmentedStream ForReading(string name,
+                                                    uint initialDiskNumber,
+                                                    uint maxDiskNumber)
+        {
+            ZipSegmentedStream zss = new ZipSegmentedStream()
+                {
+                    rwMode = RwMode.ReadOnly,
+                    CurrentSegment = initialDiskNumber,
+                    _maxDiskNumber = maxDiskNumber,
+                    _baseName = name,
+                };
+
+            // Console.WriteLine("ZSS: ForReading ({0})",
+            //                    Path.GetFileName(zss.CurrentName));
+
+            zss._SetReadStream();
+
+            return zss;
+        }
+
+
+        public static ZipSegmentedStream ForWriting(string name, int maxSegmentSize)
+        {
+            ZipSegmentedStream zss = new ZipSegmentedStream()
+                {
+                    rwMode = RwMode.Write,
+                    CurrentSegment = 0,
+                    _baseName = name,
+                    _maxSegmentSize = maxSegmentSize,
+                    _baseDir = Path.GetDirectoryName(name)
+                };
+
+            // workitem 9522
+            if (zss._baseDir=="") zss._baseDir=".";
+
+            zss._SetWriteStream(0);
+
+            // Console.WriteLine("ZSS: ForWriting ({0})",
+            //                    Path.GetFileName(zss.CurrentName));
+
+            return zss;
+        }
+
+
+        /// <summary>
+        ///   Sort-of like a factory method, ForUpdate is used only when
+        ///   the application needs to update the zip entry metadata for
+        ///   a segmented zip file, when the starting segment is earlier
+        ///   than the ending segment, for a particular entry.
+        /// </summary>
+        /// <remarks>
+        ///   <para>
+        ///     The update is always contiguous, never rolls over.  As a
+        ///     result, this method doesn't need to return a ZSS; it can
+        ///     simply return a FileStream.  That's why it's "sort of"
+        ///     like a Factory method.
+        ///   </para>
+        ///   <para>
+        ///     Caller must Close/Dispose the stream object returned by
+        ///     this method.
+        ///   </para>
+        /// </remarks>
+        public static Stream ForUpdate(string name, uint diskNumber)
+        {
+            if (diskNumber >= 99)
+                throw new ArgumentOutOfRangeException("diskNumber");
+
+            string fname =
+                String.Format("{0}.z{1:D2}",
+                                 Path.Combine(Path.GetDirectoryName(name),
+                                              Path.GetFileNameWithoutExtension(name)),
+                                 diskNumber + 1);
+
+            // Console.WriteLine("ZSS: ForUpdate ({0})",
+            //                   Path.GetFileName(fname));
+
+            // This class assumes that the update will not expand the
+            // size of the segment. Update is used only for an in-place
+            // update of zip metadata. It never will try to write beyond
+            // the end of a segment.
+
+            return File.Open(fname,
+                             FileMode.Open,
+                             FileAccess.ReadWrite,
+                             FileShare.None);
+        }
+
+        public bool ContiguousWrite
+        {
+            get;
+            set;
+        }
+
+
+        public UInt32 CurrentSegment
+        {
+            get
+            {
+                return _currentDiskNumber;
+            }
+            private set
+            {
+                _currentDiskNumber = value;
+                _currentName = null; // it will get updated next time referenced
+            }
+        }
+
+        /// <summary>
+        ///   Name of the filesystem file corresponding to the current segment.
+        /// </summary>
+        /// <remarks>
+        ///   <para>
+        ///     The name is not always the name currently being used in the
+        ///     filesystem.  When rwMode is RwMode.Write, the filesystem file has a
+        ///     temporary name until the stream is closed or until the next segment is
+        ///     started.
+        ///   </para>
+        /// </remarks>
+        public String CurrentName
+        {
+            get
+            {
+                if (_currentName==null)
+                    _currentName = _NameForSegment(CurrentSegment);
+
+                return _currentName;
+            }
+        }
+
+
+        public String CurrentTempName
+        {
+            get
+            {
+                return _currentTempName;
+            }
+        }
+
+        private string _NameForSegment(uint diskNumber)
+        {
+            if (diskNumber >= 99)
+            {
+                _exceptionPending = true;
+                throw new OverflowException("The number of zip segments would exceed 99.");
+            }
+
+            return String.Format("{0}.z{1:D2}",
+                                 Path.Combine(Path.GetDirectoryName(_baseName),
+                                              Path.GetFileNameWithoutExtension(_baseName)),
+                                 diskNumber + 1);
+        }
+
+
+        // Returns the segment that WILL be current if writing
+        // a block of the given length.
+        // This isn't exactly true. It could roll over beyond
+        // this number.
+        public UInt32 ComputeSegment(int length)
+        {
+            if (_innerStream.Position + length > _maxSegmentSize)
+                // the block will go AT LEAST into the next segment
+                return CurrentSegment + 1;
+
+            // it will fit in the current segment
+            return CurrentSegment;
+        }
+
+
+        public override String ToString()
+        {
+            return String.Format("{0}[{1}][{2}], pos=0x{3:X})",
+                                 "ZipSegmentedStream", CurrentName,
+                                 rwMode.ToString(),
+                                 this.Position);
+        }
+
+
+        private void _SetReadStream()
+        {
+            if (_innerStream != null)
+            {
+#if NETCF
+                _innerStream.Close();
+#else
+                _innerStream.Dispose();
+#endif
+            }
+
+            if (CurrentSegment + 1 == _maxDiskNumber)
+                _currentName = _baseName;
+
+            // Console.WriteLine("ZSS: SRS ({0})",
+            //                   Path.GetFileName(CurrentName));
+
+            _innerStream = File.OpenRead(CurrentName);
+        }
+
+
+        /// <summary>
+        /// Read from the stream
+        /// </summary>
+        /// <param name="buffer">the buffer to read</param>
+        /// <param name="offset">the offset at which to start</param>
+        /// <param name="count">the number of bytes to read</param>
+        /// <returns>the number of bytes actually read</returns>
+        public override int Read(byte[] buffer, int offset, int count)
+        {
+            if (rwMode != RwMode.ReadOnly)
+            {
+                _exceptionPending = true;
+                throw new InvalidOperationException("Stream Error: Cannot Read.");
+            }
+
+            int r = _innerStream.Read(buffer, offset, count);
+            int r1 = r;
+
+            while (r1 != count)
+            {
+                if (_innerStream.Position != _innerStream.Length)
+                {
+                    _exceptionPending = true;
+                    throw new ZipException(String.Format("Read error in file {0}", CurrentName));
+
+                }
+
+                if (CurrentSegment + 1 == _maxDiskNumber)
+                    return r; // no more to read
+
+                CurrentSegment++;
+                _SetReadStream();
+                offset += r1;
+                count -= r1;
+                r1 = _innerStream.Read(buffer, offset, count);
+                r += r1;
+            }
+            return r;
+        }
+
+
+
+        private void _SetWriteStream(uint increment)
+        {
+            if (_innerStream != null)
+            {
+#if NETCF
+                _innerStream.Close();
+#else
+                _innerStream.Dispose();
+#endif
+                if (File.Exists(CurrentName))
+                    File.Delete(CurrentName);
+                File.Move(_currentTempName, CurrentName);
+                // Console.WriteLine("ZSS: SWS close ({0})",
+                //                   Path.GetFileName(CurrentName));
+            }
+
+            if (increment > 0)
+                CurrentSegment += increment;
+
+            SharedUtilities.CreateAndOpenUniqueTempFile(_baseDir,
+                                                        out _innerStream,
+                                                        out _currentTempName);
+
+            // Console.WriteLine("ZSS: SWS open ({0})",
+            //                   Path.GetFileName(_currentTempName));
+
+            if (CurrentSegment == 0)
+                _innerStream.Write(BitConverter.GetBytes(ZipConstants.SplitArchiveSignature), 0, 4);
+        }
+
+
+        /// <summary>
+        /// Write to the stream.
+        /// </summary>
+        /// <param name="buffer">the buffer from which to write</param>
+        /// <param name="offset">the offset at which to start writing</param>
+        /// <param name="count">the number of bytes to write</param>
+        public override void Write(byte[] buffer, int offset, int count)
+        {
+            if (rwMode != RwMode.Write)
+            {
+                _exceptionPending = true;
+                throw new InvalidOperationException("Stream Error: Cannot Write.");
+            }
+
+
+            if (ContiguousWrite)
+            {
+                // enough space for a contiguous write?
+                if (_innerStream.Position + count > _maxSegmentSize)
+                    _SetWriteStream(1);
+            }
+            else
+            {
+                while (_innerStream.Position + count > _maxSegmentSize)
+                {
+                    int c = unchecked(_maxSegmentSize - (int)_innerStream.Position);
+                    _innerStream.Write(buffer, offset, c);
+                    _SetWriteStream(1);
+                    count -= c;
+                    offset += c;
+                }
+            }
+
+            _innerStream.Write(buffer, offset, count);
+        }
+
+
+        public long TruncateBackward(uint diskNumber, long offset)
+        {
+            // Console.WriteLine("***ZSS.Trunc to disk {0}", diskNumber);
+            // Console.WriteLine("***ZSS.Trunc:  current disk {0}", CurrentSegment);
+            if (diskNumber >= 99)
+                throw new ArgumentOutOfRangeException("diskNumber");
+
+            if (rwMode != RwMode.Write)
+            {
+                _exceptionPending = true;
+                throw new ZipException("bad state.");
+            }
+
+            // Seek back in the segmented stream to a (maybe) prior segment.
+
+            // Check if it is the same segment.  If it is, very simple.
+            if (diskNumber == CurrentSegment)
+            {
+                var x =_innerStream.Seek(offset, SeekOrigin.Begin);
+                // workitem 10178
+                Ionic.Zip.SharedUtilities.Workaround_Ladybug318918(_innerStream);
+                return x;
+            }
+
+            // Seeking back to a prior segment.
+            // The current segment and any intervening segments must be removed.
+            // First, close the current segment, and then remove it.
+            if (_innerStream != null)
+            {
+#if NETCF
+                _innerStream.Close();
+#else
+                _innerStream.Dispose();
+#endif
+                if (File.Exists(_currentTempName))
+                    File.Delete(_currentTempName);
+            }
+
+            // Now, remove intervening segments.
+            for (uint j= CurrentSegment-1; j > diskNumber; j--)
+            {
+                string s = _NameForSegment(j);
+                // Console.WriteLine("***ZSS.Trunc:  removing file {0}", s);
+                if (File.Exists(s))
+                    File.Delete(s);
+            }
+
+            // now, open the desired segment.  It must exist.
+            CurrentSegment = diskNumber;
+
+            // get a new temp file, try 3 times:
+            for (int i = 0; i < 3; i++)
+            {
+                try
+                {
+                    _currentTempName = SharedUtilities.InternalGetTempFileName();
+                    // move the .z0x file back to a temp name
+                    File.Move(CurrentName, _currentTempName);
+                    break; // workitem 12403
+                }
+                catch(IOException)
+                {
+                    if (i == 2) throw;
+                }
+            }
+
+            // open it
+            _innerStream = new FileStream(_currentTempName, FileMode.Open);
+
+            var r =  _innerStream.Seek(offset, SeekOrigin.Begin);
+
+            // workitem 10178
+            Ionic.Zip.SharedUtilities.Workaround_Ladybug318918(_innerStream);
+
+            return r;
+        }
+
+
+
+        public override bool CanRead
+        {
+            get
+            {
+                return (rwMode == RwMode.ReadOnly &&
+                        (_innerStream != null) &&
+                        _innerStream.CanRead);
+            }
+        }
+
+
+        public override bool CanSeek
+        {
+            get
+            {
+                return (_innerStream != null) &&
+                        _innerStream.CanSeek;
+            }
+        }
+
+
+        public override bool CanWrite
+        {
+            get
+            {
+                return (rwMode == RwMode.Write) &&
+                        (_innerStream != null) &&
+                        _innerStream.CanWrite;
+            }
+        }
+
+        public override void Flush()
+        {
+            _innerStream.Flush();
+        }
+
+        public override long Length
+        {
+            get
+            {
+                return _innerStream.Length;
+            }
+        }
+
+        public override long Position
+        {
+            get { return _innerStream.Position; }
+            set { _innerStream.Position = value; }
+        }
+
+        public override long Seek(long offset, System.IO.SeekOrigin origin)
+        {
+            var x = _innerStream.Seek(offset, origin);
+            // workitem 10178
+            Ionic.Zip.SharedUtilities.Workaround_Ladybug318918(_innerStream);
+            return x;
+        }
+
+        public override void SetLength(long value)
+        {
+            if (rwMode != RwMode.Write)
+            {
+                _exceptionPending = true;
+                throw new InvalidOperationException();
+            }
+            _innerStream.SetLength(value);
+        }
+
+
+        protected override void Dispose(bool disposing)
+        {
+            // this gets called by Stream.Close()
+
+            // if (_isDisposed) return;
+            // _isDisposed = true;
+            //Console.WriteLine("Dispose (mode={0})\n", rwMode.ToString());
+
+            try
+            {
+                if (_innerStream != null)
+                {
+#if NETCF
+                    _innerStream.Close();
+#else
+                    _innerStream.Dispose();
+#endif
+                    //_innerStream = null;
+                    if (rwMode == RwMode.Write)
+                    {
+                        if (_exceptionPending)
+                        {
+                            // possibly could try to clean up all the
+                            // temp files created so far...
+                        }
+                        else
+                        {
+                            // // move the final temp file to the .zNN name
+                            // if (File.Exists(CurrentName))
+                            //     File.Delete(CurrentName);
+                            // if (File.Exists(_currentTempName))
+                            //     File.Move(_currentTempName, CurrentName);
+                        }
+                    }
+                }
+            }
+            finally
+            {
+                base.Dispose(disposing);
+            }
+        }
+
+    }
+
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/Zlib/Deflate.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/Zlib/Deflate.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/Zlib/Deflate.cs	(revision 12707)
@@ -0,0 +1,1879 @@
+// Deflate.cs
+// ------------------------------------------------------------------
+//
+// Copyright (c) 2009 Dino Chiesa and Microsoft Corporation.
+// All rights reserved.
+//
+// This code module is part of DotNetZip, a zipfile class library.
+//
+// ------------------------------------------------------------------
+//
+// This code is licensed under the Microsoft Public License.
+// See the file License.txt for the license details.
+// More info on: http://dotnetzip.codeplex.com
+//
+// ------------------------------------------------------------------
+//
+// last saved (in emacs):
+// Time-stamp: <2011-August-03 19:52:15>
+//
+// ------------------------------------------------------------------
+//
+// This module defines logic for handling the Deflate or compression.
+//
+// This code is based on multiple sources:
+// - the original zlib v1.2.3 source, which is Copyright (C) 1995-2005 Jean-loup Gailly.
+// - the original jzlib, which is Copyright (c) 2000-2003 ymnk, JCraft,Inc.
+//
+// However, this code is significantly different from both.
+// The object model is not the same, and many of the behaviors are different.
+//
+// In keeping with the license for these other works, the copyrights for
+// jzlib and zlib are here.
+//
+// -----------------------------------------------------------------------
+// Copyright (c) 2000,2001,2002,2003 ymnk, JCraft,Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in
+// the documentation and/or other materials provided with the distribution.
+//
+// 3. The names of the authors may not be used to endorse or promote products
+// derived from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
+// INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
+// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// -----------------------------------------------------------------------
+//
+// This program is based on zlib-1.1.3; credit to authors
+// Jean-loup Gailly(jloup@gzip.org) and Mark Adler(madler@alumni.caltech.edu)
+// and contributors of zlib.
+//
+// -----------------------------------------------------------------------
+
+
+using System;
+
+namespace OfficeOpenXml.Packaging.Ionic.Zlib
+{
+
+    internal enum BlockState
+    {
+        NeedMore = 0,       // block not completed, need more input or more output
+        BlockDone,          // block flush performed
+        FinishStarted,              // finish started, need only more output at next deflate
+        FinishDone          // finish done, accept no more input or output
+    }
+
+    internal enum DeflateFlavor
+    {
+        Store,
+        Fast,
+        Slow
+    }
+
+    internal sealed class DeflateManager
+    {
+        private static readonly int MEM_LEVEL_MAX = 9;
+        private static readonly int MEM_LEVEL_DEFAULT = 8;
+
+        internal delegate BlockState CompressFunc(FlushType flush);
+
+        internal class Config
+        {
+            // Use a faster search when the previous match is longer than this
+            internal int GoodLength; // reduce lazy search above this match length
+
+            // Attempt to find a better match only when the current match is
+            // strictly smaller than this value. This mechanism is used only for
+            // compression levels >= 4.  For levels 1,2,3: MaxLazy is actually
+            // MaxInsertLength. (See DeflateFast)
+
+            internal int MaxLazy;    // do not perform lazy search above this match length
+
+            internal int NiceLength; // quit search above this match length
+
+            // To speed up deflation, hash chains are never searched beyond this
+            // length.  A higher limit improves compression ratio but degrades the speed.
+
+            internal int MaxChainLength;
+
+            internal DeflateFlavor Flavor;
+
+            private Config(int goodLength, int maxLazy, int niceLength, int maxChainLength, DeflateFlavor flavor)
+            {
+                this.GoodLength = goodLength;
+                this.MaxLazy = maxLazy;
+                this.NiceLength = niceLength;
+                this.MaxChainLength = maxChainLength;
+                this.Flavor = flavor;
+            }
+
+            public static Config Lookup(CompressionLevel level)
+            {
+                return Table[(int)level];
+            }
+
+
+            static Config()
+            {
+                Table = new Config[] {
+                    new Config(0, 0, 0, 0, DeflateFlavor.Store),
+                    new Config(4, 4, 8, 4, DeflateFlavor.Fast),
+                    new Config(4, 5, 16, 8, DeflateFlavor.Fast),
+                    new Config(4, 6, 32, 32, DeflateFlavor.Fast),
+
+                    new Config(4, 4, 16, 16, DeflateFlavor.Slow),
+                    new Config(8, 16, 32, 32, DeflateFlavor.Slow),
+                    new Config(8, 16, 128, 128, DeflateFlavor.Slow),
+                    new Config(8, 32, 128, 256, DeflateFlavor.Slow),
+                    new Config(32, 128, 258, 1024, DeflateFlavor.Slow),
+                    new Config(32, 258, 258, 4096, DeflateFlavor.Slow),
+                };
+            }
+
+            private static readonly Config[] Table;
+        }
+
+
+        private CompressFunc DeflateFunction;
+
+        private static readonly System.String[] _ErrorMessage = new System.String[]
+        {
+            "need dictionary",
+            "stream end",
+            "",
+            "file error",
+            "stream error",
+            "data error",
+            "insufficient memory",
+            "buffer error",
+            "incompatible version",
+            ""
+        };
+
+        // preset dictionary flag in zlib header
+        private static readonly int PRESET_DICT = 0x20;
+
+        private static readonly int INIT_STATE = 42;
+        private static readonly int BUSY_STATE = 113;
+        private static readonly int FINISH_STATE = 666;
+
+        // The deflate compression method
+        private static readonly int Z_DEFLATED = 8;
+
+        private static readonly int STORED_BLOCK = 0;
+        private static readonly int STATIC_TREES = 1;
+        private static readonly int DYN_TREES = 2;
+
+        // The three kinds of block type
+        private static readonly int Z_BINARY = 0;
+        private static readonly int Z_ASCII = 1;
+        private static readonly int Z_UNKNOWN = 2;
+
+        private static readonly int Buf_size = 8 * 2;
+
+        private static readonly int MIN_MATCH = 3;
+        private static readonly int MAX_MATCH = 258;
+
+        private static readonly int MIN_LOOKAHEAD = (MAX_MATCH + MIN_MATCH + 1);
+
+        private static readonly int HEAP_SIZE = (2 * InternalConstants.L_CODES + 1);
+
+        private static readonly int END_BLOCK = 256;
+
+        internal ZlibCodec _codec; // the zlib encoder/decoder
+        internal int status;       // as the name implies
+        internal byte[] pending;   // output still pending - waiting to be compressed
+        internal int nextPending;  // index of next pending byte to output to the stream
+        internal int pendingCount; // number of bytes in the pending buffer
+
+        internal sbyte data_type;  // UNKNOWN, BINARY or ASCII
+        internal int last_flush;   // value of flush param for previous deflate call
+
+        internal int w_size;       // LZ77 window size (32K by default)
+        internal int w_bits;       // log2(w_size)  (8..16)
+        internal int w_mask;       // w_size - 1
+
+        //internal byte[] dictionary;
+        internal byte[] window;
+
+        // Sliding window. Input bytes are read into the second half of the window,
+        // and move to the first half later to keep a dictionary of at least wSize
+        // bytes. With this organization, matches are limited to a distance of
+        // wSize-MAX_MATCH bytes, but this ensures that IO is always
+        // performed with a length multiple of the block size.
+        //
+        // To do: use the user input buffer as sliding window.
+
+        internal int window_size;
+        // Actual size of window: 2*wSize, except when the user input buffer
+        // is directly used as sliding window.
+
+        internal short[] prev;
+        // Link to older string with same hash index. To limit the size of this
+        // array to 64K, this link is maintained only for the last 32K strings.
+        // An index in this array is thus a window index modulo 32K.
+
+        internal short[] head;  // Heads of the hash chains or NIL.
+
+        internal int ins_h;     // hash index of string to be inserted
+        internal int hash_size; // number of elements in hash table
+        internal int hash_bits; // log2(hash_size)
+        internal int hash_mask; // hash_size-1
+
+        // Number of bits by which ins_h must be shifted at each input
+        // step. It must be such that after MIN_MATCH steps, the oldest
+        // byte no longer takes part in the hash key, that is:
+        // hash_shift * MIN_MATCH >= hash_bits
+        internal int hash_shift;
+
+        // Window position at the beginning of the current output block. Gets
+        // negative when the window is moved backwards.
+
+        internal int block_start;
+
+        Config config;
+        internal int match_length;    // length of best match
+        internal int prev_match;      // previous match
+        internal int match_available; // set if previous match exists
+        internal int strstart;        // start of string to insert into.....????
+        internal int match_start;     // start of matching string
+        internal int lookahead;       // number of valid bytes ahead in window
+
+        // Length of the best match at previous step. Matches not greater than this
+        // are discarded. This is used in the lazy match evaluation.
+        internal int prev_length;
+
+        // Insert new strings in the hash table only if the match length is not
+        // greater than this length. This saves time but degrades compression.
+        // max_insert_length is used only for compression levels <= 3.
+
+        internal CompressionLevel compressionLevel; // compression level (1..9)
+        internal CompressionStrategy compressionStrategy; // favor or force Huffman coding
+
+
+        internal short[] dyn_ltree;         // literal and length tree
+        internal short[] dyn_dtree;         // distance tree
+        internal short[] bl_tree;           // Huffman tree for bit lengths
+
+        internal Tree treeLiterals = new Tree();  // desc for literal tree
+        internal Tree treeDistances = new Tree();  // desc for distance tree
+        internal Tree treeBitLengths = new Tree(); // desc for bit length tree
+
+        // number of codes at each bit length for an optimal tree
+        internal short[] bl_count = new short[InternalConstants.MAX_BITS + 1];
+
+        // heap used to build the Huffman trees
+        internal int[] heap = new int[2 * InternalConstants.L_CODES + 1];
+
+        internal int heap_len;              // number of elements in the heap
+        internal int heap_max;              // element of largest frequency
+
+        // The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.
+        // The same heap array is used to build all trees.
+
+        // Depth of each subtree used as tie breaker for trees of equal frequency
+        internal sbyte[] depth = new sbyte[2 * InternalConstants.L_CODES + 1];
+
+        internal int _lengthOffset;                 // index for literals or lengths
+
+
+        // Size of match buffer for literals/lengths.  There are 4 reasons for
+        // limiting lit_bufsize to 64K:
+        //   - frequencies can be kept in 16 bit counters
+        //   - if compression is not successful for the first block, all input
+        //     data is still in the window so we can still emit a stored block even
+        //     when input comes from standard input.  (This can also be done for
+        //     all blocks if lit_bufsize is not greater than 32K.)
+        //   - if compression is not successful for a file smaller than 64K, we can
+        //     even emit a stored file instead of a stored block (saving 5 bytes).
+        //     This is applicable only for zip (not gzip or zlib).
+        //   - creating new Huffman trees less frequently may not provide fast
+        //     adaptation to changes in the input data statistics. (Take for
+        //     example a binary file with poorly compressible code followed by
+        //     a highly compressible string table.) Smaller buffer sizes give
+        //     fast adaptation but have of course the overhead of transmitting
+        //     trees more frequently.
+
+        internal int lit_bufsize;
+
+        internal int last_lit;     // running index in l_buf
+
+        // Buffer for distances. To simplify the code, d_buf and l_buf have
+        // the same number of elements. To use different lengths, an extra flag
+        // array would be necessary.
+
+        internal int _distanceOffset;        // index into pending; points to distance data??
+
+        internal int opt_len;      // bit length of current block with optimal trees
+        internal int static_len;   // bit length of current block with static trees
+        internal int matches;      // number of string matches in current block
+        internal int last_eob_len; // bit length of EOB code for last block
+
+        // Output buffer. bits are inserted starting at the bottom (least
+        // significant bits).
+        internal short bi_buf;
+
+        // Number of valid bits in bi_buf.  All bits above the last valid bit
+        // are always zero.
+        internal int bi_valid;
+
+
+        internal DeflateManager()
+        {
+            dyn_ltree = new short[HEAP_SIZE * 2];
+            dyn_dtree = new short[(2 * InternalConstants.D_CODES + 1) * 2]; // distance tree
+            bl_tree = new short[(2 * InternalConstants.BL_CODES + 1) * 2]; // Huffman tree for bit lengths
+        }
+
+
+        // lm_init
+        private void _InitializeLazyMatch()
+        {
+            window_size = 2 * w_size;
+
+            // clear the hash - workitem 9063
+            Array.Clear(head, 0, hash_size);
+            //for (int i = 0; i < hash_size; i++) head[i] = 0;
+
+            config = Config.Lookup(compressionLevel);
+            SetDeflater();
+
+            strstart = 0;
+            block_start = 0;
+            lookahead = 0;
+            match_length = prev_length = MIN_MATCH - 1;
+            match_available = 0;
+            ins_h = 0;
+        }
+
+        // Initialize the tree data structures for a new zlib stream.
+        private void _InitializeTreeData()
+        {
+            treeLiterals.dyn_tree = dyn_ltree;
+            treeLiterals.staticTree = StaticTree.Literals;
+
+            treeDistances.dyn_tree = dyn_dtree;
+            treeDistances.staticTree = StaticTree.Distances;
+
+            treeBitLengths.dyn_tree = bl_tree;
+            treeBitLengths.staticTree = StaticTree.BitLengths;
+
+            bi_buf = 0;
+            bi_valid = 0;
+            last_eob_len = 8; // enough lookahead for inflate
+
+            // Initialize the first block of the first file:
+            _InitializeBlocks();
+        }
+
+        internal void _InitializeBlocks()
+        {
+            // Initialize the trees.
+            for (int i = 0; i < InternalConstants.L_CODES; i++)
+                dyn_ltree[i * 2] = 0;
+            for (int i = 0; i < InternalConstants.D_CODES; i++)
+                dyn_dtree[i * 2] = 0;
+            for (int i = 0; i < InternalConstants.BL_CODES; i++)
+                bl_tree[i * 2] = 0;
+
+            dyn_ltree[END_BLOCK * 2] = 1;
+            opt_len = static_len = 0;
+            last_lit = matches = 0;
+        }
+
+        // Restore the heap property by moving down the tree starting at node k,
+        // exchanging a node with the smallest of its two sons if necessary, stopping
+        // when the heap property is re-established (each father smaller than its
+        // two sons).
+        internal void pqdownheap(short[] tree, int k)
+        {
+            int v = heap[k];
+            int j = k << 1; // left son of k
+            while (j <= heap_len)
+            {
+                // Set j to the smallest of the two sons:
+                if (j < heap_len && _IsSmaller(tree, heap[j + 1], heap[j], depth))
+                {
+                    j++;
+                }
+                // Exit if v is smaller than both sons
+                if (_IsSmaller(tree, v, heap[j], depth))
+                    break;
+
+                // Exchange v with the smallest son
+                heap[k] = heap[j]; k = j;
+                // And continue down the tree, setting j to the left son of k
+                j <<= 1;
+            }
+            heap[k] = v;
+        }
+
+        internal static bool _IsSmaller(short[] tree, int n, int m, sbyte[] depth)
+        {
+            short tn2 = tree[n * 2];
+            short tm2 = tree[m * 2];
+            return (tn2 < tm2 || (tn2 == tm2 && depth[n] <= depth[m]));
+        }
+
+
+        // Scan a literal or distance tree to determine the frequencies of the codes
+        // in the bit length tree.
+        internal void scan_tree(short[] tree, int max_code)
+        {
+            int n; // iterates over all tree elements
+            int prevlen = -1; // last emitted length
+            int curlen; // length of current code
+            int nextlen = (int)tree[0 * 2 + 1]; // length of next code
+            int count = 0; // repeat count of the current code
+            int max_count = 7; // max repeat count
+            int min_count = 4; // min repeat count
+
+            if (nextlen == 0)
+            {
+                max_count = 138; min_count = 3;
+            }
+            tree[(max_code + 1) * 2 + 1] = (short)0x7fff; // guard //??
+
+            for (n = 0; n <= max_code; n++)
+            {
+                curlen = nextlen; nextlen = (int)tree[(n + 1) * 2 + 1];
+                if (++count < max_count && curlen == nextlen)
+                {
+                    continue;
+                }
+                else if (count < min_count)
+                {
+                    bl_tree[curlen * 2] = (short)(bl_tree[curlen * 2] + count);
+                }
+                else if (curlen != 0)
+                {
+                    if (curlen != prevlen)
+                        bl_tree[curlen * 2]++;
+                    bl_tree[InternalConstants.REP_3_6 * 2]++;
+                }
+                else if (count <= 10)
+                {
+                    bl_tree[InternalConstants.REPZ_3_10 * 2]++;
+                }
+                else
+                {
+                    bl_tree[InternalConstants.REPZ_11_138 * 2]++;
+                }
+                count = 0; prevlen = curlen;
+                if (nextlen == 0)
+                {
+                    max_count = 138; min_count = 3;
+                }
+                else if (curlen == nextlen)
+                {
+                    max_count = 6; min_count = 3;
+                }
+                else
+                {
+                    max_count = 7; min_count = 4;
+                }
+            }
+        }
+
+        // Construct the Huffman tree for the bit lengths and return the index in
+        // bl_order of the last bit length code to send.
+        internal int build_bl_tree()
+        {
+            int max_blindex; // index of last bit length code of non zero freq
+
+            // Determine the bit length frequencies for literal and distance trees
+            scan_tree(dyn_ltree, treeLiterals.max_code);
+            scan_tree(dyn_dtree, treeDistances.max_code);
+
+            // Build the bit length tree:
+            treeBitLengths.build_tree(this);
+            // opt_len now includes the length of the tree representations, except
+            // the lengths of the bit lengths codes and the 5+5+4 bits for the counts.
+
+            // Determine the number of bit length codes to send. The pkzip format
+            // requires that at least 4 bit length codes be sent. (appnote.txt says
+            // 3 but the actual value used is 4.)
+            for (max_blindex = InternalConstants.BL_CODES - 1; max_blindex >= 3; max_blindex--)
+            {
+                if (bl_tree[Tree.bl_order[max_blindex] * 2 + 1] != 0)
+                    break;
+            }
+            // Update opt_len to include the bit length tree and counts
+            opt_len += 3 * (max_blindex + 1) + 5 + 5 + 4;
+
+            return max_blindex;
+        }
+
+
+        // Send the header for a block using dynamic Huffman trees: the counts, the
+        // lengths of the bit length codes, the literal tree and the distance tree.
+        // IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.
+        internal void send_all_trees(int lcodes, int dcodes, int blcodes)
+        {
+            int rank; // index in bl_order
+
+            send_bits(lcodes - 257, 5); // not +255 as stated in appnote.txt
+            send_bits(dcodes - 1, 5);
+            send_bits(blcodes - 4, 4); // not -3 as stated in appnote.txt
+            for (rank = 0; rank < blcodes; rank++)
+            {
+                send_bits(bl_tree[Tree.bl_order[rank] * 2 + 1], 3);
+            }
+            send_tree(dyn_ltree, lcodes - 1); // literal tree
+            send_tree(dyn_dtree, dcodes - 1); // distance tree
+        }
+
+        // Send a literal or distance tree in compressed form, using the codes in
+        // bl_tree.
+        internal void send_tree(short[] tree, int max_code)
+        {
+            int n;                           // iterates over all tree elements
+            int prevlen   = -1;              // last emitted length
+            int curlen;                      // length of current code
+            int nextlen   = tree[0 * 2 + 1]; // length of next code
+            int count     = 0;               // repeat count of the current code
+            int max_count = 7;               // max repeat count
+            int min_count = 4;               // min repeat count
+
+            if (nextlen == 0)
+            {
+                max_count = 138; min_count = 3;
+            }
+
+            for (n = 0; n <= max_code; n++)
+            {
+                curlen = nextlen; nextlen = tree[(n + 1) * 2 + 1];
+                if (++count < max_count && curlen == nextlen)
+                {
+                    continue;
+                }
+                else if (count < min_count)
+                {
+                    do
+                    {
+                        send_code(curlen, bl_tree);
+                    }
+                    while (--count != 0);
+                }
+                else if (curlen != 0)
+                {
+                    if (curlen != prevlen)
+                    {
+                        send_code(curlen, bl_tree); count--;
+                    }
+                    send_code(InternalConstants.REP_3_6, bl_tree);
+                    send_bits(count - 3, 2);
+                }
+                else if (count <= 10)
+                {
+                    send_code(InternalConstants.REPZ_3_10, bl_tree);
+                    send_bits(count - 3, 3);
+                }
+                else
+                {
+                    send_code(InternalConstants.REPZ_11_138, bl_tree);
+                    send_bits(count - 11, 7);
+                }
+                count = 0; prevlen = curlen;
+                if (nextlen == 0)
+                {
+                    max_count = 138; min_count = 3;
+                }
+                else if (curlen == nextlen)
+                {
+                    max_count = 6; min_count = 3;
+                }
+                else
+                {
+                    max_count = 7; min_count = 4;
+                }
+            }
+        }
+
+        // Output a block of bytes on the stream.
+        // IN assertion: there is enough room in pending_buf.
+        private void put_bytes(byte[] p, int start, int len)
+        {
+            Array.Copy(p, start, pending, pendingCount, len);
+            pendingCount += len;
+        }
+
+#if NOTNEEDED
+        private void put_byte(byte c)
+        {
+            pending[pendingCount++] = c;
+        }
+        internal void put_short(int b)
+        {
+            unchecked
+            {
+                pending[pendingCount++] = (byte)b;
+                pending[pendingCount++] = (byte)(b >> 8);
+            }
+        }
+        internal void putShortMSB(int b)
+        {
+            unchecked
+            {
+                pending[pendingCount++] = (byte)(b >> 8);
+                pending[pendingCount++] = (byte)b;
+            }
+        }
+#endif
+
+        internal void send_code(int c, short[] tree)
+        {
+            int c2 = c * 2;
+            send_bits((tree[c2] & 0xffff), (tree[c2 + 1] & 0xffff));
+        }
+
+        internal void send_bits(int value, int length)
+        {
+            int len = length;
+            unchecked
+            {
+                if (bi_valid > (int)Buf_size - len)
+                {
+                    //int val = value;
+                    //      bi_buf |= (val << bi_valid);
+
+                    bi_buf |= (short)((value << bi_valid) & 0xffff);
+                    //put_short(bi_buf);
+                        pending[pendingCount++] = (byte)bi_buf;
+                        pending[pendingCount++] = (byte)(bi_buf >> 8);
+
+
+                    bi_buf = (short)((uint)value >> (Buf_size - bi_valid));
+                    bi_valid += len - Buf_size;
+                }
+                else
+                {
+                    //      bi_buf |= (value) << bi_valid;
+                    bi_buf |= (short)((value << bi_valid) & 0xffff);
+                    bi_valid += len;
+                }
+            }
+        }
+
+        // Send one empty static block to give enough lookahead for inflate.
+        // This takes 10 bits, of which 7 may remain in the bit buffer.
+        // The current inflate code requires 9 bits of lookahead. If the
+        // last two codes for the previous block (real code plus EOB) were coded
+        // on 5 bits or less, inflate may have only 5+3 bits of lookahead to decode
+        // the last real code. In this case we send two empty static blocks instead
+        // of one. (There are no problems if the previous block is stored or fixed.)
+        // To simplify the code, we assume the worst case of last real code encoded
+        // on one bit only.
+        internal void _tr_align()
+        {
+            send_bits(STATIC_TREES << 1, 3);
+            send_code(END_BLOCK, StaticTree.lengthAndLiteralsTreeCodes);
+
+            bi_flush();
+
+            // Of the 10 bits for the empty block, we have already sent
+            // (10 - bi_valid) bits. The lookahead for the last real code (before
+            // the EOB of the previous block) was thus at least one plus the length
+            // of the EOB plus what we have just sent of the empty static block.
+            if (1 + last_eob_len + 10 - bi_valid < 9)
+            {
+                send_bits(STATIC_TREES << 1, 3);
+                send_code(END_BLOCK, StaticTree.lengthAndLiteralsTreeCodes);
+                bi_flush();
+            }
+            last_eob_len = 7;
+        }
+
+
+        // Save the match info and tally the frequency counts. Return true if
+        // the current block must be flushed.
+        internal bool _tr_tally(int dist, int lc)
+        {
+            pending[_distanceOffset + last_lit * 2] = unchecked((byte) ( (uint)dist >> 8 ) );
+            pending[_distanceOffset + last_lit * 2 + 1] = unchecked((byte)dist);
+            pending[_lengthOffset + last_lit] = unchecked((byte)lc);
+            last_lit++;
+
+            if (dist == 0)
+            {
+                // lc is the unmatched char
+                dyn_ltree[lc * 2]++;
+            }
+            else
+            {
+                matches++;
+                // Here, lc is the match length - MIN_MATCH
+                dist--; // dist = match distance - 1
+                dyn_ltree[(Tree.LengthCode[lc] + InternalConstants.LITERALS + 1) * 2]++;
+                dyn_dtree[Tree.DistanceCode(dist) * 2]++;
+            }
+
+            if ((last_lit & 0x1fff) == 0 && (int)compressionLevel > 2)
+            {
+                // Compute an upper bound for the compressed length
+                int out_length = last_lit << 3;
+                int in_length = strstart - block_start;
+                int dcode;
+                for (dcode = 0; dcode < InternalConstants.D_CODES; dcode++)
+                {
+                    out_length = (int)(out_length + (int)dyn_dtree[dcode * 2] * (5L + Tree.ExtraDistanceBits[dcode]));
+                }
+                out_length >>= 3;
+                if ((matches < (last_lit / 2)) && out_length < in_length / 2)
+                    return true;
+            }
+
+            return (last_lit == lit_bufsize - 1) || (last_lit == lit_bufsize);
+            // dinoch - wraparound?
+            // We avoid equality with lit_bufsize because of wraparound at 64K
+            // on 16 bit machines and because stored blocks are restricted to
+            // 64K-1 bytes.
+        }
+
+
+
+        // Send the block data compressed using the given Huffman trees
+        internal void send_compressed_block(short[] ltree, short[] dtree)
+        {
+            int distance; // distance of matched string
+            int lc;       // match length or unmatched char (if dist == 0)
+            int lx = 0;   // running index in l_buf
+            int code;     // the code to send
+            int extra;    // number of extra bits to send
+
+            if (last_lit != 0)
+            {
+                do
+                {
+                    int ix = _distanceOffset + lx * 2;
+                    distance = ((pending[ix] << 8) & 0xff00) |
+                        (pending[ix + 1] & 0xff);
+                    lc = (pending[_lengthOffset + lx]) & 0xff;
+                    lx++;
+
+                    if (distance == 0)
+                    {
+                        send_code(lc, ltree); // send a literal byte
+                    }
+                    else
+                    {
+                        // literal or match pair
+                        // Here, lc is the match length - MIN_MATCH
+                        code = Tree.LengthCode[lc];
+
+                        // send the length code
+                        send_code(code + InternalConstants.LITERALS + 1, ltree);
+                        extra = Tree.ExtraLengthBits[code];
+                        if (extra != 0)
+                        {
+                            // send the extra length bits
+                            lc -= Tree.LengthBase[code];
+                            send_bits(lc, extra);
+                        }
+                        distance--; // dist is now the match distance - 1
+                        code = Tree.DistanceCode(distance);
+
+                        // send the distance code
+                        send_code(code, dtree);
+
+                        extra = Tree.ExtraDistanceBits[code];
+                        if (extra != 0)
+                        {
+                            // send the extra distance bits
+                            distance -= Tree.DistanceBase[code];
+                            send_bits(distance, extra);
+                        }
+                    }
+
+                    // Check that the overlay between pending and d_buf+l_buf is ok:
+                }
+                while (lx < last_lit);
+            }
+
+            send_code(END_BLOCK, ltree);
+            last_eob_len = ltree[END_BLOCK * 2 + 1];
+        }
+
+
+
+        // Set the data type to ASCII or BINARY, using a crude approximation:
+        // binary if more than 20% of the bytes are <= 6 or >= 128, ascii otherwise.
+        // IN assertion: the fields freq of dyn_ltree are set and the total of all
+        // frequencies does not exceed 64K (to fit in an int on 16 bit machines).
+        internal void set_data_type()
+        {
+            int n = 0;
+            int ascii_freq = 0;
+            int bin_freq = 0;
+            while (n < 7)
+            {
+                bin_freq += dyn_ltree[n * 2]; n++;
+            }
+            while (n < 128)
+            {
+                ascii_freq += dyn_ltree[n * 2]; n++;
+            }
+            while (n < InternalConstants.LITERALS)
+            {
+                bin_freq += dyn_ltree[n * 2]; n++;
+            }
+            data_type = (sbyte)(bin_freq > (ascii_freq >> 2) ? Z_BINARY : Z_ASCII);
+        }
+
+
+
+        // Flush the bit buffer, keeping at most 7 bits in it.
+        internal void bi_flush()
+        {
+            if (bi_valid == 16)
+            {
+                pending[pendingCount++] = (byte)bi_buf;
+                pending[pendingCount++] = (byte)(bi_buf >> 8);
+                bi_buf = 0;
+                bi_valid = 0;
+            }
+            else if (bi_valid >= 8)
+            {
+                //put_byte((byte)bi_buf);
+                pending[pendingCount++] = (byte)bi_buf;
+                bi_buf >>= 8;
+                bi_valid -= 8;
+            }
+        }
+
+        // Flush the bit buffer and align the output on a byte boundary
+        internal void bi_windup()
+        {
+            if (bi_valid > 8)
+            {
+                pending[pendingCount++] = (byte)bi_buf;
+                pending[pendingCount++] = (byte)(bi_buf >> 8);
+            }
+            else if (bi_valid > 0)
+            {
+                //put_byte((byte)bi_buf);
+                pending[pendingCount++] = (byte)bi_buf;
+            }
+            bi_buf = 0;
+            bi_valid = 0;
+        }
+
+        // Copy a stored block, storing first the length and its
+        // one's complement if requested.
+        internal void copy_block(int buf, int len, bool header)
+        {
+            bi_windup(); // align on byte boundary
+            last_eob_len = 8; // enough lookahead for inflate
+
+            if (header)
+                unchecked
+                {
+                    //put_short((short)len);
+                    pending[pendingCount++] = (byte)len;
+                    pending[pendingCount++] = (byte)(len >> 8);
+                    //put_short((short)~len);
+                    pending[pendingCount++] = (byte)~len;
+                    pending[pendingCount++] = (byte)(~len >> 8);
+                }
+
+            put_bytes(window, buf, len);
+        }
+
+        internal void flush_block_only(bool eof)
+        {
+            _tr_flush_block(block_start >= 0 ? block_start : -1, strstart - block_start, eof);
+            block_start = strstart;
+            _codec.flush_pending();
+        }
+
+        // Copy without compression as much as possible from the input stream, return
+        // the current block state.
+        // This function does not insert new strings in the dictionary since
+        // uncompressible data is probably not useful. This function is used
+        // only for the level=0 compression option.
+        // NOTE: this function should be optimized to avoid extra copying from
+        // window to pending_buf.
+        internal BlockState DeflateNone(FlushType flush)
+        {
+            // Stored blocks are limited to 0xffff bytes, pending is limited
+            // to pending_buf_size, and each stored block has a 5 byte header:
+
+            int max_block_size = 0xffff;
+            int max_start;
+
+            if (max_block_size > pending.Length - 5)
+            {
+                max_block_size = pending.Length - 5;
+            }
+
+            // Copy as much as possible from input to output:
+            while (true)
+            {
+                // Fill the window as much as possible:
+                if (lookahead <= 1)
+                {
+                    _fillWindow();
+                    if (lookahead == 0 && flush == FlushType.None)
+                        return BlockState.NeedMore;
+                    if (lookahead == 0)
+                        break; // flush the current block
+                }
+
+                strstart += lookahead;
+                lookahead = 0;
+
+                // Emit a stored block if pending will be full:
+                max_start = block_start + max_block_size;
+                if (strstart == 0 || strstart >= max_start)
+                {
+                    // strstart == 0 is possible when wraparound on 16-bit machine
+                    lookahead = (int)(strstart - max_start);
+                    strstart = (int)max_start;
+
+                    flush_block_only(false);
+                    if (_codec.AvailableBytesOut == 0)
+                        return BlockState.NeedMore;
+                }
+
+                // Flush if we may have to slide, otherwise block_start may become
+                // negative and the data will be gone:
+                if (strstart - block_start >= w_size - MIN_LOOKAHEAD)
+                {
+                    flush_block_only(false);
+                    if (_codec.AvailableBytesOut == 0)
+                        return BlockState.NeedMore;
+                }
+            }
+
+            flush_block_only(flush == FlushType.Finish);
+            if (_codec.AvailableBytesOut == 0)
+                return (flush == FlushType.Finish) ? BlockState.FinishStarted : BlockState.NeedMore;
+
+            return flush == FlushType.Finish ? BlockState.FinishDone : BlockState.BlockDone;
+        }
+
+
+        // Send a stored block
+        internal void _tr_stored_block(int buf, int stored_len, bool eof)
+        {
+            send_bits((STORED_BLOCK << 1) + (eof ? 1 : 0), 3); // send block type
+            copy_block(buf, stored_len, true); // with header
+        }
+
+        // Determine the best encoding for the current block: dynamic trees, static
+        // trees or store, and output the encoded block to the zip file.
+        internal void _tr_flush_block(int buf, int stored_len, bool eof)
+        {
+            int opt_lenb, static_lenb; // opt_len and static_len in bytes
+            int max_blindex = 0; // index of last bit length code of non zero freq
+
+            // Build the Huffman trees unless a stored block is forced
+            if (compressionLevel > 0)
+            {
+                // Check if the file is ascii or binary
+                if (data_type == Z_UNKNOWN)
+                    set_data_type();
+
+                // Construct the literal and distance trees
+                treeLiterals.build_tree(this);
+
+                treeDistances.build_tree(this);
+
+                // At this point, opt_len and static_len are the total bit lengths of
+                // the compressed block data, excluding the tree representations.
+
+                // Build the bit length tree for the above two trees, and get the index
+                // in bl_order of the last bit length code to send.
+                max_blindex = build_bl_tree();
+
+                // Determine the best encoding. Compute first the block length in bytes
+                opt_lenb = (opt_len + 3 + 7) >> 3;
+                static_lenb = (static_len + 3 + 7) >> 3;
+
+                if (static_lenb <= opt_lenb)
+                    opt_lenb = static_lenb;
+            }
+            else
+            {
+                opt_lenb = static_lenb = stored_len + 5; // force a stored block
+            }
+
+            if (stored_len + 4 <= opt_lenb && buf != -1)
+            {
+                // 4: two words for the lengths
+                // The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE.
+                // Otherwise we can't have processed more than WSIZE input bytes since
+                // the last block flush, because compression would have been
+                // successful. If LIT_BUFSIZE <= WSIZE, it is never too late to
+                // transform a block into a stored block.
+                _tr_stored_block(buf, stored_len, eof);
+            }
+            else if (static_lenb == opt_lenb)
+            {
+                send_bits((STATIC_TREES << 1) + (eof ? 1 : 0), 3);
+                send_compressed_block(StaticTree.lengthAndLiteralsTreeCodes, StaticTree.distTreeCodes);
+            }
+            else
+            {
+                send_bits((DYN_TREES << 1) + (eof ? 1 : 0), 3);
+                send_all_trees(treeLiterals.max_code + 1, treeDistances.max_code + 1, max_blindex + 1);
+                send_compressed_block(dyn_ltree, dyn_dtree);
+            }
+
+            // The above check is made mod 2^32, for files larger than 512 MB
+            // and uLong implemented on 32 bits.
+
+            _InitializeBlocks();
+
+            if (eof)
+            {
+                bi_windup();
+            }
+        }
+
+        // Fill the window when the lookahead becomes insufficient.
+        // Updates strstart and lookahead.
+        //
+        // IN assertion: lookahead < MIN_LOOKAHEAD
+        // OUT assertions: strstart <= window_size-MIN_LOOKAHEAD
+        //    At least one byte has been read, or avail_in == 0; reads are
+        //    performed for at least two bytes (required for the zip translate_eol
+        //    option -- not supported here).
+        private void _fillWindow()
+        {
+            int n, m;
+            int p;
+            int more; // Amount of free space at the end of the window.
+
+            do
+            {
+                more = (window_size - lookahead - strstart);
+
+                // Deal with !@#$% 64K limit:
+                if (more == 0 && strstart == 0 && lookahead == 0)
+                {
+                    more = w_size;
+                }
+                else if (more == -1)
+                {
+                    // Very unlikely, but possible on 16 bit machine if strstart == 0
+                    // and lookahead == 1 (input done one byte at time)
+                    more--;
+
+                    // If the window is almost full and there is insufficient lookahead,
+                    // move the upper half to the lower one to make room in the upper half.
+                }
+                else if (strstart >= w_size + w_size - MIN_LOOKAHEAD)
+                {
+                    Array.Copy(window, w_size, window, 0, w_size);
+                    match_start -= w_size;
+                    strstart -= w_size; // we now have strstart >= MAX_DIST
+                    block_start -= w_size;
+
+                    // Slide the hash table (could be avoided with 32 bit values
+                    // at the expense of memory usage). We slide even when level == 0
+                    // to keep the hash table consistent if we switch back to level > 0
+                    // later. (Using level 0 permanently is not an optimal usage of
+                    // zlib, so we don't care about this pathological case.)
+
+                    n = hash_size;
+                    p = n;
+                    do
+                    {
+                        m = (head[--p] & 0xffff);
+                        head[p] = (short)((m >= w_size) ? (m - w_size) : 0);
+                    }
+                    while (--n != 0);
+
+                    n = w_size;
+                    p = n;
+                    do
+                    {
+                        m = (prev[--p] & 0xffff);
+                        prev[p] = (short)((m >= w_size) ? (m - w_size) : 0);
+                        // If n is not on any hash chain, prev[n] is garbage but
+                        // its value will never be used.
+                    }
+                    while (--n != 0);
+                    more += w_size;
+                }
+
+                if (_codec.AvailableBytesIn == 0)
+                    return;
+
+                // If there was no sliding:
+                //    strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 &&
+                //    more == window_size - lookahead - strstart
+                // => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1)
+                // => more >= window_size - 2*WSIZE + 2
+                // In the BIG_MEM or MMAP case (not yet supported),
+                //   window_size == input_size + MIN_LOOKAHEAD  &&
+                //   strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD.
+                // Otherwise, window_size == 2*WSIZE so more >= 2.
+                // If there was sliding, more >= WSIZE. So in all cases, more >= 2.
+
+                n = _codec.read_buf(window, strstart + lookahead, more);
+                lookahead += n;
+
+                // Initialize the hash value now that we have some input:
+                if (lookahead >= MIN_MATCH)
+                {
+                    ins_h = window[strstart] & 0xff;
+                    ins_h = (((ins_h) << hash_shift) ^ (window[strstart + 1] & 0xff)) & hash_mask;
+                }
+                // If the whole input has less than MIN_MATCH bytes, ins_h is garbage,
+                // but this is not important since only literal bytes will be emitted.
+            }
+            while (lookahead < MIN_LOOKAHEAD && _codec.AvailableBytesIn != 0);
+        }
+
+        // Compress as much as possible from the input stream, return the current
+        // block state.
+        // This function does not perform lazy evaluation of matches and inserts
+        // new strings in the dictionary only for unmatched strings or for short
+        // matches. It is used only for the fast compression options.
+        internal BlockState DeflateFast(FlushType flush)
+        {
+            //    short hash_head = 0; // head of the hash chain
+            int hash_head = 0; // head of the hash chain
+            bool bflush; // set if current block must be flushed
+
+            while (true)
+            {
+                // Make sure that we always have enough lookahead, except
+                // at the end of the input file. We need MAX_MATCH bytes
+                // for the next match, plus MIN_MATCH bytes to insert the
+                // string following the next match.
+                if (lookahead < MIN_LOOKAHEAD)
+                {
+                    _fillWindow();
+                    if (lookahead < MIN_LOOKAHEAD && flush == FlushType.None)
+                    {
+                        return BlockState.NeedMore;
+                    }
+                    if (lookahead == 0)
+                        break; // flush the current block
+                }
+
+                // Insert the string window[strstart .. strstart+2] in the
+                // dictionary, and set hash_head to the head of the hash chain:
+                if (lookahead >= MIN_MATCH)
+                {
+                    ins_h = (((ins_h) << hash_shift) ^ (window[(strstart) + (MIN_MATCH - 1)] & 0xff)) & hash_mask;
+
+                    //  prev[strstart&w_mask]=hash_head=head[ins_h];
+                    hash_head = (head[ins_h] & 0xffff);
+                    prev[strstart & w_mask] = head[ins_h];
+                    head[ins_h] = unchecked((short)strstart);
+                }
+
+                // Find the longest match, discarding those <= prev_length.
+                // At this point we have always match_length < MIN_MATCH
+
+                if (hash_head != 0L && ((strstart - hash_head) & 0xffff) <= w_size - MIN_LOOKAHEAD)
+                {
+                    // To simplify the code, we prevent matches with the string
+                    // of window index 0 (in particular we have to avoid a match
+                    // of the string with itself at the start of the input file).
+                    if (compressionStrategy != CompressionStrategy.HuffmanOnly)
+                    {
+                        match_length = longest_match(hash_head);
+                    }
+                    // longest_match() sets match_start
+                }
+                if (match_length >= MIN_MATCH)
+                {
+                    //        check_match(strstart, match_start, match_length);
+
+                    bflush = _tr_tally(strstart - match_start, match_length - MIN_MATCH);
+
+                    lookahead -= match_length;
+
+                    // Insert new strings in the hash table only if the match length
+                    // is not too large. This saves time but degrades compression.
+                    if (match_length <= config.MaxLazy && lookahead >= MIN_MATCH)
+                    {
+                        match_length--; // string at strstart already in hash table
+                        do
+                        {
+                            strstart++;
+
+                            ins_h = ((ins_h << hash_shift) ^ (window[(strstart) + (MIN_MATCH - 1)] & 0xff)) & hash_mask;
+                            //      prev[strstart&w_mask]=hash_head=head[ins_h];
+                            hash_head = (head[ins_h] & 0xffff);
+                            prev[strstart & w_mask] = head[ins_h];
+                            head[ins_h] = unchecked((short)strstart);
+
+                            // strstart never exceeds WSIZE-MAX_MATCH, so there are
+                            // always MIN_MATCH bytes ahead.
+                        }
+                        while (--match_length != 0);
+                        strstart++;
+                    }
+                    else
+                    {
+                        strstart += match_length;
+                        match_length = 0;
+                        ins_h = window[strstart] & 0xff;
+
+                        ins_h = (((ins_h) << hash_shift) ^ (window[strstart + 1] & 0xff)) & hash_mask;
+                        // If lookahead < MIN_MATCH, ins_h is garbage, but it does not
+                        // matter since it will be recomputed at next deflate call.
+                    }
+                }
+                else
+                {
+                    // No match, output a literal byte
+
+                    bflush = _tr_tally(0, window[strstart] & 0xff);
+                    lookahead--;
+                    strstart++;
+                }
+                if (bflush)
+                {
+                    flush_block_only(false);
+                    if (_codec.AvailableBytesOut == 0)
+                        return BlockState.NeedMore;
+                }
+            }
+
+            flush_block_only(flush == FlushType.Finish);
+            if (_codec.AvailableBytesOut == 0)
+            {
+                if (flush == FlushType.Finish)
+                    return BlockState.FinishStarted;
+                else
+                    return BlockState.NeedMore;
+            }
+            return flush == FlushType.Finish ? BlockState.FinishDone : BlockState.BlockDone;
+        }
+
+        // Same as above, but achieves better compression. We use a lazy
+        // evaluation for matches: a match is finally adopted only if there is
+        // no better match at the next window position.
+        internal BlockState DeflateSlow(FlushType flush)
+        {
+            //    short hash_head = 0;    // head of hash chain
+            int hash_head = 0; // head of hash chain
+            bool bflush; // set if current block must be flushed
+
+            // Process the input block.
+            while (true)
+            {
+                // Make sure that we always have enough lookahead, except
+                // at the end of the input file. We need MAX_MATCH bytes
+                // for the next match, plus MIN_MATCH bytes to insert the
+                // string following the next match.
+
+                if (lookahead < MIN_LOOKAHEAD)
+                {
+                    _fillWindow();
+                    if (lookahead < MIN_LOOKAHEAD && flush == FlushType.None)
+                        return BlockState.NeedMore;
+
+                    if (lookahead == 0)
+                        break; // flush the current block
+                }
+
+                // Insert the string window[strstart .. strstart+2] in the
+                // dictionary, and set hash_head to the head of the hash chain:
+
+                if (lookahead >= MIN_MATCH)
+                {
+                    ins_h = (((ins_h) << hash_shift) ^ (window[(strstart) + (MIN_MATCH - 1)] & 0xff)) & hash_mask;
+                    //  prev[strstart&w_mask]=hash_head=head[ins_h];
+                    hash_head = (head[ins_h] & 0xffff);
+                    prev[strstart & w_mask] = head[ins_h];
+                    head[ins_h] = unchecked((short)strstart);
+                }
+
+                // Find the longest match, discarding those <= prev_length.
+                prev_length = match_length;
+                prev_match = match_start;
+                match_length = MIN_MATCH - 1;
+
+                if (hash_head != 0 && prev_length < config.MaxLazy &&
+                    ((strstart - hash_head) & 0xffff) <= w_size - MIN_LOOKAHEAD)
+                {
+                    // To simplify the code, we prevent matches with the string
+                    // of window index 0 (in particular we have to avoid a match
+                    // of the string with itself at the start of the input file).
+
+                    if (compressionStrategy != CompressionStrategy.HuffmanOnly)
+                    {
+                        match_length = longest_match(hash_head);
+                    }
+                    // longest_match() sets match_start
+
+                    if (match_length <= 5 && (compressionStrategy == CompressionStrategy.Filtered ||
+                                              (match_length == MIN_MATCH && strstart - match_start > 4096)))
+                    {
+
+                        // If prev_match is also MIN_MATCH, match_start is garbage
+                        // but we will ignore the current match anyway.
+                        match_length = MIN_MATCH - 1;
+                    }
+                }
+
+                // If there was a match at the previous step and the current
+                // match is not better, output the previous match:
+                if (prev_length >= MIN_MATCH && match_length <= prev_length)
+                {
+                    int max_insert = strstart + lookahead - MIN_MATCH;
+                    // Do not insert strings in hash table beyond this.
+
+                    //          check_match(strstart-1, prev_match, prev_length);
+
+                    bflush = _tr_tally(strstart - 1 - prev_match, prev_length - MIN_MATCH);
+
+                    // Insert in hash table all strings up to the end of the match.
+                    // strstart-1 and strstart are already inserted. If there is not
+                    // enough lookahead, the last two strings are not inserted in
+                    // the hash table.
+                    lookahead -= (prev_length - 1);
+                    prev_length -= 2;
+                    do
+                    {
+                        if (++strstart <= max_insert)
+                        {
+                            ins_h = (((ins_h) << hash_shift) ^ (window[(strstart) + (MIN_MATCH - 1)] & 0xff)) & hash_mask;
+                            //prev[strstart&w_mask]=hash_head=head[ins_h];
+                            hash_head = (head[ins_h] & 0xffff);
+                            prev[strstart & w_mask] = head[ins_h];
+                            head[ins_h] = unchecked((short)strstart);
+                        }
+                    }
+                    while (--prev_length != 0);
+                    match_available = 0;
+                    match_length = MIN_MATCH - 1;
+                    strstart++;
+
+                    if (bflush)
+                    {
+                        flush_block_only(false);
+                        if (_codec.AvailableBytesOut == 0)
+                            return BlockState.NeedMore;
+                    }
+                }
+                else if (match_available != 0)
+                {
+
+                    // If there was no match at the previous position, output a
+                    // single literal. If there was a match but the current match
+                    // is longer, truncate the previous match to a single literal.
+
+                    bflush = _tr_tally(0, window[strstart - 1] & 0xff);
+
+                    if (bflush)
+                    {
+                        flush_block_only(false);
+                    }
+                    strstart++;
+                    lookahead--;
+                    if (_codec.AvailableBytesOut == 0)
+                        return BlockState.NeedMore;
+                }
+                else
+                {
+                    // There is no previous match to compare with, wait for
+                    // the next step to decide.
+
+                    match_available = 1;
+                    strstart++;
+                    lookahead--;
+                }
+            }
+
+            if (match_available != 0)
+            {
+                bflush = _tr_tally(0, window[strstart - 1] & 0xff);
+                match_available = 0;
+            }
+            flush_block_only(flush == FlushType.Finish);
+
+            if (_codec.AvailableBytesOut == 0)
+            {
+                if (flush == FlushType.Finish)
+                    return BlockState.FinishStarted;
+                else
+                    return BlockState.NeedMore;
+            }
+
+            return flush == FlushType.Finish ? BlockState.FinishDone : BlockState.BlockDone;
+        }
+
+
+        internal int longest_match(int cur_match)
+        {
+            int chain_length = config.MaxChainLength; // max hash chain length
+            int scan         = strstart;              // current string
+            int match;                                // matched string
+            int len;                                  // length of current match
+            int best_len     = prev_length;           // best match length so far
+            int limit        = strstart > (w_size - MIN_LOOKAHEAD) ? strstart - (w_size - MIN_LOOKAHEAD) : 0;
+
+            int niceLength = config.NiceLength;
+
+            // Stop when cur_match becomes <= limit. To simplify the code,
+            // we prevent matches with the string of window index 0.
+
+            int wmask = w_mask;
+
+            int strend = strstart + MAX_MATCH;
+            byte scan_end1 = window[scan + best_len - 1];
+            byte scan_end = window[scan + best_len];
+
+            // The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.
+            // It is easy to get rid of this optimization if necessary.
+
+            // Do not waste too much time if we already have a good match:
+            if (prev_length >= config.GoodLength)
+            {
+                chain_length >>= 2;
+            }
+
+            // Do not look for matches beyond the end of the input. This is necessary
+            // to make deflate deterministic.
+            if (niceLength > lookahead)
+                niceLength = lookahead;
+
+            do
+            {
+                match = cur_match;
+
+                // Skip to next match if the match length cannot increase
+                // or if the match length is less than 2:
+                if (window[match + best_len] != scan_end ||
+                    window[match + best_len - 1] != scan_end1 ||
+                    window[match] != window[scan] ||
+                    window[++match] != window[scan + 1])
+                    continue;
+
+                // The check at best_len-1 can be removed because it will be made
+                // again later. (This heuristic is not always a win.)
+                // It is not necessary to compare scan[2] and match[2] since they
+                // are always equal when the other bytes match, given that
+                // the hash keys are equal and that HASH_BITS >= 8.
+                scan += 2; match++;
+
+                // We check for insufficient lookahead only every 8th comparison;
+                // the 256th check will be made at strstart+258.
+                do
+                {
+                }
+                while (window[++scan] == window[++match] &&
+                       window[++scan] == window[++match] &&
+                       window[++scan] == window[++match] &&
+                       window[++scan] == window[++match] &&
+                       window[++scan] == window[++match] &&
+                       window[++scan] == window[++match] &&
+                       window[++scan] == window[++match] &&
+                       window[++scan] == window[++match] && scan < strend);
+
+                len = MAX_MATCH - (int)(strend - scan);
+                scan = strend - MAX_MATCH;
+
+                if (len > best_len)
+                {
+                    match_start = cur_match;
+                    best_len = len;
+                    if (len >= niceLength)
+                        break;
+                    scan_end1 = window[scan + best_len - 1];
+                    scan_end = window[scan + best_len];
+                }
+            }
+            while ((cur_match = (prev[cur_match & wmask] & 0xffff)) > limit && --chain_length != 0);
+
+            if (best_len <= lookahead)
+                return best_len;
+            return lookahead;
+        }
+
+
+        private bool Rfc1950BytesEmitted = false;
+        private bool _WantRfc1950HeaderBytes = true;
+        internal bool WantRfc1950HeaderBytes
+        {
+            get { return _WantRfc1950HeaderBytes; }
+            set { _WantRfc1950HeaderBytes = value; }
+        }
+
+
+        internal int Initialize(ZlibCodec codec, CompressionLevel level)
+        {
+            return Initialize(codec, level, ZlibConstants.WindowBitsMax);
+        }
+
+        internal int Initialize(ZlibCodec codec, CompressionLevel level, int bits)
+        {
+            return Initialize(codec, level, bits, MEM_LEVEL_DEFAULT, CompressionStrategy.Default);
+        }
+
+        internal int Initialize(ZlibCodec codec, CompressionLevel level, int bits, CompressionStrategy compressionStrategy)
+        {
+            return Initialize(codec, level, bits, MEM_LEVEL_DEFAULT, compressionStrategy);
+        }
+
+        internal int Initialize(ZlibCodec codec, CompressionLevel level, int windowBits, int memLevel, CompressionStrategy strategy)
+        {
+            _codec = codec;
+            _codec.Message = null;
+
+            // validation
+            if (windowBits < 9 || windowBits > 15)
+                throw new ZlibException("windowBits must be in the range 9..15.");
+
+            if (memLevel < 1 || memLevel > MEM_LEVEL_MAX)
+                throw new ZlibException(String.Format("memLevel must be in the range 1.. {0}", MEM_LEVEL_MAX));
+
+            _codec.dstate = this;
+
+            w_bits = windowBits;
+            w_size = 1 << w_bits;
+            w_mask = w_size - 1;
+
+            hash_bits = memLevel + 7;
+            hash_size = 1 << hash_bits;
+            hash_mask = hash_size - 1;
+            hash_shift = ((hash_bits + MIN_MATCH - 1) / MIN_MATCH);
+
+            window = new byte[w_size * 2];
+            prev = new short[w_size];
+            head = new short[hash_size];
+
+            // for memLevel==8, this will be 16384, 16k
+            lit_bufsize = 1 << (memLevel + 6);
+
+            // Use a single array as the buffer for data pending compression,
+            // the output distance codes, and the output length codes (aka tree).
+            // orig comment: This works just fine since the average
+            // output size for (length,distance) codes is <= 24 bits.
+            pending = new byte[lit_bufsize * 4];
+            _distanceOffset = lit_bufsize;
+            _lengthOffset = (1 + 2) * lit_bufsize;
+
+            // So, for memLevel 8, the length of the pending buffer is 65536. 64k.
+            // The first 16k are pending bytes.
+            // The middle slice, of 32k, is used for distance codes.
+            // The final 16k are length codes.
+
+            this.compressionLevel = level;
+            this.compressionStrategy = strategy;
+
+            Reset();
+            return ZlibConstants.Z_OK;
+        }
+
+
+        internal void Reset()
+        {
+            _codec.TotalBytesIn = _codec.TotalBytesOut = 0;
+            _codec.Message = null;
+            //strm.data_type = Z_UNKNOWN;
+
+            pendingCount = 0;
+            nextPending = 0;
+
+            Rfc1950BytesEmitted = false;
+
+            status = (WantRfc1950HeaderBytes) ? INIT_STATE : BUSY_STATE;
+            _codec._Adler32 = Adler.Adler32(0, null, 0, 0);
+
+            last_flush = (int)FlushType.None;
+
+            _InitializeTreeData();
+            _InitializeLazyMatch();
+        }
+
+
+        internal int End()
+        {
+            if (status != INIT_STATE && status != BUSY_STATE && status != FINISH_STATE)
+            {
+                return ZlibConstants.Z_STREAM_ERROR;
+            }
+            // Deallocate in reverse order of allocations:
+            pending = null;
+            head = null;
+            prev = null;
+            window = null;
+            // free
+            // dstate=null;
+            return status == BUSY_STATE ? ZlibConstants.Z_DATA_ERROR : ZlibConstants.Z_OK;
+        }
+
+
+        private void SetDeflater()
+        {
+            switch (config.Flavor)
+            {
+                case DeflateFlavor.Store:
+                    DeflateFunction = DeflateNone;
+                    break;
+                case DeflateFlavor.Fast:
+                    DeflateFunction = DeflateFast;
+                    break;
+                case DeflateFlavor.Slow:
+                    DeflateFunction = DeflateSlow;
+                    break;
+            }
+        }
+
+
+        internal int SetParams(CompressionLevel level, CompressionStrategy strategy)
+        {
+            int result = ZlibConstants.Z_OK;
+
+            if (compressionLevel != level)
+            {
+                Config newConfig = Config.Lookup(level);
+
+                // change in the deflate flavor (Fast vs slow vs none)?
+                if (newConfig.Flavor != config.Flavor && _codec.TotalBytesIn != 0)
+                {
+                    // Flush the last buffer:
+                    result = _codec.Deflate(FlushType.Partial);
+                }
+
+                compressionLevel = level;
+                config = newConfig;
+                SetDeflater();
+            }
+
+            // no need to flush with change in strategy?  Really?
+            compressionStrategy = strategy;
+
+            return result;
+        }
+
+
+        internal int SetDictionary(byte[] dictionary)
+        {
+            int length = dictionary.Length;
+            int index = 0;
+
+            if (dictionary == null || status != INIT_STATE)
+                throw new ZlibException("Stream error.");
+
+            _codec._Adler32 = Adler.Adler32(_codec._Adler32, dictionary, 0, dictionary.Length);
+
+            if (length < MIN_MATCH)
+                return ZlibConstants.Z_OK;
+            if (length > w_size - MIN_LOOKAHEAD)
+            {
+                length = w_size - MIN_LOOKAHEAD;
+                index = dictionary.Length - length; // use the tail of the dictionary
+            }
+            Array.Copy(dictionary, index, window, 0, length);
+            strstart = length;
+            block_start = length;
+
+            // Insert all strings in the hash table (except for the last two bytes).
+            // s->lookahead stays null, so s->ins_h will be recomputed at the next
+            // call of fill_window.
+
+            ins_h = window[0] & 0xff;
+            ins_h = (((ins_h) << hash_shift) ^ (window[1] & 0xff)) & hash_mask;
+
+            for (int n = 0; n <= length - MIN_MATCH; n++)
+            {
+                ins_h = (((ins_h) << hash_shift) ^ (window[(n) + (MIN_MATCH - 1)] & 0xff)) & hash_mask;
+                prev[n & w_mask] = head[ins_h];
+                head[ins_h] = (short)n;
+            }
+            return ZlibConstants.Z_OK;
+        }
+
+
+
+        internal int Deflate(FlushType flush)
+        {
+            int old_flush;
+
+            if (_codec.OutputBuffer == null ||
+                (_codec.InputBuffer == null && _codec.AvailableBytesIn != 0) ||
+                (status == FINISH_STATE && flush != FlushType.Finish))
+            {
+                _codec.Message = _ErrorMessage[ZlibConstants.Z_NEED_DICT - (ZlibConstants.Z_STREAM_ERROR)];
+                throw new ZlibException(String.Format("Something is fishy. [{0}]", _codec.Message));
+            }
+            if (_codec.AvailableBytesOut == 0)
+            {
+                _codec.Message = _ErrorMessage[ZlibConstants.Z_NEED_DICT - (ZlibConstants.Z_BUF_ERROR)];
+                throw new ZlibException("OutputBuffer is full (AvailableBytesOut == 0)");
+            }
+
+            old_flush = last_flush;
+            last_flush = (int)flush;
+
+            // Write the zlib (rfc1950) header bytes
+            if (status == INIT_STATE)
+            {
+                int header = (Z_DEFLATED + ((w_bits - 8) << 4)) << 8;
+                int level_flags = (((int)compressionLevel - 1) & 0xff) >> 1;
+
+                if (level_flags > 3)
+                    level_flags = 3;
+                header |= (level_flags << 6);
+                if (strstart != 0)
+                    header |= PRESET_DICT;
+                header += 31 - (header % 31);
+
+                status = BUSY_STATE;
+                //putShortMSB(header);
+                unchecked
+                {
+                    pending[pendingCount++] = (byte)(header >> 8);
+                    pending[pendingCount++] = (byte)header;
+                }
+                // Save the adler32 of the preset dictionary:
+                if (strstart != 0)
+                {
+                    pending[pendingCount++] = (byte)((_codec._Adler32 & 0xFF000000) >> 24);
+                    pending[pendingCount++] = (byte)((_codec._Adler32 & 0x00FF0000) >> 16);
+                    pending[pendingCount++] = (byte)((_codec._Adler32 & 0x0000FF00) >> 8);
+                    pending[pendingCount++] = (byte)(_codec._Adler32 & 0x000000FF);
+                }
+                _codec._Adler32 = Adler.Adler32(0, null, 0, 0);
+            }
+
+            // Flush as much pending output as possible
+            if (pendingCount != 0)
+            {
+                _codec.flush_pending();
+                if (_codec.AvailableBytesOut == 0)
+                {
+                    //System.out.println("  avail_out==0");
+                    // Since avail_out is 0, deflate will be called again with
+                    // more output space, but possibly with both pending and
+                    // avail_in equal to zero. There won't be anything to do,
+                    // but this is not an error situation so make sure we
+                    // return OK instead of BUF_ERROR at next call of deflate:
+                    last_flush = -1;
+                    return ZlibConstants.Z_OK;
+                }
+
+                // Make sure there is something to do and avoid duplicate consecutive
+                // flushes. For repeated and useless calls with Z_FINISH, we keep
+                // returning Z_STREAM_END instead of Z_BUFF_ERROR.
+            }
+            else if (_codec.AvailableBytesIn == 0 &&
+                     (int)flush <= old_flush &&
+                     flush != FlushType.Finish)
+            {
+                // workitem 8557
+                //
+                // Not sure why this needs to be an error.  pendingCount == 0, which
+                // means there's nothing to deflate.  And the caller has not asked
+                // for a FlushType.Finish, but...  that seems very non-fatal.  We
+                // can just say "OK" and do nothing.
+
+                // _codec.Message = z_errmsg[ZlibConstants.Z_NEED_DICT - (ZlibConstants.Z_BUF_ERROR)];
+                // throw new ZlibException("AvailableBytesIn == 0 && flush<=old_flush && flush != FlushType.Finish");
+
+                return ZlibConstants.Z_OK;
+            }
+
+            // User must not provide more input after the first FINISH:
+            if (status == FINISH_STATE && _codec.AvailableBytesIn != 0)
+            {
+                _codec.Message = _ErrorMessage[ZlibConstants.Z_NEED_DICT - (ZlibConstants.Z_BUF_ERROR)];
+                throw new ZlibException("status == FINISH_STATE && _codec.AvailableBytesIn != 0");
+            }
+
+            // Start a new block or continue the current one.
+            if (_codec.AvailableBytesIn != 0 || lookahead != 0 || (flush != FlushType.None && status != FINISH_STATE))
+            {
+                BlockState bstate = DeflateFunction(flush);
+
+                if (bstate == BlockState.FinishStarted || bstate == BlockState.FinishDone)
+                {
+                    status = FINISH_STATE;
+                }
+                if (bstate == BlockState.NeedMore || bstate == BlockState.FinishStarted)
+                {
+                    if (_codec.AvailableBytesOut == 0)
+                    {
+                        last_flush = -1; // avoid BUF_ERROR next call, see above
+                    }
+                    return ZlibConstants.Z_OK;
+                    // If flush != Z_NO_FLUSH && avail_out == 0, the next call
+                    // of deflate should use the same flush parameter to make sure
+                    // that the flush is complete. So we don't have to output an
+                    // empty block here, this will be done at next call. This also
+                    // ensures that for a very small output buffer, we emit at most
+                    // one empty block.
+                }
+
+                if (bstate == BlockState.BlockDone)
+                {
+                    if (flush == FlushType.Partial)
+                    {
+                        _tr_align();
+                    }
+                    else
+                    {
+                        // FlushType.Full or FlushType.Sync
+                        _tr_stored_block(0, 0, false);
+                        // For a full flush, this empty block will be recognized
+                        // as a special marker by inflate_sync().
+                        if (flush == FlushType.Full)
+                        {
+                            // clear hash (forget the history)
+                            for (int i = 0; i < hash_size; i++)
+                                head[i] = 0;
+                        }
+                    }
+                    _codec.flush_pending();
+                    if (_codec.AvailableBytesOut == 0)
+                    {
+                        last_flush = -1; // avoid BUF_ERROR at next call, see above
+                        return ZlibConstants.Z_OK;
+                    }
+                }
+            }
+
+            if (flush != FlushType.Finish)
+                return ZlibConstants.Z_OK;
+
+            if (!WantRfc1950HeaderBytes || Rfc1950BytesEmitted)
+                return ZlibConstants.Z_STREAM_END;
+
+            // Write the zlib trailer (adler32)
+            pending[pendingCount++] = (byte)((_codec._Adler32 & 0xFF000000) >> 24);
+            pending[pendingCount++] = (byte)((_codec._Adler32 & 0x00FF0000) >> 16);
+            pending[pendingCount++] = (byte)((_codec._Adler32 & 0x0000FF00) >> 8);
+            pending[pendingCount++] = (byte)(_codec._Adler32 & 0x000000FF);
+            //putShortMSB((int)(SharedUtils.URShift(_codec._Adler32, 16)));
+            //putShortMSB((int)(_codec._Adler32 & 0xffff));
+
+            _codec.flush_pending();
+
+            // If avail_out is zero, the application will call deflate again
+            // to flush the rest.
+
+            Rfc1950BytesEmitted = true; // write the trailer only once!
+
+            return pendingCount != 0 ? ZlibConstants.Z_OK : ZlibConstants.Z_STREAM_END;
+        }
+
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/Zlib/DeflateStream.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/Zlib/DeflateStream.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/Zlib/DeflateStream.cs	(revision 12707)
@@ -0,0 +1,740 @@
+// DeflateStream.cs
+// ------------------------------------------------------------------
+//
+// Copyright (c) 2009-2010 Dino Chiesa.
+// All rights reserved.
+//
+// This code module is part of DotNetZip, a zipfile class library.
+//
+// ------------------------------------------------------------------
+//
+// This code is licensed under the Microsoft Public License.
+// See the file License.txt for the license details.
+// More info on: http://dotnetzip.codeplex.com
+//
+// ------------------------------------------------------------------
+//
+// last saved (in emacs):
+// Time-stamp: <2011-July-31 14:48:11>
+//
+// ------------------------------------------------------------------
+//
+// This module defines the DeflateStream class, which can be used as a replacement for
+// the System.IO.Compression.DeflateStream class in the .NET BCL.
+//
+// ------------------------------------------------------------------
+
+
+using System;
+
+namespace OfficeOpenXml.Packaging.Ionic.Zlib
+{
+    /// <summary>
+    /// A class for compressing and decompressing streams using the Deflate algorithm.
+    /// </summary>
+    ///
+    /// <remarks>
+    ///
+    /// <para>
+    ///   The DeflateStream is a <see
+    ///   href="http://en.wikipedia.org/wiki/Decorator_pattern">Decorator</see> on a <see
+    ///   cref="System.IO.Stream"/>.  It adds DEFLATE compression or decompression to any
+    ///   stream.
+    /// </para>
+    ///
+    /// <para>
+    ///   Using this stream, applications can compress or decompress data via stream
+    ///   <c>Read</c> and <c>Write</c> operations.  Either compresssion or decompression
+    ///   can occur through either reading or writing. The compression format used is
+    ///   DEFLATE, which is documented in <see
+    ///   href="http://www.ietf.org/rfc/rfc1951.txt">IETF RFC 1951</see>, "DEFLATE
+    ///   Compressed Data Format Specification version 1.3.".
+    /// </para>
+    ///
+    /// <para>
+    ///   This class is similar to <see cref="ZlibStream"/>, except that
+    ///   <c>ZlibStream</c> adds the <see href="http://www.ietf.org/rfc/rfc1950.txt">RFC
+    ///   1950 - ZLIB</see> framing bytes to a compressed stream when compressing, or
+    ///   expects the RFC1950 framing bytes when decompressing. The <c>DeflateStream</c>
+    ///   does not.
+    /// </para>
+    ///
+    /// </remarks>
+    ///
+    /// <seealso cref="ZlibStream" />
+    /// <seealso cref="GZipStream" />
+    public class DeflateStream : System.IO.Stream
+    {
+        internal ZlibBaseStream _baseStream;
+        internal System.IO.Stream _innerStream;
+        bool _disposed;
+
+        /// <summary>
+        ///   Create a DeflateStream using the specified CompressionMode.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///   When mode is <c>CompressionMode.Compress</c>, the DeflateStream will use
+        ///   the default compression level. The "captive" stream will be closed when
+        ///   the DeflateStream is closed.
+        /// </remarks>
+        ///
+        /// <example>
+        /// This example uses a DeflateStream to compress data from a file, and writes
+        /// the compressed data to another file.
+        /// <code>
+        /// using (System.IO.Stream input = System.IO.File.OpenRead(fileToCompress))
+        /// {
+        ///     using (var raw = System.IO.File.Create(fileToCompress + ".deflated"))
+        ///     {
+        ///         using (Stream compressor = new DeflateStream(raw, CompressionMode.Compress))
+        ///         {
+        ///             byte[] buffer = new byte[WORKING_BUFFER_SIZE];
+        ///             int n;
+        ///             while ((n= input.Read(buffer, 0, buffer.Length)) != 0)
+        ///             {
+        ///                 compressor.Write(buffer, 0, n);
+        ///             }
+        ///         }
+        ///     }
+        /// }
+        /// </code>
+        ///
+        /// <code lang="VB">
+        /// Using input As Stream = File.OpenRead(fileToCompress)
+        ///     Using raw As FileStream = File.Create(fileToCompress &amp; ".deflated")
+        ///         Using compressor As Stream = New DeflateStream(raw, CompressionMode.Compress)
+        ///             Dim buffer As Byte() = New Byte(4096) {}
+        ///             Dim n As Integer = -1
+        ///             Do While (n &lt;&gt; 0)
+        ///                 If (n &gt; 0) Then
+        ///                     compressor.Write(buffer, 0, n)
+        ///                 End If
+        ///                 n = input.Read(buffer, 0, buffer.Length)
+        ///             Loop
+        ///         End Using
+        ///     End Using
+        /// End Using
+        /// </code>
+        /// </example>
+        /// <param name="stream">The stream which will be read or written.</param>
+        /// <param name="mode">Indicates whether the DeflateStream will compress or decompress.</param>
+        public DeflateStream(System.IO.Stream stream, CompressionMode mode)
+            : this(stream, mode, CompressionLevel.Default, false)
+        {
+        }
+
+        /// <summary>
+        /// Create a DeflateStream using the specified CompressionMode and the specified CompressionLevel.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///
+        /// <para>
+        ///   When mode is <c>CompressionMode.Decompress</c>, the level parameter is
+        ///   ignored.  The "captive" stream will be closed when the DeflateStream is
+        ///   closed.
+        /// </para>
+        ///
+        /// </remarks>
+        ///
+        /// <example>
+        ///
+        ///   This example uses a DeflateStream to compress data from a file, and writes
+        ///   the compressed data to another file.
+        ///
+        /// <code>
+        /// using (System.IO.Stream input = System.IO.File.OpenRead(fileToCompress))
+        /// {
+        ///     using (var raw = System.IO.File.Create(fileToCompress + ".deflated"))
+        ///     {
+        ///         using (Stream compressor = new DeflateStream(raw,
+        ///                                                      CompressionMode.Compress,
+        ///                                                      CompressionLevel.BestCompression))
+        ///         {
+        ///             byte[] buffer = new byte[WORKING_BUFFER_SIZE];
+        ///             int n= -1;
+        ///             while (n != 0)
+        ///             {
+        ///                 if (n &gt; 0)
+        ///                     compressor.Write(buffer, 0, n);
+        ///                 n= input.Read(buffer, 0, buffer.Length);
+        ///             }
+        ///         }
+        ///     }
+        /// }
+        /// </code>
+        ///
+        /// <code lang="VB">
+        /// Using input As Stream = File.OpenRead(fileToCompress)
+        ///     Using raw As FileStream = File.Create(fileToCompress &amp; ".deflated")
+        ///         Using compressor As Stream = New DeflateStream(raw, CompressionMode.Compress, CompressionLevel.BestCompression)
+        ///             Dim buffer As Byte() = New Byte(4096) {}
+        ///             Dim n As Integer = -1
+        ///             Do While (n &lt;&gt; 0)
+        ///                 If (n &gt; 0) Then
+        ///                     compressor.Write(buffer, 0, n)
+        ///                 End If
+        ///                 n = input.Read(buffer, 0, buffer.Length)
+        ///             Loop
+        ///         End Using
+        ///     End Using
+        /// End Using
+        /// </code>
+        /// </example>
+        /// <param name="stream">The stream to be read or written while deflating or inflating.</param>
+        /// <param name="mode">Indicates whether the <c>DeflateStream</c> will compress or decompress.</param>
+        /// <param name="level">A tuning knob to trade speed for effectiveness.</param>
+        public DeflateStream(System.IO.Stream stream, CompressionMode mode, CompressionLevel level)
+            : this(stream, mode, level, false)
+        {
+        }
+
+        /// <summary>
+        ///   Create a <c>DeflateStream</c> using the specified
+        ///   <c>CompressionMode</c>, and explicitly specify whether the
+        ///   stream should be left open after Deflation or Inflation.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///
+        /// <para>
+        ///   This constructor allows the application to request that the captive stream
+        ///   remain open after the deflation or inflation occurs.  By default, after
+        ///   <c>Close()</c> is called on the stream, the captive stream is also
+        ///   closed. In some cases this is not desired, for example if the stream is a
+        ///   memory stream that will be re-read after compression.  Specify true for
+        ///   the <paramref name="leaveOpen"/> parameter to leave the stream open.
+        /// </para>
+        ///
+        /// <para>
+        ///   The <c>DeflateStream</c> will use the default compression level.
+        /// </para>
+        ///
+        /// <para>
+        ///   See the other overloads of this constructor for example code.
+        /// </para>
+        /// </remarks>
+        ///
+        /// <param name="stream">
+        ///   The stream which will be read or written. This is called the
+        ///   "captive" stream in other places in this documentation.
+        /// </param>
+        ///
+        /// <param name="mode">
+        ///   Indicates whether the <c>DeflateStream</c> will compress or decompress.
+        /// </param>
+        ///
+        /// <param name="leaveOpen">true if the application would like the stream to
+        /// remain open after inflation/deflation.</param>
+        public DeflateStream(System.IO.Stream stream, CompressionMode mode, bool leaveOpen)
+            : this(stream, mode, CompressionLevel.Default, leaveOpen)
+        {
+        }
+
+        /// <summary>
+        ///   Create a <c>DeflateStream</c> using the specified <c>CompressionMode</c>
+        ///   and the specified <c>CompressionLevel</c>, and explicitly specify whether
+        ///   the stream should be left open after Deflation or Inflation.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///
+        /// <para>
+        ///   When mode is <c>CompressionMode.Decompress</c>, the level parameter is ignored.
+        /// </para>
+        ///
+        /// <para>
+        ///   This constructor allows the application to request that the captive stream
+        ///   remain open after the deflation or inflation occurs.  By default, after
+        ///   <c>Close()</c> is called on the stream, the captive stream is also
+        ///   closed. In some cases this is not desired, for example if the stream is a
+        ///   <see cref="System.IO.MemoryStream"/> that will be re-read after
+        ///   compression.  Specify true for the <paramref name="leaveOpen"/> parameter
+        ///   to leave the stream open.
+        /// </para>
+        ///
+        /// </remarks>
+        ///
+        /// <example>
+        ///
+        ///   This example shows how to use a <c>DeflateStream</c> to compress data from
+        ///   a file, and store the compressed data into another file.
+        ///
+        /// <code>
+        /// using (var output = System.IO.File.Create(fileToCompress + ".deflated"))
+        /// {
+        ///     using (System.IO.Stream input = System.IO.File.OpenRead(fileToCompress))
+        ///     {
+        ///         using (Stream compressor = new DeflateStream(output, CompressionMode.Compress, CompressionLevel.BestCompression, true))
+        ///         {
+        ///             byte[] buffer = new byte[WORKING_BUFFER_SIZE];
+        ///             int n= -1;
+        ///             while (n != 0)
+        ///             {
+        ///                 if (n &gt; 0)
+        ///                     compressor.Write(buffer, 0, n);
+        ///                 n= input.Read(buffer, 0, buffer.Length);
+        ///             }
+        ///         }
+        ///     }
+        ///     // can write additional data to the output stream here
+        /// }
+        /// </code>
+        ///
+        /// <code lang="VB">
+        /// Using output As FileStream = File.Create(fileToCompress &amp; ".deflated")
+        ///     Using input As Stream = File.OpenRead(fileToCompress)
+        ///         Using compressor As Stream = New DeflateStream(output, CompressionMode.Compress, CompressionLevel.BestCompression, True)
+        ///             Dim buffer As Byte() = New Byte(4096) {}
+        ///             Dim n As Integer = -1
+        ///             Do While (n &lt;&gt; 0)
+        ///                 If (n &gt; 0) Then
+        ///                     compressor.Write(buffer, 0, n)
+        ///                 End If
+        ///                 n = input.Read(buffer, 0, buffer.Length)
+        ///             Loop
+        ///         End Using
+        ///     End Using
+        ///     ' can write additional data to the output stream here.
+        /// End Using
+        /// </code>
+        /// </example>
+        /// <param name="stream">The stream which will be read or written.</param>
+        /// <param name="mode">Indicates whether the DeflateStream will compress or decompress.</param>
+        /// <param name="leaveOpen">true if the application would like the stream to remain open after inflation/deflation.</param>
+        /// <param name="level">A tuning knob to trade speed for effectiveness.</param>
+        public DeflateStream(System.IO.Stream stream, CompressionMode mode, CompressionLevel level, bool leaveOpen)
+        {
+            _innerStream = stream;
+            _baseStream = new ZlibBaseStream(stream, mode, level, ZlibStreamFlavor.DEFLATE, leaveOpen);
+        }
+
+        #region Zlib properties
+
+        /// <summary>
+        /// This property sets the flush behavior on the stream.
+        /// </summary>
+        /// <remarks> See the ZLIB documentation for the meaning of the flush behavior.
+        /// </remarks>
+        virtual public FlushType FlushMode
+        {
+            get { return (this._baseStream._flushMode); }
+            set
+            {
+                if (_disposed) throw new ObjectDisposedException("DeflateStream");
+                this._baseStream._flushMode = value;
+            }
+        }
+
+        /// <summary>
+        ///   The size of the working buffer for the compression codec.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   The working buffer is used for all stream operations.  The default size is
+        ///   1024 bytes.  The minimum size is 128 bytes. You may get better performance
+        ///   with a larger buffer.  Then again, you might not.  You would have to test
+        ///   it.
+        /// </para>
+        ///
+        /// <para>
+        ///   Set this before the first call to <c>Read()</c> or <c>Write()</c> on the
+        ///   stream. If you try to set it afterwards, it will throw.
+        /// </para>
+        /// </remarks>
+        public int BufferSize
+        {
+            get
+            {
+                return this._baseStream._bufferSize;
+            }
+            set
+            {
+                if (_disposed) throw new ObjectDisposedException("DeflateStream");
+                if (this._baseStream._workingBuffer != null)
+                    throw new ZlibException("The working buffer is already set.");
+                if (value < ZlibConstants.WorkingBufferSizeMin)
+                    throw new ZlibException(String.Format("Don't be silly. {0} bytes?? Use a bigger buffer, at least {1}.", value, ZlibConstants.WorkingBufferSizeMin));
+                this._baseStream._bufferSize = value;
+            }
+        }
+
+        /// <summary>
+        ///   The ZLIB strategy to be used during compression.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///   By tweaking this parameter, you may be able to optimize the compression for
+        ///   data with particular characteristics.
+        /// </remarks>
+        public CompressionStrategy Strategy
+        {
+            get
+            {
+                return this._baseStream.Strategy;
+            }
+            set
+            {
+            if (_disposed) throw new ObjectDisposedException("DeflateStream");
+                this._baseStream.Strategy = value;
+            }
+        }
+
+        /// <summary> Returns the total number of bytes input so far.</summary>
+        virtual public long TotalIn
+        {
+            get
+            {
+                return this._baseStream._z.TotalBytesIn;
+            }
+        }
+
+        /// <summary> Returns the total number of bytes output so far.</summary>
+        virtual public long TotalOut
+        {
+            get
+            {
+                return this._baseStream._z.TotalBytesOut;
+            }
+        }
+
+        #endregion
+
+        #region System.IO.Stream methods
+        /// <summary>
+        ///   Dispose the stream.
+        /// </summary>
+        /// <remarks>
+        ///   <para>
+        ///     This may or may not result in a <c>Close()</c> call on the captive
+        ///     stream.  See the constructors that have a <c>leaveOpen</c> parameter
+        ///     for more information.
+        ///   </para>
+        ///   <para>
+        ///     Application code won't call this code directly.  This method may be
+        ///     invoked in two distinct scenarios.  If disposing == true, the method
+        ///     has been called directly or indirectly by a user's code, for example
+        ///     via the public Dispose() method. In this case, both managed and
+        ///     unmanaged resources can be referenced and disposed.  If disposing ==
+        ///     false, the method has been called by the runtime from inside the
+        ///     object finalizer and this method should not reference other objects;
+        ///     in that case only unmanaged resources must be referenced or
+        ///     disposed.
+        ///   </para>
+        /// </remarks>
+        /// <param name="disposing">
+        ///   true if the Dispose method was invoked by user code.
+        /// </param>
+        protected override void Dispose(bool disposing)
+        {
+            try
+            {
+                if (!_disposed)
+                {
+                    if (disposing && (this._baseStream != null))
+                        this._baseStream.Close();
+                    _disposed = true;
+                }
+            }
+            finally
+            {
+                base.Dispose(disposing);
+            }
+        }
+
+
+
+        /// <summary>
+        /// Indicates whether the stream can be read.
+        /// </summary>
+        /// <remarks>
+        /// The return value depends on whether the captive stream supports reading.
+        /// </remarks>
+        public override bool CanRead
+        {
+            get
+            {
+                if (_disposed) throw new ObjectDisposedException("DeflateStream");
+                return _baseStream._stream.CanRead;
+            }
+        }
+
+        /// <summary>
+        /// Indicates whether the stream supports Seek operations.
+        /// </summary>
+        /// <remarks>
+        /// Always returns false.
+        /// </remarks>
+        public override bool CanSeek
+        {
+            get { return false; }
+        }
+
+
+        /// <summary>
+        /// Indicates whether the stream can be written.
+        /// </summary>
+        /// <remarks>
+        /// The return value depends on whether the captive stream supports writing.
+        /// </remarks>
+        public override bool CanWrite
+        {
+            get
+            {
+                if (_disposed) throw new ObjectDisposedException("DeflateStream");
+                return _baseStream._stream.CanWrite;
+            }
+        }
+
+        /// <summary>
+        /// Flush the stream.
+        /// </summary>
+        public override void Flush()
+        {
+            if (_disposed) throw new ObjectDisposedException("DeflateStream");
+            _baseStream.Flush();
+        }
+
+        /// <summary>
+        /// Reading this property always throws a <see cref="NotImplementedException"/>.
+        /// </summary>
+        public override long Length
+        {
+            get { throw new NotImplementedException(); }
+        }
+
+        /// <summary>
+        /// The position of the stream pointer.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///   Setting this property always throws a <see
+        ///   cref="NotImplementedException"/>. Reading will return the total bytes
+        ///   written out, if used in writing, or the total bytes read in, if used in
+        ///   reading.  The count may refer to compressed bytes or uncompressed bytes,
+        ///   depending on how you've used the stream.
+        /// </remarks>
+        public override long Position
+        {
+            get
+            {
+                if (this._baseStream._streamMode == Ionic.Zlib.ZlibBaseStream.StreamMode.Writer)
+                    return this._baseStream._z.TotalBytesOut;
+                if (this._baseStream._streamMode == Ionic.Zlib.ZlibBaseStream.StreamMode.Reader)
+                    return this._baseStream._z.TotalBytesIn;
+                return 0;
+            }
+            set { throw new NotImplementedException(); }
+        }
+
+        /// <summary>
+        /// Read data from the stream.
+        /// </summary>
+        /// <remarks>
+        ///
+        /// <para>
+        ///   If you wish to use the <c>DeflateStream</c> to compress data while
+        ///   reading, you can create a <c>DeflateStream</c> with
+        ///   <c>CompressionMode.Compress</c>, providing an uncompressed data stream.
+        ///   Then call Read() on that <c>DeflateStream</c>, and the data read will be
+        ///   compressed as you read.  If you wish to use the <c>DeflateStream</c> to
+        ///   decompress data while reading, you can create a <c>DeflateStream</c> with
+        ///   <c>CompressionMode.Decompress</c>, providing a readable compressed data
+        ///   stream.  Then call Read() on that <c>DeflateStream</c>, and the data read
+        ///   will be decompressed as you read.
+        /// </para>
+        ///
+        /// <para>
+        ///   A <c>DeflateStream</c> can be used for <c>Read()</c> or <c>Write()</c>, but not both.
+        /// </para>
+        ///
+        /// </remarks>
+        /// <param name="buffer">The buffer into which the read data should be placed.</param>
+        /// <param name="offset">the offset within that data array to put the first byte read.</param>
+        /// <param name="count">the number of bytes to read.</param>
+        /// <returns>the number of bytes actually read</returns>
+        public override int Read(byte[] buffer, int offset, int count)
+        {
+            if (_disposed) throw new ObjectDisposedException("DeflateStream");
+            return _baseStream.Read(buffer, offset, count);
+        }
+
+
+        /// <summary>
+        /// Calling this method always throws a <see cref="NotImplementedException"/>.
+        /// </summary>
+        /// <param name="offset">this is irrelevant, since it will always throw!</param>
+        /// <param name="origin">this is irrelevant, since it will always throw!</param>
+        /// <returns>irrelevant!</returns>
+        public override long Seek(long offset, System.IO.SeekOrigin origin)
+        {
+            throw new NotImplementedException();
+        }
+
+        /// <summary>
+        /// Calling this method always throws a <see cref="NotImplementedException"/>.
+        /// </summary>
+        /// <param name="value">this is irrelevant, since it will always throw!</param>
+        public override void SetLength(long value)
+        {
+            throw new NotImplementedException();
+        }
+
+        /// <summary>
+        ///   Write data to the stream.
+        /// </summary>
+        /// <remarks>
+        ///
+        /// <para>
+        ///   If you wish to use the <c>DeflateStream</c> to compress data while
+        ///   writing, you can create a <c>DeflateStream</c> with
+        ///   <c>CompressionMode.Compress</c>, and a writable output stream.  Then call
+        ///   <c>Write()</c> on that <c>DeflateStream</c>, providing uncompressed data
+        ///   as input.  The data sent to the output stream will be the compressed form
+        ///   of the data written.  If you wish to use the <c>DeflateStream</c> to
+        ///   decompress data while writing, you can create a <c>DeflateStream</c> with
+        ///   <c>CompressionMode.Decompress</c>, and a writable output stream.  Then
+        ///   call <c>Write()</c> on that stream, providing previously compressed
+        ///   data. The data sent to the output stream will be the decompressed form of
+        ///   the data written.
+        /// </para>
+        ///
+        /// <para>
+        ///   A <c>DeflateStream</c> can be used for <c>Read()</c> or <c>Write()</c>,
+        ///   but not both.
+        /// </para>
+        ///
+        /// </remarks>
+        ///
+        /// <param name="buffer">The buffer holding data to write to the stream.</param>
+        /// <param name="offset">the offset within that data array to find the first byte to write.</param>
+        /// <param name="count">the number of bytes to write.</param>
+        public override void Write(byte[] buffer, int offset, int count)
+        {
+            if (_disposed) throw new ObjectDisposedException("DeflateStream");
+            _baseStream.Write(buffer, offset, count);
+        }
+        #endregion
+
+
+
+
+        /// <summary>
+        ///   Compress a string into a byte array using DEFLATE (RFC 1951).
+        /// </summary>
+        ///
+        /// <remarks>
+        ///   Uncompress it with <see cref="DeflateStream.UncompressString(byte[])"/>.
+        /// </remarks>
+        ///
+        /// <seealso cref="DeflateStream.UncompressString(byte[])">DeflateStream.UncompressString(byte[])</seealso>
+        /// <seealso cref="DeflateStream.CompressBuffer(byte[])">DeflateStream.CompressBuffer(byte[])</seealso>
+        /// <seealso cref="GZipStream.CompressString(string)">GZipStream.CompressString(string)</seealso>
+        /// <seealso cref="ZlibStream.CompressString(string)">ZlibStream.CompressString(string)</seealso>
+        ///
+        /// <param name="s">
+        ///   A string to compress. The string will first be encoded
+        ///   using UTF8, then compressed.
+        /// </param>
+        ///
+        /// <returns>The string in compressed form</returns>
+        public static byte[] CompressString(String s)
+        {
+            using (var ms = new System.IO.MemoryStream())
+            {
+                System.IO.Stream compressor =
+                    new DeflateStream(ms, CompressionMode.Compress, CompressionLevel.BestCompression);
+                ZlibBaseStream.CompressString(s, compressor);
+                return ms.ToArray();
+            }
+        }
+
+
+        /// <summary>
+        ///   Compress a byte array into a new byte array using DEFLATE.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///   Uncompress it with <see cref="DeflateStream.UncompressBuffer(byte[])"/>.
+        /// </remarks>
+        ///
+        /// <seealso cref="DeflateStream.CompressString(string)">DeflateStream.CompressString(string)</seealso>
+        /// <seealso cref="DeflateStream.UncompressBuffer(byte[])">DeflateStream.UncompressBuffer(byte[])</seealso>
+        /// <seealso cref="GZipStream.CompressBuffer(byte[])">GZipStream.CompressBuffer(byte[])</seealso>
+        /// <seealso cref="ZlibStream.CompressBuffer(byte[])">ZlibStream.CompressBuffer(byte[])</seealso>
+        ///
+        /// <param name="b">
+        ///   A buffer to compress.
+        /// </param>
+        ///
+        /// <returns>The data in compressed form</returns>
+        public static byte[] CompressBuffer(byte[] b)
+        {
+            using (var ms = new System.IO.MemoryStream())
+            {
+                System.IO.Stream compressor =
+                    new DeflateStream( ms, CompressionMode.Compress, CompressionLevel.BestCompression );
+
+                ZlibBaseStream.CompressBuffer(b, compressor);
+                return ms.ToArray();
+            }
+        }
+
+
+        /// <summary>
+        ///   Uncompress a DEFLATE'd byte array into a single string.
+        /// </summary>
+        ///
+        /// <seealso cref="DeflateStream.CompressString(String)">DeflateStream.CompressString(String)</seealso>
+        /// <seealso cref="DeflateStream.UncompressBuffer(byte[])">DeflateStream.UncompressBuffer(byte[])</seealso>
+        /// <seealso cref="GZipStream.UncompressString(byte[])">GZipStream.UncompressString(byte[])</seealso>
+        /// <seealso cref="ZlibStream.UncompressString(byte[])">ZlibStream.UncompressString(byte[])</seealso>
+        ///
+        /// <param name="compressed">
+        ///   A buffer containing DEFLATE-compressed data.
+        /// </param>
+        ///
+        /// <returns>The uncompressed string</returns>
+        public static String UncompressString(byte[] compressed)
+        {
+            using (var input = new System.IO.MemoryStream(compressed))
+            {
+                System.IO.Stream decompressor =
+                    new DeflateStream(input, CompressionMode.Decompress);
+
+                return ZlibBaseStream.UncompressString(compressed, decompressor);
+            }
+        }
+
+
+        /// <summary>
+        ///   Uncompress a DEFLATE'd byte array into a byte array.
+        /// </summary>
+        ///
+        /// <seealso cref="DeflateStream.CompressBuffer(byte[])">DeflateStream.CompressBuffer(byte[])</seealso>
+        /// <seealso cref="DeflateStream.UncompressString(byte[])">DeflateStream.UncompressString(byte[])</seealso>
+        /// <seealso cref="GZipStream.UncompressBuffer(byte[])">GZipStream.UncompressBuffer(byte[])</seealso>
+        /// <seealso cref="ZlibStream.UncompressBuffer(byte[])">ZlibStream.UncompressBuffer(byte[])</seealso>
+        ///
+        /// <param name="compressed">
+        ///   A buffer containing data that has been compressed with DEFLATE.
+        /// </param>
+        ///
+        /// <returns>The data in uncompressed form</returns>
+        public static byte[] UncompressBuffer(byte[] compressed)
+        {
+            using (var input = new System.IO.MemoryStream(compressed))
+            {
+                System.IO.Stream decompressor =
+                    new DeflateStream( input, CompressionMode.Decompress );
+
+                return ZlibBaseStream.UncompressBuffer(compressed, decompressor);
+            }
+        }
+
+    }
+
+}
+
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/Zlib/GZipStream.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/Zlib/GZipStream.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/Zlib/GZipStream.cs	(revision 12707)
@@ -0,0 +1,1033 @@
+// GZipStream.cs
+// ------------------------------------------------------------------
+//
+// Copyright (c) 2009 Dino Chiesa and Microsoft Corporation.
+// All rights reserved.
+//
+// This code module is part of DotNetZip, a zipfile class library.
+//
+// ------------------------------------------------------------------
+//
+// This code is licensed under the Microsoft Public License.
+// See the file License.txt for the license details.
+// More info on: http://dotnetzip.codeplex.com
+//
+// ------------------------------------------------------------------
+//
+// last saved (in emacs):
+// Time-stamp: <2011-August-08 18:14:39>
+//
+// ------------------------------------------------------------------
+//
+// This module defines the GZipStream class, which can be used as a replacement for
+// the System.IO.Compression.GZipStream class in the .NET BCL.  NB: The design is not
+// completely OO clean: there is some intelligence in the ZlibBaseStream that reads the
+// GZip header.
+//
+// ------------------------------------------------------------------
+
+
+using System;
+using System.IO;
+
+namespace OfficeOpenXml.Packaging.Ionic.Zlib
+{
+    /// <summary>
+    ///   A class for compressing and decompressing GZIP streams.
+    /// </summary>
+    /// <remarks>
+    ///
+    /// <para>
+    ///   The <c>GZipStream</c> is a <see
+    ///   href="http://en.wikipedia.org/wiki/Decorator_pattern">Decorator</see> on a
+    ///   <see cref="Stream"/>. It adds GZIP compression or decompression to any
+    ///   stream.
+    /// </para>
+    ///
+    /// <para>
+    ///   Like the <c>System.IO.Compression.GZipStream</c> in the .NET Base Class Library, the
+    ///   <c>Ionic.Zlib.GZipStream</c> can compress while writing, or decompress while
+    ///   reading, but not vice versa.  The compression method used is GZIP, which is
+    ///   documented in <see href="http://www.ietf.org/rfc/rfc1952.txt">IETF RFC
+    ///   1952</see>, "GZIP file format specification version 4.3".</para>
+    ///
+    /// <para>
+    ///   A <c>GZipStream</c> can be used to decompress data (through <c>Read()</c>) or
+    ///   to compress data (through <c>Write()</c>), but not both.
+    /// </para>
+    ///
+    /// <para>
+    ///   If you wish to use the <c>GZipStream</c> to compress data, you must wrap it
+    ///   around a write-able stream. As you call <c>Write()</c> on the <c>GZipStream</c>, the
+    ///   data will be compressed into the GZIP format.  If you want to decompress data,
+    ///   you must wrap the <c>GZipStream</c> around a readable stream that contains an
+    ///   IETF RFC 1952-compliant stream.  The data will be decompressed as you call
+    ///   <c>Read()</c> on the <c>GZipStream</c>.
+    /// </para>
+    ///
+    /// <para>
+    ///   Though the GZIP format allows data from multiple files to be concatenated
+    ///   together, this stream handles only a single segment of GZIP format, typically
+    ///   representing a single file.
+    /// </para>
+    ///
+    /// <para>
+    ///   This class is similar to <see cref="ZlibStream"/> and <see cref="DeflateStream"/>.
+    ///   <c>ZlibStream</c> handles RFC1950-compliant streams.  <see cref="DeflateStream"/>
+    ///   handles RFC1951-compliant streams. This class handles RFC1952-compliant streams.
+    /// </para>
+    ///
+    /// </remarks>
+    ///
+    /// <seealso cref="DeflateStream" />
+    /// <seealso cref="ZlibStream" />
+    public class GZipStream : System.IO.Stream
+    {
+        // GZip format
+        // source: http://tools.ietf.org/html/rfc1952
+        //
+        //  header id:           2 bytes    1F 8B
+        //  compress method      1 byte     8= DEFLATE (none other supported)
+        //  flag                 1 byte     bitfield (See below)
+        //  mtime                4 bytes    time_t (seconds since jan 1, 1970 UTC of the file.
+        //  xflg                 1 byte     2 = max compress used , 4 = max speed (can be ignored)
+        //  OS                   1 byte     OS for originating archive. set to 0xFF in compression.
+        //  extra field length   2 bytes    optional - only if FEXTRA is set.
+        //  extra field          varies
+        //  filename             varies     optional - if FNAME is set.  zero terminated. ISO-8859-1.
+        //  file comment         varies     optional - if FCOMMENT is set. zero terminated. ISO-8859-1.
+        //  crc16                1 byte     optional - present only if FHCRC bit is set
+        //  compressed data      varies
+        //  CRC32                4 bytes
+        //  isize                4 bytes    data size modulo 2^32
+        //
+        //     FLG (FLaGs)
+        //                bit 0   FTEXT - indicates file is ASCII text (can be safely ignored)
+        //                bit 1   FHCRC - there is a CRC16 for the header immediately following the header
+        //                bit 2   FEXTRA - extra fields are present
+        //                bit 3   FNAME - the zero-terminated filename is present. encoding; ISO-8859-1.
+        //                bit 4   FCOMMENT  - a zero-terminated file comment is present. encoding: ISO-8859-1
+        //                bit 5   reserved
+        //                bit 6   reserved
+        //                bit 7   reserved
+        //
+        // On consumption:
+        // Extra field is a bunch of nonsense and can be safely ignored.
+        // Header CRC and OS, likewise.
+        //
+        // on generation:
+        // all optional fields get 0, except for the OS, which gets 255.
+        //
+
+
+
+        /// <summary>
+        ///   The comment on the GZIP stream.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   The GZIP format allows for each file to optionally have an associated
+        ///   comment stored with the file.  The comment is encoded with the ISO-8859-1
+        ///   code page.  To include a comment in a GZIP stream you create, set this
+        ///   property before calling <c>Write()</c> for the first time on the
+        ///   <c>GZipStream</c>.
+        /// </para>
+        ///
+        /// <para>
+        ///   When using <c>GZipStream</c> to decompress, you can retrieve this property
+        ///   after the first call to <c>Read()</c>.  If no comment has been set in the
+        ///   GZIP bytestream, the Comment property will return <c>null</c>
+        ///   (<c>Nothing</c> in VB).
+        /// </para>
+        /// </remarks>
+        public String Comment
+        {
+            get
+            {
+                return _Comment;
+            }
+            set
+            {
+                if (_disposed) throw new ObjectDisposedException("GZipStream");
+                _Comment = value;
+            }
+        }
+
+        /// <summary>
+        ///   The FileName for the GZIP stream.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///
+        /// <para>
+        ///   The GZIP format optionally allows each file to have an associated
+        ///   filename.  When compressing data (through <c>Write()</c>), set this
+        ///   FileName before calling <c>Write()</c> the first time on the <c>GZipStream</c>.
+        ///   The actual filename is encoded into the GZIP bytestream with the
+        ///   ISO-8859-1 code page, according to RFC 1952. It is the application's
+        ///   responsibility to insure that the FileName can be encoded and decoded
+        ///   correctly with this code page.
+        /// </para>
+        ///
+        /// <para>
+        ///   When decompressing (through <c>Read()</c>), you can retrieve this value
+        ///   any time after the first <c>Read()</c>.  In the case where there was no filename
+        ///   encoded into the GZIP bytestream, the property will return <c>null</c> (<c>Nothing</c>
+        ///   in VB).
+        /// </para>
+        /// </remarks>
+        public String FileName
+        {
+            get { return _FileName; }
+            set
+            {
+                if (_disposed) throw new ObjectDisposedException("GZipStream");
+                _FileName = value;
+                if (_FileName == null) return;
+                if (_FileName.IndexOf("/") != -1)
+                {
+                    _FileName = _FileName.Replace("/", "\\");
+                }
+                if (_FileName.EndsWith("\\"))
+                    throw new Exception("Illegal filename");
+                if (_FileName.IndexOf("\\") != -1)
+                {
+                    // trim any leading path
+                    _FileName = Path.GetFileName(_FileName);
+                }
+            }
+        }
+
+        /// <summary>
+        ///   The last modified time for the GZIP stream.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///   GZIP allows the storage of a last modified time with each GZIP entry.
+        ///   When compressing data, you can set this before the first call to
+        ///   <c>Write()</c>.  When decompressing, you can retrieve this value any time
+        ///   after the first call to <c>Read()</c>.
+        /// </remarks>
+        public DateTime? LastModified;
+
+        /// <summary>
+        /// The CRC on the GZIP stream.
+        /// </summary>
+        /// <remarks>
+        /// This is used for internal error checking. You probably don't need to look at this property.
+        /// </remarks>
+        public int Crc32 { get { return _Crc32; } }
+
+        private int _headerByteCount;
+        internal ZlibBaseStream _baseStream;
+        bool _disposed;
+        bool _firstReadDone;
+        string _FileName;
+        string _Comment;
+        int _Crc32;
+
+
+        /// <summary>
+        ///   Create a <c>GZipStream</c> using the specified <c>CompressionMode</c>.
+        /// </summary>
+        /// <remarks>
+        ///
+        /// <para>
+        ///   When mode is <c>CompressionMode.Compress</c>, the <c>GZipStream</c> will use the
+        ///   default compression level.
+        /// </para>
+        ///
+        /// <para>
+        ///   As noted in the class documentation, the <c>CompressionMode</c> (Compress
+        ///   or Decompress) also establishes the "direction" of the stream.  A
+        ///   <c>GZipStream</c> with <c>CompressionMode.Compress</c> works only through
+        ///   <c>Write()</c>.  A <c>GZipStream</c> with
+        ///   <c>CompressionMode.Decompress</c> works only through <c>Read()</c>.
+        /// </para>
+        ///
+        /// </remarks>
+        ///
+        /// <example>
+        ///   This example shows how to use a GZipStream to compress data.
+        /// <code>
+        /// using (System.IO.Stream input = System.IO.File.OpenRead(fileToCompress))
+        /// {
+        ///     using (var raw = System.IO.File.Create(outputFile))
+        ///     {
+        ///         using (Stream compressor = new GZipStream(raw, CompressionMode.Compress))
+        ///         {
+        ///             byte[] buffer = new byte[WORKING_BUFFER_SIZE];
+        ///             int n;
+        ///             while ((n= input.Read(buffer, 0, buffer.Length)) != 0)
+        ///             {
+        ///                 compressor.Write(buffer, 0, n);
+        ///             }
+        ///         }
+        ///     }
+        /// }
+        /// </code>
+        /// <code lang="VB">
+        /// Dim outputFile As String = (fileToCompress &amp; ".compressed")
+        /// Using input As Stream = File.OpenRead(fileToCompress)
+        ///     Using raw As FileStream = File.Create(outputFile)
+        ///     Using compressor As Stream = New GZipStream(raw, CompressionMode.Compress)
+        ///         Dim buffer As Byte() = New Byte(4096) {}
+        ///         Dim n As Integer = -1
+        ///         Do While (n &lt;&gt; 0)
+        ///             If (n &gt; 0) Then
+        ///                 compressor.Write(buffer, 0, n)
+        ///             End If
+        ///             n = input.Read(buffer, 0, buffer.Length)
+        ///         Loop
+        ///     End Using
+        ///     End Using
+        /// End Using
+        /// </code>
+        /// </example>
+        ///
+        /// <example>
+        /// This example shows how to use a GZipStream to uncompress a file.
+        /// <code>
+        /// private void GunZipFile(string filename)
+        /// {
+        ///     if (!filename.EndsWith(".gz))
+        ///         throw new ArgumentException("filename");
+        ///     var DecompressedFile = filename.Substring(0,filename.Length-3);
+        ///     byte[] working = new byte[WORKING_BUFFER_SIZE];
+        ///     int n= 1;
+        ///     using (System.IO.Stream input = System.IO.File.OpenRead(filename))
+        ///     {
+        ///         using (Stream decompressor= new Ionic.Zlib.GZipStream(input, CompressionMode.Decompress, true))
+        ///         {
+        ///             using (var output = System.IO.File.Create(DecompressedFile))
+        ///             {
+        ///                 while (n !=0)
+        ///                 {
+        ///                     n= decompressor.Read(working, 0, working.Length);
+        ///                     if (n > 0)
+        ///                     {
+        ///                         output.Write(working, 0, n);
+        ///                     }
+        ///                 }
+        ///             }
+        ///         }
+        ///     }
+        /// }
+        /// </code>
+        ///
+        /// <code lang="VB">
+        /// Private Sub GunZipFile(ByVal filename as String)
+        ///     If Not (filename.EndsWith(".gz)) Then
+        ///         Throw New ArgumentException("filename")
+        ///     End If
+        ///     Dim DecompressedFile as String = filename.Substring(0,filename.Length-3)
+        ///     Dim working(WORKING_BUFFER_SIZE) as Byte
+        ///     Dim n As Integer = 1
+        ///     Using input As Stream = File.OpenRead(filename)
+        ///         Using decompressor As Stream = new Ionic.Zlib.GZipStream(input, CompressionMode.Decompress, True)
+        ///             Using output As Stream = File.Create(UncompressedFile)
+        ///                 Do
+        ///                     n= decompressor.Read(working, 0, working.Length)
+        ///                     If n > 0 Then
+        ///                         output.Write(working, 0, n)
+        ///                     End IF
+        ///                 Loop While (n  > 0)
+        ///             End Using
+        ///         End Using
+        ///     End Using
+        /// End Sub
+        /// </code>
+        /// </example>
+        ///
+        /// <param name="stream">The stream which will be read or written.</param>
+        /// <param name="mode">Indicates whether the GZipStream will compress or decompress.</param>
+        public GZipStream(Stream stream, CompressionMode mode)
+            : this(stream, mode, CompressionLevel.Default, false)
+        {
+        }
+
+        /// <summary>
+        ///   Create a <c>GZipStream</c> using the specified <c>CompressionMode</c> and
+        ///   the specified <c>CompressionLevel</c>.
+        /// </summary>
+        /// <remarks>
+        ///
+        /// <para>
+        ///   The <c>CompressionMode</c> (Compress or Decompress) also establishes the
+        ///   "direction" of the stream.  A <c>GZipStream</c> with
+        ///   <c>CompressionMode.Compress</c> works only through <c>Write()</c>.  A
+        ///   <c>GZipStream</c> with <c>CompressionMode.Decompress</c> works only
+        ///   through <c>Read()</c>.
+        /// </para>
+        ///
+        /// </remarks>
+        ///
+        /// <example>
+        ///
+        /// This example shows how to use a <c>GZipStream</c> to compress a file into a .gz file.
+        ///
+        /// <code>
+        /// using (System.IO.Stream input = System.IO.File.OpenRead(fileToCompress))
+        /// {
+        ///     using (var raw = System.IO.File.Create(fileToCompress + ".gz"))
+        ///     {
+        ///         using (Stream compressor = new GZipStream(raw,
+        ///                                                   CompressionMode.Compress,
+        ///                                                   CompressionLevel.BestCompression))
+        ///         {
+        ///             byte[] buffer = new byte[WORKING_BUFFER_SIZE];
+        ///             int n;
+        ///             while ((n= input.Read(buffer, 0, buffer.Length)) != 0)
+        ///             {
+        ///                 compressor.Write(buffer, 0, n);
+        ///             }
+        ///         }
+        ///     }
+        /// }
+        /// </code>
+        ///
+        /// <code lang="VB">
+        /// Using input As Stream = File.OpenRead(fileToCompress)
+        ///     Using raw As FileStream = File.Create(fileToCompress &amp; ".gz")
+        ///         Using compressor As Stream = New GZipStream(raw, CompressionMode.Compress, CompressionLevel.BestCompression)
+        ///             Dim buffer As Byte() = New Byte(4096) {}
+        ///             Dim n As Integer = -1
+        ///             Do While (n &lt;&gt; 0)
+        ///                 If (n &gt; 0) Then
+        ///                     compressor.Write(buffer, 0, n)
+        ///                 End If
+        ///                 n = input.Read(buffer, 0, buffer.Length)
+        ///             Loop
+        ///         End Using
+        ///     End Using
+        /// End Using
+        /// </code>
+        /// </example>
+        /// <param name="stream">The stream to be read or written while deflating or inflating.</param>
+        /// <param name="mode">Indicates whether the <c>GZipStream</c> will compress or decompress.</param>
+        /// <param name="level">A tuning knob to trade speed for effectiveness.</param>
+        public GZipStream(Stream stream, CompressionMode mode, CompressionLevel level)
+            : this(stream, mode, level, false)
+        {
+        }
+
+        /// <summary>
+        ///   Create a <c>GZipStream</c> using the specified <c>CompressionMode</c>, and
+        ///   explicitly specify whether the stream should be left open after Deflation
+        ///   or Inflation.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   This constructor allows the application to request that the captive stream
+        ///   remain open after the deflation or inflation occurs.  By default, after
+        ///   <c>Close()</c> is called on the stream, the captive stream is also
+        ///   closed. In some cases this is not desired, for example if the stream is a
+        ///   memory stream that will be re-read after compressed data has been written
+        ///   to it.  Specify true for the <paramref name="leaveOpen"/> parameter to leave
+        ///   the stream open.
+        /// </para>
+        ///
+        /// <para>
+        ///   The <see cref="CompressionMode"/> (Compress or Decompress) also
+        ///   establishes the "direction" of the stream.  A <c>GZipStream</c> with
+        ///   <c>CompressionMode.Compress</c> works only through <c>Write()</c>.  A <c>GZipStream</c>
+        ///   with <c>CompressionMode.Decompress</c> works only through <c>Read()</c>.
+        /// </para>
+        ///
+        /// <para>
+        ///   The <c>GZipStream</c> will use the default compression level. If you want
+        ///   to specify the compression level, see <see cref="GZipStream(Stream,
+        ///   CompressionMode, CompressionLevel, bool)"/>.
+        /// </para>
+        ///
+        /// <para>
+        ///   See the other overloads of this constructor for example code.
+        /// </para>
+        ///
+        /// </remarks>
+        ///
+        /// <param name="stream">
+        ///   The stream which will be read or written. This is called the "captive"
+        ///   stream in other places in this documentation.
+        /// </param>
+        ///
+        /// <param name="mode">Indicates whether the GZipStream will compress or decompress.
+        /// </param>
+        ///
+        /// <param name="leaveOpen">
+        ///   true if the application would like the base stream to remain open after
+        ///   inflation/deflation.
+        /// </param>
+        public GZipStream(Stream stream, CompressionMode mode, bool leaveOpen)
+            : this(stream, mode, CompressionLevel.Default, leaveOpen)
+        {
+        }
+
+        /// <summary>
+        ///   Create a <c>GZipStream</c> using the specified <c>CompressionMode</c> and the
+        ///   specified <c>CompressionLevel</c>, and explicitly specify whether the
+        ///   stream should be left open after Deflation or Inflation.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///
+        /// <para>
+        ///   This constructor allows the application to request that the captive stream
+        ///   remain open after the deflation or inflation occurs.  By default, after
+        ///   <c>Close()</c> is called on the stream, the captive stream is also
+        ///   closed. In some cases this is not desired, for example if the stream is a
+        ///   memory stream that will be re-read after compressed data has been written
+        ///   to it.  Specify true for the <paramref name="leaveOpen"/> parameter to
+        ///   leave the stream open.
+        /// </para>
+        ///
+        /// <para>
+        ///   As noted in the class documentation, the <c>CompressionMode</c> (Compress
+        ///   or Decompress) also establishes the "direction" of the stream.  A
+        ///   <c>GZipStream</c> with <c>CompressionMode.Compress</c> works only through
+        ///   <c>Write()</c>.  A <c>GZipStream</c> with <c>CompressionMode.Decompress</c> works only
+        ///   through <c>Read()</c>.
+        /// </para>
+        ///
+        /// </remarks>
+        ///
+        /// <example>
+        ///   This example shows how to use a <c>GZipStream</c> to compress data.
+        /// <code>
+        /// using (System.IO.Stream input = System.IO.File.OpenRead(fileToCompress))
+        /// {
+        ///     using (var raw = System.IO.File.Create(outputFile))
+        ///     {
+        ///         using (Stream compressor = new GZipStream(raw, CompressionMode.Compress, CompressionLevel.BestCompression, true))
+        ///         {
+        ///             byte[] buffer = new byte[WORKING_BUFFER_SIZE];
+        ///             int n;
+        ///             while ((n= input.Read(buffer, 0, buffer.Length)) != 0)
+        ///             {
+        ///                 compressor.Write(buffer, 0, n);
+        ///             }
+        ///         }
+        ///     }
+        /// }
+        /// </code>
+        /// <code lang="VB">
+        /// Dim outputFile As String = (fileToCompress &amp; ".compressed")
+        /// Using input As Stream = File.OpenRead(fileToCompress)
+        ///     Using raw As FileStream = File.Create(outputFile)
+        ///     Using compressor As Stream = New GZipStream(raw, CompressionMode.Compress, CompressionLevel.BestCompression, True)
+        ///         Dim buffer As Byte() = New Byte(4096) {}
+        ///         Dim n As Integer = -1
+        ///         Do While (n &lt;&gt; 0)
+        ///             If (n &gt; 0) Then
+        ///                 compressor.Write(buffer, 0, n)
+        ///             End If
+        ///             n = input.Read(buffer, 0, buffer.Length)
+        ///         Loop
+        ///     End Using
+        ///     End Using
+        /// End Using
+        /// </code>
+        /// </example>
+        /// <param name="stream">The stream which will be read or written.</param>
+        /// <param name="mode">Indicates whether the GZipStream will compress or decompress.</param>
+        /// <param name="leaveOpen">true if the application would like the stream to remain open after inflation/deflation.</param>
+        /// <param name="level">A tuning knob to trade speed for effectiveness.</param>
+        public GZipStream(Stream stream, CompressionMode mode, CompressionLevel level, bool leaveOpen)
+        {
+            _baseStream = new ZlibBaseStream(stream, mode, level, ZlibStreamFlavor.GZIP, leaveOpen);
+        }
+
+        #region Zlib properties
+
+        /// <summary>
+        /// This property sets the flush behavior on the stream.
+        /// </summary>
+        virtual public FlushType FlushMode
+        {
+            get { return (this._baseStream._flushMode); }
+            set {
+                if (_disposed) throw new ObjectDisposedException("GZipStream");
+                this._baseStream._flushMode = value;
+            }
+        }
+
+        /// <summary>
+        ///   The size of the working buffer for the compression codec.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   The working buffer is used for all stream operations.  The default size is
+        ///   1024 bytes.  The minimum size is 128 bytes. You may get better performance
+        ///   with a larger buffer.  Then again, you might not.  You would have to test
+        ///   it.
+        /// </para>
+        ///
+        /// <para>
+        ///   Set this before the first call to <c>Read()</c> or <c>Write()</c> on the
+        ///   stream. If you try to set it afterwards, it will throw.
+        /// </para>
+        /// </remarks>
+        public int BufferSize
+        {
+            get
+            {
+                return this._baseStream._bufferSize;
+            }
+            set
+            {
+                if (_disposed) throw new ObjectDisposedException("GZipStream");
+                if (this._baseStream._workingBuffer != null)
+                    throw new ZlibException("The working buffer is already set.");
+                if (value < ZlibConstants.WorkingBufferSizeMin)
+                    throw new ZlibException(String.Format("Don't be silly. {0} bytes?? Use a bigger buffer, at least {1}.", value, ZlibConstants.WorkingBufferSizeMin));
+                this._baseStream._bufferSize = value;
+            }
+        }
+
+
+        /// <summary> Returns the total number of bytes input so far.</summary>
+        virtual public long TotalIn
+        {
+            get
+            {
+                return this._baseStream._z.TotalBytesIn;
+            }
+        }
+
+        /// <summary> Returns the total number of bytes output so far.</summary>
+        virtual public long TotalOut
+        {
+            get
+            {
+                return this._baseStream._z.TotalBytesOut;
+            }
+        }
+
+        #endregion
+
+        #region Stream methods
+
+        /// <summary>
+        ///   Dispose the stream.
+        /// </summary>
+        /// <remarks>
+        ///   <para>
+        ///     This may or may not result in a <c>Close()</c> call on the captive
+        ///     stream.  See the constructors that have a <c>leaveOpen</c> parameter
+        ///     for more information.
+        ///   </para>
+        ///   <para>
+        ///     This method may be invoked in two distinct scenarios.  If disposing
+        ///     == true, the method has been called directly or indirectly by a
+        ///     user's code, for example via the public Dispose() method. In this
+        ///     case, both managed and unmanaged resources can be referenced and
+        ///     disposed.  If disposing == false, the method has been called by the
+        ///     runtime from inside the object finalizer and this method should not
+        ///     reference other objects; in that case only unmanaged resources must
+        ///     be referenced or disposed.
+        ///   </para>
+        /// </remarks>
+        /// <param name="disposing">
+        ///   indicates whether the Dispose method was invoked by user code.
+        /// </param>
+        protected override void Dispose(bool disposing)
+        {
+            try
+            {
+                if (!_disposed)
+                {
+                    if (disposing && (this._baseStream != null))
+                    {
+                        this._baseStream.Close();
+                        this._Crc32 = _baseStream.Crc32;
+                    }
+                    _disposed = true;
+                }
+            }
+            finally
+            {
+                base.Dispose(disposing);
+            }
+        }
+
+
+        /// <summary>
+        /// Indicates whether the stream can be read.
+        /// </summary>
+        /// <remarks>
+        /// The return value depends on whether the captive stream supports reading.
+        /// </remarks>
+        public override bool CanRead
+        {
+            get
+            {
+                if (_disposed) throw new ObjectDisposedException("GZipStream");
+                return _baseStream._stream.CanRead;
+            }
+        }
+
+        /// <summary>
+        /// Indicates whether the stream supports Seek operations.
+        /// </summary>
+        /// <remarks>
+        /// Always returns false.
+        /// </remarks>
+        public override bool CanSeek
+        {
+            get { return false; }
+        }
+
+
+        /// <summary>
+        /// Indicates whether the stream can be written.
+        /// </summary>
+        /// <remarks>
+        /// The return value depends on whether the captive stream supports writing.
+        /// </remarks>
+        public override bool CanWrite
+        {
+            get
+            {
+                if (_disposed) throw new ObjectDisposedException("GZipStream");
+                return _baseStream._stream.CanWrite;
+            }
+        }
+
+        /// <summary>
+        /// Flush the stream.
+        /// </summary>
+        public override void Flush()
+        {
+            if (_disposed) throw new ObjectDisposedException("GZipStream");
+            _baseStream.Flush();
+        }
+
+        /// <summary>
+        /// Reading this property always throws a <see cref="NotImplementedException"/>.
+        /// </summary>
+        public override long Length
+        {
+            get { throw new NotImplementedException(); }
+        }
+
+        /// <summary>
+        ///   The position of the stream pointer.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///   Setting this property always throws a <see
+        ///   cref="NotImplementedException"/>. Reading will return the total bytes
+        ///   written out, if used in writing, or the total bytes read in, if used in
+        ///   reading.  The count may refer to compressed bytes or uncompressed bytes,
+        ///   depending on how you've used the stream.
+        /// </remarks>
+        public override long Position
+        {
+            get
+            {
+                if (this._baseStream._streamMode == Ionic.Zlib.ZlibBaseStream.StreamMode.Writer)
+                    return this._baseStream._z.TotalBytesOut + _headerByteCount;
+                if (this._baseStream._streamMode == Ionic.Zlib.ZlibBaseStream.StreamMode.Reader)
+                    return this._baseStream._z.TotalBytesIn + this._baseStream._gzipHeaderByteCount;
+                return 0;
+            }
+
+            set { throw new NotImplementedException(); }
+        }
+
+        /// <summary>
+        ///   Read and decompress data from the source stream.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///   With a <c>GZipStream</c>, decompression is done through reading.
+        /// </remarks>
+        ///
+        /// <example>
+        /// <code>
+        /// byte[] working = new byte[WORKING_BUFFER_SIZE];
+        /// using (System.IO.Stream input = System.IO.File.OpenRead(_CompressedFile))
+        /// {
+        ///     using (Stream decompressor= new Ionic.Zlib.GZipStream(input, CompressionMode.Decompress, true))
+        ///     {
+        ///         using (var output = System.IO.File.Create(_DecompressedFile))
+        ///         {
+        ///             int n;
+        ///             while ((n= decompressor.Read(working, 0, working.Length)) !=0)
+        ///             {
+        ///                 output.Write(working, 0, n);
+        ///             }
+        ///         }
+        ///     }
+        /// }
+        /// </code>
+        /// </example>
+        /// <param name="buffer">The buffer into which the decompressed data should be placed.</param>
+        /// <param name="offset">the offset within that data array to put the first byte read.</param>
+        /// <param name="count">the number of bytes to read.</param>
+        /// <returns>the number of bytes actually read</returns>
+        public override int Read(byte[] buffer, int offset, int count)
+        {
+            if (_disposed) throw new ObjectDisposedException("GZipStream");
+            int n = _baseStream.Read(buffer, offset, count);
+
+            // Console.WriteLine("GZipStream::Read(buffer, off({0}), c({1}) = {2}", offset, count, n);
+            // Console.WriteLine( Util.FormatByteArray(buffer, offset, n) );
+
+            if (!_firstReadDone)
+            {
+                _firstReadDone = true;
+                FileName = _baseStream._GzipFileName;
+                Comment = _baseStream._GzipComment;
+            }
+            return n;
+        }
+
+
+
+        /// <summary>
+        ///   Calling this method always throws a <see cref="NotImplementedException"/>.
+        /// </summary>
+        /// <param name="offset">irrelevant; it will always throw!</param>
+        /// <param name="origin">irrelevant; it will always throw!</param>
+        /// <returns>irrelevant!</returns>
+        public override long Seek(long offset, SeekOrigin origin)
+        {
+            throw new NotImplementedException();
+        }
+
+        /// <summary>
+        ///   Calling this method always throws a <see cref="NotImplementedException"/>.
+        /// </summary>
+        /// <param name="value">irrelevant; this method will always throw!</param>
+        public override void SetLength(long value)
+        {
+            throw new NotImplementedException();
+        }
+
+        /// <summary>
+        ///   Write data to the stream.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   If you wish to use the <c>GZipStream</c> to compress data while writing,
+        ///   you can create a <c>GZipStream</c> with <c>CompressionMode.Compress</c>, and a
+        ///   writable output stream.  Then call <c>Write()</c> on that <c>GZipStream</c>,
+        ///   providing uncompressed data as input.  The data sent to the output stream
+        ///   will be the compressed form of the data written.
+        /// </para>
+        ///
+        /// <para>
+        ///   A <c>GZipStream</c> can be used for <c>Read()</c> or <c>Write()</c>, but not
+        ///   both. Writing implies compression.  Reading implies decompression.
+        /// </para>
+        ///
+        /// </remarks>
+        /// <param name="buffer">The buffer holding data to write to the stream.</param>
+        /// <param name="offset">the offset within that data array to find the first byte to write.</param>
+        /// <param name="count">the number of bytes to write.</param>
+        public override void Write(byte[] buffer, int offset, int count)
+        {
+            if (_disposed) throw new ObjectDisposedException("GZipStream");
+            if (_baseStream._streamMode == Ionic.Zlib.ZlibBaseStream.StreamMode.Undefined)
+            {
+                //Console.WriteLine("GZipStream: First write");
+                if (_baseStream._wantCompress)
+                {
+                    // first write in compression, therefore, emit the GZIP header
+                    _headerByteCount = EmitHeader();
+                }
+                else
+                {
+                    throw new InvalidOperationException();
+                }
+            }
+
+            _baseStream.Write(buffer, offset, count);
+        }
+        #endregion
+
+
+        internal static readonly System.DateTime _unixEpoch = new System.DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
+#if SILVERLIGHT || NETCF
+        internal static readonly System.Text.Encoding iso8859dash1 = new Ionic.Encoding.Iso8859Dash1Encoding();
+#else
+        internal static readonly System.Text.Encoding iso8859dash1 = System.Text.Encoding.GetEncoding("iso-8859-1");
+#endif
+
+
+        private int EmitHeader()
+        {
+            byte[] commentBytes = (Comment == null) ? null : iso8859dash1.GetBytes(Comment);
+            byte[] filenameBytes = (FileName == null) ? null : iso8859dash1.GetBytes(FileName);
+
+            int cbLength = (Comment == null) ? 0 : commentBytes.Length + 1;
+            int fnLength = (FileName == null) ? 0 : filenameBytes.Length + 1;
+
+            int bufferLength = 10 + cbLength + fnLength;
+            byte[] header = new byte[bufferLength];
+            int i = 0;
+            // ID
+            header[i++] = 0x1F;
+            header[i++] = 0x8B;
+
+            // compression method
+            header[i++] = 8;
+            byte flag = 0;
+            if (Comment != null)
+                flag ^= 0x10;
+            if (FileName != null)
+                flag ^= 0x8;
+
+            // flag
+            header[i++] = flag;
+
+            // mtime
+            if (!LastModified.HasValue) LastModified = DateTime.Now;
+            System.TimeSpan delta = LastModified.Value - _unixEpoch;
+            Int32 timet = (Int32)delta.TotalSeconds;
+            Array.Copy(BitConverter.GetBytes(timet), 0, header, i, 4);
+            i += 4;
+
+            // xflg
+            header[i++] = 0;    // this field is totally useless
+            // OS
+            header[i++] = 0xFF; // 0xFF == unspecified
+
+            // extra field length - only if FEXTRA is set, which it is not.
+            //header[i++]= 0;
+            //header[i++]= 0;
+
+            // filename
+            if (fnLength != 0)
+            {
+                Array.Copy(filenameBytes, 0, header, i, fnLength - 1);
+                i += fnLength - 1;
+                header[i++] = 0; // terminate
+            }
+
+            // comment
+            if (cbLength != 0)
+            {
+                Array.Copy(commentBytes, 0, header, i, cbLength - 1);
+                i += cbLength - 1;
+                header[i++] = 0; // terminate
+            }
+
+            _baseStream._stream.Write(header, 0, header.Length);
+
+            return header.Length; // bytes written
+        }
+
+
+
+        /// <summary>
+        ///   Compress a string into a byte array using GZip.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///   Uncompress it with <see cref="GZipStream.UncompressString(byte[])"/>.
+        /// </remarks>
+        ///
+        /// <seealso cref="GZipStream.UncompressString(byte[])"/>
+        /// <seealso cref="GZipStream.CompressBuffer(byte[])"/>
+        ///
+        /// <param name="s">
+        ///   A string to compress. The string will first be encoded
+        ///   using UTF8, then compressed.
+        /// </param>
+        ///
+        /// <returns>The string in compressed form</returns>
+        public static byte[] CompressString(String s)
+        {
+            using (var ms = new MemoryStream())
+            {
+                System.IO.Stream compressor =
+                    new GZipStream(ms, CompressionMode.Compress, CompressionLevel.BestCompression);
+                ZlibBaseStream.CompressString(s, compressor);
+                return ms.ToArray();
+            }
+        }
+
+
+        /// <summary>
+        ///   Compress a byte array into a new byte array using GZip.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///   Uncompress it with <see cref="GZipStream.UncompressBuffer(byte[])"/>.
+        /// </remarks>
+        ///
+        /// <seealso cref="GZipStream.CompressString(string)"/>
+        /// <seealso cref="GZipStream.UncompressBuffer(byte[])"/>
+        ///
+        /// <param name="b">
+        ///   A buffer to compress.
+        /// </param>
+        ///
+        /// <returns>The data in compressed form</returns>
+        public static byte[] CompressBuffer(byte[] b)
+        {
+            using (var ms = new MemoryStream())
+            {
+                System.IO.Stream compressor =
+                    new GZipStream( ms, CompressionMode.Compress, CompressionLevel.BestCompression );
+
+                ZlibBaseStream.CompressBuffer(b, compressor);
+                return ms.ToArray();
+            }
+        }
+
+
+        /// <summary>
+        ///   Uncompress a GZip'ed byte array into a single string.
+        /// </summary>
+        ///
+        /// <seealso cref="GZipStream.CompressString(String)"/>
+        /// <seealso cref="GZipStream.UncompressBuffer(byte[])"/>
+        ///
+        /// <param name="compressed">
+        ///   A buffer containing GZIP-compressed data.
+        /// </param>
+        ///
+        /// <returns>The uncompressed string</returns>
+        public static String UncompressString(byte[] compressed)
+        {
+            using (var input = new MemoryStream(compressed))
+            {
+                Stream decompressor = new GZipStream(input, CompressionMode.Decompress);
+                return ZlibBaseStream.UncompressString(compressed, decompressor);
+            }
+        }
+
+
+        /// <summary>
+        ///   Uncompress a GZip'ed byte array into a byte array.
+        /// </summary>
+        ///
+        /// <seealso cref="GZipStream.CompressBuffer(byte[])"/>
+        /// <seealso cref="GZipStream.UncompressString(byte[])"/>
+        ///
+        /// <param name="compressed">
+        ///   A buffer containing data that has been compressed with GZip.
+        /// </param>
+        ///
+        /// <returns>The data in uncompressed form</returns>
+        public static byte[] UncompressBuffer(byte[] compressed)
+        {
+            using (var input = new System.IO.MemoryStream(compressed))
+            {
+                System.IO.Stream decompressor =
+                    new GZipStream( input, CompressionMode.Decompress );
+
+                return ZlibBaseStream.UncompressBuffer(compressed, decompressor);
+            }
+        }
+
+
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/Zlib/InfTree.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/Zlib/InfTree.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/Zlib/InfTree.cs	(revision 12707)
@@ -0,0 +1,436 @@
+// Inftree.cs
+// ------------------------------------------------------------------
+//
+// Copyright (c) 2009 Dino Chiesa and Microsoft Corporation.  
+// All rights reserved.
+//
+// This code module is part of DotNetZip, a zipfile class library.
+//
+// ------------------------------------------------------------------
+//
+// This code is licensed under the Microsoft Public License. 
+// See the file License.txt for the license details.
+// More info on: http://dotnetzip.codeplex.com
+//
+// ------------------------------------------------------------------
+//
+// last saved (in emacs): 
+// Time-stamp: <2009-October-28 12:43:54>
+//
+// ------------------------------------------------------------------
+//
+// This module defines classes used in  decompression. This code is derived
+// from the jzlib implementation of zlib. In keeping with the license for jzlib, 
+// the copyright to that code is below.
+//
+// ------------------------------------------------------------------
+// 
+// Copyright (c) 2000,2001,2002,2003 ymnk, JCraft,Inc. All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright 
+// notice, this list of conditions and the following disclaimer in 
+// the documentation and/or other materials provided with the distribution.
+// 
+// 3. The names of the authors may not be used to endorse or promote products
+// derived from this software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
+// INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
+// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// 
+// -----------------------------------------------------------------------
+//
+// This program is based on zlib-1.1.3; credit to authors
+// Jean-loup Gailly(jloup@gzip.org) and Mark Adler(madler@alumni.caltech.edu)
+// and contributors of zlib.
+//
+// -----------------------------------------------------------------------
+
+
+
+using System;
+namespace OfficeOpenXml.Packaging.Ionic.Zlib
+{
+        
+        sealed class InfTree
+        {
+                
+                private const int MANY = 1440;
+                
+                private const int Z_OK = 0;
+                private const int Z_STREAM_END = 1;
+                private const int Z_NEED_DICT = 2;
+                private const int Z_ERRNO = - 1;
+                private const int Z_STREAM_ERROR = - 2;
+                private const int Z_DATA_ERROR = - 3;
+                private const int Z_MEM_ERROR = - 4;
+                private const int Z_BUF_ERROR = - 5;
+                private const int Z_VERSION_ERROR = - 6;
+                
+                internal const int fixed_bl = 9;
+                internal const int fixed_bd = 5;
+                
+                //UPGRADE_NOTE: Final was removed from the declaration of 'fixed_tl'. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"
+                internal static readonly int[] fixed_tl = new int[]{96, 7, 256, 0, 8, 80, 0, 8, 16, 84, 8, 115, 82, 7, 31, 0, 8, 112, 0, 8, 48, 0, 9, 192, 80, 7, 10, 0, 8, 96, 0, 8, 32, 0, 9, 160, 0, 8, 0, 0, 8, 128, 0, 8, 64, 0, 9, 224, 80, 7, 6, 0, 8, 88, 0, 8, 24, 0, 9, 144, 83, 7, 59, 0, 8, 120, 0, 8, 56, 0, 9, 208, 81, 7, 17, 0, 8, 104, 0, 8, 40, 0, 9, 176, 0, 8, 8, 0, 8, 136, 0, 8, 72, 0, 9, 240, 80, 7, 4, 0, 8, 84, 0, 8, 20, 85, 8, 227, 83, 7, 43, 0, 8, 116, 0, 8, 52, 0, 9, 200, 81, 7, 13, 0, 8, 100, 0, 8, 36, 0, 9, 168, 0, 8, 4, 0, 8, 132, 0, 8, 68, 0, 9, 232, 80, 7, 8, 0, 8, 92, 0, 8, 28, 0, 9, 152, 84, 7, 83, 0, 8, 124, 0, 8, 60, 0, 9, 216, 82, 7, 23, 0, 8, 108, 0, 8, 44, 0, 9, 184, 0, 8, 12, 0, 8, 140, 0, 8, 76, 0, 9, 248, 80, 7, 3, 0, 8, 82, 0, 8, 18, 85, 8, 163, 83, 7, 35, 0, 8, 114, 0, 8, 50, 0, 9, 196, 81, 7, 11, 0, 8, 98, 0, 8, 34, 0, 9, 164, 0, 8, 2, 0, 8, 130, 0, 8, 66, 0, 9, 228, 80, 7, 7, 0, 8, 90, 0, 8, 26, 0, 9, 148, 84, 7, 67, 0, 8, 122, 0, 8, 58, 0, 9, 212, 82, 7, 19, 0, 8, 106, 0, 8, 42, 0, 9, 180, 0, 8, 10, 0, 8, 138, 0, 8, 74, 0, 9, 244, 80, 7, 5, 0, 8, 86, 0, 8, 22, 192, 8, 0, 83, 7, 51, 0, 8, 118, 0, 8, 54, 0, 9, 204, 81, 7, 15, 0, 8, 102, 0, 8, 38, 0, 9, 172, 0, 8, 6, 0, 8, 134, 0, 8, 70, 0, 9, 236, 80, 7, 9, 0, 8, 94, 0, 8, 30, 0, 9, 156, 84, 7, 99, 0, 8, 126, 0, 8, 62, 0, 9, 220, 82, 7, 27, 0, 8, 110, 0, 8, 46, 0, 9, 188, 0, 8, 14, 0, 8, 142, 0, 8, 78, 0, 9, 252, 96, 7, 256, 0, 8, 81, 0, 8, 17, 85, 8, 131, 82, 7, 31, 0, 8, 113, 0, 8, 49, 0, 9, 194, 80, 7, 10, 0, 8, 97, 0, 8, 33, 0, 9, 162, 0, 8, 1, 0, 8, 129, 0, 8, 65, 0, 9, 226, 80, 7, 6, 0, 8, 89, 0, 8, 25, 0, 9, 146, 83, 7, 59, 0, 8, 121, 0, 8, 57, 0, 9, 210, 81, 7, 17, 0, 8, 105, 0, 8, 41, 0, 9, 178, 0, 8, 9, 0, 8, 137, 0, 8, 73, 0, 9, 242, 80, 7, 4, 0, 8, 85, 0, 8, 21, 80, 8, 258, 83, 7, 43, 0, 8, 117, 0, 8, 53, 0, 9, 202, 81, 7, 13, 0, 8, 101, 0, 8, 37, 0, 9, 170, 0, 8, 5, 0, 8, 133, 0, 8, 69, 0, 9, 234, 80, 7, 8, 0, 8, 93, 0, 8, 29, 0, 9, 154, 84, 7, 83, 0, 8, 125, 0, 8, 61, 0, 9, 218, 82, 7, 23, 0, 8, 109, 0, 8, 45, 0, 9, 186, 
+                        0, 8, 13, 0, 8, 141, 0, 8, 77, 0, 9, 250, 80, 7, 3, 0, 8, 83, 0, 8, 19, 85, 8, 195, 83, 7, 35, 0, 8, 115, 0, 8, 51, 0, 9, 198, 81, 7, 11, 0, 8, 99, 0, 8, 35, 0, 9, 166, 0, 8, 3, 0, 8, 131, 0, 8, 67, 0, 9, 230, 80, 7, 7, 0, 8, 91, 0, 8, 27, 0, 9, 150, 84, 7, 67, 0, 8, 123, 0, 8, 59, 0, 9, 214, 82, 7, 19, 0, 8, 107, 0, 8, 43, 0, 9, 182, 0, 8, 11, 0, 8, 139, 0, 8, 75, 0, 9, 246, 80, 7, 5, 0, 8, 87, 0, 8, 23, 192, 8, 0, 83, 7, 51, 0, 8, 119, 0, 8, 55, 0, 9, 206, 81, 7, 15, 0, 8, 103, 0, 8, 39, 0, 9, 174, 0, 8, 7, 0, 8, 135, 0, 8, 71, 0, 9, 238, 80, 7, 9, 0, 8, 95, 0, 8, 31, 0, 9, 158, 84, 7, 99, 0, 8, 127, 0, 8, 63, 0, 9, 222, 82, 7, 27, 0, 8, 111, 0, 8, 47, 0, 9, 190, 0, 8, 15, 0, 8, 143, 0, 8, 79, 0, 9, 254, 96, 7, 256, 0, 8, 80, 0, 8, 16, 84, 8, 115, 82, 7, 31, 0, 8, 112, 0, 8, 48, 0, 9, 193, 80, 7, 10, 0, 8, 96, 0, 8, 32, 0, 9, 161, 0, 8, 0, 0, 8, 128, 0, 8, 64, 0, 9, 225, 80, 7, 6, 0, 8, 88, 0, 8, 24, 0, 9, 145, 83, 7, 59, 0, 8, 120, 0, 8, 56, 0, 9, 209, 81, 7, 17, 0, 8, 104, 0, 8, 40, 0, 9, 177, 0, 8, 8, 0, 8, 136, 0, 8, 72, 0, 9, 241, 80, 7, 4, 0, 8, 84, 0, 8, 20, 85, 8, 227, 83, 7, 43, 0, 8, 116, 0, 8, 52, 0, 9, 201, 81, 7, 13, 0, 8, 100, 0, 8, 36, 0, 9, 169, 0, 8, 4, 0, 8, 132, 0, 8, 68, 0, 9, 233, 80, 7, 8, 0, 8, 92, 0, 8, 28, 0, 9, 153, 84, 7, 83, 0, 8, 124, 0, 8, 60, 0, 9, 217, 82, 7, 23, 0, 8, 108, 0, 8, 44, 0, 9, 185, 0, 8, 12, 0, 8, 140, 0, 8, 76, 0, 9, 249, 80, 7, 3, 0, 8, 82, 0, 8, 18, 85, 8, 163, 83, 7, 35, 0, 8, 114, 0, 8, 50, 0, 9, 197, 81, 7, 11, 0, 8, 98, 0, 8, 34, 0, 9, 165, 0, 8, 2, 0, 8, 130, 0, 8, 66, 0, 9, 229, 80, 7, 7, 0, 8, 90, 0, 8, 26, 0, 9, 149, 84, 7, 67, 0, 8, 122, 0, 8, 58, 0, 9, 213, 82, 7, 19, 0, 8, 106, 0, 8, 42, 0, 9, 181, 0, 8, 10, 0, 8, 138, 0, 8, 74, 0, 9, 245, 80, 7, 5, 0, 8, 86, 0, 8, 22, 192, 8, 0, 83, 7, 51, 0, 8, 118, 0, 8, 54, 0, 9, 205, 81, 7, 15, 0, 8, 102, 0, 8, 38, 0, 9, 173, 0, 8, 6, 0, 8, 134, 0, 8, 70, 0, 9, 237, 80, 7, 9, 0, 8, 94, 0, 8, 30, 0, 9, 157, 84, 7, 99, 0, 8, 126, 0, 8, 62, 0, 9, 221, 82, 7, 27, 0, 8, 110, 0, 8, 46, 0, 9, 189, 0, 8, 
+                        14, 0, 8, 142, 0, 8, 78, 0, 9, 253, 96, 7, 256, 0, 8, 81, 0, 8, 17, 85, 8, 131, 82, 7, 31, 0, 8, 113, 0, 8, 49, 0, 9, 195, 80, 7, 10, 0, 8, 97, 0, 8, 33, 0, 9, 163, 0, 8, 1, 0, 8, 129, 0, 8, 65, 0, 9, 227, 80, 7, 6, 0, 8, 89, 0, 8, 25, 0, 9, 147, 83, 7, 59, 0, 8, 121, 0, 8, 57, 0, 9, 211, 81, 7, 17, 0, 8, 105, 0, 8, 41, 0, 9, 179, 0, 8, 9, 0, 8, 137, 0, 8, 73, 0, 9, 243, 80, 7, 4, 0, 8, 85, 0, 8, 21, 80, 8, 258, 83, 7, 43, 0, 8, 117, 0, 8, 53, 0, 9, 203, 81, 7, 13, 0, 8, 101, 0, 8, 37, 0, 9, 171, 0, 8, 5, 0, 8, 133, 0, 8, 69, 0, 9, 235, 80, 7, 8, 0, 8, 93, 0, 8, 29, 0, 9, 155, 84, 7, 83, 0, 8, 125, 0, 8, 61, 0, 9, 219, 82, 7, 23, 0, 8, 109, 0, 8, 45, 0, 9, 187, 0, 8, 13, 0, 8, 141, 0, 8, 77, 0, 9, 251, 80, 7, 3, 0, 8, 83, 0, 8, 19, 85, 8, 195, 83, 7, 35, 0, 8, 115, 0, 8, 51, 0, 9, 199, 81, 7, 11, 0, 8, 99, 0, 8, 35, 0, 9, 167, 0, 8, 3, 0, 8, 131, 0, 8, 67, 0, 9, 231, 80, 7, 7, 0, 8, 91, 0, 8, 27, 0, 9, 151, 84, 7, 67, 0, 8, 123, 0, 8, 59, 0, 9, 215, 82, 7, 19, 0, 8, 107, 0, 8, 43, 0, 9, 183, 0, 8, 11, 0, 8, 139, 0, 8, 75, 0, 9, 247, 80, 7, 5, 0, 8, 87, 0, 8, 23, 192, 8, 0, 83, 7, 51, 0, 8, 119, 0, 8, 55, 0, 9, 207, 81, 7, 15, 0, 8, 103, 0, 8, 39, 0, 9, 175, 0, 8, 7, 0, 8, 135, 0, 8, 71, 0, 9, 239, 80, 7, 9, 0, 8, 95, 0, 8, 31, 0, 9, 159, 84, 7, 99, 0, 8, 127, 0, 8, 63, 0, 9, 223, 82, 7, 27, 0, 8, 111, 0, 8, 47, 0, 9, 191, 0, 8, 15, 0, 8, 143, 0, 8, 79, 0, 9, 255};
+                //UPGRADE_NOTE: Final was removed from the declaration of 'fixed_td'. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"
+                internal static readonly int[] fixed_td = new int[]{80, 5, 1, 87, 5, 257, 83, 5, 17, 91, 5, 4097, 81, 5, 5, 89, 5, 1025, 85, 5, 65, 93, 5, 16385, 80, 5, 3, 88, 5, 513, 84, 5, 33, 92, 5, 8193, 82, 5, 9, 90, 5, 2049, 86, 5, 129, 192, 5, 24577, 80, 5, 2, 87, 5, 385, 83, 5, 25, 91, 5, 6145, 81, 5, 7, 89, 5, 1537, 85, 5, 97, 93, 5, 24577, 80, 5, 4, 88, 5, 769, 84, 5, 49, 92, 5, 12289, 82, 5, 13, 90, 5, 3073, 86, 5, 193, 192, 5, 24577};
+                
+                // Tables for deflate from PKZIP's appnote.txt.
+                //UPGRADE_NOTE: Final was removed from the declaration of 'cplens'. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"
+                internal static readonly int[] cplens = new int[]{3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
+                
+                // see note #13 above about 258
+                //UPGRADE_NOTE: Final was removed from the declaration of 'cplext'. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"
+                internal static readonly int[] cplext = new int[]{0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 112, 112};
+                
+                //UPGRADE_NOTE: Final was removed from the declaration of 'cpdist'. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"
+                internal static readonly int[] cpdist = new int[]{1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577};
+                
+                //UPGRADE_NOTE: Final was removed from the declaration of 'cpdext'. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"
+                internal static readonly int[] cpdext = new int[]{0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13};
+                
+                // If BMAX needs to be larger than 16, then h and x[] should be uLong.
+                internal const int BMAX = 15; // maximum bit length of any code
+                
+                internal int[] hn = null; // hufts used in space
+                internal int[] v = null; // work area for huft_build 
+                internal int[] c = null; // bit length count table
+                internal int[] r = null; // table entry for structure assignment
+                internal int[] u = null; // table stack
+                internal int[] x = null; // bit offsets, then code stack
+                
+                private int huft_build(int[] b, int bindex, int n, int s, int[] d, int[] e, int[] t, int[] m, int[] hp, int[] hn, int[] v)
+                {
+                        // Given a list of code lengths and a maximum table size, make a set of
+                        // tables to decode that set of codes.  Return Z_OK on success, Z_BUF_ERROR
+                        // if the given code set is incomplete (the tables are still built in this
+                        // case), Z_DATA_ERROR if the input is invalid (an over-subscribed set of
+                        // lengths), or Z_MEM_ERROR if not enough memory.
+                        
+                        int a; // counter for codes of length k
+                        int f; // i repeats in table every f entries
+                        int g; // maximum code length
+                        int h; // table level
+                        int i; // counter, current code
+                        int j; // counter
+                        int k; // number of bits in current code
+                        int l; // bits per table (returned in m)
+                        int mask; // (1 << w) - 1, to avoid cc -O bug on HP
+                        int p; // pointer into c[], b[], or v[]
+                        int q; // points to current table
+                        int w; // bits before this table == (l * h)
+                        int xp; // pointer into x
+                        int y; // number of dummy codes added
+                        int z; // number of entries in current table
+                        
+                        // Generate counts for each bit length
+                        
+                        p = 0; i = n;
+                        do 
+                        {
+                                c[b[bindex + p]]++; p++; i--; // assume all entries <= BMAX
+                        }
+                        while (i != 0);
+                        
+                        if (c[0] == n)
+                        {
+                                // null input--all zero length codes
+                                t[0] = - 1;
+                                m[0] = 0;
+                                return Z_OK;
+                        }
+                        
+                        // Find minimum and maximum length, bound *m by those
+                        l = m[0];
+                        for (j = 1; j <= BMAX; j++)
+                                if (c[j] != 0)
+                                        break;
+                        k = j; // minimum code length
+                        if (l < j)
+                        {
+                                l = j;
+                        }
+                        for (i = BMAX; i != 0; i--)
+                        {
+                                if (c[i] != 0)
+                                        break;
+                        }
+                        g = i; // maximum code length
+                        if (l > i)
+                        {
+                                l = i;
+                        }
+                        m[0] = l;
+                        
+                        // Adjust last length count to fill out codes, if needed
+                        for (y = 1 << j; j < i; j++, y <<= 1)
+                        {
+                                if ((y -= c[j]) < 0)
+                                {
+                                        return Z_DATA_ERROR;
+                                }
+                        }
+                        if ((y -= c[i]) < 0)
+                        {
+                                return Z_DATA_ERROR;
+                        }
+                        c[i] += y;
+                        
+                        // Generate starting offsets into the value table for each length
+                        x[1] = j = 0;
+                        p = 1; xp = 2;
+                        while (--i != 0)
+                        {
+                                // note that i == g from above
+                                x[xp] = (j += c[p]);
+                                xp++;
+                                p++;
+                        }
+                        
+                        // Make a table of values in order of bit lengths
+                        i = 0; p = 0;
+                        do 
+                        {
+                                if ((j = b[bindex + p]) != 0)
+                                {
+                                        v[x[j]++] = i;
+                                }
+                                p++;
+                        }
+                        while (++i < n);
+                        n = x[g]; // set n to length of v
+                        
+                        // Generate the Huffman codes and for each, make the table entries
+                        x[0] = i = 0; // first Huffman code is zero
+                        p = 0; // grab values in bit order
+                        h = - 1; // no tables yet--level -1
+                        w = - l; // bits decoded == (l * h)
+                        u[0] = 0; // just to keep compilers happy
+                        q = 0; // ditto
+                        z = 0; // ditto
+                        
+                        // go through the bit lengths (k already is bits in shortest code)
+                        for (; k <= g; k++)
+                        {
+                                a = c[k];
+                                while (a-- != 0)
+                                {
+                                        // here i is the Huffman code of length k bits for value *p
+                                        // make tables up to required level
+                                        while (k > w + l)
+                                        {
+                                                h++;
+                                                w += l; // previous table always l bits
+                                                // compute minimum size table less than or equal to l bits
+                                                z = g - w;
+                                                z = (z > l)?l:z; // table size upper limit
+                                                if ((f = 1 << (j = k - w)) > a + 1)
+                                                {
+                                                        // try a k-w bit table
+                                                        // too few codes for k-w bit table
+                                                        f -= (a + 1); // deduct codes from patterns left
+                                                        xp = k;
+                                                        if (j < z)
+                                                        {
+                                                                while (++j < z)
+                                                                {
+                                                                        // try smaller tables up to z bits
+                                                                        if ((f <<= 1) <= c[++xp])
+                                                                                break; // enough codes to use up j bits
+                                                                        f -= c[xp]; // else deduct codes from patterns
+                                                                }
+                                                        }
+                                                }
+                                                z = 1 << j; // table entries for j-bit table
+                                                
+                                                // allocate new table
+                                                if (hn[0] + z > MANY)
+                                                {
+                                                        // (note: doesn't matter for fixed)
+                                                        return Z_DATA_ERROR; // overflow of MANY
+                                                }
+                                                u[h] = q = hn[0]; // DEBUG
+                                                hn[0] += z;
+                                                
+                                                // connect to last table, if there is one
+                                                if (h != 0)
+                                                {
+                                                        x[h] = i; // save pattern for backing up
+                                                        r[0] = (sbyte) j; // bits in this table
+                                                        r[1] = (sbyte) l; // bits to dump before this table
+                                                        j = SharedUtils.URShift(i, (w - l));
+                                                        r[2] = (int) (q - u[h - 1] - j); // offset to this table
+                                                        Array.Copy(r, 0, hp, (u[h - 1] + j) * 3, 3); // connect to last table
+                                                }
+                                                else
+                                                {
+                                                        t[0] = q; // first table is returned result
+                                                }
+                                        }
+                                        
+                                        // set up table entry in r
+                                        r[1] = (sbyte) (k - w);
+                                        if (p >= n)
+                                        {
+                                                r[0] = 128 + 64; // out of values--invalid code
+                                        }
+                                        else if (v[p] < s)
+                                        {
+                                                r[0] = (sbyte) (v[p] < 256?0:32 + 64); // 256 is end-of-block
+                                                r[2] = v[p++]; // simple code is just the value
+                                        }
+                                        else
+                                        {
+                                                r[0] = (sbyte) (e[v[p] - s] + 16 + 64); // non-simple--look up in lists
+                                                r[2] = d[v[p++] - s];
+                                        }
+                                        
+                                        // fill code-like entries with r
+                                        f = 1 << (k - w);
+                                        for (j = SharedUtils.URShift(i, w); j < z; j += f)
+                                        {
+                                                Array.Copy(r, 0, hp, (q + j) * 3, 3);
+                                        }
+                                        
+                                        // backwards increment the k-bit code i
+                                        for (j = 1 << (k - 1); (i & j) != 0; j = SharedUtils.URShift(j, 1))
+                                        {
+                                                i ^= j;
+                                        }
+                                        i ^= j;
+                                        
+                                        // backup over finished tables
+                                        mask = (1 << w) - 1; // needed on HP, cc -O bug
+                                        while ((i & mask) != x[h])
+                                        {
+                                                h--; // don't need to update q
+                                                w -= l;
+                                                mask = (1 << w) - 1;
+                                        }
+                                }
+                        }
+                        // Return Z_BUF_ERROR if we were given an incomplete table
+                        return y != 0 && g != 1?Z_BUF_ERROR:Z_OK;
+                }
+                
+                internal int inflate_trees_bits(int[] c, int[] bb, int[] tb, int[] hp, ZlibCodec z)
+                {
+                        int result;
+                        initWorkArea(19);
+                        hn[0] = 0;
+                        result = huft_build(c, 0, 19, 19, null, null, tb, bb, hp, hn, v);
+                        
+                        if (result == Z_DATA_ERROR)
+                        {
+                                z.Message = "oversubscribed dynamic bit lengths tree";
+                        }
+                        else if (result == Z_BUF_ERROR || bb[0] == 0)
+                        {
+                                z.Message = "incomplete dynamic bit lengths tree";
+                                result = Z_DATA_ERROR;
+                        }
+                        return result;
+                }
+                
+                internal int inflate_trees_dynamic(int nl, int nd, int[] c, int[] bl, int[] bd, int[] tl, int[] td, int[] hp, ZlibCodec z)
+                {
+                        int result;
+                        
+                        // build literal/length tree
+                        initWorkArea(288);
+                        hn[0] = 0;
+                        result = huft_build(c, 0, nl, 257, cplens, cplext, tl, bl, hp, hn, v);
+                        if (result != Z_OK || bl[0] == 0)
+                        {
+                                if (result == Z_DATA_ERROR)
+                                {
+                                        z.Message = "oversubscribed literal/length tree";
+                                }
+                                else if (result != Z_MEM_ERROR)
+                                {
+                                        z.Message = "incomplete literal/length tree";
+                                        result = Z_DATA_ERROR;
+                                }
+                                return result;
+                        }
+                        
+                        // build distance tree
+                        initWorkArea(288);
+                        result = huft_build(c, nl, nd, 0, cpdist, cpdext, td, bd, hp, hn, v);
+                        
+                        if (result != Z_OK || (bd[0] == 0 && nl > 257))
+                        {
+                                if (result == Z_DATA_ERROR)
+                                {
+                                        z.Message = "oversubscribed distance tree";
+                                }
+                                else if (result == Z_BUF_ERROR)
+                                {
+                                        z.Message = "incomplete distance tree";
+                                        result = Z_DATA_ERROR;
+                                }
+                                else if (result != Z_MEM_ERROR)
+                                {
+                                        z.Message = "empty distance tree with lengths";
+                                        result = Z_DATA_ERROR;
+                                }
+                                return result;
+                        }
+                        
+                        return Z_OK;
+                }
+                
+                internal static int inflate_trees_fixed(int[] bl, int[] bd, int[][] tl, int[][] td, ZlibCodec z)
+                {
+                        bl[0] = fixed_bl;
+                        bd[0] = fixed_bd;
+                        tl[0] = fixed_tl;
+                        td[0] = fixed_td;
+                        return Z_OK;
+                }
+                
+                private void  initWorkArea(int vsize)
+                {
+                        if (hn == null)
+                        {
+                                hn = new int[1];
+                                v = new int[vsize];
+                                c = new int[BMAX + 1];
+                                r = new int[3];
+                                u = new int[BMAX];
+                                x = new int[BMAX + 1];
+                        }
+                        else
+                        {
+                            if (v.Length < vsize)
+                            {
+                                v = new int[vsize];
+                            }
+                            Array.Clear(v,0,vsize);
+                            Array.Clear(c,0,BMAX+1);
+                            r[0]=0; r[1]=0; r[2]=0;
+                            //  for(int i=0; i<BMAX; i++){u[i]=0;}
+                            //Array.Copy(c, 0, u, 0, BMAX);
+                            Array.Clear(u,0,BMAX);
+                            //  for(int i=0; i<BMAX+1; i++){x[i]=0;}
+                            //Array.Copy(c, 0, x, 0, BMAX + 1);
+                            Array.Clear(x,0,BMAX+1);
+                        }
+                }
+        }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/Zlib/Inflate.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/Zlib/Inflate.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/Zlib/Inflate.cs	(revision 12707)
@@ -0,0 +1,1796 @@
+// Inflate.cs
+// ------------------------------------------------------------------
+//
+// Copyright (c) 2009 Dino Chiesa and Microsoft Corporation.
+// All rights reserved.
+//
+// This code module is part of DotNetZip, a zipfile class library.
+//
+// ------------------------------------------------------------------
+//
+// This code is licensed under the Microsoft Public License.
+// See the file License.txt for the license details.
+// More info on: http://dotnetzip.codeplex.com
+//
+// ------------------------------------------------------------------
+//
+// last saved (in emacs):
+// Time-stamp: <2010-January-08 18:32:12>
+//
+// ------------------------------------------------------------------
+//
+// This module defines classes for decompression. This code is derived
+// from the jzlib implementation of zlib, but significantly modified.
+// The object model is not the same, and many of the behaviors are
+// different.  Nonetheless, in keeping with the license for jzlib, I am
+// reproducing the copyright to that code here.
+//
+// ------------------------------------------------------------------
+//
+// Copyright (c) 2000,2001,2002,2003 ymnk, JCraft,Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in
+// the documentation and/or other materials provided with the distribution.
+//
+// 3. The names of the authors may not be used to endorse or promote products
+// derived from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
+// INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
+// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// -----------------------------------------------------------------------
+//
+// This program is based on zlib-1.1.3; credit to authors
+// Jean-loup Gailly(jloup@gzip.org) and Mark Adler(madler@alumni.caltech.edu)
+// and contributors of zlib.
+//
+// -----------------------------------------------------------------------
+
+
+using System;
+namespace OfficeOpenXml.Packaging.Ionic.Zlib
+{
+    sealed class InflateBlocks
+    {
+        private const int MANY = 1440;
+
+        // Table for deflate from PKZIP's appnote.txt.
+        internal static readonly int[] border = new int[]
+        { 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 };
+
+        private enum InflateBlockMode
+        {
+            TYPE   = 0,                     // get type bits (3, including end bit)
+            LENS   = 1,                     // get lengths for stored
+            STORED = 2,                     // processing stored block
+            TABLE  = 3,                     // get table lengths
+            BTREE  = 4,                     // get bit lengths tree for a dynamic block
+            DTREE  = 5,                     // get length, distance trees for a dynamic block
+            CODES  = 6,                     // processing fixed or dynamic block
+            DRY    = 7,                     // output remaining window bytes
+            DONE   = 8,                     // finished last block, done
+            BAD    = 9,                     // ot a data error--stuck here
+        }
+
+        private InflateBlockMode mode;                    // current inflate_block mode
+
+        internal int left;                                // if STORED, bytes left to copy
+
+        internal int table;                               // table lengths (14 bits)
+        internal int index;                               // index into blens (or border)
+        internal int[] blens;                             // bit lengths of codes
+        internal int[] bb = new int[1];                   // bit length tree depth
+        internal int[] tb = new int[1];                   // bit length decoding tree
+
+        internal InflateCodes codes = new InflateCodes(); // if CODES, current state
+
+        internal int last;                                // true if this block is the last block
+
+        internal ZlibCodec _codec;                        // pointer back to this zlib stream
+
+                                                          // mode independent information
+        internal int bitk;                                // bits in bit buffer
+        internal int bitb;                                // bit buffer
+        internal int[] hufts;                             // single malloc for tree space
+        internal byte[] window;                           // sliding window
+        internal int end;                                 // one byte after sliding window
+        internal int readAt;                              // window read pointer
+        internal int writeAt;                             // window write pointer
+        internal System.Object checkfn;                   // check function
+        internal uint check;                              // check on output
+
+        internal InfTree inftree = new InfTree();
+
+        internal InflateBlocks(ZlibCodec codec, System.Object checkfn, int w)
+        {
+            _codec = codec;
+            hufts = new int[MANY * 3];
+            window = new byte[w];
+            end = w;
+            this.checkfn = checkfn;
+            mode = InflateBlockMode.TYPE;
+            Reset();
+        }
+
+        internal uint Reset()
+        {
+            uint oldCheck = check;
+            mode = InflateBlockMode.TYPE;
+            bitk = 0;
+            bitb = 0;
+            readAt = writeAt = 0;
+
+            if (checkfn != null)
+                _codec._Adler32 = check = Adler.Adler32(0, null, 0, 0);
+            return oldCheck;
+        }
+
+
+        internal int Process(int r)
+        {
+            int t; // temporary storage
+            int b; // bit buffer
+            int k; // bits in bit buffer
+            int p; // input data pointer
+            int n; // bytes available there
+            int q; // output window write pointer
+            int m; // bytes to end of window or read pointer
+
+            // copy input/output information to locals (UPDATE macro restores)
+
+            p = _codec.NextIn;
+            n = _codec.AvailableBytesIn;
+            b = bitb;
+            k = bitk;
+
+            q = writeAt;
+            m = (int)(q < readAt ? readAt - q - 1 : end - q);
+
+
+            // process input based on current state
+            while (true)
+            {
+                switch (mode)
+                {
+                    case InflateBlockMode.TYPE:
+
+                        while (k < (3))
+                        {
+                            if (n != 0)
+                            {
+                                r = ZlibConstants.Z_OK;
+                            }
+                            else
+                            {
+                                bitb = b; bitk = k;
+                                _codec.AvailableBytesIn = n;
+                                _codec.TotalBytesIn += p - _codec.NextIn;
+                                _codec.NextIn = p;
+                                writeAt = q;
+                                return Flush(r);
+                            }
+
+                            n--;
+                            b |= (_codec.InputBuffer[p++] & 0xff) << k;
+                            k += 8;
+                        }
+                        t = (int)(b & 7);
+                        last = t & 1;
+
+                        switch ((uint)t >> 1)
+                        {
+                            case 0:  // stored
+                                b >>= 3; k -= (3);
+                                t = k & 7; // go to byte boundary
+                                b >>= t; k -= t;
+                                mode = InflateBlockMode.LENS; // get length of stored block
+                                break;
+
+                            case 1:  // fixed
+                                int[] bl = new int[1];
+                                int[] bd = new int[1];
+                                int[][] tl = new int[1][];
+                                int[][] td = new int[1][];
+                                InfTree.inflate_trees_fixed(bl, bd, tl, td, _codec);
+                                codes.Init(bl[0], bd[0], tl[0], 0, td[0], 0);
+                                b >>= 3; k -= 3;
+                                mode = InflateBlockMode.CODES;
+                                break;
+
+                            case 2:  // dynamic
+                                b >>= 3; k -= 3;
+                                mode = InflateBlockMode.TABLE;
+                                break;
+
+                            case 3:  // illegal
+                                b >>= 3; k -= 3;
+                                mode = InflateBlockMode.BAD;
+                                _codec.Message = "invalid block type";
+                                r = ZlibConstants.Z_DATA_ERROR;
+                                bitb = b; bitk = k;
+                                _codec.AvailableBytesIn = n;
+                                _codec.TotalBytesIn += p - _codec.NextIn;
+                                _codec.NextIn = p;
+                                writeAt = q;
+                                return Flush(r);
+                        }
+                        break;
+
+                    case InflateBlockMode.LENS:
+
+                        while (k < (32))
+                        {
+                            if (n != 0)
+                            {
+                                r = ZlibConstants.Z_OK;
+                            }
+                            else
+                            {
+                                bitb = b; bitk = k;
+                                _codec.AvailableBytesIn = n;
+                                _codec.TotalBytesIn += p - _codec.NextIn;
+                                _codec.NextIn = p;
+                                writeAt = q;
+                                return Flush(r);
+                            }
+                            ;
+                            n--;
+                            b |= (_codec.InputBuffer[p++] & 0xff) << k;
+                            k += 8;
+                        }
+
+                        if ( ( ((~b)>>16) & 0xffff) != (b & 0xffff))
+                        {
+                            mode = InflateBlockMode.BAD;
+                            _codec.Message = "invalid stored block lengths";
+                            r = ZlibConstants.Z_DATA_ERROR;
+
+                            bitb = b; bitk = k;
+                            _codec.AvailableBytesIn = n;
+                            _codec.TotalBytesIn += p - _codec.NextIn;
+                            _codec.NextIn = p;
+                            writeAt = q;
+                            return Flush(r);
+                        }
+                        left = (b & 0xffff);
+                        b = k = 0; // dump bits
+                        mode = left != 0 ? InflateBlockMode.STORED : (last != 0 ? InflateBlockMode.DRY : InflateBlockMode.TYPE);
+                        break;
+
+                    case InflateBlockMode.STORED:
+                        if (n == 0)
+                        {
+                            bitb = b; bitk = k;
+                            _codec.AvailableBytesIn = n;
+                            _codec.TotalBytesIn += p - _codec.NextIn;
+                            _codec.NextIn = p;
+                            writeAt = q;
+                            return Flush(r);
+                        }
+
+                        if (m == 0)
+                        {
+                            if (q == end && readAt != 0)
+                            {
+                                q = 0; m = (int)(q < readAt ? readAt - q - 1 : end - q);
+                            }
+                            if (m == 0)
+                            {
+                                writeAt = q;
+                                r = Flush(r);
+                                q = writeAt; m = (int)(q < readAt ? readAt - q - 1 : end - q);
+                                if (q == end && readAt != 0)
+                                {
+                                    q = 0; m = (int)(q < readAt ? readAt - q - 1 : end - q);
+                                }
+                                if (m == 0)
+                                {
+                                    bitb = b; bitk = k;
+                                    _codec.AvailableBytesIn = n;
+                                    _codec.TotalBytesIn += p - _codec.NextIn;
+                                    _codec.NextIn = p;
+                                    writeAt = q;
+                                    return Flush(r);
+                                }
+                            }
+                        }
+                        r = ZlibConstants.Z_OK;
+
+                        t = left;
+                        if (t > n)
+                            t = n;
+                        if (t > m)
+                            t = m;
+                        Array.Copy(_codec.InputBuffer, p, window, q, t);
+                        p += t; n -= t;
+                        q += t; m -= t;
+                        if ((left -= t) != 0)
+                            break;
+                        mode = last != 0 ? InflateBlockMode.DRY : InflateBlockMode.TYPE;
+                        break;
+
+                    case InflateBlockMode.TABLE:
+
+                        while (k < (14))
+                        {
+                            if (n != 0)
+                            {
+                                r = ZlibConstants.Z_OK;
+                            }
+                            else
+                            {
+                                bitb = b; bitk = k;
+                                _codec.AvailableBytesIn = n;
+                                _codec.TotalBytesIn += p - _codec.NextIn;
+                                _codec.NextIn = p;
+                                writeAt = q;
+                                return Flush(r);
+                            }
+
+                            n--;
+                            b |= (_codec.InputBuffer[p++] & 0xff) << k;
+                            k += 8;
+                        }
+
+                        table = t = (b & 0x3fff);
+                        if ((t & 0x1f) > 29 || ((t >> 5) & 0x1f) > 29)
+                        {
+                            mode = InflateBlockMode.BAD;
+                            _codec.Message = "too many length or distance symbols";
+                            r = ZlibConstants.Z_DATA_ERROR;
+
+                            bitb = b; bitk = k;
+                            _codec.AvailableBytesIn = n;
+                            _codec.TotalBytesIn += p - _codec.NextIn;
+                            _codec.NextIn = p;
+                            writeAt = q;
+                            return Flush(r);
+                        }
+                        t = 258 + (t & 0x1f) + ((t >> 5) & 0x1f);
+                        if (blens == null || blens.Length < t)
+                        {
+                            blens = new int[t];
+                        }
+                        else
+                        {
+                            Array.Clear(blens, 0, t);
+                            // for (int i = 0; i < t; i++)
+                            // {
+                            //     blens[i] = 0;
+                            // }
+                        }
+
+                        b >>= 14;
+                        k -= 14;
+
+
+                        index = 0;
+                        mode = InflateBlockMode.BTREE;
+                        goto case InflateBlockMode.BTREE;
+
+                    case InflateBlockMode.BTREE:
+                        while (index < 4 + (table >> 10))
+                        {
+                            while (k < (3))
+                            {
+                                if (n != 0)
+                                {
+                                    r = ZlibConstants.Z_OK;
+                                }
+                                else
+                                {
+                                    bitb = b; bitk = k;
+                                    _codec.AvailableBytesIn = n;
+                                    _codec.TotalBytesIn += p - _codec.NextIn;
+                                    _codec.NextIn = p;
+                                    writeAt = q;
+                                    return Flush(r);
+                                }
+
+                                n--;
+                                b |= (_codec.InputBuffer[p++] & 0xff) << k;
+                                k += 8;
+                            }
+
+                            blens[border[index++]] = b & 7;
+
+                            b >>= 3; k -= 3;
+                        }
+
+                        while (index < 19)
+                        {
+                            blens[border[index++]] = 0;
+                        }
+
+                        bb[0] = 7;
+                        t = inftree.inflate_trees_bits(blens, bb, tb, hufts, _codec);
+                        if (t != ZlibConstants.Z_OK)
+                        {
+                            r = t;
+                            if (r == ZlibConstants.Z_DATA_ERROR)
+                            {
+                                blens = null;
+                                mode = InflateBlockMode.BAD;
+                            }
+
+                            bitb = b; bitk = k;
+                            _codec.AvailableBytesIn = n;
+                            _codec.TotalBytesIn += p - _codec.NextIn;
+                            _codec.NextIn = p;
+                            writeAt = q;
+                            return Flush(r);
+                        }
+
+                        index = 0;
+                        mode = InflateBlockMode.DTREE;
+                        goto case InflateBlockMode.DTREE;
+
+                    case InflateBlockMode.DTREE:
+                        while (true)
+                        {
+                            t = table;
+                            if (!(index < 258 + (t & 0x1f) + ((t >> 5) & 0x1f)))
+                            {
+                                break;
+                            }
+
+                            int i, j, c;
+
+                            t = bb[0];
+
+                            while (k < t)
+                            {
+                                if (n != 0)
+                                {
+                                    r = ZlibConstants.Z_OK;
+                                }
+                                else
+                                {
+                                    bitb = b; bitk = k;
+                                    _codec.AvailableBytesIn = n;
+                                    _codec.TotalBytesIn += p - _codec.NextIn;
+                                    _codec.NextIn = p;
+                                    writeAt = q;
+                                    return Flush(r);
+                                }
+
+                                n--;
+                                b |= (_codec.InputBuffer[p++] & 0xff) << k;
+                                k += 8;
+                            }
+
+                            t = hufts[(tb[0] + (b & InternalInflateConstants.InflateMask[t])) * 3 + 1];
+                            c = hufts[(tb[0] + (b & InternalInflateConstants.InflateMask[t])) * 3 + 2];
+
+                            if (c < 16)
+                            {
+                                b >>= t; k -= t;
+                                blens[index++] = c;
+                            }
+                            else
+                            {
+                                // c == 16..18
+                                i = c == 18 ? 7 : c - 14;
+                                j = c == 18 ? 11 : 3;
+
+                                while (k < (t + i))
+                                {
+                                    if (n != 0)
+                                    {
+                                        r = ZlibConstants.Z_OK;
+                                    }
+                                    else
+                                    {
+                                        bitb = b; bitk = k;
+                                        _codec.AvailableBytesIn = n;
+                                        _codec.TotalBytesIn += p - _codec.NextIn;
+                                        _codec.NextIn = p;
+                                        writeAt = q;
+                                        return Flush(r);
+                                    }
+
+                                    n--;
+                                    b |= (_codec.InputBuffer[p++] & 0xff) << k;
+                                    k += 8;
+                                }
+
+                                b >>= t; k -= t;
+
+                                j += (b & InternalInflateConstants.InflateMask[i]);
+
+                                b >>= i; k -= i;
+
+                                i = index;
+                                t = table;
+                                if (i + j > 258 + (t & 0x1f) + ((t >> 5) & 0x1f) || (c == 16 && i < 1))
+                                {
+                                    blens = null;
+                                    mode = InflateBlockMode.BAD;
+                                    _codec.Message = "invalid bit length repeat";
+                                    r = ZlibConstants.Z_DATA_ERROR;
+
+                                    bitb = b; bitk = k;
+                                    _codec.AvailableBytesIn = n;
+                                    _codec.TotalBytesIn += p - _codec.NextIn;
+                                    _codec.NextIn = p;
+                                    writeAt = q;
+                                    return Flush(r);
+                                }
+
+                                c = (c == 16) ? blens[i-1] : 0;
+                                do
+                                {
+                                    blens[i++] = c;
+                                }
+                                while (--j != 0);
+                                index = i;
+                            }
+                        }
+
+                        tb[0] = -1;
+                        {
+                            int[] bl = new int[] { 9 };  // must be <= 9 for lookahead assumptions
+                            int[] bd = new int[] { 6 }; // must be <= 9 for lookahead assumptions
+                            int[] tl = new int[1];
+                            int[] td = new int[1];
+
+                            t = table;
+                            t = inftree.inflate_trees_dynamic(257 + (t & 0x1f), 1 + ((t >> 5) & 0x1f), blens, bl, bd, tl, td, hufts, _codec);
+
+                            if (t != ZlibConstants.Z_OK)
+                            {
+                                if (t == ZlibConstants.Z_DATA_ERROR)
+                                {
+                                    blens = null;
+                                    mode = InflateBlockMode.BAD;
+                                }
+                                r = t;
+
+                                bitb = b; bitk = k;
+                                _codec.AvailableBytesIn = n;
+                                _codec.TotalBytesIn += p - _codec.NextIn;
+                                _codec.NextIn = p;
+                                writeAt = q;
+                                return Flush(r);
+                            }
+                            codes.Init(bl[0], bd[0], hufts, tl[0], hufts, td[0]);
+                        }
+                        mode = InflateBlockMode.CODES;
+                        goto case InflateBlockMode.CODES;
+
+                    case InflateBlockMode.CODES:
+                        bitb = b; bitk = k;
+                        _codec.AvailableBytesIn = n;
+                        _codec.TotalBytesIn += p - _codec.NextIn;
+                        _codec.NextIn = p;
+                        writeAt = q;
+
+                        r = codes.Process(this, r);
+                        if (r != ZlibConstants.Z_STREAM_END)
+                        {
+                            return Flush(r);
+                        }
+
+                        r = ZlibConstants.Z_OK;
+                        p = _codec.NextIn;
+                        n = _codec.AvailableBytesIn;
+                        b = bitb;
+                        k = bitk;
+                        q = writeAt;
+                        m = (int)(q < readAt ? readAt - q - 1 : end - q);
+
+                        if (last == 0)
+                        {
+                            mode = InflateBlockMode.TYPE;
+                            break;
+                        }
+                        mode = InflateBlockMode.DRY;
+                        goto case InflateBlockMode.DRY;
+
+                    case InflateBlockMode.DRY:
+                        writeAt = q;
+                        r = Flush(r);
+                        q = writeAt; m = (int)(q < readAt ? readAt - q - 1 : end - q);
+                        if (readAt != writeAt)
+                        {
+                            bitb = b; bitk = k;
+                            _codec.AvailableBytesIn = n;
+                            _codec.TotalBytesIn += p - _codec.NextIn;
+                            _codec.NextIn = p;
+                            writeAt = q;
+                            return Flush(r);
+                        }
+                        mode = InflateBlockMode.DONE;
+                        goto case InflateBlockMode.DONE;
+
+                    case InflateBlockMode.DONE:
+                        r = ZlibConstants.Z_STREAM_END;
+                        bitb = b;
+                        bitk = k;
+                        _codec.AvailableBytesIn = n;
+                        _codec.TotalBytesIn += p - _codec.NextIn;
+                        _codec.NextIn = p;
+                        writeAt = q;
+                        return Flush(r);
+
+                    case InflateBlockMode.BAD:
+                        r = ZlibConstants.Z_DATA_ERROR;
+
+                        bitb = b; bitk = k;
+                        _codec.AvailableBytesIn = n;
+                        _codec.TotalBytesIn += p - _codec.NextIn;
+                        _codec.NextIn = p;
+                        writeAt = q;
+                        return Flush(r);
+
+
+                    default:
+                        r = ZlibConstants.Z_STREAM_ERROR;
+
+                        bitb = b; bitk = k;
+                        _codec.AvailableBytesIn = n;
+                        _codec.TotalBytesIn += p - _codec.NextIn;
+                        _codec.NextIn = p;
+                        writeAt = q;
+                        return Flush(r);
+                }
+            }
+        }
+
+
+        internal void Free()
+        {
+            Reset();
+            window = null;
+            hufts = null;
+        }
+
+        internal void SetDictionary(byte[] d, int start, int n)
+        {
+            Array.Copy(d, start, window, 0, n);
+            readAt = writeAt = n;
+        }
+
+        // Returns true if inflate is currently at the end of a block generated
+        // by Z_SYNC_FLUSH or Z_FULL_FLUSH.
+        internal int SyncPoint()
+        {
+            return mode == InflateBlockMode.LENS ? 1 : 0;
+        }
+
+        // copy as much as possible from the sliding window to the output area
+        internal int Flush(int r)
+        {
+            int nBytes;
+
+            for (int pass=0; pass < 2; pass++)
+            {
+                if (pass==0)
+                {
+                    // compute number of bytes to copy as far as end of window
+                    nBytes = (int)((readAt <= writeAt ? writeAt : end) - readAt);
+                }
+                else
+                {
+                    // compute bytes to copy
+                    nBytes = writeAt - readAt;
+                }
+
+                // workitem 8870
+                if (nBytes == 0)
+                {
+                    if (r == ZlibConstants.Z_BUF_ERROR)
+                        r = ZlibConstants.Z_OK;
+                    return r;
+                }
+
+                if (nBytes > _codec.AvailableBytesOut)
+                    nBytes = _codec.AvailableBytesOut;
+
+                if (nBytes != 0 && r == ZlibConstants.Z_BUF_ERROR)
+                    r = ZlibConstants.Z_OK;
+
+                // update counters
+                _codec.AvailableBytesOut -= nBytes;
+                _codec.TotalBytesOut += nBytes;
+
+                // update check information
+                if (checkfn != null)
+                    _codec._Adler32 = check = Adler.Adler32(check, window, readAt, nBytes);
+
+                // copy as far as end of window
+                Array.Copy(window, readAt, _codec.OutputBuffer, _codec.NextOut, nBytes);
+                _codec.NextOut += nBytes;
+                readAt += nBytes;
+
+                // see if more to copy at beginning of window
+                if (readAt == end && pass == 0)
+                {
+                    // wrap pointers
+                    readAt = 0;
+                    if (writeAt == end)
+                        writeAt = 0;
+                }
+                else pass++;
+            }
+
+            // done
+            return r;
+        }
+    }
+
+
+    internal static class InternalInflateConstants
+    {
+        // And'ing with mask[n] masks the lower n bits
+        internal static readonly int[] InflateMask = new int[] {
+            0x00000000, 0x00000001, 0x00000003, 0x00000007,
+            0x0000000f, 0x0000001f, 0x0000003f, 0x0000007f,
+            0x000000ff, 0x000001ff, 0x000003ff, 0x000007ff,
+            0x00000fff, 0x00001fff, 0x00003fff, 0x00007fff, 0x0000ffff };
+    }
+
+
+    sealed class InflateCodes
+    {
+        // waiting for "i:"=input,
+        //             "o:"=output,
+        //             "x:"=nothing
+        private const int START   = 0; // x: set up for LEN
+        private const int LEN     = 1; // i: get length/literal/eob next
+        private const int LENEXT  = 2; // i: getting length extra (have base)
+        private const int DIST    = 3; // i: get distance next
+        private const int DISTEXT = 4; // i: getting distance extra
+        private const int COPY    = 5; // o: copying bytes in window, waiting for space
+        private const int LIT     = 6; // o: got literal, waiting for output space
+        private const int WASH    = 7; // o: got eob, possibly still output waiting
+        private const int END     = 8; // x: got eob and all data flushed
+        private const int BADCODE = 9; // x: got error
+
+        internal int mode;        // current inflate_codes mode
+
+        // mode dependent information
+        internal int len;
+
+        internal int[] tree;      // pointer into tree
+        internal int tree_index = 0;
+        internal int need;        // bits needed
+
+        internal int lit;
+
+        // if EXT or COPY, where and how much
+        internal int bitsToGet;   // bits to get for extra
+        internal int dist;        // distance back to copy from
+
+        internal byte lbits;      // ltree bits decoded per branch
+        internal byte dbits;      // dtree bits decoder per branch
+        internal int[] ltree;     // literal/length/eob tree
+        internal int ltree_index; // literal/length/eob tree
+        internal int[] dtree;     // distance tree
+        internal int dtree_index; // distance tree
+
+        internal InflateCodes()
+        {
+        }
+
+        internal void Init(int bl, int bd, int[] tl, int tl_index, int[] td, int td_index)
+        {
+            mode = START;
+            lbits = (byte)bl;
+            dbits = (byte)bd;
+            ltree = tl;
+            ltree_index = tl_index;
+            dtree = td;
+            dtree_index = td_index;
+            tree = null;
+        }
+
+        internal int Process(InflateBlocks blocks, int r)
+        {
+            int j;      // temporary storage
+            int tindex; // temporary pointer
+            int e;      // extra bits or operation
+            int b = 0;  // bit buffer
+            int k = 0;  // bits in bit buffer
+            int p = 0;  // input data pointer
+            int n;      // bytes available there
+            int q;      // output window write pointer
+            int m;      // bytes to end of window or read pointer
+            int f;      // pointer to copy strings from
+
+            ZlibCodec z = blocks._codec;
+
+            // copy input/output information to locals (UPDATE macro restores)
+            p = z.NextIn;
+            n = z.AvailableBytesIn;
+            b = blocks.bitb;
+            k = blocks.bitk;
+            q = blocks.writeAt; m = q < blocks.readAt ? blocks.readAt - q - 1 : blocks.end - q;
+
+            // process input and output based on current state
+            while (true)
+            {
+                switch (mode)
+                {
+                    // waiting for "i:"=input, "o:"=output, "x:"=nothing
+                    case START:  // x: set up for LEN
+                        if (m >= 258 && n >= 10)
+                        {
+                            blocks.bitb = b; blocks.bitk = k;
+                            z.AvailableBytesIn = n;
+                            z.TotalBytesIn += p - z.NextIn;
+                            z.NextIn = p;
+                            blocks.writeAt = q;
+                            r = InflateFast(lbits, dbits, ltree, ltree_index, dtree, dtree_index, blocks, z);
+
+                            p = z.NextIn;
+                            n = z.AvailableBytesIn;
+                            b = blocks.bitb;
+                            k = blocks.bitk;
+                            q = blocks.writeAt; m = q < blocks.readAt ? blocks.readAt - q - 1 : blocks.end - q;
+
+                            if (r != ZlibConstants.Z_OK)
+                            {
+                                mode = (r == ZlibConstants.Z_STREAM_END) ? WASH : BADCODE;
+                                break;
+                            }
+                        }
+                        need = lbits;
+                        tree = ltree;
+                        tree_index = ltree_index;
+
+                        mode = LEN;
+                        goto case LEN;
+
+                    case LEN:  // i: get length/literal/eob next
+                        j = need;
+
+                        while (k < j)
+                        {
+                            if (n != 0)
+                                r = ZlibConstants.Z_OK;
+                            else
+                            {
+                                blocks.bitb = b; blocks.bitk = k;
+                                z.AvailableBytesIn = n;
+                                z.TotalBytesIn += p - z.NextIn;
+                                z.NextIn = p;
+                                blocks.writeAt = q;
+                                return blocks.Flush(r);
+                            }
+                            n--;
+                            b |= (z.InputBuffer[p++] & 0xff) << k;
+                            k += 8;
+                        }
+
+                        tindex = (tree_index + (b & InternalInflateConstants.InflateMask[j])) * 3;
+
+                        b >>= (tree[tindex + 1]);
+                        k -= (tree[tindex + 1]);
+
+                        e = tree[tindex];
+
+                        if (e == 0)
+                        {
+                            // literal
+                            lit = tree[tindex + 2];
+                            mode = LIT;
+                            break;
+                        }
+                        if ((e & 16) != 0)
+                        {
+                            // length
+                            bitsToGet = e & 15;
+                            len = tree[tindex + 2];
+                            mode = LENEXT;
+                            break;
+                        }
+                        if ((e & 64) == 0)
+                        {
+                            // next table
+                            need = e;
+                            tree_index = tindex / 3 + tree[tindex + 2];
+                            break;
+                        }
+                        if ((e & 32) != 0)
+                        {
+                            // end of block
+                            mode = WASH;
+                            break;
+                        }
+                        mode = BADCODE; // invalid code
+                        z.Message = "invalid literal/length code";
+                        r = ZlibConstants.Z_DATA_ERROR;
+
+                        blocks.bitb = b; blocks.bitk = k;
+                        z.AvailableBytesIn = n;
+                        z.TotalBytesIn += p - z.NextIn;
+                        z.NextIn = p;
+                        blocks.writeAt = q;
+                        return blocks.Flush(r);
+
+
+                    case LENEXT:  // i: getting length extra (have base)
+                        j = bitsToGet;
+
+                        while (k < j)
+                        {
+                            if (n != 0)
+                                r = ZlibConstants.Z_OK;
+                            else
+                            {
+                                blocks.bitb = b; blocks.bitk = k;
+                                z.AvailableBytesIn = n; z.TotalBytesIn += p - z.NextIn; z.NextIn = p;
+                                blocks.writeAt = q;
+                                return blocks.Flush(r);
+                            }
+                            n--; b |= (z.InputBuffer[p++] & 0xff) << k;
+                            k += 8;
+                        }
+
+                        len += (b & InternalInflateConstants.InflateMask[j]);
+
+                        b >>= j;
+                        k -= j;
+
+                        need = dbits;
+                        tree = dtree;
+                        tree_index = dtree_index;
+                        mode = DIST;
+                        goto case DIST;
+
+                    case DIST:  // i: get distance next
+                        j = need;
+
+                        while (k < j)
+                        {
+                            if (n != 0)
+                                r = ZlibConstants.Z_OK;
+                            else
+                            {
+                                blocks.bitb = b; blocks.bitk = k;
+                                z.AvailableBytesIn = n; z.TotalBytesIn += p - z.NextIn; z.NextIn = p;
+                                blocks.writeAt = q;
+                                return blocks.Flush(r);
+                            }
+                            n--; b |= (z.InputBuffer[p++] & 0xff) << k;
+                            k += 8;
+                        }
+
+                        tindex = (tree_index + (b & InternalInflateConstants.InflateMask[j])) * 3;
+
+                        b >>= tree[tindex + 1];
+                        k -= tree[tindex + 1];
+
+                        e = (tree[tindex]);
+                        if ((e & 0x10) != 0)
+                        {
+                            // distance
+                            bitsToGet = e & 15;
+                            dist = tree[tindex + 2];
+                            mode = DISTEXT;
+                            break;
+                        }
+                        if ((e & 64) == 0)
+                        {
+                            // next table
+                            need = e;
+                            tree_index = tindex / 3 + tree[tindex + 2];
+                            break;
+                        }
+                        mode = BADCODE; // invalid code
+                        z.Message = "invalid distance code";
+                        r = ZlibConstants.Z_DATA_ERROR;
+
+                        blocks.bitb = b; blocks.bitk = k;
+                        z.AvailableBytesIn = n; z.TotalBytesIn += p - z.NextIn; z.NextIn = p;
+                        blocks.writeAt = q;
+                        return blocks.Flush(r);
+
+
+                    case DISTEXT:  // i: getting distance extra
+                        j = bitsToGet;
+
+                        while (k < j)
+                        {
+                            if (n != 0)
+                                r = ZlibConstants.Z_OK;
+                            else
+                            {
+                                blocks.bitb = b; blocks.bitk = k;
+                                z.AvailableBytesIn = n; z.TotalBytesIn += p - z.NextIn; z.NextIn = p;
+                                blocks.writeAt = q;
+                                return blocks.Flush(r);
+                            }
+                            n--; b |= (z.InputBuffer[p++] & 0xff) << k;
+                            k += 8;
+                        }
+
+                        dist += (b & InternalInflateConstants.InflateMask[j]);
+
+                        b >>= j;
+                        k -= j;
+
+                        mode = COPY;
+                        goto case COPY;
+
+                    case COPY:  // o: copying bytes in window, waiting for space
+                        f = q - dist;
+                        while (f < 0)
+                        {
+                            // modulo window size-"while" instead
+                            f += blocks.end; // of "if" handles invalid distances
+                        }
+                        while (len != 0)
+                        {
+                            if (m == 0)
+                            {
+                                if (q == blocks.end && blocks.readAt != 0)
+                                {
+                                    q = 0; m = q < blocks.readAt ? blocks.readAt - q - 1 : blocks.end - q;
+                                }
+                                if (m == 0)
+                                {
+                                    blocks.writeAt = q; r = blocks.Flush(r);
+                                    q = blocks.writeAt; m = q < blocks.readAt ? blocks.readAt - q - 1 : blocks.end - q;
+
+                                    if (q == blocks.end && blocks.readAt != 0)
+                                    {
+                                        q = 0; m = q < blocks.readAt ? blocks.readAt - q - 1 : blocks.end - q;
+                                    }
+
+                                    if (m == 0)
+                                    {
+                                        blocks.bitb = b; blocks.bitk = k;
+                                        z.AvailableBytesIn = n;
+                                        z.TotalBytesIn += p - z.NextIn;
+                                        z.NextIn = p;
+                                        blocks.writeAt = q;
+                                        return blocks.Flush(r);
+                                    }
+                                }
+                            }
+
+                            blocks.window[q++] = blocks.window[f++]; m--;
+
+                            if (f == blocks.end)
+                                f = 0;
+                            len--;
+                        }
+                        mode = START;
+                        break;
+
+                    case LIT:  // o: got literal, waiting for output space
+                        if (m == 0)
+                        {
+                            if (q == blocks.end && blocks.readAt != 0)
+                            {
+                                q = 0; m = q < blocks.readAt ? blocks.readAt - q - 1 : blocks.end - q;
+                            }
+                            if (m == 0)
+                            {
+                                blocks.writeAt = q; r = blocks.Flush(r);
+                                q = blocks.writeAt; m = q < blocks.readAt ? blocks.readAt - q - 1 : blocks.end - q;
+
+                                if (q == blocks.end && blocks.readAt != 0)
+                                {
+                                    q = 0; m = q < blocks.readAt ? blocks.readAt - q - 1 : blocks.end - q;
+                                }
+                                if (m == 0)
+                                {
+                                    blocks.bitb = b; blocks.bitk = k;
+                                    z.AvailableBytesIn = n; z.TotalBytesIn += p - z.NextIn; z.NextIn = p;
+                                    blocks.writeAt = q;
+                                    return blocks.Flush(r);
+                                }
+                            }
+                        }
+                        r = ZlibConstants.Z_OK;
+
+                        blocks.window[q++] = (byte)lit; m--;
+
+                        mode = START;
+                        break;
+
+                    case WASH:  // o: got eob, possibly more output
+                        if (k > 7)
+                        {
+                            // return unused byte, if any
+                            k -= 8;
+                            n++;
+                            p--; // can always return one
+                        }
+
+                        blocks.writeAt = q; r = blocks.Flush(r);
+                        q = blocks.writeAt; m = q < blocks.readAt ? blocks.readAt - q - 1 : blocks.end - q;
+
+                        if (blocks.readAt != blocks.writeAt)
+                        {
+                            blocks.bitb = b; blocks.bitk = k;
+                            z.AvailableBytesIn = n; z.TotalBytesIn += p - z.NextIn; z.NextIn = p;
+                            blocks.writeAt = q;
+                            return blocks.Flush(r);
+                        }
+                        mode = END;
+                        goto case END;
+
+                    case END:
+                        r = ZlibConstants.Z_STREAM_END;
+                        blocks.bitb = b; blocks.bitk = k;
+                        z.AvailableBytesIn = n; z.TotalBytesIn += p - z.NextIn; z.NextIn = p;
+                        blocks.writeAt = q;
+                        return blocks.Flush(r);
+
+                    case BADCODE:  // x: got error
+
+                        r = ZlibConstants.Z_DATA_ERROR;
+
+                        blocks.bitb = b; blocks.bitk = k;
+                        z.AvailableBytesIn = n; z.TotalBytesIn += p - z.NextIn; z.NextIn = p;
+                        blocks.writeAt = q;
+                        return blocks.Flush(r);
+
+                    default:
+                        r = ZlibConstants.Z_STREAM_ERROR;
+
+                        blocks.bitb = b; blocks.bitk = k;
+                        z.AvailableBytesIn = n; z.TotalBytesIn += p - z.NextIn; z.NextIn = p;
+                        blocks.writeAt = q;
+                        return blocks.Flush(r);
+                }
+            }
+        }
+
+
+        // Called with number of bytes left to write in window at least 258
+        // (the maximum string length) and number of input bytes available
+        // at least ten.  The ten bytes are six bytes for the longest length/
+        // distance pair plus four bytes for overloading the bit buffer.
+
+        internal int InflateFast(int bl, int bd, int[] tl, int tl_index, int[] td, int td_index, InflateBlocks s, ZlibCodec z)
+        {
+            int t;        // temporary pointer
+            int[] tp;     // temporary pointer
+            int tp_index; // temporary pointer
+            int e;        // extra bits or operation
+            int b;        // bit buffer
+            int k;        // bits in bit buffer
+            int p;        // input data pointer
+            int n;        // bytes available there
+            int q;        // output window write pointer
+            int m;        // bytes to end of window or read pointer
+            int ml;       // mask for literal/length tree
+            int md;       // mask for distance tree
+            int c;        // bytes to copy
+            int d;        // distance back to copy from
+            int r;        // copy source pointer
+
+            int tp_index_t_3; // (tp_index+t)*3
+
+            // load input, output, bit values
+            p = z.NextIn; n = z.AvailableBytesIn; b = s.bitb; k = s.bitk;
+            q = s.writeAt; m = q < s.readAt ? s.readAt - q - 1 : s.end - q;
+
+            // initialize masks
+            ml = InternalInflateConstants.InflateMask[bl];
+            md = InternalInflateConstants.InflateMask[bd];
+
+            // do until not enough input or output space for fast loop
+            do
+            {
+                // assume called with m >= 258 && n >= 10
+                // get literal/length code
+                while (k < (20))
+                {
+                    // max bits for literal/length code
+                    n--;
+                    b |= (z.InputBuffer[p++] & 0xff) << k; k += 8;
+                }
+
+                t = b & ml;
+                tp = tl;
+                tp_index = tl_index;
+                tp_index_t_3 = (tp_index + t) * 3;
+                if ((e = tp[tp_index_t_3]) == 0)
+                {
+                    b >>= (tp[tp_index_t_3 + 1]); k -= (tp[tp_index_t_3 + 1]);
+
+                    s.window[q++] = (byte)tp[tp_index_t_3 + 2];
+                    m--;
+                    continue;
+                }
+                do
+                {
+
+                    b >>= (tp[tp_index_t_3 + 1]); k -= (tp[tp_index_t_3 + 1]);
+
+                    if ((e & 16) != 0)
+                    {
+                        e &= 15;
+                        c = tp[tp_index_t_3 + 2] + ((int)b & InternalInflateConstants.InflateMask[e]);
+
+                        b >>= e; k -= e;
+
+                        // decode distance base of block to copy
+                        while (k < 15)
+                        {
+                            // max bits for distance code
+                            n--;
+                            b |= (z.InputBuffer[p++] & 0xff) << k; k += 8;
+                        }
+
+                        t = b & md;
+                        tp = td;
+                        tp_index = td_index;
+                        tp_index_t_3 = (tp_index + t) * 3;
+                        e = tp[tp_index_t_3];
+
+                        do
+                        {
+
+                            b >>= (tp[tp_index_t_3 + 1]); k -= (tp[tp_index_t_3 + 1]);
+
+                            if ((e & 16) != 0)
+                            {
+                                // get extra bits to add to distance base
+                                e &= 15;
+                                while (k < e)
+                                {
+                                    // get extra bits (up to 13)
+                                    n--;
+                                    b |= (z.InputBuffer[p++] & 0xff) << k; k += 8;
+                                }
+
+                                d = tp[tp_index_t_3 + 2] + (b & InternalInflateConstants.InflateMask[e]);
+
+                                b >>= e; k -= e;
+
+                                // do the copy
+                                m -= c;
+                                if (q >= d)
+                                {
+                                    // offset before dest
+                                    //  just copy
+                                    r = q - d;
+                                    if (q - r > 0 && 2 > (q - r))
+                                    {
+                                        s.window[q++] = s.window[r++]; // minimum count is three,
+                                        s.window[q++] = s.window[r++]; // so unroll loop a little
+                                        c -= 2;
+                                    }
+                                    else
+                                    {
+                                        Array.Copy(s.window, r, s.window, q, 2);
+                                        q += 2; r += 2; c -= 2;
+                                    }
+                                }
+                                else
+                                {
+                                    // else offset after destination
+                                    r = q - d;
+                                    do
+                                    {
+                                        r += s.end; // force pointer in window
+                                    }
+                                    while (r < 0); // covers invalid distances
+                                    e = s.end - r;
+                                    if (c > e)
+                                    {
+                                        // if source crosses,
+                                        c -= e; // wrapped copy
+                                        if (q - r > 0 && e > (q - r))
+                                        {
+                                            do
+                                            {
+                                                s.window[q++] = s.window[r++];
+                                            }
+                                            while (--e != 0);
+                                        }
+                                        else
+                                        {
+                                            Array.Copy(s.window, r, s.window, q, e);
+                                            q += e; r += e; e = 0;
+                                        }
+                                        r = 0; // copy rest from start of window
+                                    }
+                                }
+
+                                // copy all or what's left
+                                if (q - r > 0 && c > (q - r))
+                                {
+                                    do
+                                    {
+                                        s.window[q++] = s.window[r++];
+                                    }
+                                    while (--c != 0);
+                                }
+                                else
+                                {
+                                    Array.Copy(s.window, r, s.window, q, c);
+                                    q += c; r += c; c = 0;
+                                }
+                                break;
+                            }
+                            else if ((e & 64) == 0)
+                            {
+                                t += tp[tp_index_t_3 + 2];
+                                t += (b & InternalInflateConstants.InflateMask[e]);
+                                tp_index_t_3 = (tp_index + t) * 3;
+                                e = tp[tp_index_t_3];
+                            }
+                            else
+                            {
+                                z.Message = "invalid distance code";
+
+                                c = z.AvailableBytesIn - n; c = (k >> 3) < c ? k >> 3 : c; n += c; p -= c; k -= (c << 3);
+
+                                s.bitb = b; s.bitk = k;
+                                z.AvailableBytesIn = n; z.TotalBytesIn += p - z.NextIn; z.NextIn = p;
+                                s.writeAt = q;
+
+                                return ZlibConstants.Z_DATA_ERROR;
+                            }
+                        }
+                        while (true);
+                        break;
+                    }
+
+                    if ((e & 64) == 0)
+                    {
+                        t += tp[tp_index_t_3 + 2];
+                        t += (b & InternalInflateConstants.InflateMask[e]);
+                        tp_index_t_3 = (tp_index + t) * 3;
+                        if ((e = tp[tp_index_t_3]) == 0)
+                        {
+                            b >>= (tp[tp_index_t_3 + 1]); k -= (tp[tp_index_t_3 + 1]);
+                            s.window[q++] = (byte)tp[tp_index_t_3 + 2];
+                            m--;
+                            break;
+                        }
+                    }
+                    else if ((e & 32) != 0)
+                    {
+                        c = z.AvailableBytesIn - n; c = (k >> 3) < c ? k >> 3 : c; n += c; p -= c; k -= (c << 3);
+
+                        s.bitb = b; s.bitk = k;
+                        z.AvailableBytesIn = n; z.TotalBytesIn += p - z.NextIn; z.NextIn = p;
+                        s.writeAt = q;
+
+                        return ZlibConstants.Z_STREAM_END;
+                    }
+                    else
+                    {
+                        z.Message = "invalid literal/length code";
+
+                        c = z.AvailableBytesIn - n; c = (k >> 3) < c ? k >> 3 : c; n += c; p -= c; k -= (c << 3);
+
+                        s.bitb = b; s.bitk = k;
+                        z.AvailableBytesIn = n; z.TotalBytesIn += p - z.NextIn; z.NextIn = p;
+                        s.writeAt = q;
+
+                        return ZlibConstants.Z_DATA_ERROR;
+                    }
+                }
+                while (true);
+            }
+            while (m >= 258 && n >= 10);
+
+            // not enough input or output--restore pointers and return
+            c = z.AvailableBytesIn - n; c = (k >> 3) < c ? k >> 3 : c; n += c; p -= c; k -= (c << 3);
+
+            s.bitb = b; s.bitk = k;
+            z.AvailableBytesIn = n; z.TotalBytesIn += p - z.NextIn; z.NextIn = p;
+            s.writeAt = q;
+
+            return ZlibConstants.Z_OK;
+        }
+    }
+
+
+    internal sealed class InflateManager
+    {
+        // preset dictionary flag in zlib header
+        private const int PRESET_DICT = 0x20;
+
+        private const int Z_DEFLATED = 8;
+
+        private enum InflateManagerMode
+        {
+            METHOD = 0,  // waiting for method byte
+            FLAG   = 1,  // waiting for flag byte
+            DICT4  = 2,  // four dictionary check bytes to go
+            DICT3  = 3,  // three dictionary check bytes to go
+            DICT2  = 4,  // two dictionary check bytes to go
+            DICT1  = 5,  // one dictionary check byte to go
+            DICT0  = 6,  // waiting for inflateSetDictionary
+            BLOCKS = 7,  // decompressing blocks
+            CHECK4 = 8,  // four check bytes to go
+            CHECK3 = 9,  // three check bytes to go
+            CHECK2 = 10, // two check bytes to go
+            CHECK1 = 11, // one check byte to go
+            DONE   = 12, // finished check, done
+            BAD    = 13, // got an error--stay here
+        }
+
+        private InflateManagerMode mode; // current inflate mode
+        internal ZlibCodec _codec; // pointer back to this zlib stream
+
+        // mode dependent information
+        internal int method; // if FLAGS, method byte
+
+        // if CHECK, check values to compare
+        internal uint computedCheck; // computed check value
+        internal uint expectedCheck; // stream check value
+
+        // if BAD, inflateSync's marker bytes count
+        internal int marker;
+
+        // mode independent information
+        //internal int nowrap; // flag for no wrapper
+        private bool _handleRfc1950HeaderBytes = true;
+        internal bool HandleRfc1950HeaderBytes
+        {
+            get { return _handleRfc1950HeaderBytes; }
+            set { _handleRfc1950HeaderBytes = value; }
+        }
+        internal int wbits; // log2(window size)  (8..15, defaults to 15)
+
+        internal InflateBlocks blocks; // current inflate_blocks state
+
+        public InflateManager() { }
+
+        public InflateManager(bool expectRfc1950HeaderBytes)
+        {
+            _handleRfc1950HeaderBytes = expectRfc1950HeaderBytes;
+        }
+
+        internal int Reset()
+        {
+            _codec.TotalBytesIn = _codec.TotalBytesOut = 0;
+            _codec.Message = null;
+            mode = HandleRfc1950HeaderBytes ? InflateManagerMode.METHOD : InflateManagerMode.BLOCKS;
+            blocks.Reset();
+            return ZlibConstants.Z_OK;
+        }
+
+        internal int End()
+        {
+            if (blocks != null)
+                blocks.Free();
+            blocks = null;
+            return ZlibConstants.Z_OK;
+        }
+
+        internal int Initialize(ZlibCodec codec, int w)
+        {
+            _codec = codec;
+            _codec.Message = null;
+            blocks = null;
+
+            // handle undocumented nowrap option (no zlib header or check)
+            //nowrap = 0;
+            //if (w < 0)
+            //{
+            //    w = - w;
+            //    nowrap = 1;
+            //}
+
+            // set window size
+            if (w < 8 || w > 15)
+            {
+                End();
+                throw new ZlibException("Bad window size.");
+
+                //return ZlibConstants.Z_STREAM_ERROR;
+            }
+            wbits = w;
+
+            blocks = new InflateBlocks(codec,
+                HandleRfc1950HeaderBytes ? this : null,
+                1 << w);
+
+            // reset state
+            Reset();
+            return ZlibConstants.Z_OK;
+        }
+
+
+        internal int Inflate(FlushType flush)
+        {
+            int b;
+
+            if (_codec.InputBuffer == null)
+                throw new ZlibException("InputBuffer is null. ");
+
+//             int f = (flush == FlushType.Finish)
+//                 ? ZlibConstants.Z_BUF_ERROR
+//                 : ZlibConstants.Z_OK;
+
+            // workitem 8870
+            int f = ZlibConstants.Z_OK;
+            int r = ZlibConstants.Z_BUF_ERROR;
+
+            while (true)
+            {
+                switch (mode)
+                {
+                    case InflateManagerMode.METHOD:
+                        if (_codec.AvailableBytesIn == 0) return r;
+                        r = f;
+                        _codec.AvailableBytesIn--;
+                        _codec.TotalBytesIn++;
+                        if (((method = _codec.InputBuffer[_codec.NextIn++]) & 0xf) != Z_DEFLATED)
+                        {
+                            mode = InflateManagerMode.BAD;
+                            _codec.Message = String.Format("unknown compression method (0x{0:X2})", method);
+                            marker = 5; // can't try inflateSync
+                            break;
+                        }
+                        if ((method >> 4) + 8 > wbits)
+                        {
+                            mode = InflateManagerMode.BAD;
+                            _codec.Message = String.Format("invalid window size ({0})", (method >> 4) + 8);
+                            marker = 5; // can't try inflateSync
+                            break;
+                        }
+                        mode = InflateManagerMode.FLAG;
+                        break;
+
+
+                    case InflateManagerMode.FLAG:
+                        if (_codec.AvailableBytesIn == 0) return r;
+                        r = f;
+                        _codec.AvailableBytesIn--;
+                        _codec.TotalBytesIn++;
+                        b = (_codec.InputBuffer[_codec.NextIn++]) & 0xff;
+
+                        if ((((method << 8) + b) % 31) != 0)
+                        {
+                            mode = InflateManagerMode.BAD;
+                            _codec.Message = "incorrect header check";
+                            marker = 5; // can't try inflateSync
+                            break;
+                        }
+
+                        mode = ((b & PRESET_DICT) == 0)
+                            ? InflateManagerMode.BLOCKS
+                            : InflateManagerMode.DICT4;
+                        break;
+
+                    case InflateManagerMode.DICT4:
+                        if (_codec.AvailableBytesIn == 0) return r;
+                        r = f;
+                        _codec.AvailableBytesIn--;
+                        _codec.TotalBytesIn++;
+                        expectedCheck = (uint)((_codec.InputBuffer[_codec.NextIn++] << 24) & 0xff000000);
+                        mode = InflateManagerMode.DICT3;
+                        break;
+
+                    case InflateManagerMode.DICT3:
+                        if (_codec.AvailableBytesIn == 0) return r;
+                        r = f;
+                        _codec.AvailableBytesIn--;
+                        _codec.TotalBytesIn++;
+                        expectedCheck += (uint)((_codec.InputBuffer[_codec.NextIn++] << 16) & 0x00ff0000);
+                        mode = InflateManagerMode.DICT2;
+                        break;
+
+                    case InflateManagerMode.DICT2:
+
+                        if (_codec.AvailableBytesIn == 0) return r;
+                        r = f;
+                        _codec.AvailableBytesIn--;
+                        _codec.TotalBytesIn++;
+                        expectedCheck += (uint)((_codec.InputBuffer[_codec.NextIn++] << 8) & 0x0000ff00);
+                        mode = InflateManagerMode.DICT1;
+                        break;
+
+
+                    case InflateManagerMode.DICT1:
+                        if (_codec.AvailableBytesIn == 0) return r;
+                        r = f;
+                        _codec.AvailableBytesIn--; _codec.TotalBytesIn++;
+                        expectedCheck += (uint)(_codec.InputBuffer[_codec.NextIn++] & 0x000000ff);
+                        _codec._Adler32 = expectedCheck;
+                        mode = InflateManagerMode.DICT0;
+                        return ZlibConstants.Z_NEED_DICT;
+
+
+                    case InflateManagerMode.DICT0:
+                        mode = InflateManagerMode.BAD;
+                        _codec.Message = "need dictionary";
+                        marker = 0; // can try inflateSync
+                        return ZlibConstants.Z_STREAM_ERROR;
+
+
+                    case InflateManagerMode.BLOCKS:
+                        r = blocks.Process(r);
+                        if (r == ZlibConstants.Z_DATA_ERROR)
+                        {
+                            mode = InflateManagerMode.BAD;
+                            marker = 0; // can try inflateSync
+                            break;
+                        }
+
+                        if (r == ZlibConstants.Z_OK) r = f;
+
+                        if (r != ZlibConstants.Z_STREAM_END)
+                            return r;
+
+                        r = f;
+                        computedCheck = blocks.Reset();
+                        if (!HandleRfc1950HeaderBytes)
+                        {
+                            mode = InflateManagerMode.DONE;
+                            return ZlibConstants.Z_STREAM_END;
+                        }
+                        mode = InflateManagerMode.CHECK4;
+                        break;
+
+                    case InflateManagerMode.CHECK4:
+                        if (_codec.AvailableBytesIn == 0) return r;
+                        r = f;
+                        _codec.AvailableBytesIn--;
+                        _codec.TotalBytesIn++;
+                        expectedCheck = (uint)((_codec.InputBuffer[_codec.NextIn++] << 24) & 0xff000000);
+                        mode = InflateManagerMode.CHECK3;
+                        break;
+
+                    case InflateManagerMode.CHECK3:
+                        if (_codec.AvailableBytesIn == 0) return r;
+                        r = f;
+                        _codec.AvailableBytesIn--; _codec.TotalBytesIn++;
+                        expectedCheck += (uint)((_codec.InputBuffer[_codec.NextIn++] << 16) & 0x00ff0000);
+                        mode = InflateManagerMode.CHECK2;
+                        break;
+
+                    case InflateManagerMode.CHECK2:
+                        if (_codec.AvailableBytesIn == 0) return r;
+                        r = f;
+                        _codec.AvailableBytesIn--;
+                        _codec.TotalBytesIn++;
+                        expectedCheck += (uint)((_codec.InputBuffer[_codec.NextIn++] << 8) & 0x0000ff00);
+                        mode = InflateManagerMode.CHECK1;
+                        break;
+
+                    case InflateManagerMode.CHECK1:
+                        if (_codec.AvailableBytesIn == 0) return r;
+                        r = f;
+                        _codec.AvailableBytesIn--; _codec.TotalBytesIn++;
+                        expectedCheck += (uint)(_codec.InputBuffer[_codec.NextIn++] & 0x000000ff);
+                        if (computedCheck != expectedCheck)
+                        {
+                            mode = InflateManagerMode.BAD;
+                            _codec.Message = "incorrect data check";
+                            marker = 5; // can't try inflateSync
+                            break;
+                        }
+                        mode = InflateManagerMode.DONE;
+                        return ZlibConstants.Z_STREAM_END;
+
+                    case InflateManagerMode.DONE:
+                        return ZlibConstants.Z_STREAM_END;
+
+                    case InflateManagerMode.BAD:
+                        throw new ZlibException(String.Format("Bad state ({0})", _codec.Message));
+
+                    default:
+                        throw new ZlibException("Stream error.");
+
+                }
+            }
+        }
+
+
+
+        internal int SetDictionary(byte[] dictionary)
+        {
+            int index = 0;
+            int length = dictionary.Length;
+            if (mode != InflateManagerMode.DICT0)
+                throw new ZlibException("Stream error.");
+
+            if (Adler.Adler32(1, dictionary, 0, dictionary.Length) != _codec._Adler32)
+            {
+                return ZlibConstants.Z_DATA_ERROR;
+            }
+
+            _codec._Adler32 = Adler.Adler32(0, null, 0, 0);
+
+            if (length >= (1 << wbits))
+            {
+                length = (1 << wbits) - 1;
+                index = dictionary.Length - length;
+            }
+            blocks.SetDictionary(dictionary, index, length);
+            mode = InflateManagerMode.BLOCKS;
+            return ZlibConstants.Z_OK;
+        }
+
+
+        private static readonly byte[] mark = new byte[] { 0, 0, 0xff, 0xff };
+
+        internal int Sync()
+        {
+            int n; // number of bytes to look at
+            int p; // pointer to bytes
+            int m; // number of marker bytes found in a row
+            long r, w; // temporaries to save total_in and total_out
+
+            // set up
+            if (mode != InflateManagerMode.BAD)
+            {
+                mode = InflateManagerMode.BAD;
+                marker = 0;
+            }
+            if ((n = _codec.AvailableBytesIn) == 0)
+                return ZlibConstants.Z_BUF_ERROR;
+            p = _codec.NextIn;
+            m = marker;
+
+            // search
+            while (n != 0 && m < 4)
+            {
+                if (_codec.InputBuffer[p] == mark[m])
+                {
+                    m++;
+                }
+                else if (_codec.InputBuffer[p] != 0)
+                {
+                    m = 0;
+                }
+                else
+                {
+                    m = 4 - m;
+                }
+                p++; n--;
+            }
+
+            // restore
+            _codec.TotalBytesIn += p - _codec.NextIn;
+            _codec.NextIn = p;
+            _codec.AvailableBytesIn = n;
+            marker = m;
+
+            // return no joy or set up to restart on a new block
+            if (m != 4)
+            {
+                return ZlibConstants.Z_DATA_ERROR;
+            }
+            r = _codec.TotalBytesIn;
+            w = _codec.TotalBytesOut;
+            Reset();
+            _codec.TotalBytesIn = r;
+            _codec.TotalBytesOut = w;
+            mode = InflateManagerMode.BLOCKS;
+            return ZlibConstants.Z_OK;
+        }
+
+
+        // Returns true if inflate is currently at the end of a block generated
+        // by Z_SYNC_FLUSH or Z_FULL_FLUSH. This function is used by one PPP
+        // implementation to provide an additional safety check. PPP uses Z_SYNC_FLUSH
+        // but removes the length bytes of the resulting empty stored block. When
+        // decompressing, PPP checks that at the end of input packet, inflate is
+        // waiting for these length bytes.
+        internal int SyncPoint(ZlibCodec z)
+        {
+            return blocks.SyncPoint();
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/Zlib/ParallelDeflateOutputStream.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/Zlib/ParallelDeflateOutputStream.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/Zlib/ParallelDeflateOutputStream.cs	(revision 12707)
@@ -0,0 +1,1386 @@
+//#define Trace
+
+// ParallelDeflateOutputStream.cs
+// ------------------------------------------------------------------
+//
+// A DeflateStream that does compression only, it uses a
+// divide-and-conquer approach with multiple threads to exploit multiple
+// CPUs for the DEFLATE computation.
+//
+// last saved: <2011-July-31 14:49:40>
+//
+// ------------------------------------------------------------------
+//
+// Copyright (c) 2009-2011 by Dino Chiesa
+// All rights reserved!
+//
+// This code module is part of DotNetZip, a zipfile class library.
+//
+// ------------------------------------------------------------------
+//
+// This code is licensed under the Microsoft Public License.
+// See the file License.txt for the license details.
+// More info on: http://dotnetzip.codeplex.com
+//
+// ------------------------------------------------------------------
+
+using System;
+using System.Collections.Generic;
+using System.Threading;
+using System.IO;
+
+
+namespace OfficeOpenXml.Packaging.Ionic.Zlib
+{
+    internal class WorkItem
+    {
+        public byte[] buffer;
+        public byte[] compressed;
+        public int crc;
+        public int index;
+        public int ordinal;
+        public int inputBytesAvailable;
+        public int compressedBytesAvailable;
+        public ZlibCodec compressor;
+
+        public WorkItem(int size,
+                        Ionic.Zlib.CompressionLevel compressLevel,
+                        CompressionStrategy strategy,
+                        int ix)
+        {
+            this.buffer= new byte[size];
+            // alloc 5 bytes overhead for every block (margin of safety= 2)
+            int n = size + ((size / 32768)+1) * 5 * 2;
+            this.compressed = new byte[n];
+            this.compressor = new ZlibCodec();
+            this.compressor.InitializeDeflate(compressLevel, false);
+            this.compressor.OutputBuffer = this.compressed;
+            this.compressor.InputBuffer = this.buffer;
+            this.index = ix;
+        }
+    }
+
+    /// <summary>
+    ///   A class for compressing streams using the
+    ///   Deflate algorithm with multiple threads.
+    /// </summary>
+    ///
+    /// <remarks>
+    /// <para>
+    ///   This class performs DEFLATE compression through writing.  For
+    ///   more information on the Deflate algorithm, see IETF RFC 1951,
+    ///   "DEFLATE Compressed Data Format Specification version 1.3."
+    /// </para>
+    ///
+    /// <para>
+    ///   This class is similar to <see cref="Ionic.Zlib.DeflateStream"/>, except
+    ///   that this class is for compression only, and this implementation uses an
+    ///   approach that employs multiple worker threads to perform the DEFLATE.  On
+    ///   a multi-cpu or multi-core computer, the performance of this class can be
+    ///   significantly higher than the single-threaded DeflateStream, particularly
+    ///   for larger streams.  How large?  Anything over 10mb is a good candidate
+    ///   for parallel compression.
+    /// </para>
+    ///
+    /// <para>
+    ///   The tradeoff is that this class uses more memory and more CPU than the
+    ///   vanilla DeflateStream, and also is less efficient as a compressor. For
+    ///   large files the size of the compressed data stream can be less than 1%
+    ///   larger than the size of a compressed data stream from the vanialla
+    ///   DeflateStream.  For smaller files the difference can be larger.  The
+    ///   difference will also be larger if you set the BufferSize to be lower than
+    ///   the default value.  Your mileage may vary. Finally, for small files, the
+    ///   ParallelDeflateOutputStream can be much slower than the vanilla
+    ///   DeflateStream, because of the overhead associated to using the thread
+    ///   pool.
+    /// </para>
+    ///
+    /// </remarks>
+    /// <seealso cref="Ionic.Zlib.DeflateStream" />
+    public class ParallelDeflateOutputStream : System.IO.Stream
+    {
+
+        private static readonly int IO_BUFFER_SIZE_DEFAULT = 64 * 1024;  // 128k
+        private static readonly int BufferPairsPerCore = 4;
+
+        private System.Collections.Generic.List<WorkItem> _pool;
+        private bool                        _leaveOpen;
+        private bool                        emitting;
+        private System.IO.Stream            _outStream;
+        private int                         _maxBufferPairs;
+        private int                         _bufferSize = IO_BUFFER_SIZE_DEFAULT;
+        private AutoResetEvent              _newlyCompressedBlob;
+        //private ManualResetEvent            _writingDone;
+        //private ManualResetEvent            _sessionReset;
+        private object                      _outputLock = new object();
+        private bool                        _isClosed;
+        private bool                        _firstWriteDone;
+        private int                         _currentlyFilling;
+        private int                         _lastFilled;
+        private int                         _lastWritten;
+        private int                         _latestCompressed;
+        private int                         _Crc32;
+        private Ionic.Crc.CRC32             _runningCrc;
+        private object                      _latestLock = new object();
+        private System.Collections.Generic.Queue<int>     _toWrite;
+        private System.Collections.Generic.Queue<int>     _toFill;
+        private Int64                       _totalBytesProcessed;
+        private Ionic.Zlib.CompressionLevel _compressLevel;
+        private volatile Exception          _pendingException;
+        private bool                        _handlingException;
+        private object                      _eLock = new Object();  // protects _pendingException
+
+        // This bitfield is used only when Trace is defined.
+        //private TraceBits _DesiredTrace = TraceBits.Write | TraceBits.WriteBegin |
+        //TraceBits.WriteDone | TraceBits.Lifecycle | TraceBits.Fill | TraceBits.Flush |
+        //TraceBits.Session;
+
+        //private TraceBits _DesiredTrace = TraceBits.WriteBegin | TraceBits.WriteDone | TraceBits.Synch | TraceBits.Lifecycle  | TraceBits.Session ;
+
+        private TraceBits _DesiredTrace =
+            TraceBits.Session |
+            TraceBits.Compress |
+            TraceBits.WriteTake |
+            TraceBits.WriteEnter |
+            TraceBits.EmitEnter |
+            TraceBits.EmitDone |
+            TraceBits.EmitLock |
+            TraceBits.EmitSkip |
+            TraceBits.EmitBegin;
+
+        /// <summary>
+        /// Create a ParallelDeflateOutputStream.
+        /// </summary>
+        /// <remarks>
+        ///
+        /// <para>
+        ///   This stream compresses data written into it via the DEFLATE
+        ///   algorithm (see RFC 1951), and writes out the compressed byte stream.
+        /// </para>
+        ///
+        /// <para>
+        ///   The instance will use the default compression level, the default
+        ///   buffer sizes and the default number of threads and buffers per
+        ///   thread.
+        /// </para>
+        ///
+        /// <para>
+        ///   This class is similar to <see cref="Ionic.Zlib.DeflateStream"/>,
+        ///   except that this implementation uses an approach that employs
+        ///   multiple worker threads to perform the DEFLATE.  On a multi-cpu or
+        ///   multi-core computer, the performance of this class can be
+        ///   significantly higher than the single-threaded DeflateStream,
+        ///   particularly for larger streams.  How large?  Anything over 10mb is
+        ///   a good candidate for parallel compression.
+        /// </para>
+        ///
+        /// </remarks>
+        ///
+        /// <example>
+        ///
+        /// This example shows how to use a ParallelDeflateOutputStream to compress
+        /// data.  It reads a file, compresses it, and writes the compressed data to
+        /// a second, output file.
+        ///
+        /// <code>
+        /// byte[] buffer = new byte[WORKING_BUFFER_SIZE];
+        /// int n= -1;
+        /// String outputFile = fileToCompress + ".compressed";
+        /// using (System.IO.Stream input = System.IO.File.OpenRead(fileToCompress))
+        /// {
+        ///     using (var raw = System.IO.File.Create(outputFile))
+        ///     {
+        ///         using (Stream compressor = new ParallelDeflateOutputStream(raw))
+        ///         {
+        ///             while ((n= input.Read(buffer, 0, buffer.Length)) != 0)
+        ///             {
+        ///                 compressor.Write(buffer, 0, n);
+        ///             }
+        ///         }
+        ///     }
+        /// }
+        /// </code>
+        /// <code lang="VB">
+        /// Dim buffer As Byte() = New Byte(4096) {}
+        /// Dim n As Integer = -1
+        /// Dim outputFile As String = (fileToCompress &amp; ".compressed")
+        /// Using input As Stream = File.OpenRead(fileToCompress)
+        ///     Using raw As FileStream = File.Create(outputFile)
+        ///         Using compressor As Stream = New ParallelDeflateOutputStream(raw)
+        ///             Do While (n &lt;&gt; 0)
+        ///                 If (n &gt; 0) Then
+        ///                     compressor.Write(buffer, 0, n)
+        ///                 End If
+        ///                 n = input.Read(buffer, 0, buffer.Length)
+        ///             Loop
+        ///         End Using
+        ///     End Using
+        /// End Using
+        /// </code>
+        /// </example>
+        /// <param name="stream">The stream to which compressed data will be written.</param>
+        public ParallelDeflateOutputStream(System.IO.Stream stream)
+            : this(stream, CompressionLevel.Default, CompressionStrategy.Default, false)
+        {
+        }
+
+        /// <summary>
+        ///   Create a ParallelDeflateOutputStream using the specified CompressionLevel.
+        /// </summary>
+        /// <remarks>
+        ///   See the <see cref="ParallelDeflateOutputStream(System.IO.Stream)"/>
+        ///   constructor for example code.
+        /// </remarks>
+        /// <param name="stream">The stream to which compressed data will be written.</param>
+        /// <param name="level">A tuning knob to trade speed for effectiveness.</param>
+        public ParallelDeflateOutputStream(System.IO.Stream stream, CompressionLevel level)
+            : this(stream, level, CompressionStrategy.Default, false)
+        {
+        }
+
+        /// <summary>
+        /// Create a ParallelDeflateOutputStream and specify whether to leave the captive stream open
+        /// when the ParallelDeflateOutputStream is closed.
+        /// </summary>
+        /// <remarks>
+        ///   See the <see cref="ParallelDeflateOutputStream(System.IO.Stream)"/>
+        ///   constructor for example code.
+        /// </remarks>
+        /// <param name="stream">The stream to which compressed data will be written.</param>
+        /// <param name="leaveOpen">
+        ///    true if the application would like the stream to remain open after inflation/deflation.
+        /// </param>
+        public ParallelDeflateOutputStream(System.IO.Stream stream, bool leaveOpen)
+            : this(stream, CompressionLevel.Default, CompressionStrategy.Default, leaveOpen)
+        {
+        }
+
+        /// <summary>
+        /// Create a ParallelDeflateOutputStream and specify whether to leave the captive stream open
+        /// when the ParallelDeflateOutputStream is closed.
+        /// </summary>
+        /// <remarks>
+        ///   See the <see cref="ParallelDeflateOutputStream(System.IO.Stream)"/>
+        ///   constructor for example code.
+        /// </remarks>
+        /// <param name="stream">The stream to which compressed data will be written.</param>
+        /// <param name="level">A tuning knob to trade speed for effectiveness.</param>
+        /// <param name="leaveOpen">
+        ///    true if the application would like the stream to remain open after inflation/deflation.
+        /// </param>
+        public ParallelDeflateOutputStream(System.IO.Stream stream, CompressionLevel level, bool leaveOpen)
+            : this(stream, CompressionLevel.Default, CompressionStrategy.Default, leaveOpen)
+        {
+        }
+
+        /// <summary>
+        /// Create a ParallelDeflateOutputStream using the specified
+        /// CompressionLevel and CompressionStrategy, and specifying whether to
+        /// leave the captive stream open when the ParallelDeflateOutputStream is
+        /// closed.
+        /// </summary>
+        /// <remarks>
+        ///   See the <see cref="ParallelDeflateOutputStream(System.IO.Stream)"/>
+        ///   constructor for example code.
+        /// </remarks>
+        /// <param name="stream">The stream to which compressed data will be written.</param>
+        /// <param name="level">A tuning knob to trade speed for effectiveness.</param>
+        /// <param name="strategy">
+        ///   By tweaking this parameter, you may be able to optimize the compression for
+        ///   data with particular characteristics.
+        /// </param>
+        /// <param name="leaveOpen">
+        ///    true if the application would like the stream to remain open after inflation/deflation.
+        /// </param>
+        public ParallelDeflateOutputStream(System.IO.Stream stream,
+                                           CompressionLevel level,
+                                           CompressionStrategy strategy,
+                                           bool leaveOpen)
+        {
+            TraceOutput(TraceBits.Lifecycle | TraceBits.Session, "-------------------------------------------------------");
+            TraceOutput(TraceBits.Lifecycle | TraceBits.Session, "Create {0:X8}", this.GetHashCode());
+            _outStream = stream;
+            _compressLevel= level;
+            Strategy = strategy;
+            _leaveOpen = leaveOpen;
+            this.MaxBufferPairs = 16; // default
+        }
+
+
+        /// <summary>
+        ///   The ZLIB strategy to be used during compression.
+        /// </summary>
+        ///
+        public CompressionStrategy Strategy
+        {
+            get;
+            private set;
+        }
+
+        /// <summary>
+        ///   The maximum number of buffer pairs to use.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   This property sets an upper limit on the number of memory buffer
+        ///   pairs to create.  The implementation of this stream allocates
+        ///   multiple buffers to facilitate parallel compression.  As each buffer
+        ///   fills up, this stream uses <see
+        ///   cref="System.Threading.ThreadPool.QueueUserWorkItem(WaitCallback)">
+        ///   ThreadPool.QueueUserWorkItem()</see>
+        ///   to compress those buffers in a background threadpool thread. After a
+        ///   buffer is compressed, it is re-ordered and written to the output
+        ///   stream.
+        /// </para>
+        ///
+        /// <para>
+        ///   A higher number of buffer pairs enables a higher degree of
+        ///   parallelism, which tends to increase the speed of compression on
+        ///   multi-cpu computers.  On the other hand, a higher number of buffer
+        ///   pairs also implies a larger memory consumption, more active worker
+        ///   threads, and a higher cpu utilization for any compression. This
+        ///   property enables the application to limit its memory consumption and
+        ///   CPU utilization behavior depending on requirements.
+        /// </para>
+        ///
+        /// <para>
+        ///   For each compression "task" that occurs in parallel, there are 2
+        ///   buffers allocated: one for input and one for output.  This property
+        ///   sets a limit for the number of pairs.  The total amount of storage
+        ///   space allocated for buffering will then be (N*S*2), where N is the
+        ///   number of buffer pairs, S is the size of each buffer (<see
+        ///   cref="BufferSize"/>).  By default, DotNetZip allocates 4 buffer
+        ///   pairs per CPU core, so if your machine has 4 cores, and you retain
+        ///   the default buffer size of 128k, then the
+        ///   ParallelDeflateOutputStream will use 4 * 4 * 2 * 128kb of buffer
+        ///   memory in total, or 4mb, in blocks of 128kb.  If you then set this
+        ///   property to 8, then the number will be 8 * 2 * 128kb of buffer
+        ///   memory, or 2mb.
+        /// </para>
+        ///
+        /// <para>
+        ///   CPU utilization will also go up with additional buffers, because a
+        ///   larger number of buffer pairs allows a larger number of background
+        ///   threads to compress in parallel. If you find that parallel
+        ///   compression is consuming too much memory or CPU, you can adjust this
+        ///   value downward.
+        /// </para>
+        ///
+        /// <para>
+        ///   The default value is 16. Different values may deliver better or
+        ///   worse results, depending on your priorities and the dynamic
+        ///   performance characteristics of your storage and compute resources.
+        /// </para>
+        ///
+        /// <para>
+        ///   This property is not the number of buffer pairs to use; it is an
+        ///   upper limit. An illustration: Suppose you have an application that
+        ///   uses the default value of this property (which is 16), and it runs
+        ///   on a machine with 2 CPU cores. In that case, DotNetZip will allocate
+        ///   4 buffer pairs per CPU core, for a total of 8 pairs.  The upper
+        ///   limit specified by this property has no effect.
+        /// </para>
+        ///
+        /// <para>
+        ///   The application can set this value at any time, but it is effective
+        ///   only before the first call to Write(), which is when the buffers are
+        ///   allocated.
+        /// </para>
+        /// </remarks>
+        public int MaxBufferPairs
+        {
+            get
+            {
+                return _maxBufferPairs;
+            }
+            set
+            {
+                if (value < 4)
+                    throw new ArgumentException("MaxBufferPairs",
+                                                "Value must be 4 or greater.");
+                _maxBufferPairs = value;
+            }
+        }
+
+        /// <summary>
+        ///   The size of the buffers used by the compressor threads.
+        /// </summary>
+        /// <remarks>
+        ///
+        /// <para>
+        ///   The default buffer size is 128k. The application can set this value
+        ///   at any time, but it is effective only before the first Write().
+        /// </para>
+        ///
+        /// <para>
+        ///   Larger buffer sizes implies larger memory consumption but allows
+        ///   more efficient compression. Using smaller buffer sizes consumes less
+        ///   memory but may result in less effective compression.  For example,
+        ///   using the default buffer size of 128k, the compression delivered is
+        ///   within 1% of the compression delivered by the single-threaded <see
+        ///   cref="Ionic.Zlib.DeflateStream"/>.  On the other hand, using a
+        ///   BufferSize of 8k can result in a compressed data stream that is 5%
+        ///   larger than that delivered by the single-threaded
+        ///   <c>DeflateStream</c>.  Excessively small buffer sizes can also cause
+        ///   the speed of the ParallelDeflateOutputStream to drop, because of
+        ///   larger thread scheduling overhead dealing with many many small
+        ///   buffers.
+        /// </para>
+        ///
+        /// <para>
+        ///   The total amount of storage space allocated for buffering will be
+        ///   (N*S*2), where N is the number of buffer pairs, and S is the size of
+        ///   each buffer (this property). There are 2 buffers used by the
+        ///   compressor, one for input and one for output.  By default, DotNetZip
+        ///   allocates 4 buffer pairs per CPU core, so if your machine has 4
+        ///   cores, then the number of buffer pairs used will be 16. If you
+        ///   accept the default value of this property, 128k, then the
+        ///   ParallelDeflateOutputStream will use 16 * 2 * 128kb of buffer memory
+        ///   in total, or 4mb, in blocks of 128kb.  If you set this property to
+        ///   64kb, then the number will be 16 * 2 * 64kb of buffer memory, or
+        ///   2mb.
+        /// </para>
+        ///
+        /// </remarks>
+        public int BufferSize
+        {
+            get { return _bufferSize;}
+            set
+            {
+                if (value < 1024)
+                    throw new ArgumentOutOfRangeException("BufferSize",
+                                                          "BufferSize must be greater than 1024 bytes");
+                _bufferSize = value;
+            }
+        }
+
+        /// <summary>
+        /// The CRC32 for the data that was written out, prior to compression.
+        /// </summary>
+        /// <remarks>
+        /// This value is meaningful only after a call to Close().
+        /// </remarks>
+        public int Crc32 { get { return _Crc32; } }
+
+
+        /// <summary>
+        /// The total number of uncompressed bytes processed by the ParallelDeflateOutputStream.
+        /// </summary>
+        /// <remarks>
+        /// This value is meaningful only after a call to Close().
+        /// </remarks>
+        public Int64 BytesProcessed { get { return _totalBytesProcessed; } }
+
+
+        private void _InitializePoolOfWorkItems()
+        {
+            _toWrite = new Queue<int>();
+            _toFill = new Queue<int>();
+            _pool = new System.Collections.Generic.List<WorkItem>();
+            int nTasks = BufferPairsPerCore * Environment.ProcessorCount;
+            nTasks = Math.Min(nTasks, _maxBufferPairs);
+            for(int i=0; i < nTasks; i++)
+            {
+                _pool.Add(new WorkItem(_bufferSize, _compressLevel, Strategy, i));
+                _toFill.Enqueue(i);
+            }
+
+            _newlyCompressedBlob = new AutoResetEvent(false);
+            _runningCrc = new Ionic.Crc.CRC32();
+            _currentlyFilling = -1;
+            _lastFilled = -1;
+            _lastWritten = -1;
+            _latestCompressed = -1;
+        }
+
+
+
+
+        /// <summary>
+        ///   Write data to the stream.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///
+        /// <para>
+        ///   To use the ParallelDeflateOutputStream to compress data, create a
+        ///   ParallelDeflateOutputStream with CompressionMode.Compress, passing a
+        ///   writable output stream.  Then call Write() on that
+        ///   ParallelDeflateOutputStream, providing uncompressed data as input.  The
+        ///   data sent to the output stream will be the compressed form of the data
+        ///   written.
+        /// </para>
+        ///
+        /// <para>
+        ///   To decompress data, use the <see cref="Ionic.Zlib.DeflateStream"/> class.
+        /// </para>
+        ///
+        /// </remarks>
+        /// <param name="buffer">The buffer holding data to write to the stream.</param>
+        /// <param name="offset">the offset within that data array to find the first byte to write.</param>
+        /// <param name="count">the number of bytes to write.</param>
+        public override void Write(byte[] buffer, int offset, int count)
+        {
+            bool mustWait = false;
+
+            // This method does this:
+            //   0. handles any pending exceptions
+            //   1. write any buffers that are ready to be written,
+            //   2. fills a work buffer; when full, flip state to 'Filled',
+            //   3. if more data to be written,  goto step 1
+
+            if (_isClosed)
+                throw new InvalidOperationException();
+
+            // dispense any exceptions that occurred on the BG threads
+            if (_pendingException != null)
+            {
+                _handlingException = true;
+                var pe = _pendingException;
+                _pendingException = null;
+                throw pe;
+            }
+
+            if (count == 0) return;
+
+            if (!_firstWriteDone)
+            {
+                // Want to do this on first Write, first session, and not in the
+                // constructor.  We want to allow MaxBufferPairs to
+                // change after construction, but before first Write.
+                _InitializePoolOfWorkItems();
+                _firstWriteDone = true;
+            }
+
+
+            do
+            {
+                // may need to make buffers available
+                EmitPendingBuffers(false, mustWait);
+
+                mustWait = false;
+                // use current buffer, or get a new buffer to fill
+                int ix = -1;
+                if (_currentlyFilling >= 0)
+                {
+                    ix = _currentlyFilling;
+                    TraceOutput(TraceBits.WriteTake,
+                                "Write    notake   wi({0}) lf({1})",
+                                ix,
+                                _lastFilled);
+                }
+                else
+                {
+                    TraceOutput(TraceBits.WriteTake, "Write    take?");
+                    if (_toFill.Count == 0)
+                    {
+                        // no available buffers, so... need to emit
+                        // compressed buffers.
+                        mustWait = true;
+                        continue;
+                    }
+
+                    ix = _toFill.Dequeue();
+                    TraceOutput(TraceBits.WriteTake,
+                                "Write    take     wi({0}) lf({1})",
+                                ix,
+                                _lastFilled);
+                    ++_lastFilled; // TODO: consider rollover?
+                }
+
+                WorkItem workitem = _pool[ix];
+
+                int limit = ((workitem.buffer.Length - workitem.inputBytesAvailable) > count)
+                    ? count
+                    : (workitem.buffer.Length - workitem.inputBytesAvailable);
+
+                workitem.ordinal = _lastFilled;
+
+                TraceOutput(TraceBits.Write,
+                            "Write    lock     wi({0}) ord({1}) iba({2})",
+                            workitem.index,
+                            workitem.ordinal,
+                            workitem.inputBytesAvailable
+                            );
+
+                // copy from the provided buffer to our workitem, starting at
+                // the tail end of whatever data we might have in there currently.
+                Buffer.BlockCopy(buffer,
+                                 offset,
+                                 workitem.buffer,
+                                 workitem.inputBytesAvailable,
+                                 limit);
+
+                count -= limit;
+                offset += limit;
+                workitem.inputBytesAvailable += limit;
+                if (workitem.inputBytesAvailable == workitem.buffer.Length)
+                {
+                    // No need for interlocked.increment: the Write()
+                    // method is documented as not multi-thread safe, so
+                    // we can assume Write() calls come in from only one
+                    // thread.
+                    TraceOutput(TraceBits.Write,
+                                "Write    QUWI     wi({0}) ord({1}) iba({2}) nf({3})",
+                                workitem.index,
+                                workitem.ordinal,
+                                workitem.inputBytesAvailable );
+
+                    if (!ThreadPool.QueueUserWorkItem( _DeflateOne, workitem ))
+                        throw new Exception("Cannot enqueue workitem");
+
+                    _currentlyFilling = -1; // will get a new buffer next time
+                }
+                else
+                    _currentlyFilling = ix;
+
+                if (count > 0)
+                    TraceOutput(TraceBits.WriteEnter, "Write    more");
+            }
+            while (count > 0);  // until no more to write
+
+            TraceOutput(TraceBits.WriteEnter, "Write    exit");
+            return;
+        }
+
+
+
+        private void _FlushFinish()
+        {
+            // After writing a series of compressed buffers, each one closed
+            // with Flush.Sync, we now write the final one as Flush.Finish,
+            // and then stop.
+            byte[] buffer = new byte[128];
+            var compressor = new ZlibCodec();
+            int rc = compressor.InitializeDeflate(_compressLevel, false);
+            compressor.InputBuffer = null;
+            compressor.NextIn = 0;
+            compressor.AvailableBytesIn = 0;
+            compressor.OutputBuffer = buffer;
+            compressor.NextOut = 0;
+            compressor.AvailableBytesOut = buffer.Length;
+            rc = compressor.Deflate(FlushType.Finish);
+
+            if (rc != ZlibConstants.Z_STREAM_END && rc != ZlibConstants.Z_OK)
+                throw new Exception("deflating: " + compressor.Message);
+
+            if (buffer.Length - compressor.AvailableBytesOut > 0)
+            {
+                TraceOutput(TraceBits.EmitBegin,
+                            "Emit     begin    flush bytes({0})",
+                            buffer.Length - compressor.AvailableBytesOut);
+
+                _outStream.Write(buffer, 0, buffer.Length - compressor.AvailableBytesOut);
+
+                TraceOutput(TraceBits.EmitDone,
+                            "Emit     done     flush");
+            }
+
+            compressor.EndDeflate();
+
+            _Crc32 = _runningCrc.Crc32Result;
+        }
+
+
+        private void _Flush(bool lastInput)
+        {
+            if (_isClosed)
+                throw new InvalidOperationException();
+
+            if (emitting) return;
+
+            // compress any partial buffer
+            if (_currentlyFilling >= 0)
+            {
+                WorkItem workitem = _pool[_currentlyFilling];
+                _DeflateOne(workitem);
+                _currentlyFilling = -1; // get a new buffer next Write()
+            }
+
+            if (lastInput)
+            {
+                EmitPendingBuffers(true, false);
+                _FlushFinish();
+            }
+            else
+            {
+                EmitPendingBuffers(false, false);
+            }
+        }
+
+
+
+        /// <summary>
+        /// Flush the stream.
+        /// </summary>
+        public override void Flush()
+        {
+            if (_pendingException != null)
+            {
+                _handlingException = true;
+                var pe = _pendingException;
+                _pendingException = null;
+                throw pe;
+            }
+            if (_handlingException)
+                return;
+
+            _Flush(false);
+        }
+
+
+        /// <summary>
+        /// Close the stream.
+        /// </summary>
+        /// <remarks>
+        /// You must call Close on the stream to guarantee that all of the data written in has
+        /// been compressed, and the compressed data has been written out.
+        /// </remarks>
+        public override void Close()
+        {
+            TraceOutput(TraceBits.Session, "Close {0:X8}", this.GetHashCode());
+
+            if (_pendingException != null)
+            {
+                _handlingException = true;
+                var pe = _pendingException;
+                _pendingException = null;
+                throw pe;
+            }
+
+            if (_handlingException)
+                return;
+
+            if (_isClosed) return;
+
+            _Flush(true);
+
+            if (!_leaveOpen)
+                _outStream.Close();
+
+            _isClosed= true;
+        }
+
+
+
+        // workitem 10030 - implement a new Dispose method
+
+        /// <summary>Dispose the object</summary>
+        /// <remarks>
+        ///   <para>
+        ///     Because ParallelDeflateOutputStream is IDisposable, the
+        ///     application must call this method when finished using the instance.
+        ///   </para>
+        ///   <para>
+        ///     This method is generally called implicitly upon exit from
+        ///     a <c>using</c> scope in C# (<c>Using</c> in VB).
+        ///   </para>
+        /// </remarks>
+        new public void Dispose()
+        {
+            TraceOutput(TraceBits.Lifecycle, "Dispose  {0:X8}", this.GetHashCode());
+            Close();
+            _pool = null;
+            Dispose(true);
+        }
+
+
+
+        /// <summary>The Dispose method</summary>
+        /// <param name="disposing">
+        ///   indicates whether the Dispose method was invoked by user code.
+        /// </param>
+        protected override void Dispose(bool disposing)
+        {
+            base.Dispose(disposing);
+        }
+
+
+        /// <summary>
+        ///   Resets the stream for use with another stream.
+        /// </summary>
+        /// <remarks>
+        ///   Because the ParallelDeflateOutputStream is expensive to create, it
+        ///   has been designed so that it can be recycled and re-used.  You have
+        ///   to call Close() on the stream first, then you can call Reset() on
+        ///   it, to use it again on another stream.
+        /// </remarks>
+        ///
+        /// <param name="stream">
+        ///   The new output stream for this era.
+        /// </param>
+        ///
+        /// <example>
+        /// <code>
+        /// ParallelDeflateOutputStream deflater = null;
+        /// foreach (var inputFile in listOfFiles)
+        /// {
+        ///     string outputFile = inputFile + ".compressed";
+        ///     using (System.IO.Stream input = System.IO.File.OpenRead(inputFile))
+        ///     {
+        ///         using (var outStream = System.IO.File.Create(outputFile))
+        ///         {
+        ///             if (deflater == null)
+        ///                 deflater = new ParallelDeflateOutputStream(outStream,
+        ///                                                            CompressionLevel.Best,
+        ///                                                            CompressionStrategy.Default,
+        ///                                                            true);
+        ///             deflater.Reset(outStream);
+        ///
+        ///             while ((n= input.Read(buffer, 0, buffer.Length)) != 0)
+        ///             {
+        ///                 deflater.Write(buffer, 0, n);
+        ///             }
+        ///         }
+        ///     }
+        /// }
+        /// </code>
+        /// </example>
+        public void Reset(Stream stream)
+        {
+            TraceOutput(TraceBits.Session, "-------------------------------------------------------");
+            TraceOutput(TraceBits.Session, "Reset {0:X8} firstDone({1})", this.GetHashCode(), _firstWriteDone);
+
+            if (!_firstWriteDone) return;
+
+            // reset all status
+            _toWrite.Clear();
+            _toFill.Clear();
+            foreach (var workitem in _pool)
+            {
+                _toFill.Enqueue(workitem.index);
+                workitem.ordinal = -1;
+            }
+
+            _firstWriteDone = false;
+            _totalBytesProcessed = 0L;
+            _runningCrc = new Ionic.Crc.CRC32();
+            _isClosed= false;
+            _currentlyFilling = -1;
+            _lastFilled = -1;
+            _lastWritten = -1;
+            _latestCompressed = -1;
+            _outStream = stream;
+        }
+
+
+
+
+        private void EmitPendingBuffers(bool doAll, bool mustWait)
+        {
+            // When combining parallel deflation with a ZipSegmentedStream, it's
+            // possible for the ZSS to throw from within this method.  In that
+            // case, Close/Dispose will be called on this stream, if this stream
+            // is employed within a using or try/finally pair as required. But
+            // this stream is unaware of the pending exception, so the Close()
+            // method invokes this method AGAIN.  This can lead to a deadlock.
+            // Therefore, failfast if re-entering.
+
+            if (emitting) return;
+            emitting = true;
+            if (doAll || mustWait)
+                _newlyCompressedBlob.WaitOne();
+
+            do
+            {
+                int firstSkip = -1;
+                int millisecondsToWait = doAll ? 200 : (mustWait ? -1 : 0);
+                int nextToWrite = -1;
+
+                do
+                {
+                    if (Monitor.TryEnter(_toWrite, millisecondsToWait))
+                    {
+                        nextToWrite = -1;
+                        try
+                        {
+                            if (_toWrite.Count > 0)
+                                nextToWrite = _toWrite.Dequeue();
+                        }
+                        finally
+                        {
+                            Monitor.Exit(_toWrite);
+                        }
+
+                        if (nextToWrite >= 0)
+                        {
+                            WorkItem workitem = _pool[nextToWrite];
+                            if (workitem.ordinal != _lastWritten + 1)
+                            {
+                                // out of order. requeue and try again.
+                                TraceOutput(TraceBits.EmitSkip,
+                                            "Emit     skip     wi({0}) ord({1}) lw({2}) fs({3})",
+                                            workitem.index,
+                                            workitem.ordinal,
+                                            _lastWritten,
+                                            firstSkip);
+
+                                lock(_toWrite)
+                                {
+                                    _toWrite.Enqueue(nextToWrite);
+                                }
+
+                                if (firstSkip == nextToWrite)
+                                {
+                                    // We went around the list once.
+                                    // None of the items in the list is the one we want.
+                                    // Now wait for a compressor to signal again.
+                                    _newlyCompressedBlob.WaitOne();
+                                    firstSkip = -1;
+                                }
+                                else if (firstSkip == -1)
+                                    firstSkip = nextToWrite;
+
+                                continue;
+                            }
+
+                            firstSkip = -1;
+
+                            TraceOutput(TraceBits.EmitBegin,
+                                        "Emit     begin    wi({0}) ord({1})              cba({2})",
+                                        workitem.index,
+                                        workitem.ordinal,
+                                        workitem.compressedBytesAvailable);
+
+                            _outStream.Write(workitem.compressed, 0, workitem.compressedBytesAvailable);
+                            _runningCrc.Combine(workitem.crc, workitem.inputBytesAvailable);
+                            _totalBytesProcessed += workitem.inputBytesAvailable;
+                            workitem.inputBytesAvailable = 0;
+
+                            TraceOutput(TraceBits.EmitDone,
+                                        "Emit     done     wi({0}) ord({1})              cba({2}) mtw({3})",
+                                        workitem.index,
+                                        workitem.ordinal,
+                                        workitem.compressedBytesAvailable,
+                                        millisecondsToWait);
+
+                            _lastWritten = workitem.ordinal;
+                            _toFill.Enqueue(workitem.index);
+
+                            // don't wait next time through
+                            if (millisecondsToWait == -1) millisecondsToWait = 0;
+                        }
+                    }
+                    else
+                        nextToWrite = -1;
+
+                } while (nextToWrite >= 0);
+
+            //} while (doAll && (_lastWritten != _latestCompressed));
+            } while (doAll && (_lastWritten != _latestCompressed || _lastWritten != _lastFilled));
+
+            emitting = false;
+        }
+
+
+
+#if OLD
+        private void _PerpetualWriterMethod(object state)
+        {
+            TraceOutput(TraceBits.WriterThread, "_PerpetualWriterMethod START");
+
+            try
+            {
+                do
+                {
+                    // wait for the next session
+                    TraceOutput(TraceBits.Synch | TraceBits.WriterThread, "Synch    _sessionReset.WaitOne(begin) PWM");
+                    _sessionReset.WaitOne();
+                    TraceOutput(TraceBits.Synch | TraceBits.WriterThread, "Synch    _sessionReset.WaitOne(done)  PWM");
+
+                    if (_isDisposed) break;
+
+                    TraceOutput(TraceBits.Synch | TraceBits.WriterThread, "Synch    _sessionReset.Reset()        PWM");
+                    _sessionReset.Reset();
+
+                    // repeatedly write buffers as they become ready
+                    WorkItem workitem = null;
+                    Ionic.Zlib.CRC32 c= new Ionic.Zlib.CRC32();
+                    do
+                    {
+                        workitem = _pool[_nextToWrite % _pc];
+                        lock(workitem)
+                        {
+                            if (_noMoreInputForThisSegment)
+                                TraceOutput(TraceBits.Write,
+                                               "Write    drain    wi({0}) stat({1}) canuse({2})  cba({3})",
+                                               workitem.index,
+                                               workitem.status,
+                                               (workitem.status == (int)WorkItem.Status.Compressed),
+                                               workitem.compressedBytesAvailable);
+
+                            do
+                            {
+                                if (workitem.status == (int)WorkItem.Status.Compressed)
+                                {
+                                    TraceOutput(TraceBits.WriteBegin,
+                                                   "Write    begin    wi({0}) stat({1})              cba({2})",
+                                                   workitem.index,
+                                                   workitem.status,
+                                                   workitem.compressedBytesAvailable);
+
+                                    workitem.status = (int)WorkItem.Status.Writing;
+                                    _outStream.Write(workitem.compressed, 0, workitem.compressedBytesAvailable);
+                                    c.Combine(workitem.crc, workitem.inputBytesAvailable);
+                                    _totalBytesProcessed += workitem.inputBytesAvailable;
+                                    _nextToWrite++;
+                                    workitem.inputBytesAvailable= 0;
+                                    workitem.status = (int)WorkItem.Status.Done;
+
+                                    TraceOutput(TraceBits.WriteDone,
+                                                   "Write    done     wi({0}) stat({1})              cba({2})",
+                                                   workitem.index,
+                                                   workitem.status,
+                                                   workitem.compressedBytesAvailable);
+
+
+                                    Monitor.Pulse(workitem);
+                                    break;
+                                }
+                                else
+                                {
+                                    int wcycles = 0;
+                                    // I've locked a workitem I cannot use.
+                                    // Therefore, wake someone else up, and then release the lock.
+                                    while (workitem.status != (int)WorkItem.Status.Compressed)
+                                    {
+                                        TraceOutput(TraceBits.WriteWait,
+                                                       "Write    waiting  wi({0}) stat({1}) nw({2}) nf({3}) nomore({4})",
+                                                       workitem.index,
+                                                       workitem.status,
+                                                       _nextToWrite, _nextToFill,
+                                                       _noMoreInputForThisSegment );
+
+                                        if (_noMoreInputForThisSegment && _nextToWrite == _nextToFill)
+                                            break;
+
+                                        wcycles++;
+
+                                        // wake up someone else
+                                        Monitor.Pulse(workitem);
+                                        // release and wait
+                                        Monitor.Wait(workitem);
+
+                                        if (workitem.status == (int)WorkItem.Status.Compressed)
+                                            TraceOutput(TraceBits.WriteWait,
+                                                           "Write    A-OK     wi({0}) stat({1}) iba({2}) cba({3}) cyc({4})",
+                                                           workitem.index,
+                                                           workitem.status,
+                                                           workitem.inputBytesAvailable,
+                                                           workitem.compressedBytesAvailable,
+                                                           wcycles);
+                                    }
+
+                                    if (_noMoreInputForThisSegment && _nextToWrite == _nextToFill)
+                                        break;
+
+                                }
+                            }
+                            while (true);
+                        }
+
+                        if (_noMoreInputForThisSegment)
+                            TraceOutput(TraceBits.Write,
+                                           "Write    nomore  nw({0}) nf({1}) break({2})",
+                                           _nextToWrite, _nextToFill, (_nextToWrite == _nextToFill));
+
+                        if (_noMoreInputForThisSegment && _nextToWrite == _nextToFill)
+                            break;
+
+                    } while (true);
+
+
+                    // Finish:
+                    // After writing a series of buffers, closing each one with
+                    // Flush.Sync, we now write the final one as Flush.Finish, and
+                    // then stop.
+                    byte[] buffer = new byte[128];
+                    ZlibCodec compressor = new ZlibCodec();
+                    int rc = compressor.InitializeDeflate(_compressLevel, false);
+                    compressor.InputBuffer = null;
+                    compressor.NextIn = 0;
+                    compressor.AvailableBytesIn = 0;
+                    compressor.OutputBuffer = buffer;
+                    compressor.NextOut = 0;
+                    compressor.AvailableBytesOut = buffer.Length;
+                    rc = compressor.Deflate(FlushType.Finish);
+
+                    if (rc != ZlibConstants.Z_STREAM_END && rc != ZlibConstants.Z_OK)
+                        throw new Exception("deflating: " + compressor.Message);
+
+                    if (buffer.Length - compressor.AvailableBytesOut > 0)
+                    {
+                        TraceOutput(TraceBits.WriteBegin,
+                                       "Write    begin    flush bytes({0})",
+                                       buffer.Length - compressor.AvailableBytesOut);
+
+                        _outStream.Write(buffer, 0, buffer.Length - compressor.AvailableBytesOut);
+
+                        TraceOutput(TraceBits.WriteBegin,
+                                       "Write    done     flush");
+                    }
+
+                    compressor.EndDeflate();
+
+                    _Crc32 = c.Crc32Result;
+
+                    // signal that writing is complete:
+                    TraceOutput(TraceBits.Synch, "Synch    _writingDone.Set()           PWM");
+                    _writingDone.Set();
+                }
+                while (true);
+            }
+            catch (System.Exception exc1)
+            {
+                lock(_eLock)
+                {
+                    // expose the exception to the main thread
+                    if (_pendingException!=null)
+                        _pendingException = exc1;
+                }
+            }
+
+            TraceOutput(TraceBits.WriterThread, "_PerpetualWriterMethod FINIS");
+        }
+#endif
+
+
+
+
+        private void _DeflateOne(Object wi)
+        {
+            // compress one buffer
+            WorkItem workitem = (WorkItem) wi;
+            try
+            {
+                int myItem = workitem.index;
+                Ionic.Crc.CRC32 crc = new Ionic.Crc.CRC32();
+
+                // calc CRC on the buffer
+                crc.SlurpBlock(workitem.buffer, 0, workitem.inputBytesAvailable);
+
+                // deflate it
+                DeflateOneSegment(workitem);
+
+                // update status
+                workitem.crc = crc.Crc32Result;
+                TraceOutput(TraceBits.Compress,
+                            "Compress          wi({0}) ord({1}) len({2})",
+                            workitem.index,
+                            workitem.ordinal,
+                            workitem.compressedBytesAvailable
+                            );
+
+                lock(_latestLock)
+                {
+                    if (workitem.ordinal > _latestCompressed)
+                        _latestCompressed = workitem.ordinal;
+                }
+                lock (_toWrite)
+                {
+                    _toWrite.Enqueue(workitem.index);
+                }
+                _newlyCompressedBlob.Set();
+            }
+            catch (System.Exception exc1)
+            {
+                lock(_eLock)
+                {
+                    // expose the exception to the main thread
+                    if (_pendingException!=null)
+                        _pendingException = exc1;
+                }
+            }
+        }
+
+
+
+
+        private bool DeflateOneSegment(WorkItem workitem)
+        {
+            ZlibCodec compressor = workitem.compressor;
+            int rc= 0;
+            compressor.ResetDeflate();
+            compressor.NextIn = 0;
+
+            compressor.AvailableBytesIn = workitem.inputBytesAvailable;
+
+            // step 1: deflate the buffer
+            compressor.NextOut = 0;
+            compressor.AvailableBytesOut =  workitem.compressed.Length;
+            do
+            {
+                compressor.Deflate(FlushType.None);
+            }
+            while (compressor.AvailableBytesIn > 0 || compressor.AvailableBytesOut == 0);
+
+            // step 2: flush (sync)
+            rc = compressor.Deflate(FlushType.Sync);
+
+            workitem.compressedBytesAvailable= (int) compressor.TotalBytesOut;
+            return true;
+        }
+
+
+        [System.Diagnostics.ConditionalAttribute("Trace")]
+        private void TraceOutput(TraceBits bits, string format, params object[] varParams)
+        {
+            if ((bits & _DesiredTrace) != 0)
+            {
+                lock(_outputLock)
+                {
+                    int tid = Thread.CurrentThread.GetHashCode();
+#if !SILVERLIGHT
+                    Console.ForegroundColor = (ConsoleColor) (tid % 8 + 8);
+#endif
+                    Console.Write("{0:000} PDOS ", tid);
+                    Console.WriteLine(format, varParams);
+#if !SILVERLIGHT
+                    Console.ResetColor();
+#endif
+                }
+            }
+        }
+
+
+        // used only when Trace is defined
+        [Flags]
+        enum TraceBits : uint
+        {
+            None         = 0,
+            NotUsed1     = 1,
+            EmitLock     = 2,
+            EmitEnter    = 4,    // enter _EmitPending
+            EmitBegin    = 8,    // begin to write out
+            EmitDone     = 16,   // done writing out
+            EmitSkip     = 32,   // writer skipping a workitem
+            EmitAll      = 58,   // All Emit flags
+            Flush        = 64,
+            Lifecycle    = 128,  // constructor/disposer
+            Session      = 256,  // Close/Reset
+            Synch        = 512,  // thread synchronization
+            Instance     = 1024, // instance settings
+            Compress     = 2048,  // compress task
+            Write        = 4096,    // filling buffers, when caller invokes Write()
+            WriteEnter   = 8192,    // upon entry to Write()
+            WriteTake    = 16384,    // on _toFill.Take()
+            All          = 0xffffffff,
+        }
+
+
+
+        /// <summary>
+        /// Indicates whether the stream supports Seek operations.
+        /// </summary>
+        /// <remarks>
+        /// Always returns false.
+        /// </remarks>
+        public override bool CanSeek
+        {
+            get { return false; }
+        }
+
+
+        /// <summary>
+        /// Indicates whether the stream supports Read operations.
+        /// </summary>
+        /// <remarks>
+        /// Always returns false.
+        /// </remarks>
+        public override bool CanRead
+        {
+            get {return false;}
+        }
+
+        /// <summary>
+        /// Indicates whether the stream supports Write operations.
+        /// </summary>
+        /// <remarks>
+        /// Returns true if the provided stream is writable.
+        /// </remarks>
+        public override bool CanWrite
+        {
+            get { return _outStream.CanWrite; }
+        }
+
+        /// <summary>
+        /// Reading this property always throws a NotSupportedException.
+        /// </summary>
+        public override long Length
+        {
+            get { throw new NotSupportedException(); }
+        }
+
+        /// <summary>
+        /// Returns the current position of the output stream.
+        /// </summary>
+        /// <remarks>
+        ///   <para>
+        ///     Because the output gets written by a background thread,
+        ///     the value may change asynchronously.  Setting this
+        ///     property always throws a NotSupportedException.
+        ///   </para>
+        /// </remarks>
+        public override long Position
+        {
+            get { return _outStream.Position; }
+            set { throw new NotSupportedException(); }
+        }
+
+        /// <summary>
+        /// This method always throws a NotSupportedException.
+        /// </summary>
+        /// <param name="buffer">
+        ///   The buffer into which data would be read, IF THIS METHOD
+        ///   ACTUALLY DID ANYTHING.
+        /// </param>
+        /// <param name="offset">
+        ///   The offset within that data array at which to insert the
+        ///   data that is read, IF THIS METHOD ACTUALLY DID
+        ///   ANYTHING.
+        /// </param>
+        /// <param name="count">
+        ///   The number of bytes to write, IF THIS METHOD ACTUALLY DID
+        ///   ANYTHING.
+        /// </param>
+        /// <returns>nothing.</returns>
+        public override int Read(byte[] buffer, int offset, int count)
+        {
+            throw new NotSupportedException();
+        }
+
+        /// <summary>
+        /// This method always throws a NotSupportedException.
+        /// </summary>
+        /// <param name="offset">
+        ///   The offset to seek to....
+        ///   IF THIS METHOD ACTUALLY DID ANYTHING.
+        /// </param>
+        /// <param name="origin">
+        ///   The reference specifying how to apply the offset....  IF
+        ///   THIS METHOD ACTUALLY DID ANYTHING.
+        /// </param>
+        /// <returns>nothing. It always throws.</returns>
+        public override long Seek(long offset, System.IO.SeekOrigin origin)
+        {
+            throw new NotSupportedException();
+        }
+
+        /// <summary>
+        /// This method always throws a NotSupportedException.
+        /// </summary>
+        /// <param name="value">
+        ///   The new value for the stream length....  IF
+        ///   THIS METHOD ACTUALLY DID ANYTHING.
+        /// </param>
+        public override void SetLength(long value)
+        {
+            throw new NotSupportedException();
+        }
+
+    }
+
+}
+
+
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/Zlib/Tree.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/Zlib/Tree.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/Zlib/Tree.cs	(revision 12707)
@@ -0,0 +1,423 @@
+// Tree.cs
+// ------------------------------------------------------------------
+//
+// Copyright (c) 2009 Dino Chiesa and Microsoft Corporation.  
+// All rights reserved.
+//
+// This code module is part of DotNetZip, a zipfile class library.
+//
+// ------------------------------------------------------------------
+//
+// This code is licensed under the Microsoft Public License. 
+// See the file License.txt for the license details.
+// More info on: http://dotnetzip.codeplex.com
+//
+// ------------------------------------------------------------------
+//
+// last saved (in emacs): 
+// Time-stamp: <2009-October-28 13:29:50>
+//
+// ------------------------------------------------------------------
+//
+// This module defines classes for zlib compression and
+// decompression. This code is derived from the jzlib implementation of
+// zlib. In keeping with the license for jzlib, the copyright to that
+// code is below.
+//
+// ------------------------------------------------------------------
+// 
+// Copyright (c) 2000,2001,2002,2003 ymnk, JCraft,Inc. All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright 
+// notice, this list of conditions and the following disclaimer in 
+// the documentation and/or other materials provided with the distribution.
+// 
+// 3. The names of the authors may not be used to endorse or promote products
+// derived from this software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
+// INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
+// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// 
+// -----------------------------------------------------------------------
+//
+// This program is based on zlib-1.1.3; credit to authors
+// Jean-loup Gailly(jloup@gzip.org) and Mark Adler(madler@alumni.caltech.edu)
+// and contributors of zlib.
+//
+// -----------------------------------------------------------------------
+
+
+using System;
+
+namespace OfficeOpenXml.Packaging.Ionic.Zlib
+{
+    sealed class Tree
+    {
+        private static readonly int HEAP_SIZE = (2 * InternalConstants.L_CODES + 1);
+                
+        // extra bits for each length code
+        internal static readonly int[] ExtraLengthBits = new int[]
+        {
+            0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2,
+            3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0
+        };
+                
+        // extra bits for each distance code
+        internal static readonly int[] ExtraDistanceBits = new int[]
+        {
+            0, 0, 0, 0, 1, 1,  2,  2,  3,  3,  4,  4,  5,  5,  6,  6,
+            7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13
+        };
+                
+        // extra bits for each bit length code
+        internal static readonly int[] extra_blbits = new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7};
+                
+        internal static readonly sbyte[] bl_order = new sbyte[]{16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
+                
+                
+        // The lengths of the bit length codes are sent in order of decreasing
+        // probability, to avoid transmitting the lengths for unused bit
+        // length codes.
+                
+        internal const int Buf_size = 8 * 2;
+                
+        // see definition of array dist_code below
+        //internal const int DIST_CODE_LEN = 512;
+                
+        private static readonly sbyte[] _dist_code = new sbyte[]
+        {
+            0,  1,  2,  3,  4,  4,  5,  5,  6,  6,  6,  6,  7,  7,  7,  7, 
+            8,  8,  8,  8,  8,  8,  8,  8,  9,  9,  9,  9,  9,  9,  9,  9,
+            10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 
+            11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 
+            12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 
+            12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 
+            13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 
+            13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 
+            14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 
+            14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 
+            14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 
+            14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 
+            15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 
+            15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 
+            15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 
+            15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 
+            0,   0, 16, 17, 18, 18, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 
+            22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, 
+            24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 
+            25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 
+            26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 
+            26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 
+            27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 
+            27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 
+            28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 
+            28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 
+            28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 
+            28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 
+            29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 
+            29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 
+            29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 
+            29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29
+        };
+                
+        internal static readonly sbyte[] LengthCode = new sbyte[]
+        {
+            0,   1,  2,  3,  4,  5,  6,  7,  8,  8,  9,  9, 10, 10, 11, 11,
+            12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15,
+            16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 17,
+            18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19,
+            20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+            21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
+            22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+            23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
+            24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
+            24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
+            25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
+            25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
+            26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
+            26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
+            27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
+            27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28
+        };
+                
+
+        internal static readonly int[] LengthBase = new int[]
+        {
+            0,   1,  2,  3,  4,  5,  6,   7,   8,  10,  12,  14, 16, 20, 24, 28,
+            32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 0
+        };
+                
+
+        internal static readonly int[] DistanceBase = new int[]
+        {
+            0, 1, 2, 3, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128, 192,
+            256, 384, 512, 768, 1024, 1536, 2048, 3072, 4096, 6144, 8192, 12288, 16384, 24576
+        };
+
+        
+        /// <summary>
+        /// Map from a distance to a distance code.
+        /// </summary>
+        /// <remarks> 
+        /// No side effects. _dist_code[256] and _dist_code[257] are never used.
+        /// </remarks>
+        internal static int DistanceCode(int dist)
+        {
+            return (dist < 256)
+                ? _dist_code[dist]
+                : _dist_code[256 + SharedUtils.URShift(dist, 7)];
+        }
+
+        internal short[] dyn_tree; // the dynamic tree
+        internal int max_code; // largest code with non zero frequency
+        internal StaticTree staticTree; // the corresponding static tree
+                
+        // Compute the optimal bit lengths for a tree and update the total bit length
+        // for the current block.
+        // IN assertion: the fields freq and dad are set, heap[heap_max] and
+        //    above are the tree nodes sorted by increasing frequency.
+        // OUT assertions: the field len is set to the optimal bit length, the
+        //     array bl_count contains the frequencies for each bit length.
+        //     The length opt_len is updated; static_len is also updated if stree is
+        //     not null.
+        internal void  gen_bitlen(DeflateManager s)
+        {
+            short[] tree = dyn_tree;
+            short[] stree = staticTree.treeCodes;
+            int[] extra = staticTree.extraBits;
+            int base_Renamed = staticTree.extraBase;
+            int max_length = staticTree.maxLength;
+            int h; // heap index
+            int n, m; // iterate over the tree elements
+            int bits; // bit length
+            int xbits; // extra bits
+            short f; // frequency
+            int overflow = 0; // number of elements with bit length too large
+                        
+            for (bits = 0; bits <= InternalConstants.MAX_BITS; bits++)
+                s.bl_count[bits] = 0;
+                        
+            // In a first pass, compute the optimal bit lengths (which may
+            // overflow in the case of the bit length tree).
+            tree[s.heap[s.heap_max] * 2 + 1] = 0; // root of the heap
+                        
+            for (h = s.heap_max + 1; h < HEAP_SIZE; h++)
+            {
+                n = s.heap[h];
+                bits = tree[tree[n * 2 + 1] * 2 + 1] + 1;
+                if (bits > max_length)
+                {
+                    bits = max_length; overflow++;
+                }
+                tree[n * 2 + 1] = (short) bits;
+                // We overwrite tree[n*2+1] which is no longer needed
+                                
+                if (n > max_code)
+                    continue; // not a leaf node
+                                
+                s.bl_count[bits]++;
+                xbits = 0;
+                if (n >= base_Renamed)
+                    xbits = extra[n - base_Renamed];
+                f = tree[n * 2];
+                s.opt_len += f * (bits + xbits);
+                if (stree != null)
+                    s.static_len += f * (stree[n * 2 + 1] + xbits);
+            }
+            if (overflow == 0)
+                return ;
+                        
+            // This happens for example on obj2 and pic of the Calgary corpus
+            // Find the first bit length which could increase:
+            do 
+            {
+                bits = max_length - 1;
+                while (s.bl_count[bits] == 0)
+                    bits--;
+                s.bl_count[bits]--; // move one leaf down the tree
+                s.bl_count[bits + 1] = (short) (s.bl_count[bits + 1] + 2); // move one overflow item as its brother
+                s.bl_count[max_length]--;
+                // The brother of the overflow item also moves one step up,
+                // but this does not affect bl_count[max_length]
+                overflow -= 2;
+            }
+            while (overflow > 0);
+                        
+            for (bits = max_length; bits != 0; bits--)
+            {
+                n = s.bl_count[bits];
+                while (n != 0)
+                {
+                    m = s.heap[--h];
+                    if (m > max_code)
+                        continue;
+                    if (tree[m * 2 + 1] != bits)
+                    {
+                        s.opt_len = (int) (s.opt_len + ((long) bits - (long) tree[m * 2 + 1]) * (long) tree[m * 2]);
+                        tree[m * 2 + 1] = (short) bits;
+                    }
+                    n--;
+                }
+            }
+        }
+                
+        // Construct one Huffman tree and assigns the code bit strings and lengths.
+        // Update the total bit length for the current block.
+        // IN assertion: the field freq is set for all tree elements.
+        // OUT assertions: the fields len and code are set to the optimal bit length
+        //     and corresponding code. The length opt_len is updated; static_len is
+        //     also updated if stree is not null. The field max_code is set.
+        internal void  build_tree(DeflateManager s)
+        {
+            short[] tree  = dyn_tree;
+            short[] stree = staticTree.treeCodes;
+            int elems     = staticTree.elems;
+            int n, m;            // iterate over heap elements
+            int max_code  = -1;  // largest code with non zero frequency
+            int node;            // new node being created
+                        
+            // Construct the initial heap, with least frequent element in
+            // heap[1]. The sons of heap[n] are heap[2*n] and heap[2*n+1].
+            // heap[0] is not used.
+            s.heap_len = 0;
+            s.heap_max = HEAP_SIZE;
+                        
+            for (n = 0; n < elems; n++)
+            {
+                if (tree[n * 2] != 0)
+                {
+                    s.heap[++s.heap_len] = max_code = n;
+                    s.depth[n] = 0;
+                }
+                else
+                {
+                    tree[n * 2 + 1] = 0;
+                }
+            }
+                        
+            // The pkzip format requires that at least one distance code exists,
+            // and that at least one bit should be sent even if there is only one
+            // possible code. So to avoid special checks later on we force at least
+            // two codes of non zero frequency.
+            while (s.heap_len < 2)
+            {
+                node = s.heap[++s.heap_len] = (max_code < 2?++max_code:0);
+                tree[node * 2] = 1;
+                s.depth[node] = 0;
+                s.opt_len--;
+                if (stree != null)
+                    s.static_len -= stree[node * 2 + 1];
+                // node is 0 or 1 so it does not have extra bits
+            }
+            this.max_code = max_code;
+                        
+            // The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree,
+            // establish sub-heaps of increasing lengths:
+                        
+            for (n = s.heap_len / 2; n >= 1; n--)
+                s.pqdownheap(tree, n);
+                        
+            // Construct the Huffman tree by repeatedly combining the least two
+            // frequent nodes.
+                        
+            node = elems; // next internal node of the tree
+            do 
+            {
+                // n = node of least frequency
+                n = s.heap[1];
+                s.heap[1] = s.heap[s.heap_len--];
+                s.pqdownheap(tree, 1);
+                m = s.heap[1]; // m = node of next least frequency
+                                
+                s.heap[--s.heap_max] = n; // keep the nodes sorted by frequency
+                s.heap[--s.heap_max] = m;
+                                
+                // Create a new node father of n and m
+                tree[node * 2] = unchecked((short) (tree[n * 2] + tree[m * 2]));
+                s.depth[node] = (sbyte) (System.Math.Max((byte) s.depth[n], (byte) s.depth[m]) + 1);
+                tree[n * 2 + 1] = tree[m * 2 + 1] = (short) node;
+                                
+                // and insert the new node in the heap
+                s.heap[1] = node++;
+                s.pqdownheap(tree, 1);
+            }
+            while (s.heap_len >= 2);
+                        
+            s.heap[--s.heap_max] = s.heap[1];
+                        
+            // At this point, the fields freq and dad are set. We can now
+            // generate the bit lengths.
+                        
+            gen_bitlen(s);
+                        
+            // The field len is now set, we can generate the bit codes
+            gen_codes(tree, max_code, s.bl_count);
+        }
+                
+        // Generate the codes for a given tree and bit counts (which need not be
+        // optimal).
+        // IN assertion: the array bl_count contains the bit length statistics for
+        // the given tree and the field len is set for all tree elements.
+        // OUT assertion: the field code is set for all tree elements of non
+        //     zero code length.
+        internal static void  gen_codes(short[] tree, int max_code, short[] bl_count)
+        {
+            short[] next_code = new short[InternalConstants.MAX_BITS + 1]; // next code value for each bit length
+            short code = 0; // running code value
+            int bits; // bit index
+            int n; // code index
+                        
+            // The distribution counts are first used to generate the code values
+            // without bit reversal.
+            for (bits = 1; bits <= InternalConstants.MAX_BITS; bits++)
+                unchecked {
+                    next_code[bits] = code = (short) ((code + bl_count[bits - 1]) << 1);
+                }
+                        
+            // Check that the bit counts in bl_count are consistent. The last code
+            // must be all ones.
+            //Assert (code + bl_count[MAX_BITS]-1 == (1<<MAX_BITS)-1,
+            //        "inconsistent bit counts");
+            //Tracev((stderr,"\ngen_codes: max_code %d ", max_code));
+                        
+            for (n = 0; n <= max_code; n++)
+            {
+                int len = tree[n * 2 + 1];
+                if (len == 0)
+                    continue;
+                // Now reverse the bits
+                tree[n * 2] =  unchecked((short) (bi_reverse(next_code[len]++, len)));
+            }
+        }
+                
+        // Reverse the first len bits of a code, using straightforward code (a faster
+        // method would use a table)
+        // IN assertion: 1 <= len <= 15
+        internal static int bi_reverse(int code, int len)
+        {
+            int res = 0;
+            do 
+            {
+                res |= code & 1;
+                code >>= 1; //SharedUtils.URShift(code, 1);
+                res <<= 1;
+            }
+            while (--len > 0);
+            return res >> 1;
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/Zlib/Zlib.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/Zlib/Zlib.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/Zlib/Zlib.cs	(revision 12707)
@@ -0,0 +1,546 @@
+// Zlib.cs
+// ------------------------------------------------------------------
+//
+// Copyright (c) 2009-2011 Dino Chiesa and Microsoft Corporation.
+// All rights reserved.
+//
+// This code module is part of DotNetZip, a zipfile class library.
+//
+// ------------------------------------------------------------------
+//
+// This code is licensed under the Microsoft Public License.
+// See the file License.txt for the license details.
+// More info on: http://dotnetzip.codeplex.com
+//
+// ------------------------------------------------------------------
+//
+// Last Saved: <2011-August-03 19:52:28>
+//
+// ------------------------------------------------------------------
+//
+// This module defines classes for ZLIB compression and
+// decompression. This code is derived from the jzlib implementation of
+// zlib, but significantly modified.  The object model is not the same,
+// and many of the behaviors are new or different.  Nonetheless, in
+// keeping with the license for jzlib, the copyright to that code is
+// included below.
+//
+// ------------------------------------------------------------------
+//
+// The following notice applies to jzlib:
+//
+// Copyright (c) 2000,2001,2002,2003 ymnk, JCraft,Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in
+// the documentation and/or other materials provided with the distribution.
+//
+// 3. The names of the authors may not be used to endorse or promote products
+// derived from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
+// INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
+// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// -----------------------------------------------------------------------
+//
+// jzlib is based on zlib-1.1.3.
+//
+// The following notice applies to zlib:
+//
+// -----------------------------------------------------------------------
+//
+// Copyright (C) 1995-2004 Jean-loup Gailly and Mark Adler
+//
+//   The ZLIB software is provided 'as-is', without any express or implied
+//   warranty.  In no event will the authors be held liable for any damages
+//   arising from the use of this software.
+//
+//   Permission is granted to anyone to use this software for any purpose,
+//   including commercial applications, and to alter it and redistribute it
+//   freely, subject to the following restrictions:
+//
+//   1. The origin of this software must not be misrepresented; you must not
+//      claim that you wrote the original software. If you use this software
+//      in a product, an acknowledgment in the product documentation would be
+//      appreciated but is not required.
+//   2. Altered source versions must be plainly marked as such, and must not be
+//      misrepresented as being the original software.
+//   3. This notice may not be removed or altered from any source distribution.
+//
+//   Jean-loup Gailly jloup@gzip.org
+//   Mark Adler madler@alumni.caltech.edu
+//
+// -----------------------------------------------------------------------
+
+
+
+using System;
+using Interop=System.Runtime.InteropServices;
+
+namespace OfficeOpenXml.Packaging.Ionic.Zlib
+{
+
+    /// <summary>
+    /// Describes how to flush the current deflate operation.
+    /// </summary>
+    /// <remarks>
+    /// The different FlushType values are useful when using a Deflate in a streaming application.
+    /// </remarks>
+    public enum FlushType
+    {
+        /// <summary>No flush at all.</summary>
+        None = 0,
+
+        /// <summary>Closes the current block, but doesn't flush it to
+        /// the output. Used internally only in hypothetical
+        /// scenarios.  This was supposed to be removed by Zlib, but it is
+        /// still in use in some edge cases.
+        /// </summary>
+        Partial,
+
+        /// <summary>
+        /// Use this during compression to specify that all pending output should be
+        /// flushed to the output buffer and the output should be aligned on a byte
+        /// boundary.  You might use this in a streaming communication scenario, so that
+        /// the decompressor can get all input data available so far.  When using this
+        /// with a ZlibCodec, <c>AvailableBytesIn</c> will be zero after the call if
+        /// enough output space has been provided before the call.  Flushing will
+        /// degrade compression and so it should be used only when necessary.
+        /// </summary>
+        Sync,
+
+        /// <summary>
+        /// Use this during compression to specify that all output should be flushed, as
+        /// with <c>FlushType.Sync</c>, but also, the compression state should be reset
+        /// so that decompression can restart from this point if previous compressed
+        /// data has been damaged or if random access is desired.  Using
+        /// <c>FlushType.Full</c> too often can significantly degrade the compression.
+        /// </summary>
+        Full,
+
+        /// <summary>Signals the end of the compression/decompression stream.</summary>
+        Finish,
+    }
+
+
+    /// <summary>
+    /// The compression level to be used when using a DeflateStream or ZlibStream with CompressionMode.Compress.
+    /// </summary>
+    public enum CompressionLevel
+    {
+        /// <summary>
+        /// None means that the data will be simply stored, with no change at all.
+        /// If you are producing ZIPs for use on Mac OSX, be aware that archives produced with CompressionLevel.None
+        /// cannot be opened with the default zip reader. Use a different CompressionLevel.
+        /// </summary>
+        None= 0,
+        /// <summary>
+        /// Same as None.
+        /// </summary>
+        Level0 = 0,
+
+        /// <summary>
+        /// The fastest but least effective compression.
+        /// </summary>
+        BestSpeed = 1,
+
+        /// <summary>
+        /// A synonym for BestSpeed.
+        /// </summary>
+        Level1 = 1,
+
+        /// <summary>
+        /// A little slower, but better, than level 1.
+        /// </summary>
+        Level2 = 2,
+
+        /// <summary>
+        /// A little slower, but better, than level 2.
+        /// </summary>
+        Level3 = 3,
+
+        /// <summary>
+        /// A little slower, but better, than level 3.
+        /// </summary>
+        Level4 = 4,
+
+        /// <summary>
+        /// A little slower than level 4, but with better compression.
+        /// </summary>
+        Level5 = 5,
+
+        /// <summary>
+        /// The default compression level, with a good balance of speed and compression efficiency.
+        /// </summary>
+        Default = 6,
+        /// <summary>
+        /// A synonym for Default.
+        /// </summary>
+        Level6 = 6,
+
+        /// <summary>
+        /// Pretty good compression!
+        /// </summary>
+        Level7 = 7,
+
+        /// <summary>
+        ///  Better compression than Level7!
+        /// </summary>
+        Level8 = 8,
+
+        /// <summary>
+        /// The "best" compression, where best means greatest reduction in size of the input data stream.
+        /// This is also the slowest compression.
+        /// </summary>
+        BestCompression = 9,
+
+        /// <summary>
+        /// A synonym for BestCompression.
+        /// </summary>
+        Level9 = 9,
+    }
+
+    /// <summary>
+    /// Describes options for how the compression algorithm is executed.  Different strategies
+    /// work better on different sorts of data.  The strategy parameter can affect the compression
+    /// ratio and the speed of compression but not the correctness of the compresssion.
+    /// </summary>
+    public enum CompressionStrategy
+    {
+        /// <summary>
+        /// The default strategy is probably the best for normal data.
+        /// </summary>
+        Default = 0,
+
+        /// <summary>
+        /// The <c>Filtered</c> strategy is intended to be used most effectively with data produced by a
+        /// filter or predictor.  By this definition, filtered data consists mostly of small
+        /// values with a somewhat random distribution.  In this case, the compression algorithm
+        /// is tuned to compress them better.  The effect of <c>Filtered</c> is to force more Huffman
+        /// coding and less string matching; it is a half-step between <c>Default</c> and <c>HuffmanOnly</c>.
+        /// </summary>
+        Filtered = 1,
+
+        /// <summary>
+        /// Using <c>HuffmanOnly</c> will force the compressor to do Huffman encoding only, with no
+        /// string matching.
+        /// </summary>
+        HuffmanOnly = 2,
+    }
+
+
+    /// <summary>
+    /// An enum to specify the direction of transcoding - whether to compress or decompress.
+    /// </summary>
+    public enum CompressionMode
+    {
+        /// <summary>
+        /// Used to specify that the stream should compress the data.
+        /// </summary>
+        Compress= 0,
+        /// <summary>
+        /// Used to specify that the stream should decompress the data.
+        /// </summary>
+        Decompress = 1,
+    }
+
+
+    /// <summary>
+    /// A general purpose exception class for exceptions in the Zlib library.
+    /// </summary>
+    [Interop.GuidAttribute("ebc25cf6-9120-4283-b972-0e5520d0000E")]
+    public class ZlibException : System.Exception
+    {
+        /// <summary>
+        /// The ZlibException class captures exception information generated
+        /// by the Zlib library.
+        /// </summary>
+        public ZlibException()
+            : base()
+        {
+        }
+
+        /// <summary>
+        /// This ctor collects a message attached to the exception.
+        /// </summary>
+        /// <param name="s">the message for the exception.</param>
+        public ZlibException(System.String s)
+            : base(s)
+        {
+        }
+    }
+
+
+    internal class SharedUtils
+    {
+        /// <summary>
+        /// Performs an unsigned bitwise right shift with the specified number
+        /// </summary>
+        /// <param name="number">Number to operate on</param>
+        /// <param name="bits">Ammount of bits to shift</param>
+        /// <returns>The resulting number from the shift operation</returns>
+        public static int URShift(int number, int bits)
+        {
+            return (int)((uint)number >> bits);
+        }
+
+#if NOT
+        /// <summary>
+        /// Performs an unsigned bitwise right shift with the specified number
+        /// </summary>
+        /// <param name="number">Number to operate on</param>
+        /// <param name="bits">Ammount of bits to shift</param>
+        /// <returns>The resulting number from the shift operation</returns>
+        public static long URShift(long number, int bits)
+        {
+            return (long) ((UInt64)number >> bits);
+        }
+#endif
+
+        /// <summary>
+        ///   Reads a number of characters from the current source TextReader and writes
+        ///   the data to the target array at the specified index.
+        /// </summary>
+        ///
+        /// <param name="sourceTextReader">The source TextReader to read from</param>
+        /// <param name="target">Contains the array of characteres read from the source TextReader.</param>
+        /// <param name="start">The starting index of the target array.</param>
+        /// <param name="count">The maximum number of characters to read from the source TextReader.</param>
+        ///
+        /// <returns>
+        ///   The number of characters read. The number will be less than or equal to
+        ///   count depending on the data available in the source TextReader. Returns -1
+        ///   if the end of the stream is reached.
+        /// </returns>
+        public static System.Int32 ReadInput(System.IO.TextReader sourceTextReader, byte[] target, int start, int count)
+        {
+            // Returns 0 bytes if not enough space in target
+            if (target.Length == 0) return 0;
+
+            char[] charArray = new char[target.Length];
+            int bytesRead = sourceTextReader.Read(charArray, start, count);
+
+            // Returns -1 if EOF
+            if (bytesRead == 0) return -1;
+
+            for (int index = start; index < start + bytesRead; index++)
+                target[index] = (byte)charArray[index];
+
+            return bytesRead;
+        }
+
+
+        internal static byte[] ToByteArray(System.String sourceString)
+        {
+            return System.Text.UTF8Encoding.UTF8.GetBytes(sourceString);
+        }
+
+
+        internal static char[] ToCharArray(byte[] byteArray)
+        {
+            return System.Text.UTF8Encoding.UTF8.GetChars(byteArray);
+        }
+    }
+
+    internal static class InternalConstants
+    {
+        internal static readonly int MAX_BITS     = 15;
+        internal static readonly int BL_CODES     = 19;
+        internal static readonly int D_CODES      = 30;
+        internal static readonly int LITERALS     = 256;
+        internal static readonly int LENGTH_CODES = 29;
+        internal static readonly int L_CODES      = (LITERALS + 1 + LENGTH_CODES);
+
+        // Bit length codes must not exceed MAX_BL_BITS bits
+        internal static readonly int MAX_BL_BITS  = 7;
+
+        // repeat previous bit length 3-6 times (2 bits of repeat count)
+        internal static readonly int REP_3_6      = 16;
+
+        // repeat a zero length 3-10 times  (3 bits of repeat count)
+        internal static readonly int REPZ_3_10    = 17;
+
+        // repeat a zero length 11-138 times  (7 bits of repeat count)
+        internal static readonly int REPZ_11_138  = 18;
+
+    }
+
+    internal sealed class StaticTree
+    {
+        internal static readonly short[] lengthAndLiteralsTreeCodes = new short[] {
+            12, 8, 140, 8, 76, 8, 204, 8, 44, 8, 172, 8, 108, 8, 236, 8,
+            28, 8, 156, 8, 92, 8, 220, 8, 60, 8, 188, 8, 124, 8, 252, 8,
+             2, 8, 130, 8, 66, 8, 194, 8, 34, 8, 162, 8, 98, 8, 226, 8,
+            18, 8, 146, 8, 82, 8, 210, 8, 50, 8, 178, 8, 114, 8, 242, 8,
+            10, 8, 138, 8, 74, 8, 202, 8, 42, 8, 170, 8, 106, 8, 234, 8,
+            26, 8, 154, 8, 90, 8, 218, 8, 58, 8, 186, 8, 122, 8, 250, 8,
+             6, 8, 134, 8, 70, 8, 198, 8, 38, 8, 166, 8, 102, 8, 230, 8,
+            22, 8, 150, 8, 86, 8, 214, 8, 54, 8, 182, 8, 118, 8, 246, 8,
+            14, 8, 142, 8, 78, 8, 206, 8, 46, 8, 174, 8, 110, 8, 238, 8,
+            30, 8, 158, 8, 94, 8, 222, 8, 62, 8, 190, 8, 126, 8, 254, 8,
+             1, 8, 129, 8, 65, 8, 193, 8, 33, 8, 161, 8, 97, 8, 225, 8,
+            17, 8, 145, 8, 81, 8, 209, 8, 49, 8, 177, 8, 113, 8, 241, 8,
+             9, 8, 137, 8, 73, 8, 201, 8, 41, 8, 169, 8, 105, 8, 233, 8,
+            25, 8, 153, 8, 89, 8, 217, 8, 57, 8, 185, 8, 121, 8, 249, 8,
+             5, 8, 133, 8, 69, 8, 197, 8, 37, 8, 165, 8, 101, 8, 229, 8,
+            21, 8, 149, 8, 85, 8, 213, 8, 53, 8, 181, 8, 117, 8, 245, 8,
+            13, 8, 141, 8, 77, 8, 205, 8, 45, 8, 173, 8, 109, 8, 237, 8,
+            29, 8, 157, 8, 93, 8, 221, 8, 61, 8, 189, 8, 125, 8, 253, 8,
+            19, 9, 275, 9, 147, 9, 403, 9, 83, 9, 339, 9, 211, 9, 467, 9,
+            51, 9, 307, 9, 179, 9, 435, 9, 115, 9, 371, 9, 243, 9, 499, 9,
+            11, 9, 267, 9, 139, 9, 395, 9, 75, 9, 331, 9, 203, 9, 459, 9,
+            43, 9, 299, 9, 171, 9, 427, 9, 107, 9, 363, 9, 235, 9, 491, 9,
+            27, 9, 283, 9, 155, 9, 411, 9, 91, 9, 347, 9, 219, 9, 475, 9,
+            59, 9, 315, 9, 187, 9, 443, 9, 123, 9, 379, 9, 251, 9, 507, 9,
+             7, 9, 263, 9, 135, 9, 391, 9, 71, 9, 327, 9, 199, 9, 455, 9,
+            39, 9, 295, 9, 167, 9, 423, 9, 103, 9, 359, 9, 231, 9, 487, 9,
+            23, 9, 279, 9, 151, 9, 407, 9, 87, 9, 343, 9, 215, 9, 471, 9,
+            55, 9, 311, 9, 183, 9, 439, 9, 119, 9, 375, 9, 247, 9, 503, 9,
+            15, 9, 271, 9, 143, 9, 399, 9, 79, 9, 335, 9, 207, 9, 463, 9,
+            47, 9, 303, 9, 175, 9, 431, 9, 111, 9, 367, 9, 239, 9, 495, 9,
+            31, 9, 287, 9, 159, 9, 415, 9, 95, 9, 351, 9, 223, 9, 479, 9,
+            63, 9, 319, 9, 191, 9, 447, 9, 127, 9, 383, 9, 255, 9, 511, 9,
+             0, 7, 64, 7, 32, 7, 96, 7, 16, 7, 80, 7, 48, 7, 112, 7,
+             8, 7, 72, 7, 40, 7, 104, 7, 24, 7, 88, 7, 56, 7, 120, 7,
+             4, 7, 68, 7, 36, 7, 100, 7, 20, 7, 84, 7, 52, 7, 116, 7,
+             3, 8, 131, 8, 67, 8, 195, 8, 35, 8, 163, 8, 99, 8, 227, 8
+        };
+
+        internal static readonly short[] distTreeCodes = new short[] {
+            0, 5, 16, 5, 8, 5, 24, 5, 4, 5, 20, 5, 12, 5, 28, 5,
+            2, 5, 18, 5, 10, 5, 26, 5, 6, 5, 22, 5, 14, 5, 30, 5,
+            1, 5, 17, 5, 9, 5, 25, 5, 5, 5, 21, 5, 13, 5, 29, 5,
+            3, 5, 19, 5, 11, 5, 27, 5, 7, 5, 23, 5 };
+
+        internal static readonly StaticTree Literals;
+        internal static readonly StaticTree Distances;
+        internal static readonly StaticTree BitLengths;
+
+        internal short[] treeCodes; // static tree or null
+        internal int[] extraBits;   // extra bits for each code or null
+        internal int extraBase;     // base index for extra_bits
+        internal int elems;         // max number of elements in the tree
+        internal int maxLength;     // max bit length for the codes
+
+        private StaticTree(short[] treeCodes, int[] extraBits, int extraBase, int elems, int maxLength)
+        {
+            this.treeCodes = treeCodes;
+            this.extraBits = extraBits;
+            this.extraBase = extraBase;
+            this.elems = elems;
+            this.maxLength = maxLength;
+        }
+        static StaticTree()
+        {
+            Literals = new StaticTree(lengthAndLiteralsTreeCodes, Tree.ExtraLengthBits, InternalConstants.LITERALS + 1, InternalConstants.L_CODES, InternalConstants.MAX_BITS);
+            Distances = new StaticTree(distTreeCodes, Tree.ExtraDistanceBits, 0, InternalConstants.D_CODES, InternalConstants.MAX_BITS);
+            BitLengths = new StaticTree(null, Tree.extra_blbits, 0, InternalConstants.BL_CODES, InternalConstants.MAX_BL_BITS);
+        }
+    }
+
+
+
+    /// <summary>
+    /// Computes an Adler-32 checksum.
+    /// </summary>
+    /// <remarks>
+    /// The Adler checksum is similar to a CRC checksum, but faster to compute, though less
+    /// reliable.  It is used in producing RFC1950 compressed streams.  The Adler checksum
+    /// is a required part of the "ZLIB" standard.  Applications will almost never need to
+    /// use this class directly.
+    /// </remarks>
+    ///
+    /// <exclude/>
+    public sealed class Adler
+    {
+        // largest prime smaller than 65536
+        private static readonly uint BASE = 65521;
+        // NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1
+        private static readonly int NMAX = 5552;
+
+
+#pragma warning disable 3001
+#pragma warning disable 3002
+
+        /// <summary>
+        ///   Calculates the Adler32 checksum.
+        /// </summary>
+        /// <remarks>
+        ///   <para>
+        ///     This is used within ZLIB.  You probably don't need to use this directly.
+        ///   </para>
+        /// </remarks>
+        /// <example>
+        ///    To compute an Adler32 checksum on a byte array:
+        ///  <code>
+        ///    var adler = Adler.Adler32(0, null, 0, 0);
+        ///    adler = Adler.Adler32(adler, buffer, index, length);
+        ///  </code>
+        /// </example>
+        public static uint Adler32(uint adler, byte[] buf, int index, int len)
+        {
+            if (buf == null)
+                return 1;
+
+            uint s1 = (uint) (adler & 0xffff);
+            uint s2 = (uint) ((adler >> 16) & 0xffff);
+
+            while (len > 0)
+            {
+                int k = len < NMAX ? len : NMAX;
+                len -= k;
+                while (k >= 16)
+                {
+                    //s1 += (buf[index++] & 0xff); s2 += s1;
+                    s1 += buf[index++]; s2 += s1;
+                    s1 += buf[index++]; s2 += s1;
+                    s1 += buf[index++]; s2 += s1;
+                    s1 += buf[index++]; s2 += s1;
+                    s1 += buf[index++]; s2 += s1;
+                    s1 += buf[index++]; s2 += s1;
+                    s1 += buf[index++]; s2 += s1;
+                    s1 += buf[index++]; s2 += s1;
+                    s1 += buf[index++]; s2 += s1;
+                    s1 += buf[index++]; s2 += s1;
+                    s1 += buf[index++]; s2 += s1;
+                    s1 += buf[index++]; s2 += s1;
+                    s1 += buf[index++]; s2 += s1;
+                    s1 += buf[index++]; s2 += s1;
+                    s1 += buf[index++]; s2 += s1;
+                    s1 += buf[index++]; s2 += s1;
+                    k -= 16;
+                }
+                if (k != 0)
+                {
+                    do
+                    {
+                        s1 += buf[index++];
+                        s2 += s1;
+                    }
+                    while (--k != 0);
+                }
+                s1 %= BASE;
+                s2 %= BASE;
+            }
+            return (uint)((s2 << 16) | s1);
+        }
+#pragma warning restore 3001
+#pragma warning restore 3002
+
+    }
+
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/Zlib/ZlibBaseStream.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/Zlib/ZlibBaseStream.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/Zlib/ZlibBaseStream.cs	(revision 12707)
@@ -0,0 +1,628 @@
+// ZlibBaseStream.cs
+// ------------------------------------------------------------------
+//
+// Copyright (c) 2009 Dino Chiesa and Microsoft Corporation.
+// All rights reserved.
+//
+// This code module is part of DotNetZip, a zipfile class library.
+//
+// ------------------------------------------------------------------
+//
+// This code is licensed under the Microsoft Public License.
+// See the file License.txt for the license details.
+// More info on: http://dotnetzip.codeplex.com
+//
+// ------------------------------------------------------------------
+//
+// last saved (in emacs):
+// Time-stamp: <2011-August-06 21:22:38>
+//
+// ------------------------------------------------------------------
+//
+// This module defines the ZlibBaseStream class, which is an intnernal
+// base class for DeflateStream, ZlibStream and GZipStream.
+//
+// ------------------------------------------------------------------
+
+using OfficeOpenXml.Packaging.Ionic.Crc;
+using System;
+using System.IO;
+
+namespace OfficeOpenXml.Packaging.Ionic.Zlib
+{
+
+    internal enum ZlibStreamFlavor { ZLIB = 1950, DEFLATE = 1951, GZIP = 1952 }
+
+    internal class ZlibBaseStream : System.IO.Stream
+    {
+        protected internal ZlibCodec _z = null; // deferred init... new ZlibCodec();
+
+        protected internal StreamMode _streamMode = StreamMode.Undefined;
+        protected internal FlushType _flushMode;
+        protected internal ZlibStreamFlavor _flavor;
+        protected internal CompressionMode _compressionMode;
+        protected internal CompressionLevel _level;
+        protected internal bool _leaveOpen;
+        protected internal byte[] _workingBuffer;
+        protected internal int _bufferSize = ZlibConstants.WorkingBufferSizeDefault;
+        protected internal byte[] _buf1 = new byte[1];
+
+        protected internal System.IO.Stream _stream;
+        protected internal CompressionStrategy Strategy = CompressionStrategy.Default;
+
+        // workitem 7159
+        CRC32 crc;
+        protected internal string _GzipFileName;
+        protected internal string _GzipComment;
+        protected internal DateTime _GzipMtime;
+        protected internal int _gzipHeaderByteCount;
+
+        internal int Crc32 { get { if (crc == null) return 0; return crc.Crc32Result; } }
+
+        public ZlibBaseStream(System.IO.Stream stream,
+                              CompressionMode compressionMode,
+                              CompressionLevel level,
+                              ZlibStreamFlavor flavor,
+                              bool leaveOpen)
+            : base()
+        {
+            this._flushMode = FlushType.None;
+            //this._workingBuffer = new byte[WORKING_BUFFER_SIZE_DEFAULT];
+            this._stream = stream;
+            this._leaveOpen = leaveOpen;
+            this._compressionMode = compressionMode;
+            this._flavor = flavor;
+            this._level = level;
+            // workitem 7159
+            if (flavor == ZlibStreamFlavor.GZIP)
+            {
+                this.crc = new Ionic.Crc.CRC32();
+            }
+        }
+
+
+        protected internal bool _wantCompress
+        {
+            get
+            {
+                return (this._compressionMode == CompressionMode.Compress);
+            }
+        }
+
+        private ZlibCodec z
+        {
+            get
+            {
+                if (_z == null)
+                {
+                    bool wantRfc1950Header = (this._flavor == ZlibStreamFlavor.ZLIB);
+                    _z = new ZlibCodec();
+                    if (this._compressionMode == CompressionMode.Decompress)
+                    {
+                        _z.InitializeInflate(wantRfc1950Header);
+                    }
+                    else
+                    {
+                        _z.Strategy = Strategy;
+                        _z.InitializeDeflate(this._level, wantRfc1950Header);
+                    }
+                }
+                return _z;
+            }
+        }
+
+
+
+        private byte[] workingBuffer
+        {
+            get
+            {
+                if (_workingBuffer == null)
+                    _workingBuffer = new byte[_bufferSize];
+                return _workingBuffer;
+            }
+        }
+
+
+
+        public override void Write(System.Byte[] buffer, int offset, int count)
+        {
+            // workitem 7159
+            // calculate the CRC on the unccompressed data  (before writing)
+            if (crc != null)
+                crc.SlurpBlock(buffer, offset, count);
+
+            if (_streamMode == StreamMode.Undefined)
+                _streamMode = StreamMode.Writer;
+            else if (_streamMode != StreamMode.Writer)
+                throw new ZlibException("Cannot Write after Reading.");
+
+            if (count == 0)
+                return;
+
+            // first reference of z property will initialize the private var _z
+            z.InputBuffer = buffer;
+            _z.NextIn = offset;
+            _z.AvailableBytesIn = count;
+            bool done = false;
+            do
+            {
+                _z.OutputBuffer = workingBuffer;
+                _z.NextOut = 0;
+                _z.AvailableBytesOut = _workingBuffer.Length;
+                int rc = (_wantCompress)
+                    ? _z.Deflate(_flushMode)
+                    : _z.Inflate(_flushMode);
+                if (rc != ZlibConstants.Z_OK && rc != ZlibConstants.Z_STREAM_END)
+                    throw new ZlibException((_wantCompress ? "de" : "in") + "flating: " + _z.Message);
+
+                //if (_workingBuffer.Length - _z.AvailableBytesOut > 0)
+                _stream.Write(_workingBuffer, 0, _workingBuffer.Length - _z.AvailableBytesOut);
+
+                done = _z.AvailableBytesIn == 0 && _z.AvailableBytesOut != 0;
+
+                // If GZIP and de-compress, we're done when 8 bytes remain.
+                if (_flavor == ZlibStreamFlavor.GZIP && !_wantCompress)
+                    done = (_z.AvailableBytesIn == 8 && _z.AvailableBytesOut != 0);
+
+            }
+            while (!done);
+        }
+
+
+
+        private void finish()
+        {
+            if (_z == null) return;
+
+            if (_streamMode == StreamMode.Writer)
+            {
+                bool done = false;
+                do
+                {
+                    _z.OutputBuffer = workingBuffer;
+                    _z.NextOut = 0;
+                    _z.AvailableBytesOut = _workingBuffer.Length;
+                    int rc = (_wantCompress)
+                        ? _z.Deflate(FlushType.Finish)
+                        : _z.Inflate(FlushType.Finish);
+
+                    if (rc != ZlibConstants.Z_STREAM_END && rc != ZlibConstants.Z_OK)
+                    {
+                        string verb = (_wantCompress ? "de" : "in") + "flating";
+                        if (_z.Message == null)
+                            throw new ZlibException(String.Format("{0}: (rc = {1})", verb, rc));
+                        else
+                            throw new ZlibException(verb + ": " + _z.Message);
+                    }
+
+                    if (_workingBuffer.Length - _z.AvailableBytesOut > 0)
+                    {
+                        _stream.Write(_workingBuffer, 0, _workingBuffer.Length - _z.AvailableBytesOut);
+                    }
+
+                    done = _z.AvailableBytesIn == 0 && _z.AvailableBytesOut != 0;
+                    // If GZIP and de-compress, we're done when 8 bytes remain.
+                    if (_flavor == ZlibStreamFlavor.GZIP && !_wantCompress)
+                        done = (_z.AvailableBytesIn == 8 && _z.AvailableBytesOut != 0);
+
+                }
+                while (!done);
+
+                Flush();
+
+                // workitem 7159
+                if (_flavor == ZlibStreamFlavor.GZIP)
+                {
+                    if (_wantCompress)
+                    {
+                        // Emit the GZIP trailer: CRC32 and  size mod 2^32
+                        int c1 = crc.Crc32Result;
+                        _stream.Write(BitConverter.GetBytes(c1), 0, 4);
+                        int c2 = (Int32)(crc.TotalBytesRead & 0x00000000FFFFFFFF);
+                        _stream.Write(BitConverter.GetBytes(c2), 0, 4);
+                    }
+                    else
+                    {
+                        throw new ZlibException("Writing with decompression is not supported.");
+                    }
+                }
+            }
+            // workitem 7159
+            else if (_streamMode == StreamMode.Reader)
+            {
+                if (_flavor == ZlibStreamFlavor.GZIP)
+                {
+                    if (!_wantCompress)
+                    {
+                        // workitem 8501: handle edge case (decompress empty stream)
+                        if (_z.TotalBytesOut == 0L)
+                            return;
+
+                        // Read and potentially verify the GZIP trailer:
+                        // CRC32 and size mod 2^32
+                        byte[] trailer = new byte[8];
+
+                        // workitems 8679 & 12554
+                        if (_z.AvailableBytesIn < 8)
+                        {
+                            // Make sure we have read to the end of the stream
+                            Array.Copy(_z.InputBuffer, _z.NextIn, trailer, 0, _z.AvailableBytesIn);
+                            int bytesNeeded = 8 - _z.AvailableBytesIn;
+                            int bytesRead = _stream.Read(trailer,
+                                                         _z.AvailableBytesIn,
+                                                         bytesNeeded);
+                            if (bytesNeeded != bytesRead)
+                            {
+                                throw new ZlibException(String.Format("Missing or incomplete GZIP trailer. Expected 8 bytes, got {0}.",
+                                                                      _z.AvailableBytesIn + bytesRead));
+                            }
+                        }
+                        else
+                        {
+                            Array.Copy(_z.InputBuffer, _z.NextIn, trailer, 0, trailer.Length);
+                        }
+
+                        Int32 crc32_expected = BitConverter.ToInt32(trailer, 0);
+                        Int32 crc32_actual = crc.Crc32Result;
+                        Int32 isize_expected = BitConverter.ToInt32(trailer, 4);
+                        Int32 isize_actual = (Int32)(_z.TotalBytesOut & 0x00000000FFFFFFFF);
+
+                        if (crc32_actual != crc32_expected)
+                            throw new ZlibException(String.Format("Bad CRC32 in GZIP trailer. (actual({0:X8})!=expected({1:X8}))", crc32_actual, crc32_expected));
+
+                        if (isize_actual != isize_expected)
+                            throw new ZlibException(String.Format("Bad size in GZIP trailer. (actual({0})!=expected({1}))", isize_actual, isize_expected));
+
+                    }
+                    else
+                    {
+                        throw new ZlibException("Reading with compression is not supported.");
+                    }
+                }
+            }
+        }
+
+
+        private void end()
+        {
+            if (z == null)
+                return;
+            if (_wantCompress)
+            {
+                _z.EndDeflate();
+            }
+            else
+            {
+                _z.EndInflate();
+            }
+            _z = null;
+        }
+
+
+        public override void Close()
+        {
+            if (_stream == null) return;
+            try
+            {
+                finish();
+            }
+            finally
+            {
+                end();
+                if (!_leaveOpen) _stream.Close();
+                _stream = null;
+            }
+        }
+
+        public override void Flush()
+        {
+            _stream.Flush();
+        }
+
+        public override System.Int64 Seek(System.Int64 offset, System.IO.SeekOrigin origin)
+        {
+            throw new NotImplementedException();
+            //_outStream.Seek(offset, origin);
+        }
+        public override void SetLength(System.Int64 value)
+        {
+            _stream.SetLength(value);
+        }
+
+
+#if NOT
+        public int Read()
+        {
+            if (Read(_buf1, 0, 1) == 0)
+                return 0;
+            // calculate CRC after reading
+            if (crc!=null)
+                crc.SlurpBlock(_buf1,0,1);
+            return (_buf1[0] & 0xFF);
+        }
+#endif
+
+        private bool nomoreinput = false;
+
+
+
+        private string ReadZeroTerminatedString()
+        {
+            var list = new System.Collections.Generic.List<byte>();
+            bool done = false;
+            do
+            {
+                // workitem 7740
+                int n = _stream.Read(_buf1, 0, 1);
+                if (n != 1)
+                    throw new ZlibException("Unexpected EOF reading GZIP header.");
+                else
+                {
+                    if (_buf1[0] == 0)
+                        done = true;
+                    else
+                        list.Add(_buf1[0]);
+                }
+            } while (!done);
+            byte[] a = list.ToArray();
+            return GZipStream.iso8859dash1.GetString(a, 0, a.Length);
+        }
+
+
+        private int _ReadAndValidateGzipHeader()
+        {
+            int totalBytesRead = 0;
+            // read the header on the first read
+            byte[] header = new byte[10];
+            int n = _stream.Read(header, 0, header.Length);
+
+            // workitem 8501: handle edge case (decompress empty stream)
+            if (n == 0)
+                return 0;
+
+            if (n != 10)
+                throw new ZlibException("Not a valid GZIP stream.");
+
+            if (header[0] != 0x1F || header[1] != 0x8B || header[2] != 8)
+                throw new ZlibException("Bad GZIP header.");
+
+            Int32 timet = BitConverter.ToInt32(header, 4);
+            _GzipMtime = GZipStream._unixEpoch.AddSeconds(timet);
+            totalBytesRead += n;
+            if ((header[3] & 0x04) == 0x04)
+            {
+                // read and discard extra field
+                n = _stream.Read(header, 0, 2); // 2-byte length field
+                totalBytesRead += n;
+
+                Int16 extraLength = (Int16)(header[0] + header[1] * 256);
+                byte[] extra = new byte[extraLength];
+                n = _stream.Read(extra, 0, extra.Length);
+                if (n != extraLength)
+                    throw new ZlibException("Unexpected end-of-file reading GZIP header.");
+                totalBytesRead += n;
+            }
+            if ((header[3] & 0x08) == 0x08)
+                _GzipFileName = ReadZeroTerminatedString();
+            if ((header[3] & 0x10) == 0x010)
+                _GzipComment = ReadZeroTerminatedString();
+            if ((header[3] & 0x02) == 0x02)
+                Read(_buf1, 0, 1); // CRC16, ignore
+
+            return totalBytesRead;
+        }
+
+
+
+        public override System.Int32 Read(System.Byte[] buffer, System.Int32 offset, System.Int32 count)
+        {
+            // According to MS documentation, any implementation of the IO.Stream.Read function must:
+            // (a) throw an exception if offset & count reference an invalid part of the buffer,
+            //     or if count < 0, or if buffer is null
+            // (b) return 0 only upon EOF, or if count = 0
+            // (c) if not EOF, then return at least 1 byte, up to <count> bytes
+
+            if (_streamMode == StreamMode.Undefined)
+            {
+                if (!this._stream.CanRead) throw new ZlibException("The stream is not readable.");
+                // for the first read, set up some controls.
+                _streamMode = StreamMode.Reader;
+                // (The first reference to _z goes through the private accessor which
+                // may initialize it.)
+                z.AvailableBytesIn = 0;
+                if (_flavor == ZlibStreamFlavor.GZIP)
+                {
+                    _gzipHeaderByteCount = _ReadAndValidateGzipHeader();
+                    // workitem 8501: handle edge case (decompress empty stream)
+                    if (_gzipHeaderByteCount == 0)
+                        return 0;
+                }
+            }
+
+            if (_streamMode != StreamMode.Reader)
+                throw new ZlibException("Cannot Read after Writing.");
+
+            if (count == 0) return 0;
+            if (nomoreinput && _wantCompress) return 0;  // workitem 8557
+            if (buffer == null) throw new ArgumentNullException("buffer");
+            if (count < 0) throw new ArgumentOutOfRangeException("count");
+            if (offset < buffer.GetLowerBound(0)) throw new ArgumentOutOfRangeException("offset");
+            if ((offset + count) > buffer.GetLength(0)) throw new ArgumentOutOfRangeException("count");
+
+            int rc = 0;
+
+            // set up the output of the deflate/inflate codec:
+            _z.OutputBuffer = buffer;
+            _z.NextOut = offset;
+            _z.AvailableBytesOut = count;
+
+            // This is necessary in case _workingBuffer has been resized. (new byte[])
+            // (The first reference to _workingBuffer goes through the private accessor which
+            // may initialize it.)
+            _z.InputBuffer = workingBuffer;
+
+            do
+            {
+                // need data in _workingBuffer in order to deflate/inflate.  Here, we check if we have any.
+                if ((_z.AvailableBytesIn == 0) && (!nomoreinput))
+                {
+                    // No data available, so try to Read data from the captive stream.
+                    _z.NextIn = 0;
+                    _z.AvailableBytesIn = _stream.Read(_workingBuffer, 0, _workingBuffer.Length);
+                    if (_z.AvailableBytesIn == 0)
+                        nomoreinput = true;
+
+                }
+                // we have data in InputBuffer; now compress or decompress as appropriate
+                rc = (_wantCompress)
+                    ? _z.Deflate(_flushMode)
+                    : _z.Inflate(_flushMode);
+
+                if (nomoreinput && (rc == ZlibConstants.Z_BUF_ERROR))
+                    return 0;
+
+                if (rc != ZlibConstants.Z_OK && rc != ZlibConstants.Z_STREAM_END)
+                    throw new ZlibException(String.Format("{0}flating:  rc={1}  msg={2}", (_wantCompress ? "de" : "in"), rc, _z.Message));
+
+                if ((nomoreinput || rc == ZlibConstants.Z_STREAM_END) && (_z.AvailableBytesOut == count))
+                    break; // nothing more to read
+            }
+            //while (_z.AvailableBytesOut == count && rc == ZlibConstants.Z_OK);
+            while (_z.AvailableBytesOut > 0 && !nomoreinput && rc == ZlibConstants.Z_OK);
+
+
+            // workitem 8557
+            // is there more room in output?
+            if (_z.AvailableBytesOut > 0)
+            {
+                if (rc == ZlibConstants.Z_OK && _z.AvailableBytesIn == 0)
+                {
+                    // deferred
+                }
+
+                // are we completely done reading?
+                if (nomoreinput)
+                {
+                    // and in compression?
+                    if (_wantCompress)
+                    {
+                        // no more input data available; therefore we flush to
+                        // try to complete the read
+                        rc = _z.Deflate(FlushType.Finish);
+
+                        if (rc != ZlibConstants.Z_OK && rc != ZlibConstants.Z_STREAM_END)
+                            throw new ZlibException(String.Format("Deflating:  rc={0}  msg={1}", rc, _z.Message));
+                    }
+                }
+            }
+
+
+            rc = (count - _z.AvailableBytesOut);
+
+            // calculate CRC after reading
+            if (crc != null)
+                crc.SlurpBlock(buffer, offset, rc);
+
+            return rc;
+        }
+
+
+
+        public override System.Boolean CanRead
+        {
+            get { return this._stream.CanRead; }
+        }
+
+        public override System.Boolean CanSeek
+        {
+            get { return this._stream.CanSeek; }
+        }
+
+        public override System.Boolean CanWrite
+        {
+            get { return this._stream.CanWrite; }
+        }
+
+        public override System.Int64 Length
+        {
+            get { return _stream.Length; }
+        }
+
+        public override long Position
+        {
+            get { throw new NotImplementedException(); }
+            set { throw new NotImplementedException(); }
+        }
+
+        internal enum StreamMode
+        {
+            Writer,
+            Reader,
+            Undefined,
+        }
+
+
+        public static void CompressString(String s, Stream compressor)
+        {
+            byte[] uncompressed = System.Text.Encoding.UTF8.GetBytes(s);
+            using (compressor)
+            {
+                compressor.Write(uncompressed, 0, uncompressed.Length);
+            }
+        }
+
+        public static void CompressBuffer(byte[] b, Stream compressor)
+        {
+            // workitem 8460
+            using (compressor)
+            {
+                compressor.Write(b, 0, b.Length);
+            }
+        }
+
+        public static String UncompressString(byte[] compressed, Stream decompressor)
+        {
+            // workitem 8460
+            byte[] working = new byte[1024];
+            var encoding = System.Text.Encoding.UTF8;
+            using (var output = new MemoryStream())
+            {
+                using (decompressor)
+                {
+                    int n;
+                    while ((n = decompressor.Read(working, 0, working.Length)) != 0)
+                    {
+                        output.Write(working, 0, n);
+                    }
+                }
+
+                // reset to allow read from start
+                output.Seek(0, SeekOrigin.Begin);
+                var sr = new StreamReader(output, encoding);
+                return sr.ReadToEnd();
+            }
+        }
+
+        public static byte[] UncompressBuffer(byte[] compressed, Stream decompressor)
+        {
+            // workitem 8460
+            byte[] working = new byte[1024];
+            using (var output = new MemoryStream())
+            {
+                using (decompressor)
+                {
+                    int n;
+                    while ((n = decompressor.Read(working, 0, working.Length)) != 0)
+                    {
+                        output.Write(working, 0, n);
+                    }
+                }
+                return output.ToArray();
+            }
+        }
+
+    }
+
+
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/Zlib/ZlibCodec.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/Zlib/ZlibCodec.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/Zlib/ZlibCodec.cs	(revision 12707)
@@ -0,0 +1,717 @@
+// ZlibCodec.cs
+// ------------------------------------------------------------------
+//
+// Copyright (c) 2009 Dino Chiesa and Microsoft Corporation.  
+// All rights reserved.
+//
+// This code module is part of DotNetZip, a zipfile class library.
+//
+// ------------------------------------------------------------------
+//
+// This code is licensed under the Microsoft Public License. 
+// See the file License.txt for the license details.
+// More info on: http://dotnetzip.codeplex.com
+//
+// ------------------------------------------------------------------
+//
+// last saved (in emacs): 
+// Time-stamp: <2009-November-03 15:40:51>
+//
+// ------------------------------------------------------------------
+//
+// This module defines a Codec for ZLIB compression and
+// decompression. This code extends code that was based the jzlib
+// implementation of zlib, but this code is completely novel.  The codec
+// class is new, and encapsulates some behaviors that are new, and some
+// that were present in other classes in the jzlib code base.  In
+// keeping with the license for jzlib, the copyright to the jzlib code
+// is included below.
+//
+// ------------------------------------------------------------------
+// 
+// Copyright (c) 2000,2001,2002,2003 ymnk, JCraft,Inc. All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright 
+// notice, this list of conditions and the following disclaimer in 
+// the documentation and/or other materials provided with the distribution.
+// 
+// 3. The names of the authors may not be used to endorse or promote products
+// derived from this software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
+// INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
+// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// 
+// -----------------------------------------------------------------------
+//
+// This program is based on zlib-1.1.3; credit to authors
+// Jean-loup Gailly(jloup@gzip.org) and Mark Adler(madler@alumni.caltech.edu)
+// and contributors of zlib.
+//
+// -----------------------------------------------------------------------
+
+
+using System;
+using Interop=System.Runtime.InteropServices;
+
+namespace OfficeOpenXml.Packaging.Ionic.Zlib
+{
+    /// <summary>
+    /// Encoder and Decoder for ZLIB and DEFLATE (IETF RFC1950 and RFC1951).
+    /// </summary>
+    ///
+    /// <remarks>
+    /// This class compresses and decompresses data according to the Deflate algorithm
+    /// and optionally, the ZLIB format, as documented in <see
+    /// href="http://www.ietf.org/rfc/rfc1950.txt">RFC 1950 - ZLIB</see> and <see
+    /// href="http://www.ietf.org/rfc/rfc1951.txt">RFC 1951 - DEFLATE</see>.
+    /// </remarks>
+    [Interop.GuidAttribute("ebc25cf6-9120-4283-b972-0e5520d0000D")]
+    [Interop.ComVisible(true)]
+#if !NETCF    
+    [Interop.ClassInterface(Interop.ClassInterfaceType.AutoDispatch)]
+#endif
+    sealed public class ZlibCodec
+    {
+        /// <summary>
+        /// The buffer from which data is taken.
+        /// </summary>
+        public byte[] InputBuffer;
+
+        /// <summary>
+        /// An index into the InputBuffer array, indicating where to start reading. 
+        /// </summary>
+        public int NextIn;
+
+        /// <summary>
+        /// The number of bytes available in the InputBuffer, starting at NextIn. 
+        /// </summary>
+        /// <remarks>
+        /// Generally you should set this to InputBuffer.Length before the first Inflate() or Deflate() call. 
+        /// The class will update this number as calls to Inflate/Deflate are made.
+        /// </remarks>
+        public int AvailableBytesIn;
+
+        /// <summary>
+        /// Total number of bytes read so far, through all calls to Inflate()/Deflate().
+        /// </summary>
+        public long TotalBytesIn;
+
+        /// <summary>
+        /// Buffer to store output data.
+        /// </summary>
+        public byte[] OutputBuffer;
+
+        /// <summary>
+        /// An index into the OutputBuffer array, indicating where to start writing. 
+        /// </summary>
+        public int NextOut;
+
+        /// <summary>
+        /// The number of bytes available in the OutputBuffer, starting at NextOut. 
+        /// </summary>
+        /// <remarks>
+        /// Generally you should set this to OutputBuffer.Length before the first Inflate() or Deflate() call. 
+        /// The class will update this number as calls to Inflate/Deflate are made.
+        /// </remarks>
+        public int AvailableBytesOut;
+
+        /// <summary>
+        /// Total number of bytes written to the output so far, through all calls to Inflate()/Deflate().
+        /// </summary>
+        public long TotalBytesOut;
+
+        /// <summary>
+        /// used for diagnostics, when something goes wrong!
+        /// </summary>
+        public System.String Message;
+
+        internal DeflateManager dstate;
+        internal InflateManager istate;
+
+        internal uint _Adler32;
+
+        /// <summary>
+        /// The compression level to use in this codec.  Useful only in compression mode.
+        /// </summary>
+        public CompressionLevel CompressLevel = CompressionLevel.Default;
+
+        /// <summary>
+        /// The number of Window Bits to use.  
+        /// </summary>
+        /// <remarks>
+        /// This gauges the size of the sliding window, and hence the 
+        /// compression effectiveness as well as memory consumption. It's best to just leave this 
+        /// setting alone if you don't know what it is.  The maximum value is 15 bits, which implies
+        /// a 32k window.  
+        /// </remarks>
+        public int WindowBits = ZlibConstants.WindowBitsDefault;
+
+        /// <summary>
+        /// The compression strategy to use.
+        /// </summary>
+        /// <remarks>
+        /// This is only effective in compression.  The theory offered by ZLIB is that different
+        /// strategies could potentially produce significant differences in compression behavior
+        /// for different data sets.  Unfortunately I don't have any good recommendations for how
+        /// to set it differently.  When I tested changing the strategy I got minimally different
+        /// compression performance. It's best to leave this property alone if you don't have a
+        /// good feel for it.  Or, you may want to produce a test harness that runs through the
+        /// different strategy options and evaluates them on different file types. If you do that,
+        /// let me know your results.
+        /// </remarks>
+        public CompressionStrategy Strategy = CompressionStrategy.Default;
+
+
+        /// <summary>
+        /// The Adler32 checksum on the data transferred through the codec so far. You probably don't need to look at this.
+        /// </summary>
+        public int Adler32 { get { return (int)_Adler32; } }
+
+
+        /// <summary>
+        /// Create a ZlibCodec.
+        /// </summary>
+        /// <remarks>
+        /// If you use this default constructor, you will later have to explicitly call 
+        /// InitializeInflate() or InitializeDeflate() before using the ZlibCodec to compress 
+        /// or decompress. 
+        /// </remarks>
+        public ZlibCodec() { }
+
+        /// <summary>
+        /// Create a ZlibCodec that either compresses or decompresses.
+        /// </summary>
+        /// <param name="mode">
+        /// Indicates whether the codec should compress (deflate) or decompress (inflate).
+        /// </param>
+        public ZlibCodec(CompressionMode mode)
+        {
+            if (mode == CompressionMode.Compress)
+            {
+                int rc = InitializeDeflate();
+                if (rc != ZlibConstants.Z_OK) throw new ZlibException("Cannot initialize for deflate.");
+            }
+            else if (mode == CompressionMode.Decompress)
+            {
+                int rc = InitializeInflate();
+                if (rc != ZlibConstants.Z_OK) throw new ZlibException("Cannot initialize for inflate.");
+            }
+            else throw new ZlibException("Invalid ZlibStreamFlavor.");
+        }
+
+        /// <summary>
+        /// Initialize the inflation state. 
+        /// </summary>
+        /// <remarks>
+        /// It is not necessary to call this before using the ZlibCodec to inflate data; 
+        /// It is implicitly called when you call the constructor.
+        /// </remarks>
+        /// <returns>Z_OK if everything goes well.</returns>
+        public int InitializeInflate()
+        {
+            return InitializeInflate(this.WindowBits);
+        }
+
+        /// <summary>
+        /// Initialize the inflation state with an explicit flag to
+        /// govern the handling of RFC1950 header bytes.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// By default, the ZLIB header defined in <see
+        /// href="http://www.ietf.org/rfc/rfc1950.txt">RFC 1950</see> is expected.  If
+        /// you want to read a zlib stream you should specify true for
+        /// expectRfc1950Header.  If you have a deflate stream, you will want to specify
+        /// false. It is only necessary to invoke this initializer explicitly if you
+        /// want to specify false.
+        /// </remarks>
+        ///
+        /// <param name="expectRfc1950Header">whether to expect an RFC1950 header byte
+        /// pair when reading the stream of data to be inflated.</param>
+        ///
+        /// <returns>Z_OK if everything goes well.</returns>
+        public int InitializeInflate(bool expectRfc1950Header)
+        {
+            return InitializeInflate(this.WindowBits, expectRfc1950Header);
+        }
+
+        /// <summary>
+        /// Initialize the ZlibCodec for inflation, with the specified number of window bits. 
+        /// </summary>
+        /// <param name="windowBits">The number of window bits to use. If you need to ask what that is, 
+        /// then you shouldn't be calling this initializer.</param>
+        /// <returns>Z_OK if all goes well.</returns>
+        public int InitializeInflate(int windowBits)
+        {
+            this.WindowBits = windowBits;            
+            return InitializeInflate(windowBits, true);
+        }
+
+        /// <summary>
+        /// Initialize the inflation state with an explicit flag to govern the handling of
+        /// RFC1950 header bytes. 
+        /// </summary>
+        ///
+        /// <remarks>
+        /// If you want to read a zlib stream you should specify true for
+        /// expectRfc1950Header. In this case, the library will expect to find a ZLIB
+        /// header, as defined in <see href="http://www.ietf.org/rfc/rfc1950.txt">RFC
+        /// 1950</see>, in the compressed stream.  If you will be reading a DEFLATE or
+        /// GZIP stream, which does not have such a header, you will want to specify
+        /// false.
+        /// </remarks>
+        ///
+        /// <param name="expectRfc1950Header">whether to expect an RFC1950 header byte pair when reading 
+        /// the stream of data to be inflated.</param>
+        /// <param name="windowBits">The number of window bits to use. If you need to ask what that is, 
+        /// then you shouldn't be calling this initializer.</param>
+        /// <returns>Z_OK if everything goes well.</returns>
+        public int InitializeInflate(int windowBits, bool expectRfc1950Header)
+        {
+            this.WindowBits = windowBits;
+            if (dstate != null) throw new ZlibException("You may not call InitializeInflate() after calling InitializeDeflate().");
+            istate = new InflateManager(expectRfc1950Header);
+            return istate.Initialize(this, windowBits);
+        }
+
+        /// <summary>
+        /// Inflate the data in the InputBuffer, placing the result in the OutputBuffer.
+        /// </summary>
+        /// <remarks>
+        /// You must have set InputBuffer and OutputBuffer, NextIn and NextOut, and AvailableBytesIn and 
+        /// AvailableBytesOut  before calling this method.
+        /// </remarks>
+        /// <example>
+        /// <code>
+        /// private void InflateBuffer()
+        /// {
+        ///     int bufferSize = 1024;
+        ///     byte[] buffer = new byte[bufferSize];
+        ///     ZlibCodec decompressor = new ZlibCodec();
+        /// 
+        ///     Console.WriteLine("\n============================================");
+        ///     Console.WriteLine("Size of Buffer to Inflate: {0} bytes.", CompressedBytes.Length);
+        ///     MemoryStream ms = new MemoryStream(DecompressedBytes);
+        /// 
+        ///     int rc = decompressor.InitializeInflate();
+        /// 
+        ///     decompressor.InputBuffer = CompressedBytes;
+        ///     decompressor.NextIn = 0;
+        ///     decompressor.AvailableBytesIn = CompressedBytes.Length;
+        /// 
+        ///     decompressor.OutputBuffer = buffer;
+        /// 
+        ///     // pass 1: inflate 
+        ///     do
+        ///     {
+        ///         decompressor.NextOut = 0;
+        ///         decompressor.AvailableBytesOut = buffer.Length;
+        ///         rc = decompressor.Inflate(FlushType.None);
+        /// 
+        ///         if (rc != ZlibConstants.Z_OK &amp;&amp; rc != ZlibConstants.Z_STREAM_END)
+        ///             throw new Exception("inflating: " + decompressor.Message);
+        /// 
+        ///         ms.Write(decompressor.OutputBuffer, 0, buffer.Length - decompressor.AvailableBytesOut);
+        ///     }
+        ///     while (decompressor.AvailableBytesIn &gt; 0 || decompressor.AvailableBytesOut == 0);
+        /// 
+        ///     // pass 2: finish and flush
+        ///     do
+        ///     {
+        ///         decompressor.NextOut = 0;
+        ///         decompressor.AvailableBytesOut = buffer.Length;
+        ///         rc = decompressor.Inflate(FlushType.Finish);
+        /// 
+        ///         if (rc != ZlibConstants.Z_STREAM_END &amp;&amp; rc != ZlibConstants.Z_OK)
+        ///             throw new Exception("inflating: " + decompressor.Message);
+        /// 
+        ///         if (buffer.Length - decompressor.AvailableBytesOut &gt; 0)
+        ///             ms.Write(buffer, 0, buffer.Length - decompressor.AvailableBytesOut);
+        ///     }
+        ///     while (decompressor.AvailableBytesIn &gt; 0 || decompressor.AvailableBytesOut == 0);
+        /// 
+        ///     decompressor.EndInflate();
+        /// }
+        ///
+        /// </code>
+        /// </example>
+        /// <param name="flush">The flush to use when inflating.</param>
+        /// <returns>Z_OK if everything goes well.</returns>
+        public int Inflate(FlushType flush)
+        {
+            if (istate == null)
+                throw new ZlibException("No Inflate State!");
+            return istate.Inflate(flush);
+        }
+
+
+        /// <summary>
+        /// Ends an inflation session. 
+        /// </summary>
+        /// <remarks>
+        /// Call this after successively calling Inflate().  This will cause all buffers to be flushed. 
+        /// After calling this you cannot call Inflate() without a intervening call to one of the
+        /// InitializeInflate() overloads.
+        /// </remarks>
+        /// <returns>Z_OK if everything goes well.</returns>
+        public int EndInflate()
+        {
+            if (istate == null)
+                throw new ZlibException("No Inflate State!");
+            int ret = istate.End();
+            istate = null;
+            return ret;
+        }
+
+        /// <summary>
+        /// I don't know what this does!
+        /// </summary>
+        /// <returns>Z_OK if everything goes well.</returns>
+        public int SyncInflate()
+        {
+            if (istate == null)
+                throw new ZlibException("No Inflate State!");
+            return istate.Sync();
+        }
+
+        /// <summary>
+        /// Initialize the ZlibCodec for deflation operation.
+        /// </summary>
+        /// <remarks>
+        /// The codec will use the MAX window bits and the default level of compression.
+        /// </remarks>
+        /// <example>
+        /// <code>
+        ///  int bufferSize = 40000;
+        ///  byte[] CompressedBytes = new byte[bufferSize];
+        ///  byte[] DecompressedBytes = new byte[bufferSize];
+        ///  
+        ///  ZlibCodec compressor = new ZlibCodec();
+        ///  
+        ///  compressor.InitializeDeflate(CompressionLevel.Default);
+        ///  
+        ///  compressor.InputBuffer = System.Text.ASCIIEncoding.ASCII.GetBytes(TextToCompress);
+        ///  compressor.NextIn = 0;
+        ///  compressor.AvailableBytesIn = compressor.InputBuffer.Length;
+        ///  
+        ///  compressor.OutputBuffer = CompressedBytes;
+        ///  compressor.NextOut = 0;
+        ///  compressor.AvailableBytesOut = CompressedBytes.Length;
+        ///  
+        ///  while (compressor.TotalBytesIn != TextToCompress.Length &amp;&amp; compressor.TotalBytesOut &lt; bufferSize)
+        ///  {
+        ///    compressor.Deflate(FlushType.None);
+        ///  }
+        ///  
+        ///  while (true)
+        ///  {
+        ///    int rc= compressor.Deflate(FlushType.Finish);
+        ///    if (rc == ZlibConstants.Z_STREAM_END) break;
+        ///  }
+        ///  
+        ///  compressor.EndDeflate();
+        ///   
+        /// </code>
+        /// </example>
+        /// <returns>Z_OK if all goes well. You generally don't need to check the return code.</returns>
+        public int InitializeDeflate()
+        {
+            return _InternalInitializeDeflate(true);
+        }
+
+        /// <summary>
+        /// Initialize the ZlibCodec for deflation operation, using the specified CompressionLevel.
+        /// </summary>
+        /// <remarks>
+        /// The codec will use the maximum window bits (15) and the specified
+        /// CompressionLevel.  It will emit a ZLIB stream as it compresses.
+        /// </remarks>
+        /// <param name="level">The compression level for the codec.</param>
+        /// <returns>Z_OK if all goes well.</returns>
+        public int InitializeDeflate(CompressionLevel level)
+        {
+            this.CompressLevel = level;
+            return _InternalInitializeDeflate(true);
+        }
+
+
+        /// <summary>
+        /// Initialize the ZlibCodec for deflation operation, using the specified CompressionLevel, 
+        /// and the explicit flag governing whether to emit an RFC1950 header byte pair.
+        /// </summary>
+        /// <remarks>
+        /// The codec will use the maximum window bits (15) and the specified CompressionLevel.
+        /// If you want to generate a zlib stream, you should specify true for
+        /// wantRfc1950Header. In this case, the library will emit a ZLIB
+        /// header, as defined in <see href="http://www.ietf.org/rfc/rfc1950.txt">RFC
+        /// 1950</see>, in the compressed stream.  
+        /// </remarks>
+        /// <param name="level">The compression level for the codec.</param>
+        /// <param name="wantRfc1950Header">whether to emit an initial RFC1950 byte pair in the compressed stream.</param>
+        /// <returns>Z_OK if all goes well.</returns>
+        public int InitializeDeflate(CompressionLevel level, bool wantRfc1950Header)
+        {
+            this.CompressLevel = level;
+            return _InternalInitializeDeflate(wantRfc1950Header);
+        }
+
+
+        /// <summary>
+        /// Initialize the ZlibCodec for deflation operation, using the specified CompressionLevel, 
+        /// and the specified number of window bits. 
+        /// </summary>
+        /// <remarks>
+        /// The codec will use the specified number of window bits and the specified CompressionLevel.
+        /// </remarks>
+        /// <param name="level">The compression level for the codec.</param>
+        /// <param name="bits">the number of window bits to use.  If you don't know what this means, don't use this method.</param>
+        /// <returns>Z_OK if all goes well.</returns>
+        public int InitializeDeflate(CompressionLevel level, int bits)
+        {
+            this.CompressLevel = level;
+            this.WindowBits = bits;
+            return _InternalInitializeDeflate(true);
+        }
+
+        /// <summary>
+        /// Initialize the ZlibCodec for deflation operation, using the specified
+        /// CompressionLevel, the specified number of window bits, and the explicit flag
+        /// governing whether to emit an RFC1950 header byte pair.
+        /// </summary>
+        ///
+        /// <param name="level">The compression level for the codec.</param>
+        /// <param name="wantRfc1950Header">whether to emit an initial RFC1950 byte pair in the compressed stream.</param>
+        /// <param name="bits">the number of window bits to use.  If you don't know what this means, don't use this method.</param>
+        /// <returns>Z_OK if all goes well.</returns>
+        public int InitializeDeflate(CompressionLevel level, int bits, bool wantRfc1950Header)
+        {
+            this.CompressLevel = level;
+            this.WindowBits = bits;
+            return _InternalInitializeDeflate(wantRfc1950Header);
+        }
+
+        private int _InternalInitializeDeflate(bool wantRfc1950Header)
+        {
+            if (istate != null) throw new ZlibException("You may not call InitializeDeflate() after calling InitializeInflate().");
+            dstate = new DeflateManager();
+            dstate.WantRfc1950HeaderBytes = wantRfc1950Header;
+
+            return dstate.Initialize(this, this.CompressLevel, this.WindowBits, this.Strategy);
+        }
+
+        /// <summary>
+        /// Deflate one batch of data.
+        /// </summary>
+        /// <remarks>
+        /// You must have set InputBuffer and OutputBuffer before calling this method.
+        /// </remarks>
+        /// <example>
+        /// <code>
+        /// private void DeflateBuffer(CompressionLevel level)
+        /// {
+        ///     int bufferSize = 1024;
+        ///     byte[] buffer = new byte[bufferSize];
+        ///     ZlibCodec compressor = new ZlibCodec();
+        /// 
+        ///     Console.WriteLine("\n============================================");
+        ///     Console.WriteLine("Size of Buffer to Deflate: {0} bytes.", UncompressedBytes.Length);
+        ///     MemoryStream ms = new MemoryStream();
+        /// 
+        ///     int rc = compressor.InitializeDeflate(level);
+        /// 
+        ///     compressor.InputBuffer = UncompressedBytes;
+        ///     compressor.NextIn = 0;
+        ///     compressor.AvailableBytesIn = UncompressedBytes.Length;
+        /// 
+        ///     compressor.OutputBuffer = buffer;
+        /// 
+        ///     // pass 1: deflate 
+        ///     do
+        ///     {
+        ///         compressor.NextOut = 0;
+        ///         compressor.AvailableBytesOut = buffer.Length;
+        ///         rc = compressor.Deflate(FlushType.None);
+        /// 
+        ///         if (rc != ZlibConstants.Z_OK &amp;&amp; rc != ZlibConstants.Z_STREAM_END)
+        ///             throw new Exception("deflating: " + compressor.Message);
+        /// 
+        ///         ms.Write(compressor.OutputBuffer, 0, buffer.Length - compressor.AvailableBytesOut);
+        ///     }
+        ///     while (compressor.AvailableBytesIn &gt; 0 || compressor.AvailableBytesOut == 0);
+        /// 
+        ///     // pass 2: finish and flush
+        ///     do
+        ///     {
+        ///         compressor.NextOut = 0;
+        ///         compressor.AvailableBytesOut = buffer.Length;
+        ///         rc = compressor.Deflate(FlushType.Finish);
+        /// 
+        ///         if (rc != ZlibConstants.Z_STREAM_END &amp;&amp; rc != ZlibConstants.Z_OK)
+        ///             throw new Exception("deflating: " + compressor.Message);
+        /// 
+        ///         if (buffer.Length - compressor.AvailableBytesOut &gt; 0)
+        ///             ms.Write(buffer, 0, buffer.Length - compressor.AvailableBytesOut);
+        ///     }
+        ///     while (compressor.AvailableBytesIn &gt; 0 || compressor.AvailableBytesOut == 0);
+        /// 
+        ///     compressor.EndDeflate();
+        /// 
+        ///     ms.Seek(0, SeekOrigin.Begin);
+        ///     CompressedBytes = new byte[compressor.TotalBytesOut];
+        ///     ms.Read(CompressedBytes, 0, CompressedBytes.Length);
+        /// }
+        /// </code>
+        /// </example>
+        /// <param name="flush">whether to flush all data as you deflate. Generally you will want to 
+        /// use Z_NO_FLUSH here, in a series of calls to Deflate(), and then call EndDeflate() to 
+        /// flush everything. 
+        /// </param>
+        /// <returns>Z_OK if all goes well.</returns>
+        public int Deflate(FlushType flush)
+        {
+            if (dstate == null)
+                throw new ZlibException("No Deflate State!");
+            return dstate.Deflate(flush);
+        }
+
+        /// <summary>
+        /// End a deflation session.
+        /// </summary>
+        /// <remarks>
+        /// Call this after making a series of one or more calls to Deflate(). All buffers are flushed.
+        /// </remarks>
+        /// <returns>Z_OK if all goes well.</returns>
+        public int EndDeflate()
+        {
+            if (dstate == null)
+                throw new ZlibException("No Deflate State!");
+            // TODO: dinoch Tue, 03 Nov 2009  15:39 (test this)
+            //int ret = dstate.End();
+            dstate = null;
+            return ZlibConstants.Z_OK; //ret;
+        }
+
+        /// <summary>
+        /// Reset a codec for another deflation session.
+        /// </summary>
+        /// <remarks>
+        /// Call this to reset the deflation state.  For example if a thread is deflating
+        /// non-consecutive blocks, you can call Reset() after the Deflate(Sync) of the first
+        /// block and before the next Deflate(None) of the second block.
+        /// </remarks>
+        /// <returns>Z_OK if all goes well.</returns>
+        public void ResetDeflate()
+        {
+            if (dstate == null)
+                throw new ZlibException("No Deflate State!");
+            dstate.Reset();
+        }
+
+
+        /// <summary>
+        /// Set the CompressionStrategy and CompressionLevel for a deflation session.
+        /// </summary>
+        /// <param name="level">the level of compression to use.</param>
+        /// <param name="strategy">the strategy to use for compression.</param>
+        /// <returns>Z_OK if all goes well.</returns>
+        public int SetDeflateParams(CompressionLevel level, CompressionStrategy strategy)
+        {
+            if (dstate == null)
+                throw new ZlibException("No Deflate State!");
+            return dstate.SetParams(level, strategy);
+        }
+
+
+        /// <summary>
+        /// Set the dictionary to be used for either Inflation or Deflation.
+        /// </summary>
+        /// <param name="dictionary">The dictionary bytes to use.</param>
+        /// <returns>Z_OK if all goes well.</returns>
+        public int SetDictionary(byte[] dictionary)
+        {
+            if (istate != null)
+                return istate.SetDictionary(dictionary);
+
+            if (dstate != null)
+                return dstate.SetDictionary(dictionary);
+
+            throw new ZlibException("No Inflate or Deflate state!");
+        }
+
+        // Flush as much pending output as possible. All deflate() output goes
+        // through this function so some applications may wish to modify it
+        // to avoid allocating a large strm->next_out buffer and copying into it.
+        // (See also read_buf()).
+        internal void flush_pending()
+        {
+            int len = dstate.pendingCount;
+
+            if (len > AvailableBytesOut)
+                len = AvailableBytesOut;
+            if (len == 0)
+                return;
+
+            if (dstate.pending.Length <= dstate.nextPending ||
+                OutputBuffer.Length <= NextOut ||
+                dstate.pending.Length < (dstate.nextPending + len) ||
+                OutputBuffer.Length < (NextOut + len))
+            {
+                throw new ZlibException(String.Format("Invalid State. (pending.Length={0}, pendingCount={1})",
+                    dstate.pending.Length, dstate.pendingCount));
+            }
+
+            Array.Copy(dstate.pending, dstate.nextPending, OutputBuffer, NextOut, len);
+
+            NextOut             += len;
+            dstate.nextPending  += len;
+            TotalBytesOut       += len;
+            AvailableBytesOut   -= len;
+            dstate.pendingCount -= len;
+            if (dstate.pendingCount == 0)
+            {
+                dstate.nextPending = 0;
+            }
+        }
+
+        // Read a new buffer from the current input stream, update the adler32
+        // and total number of bytes read.  All deflate() input goes through
+        // this function so some applications may wish to modify it to avoid
+        // allocating a large strm->next_in buffer and copying from it.
+        // (See also flush_pending()).
+        internal int read_buf(byte[] buf, int start, int size)
+        {
+            int len = AvailableBytesIn;
+
+            if (len > size)
+                len = size;
+            if (len == 0)
+                return 0;
+
+            AvailableBytesIn -= len;
+
+            if (dstate.WantRfc1950HeaderBytes)
+            {
+                _Adler32 = Adler.Adler32(_Adler32, InputBuffer, NextIn, len);
+            }
+            Array.Copy(InputBuffer, NextIn, buf, start, len);
+            NextIn += len;
+            TotalBytesIn += len;
+            return len;
+        }
+
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/Zlib/ZlibConstants.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/Zlib/ZlibConstants.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/Zlib/ZlibConstants.cs	(revision 12707)
@@ -0,0 +1,128 @@
+// ZlibConstants.cs
+// ------------------------------------------------------------------
+//
+// Copyright (c) 2009 Dino Chiesa and Microsoft Corporation.  
+// All rights reserved.
+//
+// This code module is part of DotNetZip, a zipfile class library.
+//
+// ------------------------------------------------------------------
+//
+// This code is licensed under the Microsoft Public License. 
+// See the file License.txt for the license details.
+// More info on: http://dotnetzip.codeplex.com
+//
+// ------------------------------------------------------------------
+//
+// last saved (in emacs): 
+// Time-stamp: <2009-November-03 18:50:19>
+//
+// ------------------------------------------------------------------
+//
+// This module defines constants used by the zlib class library.  This
+// code is derived from the jzlib implementation of zlib, but
+// significantly modified.  In keeping with the license for jzlib, the
+// copyright to that code is included here.
+//
+// ------------------------------------------------------------------
+// 
+// Copyright (c) 2000,2001,2002,2003 ymnk, JCraft,Inc. All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright 
+// notice, this list of conditions and the following disclaimer in 
+// the documentation and/or other materials provided with the distribution.
+// 
+// 3. The names of the authors may not be used to endorse or promote products
+// derived from this software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
+// INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
+// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// 
+// -----------------------------------------------------------------------
+//
+// This program is based on zlib-1.1.3; credit to authors
+// Jean-loup Gailly(jloup@gzip.org) and Mark Adler(madler@alumni.caltech.edu)
+// and contributors of zlib.
+//
+// -----------------------------------------------------------------------
+
+
+using System;
+
+namespace OfficeOpenXml.Packaging.Ionic.Zlib
+{
+    /// <summary>
+    /// A bunch of constants used in the Zlib interface.
+    /// </summary>
+    public static class ZlibConstants
+    {
+        /// <summary>
+        /// The maximum number of window bits for the Deflate algorithm.
+        /// </summary>
+        public const int WindowBitsMax = 15; // 32K LZ77 window
+
+        /// <summary>
+        /// The default number of window bits for the Deflate algorithm.
+        /// </summary>
+        public const int WindowBitsDefault = WindowBitsMax;
+
+        /// <summary>
+        /// indicates everything is A-OK
+        /// </summary>
+        public const int Z_OK = 0;
+
+        /// <summary>
+        /// Indicates that the last operation reached the end of the stream.
+        /// </summary>
+        public const int Z_STREAM_END = 1;
+
+        /// <summary>
+        /// The operation ended in need of a dictionary. 
+        /// </summary>
+        public const int Z_NEED_DICT = 2;
+
+        /// <summary>
+        /// There was an error with the stream - not enough data, not open and readable, etc.
+        /// </summary>
+        public const int Z_STREAM_ERROR = -2;
+
+        /// <summary>
+        /// There was an error with the data - not enough data, bad data, etc.
+        /// </summary>
+        public const int Z_DATA_ERROR = -3;
+
+        /// <summary>
+        /// There was an error with the working buffer.
+        /// </summary>
+        public const int Z_BUF_ERROR = -5;
+
+        /// <summary>
+        /// The size of the working buffer used in the ZlibCodec class. Defaults to 8192 bytes.
+        /// </summary>
+#if NETCF        
+        public const int WorkingBufferSizeDefault = 8192;
+#else
+        public const int WorkingBufferSizeDefault = 16384; 
+#endif
+        /// <summary>
+        /// The minimum size of the working buffer used in the ZlibCodec class.  Currently it is 128 bytes.
+        /// </summary>
+        public const int WorkingBufferSizeMin = 1024;
+    }
+
+}
+
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/Zlib/ZlibStream.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/Zlib/ZlibStream.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/DotNetZip/Zlib/ZlibStream.cs	(revision 12707)
@@ -0,0 +1,725 @@
+// ZlibStream.cs
+// ------------------------------------------------------------------
+//
+// Copyright (c) 2009 Dino Chiesa and Microsoft Corporation.
+// All rights reserved.
+//
+// This code module is part of DotNetZip, a zipfile class library.
+//
+// ------------------------------------------------------------------
+//
+// This code is licensed under the Microsoft Public License.
+// See the file License.txt for the license details.
+// More info on: http://dotnetzip.codeplex.com
+//
+// ------------------------------------------------------------------
+//
+// last saved (in emacs):
+// Time-stamp: <2011-July-31 14:53:33>
+//
+// ------------------------------------------------------------------
+//
+// This module defines the ZlibStream class, which is similar in idea to
+// the System.IO.Compression.DeflateStream and
+// System.IO.Compression.GZipStream classes in the .NET BCL.
+//
+// ------------------------------------------------------------------
+
+using System;
+using System.IO;
+
+namespace OfficeOpenXml.Packaging.Ionic.Zlib
+{
+
+    /// <summary>
+    /// Represents a Zlib stream for compression or decompression.
+    /// </summary>
+    /// <remarks>
+    ///
+    /// <para>
+    /// The ZlibStream is a <see
+    /// href="http://en.wikipedia.org/wiki/Decorator_pattern">Decorator</see> on a <see
+    /// cref="System.IO.Stream"/>.  It adds ZLIB compression or decompression to any
+    /// stream.
+    /// </para>
+    ///
+    /// <para> Using this stream, applications can compress or decompress data via
+    /// stream <c>Read()</c> and <c>Write()</c> operations.  Either compresssion or
+    /// decompression can occur through either reading or writing. The compression
+    /// format used is ZLIB, which is documented in <see
+    /// href="http://www.ietf.org/rfc/rfc1950.txt">IETF RFC 1950</see>, "ZLIB Compressed
+    /// Data Format Specification version 3.3". This implementation of ZLIB always uses
+    /// DEFLATE as the compression method.  (see <see
+    /// href="http://www.ietf.org/rfc/rfc1951.txt">IETF RFC 1951</see>, "DEFLATE
+    /// Compressed Data Format Specification version 1.3.") </para>
+    ///
+    /// <para>
+    /// The ZLIB format allows for varying compression methods, window sizes, and dictionaries.
+    /// This implementation always uses the DEFLATE compression method, a preset dictionary,
+    /// and 15 window bits by default.
+    /// </para>
+    ///
+    /// <para>
+    /// This class is similar to <see cref="DeflateStream"/>, except that it adds the
+    /// RFC1950 header and trailer bytes to a compressed stream when compressing, or expects
+    /// the RFC1950 header and trailer bytes when decompressing.  It is also similar to the
+    /// <see cref="GZipStream"/>.
+    /// </para>
+    /// </remarks>
+    /// <seealso cref="DeflateStream" />
+    /// <seealso cref="GZipStream" />
+    public class ZlibStream : System.IO.Stream
+    {
+        internal ZlibBaseStream _baseStream;
+        bool _disposed;
+
+        /// <summary>
+        /// Create a <c>ZlibStream</c> using the specified <c>CompressionMode</c>.
+        /// </summary>
+        /// <remarks>
+        ///
+        /// <para>
+        ///   When mode is <c>CompressionMode.Compress</c>, the <c>ZlibStream</c>
+        ///   will use the default compression level. The "captive" stream will be
+        ///   closed when the <c>ZlibStream</c> is closed.
+        /// </para>
+        ///
+        /// </remarks>
+        ///
+        /// <example>
+        /// This example uses a <c>ZlibStream</c> to compress a file, and writes the
+        /// compressed data to another file.
+        /// <code>
+        /// using (System.IO.Stream input = System.IO.File.OpenRead(fileToCompress))
+        /// {
+        ///     using (var raw = System.IO.File.Create(fileToCompress + ".zlib"))
+        ///     {
+        ///         using (Stream compressor = new ZlibStream(raw, CompressionMode.Compress))
+        ///         {
+        ///             byte[] buffer = new byte[WORKING_BUFFER_SIZE];
+        ///             int n;
+        ///             while ((n= input.Read(buffer, 0, buffer.Length)) != 0)
+        ///             {
+        ///                 compressor.Write(buffer, 0, n);
+        ///             }
+        ///         }
+        ///     }
+        /// }
+        /// </code>
+        /// <code lang="VB">
+        /// Using input As Stream = File.OpenRead(fileToCompress)
+        ///     Using raw As FileStream = File.Create(fileToCompress &amp; ".zlib")
+        ///     Using compressor As Stream = New ZlibStream(raw, CompressionMode.Compress)
+        ///         Dim buffer As Byte() = New Byte(4096) {}
+        ///         Dim n As Integer = -1
+        ///         Do While (n &lt;&gt; 0)
+        ///             If (n &gt; 0) Then
+        ///                 compressor.Write(buffer, 0, n)
+        ///             End If
+        ///             n = input.Read(buffer, 0, buffer.Length)
+        ///         Loop
+        ///     End Using
+        ///     End Using
+        /// End Using
+        /// </code>
+        /// </example>
+        ///
+        /// <param name="stream">The stream which will be read or written.</param>
+        /// <param name="mode">Indicates whether the ZlibStream will compress or decompress.</param>
+        public ZlibStream(System.IO.Stream stream, CompressionMode mode)
+            : this(stream, mode, CompressionLevel.Default, false)
+        {
+        }
+
+        /// <summary>
+        ///   Create a <c>ZlibStream</c> using the specified <c>CompressionMode</c> and
+        ///   the specified <c>CompressionLevel</c>.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///
+        /// <para>
+        ///   When mode is <c>CompressionMode.Decompress</c>, the level parameter is ignored.
+        ///   The "captive" stream will be closed when the <c>ZlibStream</c> is closed.
+        /// </para>
+        ///
+        /// </remarks>
+        ///
+        /// <example>
+        ///   This example uses a <c>ZlibStream</c> to compress data from a file, and writes the
+        ///   compressed data to another file.
+        ///
+        /// <code>
+        /// using (System.IO.Stream input = System.IO.File.OpenRead(fileToCompress))
+        /// {
+        ///     using (var raw = System.IO.File.Create(fileToCompress + ".zlib"))
+        ///     {
+        ///         using (Stream compressor = new ZlibStream(raw,
+        ///                                                   CompressionMode.Compress,
+        ///                                                   CompressionLevel.BestCompression))
+        ///         {
+        ///             byte[] buffer = new byte[WORKING_BUFFER_SIZE];
+        ///             int n;
+        ///             while ((n= input.Read(buffer, 0, buffer.Length)) != 0)
+        ///             {
+        ///                 compressor.Write(buffer, 0, n);
+        ///             }
+        ///         }
+        ///     }
+        /// }
+        /// </code>
+        ///
+        /// <code lang="VB">
+        /// Using input As Stream = File.OpenRead(fileToCompress)
+        ///     Using raw As FileStream = File.Create(fileToCompress &amp; ".zlib")
+        ///         Using compressor As Stream = New ZlibStream(raw, CompressionMode.Compress, CompressionLevel.BestCompression)
+        ///             Dim buffer As Byte() = New Byte(4096) {}
+        ///             Dim n As Integer = -1
+        ///             Do While (n &lt;&gt; 0)
+        ///                 If (n &gt; 0) Then
+        ///                     compressor.Write(buffer, 0, n)
+        ///                 End If
+        ///                 n = input.Read(buffer, 0, buffer.Length)
+        ///             Loop
+        ///         End Using
+        ///     End Using
+        /// End Using
+        /// </code>
+        /// </example>
+        ///
+        /// <param name="stream">The stream to be read or written while deflating or inflating.</param>
+        /// <param name="mode">Indicates whether the ZlibStream will compress or decompress.</param>
+        /// <param name="level">A tuning knob to trade speed for effectiveness.</param>
+        public ZlibStream(System.IO.Stream stream, CompressionMode mode, CompressionLevel level)
+            : this(stream, mode, level, false)
+        {
+        }
+
+        /// <summary>
+        ///   Create a <c>ZlibStream</c> using the specified <c>CompressionMode</c>, and
+        ///   explicitly specify whether the captive stream should be left open after
+        ///   Deflation or Inflation.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///
+        /// <para>
+        ///   When mode is <c>CompressionMode.Compress</c>, the <c>ZlibStream</c> will use
+        ///   the default compression level.
+        /// </para>
+        ///
+        /// <para>
+        ///   This constructor allows the application to request that the captive stream
+        ///   remain open after the deflation or inflation occurs.  By default, after
+        ///   <c>Close()</c> is called on the stream, the captive stream is also
+        ///   closed. In some cases this is not desired, for example if the stream is a
+        ///   <see cref="System.IO.MemoryStream"/> that will be re-read after
+        ///   compression.  Specify true for the <paramref name="leaveOpen"/> parameter to leave the stream
+        ///   open.
+        /// </para>
+        ///
+        /// <para>
+        /// See the other overloads of this constructor for example code.
+        /// </para>
+        ///
+        /// </remarks>
+        ///
+        /// <param name="stream">The stream which will be read or written. This is called the
+        /// "captive" stream in other places in this documentation.</param>
+        /// <param name="mode">Indicates whether the ZlibStream will compress or decompress.</param>
+        /// <param name="leaveOpen">true if the application would like the stream to remain
+        /// open after inflation/deflation.</param>
+        public ZlibStream(System.IO.Stream stream, CompressionMode mode, bool leaveOpen)
+            : this(stream, mode, CompressionLevel.Default, leaveOpen)
+        {
+        }
+
+        /// <summary>
+        ///   Create a <c>ZlibStream</c> using the specified <c>CompressionMode</c>
+        ///   and the specified <c>CompressionLevel</c>, and explicitly specify
+        ///   whether the stream should be left open after Deflation or Inflation.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///
+        /// <para>
+        ///   This constructor allows the application to request that the captive
+        ///   stream remain open after the deflation or inflation occurs.  By
+        ///   default, after <c>Close()</c> is called on the stream, the captive
+        ///   stream is also closed. In some cases this is not desired, for example
+        ///   if the stream is a <see cref="System.IO.MemoryStream"/> that will be
+        ///   re-read after compression.  Specify true for the <paramref
+        ///   name="leaveOpen"/> parameter to leave the stream open.
+        /// </para>
+        ///
+        /// <para>
+        ///   When mode is <c>CompressionMode.Decompress</c>, the level parameter is
+        ///   ignored.
+        /// </para>
+        ///
+        /// </remarks>
+        ///
+        /// <example>
+        ///
+        /// This example shows how to use a ZlibStream to compress the data from a file,
+        /// and store the result into another file. The filestream remains open to allow
+        /// additional data to be written to it.
+        ///
+        /// <code>
+        /// using (var output = System.IO.File.Create(fileToCompress + ".zlib"))
+        /// {
+        ///     using (System.IO.Stream input = System.IO.File.OpenRead(fileToCompress))
+        ///     {
+        ///         using (Stream compressor = new ZlibStream(output, CompressionMode.Compress, CompressionLevel.BestCompression, true))
+        ///         {
+        ///             byte[] buffer = new byte[WORKING_BUFFER_SIZE];
+        ///             int n;
+        ///             while ((n= input.Read(buffer, 0, buffer.Length)) != 0)
+        ///             {
+        ///                 compressor.Write(buffer, 0, n);
+        ///             }
+        ///         }
+        ///     }
+        ///     // can write additional data to the output stream here
+        /// }
+        /// </code>
+        /// <code lang="VB">
+        /// Using output As FileStream = File.Create(fileToCompress &amp; ".zlib")
+        ///     Using input As Stream = File.OpenRead(fileToCompress)
+        ///         Using compressor As Stream = New ZlibStream(output, CompressionMode.Compress, CompressionLevel.BestCompression, True)
+        ///             Dim buffer As Byte() = New Byte(4096) {}
+        ///             Dim n As Integer = -1
+        ///             Do While (n &lt;&gt; 0)
+        ///                 If (n &gt; 0) Then
+        ///                     compressor.Write(buffer, 0, n)
+        ///                 End If
+        ///                 n = input.Read(buffer, 0, buffer.Length)
+        ///             Loop
+        ///         End Using
+        ///     End Using
+        ///     ' can write additional data to the output stream here.
+        /// End Using
+        /// </code>
+        /// </example>
+        ///
+        /// <param name="stream">The stream which will be read or written.</param>
+        ///
+        /// <param name="mode">Indicates whether the ZlibStream will compress or decompress.</param>
+        ///
+        /// <param name="leaveOpen">
+        /// true if the application would like the stream to remain open after
+        /// inflation/deflation.
+        /// </param>
+        ///
+        /// <param name="level">
+        /// A tuning knob to trade speed for effectiveness. This parameter is
+        /// effective only when mode is <c>CompressionMode.Compress</c>.
+        /// </param>
+        public ZlibStream(System.IO.Stream stream, CompressionMode mode, CompressionLevel level, bool leaveOpen)
+        {
+            _baseStream = new ZlibBaseStream(stream, mode, level, ZlibStreamFlavor.ZLIB, leaveOpen);
+        }
+
+        #region Zlib properties
+
+        /// <summary>
+        /// This property sets the flush behavior on the stream.
+        /// Sorry, though, not sure exactly how to describe all the various settings.
+        /// </summary>
+        virtual public FlushType FlushMode
+        {
+            get { return (this._baseStream._flushMode); }
+            set
+            {
+                if (_disposed) throw new ObjectDisposedException("ZlibStream");
+                this._baseStream._flushMode = value;
+            }
+        }
+
+        /// <summary>
+        ///   The size of the working buffer for the compression codec.
+        /// </summary>
+        ///
+        /// <remarks>
+        /// <para>
+        ///   The working buffer is used for all stream operations.  The default size is
+        ///   1024 bytes. The minimum size is 128 bytes. You may get better performance
+        ///   with a larger buffer.  Then again, you might not.  You would have to test
+        ///   it.
+        /// </para>
+        ///
+        /// <para>
+        ///   Set this before the first call to <c>Read()</c> or <c>Write()</c> on the
+        ///   stream. If you try to set it afterwards, it will throw.
+        /// </para>
+        /// </remarks>
+        public int BufferSize
+        {
+            get
+            {
+                return this._baseStream._bufferSize;
+            }
+            set
+            {
+                if (_disposed) throw new ObjectDisposedException("ZlibStream");
+                if (this._baseStream._workingBuffer != null)
+                    throw new ZlibException("The working buffer is already set.");
+                if (value < ZlibConstants.WorkingBufferSizeMin)
+                    throw new ZlibException(String.Format("Don't be silly. {0} bytes?? Use a bigger buffer, at least {1}.", value, ZlibConstants.WorkingBufferSizeMin));
+                this._baseStream._bufferSize = value;
+            }
+        }
+
+        /// <summary> Returns the total number of bytes input so far.</summary>
+        virtual public long TotalIn
+        {
+            get { return this._baseStream._z.TotalBytesIn; }
+        }
+
+        /// <summary> Returns the total number of bytes output so far.</summary>
+        virtual public long TotalOut
+        {
+            get { return this._baseStream._z.TotalBytesOut; }
+        }
+
+        #endregion
+
+        #region System.IO.Stream methods
+
+        /// <summary>
+        ///   Dispose the stream.
+        /// </summary>
+        /// <remarks>
+        ///   <para>
+        ///     This may or may not result in a <c>Close()</c> call on the captive
+        ///     stream.  See the constructors that have a <c>leaveOpen</c> parameter
+        ///     for more information.
+        ///   </para>
+        ///   <para>
+        ///     This method may be invoked in two distinct scenarios.  If disposing
+        ///     == true, the method has been called directly or indirectly by a
+        ///     user's code, for example via the public Dispose() method. In this
+        ///     case, both managed and unmanaged resources can be referenced and
+        ///     disposed.  If disposing == false, the method has been called by the
+        ///     runtime from inside the object finalizer and this method should not
+        ///     reference other objects; in that case only unmanaged resources must
+        ///     be referenced or disposed.
+        ///   </para>
+        /// </remarks>
+        /// <param name="disposing">
+        ///   indicates whether the Dispose method was invoked by user code.
+        /// </param>
+        protected override void Dispose(bool disposing)
+        {
+            try
+            {
+                if (!_disposed)
+                {
+                    if (disposing && (this._baseStream != null))
+                        this._baseStream.Close();
+                    _disposed = true;
+                }
+            }
+            finally
+            {
+                base.Dispose(disposing);
+            }
+        }
+
+
+        /// <summary>
+        /// Indicates whether the stream can be read.
+        /// </summary>
+        /// <remarks>
+        /// The return value depends on whether the captive stream supports reading.
+        /// </remarks>
+        public override bool CanRead
+        {
+            get
+            {
+                if (_disposed) throw new ObjectDisposedException("ZlibStream");
+                return _baseStream._stream.CanRead;
+            }
+        }
+
+        /// <summary>
+        /// Indicates whether the stream supports Seek operations.
+        /// </summary>
+        /// <remarks>
+        /// Always returns false.
+        /// </remarks>
+        public override bool CanSeek
+        {
+            get { return false; }
+        }
+
+        /// <summary>
+        /// Indicates whether the stream can be written.
+        /// </summary>
+        /// <remarks>
+        /// The return value depends on whether the captive stream supports writing.
+        /// </remarks>
+        public override bool CanWrite
+        {
+            get
+            {
+                if (_disposed) throw new ObjectDisposedException("ZlibStream");
+                return _baseStream._stream.CanWrite;
+            }
+        }
+
+        /// <summary>
+        /// Flush the stream.
+        /// </summary>
+        public override void Flush()
+        {
+            if (_disposed) throw new ObjectDisposedException("ZlibStream");
+            _baseStream.Flush();
+        }
+
+        /// <summary>
+        /// Reading this property always throws a <see cref="NotSupportedException"/>.
+        /// </summary>
+        public override long Length
+        {
+            get { throw new NotSupportedException(); }
+        }
+
+        /// <summary>
+        ///   The position of the stream pointer.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///   Setting this property always throws a <see
+        ///   cref="NotSupportedException"/>. Reading will return the total bytes
+        ///   written out, if used in writing, or the total bytes read in, if used in
+        ///   reading.  The count may refer to compressed bytes or uncompressed bytes,
+        ///   depending on how you've used the stream.
+        /// </remarks>
+        public override long Position
+        {
+            get
+            {
+                if (this._baseStream._streamMode == Ionic.Zlib.ZlibBaseStream.StreamMode.Writer)
+                    return this._baseStream._z.TotalBytesOut;
+                if (this._baseStream._streamMode == Ionic.Zlib.ZlibBaseStream.StreamMode.Reader)
+                    return this._baseStream._z.TotalBytesIn;
+                return 0;
+            }
+
+            set { throw new NotSupportedException(); }
+        }
+
+        /// <summary>
+        /// Read data from the stream.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///
+        /// <para>
+        ///   If you wish to use the <c>ZlibStream</c> to compress data while reading,
+        ///   you can create a <c>ZlibStream</c> with <c>CompressionMode.Compress</c>,
+        ///   providing an uncompressed data stream.  Then call <c>Read()</c> on that
+        ///   <c>ZlibStream</c>, and the data read will be compressed.  If you wish to
+        ///   use the <c>ZlibStream</c> to decompress data while reading, you can create
+        ///   a <c>ZlibStream</c> with <c>CompressionMode.Decompress</c>, providing a
+        ///   readable compressed data stream.  Then call <c>Read()</c> on that
+        ///   <c>ZlibStream</c>, and the data will be decompressed as it is read.
+        /// </para>
+        ///
+        /// <para>
+        ///   A <c>ZlibStream</c> can be used for <c>Read()</c> or <c>Write()</c>, but
+        ///   not both.
+        /// </para>
+        ///
+        /// </remarks>
+        ///
+        /// <param name="buffer">
+        /// The buffer into which the read data should be placed.</param>
+        ///
+        /// <param name="offset">
+        /// the offset within that data array to put the first byte read.</param>
+        ///
+        /// <param name="count">the number of bytes to read.</param>
+        ///
+        /// <returns>the number of bytes read</returns>
+        public override int Read(byte[] buffer, int offset, int count)
+        {
+                if (_disposed) throw new ObjectDisposedException("ZlibStream");
+            return _baseStream.Read(buffer, offset, count);
+        }
+
+        /// <summary>
+        /// Calling this method always throws a <see cref="NotSupportedException"/>.
+        /// </summary>
+        /// <param name="offset">
+        ///   The offset to seek to....
+        ///   IF THIS METHOD ACTUALLY DID ANYTHING.
+        /// </param>
+        /// <param name="origin">
+        ///   The reference specifying how to apply the offset....  IF
+        ///   THIS METHOD ACTUALLY DID ANYTHING.
+        /// </param>
+        ///
+        /// <returns>nothing. This method always throws.</returns>
+        public override long Seek(long offset, System.IO.SeekOrigin origin)
+        {
+            throw new NotSupportedException();
+        }
+
+        /// <summary>
+        /// Calling this method always throws a <see cref="NotSupportedException"/>.
+        /// </summary>
+        /// <param name="value">
+        ///   The new value for the stream length....  IF
+        ///   THIS METHOD ACTUALLY DID ANYTHING.
+        /// </param>
+        public override void SetLength(long value)
+        {
+            throw new NotSupportedException();
+        }
+
+        /// <summary>
+        /// Write data to the stream.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///
+        /// <para>
+        ///   If you wish to use the <c>ZlibStream</c> to compress data while writing,
+        ///   you can create a <c>ZlibStream</c> with <c>CompressionMode.Compress</c>,
+        ///   and a writable output stream.  Then call <c>Write()</c> on that
+        ///   <c>ZlibStream</c>, providing uncompressed data as input.  The data sent to
+        ///   the output stream will be the compressed form of the data written.  If you
+        ///   wish to use the <c>ZlibStream</c> to decompress data while writing, you
+        ///   can create a <c>ZlibStream</c> with <c>CompressionMode.Decompress</c>, and a
+        ///   writable output stream.  Then call <c>Write()</c> on that stream,
+        ///   providing previously compressed data. The data sent to the output stream
+        ///   will be the decompressed form of the data written.
+        /// </para>
+        ///
+        /// <para>
+        ///   A <c>ZlibStream</c> can be used for <c>Read()</c> or <c>Write()</c>, but not both.
+        /// </para>
+        /// </remarks>
+        /// <param name="buffer">The buffer holding data to write to the stream.</param>
+        /// <param name="offset">the offset within that data array to find the first byte to write.</param>
+        /// <param name="count">the number of bytes to write.</param>
+        public override void Write(byte[] buffer, int offset, int count)
+        {
+                if (_disposed) throw new ObjectDisposedException("ZlibStream");
+            _baseStream.Write(buffer, offset, count);
+        }
+        #endregion
+
+
+        /// <summary>
+        ///   Compress a string into a byte array using ZLIB.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///   Uncompress it with <see cref="ZlibStream.UncompressString(byte[])"/>.
+        /// </remarks>
+        ///
+        /// <seealso cref="ZlibStream.UncompressString(byte[])"/>
+        /// <seealso cref="ZlibStream.CompressBuffer(byte[])"/>
+        /// <seealso cref="GZipStream.CompressString(string)"/>
+        ///
+        /// <param name="s">
+        ///   A string to compress.  The string will first be encoded
+        ///   using UTF8, then compressed.
+        /// </param>
+        ///
+        /// <returns>The string in compressed form</returns>
+        public static byte[] CompressString(String s)
+        {
+            using (var ms = new MemoryStream())
+            {
+                Stream compressor =
+                    new ZlibStream(ms, CompressionMode.Compress, CompressionLevel.BestCompression);
+                ZlibBaseStream.CompressString(s, compressor);
+                return ms.ToArray();
+            }
+        }
+
+
+        /// <summary>
+        ///   Compress a byte array into a new byte array using ZLIB.
+        /// </summary>
+        ///
+        /// <remarks>
+        ///   Uncompress it with <see cref="ZlibStream.UncompressBuffer(byte[])"/>.
+        /// </remarks>
+        ///
+        /// <seealso cref="ZlibStream.CompressString(string)"/>
+        /// <seealso cref="ZlibStream.UncompressBuffer(byte[])"/>
+        ///
+        /// <param name="b">
+        /// A buffer to compress.
+        /// </param>
+        ///
+        /// <returns>The data in compressed form</returns>
+        public static byte[] CompressBuffer(byte[] b)
+        {
+            using (var ms = new MemoryStream())
+            {
+                Stream compressor =
+                    new ZlibStream( ms, CompressionMode.Compress, CompressionLevel.BestCompression );
+
+                ZlibBaseStream.CompressBuffer(b, compressor);
+                return ms.ToArray();
+            }
+        }
+
+
+        /// <summary>
+        ///   Uncompress a ZLIB-compressed byte array into a single string.
+        /// </summary>
+        ///
+        /// <seealso cref="ZlibStream.CompressString(String)"/>
+        /// <seealso cref="ZlibStream.UncompressBuffer(byte[])"/>
+        ///
+        /// <param name="compressed">
+        ///   A buffer containing ZLIB-compressed data.
+        /// </param>
+        ///
+        /// <returns>The uncompressed string</returns>
+        public static String UncompressString(byte[] compressed)
+        {
+            using (var input = new MemoryStream(compressed))
+            {
+                Stream decompressor =
+                    new ZlibStream(input, CompressionMode.Decompress);
+
+                return ZlibBaseStream.UncompressString(compressed, decompressor);
+            }
+        }
+
+
+        /// <summary>
+        ///   Uncompress a ZLIB-compressed byte array into a byte array.
+        /// </summary>
+        ///
+        /// <seealso cref="ZlibStream.CompressBuffer(byte[])"/>
+        /// <seealso cref="ZlibStream.UncompressString(byte[])"/>
+        ///
+        /// <param name="compressed">
+        ///   A buffer containing ZLIB-compressed data.
+        /// </param>
+        ///
+        /// <returns>The data in uncompressed form</returns>
+        public static byte[] UncompressBuffer(byte[] compressed)
+        {
+            using (var input = new MemoryStream(compressed))
+            {
+                Stream decompressor =
+                    new ZlibStream( input, CompressionMode.Decompress );
+
+                return ZlibBaseStream.UncompressBuffer(compressed, decompressor);
+            }
+        }
+
+    }
+
+
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/ZipPackage.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/ZipPackage.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/ZipPackage.cs	(revision 12707)
@@ -0,0 +1,340 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Jan Källman		Added		25-Oct-2012
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.IO;
+using System.Xml;
+using OfficeOpenXml.Utils;
+using OfficeOpenXml.Packaging.Ionic.Zip;
+using Ionic.Zip;
+namespace OfficeOpenXml.Packaging
+{
+    /// <summary>
+    /// Specifies whether the target is inside or outside the System.IO.Packaging.Package.
+    /// </summary>
+    public enum TargetMode
+    {
+        /// <summary>
+        /// The relationship references a part that is inside the package.
+        /// </summary>
+        Internal = 0,
+        /// <summary>
+        /// The relationship references a resource that is external to the package.
+        /// </summary>
+        External = 1,
+    }
+    /// <summary>
+    /// Represent an OOXML Zip package.
+    /// </summary>
+    public class ZipPackage : ZipPackageRelationshipBase
+    {
+        internal class ContentType
+        {
+            internal string Name;
+            internal bool IsExtension;
+            internal string Match;
+            public ContentType(string name, bool isExtension, string match)
+            {
+                Name = name;
+                IsExtension = isExtension;
+                Match = match;
+            }
+        }
+        Dictionary<string, ZipPackagePart> Parts = new Dictionary<string, ZipPackagePart>(StringComparer.InvariantCultureIgnoreCase);
+        internal Dictionary<string, ContentType> _contentTypes = new Dictionary<string, ContentType>(StringComparer.InvariantCultureIgnoreCase);
+        internal ZipPackage()
+        {
+            AddNew();
+        }
+
+        private void AddNew()
+        {
+            _contentTypes.Add("xml", new ContentType(ExcelPackage.schemaXmlExtension, true, "xml"));
+            _contentTypes.Add("rels", new ContentType(ExcelPackage.schemaRelsExtension, true, "rels"));
+        }
+
+        internal ZipPackage(Stream stream)
+        {
+            bool hasContentTypeXml = false;
+            if (stream == null || stream.Length == 0)
+            {
+                AddNew();
+            }
+            else
+            {
+                var rels = new Dictionary<string, string>();
+                stream.Seek(0, SeekOrigin.Begin);                
+                using (ZipInputStream zip = new ZipInputStream(stream))
+                {
+                    var e = zip.GetNextEntry();
+                    while (e != null)
+                    {
+                        if (e.UncompressedSize > 0)
+                        {
+                            var b = new byte[e.UncompressedSize];
+                            var size = zip.Read(b, 0, (int)e.UncompressedSize);
+                            if (e.FileName.Equals("[content_types].xml", StringComparison.InvariantCultureIgnoreCase))
+                            {
+                                AddContentTypes(Encoding.UTF8.GetString(b));
+                                hasContentTypeXml = true;
+                            }
+                            else if (e.FileName.Equals("_rels/.rels", StringComparison.InvariantCultureIgnoreCase)) 
+                            {
+                                ReadRelation(Encoding.UTF8.GetString(b), "");
+                            }
+                            else
+                            {
+                                if (e.FileName.EndsWith(".rels", StringComparison.InvariantCultureIgnoreCase))
+                                {
+                                    rels.Add(GetUriKey(e.FileName), Encoding.UTF8.GetString(b));
+                                }
+                                else
+                                {
+                                    var part = new ZipPackagePart(this, e);
+                                    part.Stream = new MemoryStream();
+                                    part.Stream.Write(b, 0, b.Length);
+                                    Parts.Add(GetUriKey(e.FileName), part);
+                                }
+                            }
+                        }
+                        else
+                        {
+                        }
+                        e = zip.GetNextEntry();
+                    }
+
+                    foreach (var p in Parts)
+                    {
+                        FileInfo fi = new FileInfo(p.Key);
+                        string relFile = string.Format("{0}_rels/{1}.rels", p.Key.Substring(0, p.Key.Length - fi.Name.Length), fi.Name);
+                        if (rels.ContainsKey(relFile))
+                        {
+                            p.Value.ReadRelation(rels[relFile], p.Value.Uri.OriginalString);
+                        }
+                        if (_contentTypes.ContainsKey(p.Key))
+                        {
+                            p.Value.ContentType = _contentTypes[p.Key].Name;
+                        }
+                        else if (fi.Extension.Length > 1 && _contentTypes.ContainsKey(fi.Extension.Substring(1)))
+                        {
+                            p.Value.ContentType = _contentTypes[fi.Extension.Substring(1)].Name;
+                        }
+                    }
+                    if (!hasContentTypeXml)
+                    {
+                        throw (new FileFormatException("The file is not an valid Package file. If the file is encrypted, please supply the password in the constructor."));
+                    }
+                    if (!hasContentTypeXml)
+                    {
+                        throw (new FileFormatException("The file is not an valid Package file. If the file is encrypted, please supply the password in the constructor."));
+                    }
+                    zip.Close();
+                }
+            }
+        }
+
+        private void AddContentTypes(string xml)
+        {
+            var doc = new XmlDocument();
+            XmlHelper.LoadXmlSafe(doc, xml, Encoding.UTF8);
+
+            foreach (XmlElement c in doc.DocumentElement.ChildNodes)
+            {
+                ContentType ct;
+                if (string.IsNullOrEmpty(c.GetAttribute("Extension")))
+                {
+                    ct = new ContentType(c.GetAttribute("ContentType"), false, c.GetAttribute("PartName"));
+                }
+                else
+                {
+                    ct = new ContentType(c.GetAttribute("ContentType"), true, c.GetAttribute("Extension"));
+                }
+                _contentTypes.Add(GetUriKey(ct.Match), ct);
+            }
+        }
+
+        #region Methods
+        internal ZipPackagePart CreatePart(Uri partUri, string contentType)
+        {
+            return CreatePart(partUri, contentType, CompressionLevel.Default);
+        }
+        internal ZipPackagePart CreatePart(Uri partUri, string contentType, CompressionLevel compressionLevel)
+        {
+            if (PartExists(partUri))
+            {
+                throw (new InvalidOperationException("Part already exist"));
+            }
+
+            var part = new ZipPackagePart(this, partUri, contentType, compressionLevel);
+            _contentTypes.Add(GetUriKey(part.Uri.OriginalString), new ContentType(contentType, false, part.Uri.OriginalString));
+            Parts.Add(GetUriKey(part.Uri.OriginalString), part);
+            return part;
+        }
+        internal ZipPackagePart GetPart(Uri partUri)
+        {
+            if (PartExists(partUri))
+            {
+                return Parts.Single(x => x.Key.Equals(GetUriKey(partUri.OriginalString),StringComparison.InvariantCultureIgnoreCase)).Value;
+            }
+            else
+            {
+                throw (new InvalidOperationException("Part does not exist."));
+            }
+        }
+
+        internal string GetUriKey(string uri)
+        {
+            string ret = uri;
+            if (ret[0] != '/')
+            {
+                ret = "/" + ret;
+            }
+            return ret;
+        }
+        internal bool PartExists(Uri partUri)
+        {
+            var uriKey = GetUriKey(partUri.OriginalString.ToLower(CultureInfo.InvariantCulture));
+            return Parts.Keys.Any(x => x.Equals(uriKey, StringComparison.InvariantCultureIgnoreCase));
+        }
+        #endregion
+
+        internal void DeletePart(Uri Uri)
+        {
+            var delList=new List<object[]>(); 
+            foreach (var p in Parts.Values)
+            {
+                foreach (var r in p.GetRelationships())
+                {
+                    if (UriHelper.ResolvePartUri(p.Uri, r.TargetUri).OriginalString.Equals(Uri.OriginalString, StringComparison.InvariantCultureIgnoreCase))
+                    {                        
+                        delList.Add(new object[]{r.Id, p});
+                    }
+                }
+            }
+            foreach (var o in delList)
+            {
+                ((ZipPackagePart)o[1]).DeleteRelationship(o[0].ToString());
+            }
+            var rels = GetPart(Uri).GetRelationships();
+            while (rels.Count > 0)
+            {
+                rels.Remove(rels.First().Id);
+            }
+            rels=null;
+            _contentTypes.Remove(GetUriKey(Uri.OriginalString));
+            //remove all relations
+            Parts.Remove(GetUriKey(Uri.OriginalString));
+            
+        }
+        internal void Save(Stream stream)
+        {
+            var enc = Encoding.UTF8;
+            ZipOutputStream os = new ZipOutputStream(stream, true);
+            os.CompressionLevel = (OfficeOpenXml.Packaging.Ionic.Zlib.CompressionLevel)_compression;            
+            /**** ContentType****/
+            var entry = os.PutNextEntry("[Content_Types].xml");
+            byte[] b = enc.GetBytes(GetContentTypeXml());
+            os.Write(b, 0, b.Length);
+            /**** Top Rels ****/
+            _rels.WriteZip(os, "_rels\\.rels");
+            ZipPackagePart ssPart=null;
+            foreach(var part in Parts.Values)
+            {
+                if (part.ContentType != ExcelPackage.contentTypeSharedString)
+                {
+                    part.WriteZip(os);
+                }
+                else
+                {
+                    ssPart = part;
+                }
+            }
+            //Shared strings must be saved after all worksheets. The ss dictionary is populated when that workheets are saved (to get the best performance).
+            if (ssPart != null)
+            {
+                ssPart.WriteZip(os);
+            }
+            os.Flush();
+            os.Close();
+            os.Dispose();  
+            
+            //return ms;
+        }
+
+        private string GetContentTypeXml()
+        {
+            StringBuilder xml = new StringBuilder("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><Types xmlns=\"http://schemas.openxmlformats.org/package/2006/content-types\">");
+            foreach (ContentType ct in _contentTypes.Values)
+            {
+                if (ct.IsExtension)
+                {
+                    xml.AppendFormat("<Default ContentType=\"{0}\" Extension=\"{1}\"/>", ct.Name, ct.Match);
+                }
+                else
+                {
+                    xml.AppendFormat("<Override ContentType=\"{0}\" PartName=\"{1}\" />", ct.Name, GetUriKey(ct.Match));
+                }
+            }
+            xml.Append("</Types>");
+            return xml.ToString();
+        }
+        internal void Flush()
+        {
+
+        }
+        internal void Close()
+        {
+            
+        }
+        CompressionLevel _compression = CompressionLevel.Default;
+        public CompressionLevel Compression 
+        { 
+            get
+            {
+                return _compression;
+            }
+            set
+            {
+                foreach (var part in Parts.Values)
+                {
+                    if (part.CompressionLevel == _compression)
+                    {
+                        part.CompressionLevel = value;
+                    }
+                }
+                _compression = value;
+            }
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/ZipPackagePart.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/ZipPackagePart.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/ZipPackagePart.cs	(revision 12707)
@@ -0,0 +1,170 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Jan Källman		Added		25-Oct-2012
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.IO;
+using OfficeOpenXml.Packaging.Ionic.Zip;
+
+namespace OfficeOpenXml.Packaging
+{
+    internal class ZipPackagePart : ZipPackageRelationshipBase, IDisposable
+    {
+        internal delegate void SaveHandlerDelegate(ZipOutputStream stream, CompressionLevel compressionLevel, string fileName);
+
+        internal ZipPackagePart(ZipPackage package, ZipEntry entry)
+        {
+            Package = package;
+            Entry = entry;
+            SaveHandler = null;
+            Uri = new Uri(package.GetUriKey(entry.FileName), UriKind.Relative);
+        }
+        internal ZipPackagePart(ZipPackage package, Uri partUri, string contentType, CompressionLevel compressionLevel)
+        {
+            Package = package;
+            //Entry = new ZipEntry();
+            //Entry.FileName = partUri.OriginalString.Replace('/','\\');
+            Uri = partUri;
+            ContentType = contentType;
+            CompressionLevel = compressionLevel;
+        }
+        internal ZipPackage Package { get; set; }
+        internal ZipEntry Entry { get; set; }
+        internal CompressionLevel CompressionLevel;
+        MemoryStream _stream = null;
+        internal MemoryStream Stream
+        {
+            get
+            {
+                return _stream;
+            }
+            set
+            {
+                _stream = value;
+            }
+        }
+        internal override ZipPackageRelationship CreateRelationship(Uri targetUri, TargetMode targetMode, string relationshipType)
+        {
+
+            var rel = base.CreateRelationship(targetUri, targetMode, relationshipType);
+            rel.SourceUri = Uri;
+            return rel;
+        }
+        internal MemoryStream GetStream()
+        {
+            return GetStream(FileMode.OpenOrCreate, FileAccess.ReadWrite);
+        }
+        internal MemoryStream GetStream(FileMode fileMode)
+        {
+            return GetStream(FileMode.Create, FileAccess.ReadWrite);
+        }
+        internal MemoryStream GetStream(FileMode fileMode, FileAccess fileAccess)
+        {
+            if (_stream == null || fileMode == FileMode.CreateNew || fileMode == FileMode.Create)
+            {
+                _stream = new MemoryStream();
+            }
+            else
+            {
+                _stream.Seek(0, SeekOrigin.Begin);                
+            }
+            return _stream;
+        }
+
+        string _contentType = "";
+        public string ContentType
+        {
+            get
+            {
+                return _contentType;
+            }
+            internal set
+            {
+                if (!string.IsNullOrEmpty(_contentType))
+                {
+                    if (Package._contentTypes.ContainsKey(Package.GetUriKey(Uri.OriginalString)))
+                    {
+                        Package._contentTypes.Remove(Package.GetUriKey(Uri.OriginalString));
+                        Package._contentTypes.Add(Package.GetUriKey(Uri.OriginalString), new ZipPackage.ContentType(value, false, Uri.OriginalString));
+                    }
+                }
+                _contentType = value;
+            }
+        }
+        public Uri Uri { get; private set; }
+        public Stream GetZipStream()
+        {
+            MemoryStream ms = new MemoryStream();
+            ZipOutputStream os = new ZipOutputStream(ms);
+            return os;
+        }
+        internal SaveHandlerDelegate SaveHandler
+        {
+            get;
+            set;
+        }
+        internal void WriteZip(ZipOutputStream os)
+        {
+            byte[] b;
+            if (SaveHandler == null)
+            {
+                b = GetStream().ToArray();
+                if (b.Length == 0)   //Make sure the file isn't empty. DotNetZip streams does not seems to handle zero sized files.
+                {
+                    return;
+                }
+                os.CompressionLevel = (OfficeOpenXml.Packaging.Ionic.Zlib.CompressionLevel)CompressionLevel;
+                os.PutNextEntry(Uri.OriginalString);
+                os.Write(b, 0, b.Length);
+            }
+            else
+            {
+                SaveHandler(os, (CompressionLevel)CompressionLevel, Uri.OriginalString);
+            }
+
+            if (_rels.Count > 0)
+            {
+                string f = Uri.OriginalString;
+                var fi = new FileInfo(f);
+                _rels.WriteZip(os, (string.Format("{0}_rels/{1}.rels", f.Substring(0, f.Length - fi.Name.Length), fi.Name)));
+            }
+            b = null;
+        }
+
+
+        public void Dispose()
+        {
+            _stream.Close();
+            _stream.Dispose();
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/ZipPackageRelationship.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/ZipPackageRelationship.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/ZipPackageRelationship.cs	(revision 12707)
@@ -0,0 +1,50 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Jan Källman		Added		25-Oct-2012
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.Packaging
+{
+    public class ZipPackageRelationship
+    {
+        public Uri TargetUri { get; internal set; }
+
+        public Uri SourceUri { get; internal set; }
+
+        public string RelationshipType { get; internal set; }
+
+        public TargetMode TargetMode { get; internal set; }
+
+        public string Id { get; internal set; }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/ZipPackageRelationshipBase.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/ZipPackageRelationshipBase.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/ZipPackageRelationshipBase.cs	(revision 12707)
@@ -0,0 +1,131 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Jan Källman		Added		25-Oct-2012
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Ionic.Zip;
+using System.IO;
+using System.Xml;
+using OfficeOpenXml.Packaging.Ionic.Zlib;
+using System.Web;
+namespace OfficeOpenXml.Packaging
+{
+    public abstract class ZipPackageRelationshipBase
+    {
+        protected ZipPackageRelationshipCollection _rels = new ZipPackageRelationshipCollection();
+        protected internal 
+        int maxRId = 1;
+        internal void DeleteRelationship(string id)
+        {
+            _rels.Remove(id);
+            UpdateMaxRId(id, ref maxRId);
+        }
+        protected void UpdateMaxRId(string id, ref int maxRId)
+        {
+            if (id.StartsWith("rId"))
+            {
+                int num;
+                if (int.TryParse(id.Substring(3), out num))
+                {
+                    if (num == maxRId - 1)
+                    {
+                        maxRId--;
+                    }
+                }
+            }
+        }
+        internal virtual ZipPackageRelationship CreateRelationship(Uri targetUri, TargetMode targetMode, string relationshipType)
+        {
+            var rel = new ZipPackageRelationship();
+            rel.TargetUri = targetUri;
+            rel.TargetMode = targetMode;
+            rel.RelationshipType = relationshipType;
+            rel.Id = "rId" + (maxRId++).ToString();
+            _rels.Add(rel);
+            return rel;
+        }
+        internal bool RelationshipExists(string id)
+        {
+            return _rels.ContainsKey(id);
+        }
+        internal ZipPackageRelationshipCollection GetRelationshipsByType(string schema)
+        {
+            return _rels.GetRelationshipsByType(schema);
+        }
+        internal ZipPackageRelationshipCollection GetRelationships()
+        {
+            return _rels;
+        }
+        internal ZipPackageRelationship GetRelationship(string id)
+        {
+            return _rels[id];
+        }
+        internal void ReadRelation(string xml, string source)
+        {
+            var doc = new XmlDocument();
+            XmlHelper.LoadXmlSafe(doc, xml, Encoding.UTF8);
+
+            foreach (XmlElement c in doc.DocumentElement.ChildNodes)
+            {
+                var rel = new ZipPackageRelationship();
+                rel.Id = c.GetAttribute("Id");
+                rel.RelationshipType = c.GetAttribute("Type");
+                rel.TargetMode = c.GetAttribute("TargetMode").Equals("external",StringComparison.InvariantCultureIgnoreCase) ? TargetMode.External : TargetMode.Internal;
+                try
+                {
+                    rel.TargetUri = new Uri(c.GetAttribute("Target"), UriKind.RelativeOrAbsolute);
+                }
+                catch
+                {
+                    //The URI is not a valid URI. Encode it to make i valid.
+                    rel.TargetUri = new Uri(Uri.EscapeUriString("Invalid:URI "+c.GetAttribute("Target")), UriKind.RelativeOrAbsolute);
+                }
+                if (!string.IsNullOrEmpty(source))
+                {
+                    rel.SourceUri = new Uri(source, UriKind.Relative);
+                }
+                if (rel.Id.StartsWith("rid", StringComparison.InvariantCultureIgnoreCase))
+                {
+                    int id;
+                    if (int.TryParse(rel.Id.Substring(3), out id))
+                    {
+                        if (id >= maxRId && id < int.MaxValue - 10000) //Not likly to have this high id's but make sure we have space to avoid overflow.
+                        {
+                            maxRId = id + 1;
+                        }
+                    }
+                }
+                _rels.Add(rel);
+            }
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/ZipPackageRelationshipCollection.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/ZipPackageRelationshipCollection.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Packaging/ZipPackageRelationshipCollection.cs	(revision 12707)
@@ -0,0 +1,109 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Jan Källman		Added		25-Oct-2012
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Ionic.Zip;
+using System.IO;
+using System.Security;
+using OfficeOpenXml.Packaging.Ionic.Zip;
+
+namespace OfficeOpenXml.Packaging
+{
+    public class ZipPackageRelationshipCollection : IEnumerable<ZipPackageRelationship>
+    {
+        internal protected Dictionary<string, ZipPackageRelationship> _rels = new Dictionary<string, ZipPackageRelationship>(StringComparer.InvariantCultureIgnoreCase);
+        internal void Add(ZipPackageRelationship item)
+        {
+            _rels.Add(item.Id, item);
+        }
+        public IEnumerator<ZipPackageRelationship> GetEnumerator()
+        {
+            return _rels.Values.GetEnumerator();
+        }
+
+        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
+        {
+            return _rels.Values.GetEnumerator();
+        }
+
+        internal void Remove(string id)
+        {
+            _rels.Remove(id);
+        }
+        internal bool ContainsKey(string id)
+        {
+            return _rels.ContainsKey(id);
+        }
+        internal ZipPackageRelationship this[string id]
+        {
+            get
+            {
+                return _rels[id];
+            }
+        }
+        internal ZipPackageRelationshipCollection GetRelationshipsByType(string relationshipType)
+        {
+            var ret = new ZipPackageRelationshipCollection();
+            foreach (var rel in _rels.Values)
+            {
+                if (rel.RelationshipType == relationshipType)
+                {
+                    ret.Add(rel);
+                }
+            }
+            return ret;
+        }
+
+        internal void WriteZip(ZipOutputStream os, string fileName)
+        {
+            StringBuilder xml = new StringBuilder("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\">");
+            foreach (var rel in _rels.Values)
+            {
+                xml.AppendFormat("<Relationship Id=\"{0}\" Type=\"{1}\" Target=\"{2}\"{3}/>", SecurityElement.Escape(rel.Id), rel.RelationshipType, SecurityElement.Escape(rel.TargetUri.OriginalString), rel.TargetMode == TargetMode.External ? " TargetMode=\"External\"" : "");
+            }
+            xml.Append("</Relationships>");
+
+            os.PutNextEntry(fileName);
+            byte[] b = Encoding.UTF8.GetBytes(xml.ToString());
+            os.Write(b, 0, b.Length);
+        }
+
+        public int Count
+        {
+            get
+            {
+                return _rels.Count;
+            }
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Properties/AssemblyInfo.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Properties/AssemblyInfo.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Properties/AssemblyInfo.cs	(revision 12707)
@@ -0,0 +1,65 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Jan Källman		Added		10-SEP-2009
+ * Jan Källman		License changed GPL-->LGPL 2011-12-27
+ *******************************************************************************/
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Security;
+
+// 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("EPPlus 4.0.3")]
+[assembly: AssemblyDescription("Allows Excel files(xlsx;xlsm) to be created on the server. See epplus.codeplex.com")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("EPPlus")]
+[assembly: AssemblyProduct("EPPlus 4.0.3")]
+[assembly: AssemblyCopyright("Copyright 2009- ©Jan Källman. Parts of the Interface comes from ExcelPackage-project")]
+[assembly: AssemblyTrademark("The GNU Lesser General Public License (LGPL)")]
+[assembly: AssemblyCulture("")]
+[assembly: ComVisible(false)]
+[assembly: InternalsVisibleTo("EPPlusTest, PublicKey=00240000048000009400000006020000002400005253413100040000010001001dd11308ec93a6ebcec727e183a8972dc6f95c23ecc34aa04f40cbfc9c17b08b4a0ea5c00dcd203bace44d15a30ce8796e38176ae88e960ceff9cc439ab938738ba0e603e3d155fc298799b391c004fc0eb4393dd254ce25db341eb43303e4c488c9500e126f1288594f0710ec7d642e9c72e76dd860649f1c48249c00e31fba")]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("9dd43b8d-c4fe-4a8b-ad6e-47ef83bbbb01")]
+
+// 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 Revision and Build Numbers 
+// by using the '*' as shown below:
+[assembly: AssemblyVersion("4.0.3.0")]
+[assembly: AssemblyFileVersion("4.0.3.0")]
+[assembly: AllowPartiallyTrustedCallers]
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/RangeCollection.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/RangeCollection.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/RangeCollection.cs	(revision 12707)
@@ -0,0 +1,337 @@
+﻿
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		    Added       		        2010-02-04
+ * Jan Källman		    License changed GPL-->LGPL  2011-12-27
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Collections;
+using OfficeOpenXml.Drawing.Vml;namespace OfficeOpenXml
+{
+    /// <summary>
+    /// This is the store for all Rows, Columns and Cells.
+    /// It is a Dictionary implementation that allows you to change the Key (the RowID, ColumnID or CellID )
+    /// </summary>
+    internal class RangeCollection : IEnumerator<IRangeID>, IEnumerable, IDisposable
+    {
+        private class IndexItem
+        {
+            internal IndexItem(ulong cellId)
+            {
+                RangeID = cellId;
+            }
+            internal IndexItem(ulong cellId, int listPointer)
+	        {
+                RangeID = cellId;
+                ListPointer=listPointer;
+	        }
+            internal ulong RangeID;
+            internal int ListPointer;
+        }
+        /// <summary>
+        /// Compares an IndexItem
+        /// </summary>
+        internal class Compare : IComparer<IndexItem>
+        {
+            #region IComparer<IndexItem> Members
+            int IComparer<IndexItem>.Compare(IndexItem x, IndexItem y)
+            {
+                return x.RangeID < y.RangeID ? -1 : x.RangeID > y.RangeID ? 1 : 0;
+            }
+
+            #endregion
+        }
+        IndexItem[] _cellIndex;
+        List<IRangeID> _cells;
+        static readonly Compare _comparer=new Compare(); 
+        /// <summary>
+        /// Creates a new collection
+        /// </summary>
+        /// <param name="cells">The Cells. This list must be sorted</param>
+        internal RangeCollection(List<IRangeID> cells)
+        {   
+            _cells = cells;
+            InitSize(_cells);
+            for (int i = 0; i < _cells.Count; i++)
+            {
+                _cellIndex[i] = new IndexItem(cells[i].RangeID, i);
+            }
+        }
+        ~RangeCollection()
+        {
+            _cells = null;
+            _cellIndex = null;
+        }
+        /// <summary>
+        /// Return the item with the RangeID
+        /// </summary>
+        /// <param name="RangeID"></param>
+        /// <returns></returns>
+        internal IRangeID this[ulong RangeID]
+        {
+            get
+            {
+                return _cells[_cellIndex[IndexOf(RangeID)].ListPointer];
+            }
+        }
+        /// <summary>
+        /// Return specified index from the sorted list
+        /// </summary>
+        /// <param name="Index"></param>
+        /// <returns></returns>
+        internal IRangeID this[int Index]
+        {
+            get
+            {
+                return _cells[_cellIndex[Index].ListPointer];
+            }
+        }
+        internal int Count
+        {
+            get
+            {
+                return _cells.Count;
+            }
+        }
+        internal void Add(IRangeID cell)
+        {
+            var ix = IndexOf(cell.RangeID);
+            if (ix >= 0)
+            {
+                throw (new Exception("Item already exists"));
+            }
+            Insert(~ix, cell);
+        }
+        internal void Delete(ulong key)
+        {
+            var ix = IndexOf(key);
+            if (ix < 0)
+            {
+                throw (new Exception("Key does not exists"));
+            }
+            int listPointer = _cellIndex[ix].ListPointer;
+            Array.Copy(_cellIndex, ix + 1, _cellIndex, ix, _cells.Count - ix - 1);
+            _cells.RemoveAt(listPointer);
+
+            //Item is removed subtract one from all items with greater ListPointer
+            for (int i = 0; i < _cells.Count; i++)
+            {
+                if (_cellIndex[i].ListPointer >= listPointer)
+                {
+                    _cellIndex[i].ListPointer--;
+                }
+
+            }
+        }
+        internal int IndexOf(ulong key)
+        {
+            return Array.BinarySearch<IndexItem>(_cellIndex, 0, _cells.Count, new IndexItem(key), _comparer);
+        }
+        internal bool ContainsKey(ulong key)
+        {
+            return IndexOf(key) < 0 ? false : true;
+        }
+        int _size { get; set; }
+        #region "RangeID manipulation methods"
+        /// <summary>
+        /// Insert a number of rows in the collecion but dont update the cell only the index
+        /// </summary>
+        /// <param name="rowID"></param>
+        /// <param name="rows"></param>
+        /// <returns>Index of first rangeItem</returns>
+        internal int InsertRowsUpdateIndex(ulong rowID, int rows)
+        {
+            int index = IndexOf(rowID);
+            if (index < 0) index = ~index; //No match found invert to get start cell
+            ulong rowAdd = (((ulong)rows) << 29);
+            for (int i = index; i < _cells.Count; i++)
+            {
+                _cellIndex[i].RangeID += rowAdd;
+            }
+            return index;
+        }
+        /// <summary>
+        /// Insert a number of rows in the collecion
+        /// </summary>
+        /// <param name="rowID"></param>
+        /// <param name="rows"></param>
+        /// <returns>Index of first rangeItem</returns>
+        internal int InsertRows(ulong rowID, int rows)
+        {
+            int index = IndexOf(rowID);
+            if (index < 0) index = ~index; //No match found invert to get start cell
+            ulong rowAdd=(((ulong)rows) << 29);
+            for (int i = index; i < _cells.Count; i++)
+            {
+                _cellIndex[i].RangeID += rowAdd;
+                _cells[_cellIndex[i].ListPointer].RangeID += rowAdd;
+            }
+            return index;
+        }
+        /// <summary>
+        /// Delete rows from the collecion
+        /// </summary>
+        /// <param name="rowID"></param>
+        /// <param name="rows"></param>
+        /// <param name="updateCells">Update range id's on cells</param>
+        internal int DeleteRows(ulong rowID, int rows, bool updateCells)
+        {
+            ulong rowAdd = (((ulong)rows) << 29);
+            var index = IndexOf(rowID);
+            if (index < 0) index = ~index; //No match found invert to get start cell
+
+            if (index >= _cells.Count || _cellIndex[index] == null) return -1;   //No row above this row
+            while (index < _cells.Count && _cellIndex[index].RangeID < rowID + rowAdd)
+            {
+                Delete(_cellIndex[index].RangeID);
+            }
+
+            int updIndex = IndexOf(rowID + rowAdd);
+            if (updIndex < 0) updIndex = ~updIndex; //No match found invert to get start cell
+
+            for (int i = updIndex; i < _cells.Count; i++)
+            {
+                _cellIndex[i].RangeID -= rowAdd;                        //Change the index
+                if (updateCells) _cells[_cellIndex[i].ListPointer].RangeID -= rowAdd;    //Change the cell/row or column object
+            }
+            return index;
+        }
+        internal void InsertColumn(ulong ColumnID, int columns)
+        {
+            throw (new Exception("Working on it..."));
+        }
+        internal void DeleteColumn(ulong ColumnID,int columns)
+        {
+            throw (new Exception("Working on it..."));
+        }
+        #endregion
+        #region "Private Methods"
+        /// <summary>
+        /// Init the size starting from 128 items. Double the size until the list fits.
+        /// </summary>
+        /// <param name="_cells"></param>
+        private void InitSize(List<IRangeID> _cells)
+        {
+            _size = 128;
+            while (_cells.Count > _size) _size <<= 1;
+            _cellIndex = new IndexItem[_size];
+        }
+        /// <summary>
+        /// Check the size and double the size if out of bound
+        /// </summary>
+        private void CheckSize()
+        {
+            if (_cells.Count >= _size)
+            {
+                _size <<= 1;
+                Array.Resize(ref _cellIndex, _size);
+            }
+        }
+        private void Insert(int ix, IRangeID cell)
+        {
+            CheckSize();
+            Array.Copy(_cellIndex, ix, _cellIndex, ix + 1, _cells.Count - ix);
+            _cellIndex[ix] = new IndexItem(cell.RangeID, _cells.Count);
+            _cells.Add(cell);
+        }
+        #endregion
+
+        #region IEnumerator<IRangeID> Members
+
+        IRangeID IEnumerator<IRangeID>.Current
+        {
+            get { throw new NotImplementedException(); }
+        }
+
+        #endregion
+
+        #region IDisposable for the enumerator Members
+
+        void IDisposable.Dispose()
+        {
+            _ix = -1;
+        }
+
+        #endregion
+
+        #region IEnumerator Members
+        int _ix = -1;
+        object IEnumerator.Current
+        {
+            get 
+            {
+                return _cells[_cellIndex[_ix].ListPointer];
+            }
+        }
+
+        bool IEnumerator.MoveNext()
+        {
+           _ix++;
+           return _ix < _cells.Count;
+        }
+
+        void IEnumerator.Reset()
+        {
+            _ix = -1;
+        }
+
+        #endregion
+
+        #region IEnumerable Members
+
+        IEnumerator IEnumerable.GetEnumerator()
+        {
+            return this.MemberwiseClone() as IEnumerator;
+        }
+
+        #endregion
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/Dxf/DxfStyleBase.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/Dxf/DxfStyleBase.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/Dxf/DxfStyleBase.cs	(revision 12707)
@@ -0,0 +1,98 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Xml;
+
+namespace OfficeOpenXml.Style.Dxf
+{
+    public abstract class DxfStyleBase<T>
+    {
+        protected ExcelStyles _styles;
+        internal DxfStyleBase(ExcelStyles styles)
+        {
+            _styles = styles;
+            AllowChange = false; //Don't touch this value in the styles.xml (by default). When Dxfs is fully implemented this can be removed.
+        }
+        protected internal abstract string Id { get; }
+        protected internal abstract bool HasValue{get;}
+        protected internal abstract void CreateNodes(XmlHelper helper, string path);
+        protected internal abstract T Clone();
+        protected void SetValueColor(XmlHelper helper,string path, ExcelDxfColor color)
+        {
+            if (color != null && color.HasValue)
+            {
+                if (color.Color != null)
+                {
+                    SetValue(helper, path + "/@rgb", color.Color.Value.ToArgb().ToString("x"));
+                }
+                else if (color.Auto != null)
+                {
+                    SetValueBool(helper, path + "/@auto", color.Auto);
+                }
+                else if (color.Theme != null)
+                {
+                    SetValue(helper, path + "/@theme", color.Theme);
+                }
+                else if (color.Index != null)
+                {
+                    SetValue(helper, path + "/@indexed", color.Index);
+                }
+                if (color.Tint != null)
+                {
+                    SetValue(helper, path + "/@tint", color.Tint);
+                }
+            }
+        }
+        /// <summary>
+        /// Same as SetValue but will set first char to lower case.
+        /// </summary>
+        /// <param name="helper"></param>
+        /// <param name="path"></param>
+        /// <param name="v"></param>
+        protected void SetValueEnum(XmlHelper helper, string path, Enum v)
+        {
+            if (v == null)
+            {
+                helper.DeleteNode(path);
+            }
+            else
+            {
+                var s = v.ToString();
+                s = s.Substring(0, 1).ToLower(CultureInfo.InvariantCulture) + s.Substring(1);
+                helper.SetXmlNodeString(path, s);
+            }
+        }
+        protected void SetValue(XmlHelper helper, string path, object v)
+        {
+            if (v == null)
+            {
+                helper.DeleteNode(path);
+            }
+            else
+            {
+                helper.SetXmlNodeString(path, v.ToString());
+            }
+        }
+        protected void SetValueBool(XmlHelper helper, string path, bool? v)
+        {
+            if (v == null)
+            {
+                helper.DeleteNode(path);
+            }
+            else
+            {
+                helper.SetXmlNodeBool(path, (bool)v);
+            }
+        }
+        protected internal string GetAsString(object v)
+        {
+            return (v ?? "").ToString();
+        }
+        /// <summary>
+        /// Is this value allowed to be changed?
+        /// </summary>
+        protected internal bool AllowChange { get; set; }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/Dxf/ExcelDxfBorder.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/Dxf/ExcelDxfBorder.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/Dxf/ExcelDxfBorder.cs	(revision 12707)
@@ -0,0 +1,106 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Xml;
+
+namespace OfficeOpenXml.Style.Dxf
+{
+    public class ExcelDxfBorderBase : DxfStyleBase<ExcelDxfBorderBase>
+    {
+        internal ExcelDxfBorderBase(ExcelStyles styles)
+            : base(styles)
+        {
+            Left=new ExcelDxfBorderItem(_styles);
+            Right = new ExcelDxfBorderItem(_styles);
+            Top = new ExcelDxfBorderItem(_styles);
+            Bottom = new ExcelDxfBorderItem(_styles);
+        }
+        /// <summary>
+        /// Left border style
+        /// </summary>
+        public ExcelDxfBorderItem Left
+        {
+            get;
+            internal set;
+        }
+        /// <summary>
+        /// Right border style
+        /// </summary>
+        public ExcelDxfBorderItem Right
+        {
+            get;
+            internal set;
+        }
+        /// <summary>
+        /// Top border style
+        /// </summary>
+        public ExcelDxfBorderItem Top
+        {
+            get;
+            internal set;
+        }
+        /// <summary>
+        /// Bottom border style
+        /// </summary>
+        public ExcelDxfBorderItem Bottom
+        {
+            get;
+            internal set;
+        }
+        ///// <summary>
+        ///// Diagonal border style
+        ///// </summary>
+        //public ExcelDxfBorderItem Diagonal
+        //{
+        //    get;
+        //    private set;
+        //}
+        ///// <summary>
+        ///// A diagonal from the bottom left to top right of the cell
+        ///// </summary>
+        //public bool DiagonalUp
+        //{
+        //    get;
+        //    set;
+        //}
+        ///// <summary>
+        ///// A diagonal from the top left to bottom right of the cell
+        ///// </summary>
+        //public bool DiagonalDown
+        //{
+        //    get;
+        //    set;
+        //}
+
+        protected internal override string Id
+        {
+            get
+            {
+                return Top.Id + Bottom.Id + Left.Id + Right.Id/* + Diagonal.Id + GetAsString(DiagonalUp) + GetAsString(DiagonalDown)*/;
+            }
+        }
+
+        protected internal override void CreateNodes(XmlHelper helper, string path)
+        {
+            Left.CreateNodes(helper, path + "/d:left");
+            Right.CreateNodes(helper, path + "/d:right");
+            Top.CreateNodes(helper, path + "/d:top");
+            Bottom.CreateNodes(helper, path + "/d:bottom");
+        }
+        protected internal override bool HasValue
+        {
+            get 
+            {
+                return Left.HasValue ||
+                    Right.HasValue ||
+                    Top.HasValue ||
+                    Bottom.HasValue;
+            }
+        }
+        protected internal override ExcelDxfBorderBase Clone()
+        {
+            return new ExcelDxfBorderBase(_styles) { Bottom = Bottom.Clone(), Top=Top.Clone(), Left=Left.Clone(), Right=Right.Clone() };
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/Dxf/ExcelDxfBorderItem.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/Dxf/ExcelDxfBorderItem.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/Dxf/ExcelDxfBorderItem.cs	(revision 12707)
@@ -0,0 +1,44 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Xml;
+
+namespace OfficeOpenXml.Style.Dxf
+{
+    public class ExcelDxfBorderItem : DxfStyleBase<ExcelDxfBorderItem>
+    {
+        internal ExcelDxfBorderItem(ExcelStyles styles) :
+            base(styles)
+        {
+            Color=new ExcelDxfColor(styles);
+        }
+        public ExcelBorderStyle? Style { get; set;}
+        public ExcelDxfColor Color { get; internal set; }
+
+        protected internal override string Id
+        {
+            get
+            {
+                return GetAsString(Style) + "|" + (Color == null ? "" : Color.Id);
+            }
+        }
+
+        protected internal override void CreateNodes(XmlHelper helper, string path)
+        {            
+            SetValueEnum(helper, path + "/@style", Style);
+            SetValueColor(helper, path + "/d:color", Color);
+        }
+        protected internal override bool HasValue
+        {
+            get 
+            {
+                return Style != null || Color.HasValue;
+            }
+        }
+        protected internal override ExcelDxfBorderItem Clone()
+        {
+            return new ExcelDxfBorderItem(_styles) { Style = Style, Color = Color };
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/Dxf/ExcelDxfColor.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/Dxf/ExcelDxfColor.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/Dxf/ExcelDxfColor.cs	(revision 12707)
@@ -0,0 +1,46 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Drawing;
+using System.Xml;
+
+namespace OfficeOpenXml.Style.Dxf
+{
+    public class ExcelDxfColor : DxfStyleBase<ExcelDxfColor>
+
+    {
+        public ExcelDxfColor(ExcelStyles styles) : base(styles)
+        {
+
+        }
+        public int? Theme { get; set; }
+        public int? Index { get; set; }
+        public bool? Auto { get; set; }
+        public double? Tint { get; set; }
+        public Color? Color { get; set; }
+        protected internal override string Id
+        {
+            get { return GetAsString(Theme) + "|" + GetAsString(Index) + "|" + GetAsString(Auto) + "|" + GetAsString(Tint) + "|" + GetAsString(Color==null ? "" : ((Color)Color.Value).ToArgb().ToString("x")); }
+        }
+        protected internal override ExcelDxfColor Clone()
+        {
+            return new ExcelDxfColor(_styles) { Theme = Theme, Index = Index, Color = Color, Auto = Auto, Tint = Tint };
+        }
+        protected internal override bool HasValue
+        {
+            get
+            {
+                return Theme != null ||
+                       Index != null ||
+                       Auto != null ||
+                       Tint != null ||
+                       Color != null;
+            }
+        }
+        protected internal override void CreateNodes(XmlHelper helper, string path)
+        {
+            throw new NotImplementedException();
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/Dxf/ExcelDxfFill.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/Dxf/ExcelDxfFill.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/Dxf/ExcelDxfFill.cs	(revision 12707)
@@ -0,0 +1,57 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Drawing;
+using System.Xml;
+
+namespace OfficeOpenXml.Style.Dxf
+{
+    public class ExcelDxfFill : DxfStyleBase<ExcelDxfFill>
+    {
+        public ExcelDxfFill(ExcelStyles styles)
+            : base(styles)
+        {
+            PatternColor = new ExcelDxfColor(styles);
+            BackgroundColor = new ExcelDxfColor(styles);
+        }
+        public ExcelFillStyle? PatternType { get; set; }
+        /// <summary>
+        /// The color of the pattern
+        /// </summary>
+        public ExcelDxfColor PatternColor { get; internal set; }
+        /// <summary>
+        /// The background color
+        /// </summary>
+        public ExcelDxfColor BackgroundColor { get; internal set; }
+
+        protected internal override string Id
+        {
+            get
+            {
+                return GetAsString(PatternType) + "|" + (PatternColor == null ? "" : PatternColor.Id) + "|" + (BackgroundColor == null ? "" : BackgroundColor.Id);
+            }
+        }
+        protected internal override void CreateNodes(XmlHelper helper, string path)
+        {
+            helper.CreateNode(path);
+            SetValueEnum(helper, path + "/d:patternFill/@patternType", PatternType);
+            SetValueColor(helper, path + "/d:patternFill/d:fgColor", PatternColor);
+            SetValueColor(helper, path + "/d:patternFill/d:bgColor", BackgroundColor);
+        }
+
+        protected internal override bool HasValue
+        {
+            get 
+            {
+                return PatternType != null ||
+                    PatternColor.HasValue ||
+                    BackgroundColor.HasValue;
+            }
+        }
+        protected internal override ExcelDxfFill Clone()
+        {
+            return new ExcelDxfFill(_styles) {PatternType=PatternType, PatternColor=PatternColor.Clone(), BackgroundColor=BackgroundColor.Clone()};
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/Dxf/ExcelDxfFontBase.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/Dxf/ExcelDxfFontBase.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/Dxf/ExcelDxfFontBase.cs	(revision 12707)
@@ -0,0 +1,85 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Drawing;
+using System.Xml;
+
+namespace OfficeOpenXml.Style.Dxf
+{
+    public class ExcelDxfFontBase : DxfStyleBase<ExcelDxfFontBase>
+    {
+        public ExcelDxfFontBase(ExcelStyles styles)
+            : base(styles)
+        {
+            Color = new ExcelDxfColor(styles);
+        }
+        /// <summary>
+        /// Font bold
+        /// </summary>
+        public bool? Bold
+        {
+            get;
+            set;
+        }
+        /// <summary>
+        /// Font Italic
+        /// </summary>
+        public bool? Italic
+        {
+            get;
+            set;
+        }
+        /// <summary>
+        /// Font-Strikeout
+        /// </summary>
+        public bool? Strike { get; set; }
+        //public float? Size { get; set; }
+        public ExcelDxfColor Color { get; set; }
+        //public string Name { get; set; }
+        //public int? Family { get; set; }
+        ///// <summary>
+        ///// Font-Vertical Align
+        ///// </summary>
+        //public ExcelVerticalAlignmentFont? VerticalAlign
+        //{
+        //    get;
+        //    set;
+        //}
+
+        public ExcelUnderLineType? Underline { get; set; }
+
+        protected internal override string Id
+        {
+            get
+            {
+                return GetAsString(Bold) + "|" + GetAsString(Italic) + "|" + GetAsString(Strike) + "|" + (Color ==null ? "" : Color.Id) + "|" /*+ GetAsString(VerticalAlign) + "|"*/ + GetAsString(Underline);
+            }
+        }
+
+        protected internal override void CreateNodes(XmlHelper helper, string path)
+        {
+            helper.CreateNode(path);
+            SetValueBool(helper, path + "/d:b/@val", Bold);
+            SetValueBool(helper, path + "/d:i/@val", Italic);
+            SetValueBool(helper, path + "/d:strike", Strike);
+            SetValue(helper, path + "/d:u/@val", Underline);
+            SetValueColor(helper, path + "/d:color", Color);
+        }
+        protected internal override bool HasValue
+        {
+            get
+            {
+                return Bold != null ||
+                       Italic != null ||
+                       Strike != null ||
+                       Underline != null ||
+                       Color.HasValue;
+            }
+        }
+        protected internal override ExcelDxfFontBase Clone()
+        {
+            return new ExcelDxfFontBase(_styles) { Bold = Bold, Color = Color.Clone(), Italic = Italic, Strike = Strike, Underline = Underline };
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/Dxf/ExcelDxfNumberFormat.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/Dxf/ExcelDxfNumberFormat.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/Dxf/ExcelDxfNumberFormat.cs	(revision 12707)
@@ -0,0 +1,105 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Xml;
+
+namespace OfficeOpenXml.Style.Dxf
+{
+    public class ExcelDxfNumberFormat : DxfStyleBase<ExcelDxfNumberFormat>
+    {
+        public ExcelDxfNumberFormat(ExcelStyles styles) : base(styles)
+        {
+
+        }
+        int _numFmtID=int.MinValue;
+        /// <summary>
+        /// Id for number format
+        /// 
+        /// Build in ID's
+        /// 
+        /// 0   General 
+        /// 1   0 
+        /// 2   0.00 
+        /// 3   #,##0 
+        /// 4   #,##0.00 
+        /// 9   0% 
+        /// 10  0.00% 
+        /// 11  0.00E+00 
+        /// 12  # ?/? 
+        /// 13  # ??/?? 
+        /// 14  mm-dd-yy 
+        /// 15  d-mmm-yy 
+        /// 16  d-mmm 
+        /// 17  mmm-yy 
+        /// 18  h:mm AM/PM 
+        /// 19  h:mm:ss AM/PM 
+        /// 20  h:mm 
+        /// 21  h:mm:ss 
+        /// 22  m/d/yy h:mm 
+        /// 37  #,##0 ;(#,##0) 
+        /// 38  #,##0 ;[Red](#,##0) 
+        /// 39  #,##0.00;(#,##0.00) 
+        /// 40  #,##0.00;[Red](#,##0.00) 
+        /// 45  mm:ss 
+        /// 46  [h]:mm:ss 
+        /// 47  mmss.0 
+        /// 48  ##0.0E+0 
+        /// 49  @
+        /// </summary>            
+        public int NumFmtID 
+        { 
+            get
+            {
+                return _numFmtID;
+            }
+            internal set
+            {
+                _numFmtID = value;
+            }
+        }
+        string _format="";
+        public string Format
+        { 
+            get
+            {
+                return _format;
+            }
+            set
+            {
+                _format = value;
+                NumFmtID = ExcelNumberFormat.GetFromBuildIdFromFormat(value);
+            }
+        }
+
+        protected internal override string Id
+        {
+            get
+            {
+                return Format;
+            }
+        }
+
+        protected internal override void CreateNodes(XmlHelper helper, string path)
+        {
+            if (NumFmtID < 0 && !string.IsNullOrEmpty(Format))
+            {
+                NumFmtID = _styles._nextDfxNumFmtID++;
+            }
+            helper.CreateNode(path);
+            SetValue(helper, path + "/@numFmtId", NumFmtID);
+            SetValue(helper, path + "/@formatCode", Format);
+        }
+        protected internal override bool HasValue
+        {
+            get 
+            { 
+                return !string.IsNullOrEmpty(Format); 
+            }
+        }
+        protected internal override ExcelDxfNumberFormat Clone()
+        {
+            return new ExcelDxfNumberFormat(_styles) { NumFmtID = NumFmtID, Format = Format };
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/Dxf/ExcelDxfStyle.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/Dxf/ExcelDxfStyle.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/Dxf/ExcelDxfStyle.cs	(revision 12707)
@@ -0,0 +1,153 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Xml;
+using System.Drawing;
+
+namespace OfficeOpenXml.Style.Dxf
+{
+    public class ExcelDxfStyleConditionalFormatting : DxfStyleBase<ExcelDxfStyleConditionalFormatting>
+    {
+        XmlHelperInstance _helper;
+        internal ExcelDxfStyleConditionalFormatting(XmlNamespaceManager nameSpaceManager, XmlNode topNode, ExcelStyles styles) : base(styles)
+        {
+            NumberFormat = new ExcelDxfNumberFormat(_styles);
+            Font = new ExcelDxfFontBase(_styles);
+            Border = new ExcelDxfBorderBase(_styles);
+            Fill = new ExcelDxfFill(_styles);
+            if (topNode != null)
+            {
+                _helper = new XmlHelperInstance(nameSpaceManager, topNode);
+                NumberFormat.NumFmtID = _helper.GetXmlNodeInt("d:numFmt/@numFmtId");
+                NumberFormat.Format = _helper.GetXmlNodeString("d:numFmt/@formatCode"); 
+                if (NumberFormat.NumFmtID < 164 && string.IsNullOrEmpty(NumberFormat.Format))
+                {
+                    NumberFormat.Format = ExcelNumberFormat.GetFromBuildInFromID(NumberFormat.NumFmtID);
+                }
+
+                Font.Bold = _helper.GetXmlNodeBoolNullable("d:font/d:b/@val");
+                Font.Italic = _helper.GetXmlNodeBoolNullable("d:font/d:i/@val");
+                Font.Strike = _helper.GetXmlNodeBoolNullable("d:font/d:strike");
+                Font.Underline = GetUnderLineEnum(_helper.GetXmlNodeString("d:font/d:u/@val"));
+                Font.Color = GetColor(_helper, "d:font/d:color");
+
+                Border.Left = GetBorderItem(_helper, "d:border/d:left");
+                Border.Right = GetBorderItem(_helper, "d:border/d:right");
+                Border.Bottom = GetBorderItem(_helper, "d:border/d:bottom");
+                Border.Top = GetBorderItem(_helper, "d:border/d:top");
+
+                Fill.PatternType = GetPatternTypeEnum(_helper.GetXmlNodeString("d:fill/d:patternFill/@patternType"));
+                Fill.BackgroundColor = GetColor(_helper, "d:fill/d:patternFill/d:bgColor/");
+                Fill.PatternColor = GetColor(_helper, "d:fill/d:patternFill/d:fgColor/");
+            }
+            else
+            {
+                _helper = new XmlHelperInstance(nameSpaceManager);
+            }
+            _helper.SchemaNodeOrder = new string[] { "font", "numFmt", "fill", "border" };
+        }
+        private ExcelDxfBorderItem GetBorderItem(XmlHelperInstance helper, string path)
+        {
+            ExcelDxfBorderItem bi = new ExcelDxfBorderItem(_styles);
+            bi.Style = GetBorderStyleEnum(helper.GetXmlNodeString(path+"/@style"));
+            bi.Color = GetColor(helper, path+"/d:color");
+            return bi;
+        }
+        private ExcelBorderStyle GetBorderStyleEnum(string style)
+        {
+            if (style == "") return ExcelBorderStyle.None;
+            string sInStyle = style.Substring(0, 1).ToUpper(CultureInfo.InvariantCulture) + style.Substring(1, style.Length - 1);
+            try
+            {
+                return (ExcelBorderStyle)Enum.Parse(typeof(ExcelBorderStyle), sInStyle);
+            }
+            catch
+            {
+                return ExcelBorderStyle.None;
+            }
+
+        }
+        private ExcelFillStyle GetPatternTypeEnum(string patternType)
+        {
+            if (patternType == "") return ExcelFillStyle.None;
+            patternType = patternType.Substring(0, 1).ToUpper(CultureInfo.InvariantCulture) + patternType.Substring(1, patternType.Length - 1);
+            try
+            {
+                return (ExcelFillStyle)Enum.Parse(typeof(ExcelFillStyle), patternType);
+            }
+            catch
+            {
+                return ExcelFillStyle.None;
+            }
+        }
+        private ExcelDxfColor GetColor(XmlHelperInstance helper, string path)
+        {            
+            ExcelDxfColor ret = new ExcelDxfColor(_styles);
+            ret.Theme = helper.GetXmlNodeIntNull(path + "/@theme");
+            ret.Index = helper.GetXmlNodeIntNull(path + "/@indexed");
+            string rgb=helper.GetXmlNodeString(path + "/@rgb");
+            if(rgb!="")
+            {
+                ret.Color = Color.FromArgb( int.Parse(rgb.Substring(0, 2), System.Globalization.NumberStyles.AllowHexSpecifier),
+                                            int.Parse(rgb.Substring(2, 2), System.Globalization.NumberStyles.AllowHexSpecifier),
+                                            int.Parse(rgb.Substring(4, 2), System.Globalization.NumberStyles.AllowHexSpecifier),
+                                            int.Parse(rgb.Substring(6, 2), System.Globalization.NumberStyles.AllowHexSpecifier));
+            }
+            ret.Auto = helper.GetXmlNodeBoolNullable(path + "/@auto");
+            ret.Tint = helper.GetXmlNodeDoubleNull(path + "/@tint");
+            return ret;
+        }
+        private ExcelUnderLineType? GetUnderLineEnum(string value)
+        {
+            switch(value.ToLower(CultureInfo.InvariantCulture))
+            {
+                case "single":
+                    return ExcelUnderLineType.Single;
+                case "double":
+                    return ExcelUnderLineType.Double;
+                case "singleaccounting":
+                    return ExcelUnderLineType.SingleAccounting;
+                case "doubleaccounting":
+                    return ExcelUnderLineType.DoubleAccounting;
+                default:
+                    return null;
+            }
+        }
+        internal int DxfId { get; set; }
+        public ExcelDxfFontBase Font { get; set; }
+        public ExcelDxfNumberFormat NumberFormat { get; set; }
+        public ExcelDxfFill Fill { get; set; }
+        public ExcelDxfBorderBase Border { get; set; }
+        protected internal override string Id
+        {
+            get
+            {
+                return NumberFormat.Id + Font.Id + Border.Id + Fill.Id +
+                    (AllowChange ? "" : DxfId.ToString());//If allowchange is false we add the dxfID to ensure it's not used when conditional formatting is updated);
+            }
+        }
+        protected internal override ExcelDxfStyleConditionalFormatting Clone()
+        {
+ 	       var s=new ExcelDxfStyleConditionalFormatting(_helper.NameSpaceManager, null, _styles);
+           s.Font = Font.Clone();
+           s.NumberFormat = NumberFormat.Clone();
+           s.Fill = Fill.Clone();
+           s.Border = Border.Clone();
+           return s;
+        }
+
+        protected internal override void CreateNodes(XmlHelper helper, string path)
+        {
+            if(Font.HasValue) Font.CreateNodes(helper, "d:font");
+            if (NumberFormat.HasValue) NumberFormat.CreateNodes(helper, "d:numFmt");            
+            if (Fill.HasValue) Fill.CreateNodes(helper, "d:fill");
+            if (Border.HasValue) Border.CreateNodes(helper, "d:border");
+        }
+        protected internal override bool HasValue
+        {
+            get { return Font.HasValue || NumberFormat.HasValue || Fill.HasValue || Border.HasValue; }
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/ExcelBorder.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/ExcelBorder.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/ExcelBorder.cs	(revision 12707)
@@ -0,0 +1,178 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		                Initial Release		        2009-10-01
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+using OfficeOpenXml.Style.XmlAccess;
+
+namespace OfficeOpenXml.Style
+{
+    /// <summary>
+    /// Cell Border style
+    /// </summary>
+    public sealed class Border : StyleBase
+    {
+        internal Border(ExcelStyles styles, OfficeOpenXml.XmlHelper.ChangedEventHandler ChangedEvent, int PositionID, string address, int index) :
+            base(styles, ChangedEvent, PositionID, address)
+	    {
+            Index = index;
+        }
+        /// <summary>
+        /// Left border style
+        /// </summary>
+        public ExcelBorderItem Left
+        {
+            get
+            {
+                return new ExcelBorderItem(_styles, _ChangedEvent, _positionID, _address, eStyleClass.BorderLeft, this);
+            }
+        }
+        /// <summary>
+        /// Right border style
+        /// </summary>
+        public ExcelBorderItem Right
+        {
+            get
+            {
+                return new ExcelBorderItem(_styles, _ChangedEvent, _positionID, _address, eStyleClass.BorderRight, this);
+            }
+        }
+        /// <summary>
+        /// Top border style
+        /// </summary>
+        public ExcelBorderItem Top
+        {
+            get
+            {
+                return new ExcelBorderItem(_styles, _ChangedEvent, _positionID, _address, eStyleClass.BorderTop, this);
+            }
+        }
+        /// <summary>
+        /// Bottom border style
+        /// </summary>
+        public ExcelBorderItem Bottom
+        {
+            get
+            {
+                return new ExcelBorderItem(_styles, _ChangedEvent, _positionID, _address, eStyleClass.BorderBottom, this);
+            }
+        }
+        /// <summary>
+        /// 0Diagonal border style
+        /// </summary>
+        public ExcelBorderItem Diagonal
+        {
+            get
+            {
+                return new ExcelBorderItem(_styles, _ChangedEvent, _positionID, _address, eStyleClass.BorderDiagonal, this);
+            }
+        }
+        /// <summary>
+        /// A diagonal from the bottom left to top right of the cell
+        /// </summary>
+        public bool DiagonalUp 
+        {
+            get
+            {
+                if (Index >=0)
+                {
+                    return _styles.Borders[Index].DiagonalUp;
+                }
+                else
+                {
+                    return false;
+                }
+            }
+            set
+            {
+                _ChangedEvent(this, new StyleChangeEventArgs(eStyleClass.Border, eStyleProperty.BorderDiagonalUp, value, _positionID, _address));
+            }
+        }
+        /// <summary>
+        /// A diagonal from the top left to bottom right of the cell
+        /// </summary>
+        public bool DiagonalDown 
+        {
+            get
+            {
+                if (Index >= 0)
+                {
+                    return _styles.Borders[Index].DiagonalDown;
+                }
+                else
+                {
+                    return false;
+                }
+            }
+            set
+            {
+                _ChangedEvent(this, new StyleChangeEventArgs(eStyleClass.Border, eStyleProperty.BorderDiagonalDown, value, _positionID, _address));
+            }
+        }
+        internal override string Id
+        {
+            get { return Top.Id + Bottom.Id +Left.Id + Right.Id + Diagonal.Id + DiagonalUp + DiagonalDown; }
+        }
+        /// <summary>
+        /// Set the border style around the range.
+        /// </summary>
+        /// <param name="Style">The border style</param>
+        public void BorderAround(ExcelBorderStyle Style)
+        {
+            var addr = new ExcelAddress(_address);
+            SetBorderAroundStyle(Style, addr);
+        }
+        /// <summary>
+        /// Set the border style around the range.
+        /// </summary>
+        /// <param name="Style">The border style</param>
+        /// <param name="Color">The color of the border</param>
+        public void BorderAround(ExcelBorderStyle Style, System.Drawing.Color Color)
+        {            
+            var addr=new ExcelAddress(_address);
+            SetBorderAroundStyle(Style, addr);
+
+            _ChangedEvent(this, new StyleChangeEventArgs(eStyleClass.BorderTop, eStyleProperty.Color, Color.ToArgb().ToString("X"), _positionID, new ExcelAddress(addr._fromRow, addr._fromCol, addr._fromRow, addr._toCol).Address));
+            _ChangedEvent(this, new StyleChangeEventArgs(eStyleClass.BorderBottom, eStyleProperty.Color, Color.ToArgb().ToString("X"), _positionID, new ExcelAddress(addr._toRow, addr._fromCol, addr._toRow, addr._toCol).Address));
+            _ChangedEvent(this, new StyleChangeEventArgs(eStyleClass.BorderLeft, eStyleProperty.Color, Color.ToArgb().ToString("X"), _positionID, new ExcelAddress(addr._fromRow, addr._fromCol, addr._toRow, addr._fromCol).Address));
+            _ChangedEvent(this, new StyleChangeEventArgs(eStyleClass.BorderRight, eStyleProperty.Color, Color.ToArgb().ToString("X"), _positionID, new ExcelAddress(addr._fromRow, addr._toCol, addr._toRow, addr._toCol).Address));
+        }
+
+        private void SetBorderAroundStyle(ExcelBorderStyle Style, ExcelAddress addr)
+        {
+            _ChangedEvent(this, new StyleChangeEventArgs(eStyleClass.BorderTop, eStyleProperty.Style, Style, _positionID, new ExcelAddress(addr._fromRow, addr._fromCol, addr._fromRow, addr._toCol).Address));
+            _ChangedEvent(this, new StyleChangeEventArgs(eStyleClass.BorderBottom, eStyleProperty.Style, Style, _positionID, new ExcelAddress(addr._toRow, addr._fromCol, addr._toRow, addr._toCol).Address));
+            _ChangedEvent(this, new StyleChangeEventArgs(eStyleClass.BorderLeft, eStyleProperty.Style, Style, _positionID, new ExcelAddress(addr._fromRow, addr._fromCol, addr._toRow, addr._fromCol).Address));
+            _ChangedEvent(this, new StyleChangeEventArgs(eStyleClass.BorderRight, eStyleProperty.Style, Style, _positionID, new ExcelAddress(addr._fromRow, addr._toCol, addr._toRow, addr._toCol).Address));
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/ExcelBorderItem.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/ExcelBorderItem.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/ExcelBorderItem.cs	(revision 12707)
@@ -0,0 +1,112 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		                Initial Release		        2009-10-01
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+using OfficeOpenXml.Style.XmlAccess;
+
+namespace OfficeOpenXml.Style
+{
+    /// <summary>
+    /// Cell border style
+    /// </summary>
+    public sealed class ExcelBorderItem : StyleBase
+    {
+        eStyleClass _cls;
+        StyleBase _parent;
+        internal ExcelBorderItem (ExcelStyles styles, OfficeOpenXml.XmlHelper.ChangedEventHandler ChangedEvent, int worksheetID, string address, eStyleClass cls, StyleBase parent) : 
+            base(styles, ChangedEvent, worksheetID, address)
+	    {
+            _cls=cls;
+            _parent = parent;
+	    }
+        /// <summary>
+        /// The line style of the border
+        /// </summary>
+        public ExcelBorderStyle Style
+        {
+            get
+            {
+                return GetSource().Style;
+            }
+            set
+            {
+                _ChangedEvent(this, new StyleChangeEventArgs(_cls, eStyleProperty.Style, value, _positionID, _address));
+            }
+        }
+        ExcelColor _color=null;
+        /// <summary>
+        /// The color of the border
+        /// </summary>
+        public ExcelColor Color
+        {
+            get
+            {
+                if (_color == null)
+                {
+                    _color = new ExcelColor(_styles, _ChangedEvent, _positionID, _address, _cls, _parent);
+                }
+                return _color;
+            }
+        }
+
+        internal override string Id
+        {
+            get { return Style + Color.Id; }
+        }
+        internal override void SetIndex(int index)
+        {
+            _parent.Index = index;
+        }
+        private ExcelBorderItemXml GetSource()
+        {
+            int ix = _parent.Index < 0 ? 0 : _parent.Index;
+
+            switch(_cls)
+            {
+                case eStyleClass.BorderTop:
+                    return _styles.Borders[ix].Top;
+                case eStyleClass.BorderBottom:
+                    return _styles.Borders[ix].Bottom;
+                case eStyleClass.BorderLeft:
+                    return _styles.Borders[ix].Left;
+                case eStyleClass.BorderRight:
+                    return _styles.Borders[ix].Right;
+                case eStyleClass.BorderDiagonal:
+                    return _styles.Borders[ix].Diagonal;
+                default:
+                    throw new Exception("Invalid class for Borderitem");
+            }
+
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/ExcelColor.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/ExcelColor.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/ExcelColor.cs	(revision 12707)
@@ -0,0 +1,257 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		                Initial Release		        2009-10-01
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+using OfficeOpenXml.Style.XmlAccess;
+using System.Drawing;
+
+namespace OfficeOpenXml.Style
+{
+    /// <summary>
+    /// Color for cellstyling
+    /// </summary>
+    public sealed class ExcelColor :  StyleBase
+    {
+        eStyleClass _cls;
+        StyleBase _parent;
+        internal ExcelColor(ExcelStyles styles, OfficeOpenXml.XmlHelper.ChangedEventHandler ChangedEvent, int worksheetID, string address, eStyleClass cls, StyleBase parent) : 
+            base(styles, ChangedEvent, worksheetID, address)
+            
+        {
+            _parent = parent;
+            _cls = cls;
+        }
+        /// <summary>
+        /// The theme color
+        /// </summary>
+        public string Theme
+        {
+            get
+            {
+                return GetSource().Theme;
+            }
+        }
+        /// <summary>
+        /// The tint value
+        /// </summary>
+        public decimal Tint
+        {
+            get
+            {
+                return GetSource().Tint;
+            }
+            set
+            {
+                if (value > 1 || value < -1)
+                {
+                    throw (new ArgumentOutOfRangeException("Value must be between -1 and 1"));
+                }
+                _ChangedEvent(this, new StyleChangeEventArgs(_cls, eStyleProperty.Tint, value, _positionID, _address));
+            }
+        }
+        /// <summary>
+        /// The RGB value
+        /// </summary>
+        public string Rgb
+        {
+            get
+            {
+                return GetSource().Rgb;
+            }
+            internal set
+            {
+                _ChangedEvent(this, new StyleChangeEventArgs(_cls, eStyleProperty.Color, value, _positionID, _address));
+            }
+        }
+        /// <summary>
+        /// The indexed color number.
+        /// </summary>
+        public int Indexed
+        {
+            get
+            {
+                return GetSource().Indexed;
+            }
+            set
+            {
+                _ChangedEvent(this, new StyleChangeEventArgs(_cls, eStyleProperty.IndexedColor, value, _positionID, _address));
+            }
+        }
+        /// <summary>
+        /// Set the color of the object
+        /// </summary>
+        /// <param name="color">The color</param>
+        public void SetColor(Color color)
+        {
+            Rgb = color.ToArgb().ToString("X");
+        }
+
+
+        internal override string Id
+        {
+            get 
+            {
+                return Theme + Tint + Rgb + Indexed;
+            }
+        }
+        private ExcelColorXml GetSource()
+        {
+            Index = _parent.Index < 0 ? 0 : _parent.Index;
+            switch(_cls)
+            {
+                case eStyleClass.FillBackgroundColor:
+                    return _styles.Fills[Index].BackgroundColor;
+                case eStyleClass.FillPatternColor:
+                    return _styles.Fills[Index].PatternColor;
+                case eStyleClass.Font:
+                    return _styles.Fonts[Index].Color;
+                case eStyleClass.BorderLeft:
+                    return _styles.Borders[Index].Left.Color;
+                case eStyleClass.BorderTop:
+                    return _styles.Borders[Index].Top.Color;
+                case eStyleClass.BorderRight:
+                    return _styles.Borders[Index].Right.Color;
+                case eStyleClass.BorderBottom:
+                    return _styles.Borders[Index].Bottom.Color;
+                case eStyleClass.BorderDiagonal:
+                    return _styles.Borders[Index].Diagonal.Color;
+                default:
+                    throw(new Exception("Invalid style-class for Color"));
+            }
+        }
+        internal override void SetIndex(int index)
+        {
+            _parent.Index = index;
+        }
+        /// <summary>
+        /// Return the RGB value for the color object that uses the Indexed or Tint property
+        /// </summary>
+        /// <param name="theColor">The color object</param>
+        /// <returns>The RGB color starting with a #</returns>
+        public string LookupColor(ExcelColor theColor)
+        {
+            //Thanks to neaves for contributing this method.
+            int iTint = 0;
+            string translatedRGB = "";
+
+            // reference extracted from ECMA-376, Part 4, Section 3.8.26
+            string[] rgbLookup =
+            {
+                "#FF000000", // 0
+                "#FFFFFFFF",
+                "#FFFF0000",
+                "#FF00FF00",
+                "#FF0000FF",
+                "#FFFFFF00",
+                "#FFFF00FF",
+                "#FF00FFFF",
+                "#FF000000", // 8
+                "#FFFFFFFF",
+                "#FFFF0000",
+                "#FF00FF00",
+                "#FF0000FF",
+                "#FFFFFF00",
+                "#FFFF00FF",
+                "#FF00FFFF",
+                "#FF800000",
+                "#FF008000",
+                "#FF000080",
+                "#FF808000",
+                "#FF800080",
+                "#FF008080",
+                "#FFC0C0C0",
+                "#FF808080",
+                "#FF9999FF",
+                "#FF993366",
+                "#FFFFFFCC",
+                "#FFCCFFFF",
+                "#FF660066",
+                "#FFFF8080",
+                "#FF0066CC",
+                "#FFCCCCFF",
+                "#FF000080",
+                "#FFFF00FF",
+                "#FFFFFF00",
+                "#FF00FFFF",
+                "#FF800080",
+                "#FF800000",
+                "#FF008080",
+                "#FF0000FF",
+                "#FF00CCFF",
+                "#FFCCFFFF",
+                "#FFCCFFCC",
+                "#FFFFFF99",
+                "#FF99CCFF",
+                "#FFFF99CC",
+                "#FFCC99FF",
+                "#FFFFCC99",
+                "#FF3366FF",
+                "#FF33CCCC",
+                "#FF99CC00",
+                "#FFFFCC00",
+                "#FFFF9900",
+                "#FFFF6600",
+                "#FF666699",
+                "#FF969696",
+                "#FF003366",
+                "#FF339966",
+                "#FF003300",
+                "#FF333300",
+                "#FF993300",
+                "#FF993366",
+                "#FF333399",
+                "#FF333333", // 63
+            };
+
+            if ((0 <= theColor.Indexed) && (rgbLookup.Length > theColor.Indexed))
+            {
+                // coloring by pre-set color codes
+                translatedRGB = rgbLookup[theColor.Indexed];
+            }
+            else if (null != theColor.Rgb && 0 < theColor.Rgb.Length)
+            {
+                // coloring by RGB value ("FFRRGGBB")
+                translatedRGB = "#" + theColor.Rgb;
+            }
+            else
+            {
+                // coloring by shades of grey (-1 -> 0)
+                iTint = ((int)(theColor.Tint * 160) + 0x80);
+                translatedRGB = ((int)(decimal.Round(theColor.Tint * -512))).ToString("X");
+                translatedRGB = "#FF" + translatedRGB + translatedRGB + translatedRGB;
+            }
+
+            return translatedRGB;
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/ExcelFill.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/ExcelFill.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/ExcelFill.cs	(revision 12707)
@@ -0,0 +1,138 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		                Initial Release		        2009-10-01
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+using OfficeOpenXml.Style.XmlAccess;
+using System.Globalization;
+
+namespace OfficeOpenXml.Style
+{
+    /// <summary>
+    /// The background fill of a cell
+    /// </summary>
+    public class ExcelFill : StyleBase
+    {
+        internal ExcelFill(ExcelStyles styles, OfficeOpenXml.XmlHelper.ChangedEventHandler ChangedEvent, int PositionID, string address, int index) :
+            base(styles, ChangedEvent, PositionID, address)
+
+        {
+            Index = index;
+        }
+        /// <summary>
+        /// The pattern for solid fills.
+        /// </summary>
+        public ExcelFillStyle PatternType
+        {
+            get
+            {
+                if (Index == int.MinValue)
+                {
+                    return ExcelFillStyle.None;
+                }
+                else
+                {
+                    return _styles.Fills[Index].PatternType;
+                }
+            }
+            set
+            {
+                if (_gradient != null) _gradient = null;
+                _ChangedEvent(this, new StyleChangeEventArgs(eStyleClass.Fill, eStyleProperty.PatternType, value, _positionID, _address));
+            }
+        }
+        ExcelColor _patternColor = null;
+        /// <summary>
+        /// The color of the pattern
+        /// </summary>
+        public ExcelColor PatternColor
+        {
+            get
+            {
+                if (_patternColor == null)
+                {
+                    _patternColor = new ExcelColor(_styles, _ChangedEvent, _positionID, _address, eStyleClass.FillPatternColor, this);
+                    if (_gradient != null) _gradient = null;
+                }
+                return _patternColor;
+            }
+        }
+        ExcelColor _backgroundColor = null;
+        /// <summary>
+        /// The background color
+        /// </summary>
+        public ExcelColor BackgroundColor
+        {
+            get
+            {
+                if (_backgroundColor == null)
+                {
+                    _backgroundColor = new ExcelColor(_styles, _ChangedEvent, _positionID, _address, eStyleClass.FillBackgroundColor, this);
+                    if (_gradient != null) _gradient = null;
+                }
+                return _backgroundColor;
+                
+            }
+        }
+        ExcelGradientFill _gradient=null;
+        /// <summary>
+        /// Access to properties for gradient fill.
+        /// </summary>
+        public ExcelGradientFill Gradient 
+        {
+            get
+            {
+                if (_gradient == null)
+                {                    
+                    _gradient = new ExcelGradientFill(_styles, _ChangedEvent, _positionID, _address, Index);
+                    _backgroundColor = null;
+                    _patternColor = null;
+                }
+                return _gradient;
+            }
+        }
+        internal override string Id
+        {
+            get
+            {
+                if (_gradient == null)
+                {
+                    return PatternType + PatternColor.Id + BackgroundColor.Id;
+                }
+                else
+                {
+                    return _gradient.Id;
+                }
+            }
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/ExcelFont.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/ExcelFont.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/ExcelFont.cs	(revision 12707)
@@ -0,0 +1,235 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		                Initial Release		        2009-10-01
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Drawing;
+
+namespace OfficeOpenXml.Style
+{
+    /// <summary>
+    /// Cell style Font
+    /// </summary>
+    public sealed class ExcelFont : StyleBase
+    {
+        internal ExcelFont(ExcelStyles styles, OfficeOpenXml.XmlHelper.ChangedEventHandler ChangedEvent, int PositionID, string address, int index) :
+            base(styles, ChangedEvent, PositionID, address)
+
+        {
+            Index = index;
+        }
+        /// <summary>
+        /// The name of the font
+        /// </summary>
+        public string Name
+        {
+            get
+            {
+                return _styles.Fonts[Index].Name;
+            }
+            set
+            {
+                _ChangedEvent(this, new StyleChangeEventArgs(eStyleClass.Font, eStyleProperty.Name, value, _positionID, _address));
+            }
+        }
+        /// <summary>
+        /// The Size of the font
+        /// </summary>
+        public float Size
+        {
+            get
+            {
+                return _styles.Fonts[Index].Size;
+            }
+            set
+            {
+                _ChangedEvent(this, new StyleChangeEventArgs(eStyleClass.Font, eStyleProperty.Size, value, _positionID, _address));
+            }
+        }
+        /// <summary>
+        /// Font family
+        /// </summary>
+        public int Family
+        {
+            get
+            {
+                return _styles.Fonts[Index].Family;
+            }
+            set
+            {
+                _ChangedEvent(this, new StyleChangeEventArgs(eStyleClass.Font, eStyleProperty.Family, value, _positionID, _address));
+            }
+        }
+        /// <summary>
+        /// Cell color
+        /// </summary>
+        public ExcelColor Color
+        {
+            get
+            {
+                return new ExcelColor(_styles, _ChangedEvent, _positionID, _address, eStyleClass.Font, this);
+            }
+        }
+        /// <summary>
+        /// Scheme
+        /// </summary>
+        public string Scheme
+        {
+            get
+            {
+                return _styles.Fonts[Index].Scheme;
+            }
+            set
+            {
+                _ChangedEvent(this, new StyleChangeEventArgs(eStyleClass.Font, eStyleProperty.Scheme, value, _positionID, _address));
+            }
+        }
+        /// <summary>
+        /// Font-bold
+        /// </summary>
+        public bool Bold
+        {
+            get
+            {
+                return _styles.Fonts[Index].Bold;
+            }
+            set
+            {
+                _ChangedEvent(this, new StyleChangeEventArgs(eStyleClass.Font, eStyleProperty.Bold, value, _positionID, _address));
+            }
+        }
+        /// <summary>
+        /// Font-italic
+        /// </summary>
+        public bool Italic
+        {
+            get
+            {
+                return _styles.Fonts[Index].Italic;
+            }
+            set
+            {
+                _ChangedEvent(this, new StyleChangeEventArgs(eStyleClass.Font, eStyleProperty.Italic, value, _positionID, _address));
+            }
+        }
+        /// <summary>
+        /// Font-Strikeout
+        /// </summary>
+        public bool Strike
+        {
+            get
+            {
+                return _styles.Fonts[Index].Strike;
+            }
+            set
+            {
+                _ChangedEvent(this, new StyleChangeEventArgs(eStyleClass.Font, eStyleProperty.Strike, value, _positionID, _address));
+            }
+        }
+        /// <summary>
+        /// Font-Underline
+        /// </summary>
+        public bool UnderLine
+        {
+            get
+            {
+                return _styles.Fonts[Index].UnderLine;
+            }
+            set
+            {
+                if (value)
+                {
+                    UnderLineType = ExcelUnderLineType.Single;
+                }
+                else
+                {
+                    UnderLineType = ExcelUnderLineType.None;
+                }
+                //_ChangedEvent(this, new StyleChangeEventArgs(eStyleClass.Font, eStyleProperty.UnderlineType, value, _positionID, _address));
+            }
+        }
+        public ExcelUnderLineType UnderLineType
+        {
+            get
+            {
+                return _styles.Fonts[Index].UnderLineType;
+            }
+            set
+            {
+                _ChangedEvent(this, new StyleChangeEventArgs(eStyleClass.Font, eStyleProperty.UnderlineType, value, _positionID, _address));
+            }
+        }
+        /// <summary>
+        /// Font-Vertical Align
+        /// </summary>
+        public ExcelVerticalAlignmentFont VerticalAlign
+        {
+            get
+            {
+                if (_styles.Fonts[Index].VerticalAlign == "")
+                {
+                    return ExcelVerticalAlignmentFont.None;
+                }
+                else
+                {
+                    return (ExcelVerticalAlignmentFont)Enum.Parse(typeof(ExcelVerticalAlignmentFont), _styles.Fonts[Index].VerticalAlign, true);
+                }
+            }
+            set
+            {
+                _ChangedEvent(this, new StyleChangeEventArgs(eStyleClass.Font, eStyleProperty.VerticalAlign, value, _positionID, _address));
+            }
+        }
+        /// <summary>
+        /// Set the font from a Font object
+        /// </summary>
+        /// <param name="Font"></param>
+        public void SetFromFont(Font Font)
+        {
+            Name = Font.Name;
+            //Family=fnt.FontFamily.;
+            Size = (int)Font.Size;
+            Strike = Font.Strikeout;
+            Bold = Font.Bold;
+            UnderLine = Font.Underline;
+            Italic = Font.Italic;
+        }
+
+        internal override string Id
+        {
+            get 
+            {
+                return Name + Size.ToString() + Family.ToString() + Scheme.ToString() + Bold.ToString()[0] + Italic.ToString()[0] + Strike.ToString()[0] + UnderLine.ToString()[0] + VerticalAlign;
+            }
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/ExcelGradientFill.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/ExcelGradientFill.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/ExcelGradientFill.cs	(revision 12707)
@@ -0,0 +1,188 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		                Initial Release		        2009-10-01
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+using OfficeOpenXml.Style.XmlAccess;
+using System.Globalization;
+
+namespace OfficeOpenXml.Style
+{
+    /// <summary>
+    /// The background fill of a cell
+    /// </summary>
+    public class ExcelGradientFill : StyleBase
+    {
+        internal ExcelGradientFill(ExcelStyles styles, OfficeOpenXml.XmlHelper.ChangedEventHandler ChangedEvent, int PositionID, string address, int index) :
+            base(styles, ChangedEvent, PositionID, address)
+
+        {
+            Index = index;
+        }
+        /// <summary>
+        /// Angle of the linear gradient
+        /// </summary>
+        public double Degree
+        {
+            get
+            {
+                return ((ExcelGradientFillXml)_styles.Fills[Index]).Degree;
+            }
+            set
+            {
+                _ChangedEvent(this, new StyleChangeEventArgs(eStyleClass.GradientFill, eStyleProperty.GradientDegree, value, _positionID, _address));
+            }
+        }
+        /// <summary>
+        /// Linear or Path gradient
+        /// </summary>
+        public ExcelFillGradientType Type
+        {
+            get
+            {
+                return ((ExcelGradientFillXml)_styles.Fills[Index]).Type;
+            }
+            set
+            {
+                _ChangedEvent(this, new StyleChangeEventArgs(eStyleClass.GradientFill, eStyleProperty.GradientType, value, _positionID, _address));
+            }
+        }
+        /// <summary>
+        /// Specifies in percentage format(from the top to the bottom) the position of the top edge of the inner rectangle (color 1). For top, 0 means the top edge of the inner rectangle is on the top edge of the cell, and 1 means it is on the bottom edge of the cell. (applies to From Corner and From Center gradients).
+        /// </summary>
+        public double Top
+        {
+            get
+            {
+                return ((ExcelGradientFillXml)_styles.Fills[Index]).Top;
+            }
+            set
+            {
+                if (value < 0 | value > 1)
+                {
+                    throw (new ArgumentOutOfRangeException("Value must be between 0 and 1"));
+                }
+                _ChangedEvent(this, new StyleChangeEventArgs(eStyleClass.GradientFill, eStyleProperty.GradientTop, value, _positionID, _address));
+            }
+        }
+        /// <summary>
+        /// Specifies in percentage format (from the top to the bottom) the position of the bottom edge of the inner rectangle (color 1). For bottom, 0 means the bottom edge of the inner rectangle is on the top edge of the cell, and 1 means it is on the bottom edge of the cell.
+        /// </summary>
+        public double Bottom
+        {
+            get
+            {
+                return ((ExcelGradientFillXml)_styles.Fills[Index]).Bottom;
+            }
+            set
+            {
+                if (value < 0 | value > 1)
+                {
+                    throw (new ArgumentOutOfRangeException("Value must be between 0 and 1"));
+                }
+                _ChangedEvent(this, new StyleChangeEventArgs(eStyleClass.GradientFill, eStyleProperty.GradientBottom, value, _positionID, _address));
+            }
+        }
+        /// <summary>
+        /// Specifies in percentage format (from the left to the right) the position of the left edge of the inner rectangle (color 1). For left, 0 means the left edge of the inner rectangle is on the left edge of the cell, and 1 means it is on the right edge of the cell. (applies to From Corner and From Center gradients).
+        /// </summary>
+        public double Left
+        {
+            get
+            {
+                return ((ExcelGradientFillXml)_styles.Fills[Index]).Left;
+            }
+            set
+            {
+                if (value < 0 | value > 1)
+                {
+                    throw (new ArgumentOutOfRangeException("Value must be between 0 and 1"));
+                }
+                _ChangedEvent(this, new StyleChangeEventArgs(eStyleClass.GradientFill, eStyleProperty.GradientLeft, value, _positionID, _address));
+            }
+        }
+        /// <summary>
+        /// Specifies in percentage format (from the left to the right) the position of the right edge of the inner rectangle (color 1). For right, 0 means the right edge of the inner rectangle is on the left edge of the cell, and 1 means it is on the right edge of the cell. (applies to From Corner and From Center gradients).
+        /// </summary>
+        public double Right
+        {
+            get
+            {
+                return ((ExcelGradientFillXml)_styles.Fills[Index]).Right;
+            }
+            set
+            {
+                if (value < 0 | value > 1)
+                {
+                    throw (new ArgumentOutOfRangeException("Value must be between 0 and 1"));
+                }
+                _ChangedEvent(this, new StyleChangeEventArgs(eStyleClass.GradientFill, eStyleProperty.GradientRight, value, _positionID, _address));
+            }
+        }
+        ExcelColor _gradientColor1 = null;
+        /// <summary>
+        /// Gradient Color 1
+        /// </summary>
+        public ExcelColor Color1
+        {
+            get
+            {
+                if (_gradientColor1 == null)
+                {
+                    _gradientColor1 = new ExcelColor(_styles, _ChangedEvent, _positionID, _address, eStyleClass.FillGradientColor1, this);
+                }
+                return _gradientColor1;
+
+            }
+        }
+        ExcelColor _gradientColor2 = null;
+        /// <summary>
+        /// Gradient Color 2
+        /// </summary>
+        public ExcelColor Color2
+        {
+            get
+            {
+                if (_gradientColor2 == null)
+                {
+                    _gradientColor2 = new ExcelColor(_styles, _ChangedEvent, _positionID, _address, eStyleClass.FillGradientColor2, this);
+                }
+                return _gradientColor2;
+
+            }
+        }
+        internal override string Id
+        {
+            get { return Degree.ToString() + Type + Color1.Id + Color2.Id + Top.ToString() + Bottom.ToString() + Left.ToString() + Right.ToString(); }
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/ExcelNumberFormat.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/ExcelNumberFormat.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/ExcelNumberFormat.cs	(revision 12707)
@@ -0,0 +1,228 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		                Initial Release		        2009-10-01
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Globalization;
+
+namespace OfficeOpenXml.Style
+{
+    /// <summary>
+    /// The numberformat of the cell
+    /// </summary>
+    public sealed class ExcelNumberFormat : StyleBase
+    {
+        internal ExcelNumberFormat(ExcelStyles styles, OfficeOpenXml.XmlHelper.ChangedEventHandler ChangedEvent, int PositionID, string Address, int index) :
+            base(styles, ChangedEvent, PositionID, Address)
+        {
+            Index = index;
+        }
+        /// <summary>
+        /// The numeric index fror the format
+        /// </summary>
+        public int NumFmtID 
+        {
+            get
+            {
+                return Index;
+            }
+            //set
+            //{
+            //    _ChangedEvent(this, new StyleChangeEventArgs(eStyleClass.Numberformat, "NumFmtID", value, _workSheetID, _address));
+            //}
+        }
+        /// <summary>
+        /// The numberformat 
+        /// </summary>
+        public string Format
+        {
+            get
+            {
+                for(int i=0;i<_styles.NumberFormats.Count;i++)
+                {
+                    if(Index==_styles.NumberFormats[i].NumFmtId)
+                    {
+                        return _styles.NumberFormats[i].Format;
+                    }
+                }
+                return "general";
+            }
+            set
+            {                
+                _ChangedEvent(this, new StyleChangeEventArgs(eStyleClass.Numberformat, eStyleProperty.Format, (string.IsNullOrEmpty(value) ? "General" : value), _positionID, _address));
+            }
+        }
+
+        internal override string Id
+        {
+            get 
+            {
+                return Format;
+            }
+        }
+        /// <summary>
+        /// If the numeric format is a build-in from.
+        /// </summary>
+        public bool BuildIn { get; private set; }
+
+        internal static string GetFromBuildInFromID(int _numFmtId)
+        {
+            switch (_numFmtId)
+            {
+                case 0:
+                    return "General";
+                case 1:
+                    return "0";
+                case 2:
+                    return "0.00";
+                case 3:
+                    return "#,##0";
+                case 4:
+                    return "#,##0.00";
+                case 9:
+                    return "0%";
+                case 10:
+                    return "0.00%";
+                case 11:
+                    return "0.00E+00";
+                case 12:
+                    return "# ?/?";
+                case 13:
+                    return "# ??/??";
+                case 14:
+                    return "mm-dd-yy";
+                case 15:
+                    return "d-mmm-yy";
+                case 16:
+                    return "d-mmm";
+                case 17:
+                    return "mmm-yy";
+                case 18:
+                    return "h:mm AM/PM";
+                case 19:
+                    return "h:mm:ss AM/PM";
+                case 20:
+                    return "h:mm";
+                case 21:
+                    return "h:mm:ss";
+                case 22:
+                    return "m/d/yy h:mm";
+                case 37:
+                    return "#,##0 ;(#,##0)";
+                case 38:
+                    return "#,##0 ;[Red](#,##0)";
+                case 39:
+                    return "#,##0.00;(#,##0.00)";
+                case 40:
+                    return "#,##0.00;[Red](#,##0.00)";
+                case 45:
+                    return "mm:ss";
+                case 46:
+                    return "[h]:mm:ss";
+                case 47:
+                    return "mmss.0";
+                case 48:
+                    return "##0.0";
+                case 49:
+                    return "@";
+                default:
+                    return string.Empty;
+            }
+        }
+        internal static int GetFromBuildIdFromFormat(string format)
+        {
+            switch (format)
+            {
+                case "General":
+                case "":
+                    return 0;
+                case "0":
+                    return 1;
+                case "0.00":
+                    return 2;
+                case "#,##0":
+                    return 3;
+                case "#,##0.00":
+                    return 4;
+                case "0%":
+                    return 9;
+                case "0.00%":
+                    return 10;
+                case "0.00E+00":
+                    return 11;
+                case "# ?/?":
+                    return 12;
+                case "# ??/??":
+                    return 13;
+                case "mm-dd-yy":
+                    return 14;
+                case "d-mmm-yy":
+                    return 15;
+                case "d-mmm":
+                    return 16;
+                case "mmm-yy":
+                    return 17;
+                case "h:mm AM/PM":
+                    return 18;
+                case "h:mm:ss AM/PM":
+                    return 19;
+                case "h:mm":
+                    return 20;
+                case "h:mm:ss":
+                    return 21;
+                case "m/d/yy h:mm":
+                    return 22;
+                case "#,##0 ;(#,##0)":
+                    return 37;
+                case "#,##0 ;[Red](#,##0)":
+                    return 38;
+                case "#,##0.00;(#,##0.00)":
+                    return 39;
+                case "#,##0.00;[Red](#,##0.00)":
+                    return 40;
+                case "mm:ss":
+                    return 45;
+                case "[h]:mm:ss":
+                    return 46;
+                case "mmss.0":
+                    return 47;
+                case "##0.0":
+                    return 48;
+                case "@":
+                    return 49;
+                default:
+                    return int.MinValue;
+            }
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/ExcelParagraph.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/ExcelParagraph.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/ExcelParagraph.cs	(revision 12707)
@@ -0,0 +1,67 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		                Initial Release		        2009-10-01
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Xml;
+
+namespace OfficeOpenXml.Style
+{
+    /// <summary>
+    /// Handels paragraph text
+    /// </summary>
+    public sealed class ExcelParagraph : ExcelTextFont
+    {
+        public ExcelParagraph(XmlNamespaceManager ns, XmlNode rootNode, string path, string[] schemaNodeOrder) : 
+            base(ns, rootNode, path + "a:rPr", schemaNodeOrder)
+        { 
+
+        }
+        const string TextPath = "../a:t";
+        /// <summary>
+        /// Text
+        /// </summary>
+        public string Text
+        {
+            get
+            {
+                return GetXmlNodeString(TextPath);
+            }
+            set
+            {
+                CreateTopNode();
+                SetXmlNodeString(TextPath, value);
+            }
+
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/ExcelParagraphCollection.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/ExcelParagraphCollection.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/ExcelParagraphCollection.cs	(revision 12707)
@@ -0,0 +1,177 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		                Initial Release		        2009-10-01
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Xml;
+using OfficeOpenXml.Drawing;
+using System.Drawing;
+
+namespace OfficeOpenXml.Style
+{
+    /// <summary>
+    /// A collection of Paragraph objects
+    /// </summary>
+    public class ExcelParagraphCollection : XmlHelper, IEnumerable<ExcelParagraph>
+    {
+        List<ExcelParagraph> _list = new List<ExcelParagraph>();
+        string _path;
+        internal ExcelParagraphCollection(XmlNamespaceManager ns, XmlNode topNode, string path, string[] schemaNodeOrder) :
+            base(ns, topNode)
+        {
+            var nl = topNode.SelectNodes(path + "/a:r", NameSpaceManager);
+            SchemaNodeOrder = schemaNodeOrder;
+            if (nl != null)
+            {
+                foreach (XmlNode n in nl)
+                {
+                    _list.Add(new ExcelParagraph(ns, n, "",schemaNodeOrder));
+                }
+            }
+            _path = path;
+        }
+        public ExcelParagraph this[int Index]
+        {
+            get
+            {
+                return _list[Index];
+            }
+        }
+        public int Count
+        {
+            get
+            {
+                return _list.Count;
+            }
+        }
+        /// <summary>
+        /// Add a rich text string
+        /// </summary>
+        /// <param name="Text">The text to add</param>
+        /// <returns></returns>
+        public ExcelParagraph Add(string Text)
+        {
+            XmlDocument doc;
+            if (TopNode is XmlDocument)
+            {
+                doc = TopNode as XmlDocument;
+            }
+            else
+            {
+                doc = TopNode.OwnerDocument;
+            }
+            XmlNode parentNode=TopNode.SelectSingleNode(_path, NameSpaceManager);
+            if (parentNode == null)
+            {
+                CreateNode(_path);
+                parentNode = TopNode.SelectSingleNode(_path, NameSpaceManager);
+            }
+            
+            var node = doc.CreateElement("a", "r", ExcelPackage.schemaDrawings);
+            parentNode.AppendChild(node);
+            var childNode = doc.CreateElement("a", "rPr", ExcelPackage.schemaDrawings);
+            node.AppendChild(childNode);
+            var rt = new ExcelParagraph(NameSpaceManager, node, "", SchemaNodeOrder);
+            rt.ComplexFont = "Calibri";
+            rt.LatinFont = "Calibri"; 
+            rt.Size = 11;
+
+            rt.Text = Text;
+            _list.Add(rt);
+            return rt;
+        }
+        public void Clear()
+        {
+            _list.Clear();
+            TopNode.RemoveAll();
+        }
+        public void RemoveAt(int Index)
+        {
+            var node = _list[Index].TopNode;
+            while (node != null && node.Name != "a:r")
+            {
+                node = node.ParentNode;
+            }
+            node.ParentNode.RemoveChild(node);
+            _list.RemoveAt(Index);
+        }
+        public void Remove(ExcelRichText Item)
+        {
+            TopNode.RemoveChild(Item.TopNode);
+        }
+        public string Text
+        {
+            get
+            {
+                StringBuilder sb = new StringBuilder();
+                foreach (var item in _list)
+                {
+                    sb.Append(item.Text);
+                }
+                return sb.ToString();
+            }
+            set
+            {
+                if (Count == 0)
+                {
+                    Add(value);
+                }
+                else
+                {
+                    this[0].Text = value;
+                    int count = Count;
+                    for (int ix = Count-1; ix > 0; ix--)
+                    {
+                        RemoveAt(ix);
+                    }
+                }
+            }
+        }
+        #region IEnumerable<ExcelRichText> Members
+
+        IEnumerator<ExcelParagraph> IEnumerable<ExcelParagraph>.GetEnumerator()
+        {
+            return _list.GetEnumerator();
+        }
+
+        #endregion
+
+        #region IEnumerable Members
+
+        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
+        {
+            return _list.GetEnumerator();
+        }
+
+        #endregion
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/ExcelRichText.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/ExcelRichText.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/ExcelRichText.cs	(revision 12707)
@@ -0,0 +1,303 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		                Initial Release		        2009-10-01
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ * Richard Tallent					Fix inadvertent removal of XML node					2012-10-31
+ * Richard Tallent					Remove VertAlign node if no alignment specified		2012-10-31
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Xml;
+using System.Drawing;
+using System.Globalization;
+
+namespace OfficeOpenXml.Style
+{
+    /// <summary>
+    /// A richtext part
+    /// </summary>
+    public class ExcelRichText : XmlHelper
+    {
+        internal ExcelRichText(XmlNamespaceManager ns, XmlNode topNode) :
+            base(ns, topNode)
+        {
+            SchemaNodeOrder=new string[] {"rPr", "t", "b", "i","strike", "u", "vertAlign" , "sz", "color", "rFont", "family", "scheme", "charset"};
+        }
+        internal delegate void CallbackDelegate();
+        CallbackDelegate _callback;
+        internal void SetCallback(CallbackDelegate callback)
+        {
+            _callback=callback;
+        }
+        const string TEXT_PATH="d:t";
+        /// <summary>
+        /// The text
+        /// </summary>
+        public string Text 
+        { 
+
+            get
+            {
+                return GetXmlNodeString(TEXT_PATH);
+            }
+            set
+            {
+                // Don't remove if blank -- setting a blank rich text value on a node is common,
+                // for example when applying both bold and italic to text.
+                SetXmlNodeString(TEXT_PATH, value, false);
+                if (PreserveSpace)
+                {
+                    XmlElement elem = TopNode.SelectSingleNode(TEXT_PATH, NameSpaceManager) as XmlElement;
+                    elem.SetAttribute("xml:space", "preserve");
+                }
+                if (_callback != null) _callback();
+            }
+        }
+        /// <summary>
+        /// Preserves whitespace. Default true
+        /// </summary>
+        public bool PreserveSpace
+        {
+            get
+            {
+                XmlElement elem = TopNode.SelectSingleNode(TEXT_PATH, NameSpaceManager) as XmlElement;
+                if (elem != null)
+                {
+                    return elem.GetAttribute("xml:space")=="preserve";
+                }
+                return false;
+            }
+            set
+            {
+                XmlElement elem = TopNode.SelectSingleNode(TEXT_PATH, NameSpaceManager) as XmlElement;
+                if (elem != null)
+                {
+                    if (value)
+                    {
+                        elem.SetAttribute("xml:space", "preserve");
+                    }
+                    else
+                    {
+                        elem.RemoveAttribute("xml:space");
+                    }
+                }
+                if (_callback != null) _callback();
+            }
+        }
+        const string BOLD_PATH = "d:rPr/d:b";
+        /// <summary>
+        /// Bold text
+        /// </summary>
+        public bool Bold
+        {
+            get
+            {
+                return ExistNode(BOLD_PATH);
+            }
+            set
+            {
+                if (value)
+                {
+                    CreateNode(BOLD_PATH);
+                }
+                else
+                {
+                    DeleteNode(BOLD_PATH);
+                }
+                if(_callback!=null) _callback();
+            }
+        }
+        const string ITALIC_PATH = "d:rPr/d:i";
+        /// <summary>
+        /// Italic text
+        /// </summary>
+        public bool Italic
+        {
+            get
+            {
+                //return GetXmlNodeBool(ITALIC_PATH, false);
+                return ExistNode(ITALIC_PATH);
+            }
+            set
+            {
+                if (value)
+                {
+                    CreateNode(ITALIC_PATH);
+                }
+                else
+                {
+                    DeleteNode(ITALIC_PATH);
+                }
+                if (_callback != null) _callback();
+            }
+        }
+        const string STRIKE_PATH = "d:rPr/d:strike";
+        /// <summary>
+        /// Strike-out text
+        /// </summary>
+        public bool Strike
+        {
+            get
+            {
+                return ExistNode(STRIKE_PATH);
+            }
+            set
+            {
+                if (value)
+                {
+                    CreateNode(STRIKE_PATH);
+                }
+                else
+                {
+                    DeleteNode(STRIKE_PATH);
+                }
+                if (_callback != null) _callback();
+            }
+        }
+        const string UNDERLINE_PATH = "d:rPr/d:u";
+        /// <summary>
+        /// Underlined text
+        /// </summary>
+        public bool UnderLine
+        {
+            get
+            {
+                return ExistNode(UNDERLINE_PATH);
+            }
+            set
+            {
+                if (value)
+                {
+                    CreateNode(UNDERLINE_PATH);
+                }
+                else
+                {
+                    DeleteNode(UNDERLINE_PATH);
+                }
+                if (_callback != null) _callback();
+            }
+        }
+
+        const string VERT_ALIGN_PATH = "d:rPr/d:vertAlign/@val";
+        /// <summary>
+        /// Vertical Alignment
+        /// </summary>
+        public ExcelVerticalAlignmentFont VerticalAlign
+        {
+            get
+            {
+                string v=GetXmlNodeString(VERT_ALIGN_PATH);
+                if(v=="")
+                {
+                    return ExcelVerticalAlignmentFont.None;
+                }
+                else
+                {
+                    try
+                    {
+                        return (ExcelVerticalAlignmentFont)Enum.Parse(typeof(ExcelVerticalAlignmentFont), v, true);
+                    }
+                    catch
+                    {
+                        return ExcelVerticalAlignmentFont.None;
+                    }
+                }
+            }
+            set
+            {
+				if(value == ExcelVerticalAlignmentFont.None) {
+					// If Excel 2010 encounters a vertical align value of blank, it will not load
+					// the spreadsheet. So if None is specified, delete the node, it will be 
+					// recreated if a new value is applied later.
+					DeleteNode(VERT_ALIGN_PATH);
+				} else {
+					SetXmlNodeString(VERT_ALIGN_PATH, value.ToString().ToLowerInvariant());
+				}
+                if (_callback != null) _callback();
+            }
+        }
+        const string SIZE_PATH = "d:rPr/d:sz/@val";
+        /// <summary>
+        /// Font size
+        /// </summary>
+        public float Size
+        {
+            get
+            {
+                return Convert.ToSingle(GetXmlNodeDecimal(SIZE_PATH));
+            }
+            set
+            {
+                SetXmlNodeString(SIZE_PATH, value.ToString(CultureInfo.InvariantCulture));
+                if (_callback != null) _callback();
+            }
+        }
+        const string FONT_PATH = "d:rPr/d:rFont/@val";
+        /// <summary>
+        /// Name of the font
+        /// </summary>
+        public string FontName
+        {
+            get
+            {
+                return GetXmlNodeString(FONT_PATH);
+            }
+            set
+            {
+                SetXmlNodeString(FONT_PATH, value);
+                if (_callback != null) _callback();
+            }
+        }
+        const string COLOR_PATH = "d:rPr/d:color/@rgb";
+        /// <summary>
+        /// Text color
+        /// </summary>
+        public Color Color
+        {
+            get
+            {
+                string col = GetXmlNodeString(COLOR_PATH);
+                if (col == "")
+                {
+                    return Color.Empty;
+                }
+                else
+                {
+                    return Color.FromArgb(int.Parse(col, System.Globalization.NumberStyles.AllowHexSpecifier));
+                }
+            }
+            set
+            {
+                SetXmlNodeString(COLOR_PATH, value.ToArgb().ToString("X")/*.Substring(2, 6)*/);
+                if (_callback != null) _callback();
+            }
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/ExcelRichTextCollection.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/ExcelRichTextCollection.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/ExcelRichTextCollection.cs	(revision 12707)
@@ -0,0 +1,237 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		                Initial Release		        2009-10-01
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Xml;
+using System.Drawing;
+
+namespace OfficeOpenXml.Style
+{
+    /// <summary>
+    /// Collection of Richtext objects
+    /// </summary>
+    public class ExcelRichTextCollection : XmlHelper, IEnumerable<ExcelRichText>
+    {
+        List<ExcelRichText> _list = new List<ExcelRichText>();
+        ExcelRangeBase _cells=null;
+        internal ExcelRichTextCollection(XmlNamespaceManager ns, XmlNode topNode) :
+            base(ns, topNode)
+        {
+            var nl = topNode.SelectNodes("d:r", NameSpaceManager);
+            if (nl != null)
+            {
+                foreach (XmlNode n in nl)
+                {
+                    _list.Add(new ExcelRichText(ns, n));
+                }
+            }
+        }
+        internal ExcelRichTextCollection(XmlNamespaceManager ns, XmlNode topNode, ExcelRangeBase cells) :
+            this(ns, topNode)
+        {
+            _cells = cells;
+        }        
+        /// <summary>
+        /// Collection containing the richtext objects
+        /// </summary>
+        /// <param name="Index"></param>
+        /// <returns></returns>
+        public ExcelRichText this[int Index]
+        {
+            get
+            {
+                var item=_list[Index];
+                if(_cells!=null) item.SetCallback(UpdateCells);
+                return item;
+            }
+        }
+        /// <summary>
+        /// Items in the list
+        /// </summary>
+        public int Count
+        {
+            get
+            {
+                return _list.Count;
+            }
+        }
+        /// <summary>
+        /// Add a rich text string
+        /// </summary>
+        /// <param name="Text">The text to add</param>
+        /// <returns></returns>
+        public ExcelRichText Add(string Text)
+        {
+            XmlDocument doc;
+            if (TopNode is XmlDocument)
+            {
+                doc = TopNode as XmlDocument;
+            }
+            else
+            {
+                doc = TopNode.OwnerDocument;
+            }
+            var node = doc.CreateElement("d", "r", ExcelPackage.schemaMain);
+            TopNode.AppendChild(node);
+            var rt = new ExcelRichText(NameSpaceManager, node);
+            if (_list.Count > 0)
+            {
+                ExcelRichText prevItem = _list[_list.Count - 1];
+                rt.FontName = prevItem.FontName;
+                rt.Size = prevItem.Size;
+                if (prevItem.Color.IsEmpty)
+                {
+                    rt.Color = Color.Black;
+                }
+                else
+                {
+                    rt.Color = prevItem.Color;
+                }
+                rt.PreserveSpace = rt.PreserveSpace;
+                rt.Bold = prevItem.Bold;
+                rt.Italic = prevItem.Italic;                
+                rt.UnderLine = prevItem.UnderLine;
+            }
+            else if (_cells == null)
+            {
+                rt.FontName = "Calibri";
+                rt.Size = 11;
+            }
+            else
+            {
+                var style = _cells.Offset(0, 0).Style;
+                rt.FontName = style.Font.Name;
+                rt.Size = style.Font.Size;
+                rt.Bold = style.Font.Bold;
+                rt.Italic = style.Font.Italic;
+                _cells.IsRichText = true;
+            }
+            rt.Text = Text;
+            rt.PreserveSpace = true;
+            if(_cells!=null) 
+            {
+                rt.SetCallback(UpdateCells);
+                UpdateCells();
+            }
+            _list.Add(rt);
+            return rt;
+        }
+        internal void UpdateCells()
+        {
+            _cells.SetValueRichText(TopNode.InnerXml);
+        }
+        /// <summary>
+        /// Clear the collection
+        /// </summary>
+        public void Clear()
+        {
+            _list.Clear();
+            TopNode.RemoveAll();
+            UpdateCells();
+            if (_cells != null) _cells.IsRichText = false;
+        }
+        /// <summary>
+        /// Removes an item at the specific index
+        /// </summary>
+        /// <param name="Index"></param>
+        public void RemoveAt(int Index)
+        {
+            TopNode.RemoveChild(_list[Index].TopNode);
+            _list.RemoveAt(Index);
+            if (_cells != null && _list.Count==0) _cells.IsRichText = false;
+        }
+        /// <summary>
+        /// Removes an item
+        /// </summary>
+        /// <param name="Item"></param>
+        public void Remove(ExcelRichText Item)
+        {
+            TopNode.RemoveChild(Item.TopNode);
+            _list.Remove(Item);
+            if (_cells != null && _list.Count == 0) _cells.IsRichText = false;
+        }
+        //public void Insert(int index, string Text)
+        //{
+        //    _list.Insert(index, item);
+        //}
+        
+        /// <summary>
+        /// The text
+        /// </summary>
+        public string Text
+        {
+            get
+            {
+                StringBuilder sb=new StringBuilder();
+                foreach (var item in _list)
+                {
+                    sb.Append(item.Text);
+                }
+                return sb.ToString();
+            }
+            set
+            {
+                if (Count == 0)
+                {
+                    Add(value);
+                }
+                else
+                {
+                    this[0].Text = value;
+                    for (int ix = 1; ix < Count; ix++)
+                    {
+                        RemoveAt(ix);
+                    }
+                }
+            }
+        }
+        #region IEnumerable<ExcelRichText> Members
+
+        IEnumerator<ExcelRichText> IEnumerable<ExcelRichText>.GetEnumerator()
+        {
+            return _list.Select(x => { x.SetCallback(UpdateCells); return x; }).GetEnumerator();
+        }
+
+        #endregion
+
+        #region IEnumerable Members
+
+        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
+        {
+            return _list.Select(x => { x.SetCallback(UpdateCells); return x; }).GetEnumerator();
+        }
+
+        #endregion
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/ExcelRichTextHtmlUtility.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/ExcelRichTextHtmlUtility.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/ExcelRichTextHtmlUtility.cs	(revision 12707)
@@ -0,0 +1,200 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author				Change						Date
+ * ******************************************************************************
+ * Richard Tallent		Initial Release				2012-08-13
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Text.RegularExpressions;
+
+namespace OfficeOpenXml.Style
+{
+	public class ExcelRichTextHtmlUtility
+	{
+
+		/// <summary>
+		/// Provides basic HTML support by converting well-behaved HTML into appropriate RichText blocks.
+		/// HTML support is limited, and does not include font colors, sizes, or typefaces at this time,
+		/// and also does not support CSS style attributes. It does support line breaks using the BR tag.
+		///
+		/// This routine parses the HTML into RegEx pairings of an HTML tag and the text until the NEXT 
+		/// tag (if any). The tag is parsed to determine the setting change to be applied to the last set
+		/// of settings, and if the text is not blank, a new block is added to rich text.
+		/// </summary>
+		/// <param name="range"></param>
+		/// <param name="html">The HTML to parse into RichText</param>
+		/// <param name="defaultFontName"></param>
+		/// <param name="defaultFontSize"></param>
+
+		public static void SetRichTextFromHtml(ExcelRange range, string html, string defaultFontName, short defaultFontSize)
+		{
+			// Reset the cell value, just in case there is an existing RichText value.
+			range.Value = "";
+
+			// Sanity check for blank values, skips creating Regex objects for performance.
+			if (String.IsNullOrEmpty(html))
+			{
+				range.IsRichText = false;
+				return;
+			}
+
+			// Change all BR tags to line breaks. http://epplus.codeplex.com/discussions/238692/
+			// Cells with line breaks aren't necessarily considered rich text, so this is performed
+			// before parsing the HTML tags.
+			html = System.Text.RegularExpressions.Regex.Replace(html, @"<br[^>]*>", "\r\n", RegexOptions.Compiled | RegexOptions.IgnoreCase);
+
+			string tag;
+			string text;
+			ExcelRichText thisrt = null;
+			bool isFirst = true;
+
+			// Get all pairs of legitimate tags and the text between them. This loop will
+			// only execute if there is at least one start or end tag.
+			foreach (Match m in System.Text.RegularExpressions.Regex.Matches(html, @"<(/?[a-z]+)[^<>]*>([\s\S]*?)(?=</?[a-z]+[^<>]*>|$)", RegexOptions.Compiled | RegexOptions.IgnoreCase))
+			{
+				if (isFirst)
+				{
+					// On the very first match, set up the initial rich text object with
+					// the defaults for the text BEFORE the match.
+					range.IsRichText = true;
+					thisrt = range.RichText.Add(CleanText(html.Substring(0, m.Index)));	// May be 0-length
+					thisrt.Size = defaultFontSize;										// Set the default font size
+					thisrt.FontName = defaultFontName;									// Set the default font name
+					isFirst = false;
+				}
+				// Get the tag and the block of text until the NEXT tag or EOS. If there are HTML entities
+				// encoded, unencode them, they should be passed to RichText as normal characters (other
+				// than non-breaking spaces, which should be replaced with normal spaces, they break Excel.
+				tag = m.Groups[1].Captures[0].Value;
+				text = CleanText(m.Groups[2].Captures[0].Value);
+
+				if (thisrt.Text == "")
+				{
+					// The most recent rich text block wasn't *actually* used last time around, so update
+					// the text and keep it as the "current" block. This happens with the first block if
+					// it starts with a tag, and may happen later if tags come one right after the other.
+					thisrt.Text = text;
+				}
+				else
+				{
+					// The current rich text block has some text, so create a new one. RichText.Add()
+					// automatically applies the settings from the previous block, other than vertical
+					// alignment.
+					thisrt = range.RichText.Add(text);
+				}
+				// Override the settings based on the current tag, keep all other settings.
+				SetStyleFromTag(tag, thisrt);
+			}
+
+			if (thisrt == null)
+			{
+				// No HTML tags were found, so treat this as a normal text value.
+				range.IsRichText = false;
+				range.Value = CleanText(html);
+			}
+			else if (String.IsNullOrEmpty(thisrt.Text))
+			{
+				// Rich text was found, but the last node contains no text, so remove it. This can happen if,
+				// say, the end of the string is an end tag or unsupported tag (common).
+				range.RichText.Remove(thisrt);
+
+				// Failsafe -- the HTML may be just tags, no text, in which case there may be no rich text
+				// directives that remain. If that is the case, turn off rich text and treat this like a blank
+				// cell value.
+				if (range.RichText.Count == 0)
+				{
+					range.IsRichText = false;
+					range.Value = "";
+				}
+
+			}
+
+		}
+
+		private static void SetStyleFromTag(string tag, ExcelRichText settings)
+		{
+			switch (tag.ToLower())
+			{
+				case "b":
+				case "strong":
+					settings.Bold = true;
+					break;
+				case "i":
+				case "em":
+					settings.Italic = true;
+					break;
+				case "u":
+					settings.UnderLine = true;
+					break;
+				case "s":
+				case "strike":
+					settings.Strike = true;
+					break;
+				case "sup":
+					settings.VerticalAlign = ExcelVerticalAlignmentFont.Superscript;
+					break;
+				case "sub":
+					settings.VerticalAlign = ExcelVerticalAlignmentFont.Subscript;
+					break;
+				case "/b":
+				case "/strong":
+					settings.Bold = false;
+					break;
+				case "/i":
+				case "/em":
+					settings.Italic = false;
+					break;
+				case "/u":
+					settings.UnderLine = false;
+					break;
+				case "/s":
+				case "/strike":
+					settings.Strike = false;
+					break;
+				case "/sup":
+				case "/sub":
+					settings.VerticalAlign = ExcelVerticalAlignmentFont.None;
+					break;
+				default:
+					// unsupported HTML, no style change
+					break;
+			}
+		}
+
+		private static string CleanText(string s)
+		{
+			// Need to convert HTML entities (named or numbered) into actual Unicode characters
+			s = System.Web.HttpUtility.HtmlDecode(s);
+			// Remove any non-breaking spaces, kills Excel
+			s = s.Replace("\u00A0", " ");
+			return s;
+		}
+
+	}
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/ExcelStyle.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/ExcelStyle.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/ExcelStyle.cs	(revision 12707)
@@ -0,0 +1,252 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		                Initial Release		        2009-10-01
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+using OfficeOpenXml.Style.XmlAccess;
+
+namespace OfficeOpenXml.Style
+{
+    /// <summary>
+    /// Toplevel class for cell styling
+    /// </summary>
+    public sealed class ExcelStyle : StyleBase
+    {
+        internal ExcelStyle(ExcelStyles styles, OfficeOpenXml.XmlHelper.ChangedEventHandler ChangedEvent, int positionID, string Address, int xfsId) :
+            base(styles, ChangedEvent, positionID, Address)
+        {
+            Index = xfsId;
+            ExcelXfs xfs;
+            if (positionID > -1)
+            {
+                xfs = _styles.CellXfs[xfsId];
+            }
+            else
+            {
+                xfs = _styles.CellStyleXfs[xfsId];
+            }
+            Styles = styles;
+            PositionID = positionID;
+            Numberformat = new ExcelNumberFormat(styles, ChangedEvent, PositionID, Address, xfs.NumberFormatId);
+            Font = new ExcelFont(styles, ChangedEvent, PositionID, Address, xfs.FontId);
+            Fill = new ExcelFill(styles, ChangedEvent, PositionID, Address, xfs.FillId);
+            Border = new Border(styles, ChangedEvent, PositionID, Address, xfs.BorderId); 
+        }
+        /// <summary>
+        /// Numberformat
+        /// </summary>
+        public ExcelNumberFormat Numberformat { get; set; }
+        /// <summary>
+        /// Font styling
+        /// </summary>
+        public ExcelFont Font { get; set; }
+        /// <summary>
+        /// Fill Styling
+        /// </summary>
+        public ExcelFill Fill { get; set; }
+        /// <summary>
+        /// Border 
+        /// </summary>
+        public Border Border { get; set; }
+        /// <summary>
+        /// The horizontal alignment in the cell
+        /// </summary>
+        public ExcelHorizontalAlignment HorizontalAlignment
+        {
+            get
+            {
+                return _styles.CellXfs[Index].HorizontalAlignment;
+            }
+            set
+            {
+                _ChangedEvent(this, new StyleChangeEventArgs(eStyleClass.Style, eStyleProperty.HorizontalAlign, value, _positionID, _address));
+            }
+        }
+        /// <summary>
+        /// The vertical alignment in the cell
+        /// </summary>
+        public ExcelVerticalAlignment VerticalAlignment
+        {
+            get
+            {
+                return _styles.CellXfs[Index].VerticalAlignment;
+            }
+            set
+            {
+                _ChangedEvent(this, new StyleChangeEventArgs(eStyleClass.Style, eStyleProperty.VerticalAlign, value, _positionID, _address));
+            }
+        }
+        /// <summary>
+        /// Wrap the text
+        /// </summary>
+        public bool WrapText
+        {
+            get
+            {
+                return _styles.CellXfs[Index].WrapText;
+            }
+            set
+            {
+                _ChangedEvent(this, new StyleChangeEventArgs(eStyleClass.Style, eStyleProperty.WrapText, value, _positionID, _address));
+            }
+        }
+        /// <summary>
+        /// Readingorder
+        /// </summary>
+        public ExcelReadingOrder ReadingOrder
+        {
+            get
+            {
+                return _styles.CellXfs[Index].ReadingOrder;
+            }
+            set
+            {
+                _ChangedEvent(this, new StyleChangeEventArgs(eStyleClass.Style, eStyleProperty.ReadingOrder, value, _positionID, _address));
+            }
+        }
+        /// <summary>
+        /// Shrink the text to fit
+        /// </summary>
+        public bool ShrinkToFit
+        {
+            get
+            {
+                return _styles.CellXfs[Index].ShrinkToFit;
+            }
+            set
+            {
+                _ChangedEvent(this, new StyleChangeEventArgs(eStyleClass.Style, eStyleProperty.ShrinkToFit, value, _positionID, _address));
+            }
+        }
+        /// <summary>
+        /// The margin between the border and the text
+        /// </summary>
+        public int Indent
+        {
+            get
+            {
+                return _styles.CellXfs[Index].Indent;
+            }
+            set
+            {
+                if (value <0 || value > 250)
+                {
+                    throw(new ArgumentOutOfRangeException("Indent must be between 0 and 250"));
+                }
+                _ChangedEvent(this, new StyleChangeEventArgs(eStyleClass.Style, eStyleProperty.Indent, value, _positionID, _address));
+            }
+        }
+        /// <summary>
+        /// Text orientation in degrees. Values range from 0 to 180.
+        /// </summary>
+        public int TextRotation
+        {
+            get
+            {
+                return _styles.CellXfs[Index].TextRotation;
+            }
+            set
+            {
+                if (value < 0 || value > 180)
+                {
+                    throw new ArgumentOutOfRangeException("TextRotation out of range.");
+                }
+                _ChangedEvent(this, new StyleChangeEventArgs(eStyleClass.Style, eStyleProperty.TextRotation, value, _positionID, _address));
+            }
+        }
+        /// <summary>
+        /// If true the cell is locked for editing when the sheet is protected
+        /// <seealso cref="ExcelWorksheet.Protection"/>
+        /// </summary>
+        public bool Locked
+        {
+            get
+            {
+                return _styles.CellXfs[Index].Locked;
+            }
+            set
+            {
+                _ChangedEvent(this, new StyleChangeEventArgs(eStyleClass.Style, eStyleProperty.Locked, value, _positionID, _address));
+            }
+        }
+        /// <summary>
+        /// If true the formula is hidden when the sheet is protected.
+        /// <seealso cref="ExcelWorksheet.Protection"/>
+        /// </summary>
+        public bool Hidden
+        {
+            get
+            {
+                return _styles.CellXfs[Index].Hidden;
+            }
+            set
+            {
+                _ChangedEvent(this, new StyleChangeEventArgs(eStyleClass.Style, eStyleProperty.Hidden, value, _positionID, _address));
+            }
+        }
+
+
+        const string xfIdPath = "@xfId";
+        /// <summary>
+        /// The index in the style collection
+        /// </summary>
+        public int XfId 
+        {
+            get
+            {
+                return _styles.CellXfs[Index].XfId;
+            }
+            set
+            {
+                _ChangedEvent(this, new StyleChangeEventArgs(eStyleClass.Style, eStyleProperty.XfId, value, _positionID, _address));
+            }
+        }
+        internal int PositionID
+        {
+            get;
+            set;
+        }
+        internal ExcelStyles Styles
+        {
+            get;
+            set;
+        }
+        internal override string Id
+        {
+            get 
+            { 
+                return Numberformat.Id + "|" + Font.Id + "|" + Fill.Id + "|" + Border.Id + "|" + VerticalAlignment + "|" + HorizontalAlignment + "|" + WrapText.ToString() + "|" + ReadingOrder.ToString() + "|" + XfId.ToString(); 
+            }
+        }
+
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/ExcelTextFont.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/ExcelTextFont.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/ExcelTextFont.cs	(revision 12707)
@@ -0,0 +1,307 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		                Initial Release		        2009-10-01
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Text;
+using System.Xml;
+using OfficeOpenXml.Drawing;
+using System.Drawing;
+
+namespace OfficeOpenXml.Style
+{
+    /// <summary>
+    /// Linestyle
+    /// </summary>
+    public enum eUnderLineType
+    {
+        Dash,
+        DashHeavy,
+        DashLong, 
+        DashLongHeavy,
+        Double,
+        DotDash,
+        DotDashHeavy,
+        DotDotDash,
+        DotDotDashHeavy,
+        Dotted,
+        DottedHeavy,
+        Heavy,
+        None,
+        Single,
+        Wavy,
+        WavyDbl,
+        WavyHeavy,
+        Words
+    }
+    /// <summary>
+    /// Type of font strike
+    /// </summary>
+    public enum eStrikeType
+    {
+        Double,
+        No,
+        Single
+    }
+    /// <summary>
+    /// Used by Rich-text and Paragraphs.
+    /// </summary>
+    public class ExcelTextFont : XmlHelper
+    {
+        string _path;
+        XmlNode _rootNode;
+        internal ExcelTextFont(XmlNamespaceManager namespaceManager, XmlNode rootNode, string path, string[] schemaNodeOrder)
+            : base(namespaceManager, rootNode)
+        {
+            SchemaNodeOrder = schemaNodeOrder;
+            _rootNode = rootNode;
+            if (path != "")
+            {
+                XmlNode node = rootNode.SelectSingleNode(path, namespaceManager);
+                if (node != null)
+                {
+                    TopNode = node;
+                }
+            }
+            _path = path;
+        }
+        string _fontLatinPath = "a:latin/@typeface";
+        public string LatinFont
+        {
+            get
+            {
+                return GetXmlNodeString(_fontLatinPath);
+            }
+            set
+            {
+                CreateTopNode();
+                SetXmlNodeString(_fontLatinPath, value);
+            }
+        }
+
+        protected internal void CreateTopNode()
+        {
+            if (_path!="" && TopNode == _rootNode)
+            {
+                CreateNode(_path);
+                TopNode = _rootNode.SelectSingleNode(_path, NameSpaceManager);
+            }
+        }
+        string _fontCsPath = "a:cs/@typeface";
+        public string ComplexFont
+        {
+            get
+            {
+                return GetXmlNodeString(_fontCsPath);
+            }
+            set
+            {
+                CreateTopNode();
+                SetXmlNodeString(_fontCsPath, value);
+            }
+        }
+        string _boldPath = "@b";
+        public bool Bold
+        {
+            get
+            {
+                return GetXmlNodeBool(_boldPath);
+            }
+            set
+            {
+                CreateTopNode();
+                SetXmlNodeString(_boldPath, value ? "1" : "0");
+            }
+        }
+        string _underLinePath = "@u";
+        public eUnderLineType UnderLine
+        {
+            get
+            {
+                return TranslateUnderline(GetXmlNodeString(_underLinePath));
+            }
+            set
+            {
+                CreateTopNode();
+                SetXmlNodeString(_underLinePath, TranslateUnderlineText(value));
+            }
+        }
+        string _underLineColorPath = "a:uFill/a:solidFill/a:srgbClr/@val";
+        public Color UnderLineColor
+        {
+            get
+            {
+                string col = GetXmlNodeString(_underLineColorPath);
+                if (col == "")
+                {
+                    return Color.Empty;
+                }
+                else
+                {
+                    return Color.FromArgb(int.Parse(col, System.Globalization.NumberStyles.AllowHexSpecifier));
+                }
+            }
+            set
+            {
+                CreateTopNode();
+                SetXmlNodeString(_underLineColorPath, value.ToArgb().ToString("X").Substring(2, 6));
+            }
+        }
+        string _italicPath = "@i";
+        public bool Italic
+        {
+            get
+            {
+                return GetXmlNodeBool(_italicPath);
+            }
+            set
+            {
+                CreateTopNode();
+                SetXmlNodeString(_italicPath, value ? "1" : "0");
+            }
+        }
+        string _strikePath = "@strike";
+        public eStrikeType Strike
+        {
+            get
+            {
+                return TranslateStrike(GetXmlNodeString(_strikePath));
+            }
+            set
+            {
+                CreateTopNode();
+                SetXmlNodeString(_strikePath, TranslateStrikeText(value));
+            }
+        }
+        string _sizePath = "@sz";
+        public float Size
+        {
+            get
+            {
+                return GetXmlNodeInt(_sizePath) / 100;
+            }
+            set
+            {
+                CreateTopNode();
+                SetXmlNodeString(_sizePath, ((int)(value * 100)).ToString());
+            }
+        }
+        string _colorPath = "a:solidFill/a:srgbClr/@val";
+        public Color Color
+        {
+            get
+            {
+                string col = GetXmlNodeString(_colorPath);
+                if (col == "")
+                {
+                    return Color.Empty;
+                }
+                else
+                {
+                    return Color.FromArgb(int.Parse(col, System.Globalization.NumberStyles.AllowHexSpecifier));
+                }
+            }
+            set
+            {
+                CreateTopNode();
+                SetXmlNodeString(_colorPath, value.ToArgb().ToString("X").Substring(2, 6));
+            }
+        }
+        #region "Translate methods"
+        private eUnderLineType TranslateUnderline(string text)
+        {
+            switch (text)
+            {
+                case "sng":
+                    return eUnderLineType.Single;
+                case "dbl":
+                    return eUnderLineType.Double;
+                case "":
+                    return eUnderLineType.None;
+                default:
+                    return (eUnderLineType)Enum.Parse(typeof(eUnderLineType), text);
+            }
+        }
+        private string TranslateUnderlineText(eUnderLineType value)
+        {
+            switch (value)
+            {
+                case eUnderLineType.Single:
+                    return "sng";
+                case eUnderLineType.Double:
+                    return "dbl";
+                default:
+                    string ret = value.ToString();
+                    return ret.Substring(0, 1).ToLower(CultureInfo.InvariantCulture) + ret.Substring(1, ret.Length - 1);
+            }
+        }
+        private eStrikeType TranslateStrike(string text)
+        {
+            switch (text)
+            {
+                case "dblStrike":
+                    return eStrikeType.Double;
+                case "sngStrike":
+                    return eStrikeType.Single;
+                default:
+                    return eStrikeType.No;
+            }
+        }
+        private string TranslateStrikeText(eStrikeType value)
+        {
+            switch (value)
+            {
+                case eStrikeType.Single:
+                    return "sngStrike";
+                case eStrikeType.Double:
+                    return "dblStrike";
+                default:
+                    return "noStrike";
+            }
+        }
+        #endregion
+        /// <summary>
+        /// Set the font style from a font object
+        /// </summary>
+        /// <param name="Font"></param>
+        public void SetFromFont(Font Font)
+        {
+            LatinFont = Font.Name;
+            ComplexFont = Font.Name;
+            Size = Font.Size;
+            if (Font.Bold) Bold = Font.Bold;
+            if (Font.Italic) Italic = Font.Italic;
+            if (Font.Underline) UnderLine = eUnderLineType.Single;
+            if (Font.Strikeout) Strike = eStrikeType.Single;
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/IStyle.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/IStyle.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/IStyle.cs	(revision 12707)
@@ -0,0 +1,44 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		                Initial Release		        2009-10-01
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+using OfficeOpenXml.Style;
+namespace OfficeOpenXml.Style
+{
+    internal interface IStyle
+    {
+        void SetNewStyleID(string value);
+        ulong Id {get;}
+        ExcelStyle ExcelStyle{get;}
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/StyleBase.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/StyleBase.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/StyleBase.cs	(revision 12707)
@@ -0,0 +1,184 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		                Initial Release		        2009-10-01
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace OfficeOpenXml.Style
+{
+    /// <summary>
+    /// Border line style
+    /// </summary>
+    public enum ExcelBorderStyle
+    {
+        None,
+        Hair,
+        Dotted,
+        DashDot,
+        Thin,
+        DashDotDot,
+        Dashed,
+        MediumDashDotDot,
+        MediumDashed,
+        MediumDashDot,
+        Thick,
+        Medium,
+        Double
+    };
+    /// <summary>
+    /// Horizontal text alignment
+    /// </summary>
+    public enum ExcelHorizontalAlignment
+    {
+        General,
+        Left,
+        Center,
+        CenterContinuous,
+        Right,
+        Fill,
+        Distributed,
+        Justify
+    }
+    /// <summary>
+    /// Vertical text alignment
+    /// </summary>
+    public enum ExcelVerticalAlignment
+    {
+        Top,
+        Center,
+        Bottom,
+        Distributed,
+        Justify
+    }
+    /// <summary>
+    /// Font-Vertical Align
+    /// </summary>
+    public enum ExcelVerticalAlignmentFont
+    {
+        None,
+        Subscript,
+        Superscript
+    }
+    /// <summary>
+    /// Font-Underlinestyle for 
+    /// </summary>
+    public enum ExcelUnderLineType
+    {
+        None,
+        Single,
+        Double,
+        SingleAccounting,
+        DoubleAccounting
+    }
+    /// <summary>
+    /// Fill pattern
+    /// </summary>
+    public enum ExcelFillStyle
+    {
+        None,
+        Solid,
+        DarkGray,
+        MediumGray,
+        LightGray,
+        Gray125,
+        Gray0625,
+        DarkVertical,
+        DarkHorizontal,
+        DarkDown,
+        DarkUp,
+        DarkGrid,
+        DarkTrellis,
+        LightVertical,
+        LightHorizontal,
+        LightDown,
+        LightUp,
+        LightGrid,
+        LightTrellis
+    }
+    /// <summary>
+    /// Type of gradient fill
+    /// </summary>
+    public enum ExcelFillGradientType
+    {
+        /// <summary>
+        /// No gradient fill. 
+        /// </summary>
+        None,
+        /// <summary>
+        /// This gradient fill is of linear gradient type. Linear gradient type means that the transition from one color to the next is along a line (e.g., horizontal, vertical,diagonal, etc.)
+        /// </summary>
+        Linear,
+        /// <summary>
+        /// This gradient fill is of path gradient type. Path gradient type means the that the boundary of transition from one color to the next is a rectangle, defined by top,bottom, left, and right attributes on the gradientFill element.
+        /// </summary>
+        Path
+    }
+    /// <summary>
+    /// The reading order
+    /// </summary>
+    public enum ExcelReadingOrder
+    {
+        /// <summary>
+        /// Reading order is determined by scanning the text for the first non-whitespace character: if it is a strong right-to-left character, the reading order is right-to-left; otherwise, the reading order left-to-right.
+        /// </summary>
+        ContextDependent=0,
+        /// <summary>
+        /// Left to Right
+        /// </summary>
+        LeftToRight=1,
+        /// <summary>
+        /// Right to Left
+        /// </summary>
+        RightToLeft=2
+    }
+    public abstract class StyleBase
+    {
+        protected ExcelStyles _styles;
+        internal OfficeOpenXml.XmlHelper.ChangedEventHandler _ChangedEvent;
+        protected int _positionID;
+        protected string _address;
+        internal StyleBase(ExcelStyles styles, OfficeOpenXml.XmlHelper.ChangedEventHandler ChangedEvent, int PositionID, string Address)
+        {
+            _styles = styles;
+            _ChangedEvent = ChangedEvent;
+            _address = Address;
+            _positionID = PositionID;
+        }
+        internal int Index { get; set;}
+        internal abstract string Id {get;}
+
+        internal virtual void SetIndex(int index)
+        {
+            Index = index;
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/StyleChangeEventArgs.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/StyleChangeEventArgs.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/StyleChangeEventArgs.cs	(revision 12707)
@@ -0,0 +1,113 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		                Initial Release		        2009-10-01
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+namespace OfficeOpenXml.Style
+{
+    internal enum eStyleClass
+    {
+        Numberformat,
+        Font,    
+        Border,
+        BorderTop,
+        BorderLeft,
+        BorderBottom,
+        BorderRight,
+        BorderDiagonal,
+        Fill,
+        GradientFill,
+        FillBackgroundColor,
+        FillPatternColor,
+        FillGradientColor1,
+        FillGradientColor2,
+        NamedStyle,
+        Style
+    };
+    internal enum eStyleProperty
+    {
+        Format,
+        Name,
+        Size,
+        Bold,
+        Italic,
+        Strike,
+        Color,
+        Tint,
+        IndexedColor,
+        AutoColor,
+        GradientColor,
+        Family,
+        Scheme,
+        UnderlineType,
+        HorizontalAlign,
+        VerticalAlign,
+        Border,
+        NamedStyle,
+        Style,
+        PatternType,
+        ReadingOrder,
+        WrapText,
+        TextRotation,
+        Locked,
+        Hidden,
+        ShrinkToFit,
+        BorderDiagonalUp,
+        BorderDiagonalDown,
+        GradientDegree,
+        GradientType,
+        GradientTop,
+        GradientBottom,
+        GradientLeft,
+        GradientRight,
+        XfId,
+        Indent
+    }
+    internal class StyleChangeEventArgs : EventArgs
+    {
+        internal StyleChangeEventArgs(eStyleClass styleclass, eStyleProperty styleProperty, object value, int positionID, string address)
+        {
+            StyleClass = styleclass;
+            StyleProperty=styleProperty;
+            Value = value;
+            Address = address;
+            PositionID = positionID;
+        }
+        internal eStyleClass StyleClass;
+        internal eStyleProperty StyleProperty;
+        //internal string PropertyName;
+        internal object Value;
+        internal int PositionID { get; set; }
+        //internal string Address;
+        internal string Address;
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/XmlAccess/ExcelBorderItemXml.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/XmlAccess/ExcelBorderItemXml.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/XmlAccess/ExcelBorderItemXml.cs	(revision 12707)
@@ -0,0 +1,157 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		                Initial Release		        2009-10-01
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Text;
+using System.Xml;
+using OfficeOpenXml.Style;
+namespace OfficeOpenXml.Style.XmlAccess
+{
+    /// <summary>
+    /// Xml access class for border items
+    /// </summary>
+    public sealed class ExcelBorderItemXml : StyleXmlHelper
+    {
+        internal ExcelBorderItemXml(XmlNamespaceManager nameSpaceManager) : base(nameSpaceManager)
+        {
+            _borderStyle=ExcelBorderStyle.None;
+            _color = new ExcelColorXml(NameSpaceManager);
+        }
+        internal ExcelBorderItemXml(XmlNamespaceManager nsm, XmlNode topNode) :
+            base(nsm, topNode)
+        {
+            if (topNode != null)
+            {
+                _borderStyle = GetBorderStyle(GetXmlNodeString("@style"));
+                _color = new ExcelColorXml(nsm, topNode.SelectSingleNode(_colorPath, nsm));
+                Exists = true;
+            }
+            else
+            {
+                Exists = false;
+            }
+        }
+
+        private ExcelBorderStyle GetBorderStyle(string style)
+        {
+            if(style=="") return ExcelBorderStyle.None;
+            string sInStyle = style.Substring(0, 1).ToUpper(CultureInfo.InvariantCulture) + style.Substring(1, style.Length - 1);
+            try
+            {
+                return (ExcelBorderStyle)Enum.Parse(typeof(ExcelBorderStyle), sInStyle);
+            }
+            catch
+            {
+                return ExcelBorderStyle.None;
+            }
+
+        }
+        ExcelBorderStyle _borderStyle = ExcelBorderStyle.None;
+        /// <summary>
+        /// Cell Border style
+        /// </summary>
+        public ExcelBorderStyle Style
+        {
+            get
+            {
+                return _borderStyle;
+            }
+            set
+            {
+                _borderStyle = value;
+                Exists = true;
+            }
+        }
+        ExcelColorXml _color = null;
+        const string _colorPath = "d:color";
+        /// <summary>
+        /// Border style
+        /// </summary>
+        public ExcelColorXml Color
+        {
+            get
+            {
+                return _color;
+            }
+            internal set
+            {
+                _color = value;
+            }
+        }
+        internal override string Id
+        {
+            get 
+            {
+                if (Exists)
+                {
+                    return Style + Color.Id;
+                }
+                else
+                {
+                    return "None";
+                }
+            }
+        }
+
+        internal ExcelBorderItemXml Copy()
+        {
+            ExcelBorderItemXml borderItem = new ExcelBorderItemXml(NameSpaceManager);
+            borderItem.Style = _borderStyle;
+            borderItem.Color = _color.Copy();
+            return borderItem;
+        }
+
+        internal override XmlNode CreateXmlNode(XmlNode topNode)
+        {
+            TopNode = topNode;
+
+            if (Style != ExcelBorderStyle.None)
+            {
+                SetXmlNodeString("@style", SetBorderString(Style));
+                if (Color.Exists)
+                {
+                    CreateNode(_colorPath);
+                    topNode.AppendChild(Color.CreateXmlNode(TopNode.SelectSingleNode(_colorPath,NameSpaceManager)));
+                }
+            }
+            return TopNode;
+        }
+
+        private string SetBorderString(ExcelBorderStyle Style)
+        {
+            string newName=Enum.GetName(typeof(ExcelBorderStyle), Style);
+            return newName.Substring(0, 1).ToLower(CultureInfo.InvariantCulture) + newName.Substring(1, newName.Length - 1);
+        }
+        public bool Exists { get; private set; }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/XmlAccess/ExcelBorderXml.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/XmlAccess/ExcelBorderXml.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/XmlAccess/ExcelBorderXml.cs	(revision 12707)
@@ -0,0 +1,216 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		                Initial Release		        2009-10-01
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Xml;
+namespace OfficeOpenXml.Style.XmlAccess
+{
+    /// <summary>
+    /// Xml access class for border top level
+    /// </summary>
+    public sealed class ExcelBorderXml : StyleXmlHelper
+    {
+        internal ExcelBorderXml(XmlNamespaceManager nameSpaceManager)
+            : base(nameSpaceManager)
+        {
+
+        }
+        internal ExcelBorderXml(XmlNamespaceManager nsm, XmlNode topNode) :
+            base(nsm, topNode)
+        {
+            _left = new ExcelBorderItemXml(nsm, topNode.SelectSingleNode(leftPath, nsm));
+            _right = new ExcelBorderItemXml(nsm, topNode.SelectSingleNode(rightPath, nsm));
+            _top = new ExcelBorderItemXml(nsm, topNode.SelectSingleNode(topPath, nsm));
+            _bottom = new ExcelBorderItemXml(nsm, topNode.SelectSingleNode(bottomPath, nsm));
+            _diagonal = new ExcelBorderItemXml(nsm, topNode.SelectSingleNode(diagonalPath, nsm));
+        }
+        internal override string Id
+        {
+            get
+            {
+                return Left.Id + Right.Id + Top.Id + Bottom.Id + Diagonal.Id + DiagonalUp.ToString() + DiagonalDown.ToString();
+            }
+        }
+        const string leftPath = "d:left";
+        ExcelBorderItemXml _left = null;
+        /// <summary>
+        /// Left border style properties
+        /// </summary>
+        public ExcelBorderItemXml Left
+        {
+            get
+            {
+                return _left;
+            }
+            internal set
+            {
+                _left = value;
+            }
+        }
+        const string rightPath = "d:right";
+        ExcelBorderItemXml _right = null;
+        /// <summary>
+        /// Right border style properties
+        /// </summary>
+        public ExcelBorderItemXml Right
+        {
+            get
+            {
+                return _right;
+            }
+            internal set
+            {
+                _right = value;
+            }
+        }
+        const string topPath = "d:top";
+        ExcelBorderItemXml _top = null;
+        /// <summary>
+        /// Top border style properties
+        /// </summary>
+        public ExcelBorderItemXml Top
+        {
+            get
+            {
+                return _top;
+            }
+            internal set
+            {
+                _top = value;
+            }
+        }
+        const string bottomPath = "d:bottom";
+        ExcelBorderItemXml _bottom = null;
+        /// <summary>
+        /// Bottom border style properties
+        /// </summary>
+        public ExcelBorderItemXml Bottom
+        {
+            get
+            {
+                return _bottom;
+            }
+            internal set
+            {
+                _bottom = value;
+            }
+        }
+        const string diagonalPath = "d:diagonal";
+        ExcelBorderItemXml _diagonal = null;
+        /// <summary>
+        /// Diagonal border style properties
+        /// </summary>
+        public ExcelBorderItemXml Diagonal
+        {
+            get
+            {
+                return _diagonal;
+            }
+            internal set
+            {
+                _diagonal = value;
+            }
+        }
+        const string diagonalUpPath = "@diagonalUp";
+        bool _diagonalUp = false;
+        /// <summary>
+        /// Diagonal up border
+        /// </summary>
+        public bool DiagonalUp
+        {
+            get
+            {
+                return _diagonalUp;
+            }
+            internal set
+            {
+                _diagonalUp = value;
+            }
+        }
+        const string diagonalDownPath = "@diagonalDown";
+        bool _diagonalDown = false;
+        /// <summary>
+        /// Diagonal down border
+        /// </summary>
+        public bool DiagonalDown
+        {
+            get
+            {
+                return _diagonalDown;
+            }
+            internal set
+            {
+                _diagonalDown = value;
+            }
+        }
+
+        internal ExcelBorderXml Copy()
+        {
+            ExcelBorderXml newBorder = new ExcelBorderXml(NameSpaceManager);
+            newBorder.Bottom = _bottom.Copy();
+            newBorder.Diagonal = _diagonal.Copy();
+            newBorder.Left = _left.Copy();
+            newBorder.Right = _right.Copy();
+            newBorder.Top = _top.Copy();
+            newBorder.DiagonalUp = _diagonalUp;
+            newBorder.DiagonalDown = _diagonalDown;
+
+            return newBorder;
+
+        }
+
+        internal override XmlNode CreateXmlNode(XmlNode topNode)
+        {
+            TopNode = topNode;
+            CreateNode(leftPath);
+            topNode.AppendChild(_left.CreateXmlNode(TopNode.SelectSingleNode(leftPath, NameSpaceManager)));
+            CreateNode(rightPath);
+            topNode.AppendChild(_right.CreateXmlNode(TopNode.SelectSingleNode(rightPath, NameSpaceManager)));
+            CreateNode(topPath);
+            topNode.AppendChild(_top.CreateXmlNode(TopNode.SelectSingleNode(topPath, NameSpaceManager)));
+            CreateNode(bottomPath);
+            topNode.AppendChild(_bottom.CreateXmlNode(TopNode.SelectSingleNode(bottomPath, NameSpaceManager)));
+            CreateNode(diagonalPath);
+            topNode.AppendChild(_diagonal.CreateXmlNode(TopNode.SelectSingleNode(diagonalPath, NameSpaceManager)));
+            if (_diagonalUp)
+            {
+                SetXmlNodeString(diagonalUpPath, "1");
+            }
+            if (_diagonalDown)
+            {
+                SetXmlNodeString(diagonalDownPath, "1");
+            }
+            return topNode;
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/XmlAccess/ExcelColorXml.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/XmlAccess/ExcelColorXml.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/XmlAccess/ExcelColorXml.cs	(revision 12707)
@@ -0,0 +1,223 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		                Initial Release		        2009-10-01
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Xml;
+using System.Globalization;
+namespace OfficeOpenXml.Style.XmlAccess
+{
+    /// <summary>
+    /// Xml access class for color
+    /// </summary>
+    public sealed class ExcelColorXml : StyleXmlHelper
+    {
+        internal ExcelColorXml(XmlNamespaceManager nameSpaceManager)
+            : base(nameSpaceManager)
+        {
+            _auto = false;
+            _theme = "";
+            _tint = 0;
+            _rgb = "";
+            _indexed = int.MinValue;
+        }
+        internal ExcelColorXml(XmlNamespaceManager nsm, XmlNode topNode) :
+            base(nsm, topNode)
+        {
+            if(topNode==null)
+            {
+                _exists=false;
+            }
+            else
+            {
+                _exists = true;
+                _auto = GetXmlNodeBool("@auto");
+                _theme = GetXmlNodeString("@theme");
+                _tint = GetXmlNodeDecimalNull("@tint")??decimal.MinValue;
+                _rgb = GetXmlNodeString("@rgb");
+                _indexed = GetXmlNodeIntNull("@indexed") ?? int.MinValue;
+            }
+        }
+        
+        internal override string Id
+        {
+            get
+            {
+                return _auto.ToString() + "|" + _theme + "|" + _tint + "|" + _rgb + "|" + _indexed;
+            }
+        }
+        bool _auto;
+        public bool Auto
+        {
+            get
+            {
+                return _auto;
+            }
+            set
+            {
+                if (value)
+                {
+
+                }
+                _auto = value;
+                _exists = true;
+                Clear();
+            }
+        }
+        string _theme;
+        /// <summary>
+        /// Theme color value
+        /// </summary>
+        public string Theme
+        {
+            get
+            {
+                return _theme;
+            }
+        }
+        decimal _tint;
+        /// <summary>
+        /// Tint
+        /// </summary>
+        public decimal Tint
+        {
+            get
+            {
+                if (_tint == decimal.MinValue)
+                {
+                    return 0;
+                }
+                else
+                {
+                    return _tint;
+                }
+            }
+            set
+            {
+                _tint = value;
+                _exists = true;
+            }
+        }
+        string _rgb;
+        /// <summary>
+        /// RGB value
+        /// </summary>
+        public string Rgb
+        {
+            get
+            {
+                return _rgb;
+            }
+            set
+            {
+                _rgb = value;
+                _exists=true;
+                _indexed = int.MinValue;
+                _auto = false;
+            }
+        }
+        int _indexed;
+        /// <summary>
+        /// Indexed color value
+        /// </summary>
+        public int Indexed
+        {
+            get
+            {
+                return (_indexed == int.MinValue ? 0 : _indexed);
+            }
+            set
+            {
+                if (value < 0 || value > 65)
+                {
+                    throw (new ArgumentOutOfRangeException("Index out of range"));
+                }
+                Clear();
+                _indexed = value;
+                _exists = true;
+            }
+        }
+        internal void Clear()
+        {
+            _theme = "";
+            _tint = decimal.MinValue;
+            _indexed = int.MinValue;
+            _rgb = "";
+            _auto = false;
+        }
+        public void SetColor(System.Drawing.Color color)
+        {
+            Clear();
+            _rgb = color.ToArgb().ToString("X");
+        }
+
+        internal ExcelColorXml Copy()
+        {
+            return new ExcelColorXml(NameSpaceManager) {_indexed=_indexed, _tint=_tint, _rgb=_rgb, _theme=_theme, _auto=_auto, _exists=_exists };
+        }
+
+        internal override XmlNode CreateXmlNode(XmlNode topNode)
+        {
+            TopNode = topNode;
+            if(_rgb!="")
+            {
+                SetXmlNodeString("@rgb", _rgb);
+            }
+            else if (_indexed >= 0)
+            {
+                SetXmlNodeString("@indexed", _indexed.ToString());
+            }
+            else if (_auto)
+            {
+                SetXmlNodeBool("@auto", _auto);
+            }
+            else
+            {
+                SetXmlNodeString("@theme", _theme.ToString());
+            }
+            if (_tint != decimal.MinValue)
+            {
+                SetXmlNodeString("@tint", _tint.ToString(CultureInfo.InvariantCulture));
+            }
+            return TopNode;
+        }
+
+        bool _exists;
+        internal bool Exists
+        {
+            get
+            {
+                return _exists;
+            }
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/XmlAccess/ExcelFillXml.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/XmlAccess/ExcelFillXml.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/XmlAccess/ExcelFillXml.cs	(revision 12707)
@@ -0,0 +1,174 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		                Initial Release		        2009-10-01
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Text;
+using System.Xml;
+namespace OfficeOpenXml.Style.XmlAccess
+{
+    /// <summary>
+    /// Xml access class for fills
+    /// </summary>
+    public class ExcelFillXml : StyleXmlHelper 
+    {
+        internal ExcelFillXml(XmlNamespaceManager nameSpaceManager)
+            : base(nameSpaceManager)
+        {
+            _fillPatternType = ExcelFillStyle.None;
+            _backgroundColor = new ExcelColorXml(NameSpaceManager);
+            _patternColor = new ExcelColorXml(NameSpaceManager);
+        }
+        internal ExcelFillXml(XmlNamespaceManager nsm, XmlNode topNode):
+            base(nsm, topNode)
+        {
+            PatternType = GetPatternType(GetXmlNodeString(fillPatternTypePath));
+            _backgroundColor = new ExcelColorXml(nsm, topNode.SelectSingleNode(_backgroundColorPath, nsm));
+            _patternColor = new ExcelColorXml(nsm, topNode.SelectSingleNode(_patternColorPath, nsm));
+        }
+
+        private ExcelFillStyle GetPatternType(string patternType)
+        {
+            if (patternType == "") return ExcelFillStyle.None;
+            patternType = patternType.Substring(0, 1).ToUpper(CultureInfo.InvariantCulture) + patternType.Substring(1, patternType.Length - 1);
+            try
+            {
+                return (ExcelFillStyle)Enum.Parse(typeof(ExcelFillStyle), patternType);
+            }
+            catch
+            {
+                return ExcelFillStyle.None;
+            }
+        }
+        internal override string Id
+        {
+            get
+            {
+                return PatternType + PatternColor.Id + BackgroundColor.Id;
+            }
+        }
+        #region Public Properties
+        const string fillPatternTypePath = "d:patternFill/@patternType";
+        protected ExcelFillStyle _fillPatternType;
+        /// <summary>
+        /// Cell fill pattern style
+        /// </summary>
+        public ExcelFillStyle PatternType
+        {
+            get
+            {
+                return _fillPatternType;
+            }
+            set
+            {
+                _fillPatternType=value;
+            }
+        }
+        protected ExcelColorXml _patternColor = null;
+        const string _patternColorPath = "d:patternFill/d:bgColor";
+        /// <summary>
+        /// Pattern color
+        /// </summary>
+        public ExcelColorXml PatternColor
+        {
+            get
+            {
+                return _patternColor;
+            }
+            internal set
+            {
+                _patternColor = value;
+            }
+        }
+        protected ExcelColorXml _backgroundColor = null;
+        const string _backgroundColorPath = "d:patternFill/d:fgColor";
+        /// <summary>
+        /// Cell background color 
+        /// </summary>
+        public ExcelColorXml BackgroundColor
+        {
+            get
+            {
+                return _backgroundColor;
+            }
+            internal set
+            {
+                _backgroundColor=value;
+            }
+        }
+        #endregion
+
+
+        //internal Fill Copy()
+        //{
+        //    Fill newFill = new Fill(NameSpaceManager, TopNode.Clone());
+        //    return newFill;
+        //}
+
+        internal virtual ExcelFillXml Copy()
+        {
+            ExcelFillXml newFill = new ExcelFillXml(NameSpaceManager);
+            newFill.PatternType = _fillPatternType;
+            newFill.BackgroundColor = _backgroundColor.Copy();
+            newFill.PatternColor = _patternColor.Copy();
+            return newFill;
+        }
+
+        internal override XmlNode CreateXmlNode(XmlNode topNode)
+        {
+            TopNode = topNode;
+            SetXmlNodeString(fillPatternTypePath, SetPatternString(_fillPatternType));
+            if (PatternType != ExcelFillStyle.None)
+            {
+                XmlNode pattern = topNode.SelectSingleNode(fillPatternTypePath, NameSpaceManager);
+                if (BackgroundColor.Exists)
+                {
+                    CreateNode(_backgroundColorPath);
+                    BackgroundColor.CreateXmlNode(topNode.SelectSingleNode(_backgroundColorPath, NameSpaceManager));
+                    if (PatternColor.Exists)
+                    {
+                        CreateNode(_patternColorPath);
+                        //topNode.AppendChild(PatternColor.CreateXmlNode(topNode.SelectSingleNode(_patternColorPath, NameSpaceManager)));
+                        PatternColor.CreateXmlNode(topNode.SelectSingleNode(_patternColorPath, NameSpaceManager));
+                    }
+                }
+            }
+            return topNode;
+        }
+
+        private string SetPatternString(ExcelFillStyle pattern)
+        {
+            string newName = Enum.GetName(typeof(ExcelFillStyle), pattern);
+            return newName.Substring(0, 1).ToLower(CultureInfo.InvariantCulture) + newName.Substring(1, newName.Length - 1);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/XmlAccess/ExcelFontXml.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/XmlAccess/ExcelFontXml.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/XmlAccess/ExcelFontXml.cs	(revision 12707)
@@ -0,0 +1,332 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		                Initial Release		        2009-10-01
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Text;
+using System.Xml;
+namespace OfficeOpenXml.Style.XmlAccess
+{
+    /// <summary>
+    /// Xml access class for fonts
+    /// </summary>
+    public sealed class ExcelFontXml : StyleXmlHelper
+    {
+        internal ExcelFontXml(XmlNamespaceManager nameSpaceManager)
+            : base(nameSpaceManager)
+        {
+            _name = "";
+            _size = 0;
+            _family = int.MinValue;
+            _scheme = "";
+            _color = _color = new ExcelColorXml(NameSpaceManager);
+            _bold = false;
+            _italic = false;
+            _strike = false;
+            _underlineType = ExcelUnderLineType.None ;
+            _verticalAlign = "";
+        }
+        internal ExcelFontXml(XmlNamespaceManager nsm, XmlNode topNode) :
+            base(nsm, topNode)
+        {
+            _name = GetXmlNodeString(namePath);
+            _size = (float)GetXmlNodeDecimal(sizePath);
+            _family = GetXmlNodeIntNull(familyPath)??int.MinValue;
+            _scheme = GetXmlNodeString(schemePath);
+            _color = new ExcelColorXml(nsm, topNode.SelectSingleNode(_colorPath, nsm));
+            _bold = (topNode.SelectSingleNode(boldPath, NameSpaceManager) != null);
+            _italic = (topNode.SelectSingleNode(italicPath, NameSpaceManager) != null);
+            _strike = (topNode.SelectSingleNode(strikePath, NameSpaceManager) != null);
+            _verticalAlign = GetXmlNodeString(verticalAlignPath);
+            if (topNode.SelectSingleNode(underLinedPath, NameSpaceManager) != null)
+            {
+                string ut = GetXmlNodeString(underLinedPath + "/@val");
+                if (ut == "")
+                {
+                    _underlineType = ExcelUnderLineType.Single;
+                }
+                else
+                {
+                    _underlineType = (ExcelUnderLineType)Enum.Parse(typeof(ExcelUnderLineType), ut, true);
+                }
+            }
+            else
+            {
+                _underlineType = ExcelUnderLineType.None;
+            }
+        }
+        internal override string Id
+        {
+            get
+            {
+                return Name + "|" + Size + "|" + Family + "|" + Color.Id + "|" + Scheme + "|" + Bold.ToString() + "|" + Italic.ToString() + "|" + Strike.ToString() + "|" + VerticalAlign + "|" + UnderLineType.ToString();
+            }
+        }
+        const string namePath = "d:name/@val";
+        string _name;
+        /// <summary>
+        /// The name of the font
+        /// </summary>
+        public string Name
+        {
+            get
+            {
+                return _name;
+            }
+            set
+            {
+                Scheme = "";        //Reset schema to avoid corrupt file if unsupported font is selected.
+                _name = value;
+            }
+        }
+        const string sizePath = "d:sz/@val";
+        float _size;
+        /// <summary>
+        /// Font size
+        /// </summary>
+        public float Size
+        {
+            get
+            {
+                return _size;
+            }
+            set
+            {
+                _size = value;
+            }
+        }
+        const string familyPath = "d:family/@val";
+        int _family;
+        /// <summary>
+        /// Font family
+        /// </summary>
+        public int Family
+        {
+            get
+            {
+                return (_family == int.MinValue ? 0 : _family); ;
+            }
+            set
+            {
+                _family=value;
+            }
+        }
+        ExcelColorXml _color = null;
+        const string _colorPath = "d:color";
+        /// <summary>
+        /// Text color
+        /// </summary>
+        public ExcelColorXml Color
+        {
+            get
+            {
+                return _color;
+            }
+            internal set 
+            {
+                _color=value;
+            }
+        }
+        const string schemePath = "d:scheme/@val";
+        string _scheme="";
+        /// <summary>
+        /// Font Scheme
+        /// </summary>
+        public string Scheme
+        {
+            get
+            {
+                return _scheme;
+            }
+            private set
+            {
+                _scheme=value;
+            }
+        }
+        const string boldPath = "d:b";
+        bool _bold;
+        /// <summary>
+        /// If the font is bold
+        /// </summary>
+        public bool Bold
+        {
+            get
+            {
+                return _bold;
+            }
+            set
+            {
+                _bold=value;
+            }
+        }
+        const string italicPath = "d:i";
+        bool _italic;
+        /// <summary>
+        /// If the font is italic
+        /// </summary>
+        public bool Italic
+        {
+            get
+            {
+                return _italic;
+            }
+            set
+            {
+                _italic=value;
+            }
+        }
+        const string strikePath = "d:strike";
+        bool _strike;
+        /// <summary>
+        /// If the font is striked out
+        /// </summary>
+        public bool Strike
+        {
+            get
+            {
+                return _strike;
+            }
+            set
+            {
+                _strike=value;
+            }
+        }
+        const string underLinedPath = "d:u";
+        /// <summary>
+        /// If the font is underlined.
+        /// When set to true a the text is underlined with a single line
+        /// </summary>
+        public bool UnderLine
+        {
+            get
+            {
+                return UnderLineType!=ExcelUnderLineType.None;
+            }
+            set
+            {
+                _underlineType=value ? ExcelUnderLineType.Single : ExcelUnderLineType.None;
+            }
+        }
+        ExcelUnderLineType _underlineType;
+        /// <summary>
+        /// If the font is underlined
+        /// </summary>
+        public ExcelUnderLineType UnderLineType
+        {
+            get
+            {
+                return _underlineType;
+            }
+            set
+            {
+                _underlineType = value;
+            }
+        }
+        const string verticalAlignPath = "d:vertAlign/@val";
+        string _verticalAlign;
+        /// <summary>
+        /// Vertical aligned
+        /// </summary>
+        public string VerticalAlign
+        {
+            get
+            {
+                return _verticalAlign;
+            }
+            set
+            {
+                _verticalAlign=value;
+            }
+        }
+        public void SetFromFont(System.Drawing.Font Font)
+        {
+            Name=Font.Name;
+            //Family=fnt.FontFamily.;
+            Size=(int)Font.Size;
+            Strike=Font.Strikeout;
+            Bold = Font.Bold;
+            UnderLine=Font.Underline;
+            Italic=Font.Italic;
+        }
+        internal ExcelFontXml Copy()
+        {
+            ExcelFontXml newFont = new ExcelFontXml(NameSpaceManager);
+            newFont.Name = _name;
+            newFont.Size = _size;
+            newFont.Family = _family;
+            newFont.Scheme = _scheme;
+            newFont.Bold = _bold;
+            newFont.Italic = _italic;
+            newFont.UnderLineType = _underlineType;
+            newFont.Strike = _strike;
+            newFont.VerticalAlign = _verticalAlign;
+            newFont.Color = Color.Copy();
+            return newFont;
+        }
+
+        internal override XmlNode CreateXmlNode(XmlNode topElement)
+        {
+            TopNode = topElement;
+
+            if (_bold) CreateNode(boldPath); else DeleteAllNode(boldPath);
+            if (_italic) CreateNode(italicPath); else DeleteAllNode(italicPath);
+            if (_strike) CreateNode(strikePath); else DeleteAllNode(strikePath);
+            
+            if (_underlineType == ExcelUnderLineType.None)
+            {
+                DeleteAllNode(underLinedPath);
+            }
+            else if(_underlineType==ExcelUnderLineType.Single)
+            {
+                CreateNode(underLinedPath);
+            }
+            else
+            {
+                var v=_underlineType.ToString();
+                SetXmlNodeString(underLinedPath + "/@val", v.Substring(0, 1).ToLower(CultureInfo.InvariantCulture) + v.Substring(1));
+            }
+
+            if (_verticalAlign!="") SetXmlNodeString(verticalAlignPath, _verticalAlign.ToString());
+            if(_size>0) SetXmlNodeString(sizePath, _size.ToString(System.Globalization.CultureInfo.InvariantCulture));
+            if (_color.Exists)
+            {
+                CreateNode(_colorPath);
+                TopNode.AppendChild(_color.CreateXmlNode(TopNode.SelectSingleNode(_colorPath, NameSpaceManager)));
+            }
+            if(!string.IsNullOrEmpty(_name)) SetXmlNodeString(namePath, _name);
+            if(_family>int.MinValue) SetXmlNodeString(familyPath, _family.ToString());
+            if (_scheme != "") SetXmlNodeString(schemePath, _scheme.ToString());
+
+            return TopNode;
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/XmlAccess/ExcelGradientFillXml.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/XmlAccess/ExcelGradientFillXml.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/XmlAccess/ExcelGradientFillXml.cs	(revision 12707)
@@ -0,0 +1,198 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		                Initial Release		        2009-10-01
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Xml;
+using System.Globalization;
+namespace OfficeOpenXml.Style.XmlAccess
+{
+    /// <summary>
+    /// Xml access class for gradient fillsde
+    /// </summary>
+    public sealed class ExcelGradientFillXml : ExcelFillXml
+    {
+        internal ExcelGradientFillXml(XmlNamespaceManager nameSpaceManager)
+            : base(nameSpaceManager)
+        {
+            GradientColor1 = new ExcelColorXml(nameSpaceManager);
+            GradientColor2 = new ExcelColorXml(nameSpaceManager);
+        }
+        internal ExcelGradientFillXml(XmlNamespaceManager nsm, XmlNode topNode) :
+            base(nsm, topNode)
+        {
+            Degree = GetXmlNodeDouble(_degreePath);
+            Type = GetXmlNodeString(_typePath)=="path" ? ExcelFillGradientType.Path : ExcelFillGradientType.Linear;
+            GradientColor1 = new ExcelColorXml(nsm, topNode.SelectSingleNode(_gradientColor1Path, nsm));
+            GradientColor2 = new ExcelColorXml(nsm, topNode.SelectSingleNode(_gradientColor2Path, nsm));
+            
+            Top = GetXmlNodeDouble(_topPath);
+            Bottom = GetXmlNodeDouble(_bottomPath);
+            Left = GetXmlNodeDouble(_leftPath);
+            Right = GetXmlNodeDouble(_rightPath);
+        }
+        const string _typePath = "d:gradientFill/@type";
+        /// <summary>
+        /// Type of gradient fill. 
+        /// </summary>
+        public ExcelFillGradientType Type
+        {
+            get;
+            internal set;
+        }
+        const string _degreePath = "d:gradientFill/@degree";
+        /// <summary>
+        /// Angle of the linear gradient
+        /// </summary>
+        public double Degree
+        {
+            get;
+            internal set;
+        }
+        const string _gradientColor1Path = "d:gradientFill/d:stop[@position=\"0\"]/d:color";
+        /// <summary>
+        /// Gradient color 1
+        /// </summary>
+        public ExcelColorXml GradientColor1 
+        {
+            get;
+            private set;
+        }
+        const string _gradientColor2Path = "d:gradientFill/d:stop[@position=\"1\"]/d:color";
+        /// <summary>
+        /// Gradient color 2
+        /// </summary>
+        public ExcelColorXml GradientColor2
+        {
+            get;
+            private set;
+        }
+        const string _bottomPath = "d:gradientFill/@bottom";
+        /// <summary>
+        /// Percentage format bottom
+        /// </summary>
+        public double Bottom
+        { 
+            get; 
+            internal set; 
+        }
+        const string _topPath = "d:gradientFill/@top";
+        /// <summary>
+        /// Percentage format top
+        /// </summary>
+        public double Top
+        {
+            get;
+            internal set;
+        }
+        const string _leftPath = "d:gradientFill/@left";
+        /// <summary>
+        /// Percentage format left
+        /// </summary>
+        public double Left
+        {
+            get;
+            internal set;
+        }
+        const string _rightPath = "d:gradientFill/@right";
+        /// <summary>
+        /// Percentage format right
+        /// </summary>
+        public double Right
+        {
+            get;
+            internal set;
+        }
+        internal override string Id
+        {
+            get
+            {
+                return base.Id + Degree.ToString() + GradientColor1.Id + GradientColor2.Id + Type + Left.ToString() + Right.ToString() + Bottom.ToString() + Top.ToString();
+            }
+        }
+
+        #region Public Properties
+        #endregion
+        internal override ExcelFillXml Copy()
+        {
+            ExcelGradientFillXml newFill = new ExcelGradientFillXml(NameSpaceManager);
+            newFill.PatternType = base._fillPatternType;
+            newFill.BackgroundColor = _backgroundColor.Copy();
+            newFill.PatternColor = _patternColor.Copy();
+
+            newFill.GradientColor1 = GradientColor1.Copy();
+            newFill.GradientColor2 = GradientColor2.Copy();
+            newFill.Type = Type;
+            newFill.Degree = Degree;
+            newFill.Top = Top;
+            newFill.Bottom = Bottom;
+            newFill.Left = Left;
+            newFill.Right = Right;
+            
+            return newFill;
+        }
+
+        internal override XmlNode CreateXmlNode(XmlNode topNode)
+        {
+            TopNode = topNode;
+            CreateNode("d:gradientFill");
+            if(Type==ExcelFillGradientType.Path) SetXmlNodeString(_typePath, "path");
+            if(!double.IsNaN(Degree)) SetXmlNodeString(_degreePath, Degree.ToString(CultureInfo.InvariantCulture));
+            if (GradientColor1!=null)
+            {
+                /*** Gradient color node 1***/
+                var node = TopNode.SelectSingleNode("d:gradientFill", NameSpaceManager);
+                var stopNode = node.OwnerDocument.CreateElement("stop", ExcelPackage.schemaMain);
+                stopNode.SetAttribute("position", "0");
+                node.AppendChild(stopNode);
+                var colorNode = node.OwnerDocument.CreateElement("color", ExcelPackage.schemaMain);
+                stopNode.AppendChild(colorNode);
+                GradientColor1.CreateXmlNode(colorNode);
+
+                /*** Gradient color node 2***/
+                stopNode = node.OwnerDocument.CreateElement("stop", ExcelPackage.schemaMain);
+                stopNode.SetAttribute("position", "1");
+                node.AppendChild(stopNode);
+                colorNode = node.OwnerDocument.CreateElement("color", ExcelPackage.schemaMain);
+                stopNode.AppendChild(colorNode);
+
+                GradientColor2.CreateXmlNode(colorNode);
+            }
+            if (!double.IsNaN(Top)) SetXmlNodeString(_topPath, Top.ToString("F5",CultureInfo.InvariantCulture));
+            if (!double.IsNaN(Bottom)) SetXmlNodeString(_bottomPath, Bottom.ToString("F5", CultureInfo.InvariantCulture));
+            if (!double.IsNaN(Left)) SetXmlNodeString(_leftPath, Left.ToString("F5", CultureInfo.InvariantCulture));
+            if (!double.IsNaN(Right)) SetXmlNodeString(_rightPath, Right.ToString("F5", CultureInfo.InvariantCulture));
+
+            return topNode;
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/XmlAccess/ExcelNamedStyleXml.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/XmlAccess/ExcelNamedStyleXml.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/XmlAccess/ExcelNamedStyleXml.cs	(revision 12707)
@@ -0,0 +1,145 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		                Initial Release		        2009-10-01
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Xml;
+namespace OfficeOpenXml.Style.XmlAccess
+{
+    /// <summary>
+    /// Xml access class for named styles
+    /// </summary>
+    public sealed class ExcelNamedStyleXml : StyleXmlHelper
+    {
+        ExcelStyles _styles;
+        internal ExcelNamedStyleXml(XmlNamespaceManager nameSpaceManager, ExcelStyles styles)
+            : base(nameSpaceManager)
+        {
+            _styles = styles;
+            BuildInId = int.MinValue;
+        }
+        internal ExcelNamedStyleXml(XmlNamespaceManager NameSpaceManager, XmlNode topNode, ExcelStyles styles) :
+            base(NameSpaceManager, topNode)
+        {
+            StyleXfId = GetXmlNodeInt(idPath);
+            Name = GetXmlNodeString(namePath);
+            BuildInId = GetXmlNodeInt(buildInIdPath);
+            CustomBuildin = GetXmlNodeBool(customBuiltinPath);
+
+            _styles = styles;
+            _style = new ExcelStyle(styles, styles.NamedStylePropertyChange, -1, Name, _styleXfId);
+        }
+        internal override string Id
+        {
+            get
+            {
+                return Name;
+            }
+        }
+        int _styleXfId=0;
+        const string idPath = "@xfId";
+        /// <summary>
+        /// Named style index
+        /// </summary>
+        public int StyleXfId
+        {
+            get
+            {
+                return _styleXfId;
+            }
+            set
+            {
+                _styleXfId = value;
+            }
+        }
+        int _xfId = int.MinValue;
+        /// <summary>
+        /// Style index
+        /// </summary>
+        internal int XfId
+        {
+            get
+            {
+                return _xfId;
+            }
+            set
+            {
+                _xfId = value;
+            }
+        }
+        const string buildInIdPath = "@builtinId";
+        public int BuildInId { get; set; }
+        const string customBuiltinPath = "@customBuiltin";
+        public bool CustomBuildin { get; set; }
+        const string namePath = "@name";
+        string _name;
+        /// <summary>
+        /// Name of the style
+        /// </summary>
+        public string Name
+        {
+            get
+            {
+                return _name;
+            }
+            internal set
+            {
+                _name = value;
+            }
+        }
+        ExcelStyle _style = null;
+        /// <summary>
+        /// The style object
+        /// </summary>
+        public ExcelStyle Style
+        {
+            get
+            {
+                return _style;
+            }
+            internal set
+            {
+                _style = value;
+            }
+        }
+
+        internal override XmlNode CreateXmlNode(XmlNode topNode)
+        {
+            TopNode = topNode;
+            SetXmlNodeString(namePath, _name);
+            SetXmlNodeString("@xfId", _styles.CellStyleXfs[StyleXfId].newID.ToString());
+            if (BuildInId>=0) SetXmlNodeString("@builtinId", BuildInId.ToString());
+            if(CustomBuildin) SetXmlNodeBool(customBuiltinPath, true);
+            return TopNode;            
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/XmlAccess/ExcelNumberFormatXml.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/XmlAccess/ExcelNumberFormatXml.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/XmlAccess/ExcelNumberFormatXml.cs	(revision 12707)
@@ -0,0 +1,666 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		                Initial Release		        2009-10-01
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Xml;
+using System.Globalization;
+using System.Text.RegularExpressions;
+namespace OfficeOpenXml.Style.XmlAccess
+{
+    /// <summary>
+    /// Xml access class for number formats
+    /// </summary>
+    public sealed class ExcelNumberFormatXml : StyleXmlHelper
+    {
+        internal ExcelNumberFormatXml(XmlNamespaceManager nameSpaceManager) : base(nameSpaceManager)
+        {
+            
+        }        
+        internal ExcelNumberFormatXml(XmlNamespaceManager nameSpaceManager, bool buildIn): base(nameSpaceManager)
+        {
+            BuildIn = buildIn;
+        }
+        internal ExcelNumberFormatXml(XmlNamespaceManager nsm, XmlNode topNode) :
+            base(nsm, topNode)
+        {
+            _numFmtId = GetXmlNodeInt("@numFmtId");
+            _format = GetXmlNodeString("@formatCode");
+        }
+        public bool BuildIn { get; private set; }
+        int _numFmtId;
+//        const string idPath = "@numFmtId";
+        /// <summary>
+        /// Id for number format
+        /// 
+        /// Build in ID's
+        /// 
+        /// 0   General 
+        /// 1   0 
+        /// 2   0.00 
+        /// 3   #,##0 
+        /// 4   #,##0.00 
+        /// 9   0% 
+        /// 10  0.00% 
+        /// 11  0.00E+00 
+        /// 12  # ?/? 
+        /// 13  # ??/?? 
+        /// 14  mm-dd-yy 
+        /// 15  d-mmm-yy 
+        /// 16  d-mmm 
+        /// 17  mmm-yy 
+        /// 18  h:mm AM/PM 
+        /// 19  h:mm:ss AM/PM 
+        /// 20  h:mm 
+        /// 21  h:mm:ss 
+        /// 22  m/d/yy h:mm 
+        /// 37  #,##0 ;(#,##0) 
+        /// 38  #,##0 ;[Red](#,##0) 
+        /// 39  #,##0.00;(#,##0.00) 
+        /// 40  #,##0.00;[Red](#,##0.00) 
+        /// 45  mm:ss 
+        /// 46  [h]:mm:ss 
+        /// 47  mmss.0 
+        /// 48  ##0.0E+0 
+        /// 49  @
+        /// </summary>            
+        public int NumFmtId
+        {
+            get
+            {
+                return _numFmtId;
+            }
+            set
+            {
+                _numFmtId = value;
+            }
+        }
+        internal override string Id
+        {
+            get
+            {
+                return _format;
+            }
+        }
+        const string fmtPath = "@formatCode";
+        string _format = string.Empty;
+        public string Format
+        {
+            get
+            {
+                return _format;
+            }
+            set
+            {
+                _numFmtId = ExcelNumberFormat.GetFromBuildIdFromFormat(value);
+                _format = value;
+            }
+        }
+        internal string GetNewID(int NumFmtId, string Format)
+        {
+            
+            if (NumFmtId < 0)
+            {
+                NumFmtId = ExcelNumberFormat.GetFromBuildIdFromFormat(Format);                
+            }
+            return NumFmtId.ToString();
+        }
+
+        internal static void AddBuildIn(XmlNamespaceManager NameSpaceManager, ExcelStyleCollection<ExcelNumberFormatXml> NumberFormats)
+        {
+            NumberFormats.Add("General",new ExcelNumberFormatXml(NameSpaceManager,true){NumFmtId=0,Format="General"});
+            NumberFormats.Add("0", new ExcelNumberFormatXml(NameSpaceManager,true) { NumFmtId = 1, Format = "0" });
+            NumberFormats.Add("0.00", new ExcelNumberFormatXml(NameSpaceManager,true) { NumFmtId = 2, Format = "0.00" });
+            NumberFormats.Add("#,##0", new ExcelNumberFormatXml(NameSpaceManager, true) { NumFmtId = 3, Format = "#,##0" });
+            NumberFormats.Add("#,##0.00", new ExcelNumberFormatXml(NameSpaceManager, true) { NumFmtId = 4, Format = "#,##0.00" });
+            NumberFormats.Add("0%", new ExcelNumberFormatXml(NameSpaceManager,true) { NumFmtId = 9, Format = "0%" });
+            NumberFormats.Add("0.00%", new ExcelNumberFormatXml(NameSpaceManager,true) { NumFmtId = 10, Format = "0.00%" });
+            NumberFormats.Add("0.00E+00", new ExcelNumberFormatXml(NameSpaceManager, true) { NumFmtId = 11, Format = "0.00E+00" });
+            NumberFormats.Add("# ?/?", new ExcelNumberFormatXml(NameSpaceManager, true) { NumFmtId = 12, Format = "# ?/?" });
+            NumberFormats.Add("# ??/??", new ExcelNumberFormatXml(NameSpaceManager,true) { NumFmtId = 13, Format = "# ??/??" });
+            NumberFormats.Add("mm-dd-yy", new ExcelNumberFormatXml(NameSpaceManager,true) { NumFmtId = 14, Format = "mm-dd-yy" });
+            NumberFormats.Add("d-mmm-yy", new ExcelNumberFormatXml(NameSpaceManager, true) { NumFmtId = 15, Format = "d-mmm-yy" });
+            NumberFormats.Add("d-mmm", new ExcelNumberFormatXml(NameSpaceManager, true) { NumFmtId = 16, Format = "d-mmm" });
+            NumberFormats.Add("mmm-yy", new ExcelNumberFormatXml(NameSpaceManager, true) { NumFmtId = 17, Format = "mmm-yy" });
+            NumberFormats.Add("h:mm AM/PM", new ExcelNumberFormatXml(NameSpaceManager, true) { NumFmtId = 18, Format = "h:mm AM/PM" });
+            NumberFormats.Add("h:mm:ss AM/PM", new ExcelNumberFormatXml(NameSpaceManager, true) { NumFmtId = 19, Format = "h:mm:ss AM/PM" });
+            NumberFormats.Add("h:mm", new ExcelNumberFormatXml(NameSpaceManager, true) { NumFmtId = 20, Format = "h:mm" });
+            NumberFormats.Add("h:mm:ss", new ExcelNumberFormatXml(NameSpaceManager, true) { NumFmtId = 21, Format = "h:mm:ss" });
+            NumberFormats.Add("m/d/yy h:mm", new ExcelNumberFormatXml(NameSpaceManager, true) { NumFmtId = 22, Format = "m/d/yy h:mm" });
+            NumberFormats.Add("#,##0 ;(#,##0)", new ExcelNumberFormatXml(NameSpaceManager, true) { NumFmtId = 37, Format = "#,##0 ;(#,##0)" });
+            NumberFormats.Add("#,##0 ;[Red](#,##0)", new ExcelNumberFormatXml(NameSpaceManager, true) { NumFmtId = 38, Format = "#,##0 ;[Red](#,##0)" });
+            NumberFormats.Add("#,##0.00;(#,##0.00)", new ExcelNumberFormatXml(NameSpaceManager, true) { NumFmtId = 39, Format = "#,##0.00;(#,##0.00)" });
+            NumberFormats.Add("#,##0.00;[Red](#,##0.00)", new ExcelNumberFormatXml(NameSpaceManager, true) { NumFmtId = 40, Format = "#,##0.00;[Red](#,#)" });
+            NumberFormats.Add("mm:ss", new ExcelNumberFormatXml(NameSpaceManager, true) { NumFmtId = 45, Format = "mm:ss" });
+            NumberFormats.Add("[h]:mm:ss", new ExcelNumberFormatXml(NameSpaceManager, true) { NumFmtId = 46, Format = "[h]:mm:ss" });
+            NumberFormats.Add("mmss.0", new ExcelNumberFormatXml(NameSpaceManager, true) { NumFmtId = 47, Format = "mmss.0" });
+            NumberFormats.Add("##0.0", new ExcelNumberFormatXml(NameSpaceManager, true) { NumFmtId = 48, Format = "##0.0" });
+            NumberFormats.Add("@", new ExcelNumberFormatXml(NameSpaceManager, true) { NumFmtId = 49, Format = "@" });
+
+            NumberFormats.NextId = 164; //Start for custom formats.
+        }
+
+        internal override XmlNode CreateXmlNode(XmlNode topNode)
+        {
+            TopNode = topNode;
+            SetXmlNodeString("@numFmtId", NumFmtId.ToString());
+            SetXmlNodeString("@formatCode", Format);
+            return TopNode;
+        }
+
+        internal enum eFormatType
+        {
+            Unknown = 0,
+            Number = 1,
+            DateTime = 2,
+        }
+        ExcelFormatTranslator _translator = null;
+        internal ExcelFormatTranslator FormatTranslator
+        {
+            get
+            {
+                if (_translator == null)
+                {
+                    _translator = new ExcelFormatTranslator(Format, NumFmtId);
+                }
+                return _translator;
+            }
+        }
+        #region Excel --> .Net Format
+        internal class ExcelFormatTranslator
+        {
+            internal ExcelFormatTranslator(string format, int numFmtID)
+            {
+                if (numFmtID == 14)
+                {
+                    NetFormat = NetFormatForWidth = "d";
+                    NetTextFormat = NetTextFormatForWidth = "";
+                    DataType = eFormatType.DateTime;
+                }
+                else if (format.Equals("general",StringComparison.InvariantCultureIgnoreCase))
+                {
+                    NetFormat = NetFormatForWidth = "0.#####";
+                    NetTextFormat = NetTextFormatForWidth = "";
+                    DataType = eFormatType.Number;
+                }
+                else
+                {
+                    ToNetFormat(format, false);
+                    ToNetFormat(format, true);
+                }                
+            }
+            internal string NetTextFormat { get; private set; }
+            internal string NetFormat { get; private set; }
+            CultureInfo _ci = null;
+            internal CultureInfo Culture
+            {
+                get
+                {
+                    if (_ci == null)
+                    {
+                        return CultureInfo.CurrentCulture;
+                    }
+                    return _ci;
+                }
+                private set
+                {
+                    _ci = value;
+                }
+            }
+            internal eFormatType DataType { get; private set; }
+            internal string NetTextFormatForWidth { get; private set; }
+            internal string NetFormatForWidth { get; private set; }
+
+            //internal string FractionFormatInteger { get; private set; }
+            internal string FractionFormat { get; private set; }
+            //internal string FractionFormat2 { get; private set; }
+
+            private void ToNetFormat(string ExcelFormat, bool forColWidth)
+            {
+                DataType = eFormatType.Unknown;
+                int secCount = 0;
+                bool isText = false;
+                bool isBracket = false;
+                string bracketText = "";
+                bool prevBslsh = false;
+                bool useMinute = false;
+                bool prevUnderScore = false;
+                bool ignoreNext = false;
+                int fractionPos = -1;
+                string specialDateFormat = "";
+                bool containsAmPm = ExcelFormat.Contains("AM/PM");
+                List<int> lstDec=new List<int>();
+                StringBuilder sb = new StringBuilder();
+                Culture = null;
+                var format = "";
+                var text = "";
+                char clc;
+
+                if (containsAmPm)
+                {
+                    ExcelFormat = Regex.Replace(ExcelFormat, "AM/PM", "");
+                    DataType = eFormatType.DateTime;
+                }
+
+                for (int pos = 0; pos < ExcelFormat.Length; pos++)
+                {
+                    char c = ExcelFormat[pos];
+                    if (c == '"')
+                    {
+                        isText = !isText;
+                    }
+                    else
+                    {
+                        if (ignoreNext)
+                        {
+                            ignoreNext = false;
+                            continue;
+                        }
+                        else if (isText && !isBracket)
+                        {
+                            sb.Append(c);
+                        }
+                        else if (isBracket)
+                        {
+                            if (c == ']')
+                            {
+                                isBracket = false;
+                                if (bracketText[0] == '$')  //Local Info
+                                {
+                                    string[] li = Regex.Split(bracketText, "-");
+                                    if (li[0].Length > 1)
+                                    {
+                                        sb.Append("\"" + li[0].Substring(1, li[0].Length - 1) + "\"");     //Currency symbol
+                                    }
+                                    if (li.Length > 1)
+                                    {
+                                        if (li[1].Equals("f800", StringComparison.InvariantCultureIgnoreCase))
+                                        {
+                                            specialDateFormat = "D";
+                                        }
+                                        else if (li[1].Equals("f400", StringComparison.InvariantCultureIgnoreCase))
+                                        {
+                                            specialDateFormat = "T";
+                                        }
+                                        else
+                                        {
+                                            var num = int.Parse(li[1], NumberStyles.HexNumber);
+                                            try
+                                            {
+                                                Culture = CultureInfo.GetCultureInfo(num & 0xFFFF);
+                                            }
+                                            catch
+                                            {
+                                                Culture = null;
+                                            }
+                                        }
+                                    }
+                                }
+                                else if(bracketText[0]=='t')
+                                {
+                                    sb.Append("hh"); //TODO:This will not be correct for dates over 24H.
+                                }
+                                else if (bracketText[0] == 'h')
+                                {
+                                    specialDateFormat = "hh"; //TODO:This will not be correct for dates over 24H.
+                                }
+                            }
+                            else
+                            {
+                                bracketText += c;
+                            }
+                        }
+                        else if (prevUnderScore)
+                        {
+                            if (forColWidth)
+                            {
+                                sb.AppendFormat("\"{0}\"", c);
+                            }
+                            prevUnderScore = false;
+                        }
+                        else
+                        {
+                            if (c == ';') //We use first part (for positive only at this stage)
+                            {
+                                secCount++;
+                                if (DataType == eFormatType.DateTime || secCount == 3)
+                                {
+                                    //Add qoutes
+                                    SetDecimal(lstDec, sb);
+                                    lstDec = new List<int>();
+                                    format = sb.ToString();
+                                    sb = new StringBuilder();
+                                }
+                                else
+                                {
+                                    sb.Append(c);
+                                }
+                            }
+                            else
+                            {
+                                clc = c.ToString().ToLower(CultureInfo.InvariantCulture)[0];  //Lowercase character
+                                //Set the datetype
+                                if (DataType == eFormatType.Unknown)
+                                {
+                                    if (c == '0' || c == '#' || c == '.')
+                                    {
+                                        DataType = eFormatType.Number;
+                                    }
+                                    else if (clc == 'y' || clc == 'm' || clc == 'd' || clc == 'h' || clc == 'm' || clc == 's')
+                                    {
+                                        DataType = eFormatType.DateTime;
+                                    }
+                                }
+
+                                if (prevBslsh)
+                                {
+                                    sb.Append(c);
+                                    prevBslsh = false;
+                                }
+                                else if (c == '[')
+                                {
+                                    bracketText = "";
+                                    isBracket = true;
+                                }
+                                else if (c == '\\')
+                                {
+                                    prevBslsh = true;
+                                }
+                                else if (c == '0' ||
+                                    c == '#' ||
+                                    c == '.' ||
+                                    c == ',' ||
+                                    c == '%' ||
+                                    clc == 'd' ||
+                                    clc == 's')
+                                {
+                                    sb.Append(c);
+                                    if(c=='.')
+                                    {
+                                        lstDec.Add(sb.Length - 1);
+                                    }
+                                }
+                                else if (clc == 'h')
+                                {
+                                    if (containsAmPm)
+                                    {
+                                        sb.Append('h'); ;
+                                    }
+                                    else
+                                    {
+                                        sb.Append('H');
+                                    }
+                                    useMinute = true;
+                                }
+                                else if (clc == 'm')
+                                {
+                                    if (useMinute)
+                                    {
+                                        sb.Append('m');
+                                    }
+                                    else
+                                    {
+                                        sb.Append('M');
+                                    }
+                                }
+                                else if (c == '_') //Skip next but use for alignment
+                                {
+                                    prevUnderScore = true;
+                                }
+                                else if (c == '?')
+                                {
+                                    sb.Append(' ');
+                                }
+                                else if (c == '/')
+                                {
+                                    if (DataType == eFormatType.Number)
+                                    {
+                                        fractionPos = sb.Length;
+                                        int startPos = pos - 1;
+                                        while (startPos >= 0 &&
+                                                (ExcelFormat[startPos] == '?' ||
+                                                ExcelFormat[startPos] == '#' ||
+                                                ExcelFormat[startPos] == '0'))
+                                        {
+                                            startPos--;
+                                        }
+
+                                        if (startPos > 0)  //RemovePart
+                                            sb.Remove(sb.Length-(pos-startPos-1),(pos-startPos-1)) ;
+
+                                        int endPos = pos + 1;
+                                        while (endPos < ExcelFormat.Length &&
+                                                (ExcelFormat[endPos] == '?' ||
+                                                ExcelFormat[endPos] == '#' ||
+                                                (ExcelFormat[endPos] >= '0' && ExcelFormat[endPos]<= '9')))
+                                        {
+                                            endPos++;
+                                        }
+                                        pos = endPos;
+                                        if (FractionFormat != "")
+                                        {
+                                            FractionFormat = ExcelFormat.Substring(startPos+1, endPos - startPos-1);
+                                        }
+                                        sb.Append('?'); //Will be replaced later on by the fraction
+                                    }
+                                    else
+                                    {
+                                        sb.Append('/');
+                                    }
+                                }
+                                else if (c == '*')
+                                {
+                                    //repeat char--> ignore
+                                    ignoreNext = true;
+                                }
+                                else if (c == '@')
+                                {
+                                    sb.Append("{0}");
+                                }
+                                else
+                                {
+                                    sb.Append(c);
+                                }
+                            }
+                        }
+                    }
+                }
+
+                //Add qoutes
+                SetDecimal(lstDec, sb);
+
+                // AM/PM format
+                if (containsAmPm)
+                {
+                    format += "tt";
+                }
+
+
+                if (format == "")
+                    format = sb.ToString();
+                else
+                    text = sb.ToString();
+                if (specialDateFormat != "")
+                {
+                    format = specialDateFormat;
+                }
+
+                if (forColWidth)
+                {
+                    NetFormatForWidth = format;
+                    NetTextFormatForWidth = text;
+                }
+                else
+                {
+                    NetFormat = format;
+                    NetTextFormat = text;
+                }
+                if (Culture == null)
+                {
+                    Culture = CultureInfo.CurrentCulture;
+                }
+            }
+
+            private static void SetDecimal(List<int> lstDec, StringBuilder sb)
+            {
+                if (lstDec.Count > 1)
+                {
+                    for (int i = lstDec.Count - 1; i >= 0; i--)
+                    {
+                        sb.Insert(lstDec[i] + 1, '\'');
+                        sb.Insert(lstDec[i], '\'');
+                    }
+                }
+            }
+
+            internal string FormatFraction(double d)
+            {
+                int numerator, denomerator;
+
+                int intPart = (int)d;
+
+                string[] fmt = FractionFormat.Split('/');
+
+                int fixedDenominator;
+                if (!int.TryParse(fmt[1], out fixedDenominator))
+                {
+                    fixedDenominator = 0;
+                }
+                
+                if (d == 0 || double.IsNaN(d))
+                {
+                    if (fmt[0].Trim() == "" && fmt[1].Trim() == "")
+                    {
+                        return new string(' ', FractionFormat.Length);
+                    }
+                    else
+                    {
+                        return 0.ToString(fmt[0]) + "/" + 1.ToString(fmt[0]);
+                    }
+                }
+
+                int maxDigits = fmt[1].Length;
+                string sign = d < 0 ? "-" : "";
+                if (fixedDenominator == 0)
+                {
+                    List<double> numerators = new List<double>() { 1, 0 };
+                    List<double> denominators = new List<double>() { 0, 1 };
+
+                    if (maxDigits < 1 && maxDigits > 12)
+                    {
+                        throw (new ArgumentException("Number of digits out of range (1-12)"));
+                    }
+
+                    int maxNum = 0;
+                    for (int i = 0; i < maxDigits; i++)
+                    {
+                        maxNum += 9 * (int)(Math.Pow((double)10, (double)i));
+                    }
+
+                    double divRes = 1 / ((double)Math.Abs(d) - intPart);
+                    double result, prevResult = double.NaN;
+                    int listPos = 2, index = 1;
+                    while (true)
+                    {
+                        index++;
+                        double intDivRes = Math.Floor(divRes);
+                        numerators.Add((intDivRes * numerators[index - 1] + numerators[index - 2]));
+                        if (numerators[index] > maxNum)
+                        {
+                            break;
+                        }
+
+                        denominators.Add((intDivRes * denominators[index - 1] + denominators[index - 2]));
+
+                        result = numerators[index] / denominators[index];
+                        if (denominators[index] > maxNum)
+                        {
+                            break;
+                        }
+                        listPos = index;
+
+                        if (result == prevResult) break;
+
+                        if (result == d) break;
+
+                        prevResult = result;
+
+                        divRes = 1 / (divRes - intDivRes);  //Rest
+                    }
+                    
+                    numerator = (int)numerators[listPos];
+                    denomerator = (int)denominators[listPos];
+                }
+                else
+                {
+                    numerator = (int)Math.Round((d - intPart) / (1D / fixedDenominator), 0);
+                    denomerator = fixedDenominator;
+                }
+                if (numerator == denomerator || numerator==0)
+                {
+                    if(numerator == denomerator) intPart++;
+                    return sign + intPart.ToString(NetFormat).Replace("?", new string(' ', FractionFormat.Length));
+                }
+                else if (intPart == 0)
+                {
+                    return sign + FmtInt(numerator, fmt[0]) + "/" + FmtInt(denomerator, fmt[1]);
+                }
+                else
+                {
+                    return sign + intPart.ToString(NetFormat).Replace("?", FmtInt(numerator, fmt[0]) + "/" + FmtInt(denomerator, fmt[1]));
+                }
+            }
+
+            private string FmtInt(double value, string format)
+            {
+                string v = value.ToString("#");
+                string pad = "";
+                if (v.Length < format.Length)
+                {
+                    for (int i = format.Length - v.Length-1; i >= 0; i--)
+                    {
+                        if (format[i] == '?')
+                        {
+                            pad += " ";
+                        }
+                        else if (format[i] == ' ')
+                        {
+                            pad += "0";
+                        }
+                    }
+                }
+                return pad + v;
+            }
+        }
+        #endregion
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/XmlAccess/ExcelXfsXml.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/XmlAccess/ExcelXfsXml.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/XmlAccess/ExcelXfsXml.cs	(revision 12707)
@@ -0,0 +1,860 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		                Initial Release		        2009-10-01
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Text;
+using System.Xml;
+using System.Drawing;
+namespace OfficeOpenXml.Style.XmlAccess
+{
+    /// <summary>
+    /// Xml access class xfs records. This is the top level style object.
+    /// </summary>
+    public sealed class ExcelXfs : StyleXmlHelper
+    {
+        ExcelStyles _styles;
+        internal ExcelXfs(XmlNamespaceManager nameSpaceManager, ExcelStyles styles) : base(nameSpaceManager)
+        {
+            _styles = styles;
+            isBuildIn = false;
+        }
+        internal ExcelXfs(XmlNamespaceManager nsm, XmlNode topNode, ExcelStyles styles) :
+            base(nsm, topNode)
+        {
+            _styles = styles;
+            _xfID = GetXmlNodeInt("@xfId");
+            if (_xfID == 0) isBuildIn = true; //Normal taggen
+            _numFmtId = GetXmlNodeInt("@numFmtId");
+            _fontId = GetXmlNodeInt("@fontId");
+            _fillId = GetXmlNodeInt("@fillId");
+            _borderId = GetXmlNodeInt("@borderId");
+            _readingOrder = GetReadingOrder(GetXmlNodeString(readingOrderPath));
+            _indent = GetXmlNodeInt(indentPath);
+            _shrinkToFit = GetXmlNodeString(shrinkToFitPath) == "1" ? true : false; 
+            _verticalAlignment = GetVerticalAlign(GetXmlNodeString(verticalAlignPath));
+            _horizontalAlignment = GetHorizontalAlign(GetXmlNodeString(horizontalAlignPath));
+            _wrapText = GetXmlNodeBool(wrapTextPath);
+            _textRotation = GetXmlNodeInt(textRotationPath);
+            _hidden = GetXmlNodeBool(hiddenPath);
+            _locked = GetXmlNodeBool(lockedPath,true);
+        }
+
+        private ExcelReadingOrder GetReadingOrder(string value)
+        {
+            switch(value)
+            {
+                case "1":
+                    return ExcelReadingOrder.LeftToRight;
+                case "2":
+                    return ExcelReadingOrder.RightToLeft;
+                default:
+                    return ExcelReadingOrder.ContextDependent;
+            }
+        }
+
+        private ExcelHorizontalAlignment GetHorizontalAlign(string align)
+        {
+            if (align == "") return ExcelHorizontalAlignment.General;
+            align = align.Substring(0, 1).ToUpper(CultureInfo.InvariantCulture) + align.Substring(1, align.Length - 1);
+            try
+            {
+                return (ExcelHorizontalAlignment)Enum.Parse(typeof(ExcelHorizontalAlignment), align);
+            }
+            catch
+            {
+                return ExcelHorizontalAlignment.General;
+            }
+        }
+
+        private ExcelVerticalAlignment GetVerticalAlign(string align)
+        {
+            if (align == "") return ExcelVerticalAlignment.Bottom;
+            align = align.Substring(0, 1).ToUpper(CultureInfo.InvariantCulture) + align.Substring(1, align.Length - 1);
+            try
+            {
+                return (ExcelVerticalAlignment)Enum.Parse(typeof(ExcelVerticalAlignment), align);
+            }
+            catch
+            {
+                return ExcelVerticalAlignment.Bottom;
+            }
+        }
+        internal void Xf_ChangedEvent(object sender, EventArgs e)
+        {
+            //if (_cell != null)
+            //{
+            //    if (!Styles.ChangedCells.ContainsKey(_cell.Id))
+            //    {
+            //        //_cell.Style = "";
+            //        _cell.SetNewStyleID(int.MinValue.ToString());
+            //        Styles.ChangedCells.Add(_cell.Id, _cell);
+            //    }
+            //}
+        }
+        int _xfID;
+        /// <summary>
+        /// Style index
+        /// </summary>
+        public int XfId
+        {
+            get
+            {
+                return _xfID;
+            }
+            set
+            {
+                _xfID = value;
+            }
+        }
+        #region Internal Properties
+        int _numFmtId;
+        internal int NumberFormatId
+        {
+            get
+            {
+                return _numFmtId;
+            }
+            set
+            {
+                _numFmtId = value;
+                ApplyNumberFormat = (value>0);
+            }
+        }
+        int _fontId;
+        internal int FontId
+        {
+            get
+            {
+                return _fontId;
+            }
+            set
+            {
+                _fontId = value;
+            }
+        }
+        int _fillId;
+        internal int FillId
+        {
+            get
+            {
+                return _fillId;
+            }
+            set
+            {
+                _fillId = value;
+            }
+        }
+        int _borderId;
+        internal int BorderId
+        {
+            get
+            {
+                return _borderId;
+            }
+            set
+            {
+                _borderId = value;
+            }
+        }
+        private bool isBuildIn
+        {
+            get;
+            set;
+        }
+        internal bool ApplyNumberFormat
+        {
+            get;
+            set;
+        }
+        internal bool ApplyFont
+        {
+            get;
+            set;
+        }
+        internal bool ApplyFill
+        {
+            get;
+            set;
+        }
+        internal bool ApplyBorder
+        {
+            get;
+            set;
+        }
+        internal bool ApplyAlignment
+        {
+            get;
+            set;
+        }
+        internal bool ApplyProtection
+        {
+            get;
+            set;
+        }
+        #endregion
+        #region Public Properties
+        public ExcelStyles Styles { get; private set; }
+        /// <summary>
+        /// Numberformat properties
+        /// </summary>
+        public ExcelNumberFormatXml Numberformat 
+        {
+            get
+            {
+                return _styles.NumberFormats[_numFmtId < 0 ? 0 : _numFmtId];
+            }
+        }
+        /// <summary>
+        /// Font properties
+        /// </summary>
+        public ExcelFontXml Font 
+        { 
+           get
+           {
+               return _styles.Fonts[_fontId < 0 ? 0 : _fontId];
+           }
+        }
+        /// <summary>
+        /// Fill properties
+        /// </summary>
+        public ExcelFillXml Fill
+        {
+            get
+            {
+                return _styles.Fills[_fillId < 0 ? 0 : _fillId];
+            }
+        }        
+        /// <summary>
+        /// Border style properties
+        /// </summary>
+        public ExcelBorderXml Border
+        {
+            get
+            {
+                return _styles.Borders[_borderId < 0 ? 0 : _borderId];
+            }
+        }
+        const string horizontalAlignPath = "d:alignment/@horizontal";
+        ExcelHorizontalAlignment _horizontalAlignment = ExcelHorizontalAlignment.General;
+        /// <summary>
+        /// Horizontal alignment
+        /// </summary>
+        public ExcelHorizontalAlignment HorizontalAlignment
+        {
+            get
+            {
+                return _horizontalAlignment;
+            }
+            set
+            {
+                _horizontalAlignment = value;
+            }
+        }
+        const string verticalAlignPath = "d:alignment/@vertical";
+        ExcelVerticalAlignment _verticalAlignment=ExcelVerticalAlignment.Bottom;
+        /// <summary>
+        /// Vertical alignment
+        /// </summary>
+        public ExcelVerticalAlignment VerticalAlignment
+        {
+            get
+            {
+                return _verticalAlignment;
+            }
+            set
+            {
+                _verticalAlignment = value;
+            }
+        }
+        const string wrapTextPath = "d:alignment/@wrapText";
+        bool _wrapText=false;
+        /// <summary>
+        /// Wraped text
+        /// </summary>
+        public bool WrapText
+        {
+            get
+            {
+                return _wrapText;
+            }
+            set
+            {
+                _wrapText = value;
+            }
+        }
+        string textRotationPath = "d:alignment/@textRotation";
+        int _textRotation = 0;
+        /// <summary>
+        /// Text rotation angle
+        /// </summary>
+        public int TextRotation
+        {
+            get
+            {
+                return (_textRotation == int.MinValue ? 0 : _textRotation);
+            }
+            set
+            {
+                _textRotation = value;
+            }
+        }
+        const string lockedPath = "d:protection/@locked";
+        bool _locked = true;
+        /// <summary>
+        /// Locked when sheet is protected
+        /// </summary>
+        public bool Locked
+        {
+            get
+            {
+                return _locked;
+            }
+            set
+            {
+                _locked = value;
+            }
+        }
+        const string hiddenPath = "d:protection/@hidden";
+        bool _hidden = false;
+        /// <summary>
+        /// Hide formulas when sheet is protected
+        /// </summary>
+        public bool Hidden
+        {
+            get
+            {
+                return _hidden;
+            }
+            set
+            {
+                _hidden = value;
+            }
+        }
+        const string readingOrderPath = "d:alignment/@readingOrder";
+        ExcelReadingOrder _readingOrder = ExcelReadingOrder.ContextDependent;
+        /// <summary>
+        /// Readingorder
+        /// </summary>
+        public ExcelReadingOrder ReadingOrder
+        {
+            get
+            {
+                return _readingOrder;
+            }
+            set
+            {
+                _readingOrder = value;
+            }
+        }
+        const string shrinkToFitPath = "d:alignment/@shrinkToFit";
+        bool _shrinkToFit = false;
+        /// <summary>
+        /// Shrink to fit
+        /// </summary>
+        public bool ShrinkToFit
+        {
+            get
+            {
+                return _shrinkToFit;
+            }
+            set
+            {
+                _shrinkToFit = value;
+            }
+        }
+        const string indentPath = "d:alignment/@indent";
+        int _indent = 0;
+        /// <summary>
+        /// Indentation
+        /// </summary>
+        public int Indent
+        {
+            get
+            {
+                return (_indent == int.MinValue ? 0 : _indent);
+            }
+            set
+            {
+                _indent=value;
+            }
+        }
+        #endregion
+        internal void RegisterEvent(ExcelXfs xf)
+        {
+            //                RegisterEvent(xf, xf.Xf_ChangedEvent);
+        }
+        internal override string Id
+        {
+
+            get
+            {
+                return XfId + "|" + NumberFormatId.ToString() + "|" + FontId.ToString() + "|" + FillId.ToString() + "|" + BorderId.ToString() + VerticalAlignment.ToString() + "|" + HorizontalAlignment.ToString() + "|" + WrapText.ToString() + "|" + ReadingOrder.ToString() + "|" + isBuildIn.ToString() + TextRotation.ToString() + Locked.ToString() + Hidden.ToString() + ShrinkToFit.ToString() + Indent.ToString(); 
+                //return Numberformat.Id + "|" + Font.Id + "|" + Fill.Id + "|" + Border.Id + VerticalAlignment.ToString() + "|" + HorizontalAlignment.ToString() + "|" + WrapText.ToString() + "|" + ReadingOrder.ToString(); 
+            }
+        }
+        internal ExcelXfs Copy()
+        {
+            return Copy(_styles);
+        }        
+        internal ExcelXfs Copy(ExcelStyles styles)
+        {
+            ExcelXfs newXF = new ExcelXfs(NameSpaceManager, styles);
+            newXF.NumberFormatId = _numFmtId;
+            newXF.FontId = _fontId;
+            newXF.FillId = _fillId;
+            newXF.BorderId = _borderId;
+            newXF.XfId = _xfID;
+            newXF.ReadingOrder = _readingOrder;
+            newXF.HorizontalAlignment = _horizontalAlignment;
+            newXF.VerticalAlignment = _verticalAlignment;
+            newXF.WrapText = _wrapText;
+            newXF.ShrinkToFit = _shrinkToFit;
+            newXF.Indent = _indent;
+            newXF.TextRotation = _textRotation;
+            newXF.Locked = _locked;
+            newXF.Hidden = _hidden;
+            return newXF;
+        }
+
+        internal int GetNewID(ExcelStyleCollection<ExcelXfs> xfsCol, StyleBase styleObject, eStyleClass styleClass, eStyleProperty styleProperty, object value)
+        {
+            ExcelXfs newXfs = this.Copy();
+            switch(styleClass)
+            {
+                case eStyleClass.Numberformat:
+                    newXfs.NumberFormatId = GetIdNumberFormat(styleProperty, value);
+                    styleObject.SetIndex(newXfs.NumberFormatId);
+                    break;
+                case eStyleClass.Font:
+                {
+                    newXfs.FontId = GetIdFont(styleProperty, value);
+                    styleObject.SetIndex(newXfs.FontId);
+                    break;
+                }
+                case eStyleClass.Fill:
+                case eStyleClass.FillBackgroundColor:
+                case eStyleClass.FillPatternColor:
+                    newXfs.FillId = GetIdFill(styleClass, styleProperty, value);
+                    styleObject.SetIndex(newXfs.FillId);
+                    break;
+                case eStyleClass.GradientFill:
+                case eStyleClass.FillGradientColor1:
+                case eStyleClass.FillGradientColor2:
+                    newXfs.FillId = GetIdGradientFill(styleClass, styleProperty, value);
+                    styleObject.SetIndex(newXfs.FillId);
+                    break;
+                case eStyleClass.Border:
+                case eStyleClass.BorderBottom:
+                case eStyleClass.BorderDiagonal:
+                case eStyleClass.BorderLeft:
+                case eStyleClass.BorderRight:
+                case eStyleClass.BorderTop:
+                    newXfs.BorderId = GetIdBorder(styleClass, styleProperty, value);
+                    styleObject.SetIndex(newXfs.BorderId);
+                    break;
+                case eStyleClass.Style:
+                    switch(styleProperty)
+                    {
+                        case eStyleProperty.XfId:
+                            newXfs.XfId = (int)value;
+                            break;
+                        case eStyleProperty.HorizontalAlign:
+                            newXfs.HorizontalAlignment=(ExcelHorizontalAlignment)value;
+                            break;
+                        case eStyleProperty.VerticalAlign:
+                            newXfs.VerticalAlignment = (ExcelVerticalAlignment)value;
+                            break;
+                        case eStyleProperty.WrapText:
+                            newXfs.WrapText = (bool)value;
+                            break;
+                        case eStyleProperty.ReadingOrder:
+                            newXfs.ReadingOrder = (ExcelReadingOrder)value;
+                            break;
+                        case eStyleProperty.ShrinkToFit:
+                            newXfs.ShrinkToFit=(bool)value;
+                            break;
+                        case eStyleProperty.Indent:
+                            newXfs.Indent = (int)value;
+                            break;
+                        case eStyleProperty.TextRotation:
+                            newXfs.TextRotation = (int)value;
+                            break;
+                        case eStyleProperty.Locked:
+                            newXfs.Locked = (bool)value;
+                            break;
+                        case eStyleProperty.Hidden:
+                            newXfs.Hidden = (bool)value;
+                            break;
+                        default:
+                            throw (new Exception("Invalid property for class style."));
+
+                    }
+                    break;
+                default:
+                    break;
+            }
+            int id = xfsCol.FindIndexByID(newXfs.Id);
+            if (id < 0)
+            {
+                return xfsCol.Add(newXfs.Id, newXfs);
+            }
+            return id;
+        }
+
+        private int GetIdBorder(eStyleClass styleClass, eStyleProperty styleProperty, object value)
+        {
+            ExcelBorderXml border = Border.Copy();
+
+            switch (styleClass)
+            {
+                case eStyleClass.BorderBottom:
+                    SetBorderItem(border.Bottom, styleProperty, value);
+                    break;
+                case eStyleClass.BorderDiagonal:
+                    SetBorderItem(border.Diagonal, styleProperty, value);
+                    break;
+                case eStyleClass.BorderLeft:
+                    SetBorderItem(border.Left, styleProperty, value);
+                    break;
+                case eStyleClass.BorderRight:
+                    SetBorderItem(border.Right, styleProperty, value);
+                    break;
+                case eStyleClass.BorderTop:
+                    SetBorderItem(border.Top, styleProperty, value);
+                    break;
+                case eStyleClass.Border:
+                    if (styleProperty == eStyleProperty.BorderDiagonalUp)
+                    {
+                        border.DiagonalUp = (bool)value;
+                    }
+                    else if (styleProperty == eStyleProperty.BorderDiagonalDown)
+                    {
+                        border.DiagonalDown = (bool)value;
+                    }
+                    else
+                    {
+                        throw (new Exception("Invalid property for class Border."));
+                    }
+                    break;
+                default:
+                    throw (new Exception("Invalid class/property for class Border."));
+            }
+            int subId;
+            string id = border.Id;
+            subId = _styles.Borders.FindIndexByID(id);
+            if (subId == int.MinValue)
+            {
+                return _styles.Borders.Add(id, border);
+            }
+            return subId;
+        }
+
+        private void SetBorderItem(ExcelBorderItemXml excelBorderItem, eStyleProperty styleProperty, object value)
+        {
+            if(styleProperty==eStyleProperty.Style)
+            {
+                excelBorderItem.Style = (ExcelBorderStyle)value;
+            }
+            else if (styleProperty == eStyleProperty.Color || styleProperty== eStyleProperty.Tint || styleProperty==eStyleProperty.IndexedColor)
+            {
+                if (excelBorderItem.Style == ExcelBorderStyle.None)
+                {
+                    throw(new Exception("Can't set bordercolor when style is not set."));
+                }
+                excelBorderItem.Color.Rgb = value.ToString();
+            }
+        }
+
+        private int GetIdFill(eStyleClass styleClass, eStyleProperty styleProperty, object value)
+        {
+            ExcelFillXml fill = Fill.Copy();
+
+            switch (styleProperty)
+            {
+                case eStyleProperty.PatternType:
+                    if (fill is ExcelGradientFillXml)
+                    {
+                        fill = new ExcelFillXml(NameSpaceManager);
+                    }
+                    fill.PatternType = (ExcelFillStyle)value;
+                    break;
+                case eStyleProperty.Color:
+                case eStyleProperty.Tint:
+                case eStyleProperty.IndexedColor:
+                case eStyleProperty.AutoColor:
+                    if (fill is ExcelGradientFillXml)
+                    {
+                        fill = new ExcelFillXml(NameSpaceManager);
+                    }
+                    if (fill.PatternType == ExcelFillStyle.None)
+                    {
+                        throw (new ArgumentException("Can't set color when patterntype is not set."));
+                    }
+                    ExcelColorXml destColor;
+                    if (styleClass==eStyleClass.FillPatternColor)
+                    {
+                        destColor = fill.PatternColor;
+                    }
+                    else
+                    {
+                        destColor = fill.BackgroundColor;
+                    }
+
+                    if (styleProperty == eStyleProperty.Color)
+                    {
+                        destColor.Rgb = value.ToString();
+                    }
+                    else if (styleProperty == eStyleProperty.Tint)
+                    {
+                        destColor.Tint = (decimal)value;
+                    }
+                    else if (styleProperty == eStyleProperty.IndexedColor)
+                    {
+                        destColor.Indexed = (int)value;
+                    }
+                    else
+                    {
+                        destColor.Auto = (bool)value;
+                    }
+
+                    break;
+                default:
+                    throw (new ArgumentException("Invalid class/property for class Fill."));
+            }
+            int subId;
+            string id = fill.Id;
+            subId = _styles.Fills.FindIndexByID(id);
+            if (subId == int.MinValue)
+            {
+                return _styles.Fills.Add(id, fill);
+            }
+            return subId;
+        }
+        private int GetIdGradientFill(eStyleClass styleClass, eStyleProperty styleProperty, object value)
+        {
+            ExcelGradientFillXml fill;
+            if(Fill is ExcelGradientFillXml)
+            {
+                fill = (ExcelGradientFillXml)Fill.Copy();
+            }
+            else
+            {
+                fill = new ExcelGradientFillXml(Fill.NameSpaceManager);
+                fill.GradientColor1.SetColor(Color.White);
+                fill.GradientColor2.SetColor(Color.FromArgb(79,129,189));
+                fill.Type=ExcelFillGradientType.Linear;
+                fill.Degree=90;
+                fill.Top = double.NaN;
+                fill.Bottom = double.NaN;
+                fill.Left = double.NaN;
+                fill.Right = double.NaN;
+            }
+
+            switch (styleProperty)
+            {
+                case eStyleProperty.GradientType:
+                    fill.Type = (ExcelFillGradientType)value;
+                    break;
+                case eStyleProperty.GradientDegree:
+                    fill.Degree = (double)value;
+                    break;
+                case eStyleProperty.GradientTop:
+                    fill.Top = (double)value;
+                    break;
+                case eStyleProperty.GradientBottom: 
+                    fill.Bottom = (double)value;
+                    break;
+                case eStyleProperty.GradientLeft:
+                    fill.Left = (double)value;
+                    break;
+                case eStyleProperty.GradientRight:
+                    fill.Right = (double)value;
+                    break;
+                case eStyleProperty.Color:
+                case eStyleProperty.Tint:
+                case eStyleProperty.IndexedColor:
+                case eStyleProperty.AutoColor:
+                    ExcelColorXml destColor;
+
+                    if (styleClass == eStyleClass.FillGradientColor1)
+                    {
+                        destColor = fill.GradientColor1;
+                    }
+                    else
+                    {
+                        destColor = fill.GradientColor2;
+                    }
+                    
+                    if (styleProperty == eStyleProperty.Color)
+                    {
+                        destColor.Rgb = value.ToString();
+                    }
+                    else if (styleProperty == eStyleProperty.Tint)
+                    {
+                        destColor.Tint = (decimal)value;
+                    }
+                    else if (styleProperty == eStyleProperty.IndexedColor)
+                    {
+                        destColor.Indexed = (int)value;
+                    }
+                    else
+                    {
+                        destColor.Auto = (bool)value;
+                    }
+                    break;
+                default:
+                    throw (new ArgumentException("Invalid class/property for class Fill."));
+            }
+            int subId;
+            string id = fill.Id;
+            subId = _styles.Fills.FindIndexByID(id);
+            if (subId == int.MinValue)
+            {
+                return _styles.Fills.Add(id, fill);
+            }
+            return subId;
+        }
+
+        private int GetIdNumberFormat(eStyleProperty styleProperty, object value)
+        {
+            if (styleProperty == eStyleProperty.Format)
+            {
+                ExcelNumberFormatXml item=null;
+                if (!_styles.NumberFormats.FindByID(value.ToString(), ref item))
+                {
+                    item = new ExcelNumberFormatXml(NameSpaceManager) { Format = value.ToString(), NumFmtId = _styles.NumberFormats.NextId++ };
+                    _styles.NumberFormats.Add(value.ToString(), item);
+                }
+                return item.NumFmtId;
+            }
+            else
+            {
+                throw (new Exception("Invalid property for class Numberformat"));
+            }
+        }
+        private int GetIdFont(eStyleProperty styleProperty, object value)
+        {
+            ExcelFontXml fnt = Font.Copy();
+
+            switch (styleProperty)
+            {
+                case eStyleProperty.Name:
+                    fnt.Name = value.ToString();
+                    break;
+                case eStyleProperty.Size:
+                    fnt.Size = (float)value;
+                    break;
+                case eStyleProperty.Family:
+                    fnt.Family = (int)value;
+                    break;
+                case eStyleProperty.Bold:
+                    fnt.Bold = (bool)value;
+                    break;
+                case eStyleProperty.Italic:
+                    fnt.Italic = (bool)value;
+                    break;
+                case eStyleProperty.Strike:
+                    fnt.Strike = (bool)value;
+                    break;
+                case eStyleProperty.UnderlineType:
+                    fnt.UnderLineType = (ExcelUnderLineType)value;
+                    break;
+                case eStyleProperty.Color:
+                    fnt.Color.Rgb=value.ToString();
+                    break;
+                case eStyleProperty.VerticalAlign:
+                    fnt.VerticalAlign = ((ExcelVerticalAlignmentFont)value) == ExcelVerticalAlignmentFont.None ? "" : value.ToString().ToLower(CultureInfo.InvariantCulture);
+                    break;
+                default:
+                    throw (new Exception("Invalid property for class Font"));
+            }
+            int subId;
+            string id = fnt.Id;
+            subId = _styles.Fonts.FindIndexByID(id);
+            if (subId == int.MinValue)
+            {
+                return _styles.Fonts.Add(id,fnt);
+            }
+            return subId;
+        }
+        internal override XmlNode CreateXmlNode(XmlNode topNode)
+        {
+            return CreateXmlNode(topNode, false);
+        }
+        internal XmlNode CreateXmlNode(XmlNode topNode, bool isCellStyleXsf)
+        {
+            TopNode = topNode;
+            var doSetXfId = (!isCellStyleXsf && _xfID > int.MinValue && _styles.CellStyleXfs.Count > 0 && _styles.CellStyleXfs[_xfID].newID > int.MinValue);
+            if (_numFmtId >= 0)
+            {
+                SetXmlNodeString("@numFmtId", _numFmtId.ToString());
+                if(doSetXfId) SetXmlNodeString("@applyNumberFormat", "1");
+            }
+            if (_fontId >= 0)
+            {
+                SetXmlNodeString("@fontId", _styles.Fonts[_fontId].newID.ToString());
+                if (doSetXfId) SetXmlNodeString("@applyFont", "1");
+            }
+            if (_fillId >= 0)
+            {
+                SetXmlNodeString("@fillId", _styles.Fills[_fillId].newID.ToString());
+                if (doSetXfId) SetXmlNodeString("@applyFill", "1");
+            }
+            if (_borderId >= 0)
+            {
+                SetXmlNodeString("@borderId", _styles.Borders[_borderId].newID.ToString());
+                if (doSetXfId) SetXmlNodeString("@applyBorder", "1");
+            }
+            if(_horizontalAlignment != ExcelHorizontalAlignment.General) this.SetXmlNodeString(horizontalAlignPath, SetAlignString(_horizontalAlignment));
+            if (doSetXfId)
+            {
+                SetXmlNodeString("@xfId", _styles.CellStyleXfs[_xfID].newID.ToString());
+            }
+            if (_verticalAlignment != ExcelVerticalAlignment.Bottom) this.SetXmlNodeString(verticalAlignPath, SetAlignString(_verticalAlignment));
+            if(_wrapText) this.SetXmlNodeString(wrapTextPath, "1");
+            if(_readingOrder!=ExcelReadingOrder.ContextDependent) this.SetXmlNodeString(readingOrderPath, ((int)_readingOrder).ToString());
+            if (_shrinkToFit) this.SetXmlNodeString(shrinkToFitPath, "1");
+            if (_indent > 0) SetXmlNodeString(indentPath, _indent.ToString());
+            if (_textRotation > 0) this.SetXmlNodeString(textRotationPath, _textRotation.ToString());
+            if (!_locked) this.SetXmlNodeString(lockedPath, "0");
+            if (_hidden) this.SetXmlNodeString(hiddenPath, "1");
+            return TopNode;
+        }
+
+        private string SetAlignString(Enum align)
+        {
+            string newName = Enum.GetName(align.GetType(), align);
+            return newName.Substring(0, 1).ToLower(CultureInfo.InvariantCulture) + newName.Substring(1, newName.Length - 1);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/XmlAccess/StyleXmlHelper.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/XmlAccess/StyleXmlHelper.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Style/XmlAccess/StyleXmlHelper.cs	(revision 12707)
@@ -0,0 +1,58 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		                Initial Release		        2009-10-01
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Xml;
+namespace OfficeOpenXml.Style.XmlAccess
+{
+    /// <summary>
+    /// Xml helper class for cell style classes
+    /// </summary>
+    public abstract class  StyleXmlHelper : XmlHelper
+    {
+        internal StyleXmlHelper(XmlNamespaceManager nameSpaceManager) : base(nameSpaceManager)
+        { 
+
+        }
+        internal StyleXmlHelper(XmlNamespaceManager nameSpaceManager, XmlNode topNode) : base(nameSpaceManager, topNode)
+        {
+        }
+        internal abstract XmlNode CreateXmlNode(XmlNode top);
+        internal abstract string Id
+        {
+            get;
+        }
+        internal long useCnt=0;
+        internal int newID=int.MinValue;
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Table/ExcelTable.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Table/ExcelTable.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Table/ExcelTable.cs	(revision 12707)
@@ -0,0 +1,629 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		Added		30-AUG-2010
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Xml;
+using System.Text.RegularExpressions;
+using OfficeOpenXml.FormulaParsing.Excel.Functions.Math;
+using OfficeOpenXml.Utils;
+
+namespace OfficeOpenXml.Table
+{
+    /// <summary>
+    /// Table style Enum
+    /// </summary>
+    public enum TableStyles
+    {
+        None,
+        Custom,
+        Light1,
+        Light2,
+        Light3,
+        Light4,
+        Light5,
+        Light6,
+        Light7,
+        Light8,
+        Light9,
+        Light10,
+        Light11,
+        Light12,
+        Light13,
+        Light14,
+        Light15,
+        Light16,
+        Light17,
+        Light18,
+        Light19,
+        Light20,
+        Light21,
+        Medium1,
+        Medium2,
+        Medium3,
+        Medium4,
+        Medium5,
+        Medium6,
+        Medium7,
+        Medium8,
+        Medium9,
+        Medium10,
+        Medium11,
+        Medium12,
+        Medium13,
+        Medium14,
+        Medium15,
+        Medium16,
+        Medium17,
+        Medium18,
+        Medium19,
+        Medium20,
+        Medium21,
+        Medium22,
+        Medium23,
+        Medium24,
+        Medium25,
+        Medium26,
+        Medium27,
+        Medium28,
+        Dark1,
+        Dark2,
+        Dark3,
+        Dark4,
+        Dark5,
+        Dark6,
+        Dark7,
+        Dark8,
+        Dark9,
+        Dark10,
+        Dark11,
+    }
+    /// <summary>
+    /// An Excel Table
+    /// </summary>
+    public class ExcelTable : XmlHelper
+    {
+        internal ExcelTable(Packaging.ZipPackageRelationship rel, ExcelWorksheet sheet) : 
+            base(sheet.NameSpaceManager)
+        {
+            WorkSheet = sheet;
+            TableUri = UriHelper.ResolvePartUri(rel.SourceUri, rel.TargetUri);
+            RelationshipID = rel.Id;
+            var pck = sheet._package.Package;
+            Part=pck.GetPart(TableUri);
+
+            TableXml = new XmlDocument();
+            LoadXmlSafe(TableXml, Part.GetStream());
+            init();
+            Address = new ExcelAddressBase(GetXmlNodeString("@ref"));
+        }
+        internal ExcelTable(ExcelWorksheet sheet, ExcelAddressBase address, string name, int tblId) : 
+            base(sheet.NameSpaceManager)
+	    {
+            WorkSheet = sheet;
+            Address = address;
+            TableXml = new XmlDocument();
+            LoadXmlSafe(TableXml, GetStartXml(name, tblId), Encoding.UTF8); 
+            TopNode = TableXml.DocumentElement;
+
+            init();
+
+            //If the table is just one row we can not have a header.
+            if (address._fromRow == address._toRow)
+            {
+                ShowHeader = false;
+            }
+        }
+
+        private void init()
+        {
+            TopNode = TableXml.DocumentElement;
+            SchemaNodeOrder = new string[] { "autoFilter", "tableColumns", "tableStyleInfo" };
+        }
+        private string GetStartXml(string name, int tblId)
+        {
+            string xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?>";
+            xml += string.Format("<table xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" id=\"{0}\" name=\"{1}\" displayName=\"{2}\" ref=\"{3}\" headerRowCount=\"1\">",
+            tblId,
+            name,
+            cleanDisplayName(name),
+            Address.Address);
+            xml += string.Format("<autoFilter ref=\"{0}\" />", Address.Address);
+
+            int cols=Address._toCol-Address._fromCol+1;
+            xml += string.Format("<tableColumns count=\"{0}\">",cols);
+            var names = new Dictionary<string, string>();            
+            for(int i=1;i<=cols;i++)
+            {
+                var cell = WorkSheet.Cells[Address._fromRow, Address._fromCol+i-1];
+                string colName;
+                if (cell.Value == null || names.ContainsKey(cell.Value.ToString()))
+                {
+                    //Get an unique name
+                    int a=i;
+                    do
+                    {
+                        colName = string.Format("Column{0}", a++);
+                    }
+                    while (names.ContainsKey(colName));
+                }
+                else
+                {
+                    colName = System.Security.SecurityElement.Escape(cell.Value.ToString());
+                }
+                names.Add(colName, colName);
+                xml += string.Format("<tableColumn id=\"{0}\" name=\"{1}\" />", i,colName);
+            }
+            xml += "</tableColumns>";
+            xml += "<tableStyleInfo name=\"TableStyleMedium9\" showFirstColumn=\"0\" showLastColumn=\"0\" showRowStripes=\"1\" showColumnStripes=\"0\" /> ";
+            xml += "</table>";
+
+            return xml;
+        }
+        private string cleanDisplayName(string name) 
+        {
+            return Regex.Replace(name, @"[^\w\.-_]", "_");
+        }
+        internal Packaging.ZipPackagePart Part
+        {
+            get;
+            set;
+        }
+        /// <summary>
+        /// Provides access to the XML data representing the table in the package.
+        /// </summary>
+        public XmlDocument TableXml
+        {
+            get;
+            set;
+        }
+        /// <summary>
+        /// The package internal URI to the Table Xml Document.
+        /// </summary>
+        public Uri TableUri
+        {
+            get;
+            internal set;
+        }
+        internal string RelationshipID
+        {
+            get;
+            set;
+        }
+        const string ID_PATH = "@id";
+        internal int Id 
+        {
+            get
+            {
+                return GetXmlNodeInt(ID_PATH);
+            }
+            set
+            {
+                SetXmlNodeString(ID_PATH, value.ToString());
+            }
+        }
+        const string NAME_PATH = "@name";
+        const string DISPLAY_NAME_PATH = "@displayName";
+        /// <summary>
+        /// The name of the table object in Excel
+        /// </summary>
+        public string Name
+        {
+            get
+            {
+                return GetXmlNodeString(NAME_PATH);
+            }
+            set 
+            {
+                if(WorkSheet.Workbook.ExistsTableName(value))
+                {
+                    throw (new ArgumentException("Tablename is not unique"));
+                }
+                string prevName = Name;
+                if (WorkSheet.Tables._tableNames.ContainsKey(prevName))
+                {
+                    int ix=WorkSheet.Tables._tableNames[prevName];
+                    WorkSheet.Tables._tableNames.Remove(prevName);
+                    WorkSheet.Tables._tableNames.Add(value,ix);
+                }
+                SetXmlNodeString(NAME_PATH, value);
+                SetXmlNodeString(DISPLAY_NAME_PATH, cleanDisplayName(value));
+            }
+        }
+        /// <summary>
+        /// The worksheet of the table
+        /// </summary>
+        public ExcelWorksheet WorkSheet
+        {
+            get;
+            set;
+        }
+
+        private ExcelAddressBase _address = null;
+        /// <summary>
+        /// The address of the table
+        /// </summary>
+        public ExcelAddressBase Address
+        {
+            get
+            {
+                return _address;
+            }
+            internal set
+            {
+                _address = value;
+                SetXmlNodeString("@ref",value.Address);
+                WriteAutoFilter(ShowTotal);
+            }
+        }
+        internal ExcelTableColumnCollection _cols = null;
+        /// <summary>
+        /// Collection of the columns in the table
+        /// </summary>
+        public ExcelTableColumnCollection Columns
+        {
+            get
+            {
+                if(_cols==null)
+                {
+                    _cols = new ExcelTableColumnCollection(this);
+                }
+                return _cols;
+            }
+        }
+        TableStyles _tableStyle = TableStyles.Medium6;
+        /// <summary>
+        /// The table style. If this property is cusom, the style from the StyleName propery is used.
+        /// </summary>
+        public TableStyles TableStyle
+        {
+            get
+            {
+                return _tableStyle;
+            }
+            set
+            {
+                _tableStyle=value;
+                if (value != TableStyles.Custom)
+                {
+                    SetXmlNodeString(STYLENAME_PATH, "TableStyle" + value.ToString());
+                }
+            }
+        }
+        const string HEADERROWCOUNT_PATH = "@headerRowCount";
+        const string AUTOFILTER_PATH = "d:autoFilter/@ref";
+        /// <summary>
+        /// If the header row is visible or not
+        /// </summary>
+        public bool ShowHeader
+        {
+            get
+            {
+                return GetXmlNodeInt(HEADERROWCOUNT_PATH)!=0;
+            }
+            set
+            {
+                if (Address._toRow - Address._fromRow < 0 && value ||
+                    Address._toRow - Address._fromRow == 1 && value && ShowTotal)
+                {
+                    throw (new Exception("Cant set ShowHeader-property. Table has too few rows"));
+                }
+
+                if(value)
+                {
+                    DeleteNode(HEADERROWCOUNT_PATH);
+                    WriteAutoFilter(ShowTotal);
+                    //for (int i = 0; i < Columns.Count; i++)
+                    //{
+                    //    var v = WorkSheet.GetValue<string>(Address._fromRow, Address._fromCol + i);
+                    //    if (!string.IsNullOrEmpty(v) || v != _cols[i].Name)
+                    //    {
+                    //        _cols[i].Name = v;
+                    //    }
+                    //}
+                }
+                else
+                {
+                    SetXmlNodeString(HEADERROWCOUNT_PATH, "0");
+                    DeleteAllNode(AUTOFILTER_PATH);
+                }
+            }
+        }
+        internal ExcelAddressBase AutoFilterAddress
+        {
+            get
+            {
+                string a=GetXmlNodeString(AUTOFILTER_PATH);
+                if (a == "")
+                {
+                    return null;
+                }
+                else
+                {
+                    return new ExcelAddressBase(a);
+                }
+            }
+        }
+        private void WriteAutoFilter(bool showTotal)
+        {
+            string autofilterAddress;
+            if (ShowHeader)
+            {
+                if (showTotal)
+                {
+                    autofilterAddress = ExcelCellBase.GetAddress(Address._fromRow, Address._fromCol, Address._toRow - 1, Address._toCol);
+                }
+                else
+                {
+                    autofilterAddress = Address.Address;
+                }
+                SetXmlNodeString(AUTOFILTER_PATH, autofilterAddress);
+            }
+        }
+        /// <summary>
+        /// If the header row has an autofilter
+        /// </summary>
+        public bool ShowFilter 
+        { 
+            get
+            {
+                return ShowHeader && AutoFilterAddress != null;
+            }
+            set
+            {
+                if (ShowHeader)
+                {
+                    if (value)
+                    {
+                        WriteAutoFilter(ShowTotal);
+                    }
+                    else 
+                    {
+                        DeleteAllNode(AUTOFILTER_PATH);
+                    }
+                }
+                else if(value)
+                {
+                    throw(new InvalidOperationException("Filter can only be applied when ShowHeader is set to true"));
+                }
+            }
+        }
+        const string TOTALSROWCOUNT_PATH = "@totalsRowCount";
+        const string TOTALSROWSHOWN_PATH = "@totalsRowShown";
+        /// <summary>
+        /// If the total row is visible or not
+        /// </summary>
+        public bool ShowTotal
+        {
+            get
+            {
+                return GetXmlNodeInt(TOTALSROWCOUNT_PATH) == 1;
+            }
+            set
+            {
+                if (value != ShowTotal)
+                {
+                    if (value)
+                    {
+                        Address=new ExcelAddress(WorkSheet.Name, ExcelAddressBase.GetAddress(Address.Start.Row, Address.Start.Column, Address.End.Row+1, Address.End.Column));
+                    }
+                    else
+                    {
+                        Address = new ExcelAddress(WorkSheet.Name, ExcelAddressBase.GetAddress(Address.Start.Row, Address.Start.Column, Address.End.Row - 1, Address.End.Column));
+                    }
+                    SetXmlNodeString("@ref", Address.Address);
+                    if (value)
+                    {
+                        SetXmlNodeString(TOTALSROWCOUNT_PATH, "1");
+                    }
+                    else
+                    {
+                        DeleteNode(TOTALSROWCOUNT_PATH);
+                    }
+                    WriteAutoFilter(value);
+                }
+            }
+        }
+        const string STYLENAME_PATH = "d:tableStyleInfo/@name";
+        /// <summary>
+        /// The style name for custum styles
+        /// </summary>
+        public string StyleName
+        {
+            get
+            {
+                return GetXmlNodeString(STYLENAME_PATH);
+            }
+            set
+            {
+                if (value.StartsWith("TableStyle"))
+                {
+                    try
+                    {
+                        _tableStyle = (TableStyles)Enum.Parse(typeof(TableStyles), value.Substring(10,value.Length-10), true);
+                    }
+                    catch
+                    {
+                        _tableStyle = TableStyles.Custom;
+                    }
+                }
+                else if (value == "None")
+                {
+                    _tableStyle = TableStyles.None;
+                    value = "";
+                }
+                else
+                {
+                    _tableStyle = TableStyles.Custom;
+                }
+                SetXmlNodeString(STYLENAME_PATH,value,true);
+            }
+        }
+        const string SHOWFIRSTCOLUMN_PATH = "d:tableStyleInfo/@showFirstColumn";
+        /// <summary>
+        /// Display special formatting for the first row
+        /// </summary>
+        public bool ShowFirstColumn
+        {
+            get
+            {
+                return GetXmlNodeBool(SHOWFIRSTCOLUMN_PATH);
+            }
+            set
+            {
+                SetXmlNodeBool(SHOWFIRSTCOLUMN_PATH, value, false);
+            }   
+        }
+        const string SHOWLASTCOLUMN_PATH = "d:tableStyleInfo/@showLastColumn";
+        /// <summary>
+        /// Display special formatting for the last row
+        /// </summary>
+        public bool ShowLastColumn
+        {
+            get
+            {
+                return GetXmlNodeBool(SHOWLASTCOLUMN_PATH);
+            }
+            set
+            {
+                SetXmlNodeBool(SHOWLASTCOLUMN_PATH, value, false);
+            }
+        }
+        const string SHOWROWSTRIPES_PATH = "d:tableStyleInfo/@showRowStripes";
+        /// <summary>
+        /// Display banded rows
+        /// </summary>
+        public bool ShowRowStripes
+        {
+            get
+            {
+                return GetXmlNodeBool(SHOWROWSTRIPES_PATH);
+            }
+            set
+            {
+                SetXmlNodeBool(SHOWROWSTRIPES_PATH, value, false);
+            }
+        }
+        const string SHOWCOLUMNSTRIPES_PATH = "d:tableStyleInfo/@showColumnStripes";
+        /// <summary>
+        /// Display banded columns
+        /// </summary>
+        public bool ShowColumnStripes
+        {
+            get
+            {
+                return GetXmlNodeBool(SHOWCOLUMNSTRIPES_PATH);
+            }
+            set
+            {
+                SetXmlNodeBool(SHOWCOLUMNSTRIPES_PATH, value, false);
+            }
+        }
+
+        const string TOTALSROWCELLSTYLE_PATH = "@totalsRowCellStyle";
+        /// <summary>
+        /// Named style used for the total row
+        /// </summary>
+        public string TotalsRowCellStyle
+        {
+            get
+            {
+                return GetXmlNodeString(TOTALSROWCELLSTYLE_PATH);
+            }
+            set
+            {
+                if (WorkSheet.Workbook.Styles.NamedStyles.FindIndexByID(value) < 0)
+                {
+                    throw (new Exception(string.Format("Named style {0} does not exist.", value)));
+                }
+                SetXmlNodeString(TopNode, TOTALSROWCELLSTYLE_PATH, value, true);
+
+                if (ShowTotal)
+                {
+                    WorkSheet.Cells[Address._toRow, Address._fromCol, Address._toRow, Address._toCol].StyleName = value;
+                }
+            }
+        }
+        const string DATACELLSTYLE_PATH = "@dataCellStyle";
+        /// <summary>
+        /// Named style used for the data cells
+        /// </summary>
+        public string DataCellStyleName
+        {
+            get
+            {
+                return GetXmlNodeString(DATACELLSTYLE_PATH);
+            }
+            set
+            {
+                if (WorkSheet.Workbook.Styles.NamedStyles.FindIndexByID(value) < 0)
+                {
+                    throw (new Exception(string.Format("Named style {0} does not exist.", value)));
+                }
+                SetXmlNodeString(TopNode, DATACELLSTYLE_PATH, value, true);
+
+                int fromRow = Address._fromRow + (ShowHeader ? 1 : 0),
+                    toRow = Address._toRow - (ShowTotal ? 1 : 0);
+
+                if (fromRow < toRow)
+                {
+                    WorkSheet.Cells[fromRow, Address._fromCol, toRow, Address._toCol].StyleName = value;
+                }
+            }
+        }
+        const string HEADERROWCELLSTYLE_PATH = "@headerRowCellStyle";
+        /// <summary>
+        /// Named style used for the header row
+        /// </summary>
+        public string HeaderRowCellStyle
+        {
+            get
+            {
+                return GetXmlNodeString(HEADERROWCELLSTYLE_PATH);
+            }
+            set
+            {
+                if (WorkSheet.Workbook.Styles.NamedStyles.FindIndexByID(value) < 0)
+                {
+                    throw (new Exception(string.Format("Named style {0} does not exist.", value)));
+                }
+                SetXmlNodeString(TopNode, HEADERROWCELLSTYLE_PATH, value, true);
+
+                if (ShowHeader)
+                {
+                    WorkSheet.Cells[Address._fromRow, Address._fromCol, Address._fromRow, Address._toCol].StyleName = value;
+                }
+
+            }
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Table/ExcelTableCollection.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Table/ExcelTableCollection.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Table/ExcelTableCollection.cs	(revision 12707)
@@ -0,0 +1,178 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		Added		30-AUG-2010
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Xml;
+
+namespace OfficeOpenXml.Table
+{
+    /// <summary>
+    /// A collection of table objects
+    /// </summary>
+    public class ExcelTableCollection : IEnumerable<ExcelTable>
+    {
+        List<ExcelTable> _tables = new List<ExcelTable>();
+        internal Dictionary<string, int> _tableNames = new Dictionary<string, int>();
+        ExcelWorksheet _ws;        
+        internal ExcelTableCollection(ExcelWorksheet ws)
+        {
+            var pck = ws._package.Package;
+            _ws = ws;
+            foreach(XmlElement node in ws.WorksheetXml.SelectNodes("//d:tableParts/d:tablePart", ws.NameSpaceManager))
+            {
+                var rel = ws.Part.GetRelationship(node.GetAttribute("id",ExcelPackage.schemaRelationships));
+                var tbl = new ExcelTable(rel, ws);
+                if (tbl.Id + 1 > _ws.Workbook._nextTableID) _ws.Workbook._nextTableID = tbl.Id + 1;
+                _tableNames.Add(tbl.Name, _tables.Count);
+                _tables.Add(tbl);
+            }
+        }
+        private ExcelTable Add(ExcelTable tbl)
+        {
+            _tables.Add(tbl);
+            _tableNames.Add(tbl.Name, _tables.Count - 1);
+            if (tbl.Id >= _ws.Workbook._nextTableID)
+            {
+                _ws.Workbook._nextTableID = tbl.Id + 1;
+            }
+            return tbl;
+        }
+
+        /// <summary>
+        /// Create a table on the supplied range
+        /// </summary>
+        /// <param name="Range">The range address including header and total row</param>
+        /// <param name="Name">The name of the table. Must be unique </param>
+        /// <returns>The table object</returns>
+        public ExcelTable Add(ExcelAddressBase Range, string Name)
+        {
+            if (string.IsNullOrEmpty(Name))
+            {
+                Name = GetNewTableName();
+            }
+            else if (_ws.Workbook.ExistsTableName(Name))
+            {
+                throw (new ArgumentException("Tablename is not unique"));
+            }
+            foreach (var t in _tables)
+            {
+                if (t.Address.Collide(Range) != ExcelAddressBase.eAddressCollition.No)
+                {
+                    throw (new ArgumentException(string.Format("Table range collides with table {0}", t.Name)));
+                }
+            }
+            return Add(new ExcelTable(_ws, Range, Name, _ws.Workbook._nextTableID));
+        }
+
+        internal string GetNewTableName()
+        {
+            string name = "Table1";
+            int i = 2;
+            while (_ws.Workbook.ExistsTableName(name))
+            {
+                name = string.Format("Table{0}", i++);
+            }
+            return name;
+        }
+        /// <summary>
+        /// Number of items in the collection
+        /// </summary>
+        public int Count
+        {
+            get
+            {
+                return _tables.Count;
+            }
+        }
+        /// <summary>
+        /// Get the table object from a range.
+        /// </summary>
+        /// <param name="Range">The range</param>
+        /// <returns>The table. Null if no range matches</returns>
+        public ExcelTable GetFromRange(ExcelRangeBase Range)
+        {
+            foreach (var tbl in Range.Worksheet.Tables)
+            {
+                if (tbl.Address._address == Range._address)
+                {
+                    return tbl;
+                }
+            }
+            return null;
+        }
+        /// <summary>
+        /// The table Index. Base 0.
+        /// </summary>
+        /// <param name="Index"></param>
+        /// <returns></returns>
+        public ExcelTable this[int Index]
+        {
+            get
+            {
+                if (Index < 0 || Index >= _tables.Count)
+                {
+                    throw (new ArgumentOutOfRangeException("Table index out of range"));
+                }
+                return _tables[Index];
+            }
+        }
+        /// <summary>
+        /// Indexer
+        /// </summary>
+        /// <param name="Name">The name of the table</param>
+        /// <returns>The table. Null if the table name is not found in the collection</returns>
+        public ExcelTable this[string Name]
+        {
+            get
+            {
+                if (_tableNames.ContainsKey(Name))
+                {
+                    return _tables[_tableNames[Name]];
+                }
+                else
+                {
+                    return null;
+                }
+            }
+        }
+        public IEnumerator<ExcelTable> GetEnumerator()
+        {
+            return _tables.GetEnumerator();
+        }
+
+        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
+        {
+            return _tables.GetEnumerator();
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Table/ExcelTableColumn.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Table/ExcelTableColumn.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Table/ExcelTableColumn.cs	(revision 12707)
@@ -0,0 +1,234 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		Added		30-AUG-2010
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Text;
+using System.Xml;
+
+namespace OfficeOpenXml.Table
+{
+    /// <summary>
+    /// Build-in table row functions
+    /// </summary>
+    public enum RowFunctions
+    {
+        Average,        
+        Count,
+        CountNums,
+        Custom,
+        Max,
+        Min,
+        None,
+        StdDev,
+        Sum,
+        Var
+    }
+
+    /// <summary>
+    /// A table column
+    /// </summary>
+    public class ExcelTableColumn : XmlHelper
+    {
+        internal ExcelTable _tbl;
+        internal ExcelTableColumn(XmlNamespaceManager ns, XmlNode topNode, ExcelTable tbl, int pos) :
+            base(ns, topNode)
+        {
+            _tbl = tbl;
+            Position = pos;
+        }
+        /// <summary>
+        /// The column id
+        /// </summary>
+        public int Id 
+        {
+            get
+            {
+                return GetXmlNodeInt("@id");
+            }
+            set
+            {
+                SetXmlNodeString("@id", value.ToString());
+            }
+        }
+        /// <summary>
+        /// The position of the column
+        /// </summary>
+        public int Position
+        {
+            get;
+            private set;
+        }
+        /// <summary>
+        /// The name of the column
+        /// </summary>
+        public string Name
+        {
+            get
+            {
+                var n=GetXmlNodeString("@name");
+                if (string.IsNullOrEmpty(n))
+                {
+                    if (_tbl.ShowHeader)
+                    {
+                        n = _tbl.WorkSheet.GetValue<string>(_tbl.Address._fromRow, _tbl.Address._fromCol + this.Position);
+                    }
+                    else
+                    {
+                        n = "Column" + (this.Position+1).ToString();
+                    }
+                }
+                return n;
+            }
+            set
+            {
+                SetXmlNodeString("@name", value);
+                _tbl.WorkSheet.SetTableTotalFunction(_tbl, this);
+            }
+        }
+        /// <summary>
+        /// A string text in the total row
+        /// </summary>
+        public string TotalsRowLabel
+        {
+            get
+            {
+                return GetXmlNodeString("@totalsRowLabel");
+            }
+            set
+            {
+                SetXmlNodeString("@totalsRowLabel", value);
+            }
+        }
+        /// <summary>
+        /// Build-in total row functions.
+        /// To set a custom Total row formula use the TotalsRowFormula property
+        /// <seealso cref="TotalsRowFormula"/>
+        /// </summary>
+        public RowFunctions TotalsRowFunction
+        {
+            get
+            {
+                if (GetXmlNodeString("@totalsRowFunction") == "")
+                {
+                    return RowFunctions.None;
+                }
+                else
+                {
+                    return (RowFunctions)Enum.Parse(typeof(RowFunctions), GetXmlNodeString("@totalsRowFunction"), true);
+                }
+            }
+            set
+            {
+                if (value == RowFunctions.Custom)
+                {
+                    throw(new Exception("Use the TotalsRowFormula-property to set a custom table formula"));
+                }
+                string s = value.ToString();
+                s = s.Substring(0, 1).ToLower(CultureInfo.InvariantCulture) + s.Substring(1, s.Length - 1);
+                SetXmlNodeString("@totalsRowFunction", s);
+                _tbl.WorkSheet.SetTableTotalFunction(_tbl, this);
+            }
+        }
+        const string TOTALSROWFORMULA_PATH = "d:totalsRowFormula";
+        /// <summary>
+        /// Sets a custom Totals row Formula.
+        /// Be carefull with this property since it is not validated. 
+        /// <example>
+        /// tbl.Columns[9].TotalsRowFormula = string.Format("SUM([{0}])",tbl.Columns[9].Name);
+        /// </example>
+        /// </summary>
+        public string TotalsRowFormula
+        {
+            get
+            {
+                return GetXmlNodeString(TOTALSROWFORMULA_PATH);
+            }
+            set
+            {
+                if (value.StartsWith("=")) value = value.Substring(1, value.Length - 1);
+                SetXmlNodeString("@totalsRowFunction", "custom");                
+                SetXmlNodeString(TOTALSROWFORMULA_PATH, value);
+                _tbl.WorkSheet.SetTableTotalFunction(_tbl, this);
+            }
+        }
+        const string DATACELLSTYLE_PATH = "@dataCellStyle";
+        /// <summary>
+        /// The named style for datacells in the column
+        /// </summary>
+        public string DataCellStyleName
+        {
+            get
+            {
+                return GetXmlNodeString(DATACELLSTYLE_PATH);
+            }
+            set
+            {
+                if(_tbl.WorkSheet.Workbook.Styles.NamedStyles.FindIndexByID(value)<0)
+                {
+                    throw(new Exception(string.Format("Named style {0} does not exist.",value)));
+                }
+                SetXmlNodeString(TopNode, DATACELLSTYLE_PATH, value,true);
+               
+                int fromRow=_tbl.Address._fromRow + (_tbl.ShowHeader?1:0),
+                    toRow=_tbl.Address._toRow - (_tbl.ShowTotal?1:0),
+                    col=_tbl.Address._fromCol+Position;
+
+                if (fromRow < toRow)
+                {
+                    _tbl.WorkSheet.Cells[fromRow, col, toRow, col].StyleName = value;
+                }
+            }
+        }
+  		const string CALCULATEDCOLUMNFORMULA_PATH = "d:calculatedColumnFormula";
+ 		/// <summary>
+ 		/// Sets a calculated column Formula.
+ 		/// Be carefull with this property since it is not validated. 
+ 		/// <example>
+ 		/// tbl.Columns[9].CalculatedColumnFormula = string.Format("SUM(MyDataTable[[#This Row],[{0}]])",tbl.Columns[9].Name);
+ 		/// </example>
+ 		/// </summary>
+ 		public string CalculatedColumnFormula
+ 		{
+ 			get
+ 			{
+ 				return GetXmlNodeString(CALCULATEDCOLUMNFORMULA_PATH);
+ 			}
+ 			set
+ 			{
+ 				if (value.StartsWith("=")) value = value.Substring(1, value.Length - 1);
+ 				SetXmlNodeString(CALCULATEDCOLUMNFORMULA_PATH, value);
+ 			}
+ 		}
+
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Table/ExcelTableColumnCollection.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Table/ExcelTableColumnCollection.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Table/ExcelTableColumnCollection.cs	(revision 12707)
@@ -0,0 +1,135 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		Added		30-AUG-2010
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Text;
+using System.Xml;
+
+namespace OfficeOpenXml.Table
+{
+    /// <summary>
+    /// A collection of table columns
+    /// </summary>
+    public class ExcelTableColumnCollection : IEnumerable<ExcelTableColumn>
+    {
+        List<ExcelTableColumn> _cols = new List<ExcelTableColumn>();
+        Dictionary<string, int> _colNames = new Dictionary<string, int>(StringComparer.InvariantCultureIgnoreCase);
+        public ExcelTableColumnCollection(ExcelTable table)
+        {
+            Table = table;
+            foreach(XmlNode node in table.TableXml.SelectNodes("//d:table/d:tableColumns/d:tableColumn",table.NameSpaceManager))
+            {                
+                _cols.Add(new ExcelTableColumn(table.NameSpaceManager, node, table, _cols.Count));
+                _colNames.Add(_cols[_cols.Count - 1].Name, _cols.Count - 1);
+            }
+        }
+        /// <summary>
+        /// A reference to the table object
+        /// </summary>
+        public ExcelTable Table
+        {
+            get;
+            private set;
+        }
+        /// <summary>
+        /// Number of items in the collection
+        /// </summary>
+        public int Count
+        {
+            get
+            {
+                return _cols.Count;
+            }
+        }
+        /// <summary>
+        /// The column Index. Base 0.
+        /// </summary>
+        /// <param name="Index"></param>
+        /// <returns></returns>
+        public ExcelTableColumn this[int Index]
+        {
+            get
+            {
+                if (Index < 0 || Index >= _cols.Count)
+                {
+                    throw (new ArgumentOutOfRangeException("Column index out of range"));
+                }
+                return _cols[Index] as ExcelTableColumn;
+            }
+        }
+        /// <summary>
+        /// Indexer
+        /// </summary>
+        /// <param name="Name">The name of the table</param>
+        /// <returns>The table column. Null if the table name is not found in the collection</returns>
+        public ExcelTableColumn this[string Name]
+        {
+            get
+            {
+                if (_colNames.ContainsKey(Name))
+                {
+                    return _cols[_colNames[Name]];
+                }
+                else
+                {
+                    return null;
+                }
+            }
+        }
+
+        IEnumerator<ExcelTableColumn> IEnumerable<ExcelTableColumn>.GetEnumerator()
+        {
+            return _cols.GetEnumerator();
+        }
+
+        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
+        {
+            return _cols.GetEnumerator();
+        }
+        internal string GetUniqueName(string name)
+        {            
+            if (_colNames.ContainsKey(name))
+            {
+                var newName = name;
+                var i = 2;
+                do
+                {
+                    newName = name+(i++).ToString(CultureInfo.InvariantCulture);
+                }
+                while (_colNames.ContainsKey(newName));
+                return newName;
+            }
+            return name;
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Table/PivotTable/ExcelPivotCacheDefinition.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Table/PivotTable/ExcelPivotCacheDefinition.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Table/PivotTable/ExcelPivotCacheDefinition.cs	(revision 12707)
@@ -0,0 +1,264 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		Added		21-MAR-2011
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Xml;
+using System.Linq;
+using OfficeOpenXml.Utils;
+namespace OfficeOpenXml.Table.PivotTable
+{
+    public enum eSourceType
+    {
+        /// <summary>
+        /// Indicates that the cache contains data that consolidates ranges.
+        /// </summary>
+        Consolidation,
+        /// <summary>
+        /// Indicates that the cache contains data from an external data source.
+        /// </summary>
+        External,
+        /// <summary>
+        /// Indicates that the cache contains a scenario summary report
+        /// </summary>
+        Scenario,
+        /// <summary>
+        /// Indicates that the cache contains worksheet data
+        /// </summary>
+        Worksheet
+    }
+    /// <summary>
+    /// Cache definition. This class defines the source data. Note that one cache definition can be shared between many pivot tables.
+    /// </summary>
+    public class ExcelPivotCacheDefinition : XmlHelper
+    {
+        internal ExcelPivotCacheDefinition(XmlNamespaceManager ns, ExcelPivotTable pivotTable) :
+            base(ns, null)
+        {
+            foreach (var r in pivotTable.Part.GetRelationshipsByType(ExcelPackage.schemaRelationships + "/pivotCacheDefinition"))
+            {
+                Relationship = r;
+            }
+            CacheDefinitionUri = UriHelper.ResolvePartUri(Relationship.SourceUri, Relationship.TargetUri);
+
+            var pck = pivotTable.WorkSheet._package.Package;
+            Part = pck.GetPart(CacheDefinitionUri);
+            CacheDefinitionXml = new XmlDocument();
+            LoadXmlSafe(CacheDefinitionXml, Part.GetStream());
+
+            TopNode = CacheDefinitionXml.DocumentElement;
+            PivotTable = pivotTable;
+            if (CacheSource == eSourceType.Worksheet)
+            {
+                var worksheetName = GetXmlNodeString(_sourceWorksheetPath);
+                if (pivotTable.WorkSheet.Workbook.Worksheets.Any(t => t.Name == worksheetName))
+                {
+                    _sourceRange = pivotTable.WorkSheet.Workbook.Worksheets[worksheetName].Cells[GetXmlNodeString(_sourceAddressPath)];
+                }
+            }
+        }
+        internal ExcelPivotCacheDefinition(XmlNamespaceManager ns, ExcelPivotTable pivotTable, ExcelRangeBase sourceAddress, int tblId) :
+            base(ns, null)
+        {
+            PivotTable = pivotTable;
+
+            var pck = pivotTable.WorkSheet._package.Package;
+            
+            //CacheDefinition
+            CacheDefinitionXml = new XmlDocument();
+            LoadXmlSafe(CacheDefinitionXml, GetStartXml(sourceAddress), Encoding.UTF8);
+            CacheDefinitionUri = GetNewUri(pck, "/xl/pivotCache/pivotCacheDefinition{0}.xml", tblId); 
+            Part = pck.CreatePart(CacheDefinitionUri, ExcelPackage.schemaPivotCacheDefinition);
+            TopNode = CacheDefinitionXml.DocumentElement;
+
+            //CacheRecord. Create an empty one.
+            CacheRecordUri = GetNewUri(pck, "/xl/pivotCache/pivotCacheRecords{0}.xml", tblId); 
+            var cacheRecord = new XmlDocument();
+            cacheRecord.LoadXml("<pivotCacheRecords xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" count=\"0\" />");
+            var recPart = pck.CreatePart(CacheRecordUri, ExcelPackage.schemaPivotCacheRecords);
+            cacheRecord.Save(recPart.GetStream());
+
+            RecordRelationship = Part.CreateRelationship(UriHelper.ResolvePartUri(CacheDefinitionUri, CacheRecordUri), Packaging.TargetMode.Internal, ExcelPackage.schemaRelationships + "/pivotCacheRecords");
+            RecordRelationshipID = RecordRelationship.Id;
+
+            CacheDefinitionXml.Save(Part.GetStream());
+        }        
+        /// <summary>
+        /// Reference to the internal package part
+        /// </summary>
+        internal Packaging.ZipPackagePart Part
+        {
+            get;
+            set;
+        }
+        /// <summary>
+        /// Provides access to the XML data representing the cache definition in the package.
+        /// </summary>
+        public XmlDocument CacheDefinitionXml { get; private set; }
+        /// <summary>
+        /// The package internal URI to the pivottable cache definition Xml Document.
+        /// </summary>
+        public Uri CacheDefinitionUri
+        {
+            get;
+            internal set;
+        }
+        internal Uri CacheRecordUri
+        {
+            get;
+            set;
+        }
+        internal Packaging.ZipPackageRelationship Relationship
+        {
+            get;
+            set;
+        }
+        internal Packaging.ZipPackageRelationship RecordRelationship
+        {
+            get;
+            set;
+        }
+        internal string RecordRelationshipID 
+        {
+            get
+            {
+                return GetXmlNodeString("@r:id");
+            }
+            set
+            {
+                SetXmlNodeString("@r:id", value);
+            }
+        }
+        /// <summary>
+        /// Referece to the PivoTable object
+        /// </summary>
+        public ExcelPivotTable PivotTable
+        {
+            get;
+            private set;
+        }
+        
+        const string _sourceWorksheetPath="d:cacheSource/d:worksheetSource/@sheet";
+        const string _sourceAddressPath = "d:cacheSource/d:worksheetSource/@ref";
+        internal ExcelRangeBase _sourceRange = null;
+        /// <summary>
+        /// The source data range when the pivottable has a worksheet datasource. 
+        /// The number of columns in the range must be intact if this property is changed.
+        /// The range must be in the same workbook as the pivottable.
+        /// </summary>
+        public ExcelRangeBase SourceRange
+        {
+            get
+            {
+                if (_sourceRange == null)
+                {
+                    if (CacheSource == eSourceType.Worksheet)
+                    {
+                        var ws = PivotTable.WorkSheet.Workbook.Worksheets[GetXmlNodeString(_sourceWorksheetPath)];
+                        if (ws != null)
+                        {
+                            _sourceRange = ws.Cells[GetXmlNodeString(_sourceAddressPath)];
+                        }
+                    }
+                    else
+                    {
+                        throw (new ArgumentException("The cachesource is not a worksheet"));
+                    }
+                }
+                return _sourceRange;
+            }
+            set
+            {
+                if (PivotTable.WorkSheet.Workbook != value.Worksheet.Workbook)
+                {
+                    throw (new ArgumentException("Range must be in the same package as the pivottable"));
+                }
+
+                var sr=SourceRange;
+                if (value.End.Column - value.Start.Column != sr.End.Column - sr.Start.Column)
+                {
+                    throw (new ArgumentException("Can not change the number of columns(fields) in the SourceRange"));
+                }
+
+                SetXmlNodeString(_sourceWorksheetPath, value.Worksheet.Name);
+                SetXmlNodeString(_sourceAddressPath, value.FirstAddress);
+                _sourceRange = value;
+            }
+        }
+        /// <summary>
+        /// Type of source data
+        /// </summary>
+        public eSourceType CacheSource
+        {
+            get
+            {
+                var s=GetXmlNodeString("d:cacheSource/@type");
+                if (s == "")
+                {
+                    return eSourceType.Worksheet;
+                }
+                else
+                {
+                    return (eSourceType)Enum.Parse(typeof(eSourceType), s, true);
+                }
+            }
+        }
+        private string GetStartXml(ExcelRangeBase sourceAddress)
+        {
+            string xml="<pivotCacheDefinition xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" r:id=\"\" refreshOnLoad=\"1\" refreshedBy=\"SomeUser\" refreshedDate=\"40504.582403125001\" createdVersion=\"1\" refreshedVersion=\"3\" recordCount=\"5\" upgradeOnRefresh=\"1\">";
+
+            xml += "<cacheSource type=\"worksheet\">";
+            xml += string.Format("<worksheetSource ref=\"{0}\" sheet=\"{1}\" /> ", sourceAddress.Address, sourceAddress.WorkSheet);
+            xml += "</cacheSource>";
+            xml += string.Format("<cacheFields count=\"{0}\">", sourceAddress._toCol - sourceAddress._fromCol + 1);
+            var sourceWorksheet = PivotTable.WorkSheet.Workbook.Worksheets[sourceAddress.WorkSheet];
+            for (int col = sourceAddress._fromCol; col <= sourceAddress._toCol; col++)
+            {
+                if (sourceWorksheet == null || sourceWorksheet._values.GetValue(sourceAddress._fromRow, col) == null || sourceWorksheet._values.GetValue(sourceAddress._fromRow, col).ToString().Trim() == "")
+                {
+                    xml += string.Format("<cacheField name=\"Column{0}\" numFmtId=\"0\">", col - sourceAddress._fromCol + 1);
+                }
+                else
+                {
+                    xml += string.Format("<cacheField name=\"{0}\" numFmtId=\"0\">", sourceWorksheet._values.GetValue(sourceAddress._fromRow, col));
+                }
+                //xml += "<sharedItems containsNonDate=\"0\" containsString=\"0\" containsBlank=\"1\" /> ";
+                xml += "<sharedItems containsBlank=\"1\" /> ";
+                xml += "</cacheField>";
+            }
+            xml += "</cacheFields>";
+            xml += "</pivotCacheDefinition>";
+
+            return xml;
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Table/PivotTable/ExcelPivotTable.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Table/PivotTable/ExcelPivotTable.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Table/PivotTable/ExcelPivotTable.cs	(revision 12707)
@@ -0,0 +1,946 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		Added		21-MAR-2011
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Xml;
+using System.Text.RegularExpressions;
+using OfficeOpenXml.Table;
+using OfficeOpenXml.Utils;
+
+namespace OfficeOpenXml.Table.PivotTable
+{
+    /// <summary>
+    /// An Excel Pivottable
+    /// </summary>
+    public class ExcelPivotTable : XmlHelper
+    {
+        internal ExcelPivotTable(Packaging.ZipPackageRelationship rel, ExcelWorksheet sheet) : 
+            base(sheet.NameSpaceManager)
+        {
+            WorkSheet = sheet;
+            PivotTableUri = UriHelper.ResolvePartUri(rel.SourceUri, rel.TargetUri);
+            Relationship = rel;
+            var pck = sheet._package.Package;
+            Part=pck.GetPart(PivotTableUri);
+
+            PivotTableXml = new XmlDocument();
+            LoadXmlSafe(PivotTableXml, Part.GetStream());
+            init();
+            TopNode = PivotTableXml.DocumentElement;
+            Address = new ExcelAddressBase(GetXmlNodeString("d:location/@ref"));
+
+            _cacheDefinition = new ExcelPivotCacheDefinition(sheet.NameSpaceManager, this);
+            LoadFields();
+
+            //Add row fields.
+            foreach (XmlElement rowElem in TopNode.SelectNodes("d:rowFields/d:field", NameSpaceManager))
+            {
+                int x;
+                if (int.TryParse(rowElem.GetAttribute("x"), out x) && x >= 0)
+                {
+                    RowFields.AddInternal(Fields[x]);
+                }
+                else
+                {
+                    rowElem.ParentNode.RemoveChild(rowElem);
+                }
+            }
+
+            ////Add column fields.
+            foreach (XmlElement colElem in TopNode.SelectNodes("d:colFields/d:field", NameSpaceManager))
+            {
+                int x;
+                if(int.TryParse(colElem.GetAttribute("x"),out x) && x >= 0)
+                {
+                    ColumnFields.AddInternal(Fields[x]);
+                }
+                else
+                {
+                    colElem.ParentNode.RemoveChild(colElem);
+                }
+            }
+
+            //Add Page elements
+            //int index = 0;
+            foreach (XmlElement pageElem in TopNode.SelectNodes("d:pageFields/d:pageField", NameSpaceManager))
+            {
+                int fld;
+                if (int.TryParse(pageElem.GetAttribute("fld"), out fld) && fld >= 0)
+                {
+                    var field = Fields[fld];
+                    field._pageFieldSettings = new ExcelPivotTablePageFieldSettings(NameSpaceManager, pageElem, field, fld);
+                    PageFields.AddInternal(field);
+                }
+            }
+
+            //Add data elements
+            //index = 0;
+            foreach (XmlElement dataElem in TopNode.SelectNodes("d:dataFields/d:dataField", NameSpaceManager))
+            {
+                int fld;
+                if (int.TryParse(dataElem.GetAttribute("fld"), out fld) && fld >= 0)
+                {
+                    var field = Fields[fld];
+                    var dataField = new ExcelPivotTableDataField(NameSpaceManager, dataElem, field);
+                    DataFields.AddInternal(dataField);
+                }
+            }
+        }
+        /// <summary>
+        /// Add a new pivottable
+        /// </summary>
+        /// <param name="sheet">The worksheet</param>
+        /// <param name="address">the address of the pivottable</param>
+        /// <param name="sourceAddress">The address of the Source data</param>
+        /// <param name="name"></param>
+        /// <param name="tblId"></param>
+        internal ExcelPivotTable(ExcelWorksheet sheet, ExcelAddressBase address,ExcelRangeBase sourceAddress, string name, int tblId) : 
+            base(sheet.NameSpaceManager)
+	    {
+            WorkSheet = sheet;
+            Address = address;
+            var pck = sheet._package.Package;
+
+            PivotTableXml = new XmlDocument();
+            LoadXmlSafe(PivotTableXml, GetStartXml(name, tblId, address, sourceAddress), Encoding.UTF8);
+            TopNode = PivotTableXml.DocumentElement;
+            PivotTableUri =  GetNewUri(pck, "/xl/pivotTables/pivotTable{0}.xml", tblId);
+            init();
+
+            Part = pck.CreatePart(PivotTableUri, ExcelPackage.schemaPivotTable);
+            PivotTableXml.Save(Part.GetStream());
+            
+            //Worksheet-Pivottable relationship
+            Relationship = sheet.Part.CreateRelationship(UriHelper.ResolvePartUri(sheet.WorksheetUri, PivotTableUri), Packaging.TargetMode.Internal, ExcelPackage.schemaRelationships + "/pivotTable");
+
+            _cacheDefinition = new ExcelPivotCacheDefinition(sheet.NameSpaceManager, this, sourceAddress, tblId);
+            _cacheDefinition.Relationship=Part.CreateRelationship(UriHelper.ResolvePartUri(PivotTableUri, _cacheDefinition.CacheDefinitionUri), Packaging.TargetMode.Internal, ExcelPackage.schemaRelationships + "/pivotCacheDefinition");
+
+            sheet.Workbook.AddPivotTable(CacheID.ToString(), _cacheDefinition.CacheDefinitionUri);
+
+            LoadFields();
+
+            sheet.Cells[address.Address].Clear();
+        }
+        private void init()
+        {
+            SchemaNodeOrder = new string[] { "location", "pivotFields", "rowFields", "rowItems", "colFields", "colItems", "pageFields", "pageItems", "dataFields", "dataItems", "formats", "pivotTableStyleInfo" };
+        }
+        private void LoadFields()
+        {
+            //Fields.Clear();
+            //int ix=0;
+            //foreach(XmlElement fieldNode in PivotXml.SelectNodes("//d:pivotFields/d:pivotField",NameSpaceManager))
+            //{
+            //    Fields.AddInternal(new ExcelPivotTableField(NameSpaceManager, fieldNode, this, ix++));
+            //}
+
+            int index = 0;
+            //Add fields.
+            foreach (XmlElement fieldElem in TopNode.SelectNodes("d:pivotFields/d:pivotField", NameSpaceManager))
+            {
+                var fld = new ExcelPivotTableField(NameSpaceManager, fieldElem, this, index, index++);
+                Fields.AddInternal(fld);
+            }
+
+            //Add fields.
+            index = 0;
+            foreach (XmlElement fieldElem in _cacheDefinition.TopNode.SelectNodes("d:cacheFields/d:cacheField", NameSpaceManager))
+            {
+                var fld = Fields[index++];
+                fld.SetCacheFieldNode(fieldElem);
+            }
+
+
+        }
+        private string GetStartXml(string name, int id, ExcelAddressBase address, ExcelAddressBase sourceAddress)
+        {
+            string xml = string.Format("<pivotTableDefinition xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" name=\"{0}\" cacheId=\"{1}\" dataOnRows=\"1\" applyNumberFormats=\"0\" applyBorderFormats=\"0\" applyFontFormats=\"0\" applyPatternFormats=\"0\" applyAlignmentFormats=\"0\" applyWidthHeightFormats=\"1\" dataCaption=\"Data\"  createdVersion=\"4\" showMemberPropertyTips=\"0\" useAutoFormatting=\"1\" itemPrintTitles=\"1\" indent=\"0\" compact=\"0\" compactData=\"0\" gridDropZones=\"1\">", name, id);
+
+            xml += string.Format("<location ref=\"{0}\" firstHeaderRow=\"1\" firstDataRow=\"1\" firstDataCol=\"1\" /> ", address.FirstAddress);
+            xml += string.Format("<pivotFields count=\"{0}\">", sourceAddress._toCol-sourceAddress._fromCol+1);
+            for (int col = sourceAddress._fromCol; col <= sourceAddress._toCol; col++)
+            {
+                xml += "<pivotField showAll=\"0\" />"; //compact=\"0\" outline=\"0\" subtotalTop=\"0\" includeNewItemsInFilter=\"1\"     
+            }
+
+            xml += "</pivotFields>";
+            xml += "<pivotTableStyleInfo name=\"PivotStyleMedium9\" showRowHeaders=\"1\" showColHeaders=\"1\" showRowStripes=\"0\" showColStripes=\"0\" showLastColumn=\"1\" />";
+            xml += "</pivotTableDefinition>";
+            return xml;
+        }
+        internal Packaging.ZipPackagePart Part
+        {
+            get;
+            set;
+        }
+        /// <summary>
+        /// Provides access to the XML data representing the pivottable in the package.
+        /// </summary>
+        public XmlDocument PivotTableXml { get; private set; }
+        /// <summary>
+        /// The package internal URI to the pivottable Xml Document.
+        /// </summary>
+        public Uri PivotTableUri
+        {
+            get;
+            internal set;
+        }
+        internal Packaging.ZipPackageRelationship Relationship
+        {
+            get;
+            set;
+        }
+        const string ID_PATH = "@id";
+        internal int Id
+        {
+            get
+            {
+                return GetXmlNodeInt(ID_PATH);
+            }
+            set
+            {
+                SetXmlNodeString(ID_PATH, value.ToString());
+            }
+        }
+        const string NAME_PATH = "@name";
+        const string DISPLAY_NAME_PATH = "@displayName";
+        /// <summary>
+        /// Name of the pivottable object in Excel
+        /// </summary>
+        public string Name
+        {
+            get
+            {
+                return GetXmlNodeString(NAME_PATH);
+            }
+            set
+            {
+                if (WorkSheet.Workbook.ExistsTableName(value))
+                {
+                    throw (new ArgumentException("PivotTable name is not unique"));
+                }
+                string prevName = Name;
+                if (WorkSheet.Tables._tableNames.ContainsKey(prevName))
+                {
+                    int ix = WorkSheet.Tables._tableNames[prevName];
+                    WorkSheet.Tables._tableNames.Remove(prevName);
+                    WorkSheet.Tables._tableNames.Add(value, ix);
+                }
+                SetXmlNodeString(NAME_PATH, value);
+                SetXmlNodeString(DISPLAY_NAME_PATH, cleanDisplayName(value));
+            }
+        }        
+        ExcelPivotCacheDefinition _cacheDefinition = null;
+        /// <summary>
+        /// Reference to the pivot table cache definition object
+        /// </summary>
+        public ExcelPivotCacheDefinition CacheDefinition
+        {
+            get
+            {
+                if (_cacheDefinition == null)
+                {
+                    _cacheDefinition = new ExcelPivotCacheDefinition(NameSpaceManager, this, null, 1);
+                }
+                return _cacheDefinition;
+            }
+        }
+        private string cleanDisplayName(string name)
+        {
+            return Regex.Replace(name, @"[^\w\.-_]", "_");
+        }
+        #region "Public Properties"
+
+        /// <summary>
+        /// The worksheet where the pivottable is located
+        /// </summary>
+        public ExcelWorksheet WorkSheet
+        {
+            get;
+            set;
+        }
+        /// <summary>
+        /// The location of the pivot table
+        /// </summary>
+        public ExcelAddressBase Address
+        {
+            get;
+            internal set;
+        }
+        /// <summary>
+        /// If multiple datafields are displayed in the row area or the column area
+        /// </summary>
+        public bool DataOnRows 
+        { 
+            get
+            {
+                return GetXmlNodeBool("@dataOnRows");
+            }
+            set
+            {
+                SetXmlNodeBool("@dataOnRows",value);
+            }
+        }
+        /// <summary>
+        /// if true apply legacy table autoformat number format properties.
+        /// </summary>
+        public bool ApplyNumberFormats 
+        { 
+            get
+            {
+                return GetXmlNodeBool("@applyNumberFormats");
+            }
+            set
+            {
+                SetXmlNodeBool("@applyNumberFormats",value);
+            }
+        }
+        /// <summary>
+        /// If true apply legacy table autoformat border properties
+        /// </summary>
+        public bool ApplyBorderFormats 
+        { 
+            get
+            {
+                return GetXmlNodeBool("@applyBorderFormats");
+            }
+            set
+            {
+                SetXmlNodeBool("@applyBorderFormats",value);
+            }
+        }
+        /// <summary>
+        /// If true apply legacy table autoformat font properties
+        /// </summary>
+        public bool ApplyFontFormats
+        { 
+            get
+            {
+                return GetXmlNodeBool("@applyFontFormats");
+            }
+            set
+            {
+                SetXmlNodeBool("@applyFontFormats",value);
+            }
+        }
+        /// <summary>
+        /// If true apply legacy table autoformat pattern properties
+        /// </summary>
+        public bool ApplyPatternFormats
+        { 
+            get
+            {
+                return GetXmlNodeBool("@applyPatternFormats");
+            }
+            set
+            {
+                SetXmlNodeBool("@applyPatternFormats",value);
+            }
+        }
+        /// <summary>
+        /// If true apply legacy table autoformat width/height properties.
+        /// </summary>
+        public bool ApplyWidthHeightFormats
+        { 
+            get
+            {
+                return GetXmlNodeBool("@applyWidthHeightFormats");
+            }
+            set
+            {
+                SetXmlNodeBool("@applyWidthHeightFormats",value);
+            }
+        }
+        /// <summary>
+        /// Show member property information
+        /// </summary>
+        public bool ShowMemberPropertyTips
+        { 
+            get
+            {
+                return GetXmlNodeBool("@showMemberPropertyTips");
+            }
+            set
+            {
+                SetXmlNodeBool("@showMemberPropertyTips",value);
+            }
+        }
+        /// <summary>
+        /// Show the drill indicators
+        /// </summary>
+        public bool ShowCalcMember
+        {
+            get
+            {
+                return GetXmlNodeBool("@showCalcMbrs");
+            }
+            set
+            {
+                SetXmlNodeBool("@showCalcMbrs", value);
+            }
+        }       
+        /// <summary>
+        /// If the user is prevented from drilling down on a PivotItem or aggregate value
+        /// </summary>
+        public bool EnableDrill
+        {
+            get
+            {
+                return GetXmlNodeBool("@enableDrill", true);
+            }
+            set
+            {
+                SetXmlNodeBool("@enableDrill", value);
+            }
+        }
+        /// <summary>
+        /// Show the drill down buttons
+        /// </summary>
+        public bool ShowDrill
+        {
+            get
+            {
+                return GetXmlNodeBool("@showDrill", true);
+            }
+            set
+            {
+                SetXmlNodeBool("@showDrill", value);
+            }
+        }
+        /// <summary>
+        /// If the tooltips should be displayed for PivotTable data cells.
+        /// </summary>
+        public bool ShowDataTips
+        {
+            get
+            {
+                return GetXmlNodeBool("@showDataTips", true);
+            }
+            set
+            {
+                SetXmlNodeBool("@showDataTips", value, true);
+            }
+        }
+        /// <summary>
+        /// If the row and column titles from the PivotTable should be printed.
+        /// </summary>
+        public bool FieldPrintTitles
+        {
+            get
+            {
+                return GetXmlNodeBool("@fieldPrintTitles");
+            }
+            set
+            {
+                SetXmlNodeBool("@fieldPrintTitles", value);
+            }
+        }
+        /// <summary>
+        /// If the row and column titles from the PivotTable should be printed.
+        /// </summary>
+        public bool ItemPrintTitles
+        {
+            get
+            {
+                return GetXmlNodeBool("@itemPrintTitles");
+            }
+            set
+            {
+                SetXmlNodeBool("@itemPrintTitles", value);
+            }
+        }
+        /// <summary>
+        /// If the grand totals should be displayed for the PivotTable columns
+        /// </summary>
+        public bool ColumGrandTotals
+        {
+            get
+            {
+                return GetXmlNodeBool("@colGrandTotals");
+            }
+            set
+            {
+                SetXmlNodeBool("@colGrandTotals", value);
+            }
+        }        
+        /// <summary>
+        /// If the grand totals should be displayed for the PivotTable rows
+        /// </summary>
+        public bool RowGrandTotals
+        {
+            get
+            {
+                return GetXmlNodeBool("@rowGrandTotals");
+            }
+            set
+            {
+                SetXmlNodeBool("@rowGrandTotals", value);
+            }
+        }        
+        /// <summary>
+        /// If the drill indicators expand collapse buttons should be printed.
+        /// </summary>
+        public bool PrintDrill
+        {
+            get
+            {
+                return GetXmlNodeBool("@printDrill");
+            }
+            set
+            {
+                SetXmlNodeBool("@printDrill", value);
+            }
+        }        
+        /// <summary>
+        /// Indicates whether to show error messages in cells.
+        /// </summary>
+        public bool ShowError
+        {
+            get
+            {
+                return GetXmlNodeBool("@showError");
+            }
+            set
+            {
+                SetXmlNodeBool("@showError", value);
+            }
+        }        
+        /// <summary>
+        /// The string to be displayed in cells that contain errors.
+        /// </summary>
+        public string ErrorCaption
+        {
+            get
+            {
+                return GetXmlNodeString("@errorCaption");
+            }
+            set
+            {
+                SetXmlNodeString("@errorCaption", value);
+            }
+        }        
+        /// <summary>
+        /// Specifies the name of the value area field header in the PivotTable. 
+        /// This caption is shown when the PivotTable when two or more fields are in the values area.
+        /// </summary>
+        public string DataCaption
+        {
+            get
+            {
+                return GetXmlNodeString("@dataCaption");
+            }
+            set
+            {
+                SetXmlNodeString("@dataCaption", value);
+            }
+        }        
+        /// <summary>
+        /// Show field headers
+        /// </summary>
+        public bool ShowHeaders
+        {
+            get
+            {
+                return GetXmlNodeBool("@showHeaders");
+            }
+            set
+            {
+                SetXmlNodeBool("@showHeaders", value);
+            }
+        }
+        /// <summary>
+        /// The number of page fields to display before starting another row or column
+        /// </summary>
+        public int PageWrap
+        {
+            get
+            {
+                return GetXmlNodeInt("@pageWrap");
+            }
+            set
+            {
+                if(value<0)
+                {
+                    throw new Exception("Value can't be negative");
+                }
+                SetXmlNodeString("@pageWrap", value.ToString());
+            }
+        }
+        /// <summary>
+        /// A boolean that indicates whether legacy auto formatting has been applied to the PivotTable view
+        /// </summary>
+        public bool UseAutoFormatting
+        { 
+            get
+            {
+                return GetXmlNodeBool("@useAutoFormatting");
+            }
+            set
+            {
+                SetXmlNodeBool("@useAutoFormatting",value);
+            }
+        } 
+        /// <summary>
+        /// A boolean that indicates whether the in-grid drop zones should be displayed at runtime, and whether classic layout is applied
+        /// </summary>
+        public bool GridDropZones
+        { 
+            get
+            {
+                return GetXmlNodeBool("@gridDropZones");
+            }
+            set
+            {
+                SetXmlNodeBool("@gridDropZones",value);
+            }
+        }
+        /// <summary>
+        /// Specifies the indentation increment for compact axis and can be used to set the Report Layout to Compact Form
+        /// </summary>
+        public int Indent
+        { 
+            get
+            {
+                return GetXmlNodeInt("@indent");
+            }
+            set
+            {
+                SetXmlNodeString("@indent",value.ToString());
+            }
+        }
+        /// <summary>
+        /// A boolean that indicates whether data fields in the PivotTable should be displayed in outline form
+        /// </summary>
+        public bool OutlineData
+        {
+            get
+            {
+                return GetXmlNodeBool("@outlineData");
+            }
+            set
+            {
+                SetXmlNodeBool("@outlineData", value);
+            }
+        }
+        /// <summary>
+        /// a boolean that indicates whether new fields should have their outline flag set to true
+        /// </summary>
+        public bool Outline
+        {
+            get
+            {
+                return GetXmlNodeBool("@outline");
+            }
+            set
+            {
+                SetXmlNodeBool("@outline", value);
+            }
+        }
+        /// <summary>
+        /// A boolean that indicates whether the fields of a PivotTable can have multiple filters set on them
+        /// </summary>
+        public bool MultipleFieldFilters
+        {
+            get
+            {
+                return GetXmlNodeBool("@multipleFieldFilters");
+            }
+            set
+            {
+                SetXmlNodeBool("@multipleFieldFilters", value);
+            }
+        }
+        /// <summary>
+        /// A boolean that indicates whether new fields should have their compact flag set to true
+        /// </summary>
+        public bool Compact
+        { 
+            get
+            {
+                return GetXmlNodeBool("@compact");
+            }
+            set
+            {
+                SetXmlNodeBool("@compact",value);
+            }
+        }        
+        /// <summary>
+        /// A boolean that indicates whether the field next to the data field in the PivotTable should be displayed in the same column of the spreadsheet
+        /// </summary>
+        public bool CompactData
+        { 
+            get
+            {
+                return GetXmlNodeBool("@compactData");
+            }
+            set
+            {
+                SetXmlNodeBool("@compactData",value);
+            }
+        }
+        /// <summary>
+        /// Specifies the string to be displayed for grand totals.
+        /// </summary>
+        public string GrandTotalCaption
+        {
+            get
+            {
+                return GetXmlNodeString("@grandTotalCaption");
+            }
+            set
+            {
+                SetXmlNodeString("@grandTotalCaption", value);
+            }
+        }
+        /// <summary>
+        /// Specifies the string to be displayed in row header in compact mode.
+        /// </summary>
+        public string RowHeaderCaption 
+        {
+            get
+            {
+                return GetXmlNodeString("@rowHeaderCaption");
+            }
+            set
+            {
+                SetXmlNodeString("@rowHeaderCaption", value);                
+            }
+        }
+        /// <summary>
+        /// Specifies the string to be displayed in cells with no value
+        /// </summary>
+        public string MissingCaption
+        {
+            get
+            {
+                return GetXmlNodeString("@missingCaption");
+            }
+            set
+            {
+                SetXmlNodeString("@missingCaption", value);                
+            }
+        }
+        const string FIRSTHEADERROW_PATH="d:location/@firstHeaderRow";
+        /// <summary>
+        /// Specifies the first row of the PivotTable header, relative to the top left cell in the ref value
+        /// </summary>
+        public int FirstHeaderRow
+        {
+            get
+            {
+                return GetXmlNodeInt(FIRSTHEADERROW_PATH);
+            }
+            set
+            {
+                SetXmlNodeString(FIRSTHEADERROW_PATH, value.ToString());
+            }
+        }
+        const string FIRSTDATAROW_PATH = "d:location/@firstDataRow";
+        /// <summary>
+        /// Specifies the first column of the PivotTable data, relative to the top left cell in the ref value
+        /// </summary>
+        public int FirstDataRow
+        {
+            get
+            {
+                return GetXmlNodeInt(FIRSTDATAROW_PATH);
+            }
+            set
+            {
+                SetXmlNodeString(FIRSTDATAROW_PATH, value.ToString());
+            }
+        }
+        const string FIRSTDATACOL_PATH = "d:location/@firstDataCol";
+        /// <summary>
+        /// Specifies the first column of the PivotTable data, relative to the top left cell in the ref value
+        /// </summary>
+        public int FirstDataCol
+        {
+            get
+            {
+                return GetXmlNodeInt(FIRSTDATACOL_PATH);
+            }
+            set
+            {
+                SetXmlNodeString(FIRSTDATACOL_PATH, value.ToString());
+            }
+        }
+        ExcelPivotTableFieldCollection _fields = null;
+        /// <summary>
+        /// The fields in the table 
+        /// </summary>
+        public ExcelPivotTableFieldCollection Fields
+        {
+            get
+            {
+                if (_fields == null)
+                {
+                    _fields = new ExcelPivotTableFieldCollection(this, "");
+                }
+                return _fields;
+            }
+        }
+        ExcelPivotTableRowColumnFieldCollection _rowFields = null;
+        /// <summary>
+        /// Row label fields 
+        /// </summary>
+        public ExcelPivotTableRowColumnFieldCollection RowFields
+        {
+            get
+            {
+                if (_rowFields == null)
+                {
+                    _rowFields = new ExcelPivotTableRowColumnFieldCollection(this, "rowFields");
+                }
+                return _rowFields;
+            }
+        }
+        ExcelPivotTableRowColumnFieldCollection _columnFields = null;
+        /// <summary>
+        /// Column label fields 
+        /// </summary>
+        public ExcelPivotTableRowColumnFieldCollection ColumnFields
+        {
+            get
+            {
+                if (_columnFields == null)
+                {
+                    _columnFields = new ExcelPivotTableRowColumnFieldCollection(this, "colFields");
+                }
+                return _columnFields;
+            }
+        }
+        ExcelPivotTableDataFieldCollection _dataFields = null;
+        /// <summary>
+        /// Value fields 
+        /// </summary>
+        public ExcelPivotTableDataFieldCollection DataFields
+        {
+            get
+            {
+                if (_dataFields == null)
+                {
+                    _dataFields = new ExcelPivotTableDataFieldCollection(this);
+                }
+                return _dataFields;
+            }
+        }
+        ExcelPivotTableRowColumnFieldCollection _pageFields = null;
+        /// <summary>
+        /// Report filter fields
+        /// </summary>
+        public ExcelPivotTableRowColumnFieldCollection PageFields
+        {
+            get
+            {
+                if (_pageFields == null)
+                {
+                    _pageFields = new ExcelPivotTableRowColumnFieldCollection(this, "pageFields");
+                }
+                return _pageFields;
+            }
+        }
+        const string STYLENAME_PATH = "d:pivotTableStyleInfo/@name";
+        /// <summary>
+        /// Pivot style name. Used for custom styles
+        /// </summary>
+        public string StyleName
+        {
+            get
+            {
+                return GetXmlNodeString(STYLENAME_PATH);
+            }
+            set
+            {
+                if (value.StartsWith("PivotStyle"))
+                {
+                    try
+                    {
+                        _tableStyle = (TableStyles)Enum.Parse(typeof(TableStyles), value.Substring(10, value.Length - 10), true);
+                    }
+                    catch
+                    {
+                        _tableStyle = TableStyles.Custom;
+                    }
+                }
+                else if (value == "None")
+                {
+                    _tableStyle = TableStyles.None;
+                    value = "";
+                }
+                else
+                {
+                    _tableStyle = TableStyles.Custom;
+                }
+                SetXmlNodeString(STYLENAME_PATH, value, true);
+            }
+        }
+        TableStyles _tableStyle = Table.TableStyles.Medium6;
+        /// <summary>
+        /// The table style. If this property is cusom the style from the StyleName propery is used.
+        /// </summary>
+        public TableStyles TableStyle
+        {
+            get
+            {
+                return _tableStyle;
+            }
+            set
+            {
+                _tableStyle=value;
+                if (value != TableStyles.Custom)
+                {
+                    SetXmlNodeString(STYLENAME_PATH, "PivotStyle" + value.ToString());
+                }
+            }
+        }
+
+        #endregion
+        #region "Internal Properties"
+        internal int CacheID 
+        { 
+                get
+                {
+                    return GetXmlNodeInt("@cacheId");
+                }
+                set
+                {
+                    SetXmlNodeString("@cacheId",value.ToString());
+                }
+        }
+
+        #endregion
+
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Table/PivotTable/ExcelPivotTableCollection.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Table/PivotTable/ExcelPivotTableCollection.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Table/PivotTable/ExcelPivotTableCollection.cs	(revision 12707)
@@ -0,0 +1,166 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		Added		21-MAR-2011
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Xml;
+
+namespace OfficeOpenXml.Table.PivotTable
+{
+    /// <summary>
+    /// A collection of pivottable objects
+    /// </summary>
+    public class ExcelPivotTableCollection : IEnumerable<ExcelPivotTable>
+    {
+        List<ExcelPivotTable> _pivotTables = new List<ExcelPivotTable>();
+        internal Dictionary<string, int> _pivotTableNames = new Dictionary<string, int>();
+        ExcelWorksheet _ws;        
+        internal ExcelPivotTableCollection(ExcelWorksheet ws)
+        {
+            var pck = ws._package.Package;
+            _ws = ws;            
+            foreach(var rel in ws.Part.GetRelationships())
+            {
+                if (rel.RelationshipType == ExcelPackage.schemaRelationships + "/pivotTable")
+                {
+                    var tbl = new ExcelPivotTable(rel, ws);
+                    _pivotTableNames.Add(tbl.Name, _pivotTables.Count);
+                    if (tbl.Id + 1 > _ws.Workbook._nextPivotTableID) _ws.Workbook._nextPivotTableID = tbl.Id + 1;
+                    _pivotTables.Add(tbl);
+                }
+            }
+        }
+        private ExcelPivotTable Add(ExcelPivotTable tbl)
+        {
+            _pivotTables.Add(tbl);
+            _pivotTableNames.Add(tbl.Name, _pivotTables.Count - 1);
+            if (tbl.Id >= _ws.Workbook._nextPivotTableID)
+            {
+                _ws.Workbook._nextPivotTableID = tbl.Id + 1;
+            }
+            return tbl;
+        }
+
+        /// <summary>
+        /// Create a pivottable on the supplied range
+        /// </summary>
+        /// <param name="Range">The range address including header and total row</param>
+        /// <param name="Source">The Source data range address</param>
+        /// <param name="Name">The name of the table. Must be unique </param>
+        /// <returns>The pivottable object</returns>
+        public ExcelPivotTable Add(ExcelAddressBase Range, ExcelRangeBase Source, string Name)
+        {
+            if (string.IsNullOrEmpty(Name))
+            {
+                Name = GetNewTableName();
+            }
+            if (Range.WorkSheet != _ws.Name)
+            {
+                throw(new Exception("The Range must be in the current worksheet"));
+            }
+            else if (_ws.Workbook.ExistsTableName(Name))
+            {
+                throw (new ArgumentException("Tablename is not unique"));
+            }
+            foreach (var t in _pivotTables)
+            {
+                if (t.Address.Collide(Range) != ExcelAddressBase.eAddressCollition.No)
+                {
+                    throw (new ArgumentException(string.Format("Table range collides with table {0}", t.Name)));
+                }
+            }
+            return Add(new ExcelPivotTable(_ws, Range, Source, Name, _ws.Workbook._nextPivotTableID++));
+        }
+
+        internal string GetNewTableName()
+        {
+            string name = "Pivottable1";
+            int i = 2;
+            while (_ws.Workbook.ExistsPivotTableName(name))
+            {
+                name = string.Format("Pivottable{0}", i++);
+            }
+            return name;
+        }
+        public int Count
+        {
+            get
+            {
+                return _pivotTables.Count;
+            }
+        }
+        /// <summary>
+        /// The pivottable Index. Base 0.
+        /// </summary>
+        /// <param name="Index"></param>
+        /// <returns></returns>
+        public ExcelPivotTable this[int Index]
+        {
+            get
+            {
+                if (Index < 0 || Index >= _pivotTables.Count)
+                {
+                    throw (new ArgumentOutOfRangeException("PivotTable index out of range"));
+                }
+                return _pivotTables[Index];
+            }
+        }
+        /// <summary>
+        /// Pivottabes accesed by name
+        /// </summary>
+        /// <param name="Name">The name of the pivottable</param>
+        /// <returns>The Pivotable. Null if the no match is found</returns>
+        public ExcelPivotTable this[string Name]
+        {
+            get
+            {
+                if (_pivotTableNames.ContainsKey(Name))
+                {
+                    return _pivotTables[_pivotTableNames[Name]];
+                }
+                else
+                {
+                    return null;
+                }
+            }
+        }
+        public IEnumerator<ExcelPivotTable> GetEnumerator()
+        {
+            return _pivotTables.GetEnumerator();
+        }
+
+        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
+        {
+            return _pivotTables.GetEnumerator();
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Table/PivotTable/ExcelPivotTableDataField.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Table/PivotTable/ExcelPivotTableDataField.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Table/PivotTable/ExcelPivotTableDataField.cs	(revision 12707)
@@ -0,0 +1,233 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		Added		21-MAR-2011
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Text;
+using System.Xml;
+using OfficeOpenXml.Style.XmlAccess;
+
+namespace OfficeOpenXml.Table.PivotTable
+{
+    /// <summary>
+    /// A pivo table data field
+    /// </summary>
+    public class ExcelPivotTableDataField : XmlHelper
+    {
+        internal ExcelPivotTableDataField(XmlNamespaceManager ns, XmlNode topNode,ExcelPivotTableField field) :
+            base(ns, topNode)
+        {
+            if (topNode.Attributes.Count == 0)
+            {
+                Index = field.Index;
+                BaseField = 0;
+                BaseItem = 0;
+            }
+            
+            Field = field;
+        }
+        /// <summary>
+        /// The field
+        /// </summary>
+        public ExcelPivotTableField Field
+        {
+            get;
+            private set;
+        }
+        /// <summary>
+        /// The index of the datafield
+        /// </summary>
+        public int Index 
+        { 
+            get
+            {
+                return GetXmlNodeInt("@fld");
+            }
+            internal set
+            {
+                SetXmlNodeString("@fld",value.ToString());
+            }
+        }
+        /// <summary>
+        /// The name of the datafield
+        /// </summary>
+        public string Name
+        {
+            get
+            {
+                return GetXmlNodeString("@name");
+            }
+            set
+            {
+                if (Field._table.DataFields.ExistsDfName(value, this))
+                {
+                    throw (new InvalidOperationException("Duplicate datafield name"));
+                }
+                SetXmlNodeString("@name", value);
+            }
+        }
+        /// <summary>
+        /// Field index. Reference to the field collection
+        /// </summary>
+        public int BaseField
+        {
+            get
+            {
+                return GetXmlNodeInt("@baseField");
+            }
+            set
+            {
+                SetXmlNodeString("@baseField", value.ToString());
+            }
+        }
+        /// <summary>
+        /// Specifies the index to the base item when the ShowDataAs calculation is in use
+        /// </summary>
+        public int BaseItem
+        {
+            get
+            {
+                return GetXmlNodeInt("@baseItem");
+            }
+            set
+            {
+                SetXmlNodeString("@baseItem", value.ToString());
+            }
+        }
+        /// <summary>
+        /// Number format id. 
+        /// </summary>
+        internal int NumFmtId
+        {
+            get
+            {
+                return GetXmlNodeInt("@numFmtId");
+            }
+            set
+            {
+                SetXmlNodeString("@numFmtId", value.ToString());
+            }
+        }
+        /// <summary>
+        /// Number format for the data column
+        /// </summary>
+        public string Format
+        {
+            get
+            {
+                foreach (var nf in Field._table.WorkSheet.Workbook.Styles.NumberFormats)
+                {
+                    if (nf.NumFmtId == NumFmtId)
+                    {
+                        return nf.Format;
+                    }
+                }
+                return Field._table.WorkSheet.Workbook.Styles.NumberFormats[0].Format;
+            }
+            set
+            {
+                var styles = Field._table.WorkSheet.Workbook.Styles;
+
+                ExcelNumberFormatXml nf = null;
+                if (!styles.NumberFormats.FindByID(value, ref nf))
+                {
+                    nf = new ExcelNumberFormatXml(NameSpaceManager) { Format = value, NumFmtId = styles.NumberFormats.NextId++ };
+                    styles.NumberFormats.Add(value, nf);
+                }
+                NumFmtId = nf.NumFmtId;
+            }
+        }
+        /// <summary>
+        /// Type of aggregate function
+        /// </summary>
+        public DataFieldFunctions Function
+        {
+            get
+            {
+                string s=GetXmlNodeString("@subtotal");
+                if(s=="")
+                {
+                    return DataFieldFunctions.None;
+                }
+                else
+                {
+                    return (DataFieldFunctions)Enum.Parse(typeof(DataFieldFunctions), s, true);
+                }
+            }
+            set
+            {
+                string v;
+                switch(value)
+                {
+                    case DataFieldFunctions.None:
+                        DeleteNode("@subtotal");
+                        return;
+                    case DataFieldFunctions.CountNums:
+                        v="CountNums";
+                        break;
+                    case DataFieldFunctions.StdDev:
+                        v="stdDev";
+                        break;
+                    case DataFieldFunctions.StdDevP:
+                        v="stdDevP";
+                        break;
+                    default:
+                        v=value.ToString().ToLower(CultureInfo.InvariantCulture);
+                        break;
+                }                
+                SetXmlNodeString("@subtotal", v);
+            }
+        }
+        /////Since we have no items, Excel will crash when we use showDataAs options that require baseItem's
+        //public eShowDataAs ShowDataAs
+        //{
+        //    get
+        //    {
+        //        string s = GetXmlNodeString("@showDataAs");
+        //        if (s == "")
+        //        {
+        //            return eShowDataAs.Normal;
+        //        }
+        //        else
+        //        {
+        //            return (eShowDataAs)Enum.Parse(typeof(eShowDataAs), s, true);
+        //        }
+        //    }
+        //    set
+        //    {
+        //        string v = value.ToString();
+        //        v = v.Substring(0, 1).ToLower() + v.Substring(1);
+        //        SetXmlNodeString("@showDataAs", v);
+        //    }
+        //}
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Table/PivotTable/ExcelPivotTableField.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Table/PivotTable/ExcelPivotTableField.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Table/PivotTable/ExcelPivotTableField.cs	(revision 12707)
@@ -0,0 +1,1076 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		Added		21-MAR-2011
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Xml;
+using System.Globalization;
+
+namespace OfficeOpenXml.Table.PivotTable
+{
+    
+    /// <summary>
+    /// Defines the axis for a PivotTable
+    /// </summary>
+    public enum ePivotFieldAxis
+    {
+        /// <summary>
+        /// None
+        /// </summary>
+        None=-1,
+        /// <summary>
+        /// Column axis
+        /// </summary>
+        Column,
+        /// <summary>
+        /// Page axis (Include Count Filter) 
+        /// 
+        /// </summary>
+        Page,
+        /// <summary>
+        /// Row axis
+        /// </summary>
+        Row,
+        /// <summary>
+        /// Values axis
+        /// </summary>
+        Values 
+    }
+    /// <summary>
+    /// Build-in table row functions
+    /// </summary>
+    public enum DataFieldFunctions
+    {
+        Average,
+        Count,
+        CountNums,
+        Max,
+        Min,
+        Product,
+        None,
+        StdDev,
+        StdDevP,
+        Sum,
+        Var,
+        VarP
+    }
+    /// <summary>
+    /// Defines the data formats for a field in the PivotTable
+    /// </summary>
+    public enum eShowDataAs
+    {
+        /// <summary>
+        /// Indicates the field is shown as the "difference from" a value.
+        /// </summary>
+        Difference,
+        /// <summary>
+        /// Indicates the field is shown as the "index.
+        /// </summary>
+        Index, 
+        /// <summary>
+        /// Indicates that the field is shown as its normal datatype.
+        /// </summary>
+        Normal, 
+        /// <summary>
+        /// /Indicates the field is show as the "percentage of" a value
+        /// </summary>
+        Percent, 
+        /// <summary>
+        /// Indicates the field is shown as the "percentage difference from" a value.
+        /// </summary>
+        PercentDiff, 
+        /// <summary>
+        /// Indicates the field is shown as the percentage of column.
+        /// </summary>
+        PercentOfCol,
+        /// <summary>
+        /// Indicates the field is shown as the percentage of row
+        /// </summary>
+        PercentOfRow, 
+        /// <summary>
+        /// Indicates the field is shown as percentage of total.
+        /// </summary>
+        PercentOfTotal, 
+        /// <summary>
+        /// Indicates the field is shown as running total in the table.
+        /// </summary>
+        RunTotal,        
+    }
+      /// <summary>
+     /// Built-in subtotal functions
+     /// </summary>
+    [Flags] 
+    public enum eSubTotalFunctions 
+     {
+         None=1,
+         Count=2, 
+         CountA=4, 
+         Avg=8, 
+         Default=16, 
+         Min=32, 
+         Max=64, 
+         Product=128, 
+         StdDev=256, 
+         StdDevP=512, 
+         Sum=1024, 
+         Var=2048, 
+         VarP=4096
+     }
+    /// <summary>
+    /// Data grouping
+    /// </summary>
+    [Flags]
+    public enum eDateGroupBy
+    {
+        Years = 1,
+        Quarters = 2,
+        Months = 4,
+        Days = 8,
+        Hours = 16,
+        Minutes = 32,
+        Seconds = 64
+    }
+    /// <summary>
+    /// Sorting
+    /// </summary>
+    public enum eSortType
+    {
+        None,
+        Ascending,
+        Descending
+    }
+    /// <summary>
+    /// A pivot table field.
+    /// </summary>
+    public class ExcelPivotTableField : XmlHelper
+    {
+        internal ExcelPivotTable _table;
+        internal ExcelPivotTableField(XmlNamespaceManager ns, XmlNode topNode,ExcelPivotTable table, int index, int baseIndex) :
+            base(ns, topNode)
+        {
+            Index = index;
+            BaseIndex = baseIndex;
+            _table = table;
+        }
+        public int Index
+        {
+            get;
+            set;
+        }
+        internal int BaseIndex
+        {
+            get;
+            set;
+        }
+        /// <summary>
+        /// Name of the field
+        /// </summary>
+        public string Name 
+        { 
+            get
+            {
+                string v = GetXmlNodeString("@name");
+                if (v == "")
+                {
+                    return _cacheFieldHelper.GetXmlNodeString("@name");
+                }
+                else
+                {
+                    return GetXmlNodeString("@name");
+                }
+            }
+            set
+            {
+                SetXmlNodeString("@name", value);
+            }
+        }
+        /// <summary>
+        /// Compact mode
+        /// </summary>
+        public bool Compact
+        { 
+            get
+            {
+                return GetXmlNodeBool("@compact");
+            }
+            set
+            {
+                SetXmlNodeBool("@compact",value);
+            }
+        }
+        /// <summary>
+        /// A boolean that indicates whether the items in this field should be shown in Outline form
+        /// </summary>
+        public bool Outline 
+        { 
+            get
+            {
+                return GetXmlNodeBool("@outline");
+            }
+            set
+            {
+                SetXmlNodeBool("@outline",value);
+            }
+        }
+        /// <summary>
+        /// The custom text that is displayed for the subtotals label
+        /// </summary>
+        public bool SubtotalTop 
+        { 
+            get
+            {
+                return GetXmlNodeBool("@subtotalTop");
+            }
+            set
+            {
+                SetXmlNodeBool("@subtotalTop",value);
+            }
+        }
+        /// <summary>
+        /// A boolean that indicates whether to show all items for this field
+        /// </summary>
+        public bool ShowAll 
+        { 
+            get
+            {
+                return GetXmlNodeBool("@showAll");
+            }
+            set
+            {
+                SetXmlNodeBool("@showAll",value);
+            }
+        }
+        /// <summary>
+        /// The type of sort that is applied to this field
+        /// </summary>
+        public eSortType Sort
+        {
+            get
+            {
+                string v = GetXmlNodeString("@sortType");
+                return v == "" ? eSortType.None : (eSortType)Enum.Parse(typeof(eSortType), v, true);
+            }
+            set
+            {
+                if (value == eSortType.None)
+                {
+                    DeleteNode("@sortType");
+                }
+                else
+                {
+                    SetXmlNodeString("@sortType", value.ToString().ToLower(CultureInfo.InvariantCulture));
+                }
+            }
+        }
+        /// <summary>
+        /// A boolean that indicates whether manual filter is in inclusive mode
+        /// </summary>
+        public bool IncludeNewItemsInFilter
+        { 
+            get
+            {
+                return GetXmlNodeBool("@includeNewItemsInFilter");
+            }
+            set
+            {
+                SetXmlNodeBool("@includeNewItemsInFilter",value);
+            }
+        }
+         /// <summary>
+         /// Enumeration of the different subtotal operations that can be applied to page, row or column fields
+         /// </summary>
+         public eSubTotalFunctions SubTotalFunctions
+         {
+            get
+            {
+                eSubTotalFunctions ret = 0;
+                XmlNodeList nl = TopNode.SelectNodes("d:items/d:item/@t", NameSpaceManager);
+                if (nl.Count == 0) return eSubTotalFunctions.None;
+                foreach (XmlAttribute item in nl)
+                {
+                    try
+                    {
+                        ret |= (eSubTotalFunctions)Enum.Parse(typeof(eSubTotalFunctions), item.Value, true);
+                    }
+                    catch (ArgumentException ex)
+                    {
+                        throw new ArgumentException("Unable to parse value of " + item.Value + " to a valid pivot table subtotal function", ex);
+                    }
+                }
+                return ret;
+             }
+             set
+             {
+                 if ((value & eSubTotalFunctions.None) == eSubTotalFunctions.None && (value != eSubTotalFunctions.None))
+                 {
+                     throw (new ArgumentException("Value None can not be combined with other values."));
+                 }
+                 if ((value & eSubTotalFunctions.Default) == eSubTotalFunctions.Default && (value != eSubTotalFunctions.Default))
+                 {
+                     throw (new ArgumentException("Value Default can not be combined with other values."));
+                 }
+
+
+                 // remove old attribute                 
+                 XmlNodeList nl = TopNode.SelectNodes("d:items/d:item/@t", NameSpaceManager);
+                 if (nl.Count > 0)
+                 {
+                     foreach (XmlAttribute item in nl)
+                     {
+                         DeleteNode("@" + item.Value + "Subtotal");
+                         item.OwnerElement.ParentNode.RemoveChild(item.OwnerElement);
+                     }
+                 }
+                 
+ 
+                 if (value==eSubTotalFunctions.None)
+                 {
+                     // for no subtotals, set defaultSubtotal to off
+                     SetXmlNodeBool("@defaultSubtotal", false);
+                     TopNode.InnerXml = "";
+                 }
+                 else
+                 {
+                     string innerXml = "";
+                     int count = 0;
+                     foreach (eSubTotalFunctions e in Enum.GetValues(typeof(eSubTotalFunctions)))
+                    {
+                        if ((value & e) == e)
+                        {
+                            var newTotalType = e.ToString();
+                            var totalType = char.ToLower(newTotalType[0], CultureInfo.InvariantCulture) + newTotalType.Substring(1);
+                            // add new attribute
+                            SetXmlNodeBool("@" + totalType + "Subtotal", true);
+                            innerXml += "<item t=\"" + totalType + "\" />";
+                            count++;
+                        }
+                    }
+                    TopNode.InnerXml = string.Format("<items count=\"{0}\">{1}</items>", count, innerXml);
+                 }
+             }
+         }
+        /// <summary>
+        /// Type of axis
+        /// </summary>
+        public ePivotFieldAxis Axis
+        {
+            get
+            {
+                switch(GetXmlNodeString("@axis"))
+                {
+                    case "axisRow":
+                        return ePivotFieldAxis.Row;
+                    case "axisCol":
+                        return ePivotFieldAxis.Column;
+                    case "axisPage":
+                        return ePivotFieldAxis.Page;
+                    case "axisValues":
+                        return ePivotFieldAxis.Values;
+                    default:
+                        return ePivotFieldAxis.None;
+                }
+            }
+            internal set
+            {
+                switch (value)
+                {
+                    case ePivotFieldAxis.Row:
+                        SetXmlNodeString("@axis","axisRow");
+                        break;
+                    case ePivotFieldAxis.Column:
+                        SetXmlNodeString("@axis","axisCol");
+                        break;
+                    case ePivotFieldAxis.Values:
+                        SetXmlNodeString("@axis", "axisValues");
+                        break;
+                    case ePivotFieldAxis.Page:
+                        SetXmlNodeString("@axis", "axisPage");
+                        break;
+                    default:
+                        DeleteNode("@axis");
+                        break;
+                }
+            }
+        }        
+        /// <summary>
+        /// If the field is a row field
+        /// </summary>
+        public bool IsRowField
+        {
+            get
+            {
+                return (TopNode.SelectSingleNode(string.Format("../../d:rowFields/d:field[@x={0}]", Index), NameSpaceManager) != null);
+            }
+            internal set
+            {
+                if (value)
+                {
+                    var rowsNode = TopNode.SelectSingleNode("../../d:rowFields", NameSpaceManager);
+                    if (rowsNode == null)
+                    {
+                        _table.CreateNode("d:rowFields");
+                    }
+                    rowsNode = TopNode.SelectSingleNode("../../d:rowFields", NameSpaceManager);
+
+                    AppendField(rowsNode, Index, "field", "x");
+                    if (BaseIndex == Index)
+                    {
+                        TopNode.InnerXml = "<items count=\"1\"><item t=\"default\" /></items>";
+                    }
+                    else
+                    {
+                        TopNode.InnerXml = "<items count=\"0\"></items>";
+                    }
+                }
+                else
+                {
+                    XmlElement node = TopNode.SelectSingleNode(string.Format("../../d:rowFields/d:field[@x={0}]", Index), NameSpaceManager) as XmlElement;
+                     if (node != null)
+                     {
+                         node.ParentNode.RemoveChild(node);
+                     }
+                }
+            }
+        }
+        /// <summary>
+        /// If the field is a column field
+        /// </summary>
+        public bool IsColumnField
+        {
+            get
+            {
+                return (TopNode.SelectSingleNode(string.Format("../../d:colFields/d:field[@x={0}]", Index), NameSpaceManager) != null);
+            }
+            internal set
+            {
+                if (value)
+                {
+                    var columnsNode = TopNode.SelectSingleNode("../../d:colFields", NameSpaceManager);
+                    if (columnsNode == null)
+                    {
+                        _table.CreateNode("d:colFields");
+                    }
+                    columnsNode = TopNode.SelectSingleNode("../../d:colFields", NameSpaceManager);
+
+                    AppendField(columnsNode, Index, "field", "x");
+                    if (BaseIndex == Index)
+                    {
+                        TopNode.InnerXml = "<items count=\"1\"><item t=\"default\" /></items>";
+                    }
+                    else
+                    {
+                        TopNode.InnerXml = "<items count=\"0\"></items>";
+                    }
+                }
+                else
+                {
+                    XmlElement node = TopNode.SelectSingleNode(string.Format("../../d:colFields/d:field[@x={0}]", Index), NameSpaceManager) as XmlElement;
+                    if (node != null)
+                    {
+                        node.ParentNode.RemoveChild(node);
+                    }
+                }
+            }
+        }
+        /// <summary>
+        /// If the field is a datafield
+        /// </summary>
+        public bool IsDataField
+        {
+            get
+            {
+                return GetXmlNodeBool("@dataField", false);
+            }
+        }
+        /// <summary>
+        /// If the field is a page field.
+        /// </summary>
+        public bool IsPageField
+        {
+            get
+            {
+                return (Axis==ePivotFieldAxis.Page);
+            }
+            internal set
+            {
+                if (value)
+                {
+                    var dataFieldsNode = TopNode.SelectSingleNode("../../d:pageFields", NameSpaceManager);
+                    if (dataFieldsNode == null)
+                    {
+                        _table.CreateNode("d:pageFields");
+                        dataFieldsNode = TopNode.SelectSingleNode("../../d:pageFields", NameSpaceManager);
+                    }
+
+                    TopNode.InnerXml = "<items count=\"1\"><item t=\"default\" /></items>";
+
+                    XmlElement node = AppendField(dataFieldsNode, Index, "pageField", "fld");
+                    _pageFieldSettings = new ExcelPivotTablePageFieldSettings(NameSpaceManager, node, this, Index);
+                }
+                else
+                {
+                    _pageFieldSettings = null;
+                    XmlElement node = TopNode.SelectSingleNode(string.Format("../../d:pageFields/d:pageField[@fld={0}]", Index), NameSpaceManager) as XmlElement;
+                    if (node != null)
+                    {
+                        node.ParentNode.RemoveChild(node);
+                    }
+                }
+            }
+        }
+        //public ExcelPivotGrouping DateGrouping
+        //{
+
+        //}
+        internal ExcelPivotTablePageFieldSettings _pageFieldSettings = null;
+        public ExcelPivotTablePageFieldSettings PageFieldSettings
+        {
+            get
+            {
+                return _pageFieldSettings;
+            }
+        }
+        internal eDateGroupBy DateGrouping
+        {
+            get;
+            set;
+        }
+        ExcelPivotTableFieldGroup _grouping=null;
+        /// <summary>
+        /// Grouping settings. 
+        /// Null if the field has no grouping otherwise ExcelPivotTableFieldNumericGroup or ExcelPivotTableFieldNumericGroup.
+        /// </summary>        
+        public ExcelPivotTableFieldGroup Grouping
+        {
+            get
+            {
+                return _grouping;
+            }
+        }
+        #region Private & internal Methods
+        internal XmlElement AppendField(XmlNode rowsNode, int index, string fieldNodeText, string indexAttrText)
+        {
+            XmlElement prevField = null, newElement;
+            foreach (XmlElement field in rowsNode.ChildNodes)
+            {
+                string x = field.GetAttribute(indexAttrText);
+                int fieldIndex;
+                if(int.TryParse(x, out fieldIndex))
+                {
+                    if (fieldIndex == index)    //Row already exists
+                    {
+                        return field;
+                    }
+                    //else if (fieldIndex > index)
+                    //{
+                    //    newElement = rowsNode.OwnerDocument.CreateElement(fieldNodeText, ExcelPackage.schemaMain);
+                    //    newElement.SetAttribute(indexAttrText, index.ToString());
+                    //    rowsNode.InsertAfter(newElement, field);
+                    //}
+                }
+                prevField=field;
+            }
+            newElement = rowsNode.OwnerDocument.CreateElement(fieldNodeText, ExcelPackage.schemaMain);
+            newElement.SetAttribute(indexAttrText, index.ToString());
+            rowsNode.InsertAfter(newElement, prevField);
+
+            return newElement;
+        }
+        internal XmlHelperInstance _cacheFieldHelper = null;
+        internal void SetCacheFieldNode(XmlNode cacheField)
+        {
+            _cacheFieldHelper = new XmlHelperInstance(NameSpaceManager, cacheField);
+            var groupNode = cacheField.SelectSingleNode("d:fieldGroup", NameSpaceManager);
+            if (groupNode!=null)
+            {
+                var groupBy = groupNode.SelectSingleNode("d:rangePr/@groupBy", NameSpaceManager);
+                if (groupBy==null)
+                {
+                    _grouping = new ExcelPivotTableFieldNumericGroup(NameSpaceManager, cacheField);
+                }
+                else
+                {
+                    DateGrouping=(eDateGroupBy)Enum.Parse(typeof(eDateGroupBy), groupBy.Value, true);
+                    _grouping = new ExcelPivotTableFieldDateGroup(NameSpaceManager, groupNode);
+                }
+            }
+        }
+        #endregion
+        #region Grouping
+        internal ExcelPivotTableFieldDateGroup SetDateGroup(eDateGroupBy GroupBy, DateTime StartDate, DateTime EndDate, int interval)
+        {
+            ExcelPivotTableFieldDateGroup group;
+            group = new ExcelPivotTableFieldDateGroup(NameSpaceManager, _cacheFieldHelper.TopNode);
+            _cacheFieldHelper.SetXmlNodeBool("d:sharedItems/@containsDate", true);
+            _cacheFieldHelper.SetXmlNodeBool("d:sharedItems/@containsNonDate", false);
+            _cacheFieldHelper.SetXmlNodeBool("d:sharedItems/@containsSemiMixedTypes", false);
+
+            group.TopNode.InnerXml += string.Format("<fieldGroup base=\"{0}\"><rangePr groupBy=\"{1}\" /><groupItems /></fieldGroup>", BaseIndex, GroupBy.ToString().ToLower(CultureInfo.InvariantCulture));
+
+            if (StartDate.Year < 1900)
+            {
+                _cacheFieldHelper.SetXmlNodeString("d:fieldGroup/d:rangePr/@startDate", "1900-01-01T00:00:00");
+            }
+            else
+            {
+                _cacheFieldHelper.SetXmlNodeString("d:fieldGroup/d:rangePr/@startDate", StartDate.ToString("s", CultureInfo.InvariantCulture));
+                _cacheFieldHelper.SetXmlNodeString("d:fieldGroup/d:rangePr/@autoStart", "0");
+            }
+
+            if (EndDate==DateTime.MaxValue)
+            {
+                _cacheFieldHelper.SetXmlNodeString("d:fieldGroup/d:rangePr/@endDate", "9999-12-31T00:00:00");
+            }
+            else
+            {
+                _cacheFieldHelper.SetXmlNodeString("d:fieldGroup/d:rangePr/@endDate", EndDate.ToString("s", CultureInfo.InvariantCulture));
+                _cacheFieldHelper.SetXmlNodeString("d:fieldGroup/d:rangePr/@autoEnd", "0");
+            }
+
+            int items = AddDateGroupItems(group, GroupBy, StartDate, EndDate, interval);
+            AddFieldItems(items);
+
+            _grouping = group;
+            return group;
+        }
+        internal ExcelPivotTableFieldNumericGroup SetNumericGroup(double start, double end, double interval)
+        {
+            ExcelPivotTableFieldNumericGroup group;
+            group = new ExcelPivotTableFieldNumericGroup(NameSpaceManager, _cacheFieldHelper.TopNode);
+            _cacheFieldHelper.SetXmlNodeBool("d:sharedItems/@containsNumber", true);
+            _cacheFieldHelper.SetXmlNodeBool("d:sharedItems/@containsInteger", true);
+            _cacheFieldHelper.SetXmlNodeBool("d:sharedItems/@containsSemiMixedTypes", false);
+            _cacheFieldHelper.SetXmlNodeBool("d:sharedItems/@containsString", false);
+
+            group.TopNode.InnerXml += string.Format("<fieldGroup base=\"{0}\"><rangePr autoStart=\"0\" autoEnd=\"0\" startNum=\"{1}\" endNum=\"{2}\" groupInterval=\"{3}\"/><groupItems /></fieldGroup>", BaseIndex, start.ToString(CultureInfo.InvariantCulture), end.ToString(CultureInfo.InvariantCulture), interval.ToString(CultureInfo.InvariantCulture));
+            int items = AddNumericGroupItems(group, start, end, interval);
+            AddFieldItems(items);
+
+            _grouping = group;
+            return group;
+        }
+
+        private int AddNumericGroupItems(ExcelPivotTableFieldNumericGroup group, double start, double end, double interval)
+        {
+            if (interval < 0)
+            {
+                throw (new Exception("The interval must be a positiv"));
+            }
+            if (start > end)
+            {
+                throw(new Exception("Then End number must be larger than the Start number"));
+            }
+
+            XmlElement groupItems = group.TopNode.SelectSingleNode("d:fieldGroup/d:groupItems", group.NameSpaceManager) as XmlElement;
+            int items = 2;
+            //First date
+            double index=start;
+            double nextIndex=start+interval;
+            AddGroupItem(groupItems, "<" + start.ToString(CultureInfo.InvariantCulture));
+
+            while (index < end)
+            {
+                AddGroupItem(groupItems, string.Format("{0}-{1}", index.ToString(CultureInfo.InvariantCulture), nextIndex.ToString(CultureInfo.InvariantCulture)));
+                index=nextIndex;
+                nextIndex+=interval;
+                items++;
+            }
+            AddGroupItem(groupItems, ">" + nextIndex.ToString(CultureInfo.InvariantCulture));
+            return items;
+        }
+
+        private void AddFieldItems(int items)
+        {
+            XmlElement prevNode = null;
+            XmlElement itemsNode = TopNode.SelectSingleNode("d:items", NameSpaceManager) as XmlElement;
+            for (int x = 0; x < items; x++)
+            {
+                var itemNode = itemsNode.OwnerDocument.CreateElement("item", ExcelPackage.schemaMain);
+                itemNode.SetAttribute("x", x.ToString());
+                if (prevNode == null)
+                {
+                    itemsNode.PrependChild(itemNode);
+                }
+                else
+                {
+                    itemsNode.InsertAfter(itemNode, prevNode);
+                }
+                prevNode = itemNode;
+            }
+            itemsNode.SetAttribute("count", (items + 1).ToString());
+        }
+
+        private int AddDateGroupItems(ExcelPivotTableFieldGroup group, eDateGroupBy GroupBy, DateTime StartDate, DateTime EndDate, int interval)
+        {
+            XmlElement groupItems = group.TopNode.SelectSingleNode("d:fieldGroup/d:groupItems", group.NameSpaceManager) as XmlElement;
+            int items = 2;
+            //First date
+            AddGroupItem(groupItems, "<" + StartDate.ToString("s", CultureInfo.InvariantCulture).Substring(0, 10));
+
+            switch (GroupBy)
+            {
+                case eDateGroupBy.Seconds:
+                case eDateGroupBy.Minutes:
+                    AddTimeSerie(60, groupItems);
+                    items += 60;
+                    break;
+                case eDateGroupBy.Hours:
+                    AddTimeSerie(24, groupItems);
+                    items += 24;
+                    break;
+                case eDateGroupBy.Days:
+                    if (interval == 1)
+                    {
+                        DateTime dt = new DateTime(2008, 1, 1); //pick a year with 366 days
+                        while (dt.Year == 2008)
+                        {
+                            AddGroupItem(groupItems, dt.ToString("dd-MMM"));
+                            dt = dt.AddDays(1);
+                        }
+                        items += 366;
+                    }
+                    else
+                    {
+                        DateTime dt = StartDate;
+                        items = 0;
+                        while (dt < EndDate)
+                        {
+                            AddGroupItem(groupItems, dt.ToString("dd-MMM"));
+                            dt = dt.AddDays(interval);
+                            items++;
+                        }
+                    }
+                    break;
+                case eDateGroupBy.Months:
+                    AddGroupItem(groupItems, "jan");
+                    AddGroupItem(groupItems, "feb");
+                    AddGroupItem(groupItems, "mar");
+                    AddGroupItem(groupItems, "apr");
+                    AddGroupItem(groupItems, "may");
+                    AddGroupItem(groupItems, "jun");
+                    AddGroupItem(groupItems, "jul");
+                    AddGroupItem(groupItems, "aug");
+                    AddGroupItem(groupItems, "sep");
+                    AddGroupItem(groupItems, "oct");
+                    AddGroupItem(groupItems, "nov");
+                    AddGroupItem(groupItems, "dec");
+                    items += 12;
+                    break;
+                case eDateGroupBy.Quarters:
+                    AddGroupItem(groupItems, "Qtr1");
+                    AddGroupItem(groupItems, "Qtr2");
+                    AddGroupItem(groupItems, "Qtr3");
+                    AddGroupItem(groupItems, "Qtr4");
+                    items += 4;
+                    break;
+                case eDateGroupBy.Years:
+                    if(StartDate.Year>=1900 && EndDate!=DateTime.MaxValue)
+                    {
+                        for (int year = StartDate.Year; year <= EndDate.Year; year++)
+                        {
+                            AddGroupItem(groupItems, year.ToString());
+                        }
+                        items += EndDate.Year - StartDate.Year+1;
+                    }
+                    break;
+                default:
+                    throw (new Exception("unsupported grouping"));
+            }
+
+            //Lastdate
+            AddGroupItem(groupItems, ">" + EndDate.ToString("s", CultureInfo.InvariantCulture).Substring(0, 10));
+            return items;
+        }
+
+        private void AddTimeSerie(int count, XmlElement groupItems)
+        {
+            for (int i = 0; i < count; i++)
+            {
+                AddGroupItem(groupItems, string.Format("{0:00}", i));
+            }
+        }
+
+        private void AddGroupItem(XmlElement groupItems, string value)
+        {
+            var s = groupItems.OwnerDocument.CreateElement("s", ExcelPackage.schemaMain);
+            s.SetAttribute("v", value);
+            groupItems.AppendChild(s);
+        }
+        #endregion
+        internal ExcelPivotTableFieldCollectionBase<ExcelPivotTableFieldItem> _items=null;
+        /// <summary>
+        /// Pivottable field Items. Used for grouping.
+        /// </summary>
+        public ExcelPivotTableFieldCollectionBase<ExcelPivotTableFieldItem> Items
+        {
+            get
+            {
+                if (_items == null)
+                {
+                    _items = new ExcelPivotTableFieldCollectionBase<ExcelPivotTableFieldItem>(_table);
+                    foreach (XmlNode node in TopNode.SelectNodes("d:items//d:item", NameSpaceManager))
+                    {
+                        var item = new ExcelPivotTableFieldItem(NameSpaceManager, node,this);
+                        if (item.T == "")
+                        {
+                            _items.AddInternal(item);
+                        }
+                    }
+                    //if (_grouping is ExcelPivotTableFieldDateGroup)
+                    //{
+                    //    ExcelPivotTableFieldDateGroup dtgrp = ((ExcelPivotTableFieldDateGroup)_grouping);
+
+                    //    ExcelPivotTableFieldItem minItem=null, maxItem=null;
+                    //    foreach (var item in _items)
+                    //    {
+                    //        if (item.X == 0)
+                    //        {
+                    //            minItem = item;
+                    //        }
+                    //        else if (maxItem == null || maxItem.X < item.X)
+                    //        {
+                    //            maxItem = item;
+                    //        }
+                    //    }
+                    //    if (dtgrp.AutoStart)
+                    //    {
+                    //        _items._list.Remove(minItem);
+                    //    }
+                    //    if (dtgrp.AutoEnd)
+                    //    {
+                    //        _items._list.Remove(maxItem);
+                    //    }
+
+                    //}
+                }
+                return _items;
+            }
+        }
+        /// <summary>
+        /// Add numberic grouping to the field
+        /// </summary>
+        /// <param name="Start">Start value</param>
+        /// <param name="End">End value</param>
+        /// <param name="Interval">Interval</param>
+        public void AddNumericGrouping(double Start, double End, double Interval)
+        {
+            ValidateGrouping();
+            SetNumericGroup(Start, End, Interval);
+        }
+        /// <summary>
+        /// Add a date grouping on this field.
+        /// </summary>
+        /// <param name="groupBy">Group by</param>
+        public void AddDateGrouping(eDateGroupBy groupBy)
+        {
+            AddDateGrouping(groupBy, DateTime.MinValue, DateTime.MaxValue,1);
+        }
+        /// <summary>
+        /// Add a date grouping on this field.
+        /// </summary>
+        /// <param name="groupBy">Group by</param>
+        /// <param name="startDate">Fixed start date. Use DateTime.MinValue for auto</param>
+        /// <param name="endDate">Fixed end date. Use DateTime.MaxValue for auto</param>
+        public void AddDateGrouping(eDateGroupBy groupBy, DateTime startDate, DateTime endDate)
+        {
+            AddDateGrouping(groupBy, startDate, endDate, 1);
+        }
+        /// <summary>
+        /// Add a date grouping on this field.
+        /// </summary>
+        /// <param name="days">Number of days when grouping on days</param>
+        /// <param name="startDate">Fixed start date. Use DateTime.MinValue for auto</param>
+        /// <param name="endDate">Fixed end date. Use DateTime.MaxValue for auto</param>
+        public void AddDateGrouping(int days, DateTime startDate, DateTime endDate)
+        {
+            AddDateGrouping(eDateGroupBy.Days, startDate, endDate, days);
+        }
+        private void AddDateGrouping(eDateGroupBy groupBy, DateTime startDate, DateTime endDate, int groupInterval)
+        {
+            if (groupInterval < 1 || groupInterval >= Int16.MaxValue)
+            {
+                throw (new ArgumentOutOfRangeException("Group interval is out of range"));
+            }
+            if (groupInterval > 1 && groupBy != eDateGroupBy.Days)
+            {
+                throw (new ArgumentException("Group interval is can only be used when groupBy is Days"));
+            }
+            ValidateGrouping();
+
+            bool firstField = true;            
+            List<ExcelPivotTableField> fields=new List<ExcelPivotTableField>();
+            //Seconds
+            if ((groupBy & eDateGroupBy.Seconds) == eDateGroupBy.Seconds)
+            {
+                fields.Add(AddField(eDateGroupBy.Seconds, startDate, endDate, ref firstField));
+            }
+            //Minutes
+            if ((groupBy & eDateGroupBy.Minutes) == eDateGroupBy.Minutes)
+            {
+                fields.Add(AddField(eDateGroupBy.Minutes, startDate, endDate, ref firstField));
+            }
+            //Hours
+            if ((groupBy & eDateGroupBy.Hours) == eDateGroupBy.Hours)
+            {
+                fields.Add(AddField(eDateGroupBy.Hours, startDate, endDate, ref firstField));
+            }
+            //Days
+            if ((groupBy & eDateGroupBy.Days) == eDateGroupBy.Days)
+            {
+                fields.Add(AddField(eDateGroupBy.Days, startDate, endDate, ref firstField, groupInterval));
+            }
+            //Month
+            if ((groupBy & eDateGroupBy.Months) == eDateGroupBy.Months)
+            {
+                fields.Add(AddField(eDateGroupBy.Months, startDate, endDate, ref firstField));
+            }
+            //Quarters
+            if ((groupBy & eDateGroupBy.Quarters) == eDateGroupBy.Quarters)
+            {
+                fields.Add(AddField(eDateGroupBy.Quarters, startDate, endDate, ref firstField));
+            }
+            //Years
+            if ((groupBy & eDateGroupBy.Years) == eDateGroupBy.Years)
+            {
+                fields.Add(AddField(eDateGroupBy.Years, startDate, endDate, ref firstField));
+            }
+
+            if (fields.Count > 1) _cacheFieldHelper.SetXmlNodeString("d:fieldGroup/@par", (_table.Fields.Count - 1).ToString());
+            if (groupInterval != 1)
+            {
+                _cacheFieldHelper.SetXmlNodeString("d:fieldGroup/d:rangePr/@groupInterval", groupInterval.ToString());
+            }
+            else
+            {
+                _cacheFieldHelper.DeleteNode("d:fieldGroup/d:rangePr/@groupInterval");
+            }
+            _items = null;
+        }
+
+        private void ValidateGrouping()
+        {
+            if (!(IsColumnField || IsRowField))
+            {
+                throw (new Exception("Field must be a row or column field"));
+            }
+            foreach (var field in _table.Fields)
+            {
+                if (field.Grouping != null)
+                {
+                    throw (new Exception("Grouping already exists"));
+                }
+            }
+        }
+        private ExcelPivotTableField AddField(eDateGroupBy groupBy, DateTime startDate, DateTime endDate, ref  bool firstField)
+        {
+            return AddField(groupBy, startDate, endDate, ref firstField,1);
+        }
+        private ExcelPivotTableField AddField(eDateGroupBy groupBy, DateTime startDate, DateTime endDate, ref  bool firstField, int interval)
+        {
+            if (firstField == false)
+            {
+                //Pivot field
+                var topNode = _table.PivotTableXml.SelectSingleNode("//d:pivotFields", _table.NameSpaceManager);
+                var fieldNode = _table.PivotTableXml.CreateElement("pivotField", ExcelPackage.schemaMain);
+                fieldNode.SetAttribute("compact", "0");
+                fieldNode.SetAttribute("outline", "0");
+                fieldNode.SetAttribute("showAll", "0");
+                fieldNode.SetAttribute("defaultSubtotal", "0");
+                topNode.AppendChild(fieldNode);
+
+                var field = new ExcelPivotTableField(_table.NameSpaceManager, fieldNode, _table, _table.Fields.Count, Index);
+                field.DateGrouping = groupBy;
+
+                XmlNode rowColFields;
+                if (IsRowField)
+                {
+                    rowColFields=TopNode.SelectSingleNode("../../d:rowFields", NameSpaceManager);
+                }
+                else
+                {
+                    rowColFields = TopNode.SelectSingleNode("../../d:colFields", NameSpaceManager);
+                }
+
+                int fieldIndex, index = 0;
+                foreach (XmlElement rowfield in rowColFields.ChildNodes)
+                {
+                    if (int.TryParse(rowfield.GetAttribute("x"), out fieldIndex))
+                    {
+                        if (_table.Fields[fieldIndex].BaseIndex == BaseIndex)
+                        {
+                            var newElement = rowColFields.OwnerDocument.CreateElement("field", ExcelPackage.schemaMain);
+                            newElement.SetAttribute("x", field.Index.ToString());
+                            rowColFields.InsertBefore(newElement, rowfield);
+                            break;
+                        }
+                    }
+                    index++;
+                }
+
+                if (IsRowField)
+                {
+                    _table.RowFields.Insert(field, index);
+                }
+                else
+                {
+                    _table.ColumnFields.Insert(field, index);
+                }
+                
+                _table.Fields.AddInternal(field);
+
+                AddCacheField(field, startDate, endDate, interval);
+                return field;
+            }
+            else
+            {
+                firstField = false;
+                DateGrouping = groupBy;
+                Compact = false;
+                SetDateGroup(groupBy, startDate, endDate, interval);
+                return this;
+            }
+        }
+        private void AddCacheField(ExcelPivotTableField field, DateTime startDate, DateTime endDate, int interval)
+        {
+            //Add Cache definition field.
+            var cacheTopNode = _table.CacheDefinition.CacheDefinitionXml.SelectSingleNode("//d:cacheFields", _table.NameSpaceManager);
+            var cacheFieldNode = _table.CacheDefinition.CacheDefinitionXml.CreateElement("cacheField", ExcelPackage.schemaMain);
+
+            cacheFieldNode.SetAttribute("name", field.DateGrouping.ToString());
+            cacheFieldNode.SetAttribute("databaseField", "0");
+            cacheTopNode.AppendChild(cacheFieldNode);
+            field.SetCacheFieldNode(cacheFieldNode);
+
+            field.SetDateGroup(field.DateGrouping, startDate, endDate, interval);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Table/PivotTable/ExcelPivotTableFieldCollection.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Table/PivotTable/ExcelPivotTableFieldCollection.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Table/PivotTable/ExcelPivotTableFieldCollection.cs	(revision 12707)
@@ -0,0 +1,322 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		Added		21-MAR-2011
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Xml;
+
+namespace OfficeOpenXml.Table.PivotTable
+{
+    /// <summary>
+    /// Base collection class for pivottable fields
+    /// </summary>
+    /// <typeparam name="T"></typeparam>
+    public class ExcelPivotTableFieldCollectionBase<T> : IEnumerable<T>
+    {
+        protected ExcelPivotTable _table;
+        internal List<T> _list = new List<T>();
+        internal ExcelPivotTableFieldCollectionBase(ExcelPivotTable table)
+        {
+            _table = table;
+        }
+        public IEnumerator<T> GetEnumerator()
+        {
+            return _list.GetEnumerator();
+        }
+
+        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
+        {
+            return _list.GetEnumerator();
+        }
+        public int Count
+        {
+            get
+            {
+                return _list.Count;
+            }
+        }
+        internal void AddInternal(T field)
+        {
+            _list.Add(field);
+        }
+        internal void Clear()
+        {
+            _list.Clear();
+        }
+        public T this[int Index]
+        {
+            get
+            {
+                if (Index < 0 || Index >= _list.Count)
+                {
+                    throw (new ArgumentOutOfRangeException("Index out of range"));
+                }
+                return _list[Index];
+            }
+        }
+    }
+    public class ExcelPivotTableFieldCollection : ExcelPivotTableFieldCollectionBase<ExcelPivotTableField>
+    {
+        internal ExcelPivotTableFieldCollection(ExcelPivotTable table, string topNode) :
+            base(table)
+        {
+
+        }
+        /// <summary>
+        /// Indexer by name
+        /// </summary>
+        /// <param name="name"></param>
+        /// <returns></returns>
+        public ExcelPivotTableField this[string name]
+        {
+            get
+            {
+                foreach (var field in _list)
+                {
+                    if (field.Name.Equals(name,StringComparison.InvariantCultureIgnoreCase))
+                    {
+                        return field;
+                    }
+                }
+                return null;
+            }
+        }
+        /// <summary>
+        /// Returns the date group field.
+        /// </summary>
+        /// <param name="GroupBy">The type of grouping</param>
+        /// <returns>The matching field. If none is found null is returned</returns>
+        public ExcelPivotTableField GetDateGroupField(eDateGroupBy GroupBy)
+        {
+            foreach (var fld in _list)
+            {
+                if (fld.Grouping is ExcelPivotTableFieldDateGroup && (((ExcelPivotTableFieldDateGroup)fld.Grouping).GroupBy) == GroupBy)
+                {
+                    return fld;
+                }
+            }
+            return null;
+        }
+        /// <summary>
+        /// Returns the numeric group field.
+        /// </summary>
+        /// <returns>The matching field. If none is found null is returned</returns>
+        public ExcelPivotTableField GetNumericGroupField()
+        {
+            foreach (var fld in _list)
+            {
+                if (fld.Grouping is ExcelPivotTableFieldNumericGroup)
+                {
+                    return fld;
+                }
+            }
+            return null;
+        }
+    }
+    /// <summary>
+    /// Collection class for Row and column fields in a Pivottable 
+    /// </summary>
+    public class ExcelPivotTableRowColumnFieldCollection : ExcelPivotTableFieldCollectionBase<ExcelPivotTableField>
+    {
+        internal string _topNode;
+        internal ExcelPivotTableRowColumnFieldCollection(ExcelPivotTable table, string topNode) :
+            base(table)
+	    {
+            _topNode=topNode;
+	    }
+
+        /// <summary>
+        /// Add a new row/column field
+        /// </summary>
+        /// <param name="Field">The field</param>
+        /// <returns>The new field</returns>
+        public ExcelPivotTableField Add(ExcelPivotTableField Field)
+        {
+            SetFlag(Field, true);
+            _list.Add(Field);
+            return Field;
+        }
+        /// <summary>
+        /// Insert a new row/column field
+        /// </summary>
+        /// <param name="Field">The field</param>
+        /// <param name="Index">The position to insert the field</param>
+        /// <returns>The new field</returns>
+        internal ExcelPivotTableField Insert(ExcelPivotTableField Field, int Index)
+        {
+            SetFlag(Field, true);
+            _list.Insert(Index, Field);
+            return Field;
+        }
+        private void SetFlag(ExcelPivotTableField field, bool value)
+        {
+            switch (_topNode)
+            {
+                case "rowFields":
+                    if (field.IsColumnField || field.IsPageField)
+                    {
+                        throw(new Exception("This field is a column or page field. Can't add it to the RowFields collection"));
+                    }
+                    field.IsRowField = value;
+                    field.Axis = ePivotFieldAxis.Row;
+                    break;
+                case "colFields":
+                    if (field.IsRowField || field.IsPageField)
+                    {
+                        throw (new Exception("This field is a row or page field. Can't add it to the ColumnFields collection"));
+                    }
+                    field.IsColumnField = value;
+                    field.Axis = ePivotFieldAxis.Column;
+                    break;
+                case "pageFields":
+                    if (field.IsColumnField || field.IsRowField)
+                    {
+                        throw (new Exception("Field is a column or row field. Can't add it to the PageFields collection"));
+                    }
+                    if (_table.Address._fromRow < 3)
+                    {
+                        throw(new Exception(string.Format("A pivot table with page fields must be located above row 3. Currenct location is {0}", _table.Address.Address)));
+                    }
+                    field.IsPageField = value;
+                    field.Axis = ePivotFieldAxis.Page;
+                    break;
+                case "dataFields":
+                    
+                    break;
+            }
+        }
+        /// <summary>
+        /// Remove a field
+        /// </summary>
+        /// <param name="Field"></param>
+        public void Remove(ExcelPivotTableField Field)
+        {
+            if(!_list.Contains(Field))
+            {
+                throw new ArgumentException("Field not in collection");
+            }
+            SetFlag(Field, false);            
+            _list.Remove(Field);            
+        }
+        /// <summary>
+        /// Remove a field at a specific position
+        /// </summary>
+        /// <param name="Index"></param>
+        public void RemoveAt(int Index)
+        {
+            if (Index > -1 && Index < _list.Count)
+            {
+                throw(new IndexOutOfRangeException());
+            }
+            SetFlag(_list[Index], false);
+            _list.RemoveAt(Index);      
+        }
+    }
+    /// <summary>
+    /// Collection class for data fields in a Pivottable 
+    /// </summary>
+    public class ExcelPivotTableDataFieldCollection : ExcelPivotTableFieldCollectionBase<ExcelPivotTableDataField>
+    {
+        internal ExcelPivotTableDataFieldCollection(ExcelPivotTable table) :
+            base(table)
+        {
+
+        }
+        /// <summary>
+        /// Add a new datafield
+        /// </summary>
+        /// <param name="field">The field</param>
+        /// <returns>The new datafield</returns>
+        public ExcelPivotTableDataField Add(ExcelPivotTableField field)
+        {
+            var dataFieldsNode = field.TopNode.SelectSingleNode("../../d:dataFields", field.NameSpaceManager);
+            if (dataFieldsNode == null)
+            {
+                _table.CreateNode("d:dataFields");
+                dataFieldsNode = field.TopNode.SelectSingleNode("../../d:dataFields", field.NameSpaceManager);
+            }
+
+            XmlElement node = _table.PivotTableXml.CreateElement("dataField", ExcelPackage.schemaMain);
+            node.SetAttribute("fld", field.Index.ToString());
+            dataFieldsNode.AppendChild(node);
+
+            //XmlElement node = field.AppendField(dataFieldsNode, field.Index, "dataField", "fld");
+            field.SetXmlNodeBool("@dataField", true,false);
+
+            var dataField = new ExcelPivotTableDataField(field.NameSpaceManager, node, field);
+            ValidateDupName(dataField);
+
+            _list.Add(dataField);
+            return dataField;
+        }
+        private void ValidateDupName(ExcelPivotTableDataField dataField)
+        {
+            if(ExistsDfName(dataField.Field.Name, null))
+            {
+                var index = 2;
+                string name;
+                do
+                {
+                    name = dataField.Field.Name + "_" + index++.ToString();
+                }
+                while (ExistsDfName(name,null));
+                dataField.Name = name;
+            }
+        }
+
+        internal bool ExistsDfName(string name, ExcelPivotTableDataField datafield)
+        {
+            foreach (var df in _list)
+            {
+                if (((!string.IsNullOrEmpty(df.Name) && df.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase) ||
+                     (string.IsNullOrEmpty(df.Name) && df.Field.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase)))) && datafield != df)
+                {
+                    return true;
+                }
+            }
+            return false;
+        }
+        /// <summary>
+        /// Remove a datafield
+        /// </summary>
+        /// <param name="dataField"></param>
+        public void Remove(ExcelPivotTableDataField dataField)
+        {
+            XmlElement node = dataField.Field.TopNode.SelectSingleNode(string.Format("../../d:dataFields/d:dataField[@fld={0}]", dataField.Index), dataField.NameSpaceManager) as XmlElement;
+            if (node != null)
+            {
+                node.ParentNode.RemoveChild(node);
+            }
+            _list.Remove(dataField);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Table/PivotTable/ExcelPivotTableFieldGroup.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Table/PivotTable/ExcelPivotTableFieldGroup.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Table/PivotTable/ExcelPivotTableFieldGroup.cs	(revision 12707)
@@ -0,0 +1,160 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		Added		21-MAR-2011
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Xml;
+using System.Globalization;
+
+namespace OfficeOpenXml.Table.PivotTable
+{
+    /// <summary>
+    /// Base class for pivot table field groups
+    /// </summary>
+    public class ExcelPivotTableFieldGroup : XmlHelper
+    {
+        internal ExcelPivotTableFieldGroup(XmlNamespaceManager ns, XmlNode topNode) :
+            base(ns, topNode)
+        {
+            
+        }
+    }
+    /// <summary>
+    /// A date group
+    /// </summary>
+    public class ExcelPivotTableFieldDateGroup : ExcelPivotTableFieldGroup
+    {
+        internal ExcelPivotTableFieldDateGroup(XmlNamespaceManager ns, XmlNode topNode) :
+            base(ns, topNode)
+        {
+        }
+        const string groupByPath = "d:fieldGroup/d:rangePr/@groupBy";
+        /// <summary>
+        /// How to group the date field
+        /// </summary>
+        public eDateGroupBy GroupBy
+        {
+            get
+            {
+                string v = GetXmlNodeString(groupByPath);
+                if (v != "")
+                {
+                    return (eDateGroupBy)Enum.Parse(typeof(eDateGroupBy), v, true);
+                }
+                else
+                {
+                    throw (new Exception("Invalid date Groupby"));
+                }
+            }
+            private set
+            {
+                SetXmlNodeString(groupByPath, value.ToString().ToLower(CultureInfo.InvariantCulture));
+            }
+        }
+        /// <summary>
+        /// Auto detect start date
+        /// </summary>
+        public bool AutoStart
+        {
+            get
+            {
+                return GetXmlNodeBool("@autoStart", false);
+            }
+        }
+        /// <summary>
+        /// Auto detect end date
+        /// </summary>
+        public bool AutoEnd
+        {
+            get
+            {
+                return GetXmlNodeBool("@autoStart", false);
+            }
+        }
+    }
+    /// <summary>
+    /// A pivot table field numeric grouping
+    /// </summary>
+    public class ExcelPivotTableFieldNumericGroup : ExcelPivotTableFieldGroup
+    {
+        internal ExcelPivotTableFieldNumericGroup(XmlNamespaceManager ns, XmlNode topNode) :
+            base(ns, topNode)
+        {
+        }
+        const string startPath = "d:fieldGroup/d:rangePr/@startNum";
+        /// <summary>
+        /// Start value
+        /// </summary>
+        public double Start
+        {
+            get
+            {
+                return (double)GetXmlNodeDoubleNull(startPath);
+            }
+            private set
+            {
+                SetXmlNodeString(startPath,value.ToString(CultureInfo.InvariantCulture));
+            }
+        }
+        const string endPath = "d:fieldGroup/d:rangePr/@endNum";
+        /// <summary>
+        /// End value
+        /// </summary>
+        public double End
+        {
+            get
+            {
+                return (double)GetXmlNodeDoubleNull(endPath);
+            }
+            private set
+            {
+                SetXmlNodeString(endPath, value.ToString(CultureInfo.InvariantCulture));
+            }
+        }
+        const string groupIntervalPath = "d:fieldGroup/d:rangePr/@groupInterval";
+        /// <summary>
+        /// Interval
+        /// </summary>
+        public double Interval
+        {
+            get
+            {
+                return (double)GetXmlNodeDoubleNull(groupIntervalPath);
+            }
+            private set
+            {
+                SetXmlNodeString(groupIntervalPath, value.ToString(CultureInfo.InvariantCulture));
+            }
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Table/PivotTable/ExcelPivotTableFieldItem.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Table/PivotTable/ExcelPivotTableFieldItem.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Table/PivotTable/ExcelPivotTableFieldItem.cs	(revision 12707)
@@ -0,0 +1,92 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		Added		21-MAR-2011
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Xml;
+
+namespace OfficeOpenXml.Table.PivotTable
+{
+    /// <summary>
+    /// A field Item. Used for grouping
+    /// </summary>
+    public class ExcelPivotTableFieldItem : XmlHelper
+    {
+        ExcelPivotTableField _field;
+        internal ExcelPivotTableFieldItem(XmlNamespaceManager ns, XmlNode topNode, ExcelPivotTableField field) :
+            base(ns, topNode)
+        {
+           _field = field;
+        }
+        /// <summary>
+        /// The text. Unique values only
+        /// </summary>
+        public string Text
+        {
+            get
+            {
+                return GetXmlNodeString("@n");
+            }
+            set
+            {
+                if(string.IsNullOrEmpty(value))
+                {
+                    DeleteNode("@n");
+                    return;
+                }
+                foreach (var item in _field.Items)
+                {
+                    if (item.Text == value)
+                    {
+                        throw(new ArgumentException("Duplicate Text"));
+                    }
+                }
+                SetXmlNodeString("@n", value);
+            }
+        }
+        internal int X
+        {
+            get
+            {
+                return GetXmlNodeInt("@x"); 
+            }
+        }
+        internal string T
+        {
+            get
+            {
+                return GetXmlNodeString("@t");
+            }
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Table/PivotTable/ExcelPivotTablePageFieldSettings.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Table/PivotTable/ExcelPivotTablePageFieldSettings.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Table/PivotTable/ExcelPivotTablePageFieldSettings.cs	(revision 12707)
@@ -0,0 +1,118 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		Added		21-MAR-2011
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Xml;
+
+namespace OfficeOpenXml.Table.PivotTable
+{
+    /// <summary>
+    /// A page / report filter field
+    /// </summary>
+    public class ExcelPivotTablePageFieldSettings  : XmlHelper
+    {
+        ExcelPivotTableField _field;
+        internal ExcelPivotTablePageFieldSettings(XmlNamespaceManager ns, XmlNode topNode, ExcelPivotTableField field, int index) :
+            base(ns, topNode)
+        {
+            if (GetXmlNodeString("@hier")=="")
+            {
+                Hier = -1;
+            }
+            _field = field;
+        }
+        internal int Index 
+        { 
+            get
+            {
+                return GetXmlNodeInt("@fld");
+            }
+            set
+            {
+                SetXmlNodeString("@fld",value.ToString());
+            }
+        }
+        /// <summary>
+        /// The Name of the field
+        /// </summary>
+        public string Name
+        {
+            get
+            {
+                return GetXmlNodeString("@name");
+            }
+            set
+            {
+                SetXmlNodeString("@name", value);
+            }
+        }
+        /***** Dont work. Need items to be populated. ****/
+        ///// <summary>
+        ///// The selected item 
+        ///// </summary>
+        //public int SelectedItem
+        //{
+        //    get
+        //    {
+        //        return GetXmlNodeInt("@item");
+        //    }
+        //    set
+        //    {
+        //        if (value < 0) throw new InvalidOperationException("Can't be negative");
+        //        SetXmlNodeString("@item", value.ToString());
+        //    }
+        //}
+        internal int NumFmtId
+        {
+            get
+            {
+                return GetXmlNodeInt("@numFmtId");
+            }
+            set
+            {
+                SetXmlNodeString("@numFmtId", value.ToString());
+            }
+        }
+        internal int Hier
+        {
+            get
+            {
+                return GetXmlNodeInt("@hier");
+            }
+            set
+            {
+                SetXmlNodeString("@hier", value.ToString());
+            }
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Utils/AddressUtility.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Utils/AddressUtility.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Utils/AddressUtility.cs	(revision 12707)
@@ -0,0 +1,29 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+
+namespace OfficeOpenXml.Utils
+{
+    public static class AddressUtility
+    {
+        public static string ParseEntireColumnSelections(string address)
+        {
+            string parsedAddress = address;
+            var matches = Regex.Matches(address, "[A-Z]+:[A-Z]+");
+            foreach (Match match in matches)
+            {
+                AddRowNumbersToEntireColumnRange(ref parsedAddress, match.Value);
+            }
+            return parsedAddress;
+        }
+
+        private static void AddRowNumbersToEntireColumnRange(ref string address, string range)
+        {
+            var parsedRange = string.Format("{0}{1}", range, ExcelPackage.MaxRows);
+            var splitArr = parsedRange.Split(new char[] { ':' });
+            address = address.Replace(range, string.Format("{0}1:{1}", splitArr[0], splitArr[1]));
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Utils/Argument.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Utils/Argument.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Utils/Argument.cs	(revision 12707)
@@ -0,0 +1,53 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2011-01-01
+ * Jan Källman		    License changed GPL-->LGPL  2011-12-27
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.Utils
+{
+    internal class Argument<T> : IArgument<T>
+    {
+        public Argument(T @value)
+        {
+            _value = @value;
+        }
+
+        private T _value;
+
+        T IArgument<T>.Value
+        {
+            get { return _value; }
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Utils/ArgumentExtensions.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Utils/ArgumentExtensions.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Utils/ArgumentExtensions.cs	(revision 12707)
@@ -0,0 +1,95 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2011-01-01
+ * Jan Källman		    License changed GPL-->LGPL  2011-12-27
+ *******************************************************************************/
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.Utils
+{
+    /// <summary>
+    /// Extension methods for guarding
+    /// </summary>
+    public static class ArgumentExtensions
+    {
+
+        /// <summary>
+        /// Throws an ArgumentNullException if argument is null
+        /// </summary>
+        /// <typeparam name="T">Argument type</typeparam>
+        /// <param name="argument">Argument to check</param>
+        /// <param name="argumentName">parameter/argument name</param>
+        /// <exception cref="ArgumentNullException"></exception>
+        public static void IsNotNull<T>(this IArgument<T> argument, string argumentName)
+            where T : class
+        {
+            argumentName = string.IsNullOrEmpty(argumentName) ? "value" : argumentName;
+            if (argument.Value == null)
+            {
+                throw new ArgumentNullException(argumentName);
+            }
+        }
+
+        /// <summary>
+        /// Throws an <see cref="ArgumentNullException"/> if the string argument is null or empty
+        /// </summary>
+        /// <param name="argument">Argument to check</param>
+        /// <param name="argumentName">parameter/argument name</param>
+        /// <exception cref="ArgumentNullException"></exception>
+        public static void IsNotNullOrEmpty(this IArgument<string> argument, string argumentName)
+        {
+            if (string.IsNullOrEmpty(argument.Value))
+            {
+                throw new ArgumentNullException(argumentName);
+            }
+        }
+
+        /// <summary>
+        /// Throws an ArgumentOutOfRangeException if the value of the argument is out of the supplied range
+        /// </summary>
+        /// <typeparam name="T">Type implementing <see cref="IComparable"/></typeparam>
+        /// <param name="argument">The argument to check</param>
+        /// <param name="min">Min value of the supplied range</param>
+        /// <param name="max">Max value of the supplied range</param>
+        /// <param name="argumentName">parameter/argument name</param>
+        /// <exception cref="ArgumentOutOfRangeException"></exception>
+        public static void IsInRange<T>(this IArgument<T> argument, T min, T max, string argumentName)
+            where T : IComparable
+        {
+            if (!(argument.Value.CompareTo(min) >= 0 && argument.Value.CompareTo(max) <= 0))
+            {
+                throw new ArgumentOutOfRangeException(argumentName);
+            }
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Utils/CompoundDocument.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Utils/CompoundDocument.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Utils/CompoundDocument.cs	(revision 12707)
@@ -0,0 +1,755 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Jan Källman		Added		01-01-2012
+ * Jan Källman      Added compression support 27-03-2012
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Runtime.InteropServices;
+using comTypes = System.Runtime.InteropServices.ComTypes;
+using System.IO;
+using System.Security;
+
+namespace OfficeOpenXml.Utils
+{
+#if !MONO
+    internal class CompoundDocument
+    {        
+        internal class StoragePart
+        {
+            public StoragePart()
+            {
+
+            }
+            internal Dictionary<string, StoragePart> SubStorage = new Dictionary<string, StoragePart>();
+            internal Dictionary<string, byte[]> DataStreams = new Dictionary<string, byte[]>();
+        }
+        internal StoragePart Storage = null;
+        internal CompoundDocument()
+        {
+            Storage = new CompoundDocument.StoragePart();
+        }
+        internal CompoundDocument(FileInfo fi)
+        {
+            Read(fi);
+        }
+        internal CompoundDocument(ILockBytes lb)
+        {
+            Read(lb);
+        }
+        internal CompoundDocument(byte[] doc)
+        {
+            Read(doc);
+        }
+        internal void Read(FileInfo fi)
+        {
+            var b = File.ReadAllBytes(fi.FullName);
+            Read(b);
+        }
+        [SecuritySafeCritical]
+        internal void Read(byte[] doc)
+        {
+            ILockBytes lb;
+            var iret = CreateILockBytesOnHGlobal(IntPtr.Zero, true, out lb);
+
+            IntPtr buffer = Marshal.AllocHGlobal(doc.Length);
+            Marshal.Copy(doc, 0, buffer, doc.Length);
+            UIntPtr readSize;
+            lb.WriteAt(0, buffer, doc.Length, out readSize);
+            Marshal.FreeHGlobal(buffer);
+
+            Read(lb);
+        }
+
+        [SecuritySafeCritical]
+        internal void Read(ILockBytes lb)
+        {
+            if (StgIsStorageILockBytes(lb) == 0)
+            {
+                IStorage storage = null;
+                if (StgOpenStorageOnILockBytes(
+                    lb,
+                    null,
+                    STGM.DIRECT | STGM.READ | STGM.SHARE_EXCLUSIVE,
+                    IntPtr.Zero,
+                    0,
+                    out storage) == 0)
+                {
+                    Storage = new StoragePart();
+                    ReadParts(storage, Storage);
+                    Marshal.ReleaseComObject(storage);
+                }
+            }
+            else
+            {
+                throw (new InvalidDataException(string.Format("Part is not a compound document")));
+            }
+        }
+        #region  Compression
+        /// <summary>
+        /// Compression using a run length encoding algorithm.
+        /// See MS-OVBA Section 2.4
+        /// </summary>
+        /// <param name="part">Byte array to decompress</param>
+        /// <returns></returns>
+        internal static byte[] CompressPart(byte[] part)
+        {
+            MemoryStream ms = new MemoryStream(4096);
+            BinaryWriter br = new BinaryWriter(ms);
+            br.Write((byte)1);
+
+            int compStart = 1;
+            int compEnd = 4098;
+            int decompStart = 0;
+            int decompEnd = part.Length < 4096 ? part.Length : 4096;
+
+            while (decompStart < decompEnd && compStart < compEnd)
+            {
+                byte[] chunk = CompressChunk(part, ref decompStart);
+                ushort header;
+                if (chunk == null || chunk.Length == 0)
+                {
+                    header = 4096 | 0x600;  //B=011 A=0
+                }
+                else
+                {
+                    header = (ushort)(((chunk.Length - 1) & 0xFFF));
+                    header |= 0xB000;   //B=011 A=1
+                    br.Write(header);
+                    br.Write(chunk);                    
+                }
+                decompEnd = part.Length < decompStart + 4096 ? part.Length : decompStart+4096;
+            }
+
+            
+            br.Flush();
+            return ms.ToArray();        
+        }
+        private static byte[] CompressChunk(byte[] buffer, ref int startPos)
+        {
+            var comprBuffer=new byte[4096];
+            int flagPos = 0;
+            int cPos=1;
+            int dPos = startPos;
+            int dEnd=startPos+4096 < buffer.Length? startPos+4096 : buffer.Length;
+            while(dPos<dEnd)
+            {
+                byte tokenFlags = 0;
+                for (int i = 0; i < 8; i++)
+                {
+                    if (dPos - startPos > 0)
+                    {
+                        int bestCandidate = -1;
+                        int bestLength = 0;
+                        int candidate = dPos - 1;
+                        int bitCount = GetLengthBits(dPos-startPos);
+                        int bits = (16 - bitCount);
+                        ushort lengthMask = (ushort)((0xFFFF) >> bits);
+
+                        while (candidate >= startPos)
+                        {
+                            if (buffer[candidate] == buffer[dPos])
+                            {
+                                int length = 1;
+
+                                while (buffer.Length > dPos + length && buffer[candidate + length] == buffer[dPos + length] && length < lengthMask && dPos+length < dEnd)
+                                {
+                                    length++;
+                                }
+                                if (length > bestLength)
+                                {
+                                    bestCandidate = candidate;
+                                    bestLength = length;
+                                    if (bestLength == lengthMask)
+                                    {
+                                        break;
+                                    }
+                                }
+                            }
+                            candidate--;
+                        }
+                        if (bestLength >= 3)    //Copy token
+                        {
+                            tokenFlags |= (byte)(1 << i);
+
+                            UInt16 offsetMask = (ushort)~lengthMask;
+                            ushort token = (ushort)(((ushort)(dPos - (bestCandidate+1))) << (bitCount) | (ushort)(bestLength - 3));
+                            Array.Copy(BitConverter.GetBytes(token), 0, comprBuffer, cPos, 2);
+                            dPos = dPos + bestLength;
+                            cPos += 2;
+                            //SetCopy Token                        
+                        }
+                        else
+                        {
+                            comprBuffer[cPos++] = buffer[dPos++];
+                        }
+                    }
+                    
+                    else
+                    {
+                        comprBuffer[cPos++] = buffer[dPos++];
+                    }
+                    if (dPos >= dEnd) break;
+                }
+                comprBuffer[flagPos] = tokenFlags;
+                flagPos = cPos++;
+            }
+            var ret = new byte[cPos - 1];
+            Array.Copy(comprBuffer, ret, ret.Length);
+            startPos = dEnd;
+            return ret;
+        }
+        internal static byte[] DecompressPart(byte[] part)
+        {
+            return DecompressPart(part, 0);
+        }
+        /// <summary>
+        /// Decompression using a run length encoding algorithm.
+        /// See MS-OVBA Section 2.4
+        /// </summary>
+        /// <param name="part">Byte array to decompress</param>
+        /// <param name="startPos"></param>
+        /// <returns></returns>
+        internal static byte[] DecompressPart(byte[] part, int startPos)
+        {
+
+            if (part[startPos] != 1)
+            {
+                return null;
+            }
+            MemoryStream ms = new MemoryStream(4096);
+            int compressPos = startPos + 1;
+            while(compressPos < part.Length-1)
+            {
+                DecompressChunk(ms, part, ref compressPos);
+            }
+            return ms.ToArray();
+        }
+        private static void DecompressChunk(MemoryStream ms, byte[] compBuffer, ref int pos)
+        {
+            ushort header = BitConverter.ToUInt16(compBuffer, pos);
+            int  decomprPos=0;
+            byte[] buffer = new byte[4198]; //Add an extra 100 byte. Some workbooks have overflowing worksheets.
+            int size = (int)(header & 0xFFF)+3;
+            int endPos = pos+size;
+            int a = (int)(header & 0x7000) >> 12;
+            int b = (int)(header & 0x8000) >> 15;
+            pos += 2;
+            if (b == 1) //Compressed chunk
+            {
+                while (pos < compBuffer.Length && pos < endPos)
+                {
+                    //Decompress token
+                    byte token = compBuffer[pos++];
+                    if (pos >= endPos)
+                        break;
+                    for (int i = 0; i < 8; i++)
+                    {
+                        //Literal token
+                        if ((token & (1 << i)) == 0)
+                        {
+                            ms.WriteByte(compBuffer[pos]);  
+                            buffer[decomprPos++] = compBuffer[pos++];
+                        }
+                        else //copy token
+                        {
+                            var t = BitConverter.ToUInt16(compBuffer, pos);
+                            int bitCount = GetLengthBits(decomprPos);
+                            int bits = (16 - bitCount);
+                            ushort lengthMask = (ushort)((0xFFFF) >> bits);
+                            UInt16 offsetMask = (ushort)~lengthMask;
+                            var length = (lengthMask & t) + 3;
+                            var offset = (offsetMask & t) >> (bitCount);
+                            int source = decomprPos - offset - 1;
+                            if (decomprPos + length >= buffer.Length)
+                            {
+                                // Be lenient on decompression, so extend our decompression
+                                // buffer. Excel generated VBA projects do encounter this issue.
+                                // One would think (not surprisingly that the VBA project spec)
+                                // over emphasizes the size restrictions of a DecompressionChunk.
+                                var largerBuffer = new byte[buffer.Length + 4098];
+                                Array.Copy(buffer, largerBuffer, decomprPos);
+                                buffer = largerBuffer;
+                            }
+                            
+                            // Even though we've written to the MemoryStream,
+                            // We still should decompress the token into this buffer
+                            // in case a later token needs to use the bytes we're
+                            // about to decompress.
+                            for (int c = 0; c < length; c++)
+                            {
+                                ms.WriteByte(buffer[source]); //Must copy byte-wise because copytokens can overlap compressed buffer.
+                                buffer[decomprPos++] = buffer[source++];
+                            }
+
+                            pos += 2;
+
+                        }
+                        if (pos >= endPos)
+                            break;
+                    }
+                }
+                return;
+            }
+            else //Raw chunk
+            {
+                ms.Write(compBuffer, pos, size);
+                pos += size;
+                return;
+            }
+        }
+        private static int GetLengthBits(int decompPos)
+        {
+            if (decompPos <= 16)
+            {
+                return 12;
+            }
+            else if (decompPos <= 32)
+            {
+                return 11;
+            }
+            else if (decompPos <= 64)
+            {
+                return 10;
+            }
+            else if (decompPos <= 128)
+            {
+                return 9;
+            }
+            else if (decompPos <= 256)
+            {
+                return 8;
+            }
+            else if (decompPos <= 512)
+            {
+                return 7;
+            }
+            else if (decompPos <= 1024)
+            {
+                return 6;
+            }
+            else if (decompPos <= 2048)
+            {
+                return 5;
+            }
+            else if (decompPos <= 4096)
+            {
+                return 4;
+            }
+            else
+            {
+                //We should never end up here, but if so this is the formula to calculate the bits...
+                return 12 - (int)Math.Truncate(Math.Log(decompPos - 1 >> 4, 2) + 1);
+            }
+        }
+        #endregion
+        #region "API declare"
+        [ComImport]
+        [Guid("0000000d-0000-0000-C000-000000000046")]
+        [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+        internal interface IEnumSTATSTG
+        {
+            // The user needs to allocate an STATSTG array whose size is celt. 
+            [PreserveSig]
+            uint Next(
+                uint celt,
+                [MarshalAs(UnmanagedType.LPArray), Out] 
+            System.Runtime.InteropServices.ComTypes.STATSTG[] rgelt,
+                out uint pceltFetched
+            );
+
+            void Skip(uint celt);
+
+            void Reset();
+
+            [return: MarshalAs(UnmanagedType.Interface)]
+            IEnumSTATSTG Clone();
+        }
+
+        [ComImport]
+        [Guid("0000000b-0000-0000-C000-000000000046")]
+        [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+        interface IStorage
+        {
+            void CreateStream(
+                /* [string][in] */ string pwcsName,
+                /* [in] */ uint grfMode,
+                /* [in] */ uint reserved1,
+                /* [in] */ uint reserved2,
+                /* [out] */ out comTypes.IStream ppstm);
+
+            void OpenStream(
+                /* [string][in] */ string pwcsName,
+                /* [unique][in] */ IntPtr reserved1,
+                /* [in] */ uint grfMode,
+                /* [in] */ uint reserved2,
+                /* [out] */ out comTypes.IStream ppstm);
+
+            void CreateStorage(
+                /* [string][in] */ string pwcsName,
+                /* [in] */ uint grfMode,
+                /* [in] */ uint reserved1,
+                /* [in] */ uint reserved2,
+                /* [out] */ out IStorage ppstg);
+
+            void OpenStorage(
+                /* [string][unique][in] */ string pwcsName,
+                /* [unique][in] */ IStorage pstgPriority,
+                /* [in] */ STGM grfMode,
+                /* [unique][in] */ IntPtr snbExclude,
+                /* [in] */ uint reserved,
+                /* [out] */ out IStorage ppstg);
+
+            void CopyTo(
+                [InAttribute] uint ciidExclude,
+                [InAttribute] Guid[] rgiidExclude,
+                [InAttribute] IntPtr snbExclude,
+                [InAttribute] IStorage pstgDest
+            );
+
+            void MoveElementTo(
+                /* [string][in] */ string pwcsName,
+                /* [unique][in] */ IStorage pstgDest,
+                /* [string][in] */ string pwcsNewName,
+                /* [in] */ uint grfFlags);
+
+            void Commit(
+                /* [in] */ uint grfCommitFlags);
+
+            void Revert();
+
+            void EnumElements(
+                /* [in] */ uint reserved1,
+                /* [size_is][unique][in] */ IntPtr reserved2,
+                /* [in] */ uint reserved3,
+                /* [out] */ out IEnumSTATSTG ppenum);
+
+            void DestroyElement(
+                /* [string][in] */ string pwcsName);
+
+            void RenameElement(
+                /* [string][in] */ string pwcsOldName,
+                /* [string][in] */ string pwcsNewName);
+
+            void SetElementTimes(
+                /* [string][unique][in] */ string pwcsName,
+                /* [unique][in] */ System.Runtime.InteropServices.ComTypes.FILETIME pctime,
+                /* [unique][in] */ System.Runtime.InteropServices.ComTypes.FILETIME patime,
+                /* [unique][in] */ System.Runtime.InteropServices.ComTypes.FILETIME pmtime);
+
+            void SetClass(
+                /* [in] */ Guid clsid);
+
+            void SetStateBits(
+                /* [in] */ uint grfStateBits,
+                /* [in] */ uint grfMask);
+
+            void Stat(
+                /* [out] */ out System.Runtime.InteropServices.ComTypes.STATSTG pstatstg,
+                /* [in] */ uint grfStatFlag);
+
+        }
+        [ComVisible(false)]
+        [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("0000000A-0000-0000-C000-000000000046")]
+        internal interface ILockBytes
+        {
+            void ReadAt(long ulOffset, System.IntPtr pv, int cb, out UIntPtr pcbRead);
+            void WriteAt(long ulOffset, System.IntPtr pv, int cb, out UIntPtr pcbWritten);
+            void Flush();
+            void SetSize(long cb);
+            void LockRegion(long libOffset, long cb, int dwLockType);
+            void UnlockRegion(long libOffset, long cb, int dwLockType);
+            void Stat(out System.Runtime.InteropServices.ComTypes.STATSTG pstatstg, int grfStatFlag);
+        }
+        [Flags]
+        internal enum STGM : int
+        {
+            DIRECT = 0x00000000,
+            TRANSACTED = 0x00010000,
+            SIMPLE = 0x08000000,
+            READ = 0x00000000,
+            WRITE = 0x00000001,
+            READWRITE = 0x00000002,
+            SHARE_DENY_NONE = 0x00000040,
+            SHARE_DENY_READ = 0x00000030,
+            SHARE_DENY_WRITE = 0x00000020,
+            SHARE_EXCLUSIVE = 0x00000010,
+            PRIORITY = 0x00040000,
+            DELETEONRELEASE = 0x04000000,
+            NOSCRATCH = 0x00100000,
+            CREATE = 0x00001000,
+            CONVERT = 0x00020000,
+            FAILIFTHERE = 0x00000000,
+            NOSNAPSHOT = 0x00200000,
+            DIRECT_SWMR = 0x00400000,
+        }
+
+        internal enum STATFLAG : uint
+        {
+            STATFLAG_DEFAULT = 0,
+            STATFLAG_NONAME = 1,
+            STATFLAG_NOOPEN = 2
+        }
+
+        internal enum STGTY : int
+        {
+            STGTY_STORAGE = 1,
+            STGTY_STREAM = 2,
+            STGTY_LOCKBYTES = 3,
+            STGTY_PROPERTY = 4
+        }
+
+        [DllImport("ole32.dll")]
+        private static extern int StgIsStorageFile(
+            [MarshalAs(UnmanagedType.LPWStr)] string pwcsName);
+        [DllImport("ole32.dll")]
+        private static extern int StgIsStorageILockBytes(
+            ILockBytes plkbyt);
+
+
+        [DllImport("ole32.dll")]
+        static extern int StgOpenStorage(
+            [MarshalAs(UnmanagedType.LPWStr)] string pwcsName,
+            IStorage pstgPriority,
+            STGM grfMode,
+            IntPtr snbExclude,
+            uint reserved,
+            out IStorage ppstgOpen);
+
+        [DllImport("ole32.dll")]
+        static extern int StgOpenStorageOnILockBytes(
+            ILockBytes plkbyt,
+            IStorage pStgPriority,
+            STGM grfMode,
+            IntPtr snbEnclude,
+            uint reserved,
+            out IStorage ppstgOpen);
+        [DllImport("ole32.dll")]
+        static extern int CreateILockBytesOnHGlobal(
+            IntPtr hGlobal,
+            bool fDeleteOnRelease,
+            out ILockBytes ppLkbyt);
+
+        [DllImport("ole32.dll")]
+        static extern int StgCreateDocfileOnILockBytes(ILockBytes plkbyt, STGM grfMode, int reserved, out IStorage ppstgOpen);
+
+        #endregion
+        [SecuritySafeCritical]
+        internal static int IsStorageFile(string Name)
+        {
+            return StgIsStorageFile(Name);
+        }
+        [SecuritySafeCritical]
+        internal static int IsStorageILockBytes(ILockBytes lb)
+        {
+            return StgIsStorageILockBytes(lb);
+        }
+        [SecuritySafeCritical]
+        internal static ILockBytes GetLockbyte(MemoryStream stream)
+        {
+            ILockBytes lb;
+            var iret = CreateILockBytesOnHGlobal(IntPtr.Zero, true, out lb);
+            byte[] docArray = stream.GetBuffer();
+
+            IntPtr buffer = Marshal.AllocHGlobal(docArray.Length);
+            Marshal.Copy(docArray, 0, buffer, docArray.Length);
+            UIntPtr readSize;
+            lb.WriteAt(0, buffer, docArray.Length, out readSize);
+            Marshal.FreeHGlobal(buffer);
+
+            return lb;
+        }
+        [SecuritySafeCritical]
+        private MemoryStream ReadParts(IStorage storage, StoragePart storagePart)
+        {
+            MemoryStream ret = null;
+            comTypes.STATSTG statstg;
+
+            storage.Stat(out statstg, (uint)STATFLAG.STATFLAG_DEFAULT);
+
+            IEnumSTATSTG pIEnumStatStg = null;
+            storage.EnumElements(0, IntPtr.Zero, 0, out pIEnumStatStg);
+
+            comTypes.STATSTG[] regelt = { statstg };
+            uint fetched = 0;
+            uint res = pIEnumStatStg.Next(1, regelt, out fetched);
+
+            //if (regelt[0].pwcsName == "DataSpaces")
+            //{
+            //    PrintStorage(storage, regelt[0],"");
+            //}
+            while (res != 1)
+            {
+                foreach (var item in regelt)
+                {
+                    if (item.type == 1)
+                    {
+                        IStorage subStorage;
+                        storage.OpenStorage(item.pwcsName, null, STGM.DIRECT | STGM.READ | STGM.SHARE_EXCLUSIVE, IntPtr.Zero, 0, out subStorage);
+                        StoragePart subStoragePart=new StoragePart();
+                        storagePart.SubStorage.Add(item.pwcsName, subStoragePart);
+                        ReadParts(subStorage, subStoragePart);
+                    }
+                    else
+                    {
+                        storagePart.DataStreams.Add(item.pwcsName, GetOleStream(storage, item));                    
+                    }
+                }
+                res = pIEnumStatStg.Next(1, regelt, out fetched);
+            }
+            Marshal.ReleaseComObject(pIEnumStatStg);
+            return ret;
+        }
+        // Help method to print a storage part binary to c:\temp
+        //private void PrintStorage(IStorage storage, System.Runtime.InteropServices.ComTypes.STATSTG sTATSTG, string topName)
+        //{
+        //    IStorage ds;
+        //    if (topName.Length > 0)
+        //    {
+        //        topName = topName[0] < 'A' ? topName.Substring(1, topName.Length - 1) : topName;
+        //    }
+        //    storage.OpenStorage(sTATSTG.pwcsName,
+        //        null,
+        //        (uint)(STGM.DIRECT | STGM.READ | STGM.SHARE_EXCLUSIVE),
+        //        IntPtr.Zero,
+        //        0,
+        //        out ds);
+
+        //    System.Runtime.InteropServices.ComTypes.STATSTG statstgSub;
+        //    ds.Stat(out statstgSub, (uint)STATFLAG.STATFLAG_DEFAULT);
+
+        //    IEnumSTATSTG pIEnumStatStgSub = null;
+        //    System.Runtime.InteropServices.ComTypes.STATSTG[] regeltSub = { statstgSub };
+        //    ds.EnumElements(0, IntPtr.Zero, 0, out pIEnumStatStgSub);
+
+        //    uint fetched = 0;
+        //    while (pIEnumStatStgSub.Next(1, regeltSub, out fetched) == 0)
+        //    {
+        //        string sName = regeltSub[0].pwcsName[0] < 'A' ? regeltSub[0].pwcsName.Substring(1, regeltSub[0].pwcsName.Length - 1) : regeltSub[0].pwcsName;
+        //        if (regeltSub[0].type == 1)
+        //        {
+        //            PrintStorage(ds, regeltSub[0], topName + sName + "_");
+        //        }
+        //        else if(regeltSub[0].type==2)
+        //        {
+        //            File.WriteAllBytes(@"c:\temp\" + topName + sName + ".bin", GetOleStream(ds, regeltSub[0]));
+        //        }
+        //    }
+        //}    }
+        /// <summary>
+        /// Read the stream and return it as a byte-array
+        /// </summary>
+        /// <param name="storage"></param>
+        /// <param name="statstg"></param>
+        /// <returns></returns>
+        [SecuritySafeCritical]
+        private byte[] GetOleStream(IStorage storage, comTypes.STATSTG statstg)
+        {
+            comTypes.IStream pIStream;
+            storage.OpenStream(statstg.pwcsName,
+               IntPtr.Zero,
+               (uint)(STGM.READ | STGM.SHARE_EXCLUSIVE),
+               0,
+               out pIStream);
+
+            byte[] data = new byte[statstg.cbSize];
+            pIStream.Read(data, (int)statstg.cbSize, IntPtr.Zero);
+            Marshal.ReleaseComObject(pIStream);
+
+            return data;
+        }
+
+        [SecuritySafeCritical]
+        internal byte[] Save()
+        {
+            ILockBytes lb;
+            var iret = CreateILockBytesOnHGlobal(IntPtr.Zero, true, out lb);
+
+            IStorage storage = null;
+            byte[] ret = null;
+
+            //Create the document in-memory
+            if (StgCreateDocfileOnILockBytes(lb,
+                    STGM.CREATE | STGM.READWRITE | STGM.SHARE_EXCLUSIVE | STGM.TRANSACTED, 
+                    0,
+                    out storage)==0)
+            {
+                foreach(var store in this.Storage.SubStorage)
+                {
+                    CreateStore(store.Key, store.Value, storage);
+                }
+                CreateStreams(this.Storage, storage);                                
+                lb.Flush();
+                
+                //Now copy the unmanaged stream to a byte array --> memory stream
+                var statstg = new comTypes.STATSTG();
+                lb.Stat(out statstg, 0);
+                int size = (int)statstg.cbSize;
+                IntPtr buffer = Marshal.AllocHGlobal(size);
+                UIntPtr readSize;
+                ret=new byte[size];
+                lb.ReadAt(0, buffer, size, out readSize);
+                Marshal.Copy(buffer, ret, 0, size);
+                Marshal.FreeHGlobal(buffer);
+            }
+            Marshal.ReleaseComObject(storage);
+            Marshal.ReleaseComObject(lb);
+
+            return ret;
+        }
+
+        private void CreateStore(string name, StoragePart subStore, IStorage storage)
+        {
+            IStorage subStorage;
+            storage.CreateStorage(name, (uint)(STGM.CREATE | STGM.WRITE | STGM.DIRECT | STGM.SHARE_EXCLUSIVE), 0, 0, out subStorage);
+            storage.Commit(0);
+            foreach (var store in subStore.SubStorage)
+            {
+                CreateStore(store.Key, store.Value, subStorage);
+            }
+            
+            CreateStreams(subStore, subStorage);
+        }
+
+        private void CreateStreams(StoragePart subStore, IStorage subStorage)
+        {
+            foreach (var ds in subStore.DataStreams)
+            {
+                comTypes.IStream stream;
+                subStorage.CreateStream(ds.Key, (uint)(STGM.CREATE | STGM.WRITE | STGM.DIRECT | STGM.SHARE_EXCLUSIVE), 0, 0, out stream);
+                stream.Write(ds.Value, ds.Value.Length, IntPtr.Zero);
+            }
+            subStorage.Commit(0);
+        }
+			
+    }
+#endif
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Utils/ConvertUtil.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Utils/ConvertUtil.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Utils/ConvertUtil.cs	(revision 12707)
@@ -0,0 +1,183 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+using OfficeOpenXml.FormulaParsing.ExpressionGraph;
+using System.IO;
+
+namespace OfficeOpenXml.Utils
+{
+    internal static class ConvertUtil
+    {
+        internal static bool IsNumeric(object candidate)
+        {
+            if (candidate == null) return false;
+            return (candidate.GetType().IsPrimitive || candidate is double || candidate is decimal || candidate is DateTime || candidate is TimeSpan || candidate is long);
+        }
+
+        internal static bool IsNumericString(object candidate)
+        {
+            if (candidate != null)
+            {
+                return Regex.IsMatch(candidate.ToString(), @"^[\d]+(\,[\d])?");
+            }
+            return false;
+        }
+
+        /// <summary>
+        /// Convert an object value to a double 
+        /// </summary>
+        /// <param name="v"></param>
+        /// <param name="ignoreBool"></param>
+        /// <returns></returns>
+        internal static double GetValueDouble(object v, bool ignoreBool = false)
+        {
+            double d;
+            try
+            {
+                if (ignoreBool && v is bool)
+                {
+                    return 0;
+                }
+                if (IsNumeric(v))
+                {
+                    if (v is DateTime)
+                    {
+                        d = ((DateTime)v).ToOADate();
+                    }
+                    else if (v is TimeSpan)
+                    {
+                        d = DateTime.FromOADate(0).Add((TimeSpan)v).ToOADate();
+                    }
+                    else
+                    {
+                        d = Convert.ToDouble(v, CultureInfo.InvariantCulture);
+                    }
+                }
+                else
+                {
+                    d = 0;
+                }
+            }
+
+            catch
+            {
+                d = 0;
+            }
+            return d;
+        }
+        /// <summary>
+        /// OOXML requires that "," , and &amp; be escaped, but ' and " should *not* be escaped, nor should
+        /// any extended Unicode characters. This function only encodes the required characters.
+        /// System.Security.SecurityElement.Escape() escapes ' and " as  &apos; and &quot;, so it cannot
+        /// be used reliably. System.Web.HttpUtility.HtmlEncode overreaches as well and uses the numeric
+        /// escape equivalent.
+        /// </summary>
+        /// <param name="s"></param>
+        /// <returns></returns>
+        internal static string ExcelEscapeString(string s)
+        {
+            return s.Replace("&", "&amp;").Replace("<", "&lt;").Replace(">", "&gt;");
+        }
+
+        /// <summary>
+        /// Return true if preserve space attribute is set.
+        /// </summary>
+        /// <param name="sw"></param>
+        /// <param name="t"></param>
+        /// <returns></returns>
+        internal static void ExcelEncodeString(StreamWriter sw, string t)
+        {
+            if (Regex.IsMatch(t, "(_x[0-9A-F]{4,4}_)"))
+            {
+                var match = Regex.Match(t, "(_x[0-9A-F]{4,4}_)");
+                int indexAdd = 0;
+                while (match.Success)
+                {
+                    t = t.Insert(match.Index + indexAdd, "_x005F");
+                    indexAdd += 6;
+                    match = match.NextMatch();
+                }
+            }
+            for (int i = 0; i < t.Length; i++)
+            {
+                if (t[i] <= 0x1f && t[i] != '\t' && t[i] != '\n' && t[i] != '\r') //Not Tab, CR or LF
+                {
+                    sw.Write("_x00{0}_", (t[i] < 0xa ? "0" : "") + ((int)t[i]).ToString("X"));
+                }
+                else
+                {
+                    sw.Write(t[i]);
+                }
+            }
+
+        }
+        /// <summary>
+        /// Return true if preserve space attribute is set.
+        /// </summary>
+        /// <param name="sb"></param>
+        /// <param name="t"></param>
+        /// <returns></returns>
+        internal static void ExcelEncodeString(StringBuilder sb, string t)
+        {
+            if (Regex.IsMatch(t, "(_x[0-9A-F]{4,4}_)"))
+            {
+                var match = Regex.Match(t, "(_x[0-9A-F]{4,4}_)");
+                int indexAdd = 0;
+                while (match.Success)
+                {
+                    t = t.Insert(match.Index + indexAdd, "_x005F");
+                    indexAdd += 6;
+                    match = match.NextMatch();
+                }
+            }
+            for (int i = 0; i < t.Length; i++)
+            {
+                if (t[i] <= 0x1f && t[i] != '\t' && t[i] != '\n' && t[i] != '\r') //Not Tab, CR or LF
+                {
+                    sb.AppendFormat("_x00{0}_", (t[i] < 0xa ? "0" : "") + ((int)t[i]).ToString("X"));
+                }
+                else
+                {
+                    sb.Append(t[i]);
+                }
+            }
+
+        }
+        internal static string ExcelDecodeString(string t)
+        {
+            var match = Regex.Match(t, "(_x005F|_x[0-9A-F]{4,4}_)");
+            if (!match.Success) return t;
+
+            var useNextValue = false;
+            var ret = new StringBuilder();
+            var prevIndex = 0;
+            while (match.Success)
+            {
+                if (prevIndex < match.Index) ret.Append(t.Substring(prevIndex, match.Index - prevIndex));
+                if (!useNextValue && match.Value == "_x005F")
+                {
+                    useNextValue = true;
+                }
+                else
+                {
+                    if (useNextValue)
+                    {
+                        ret.Append(match.Value);
+                        useNextValue = false;
+                    }
+                    else
+                    {
+                        ret.Append((char)int.Parse(match.Value.Substring(2, 4), NumberStyles.AllowHexSpecifier));
+                    }
+                }
+                prevIndex = match.Index + match.Length;
+                match = match.NextMatch();
+            }
+            ret.Append(t.Substring(prevIndex, t.Length - prevIndex));
+            return ret.ToString();
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Utils/EncryptedPackageHandler.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Utils/EncryptedPackageHandler.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Utils/EncryptedPackageHandler.cs	(revision 12707)
@@ -0,0 +1,200 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ **************************************************************************************
+ * This class is created with the help of the MS-OFFCRYPTO PDF documentation... http://msdn.microsoft.com/en-us/library/cc313071(office.12).aspx
+ * Decryption library for Office Open XML files(Lyquidity) and Sminks very nice example 
+ * on "Reading compound documents in c#" on Stackoverflow. Many thanks!
+ ***************************************************************************************
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Jan Källman		Added		10-AUG-2010
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Runtime.InteropServices; 
+using comTypes=System.Runtime.InteropServices.ComTypes;
+using System.IO;
+using System.Security.Cryptography;
+using System.Xml;
+namespace OfficeOpenXml.Utils
+{
+    [ComImport] 
+    [Guid("0000000d-0000-0000-C000-000000000046")] 
+    [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] 
+    internal interface IEnumSTATSTG 
+    { 
+        // The user needs to allocate an STATSTG array whose size is celt. 
+        [PreserveSig] 
+        uint Next( 
+            uint celt, 
+            [MarshalAs(UnmanagedType.LPArray), Out] 
+            System.Runtime.InteropServices.ComTypes.STATSTG[] rgelt, 
+            out uint pceltFetched 
+        ); 
+ 
+        void Skip(uint celt); 
+ 
+        void Reset(); 
+ 
+        [return: MarshalAs(UnmanagedType.Interface)] 
+        IEnumSTATSTG Clone(); 
+    } 
+ 
+    [ComImport] 
+    [Guid("0000000b-0000-0000-C000-000000000046")] 
+    [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] 
+    interface IStorage 
+    { 
+        void CreateStream( 
+            /* [string][in] */ string pwcsName, 
+            /* [in] */ uint grfMode, 
+            /* [in] */ uint reserved1, 
+            /* [in] */ uint reserved2, 
+            /* [out] */ out comTypes.IStream ppstm); 
+        
+        void OpenStream( 
+            /* [string][in] */ string pwcsName, 
+            /* [unique][in] */ IntPtr reserved1, 
+            /* [in] */ uint grfMode, 
+            /* [in] */ uint reserved2,
+            /* [out] */ out comTypes.IStream ppstm); 
+ 
+        void CreateStorage( 
+            /* [string][in] */ string pwcsName, 
+            /* [in] */ uint grfMode, 
+            /* [in] */ uint reserved1, 
+            /* [in] */ uint reserved2, 
+            /* [out] */ out IStorage ppstg); 
+ 
+        void OpenStorage( 
+            /* [string][unique][in] */ string pwcsName, 
+            /* [unique][in] */ IStorage pstgPriority, 
+            /* [in] */ uint grfMode, 
+            /* [unique][in] */ IntPtr snbExclude, 
+            /* [in] */ uint reserved, 
+            /* [out] */ out IStorage ppstg);
+
+        void CopyTo(
+            [InAttribute] uint ciidExclude,
+            [InAttribute] Guid[] rgiidExclude,
+            [InAttribute] IntPtr snbExclude,
+            [InAttribute] IStorage pstgDest
+        );
+ 
+        void MoveElementTo( 
+            /* [string][in] */ string pwcsName, 
+            /* [unique][in] */ IStorage pstgDest, 
+            /* [string][in] */ string pwcsNewName, 
+            /* [in] */ uint grfFlags); 
+ 
+        void Commit( 
+            /* [in] */ uint grfCommitFlags); 
+ 
+        void Revert(); 
+ 
+        void EnumElements( 
+            /* [in] */ uint reserved1, 
+            /* [size_is][unique][in] */ IntPtr reserved2, 
+            /* [in] */ uint reserved3, 
+            /* [out] */ out IEnumSTATSTG ppenum); 
+ 
+        void DestroyElement( 
+            /* [string][in] */ string pwcsName); 
+ 
+        void RenameElement( 
+            /* [string][in] */ string pwcsOldName, 
+            /* [string][in] */ string pwcsNewName); 
+ 
+        void SetElementTimes( 
+            /* [string][unique][in] */ string pwcsName, 
+            /* [unique][in] */ System.Runtime.InteropServices.ComTypes.FILETIME pctime, 
+            /* [unique][in] */ System.Runtime.InteropServices.ComTypes.FILETIME patime, 
+            /* [unique][in] */ System.Runtime.InteropServices.ComTypes.FILETIME pmtime); 
+ 
+        void SetClass( 
+            /* [in] */ Guid clsid); 
+ 
+        void SetStateBits( 
+            /* [in] */ uint grfStateBits, 
+            /* [in] */ uint grfMask); 
+ 
+        void Stat( 
+            /* [out] */ out System.Runtime.InteropServices.ComTypes.STATSTG pstatstg, 
+            /* [in] */ uint grfStatFlag); 
+ 
+    }
+    [ComVisible(false)]
+    [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("0000000A-0000-0000-C000-000000000046")]
+    internal interface ILockBytes
+    {
+        void ReadAt(long ulOffset, System.IntPtr pv, int cb, out UIntPtr pcbRead);
+        void WriteAt(long ulOffset, System.IntPtr pv, int cb, out UIntPtr pcbWritten);
+        void Flush();
+        void SetSize(long cb);
+        void LockRegion(long libOffset, long cb, int dwLockType);
+        void UnlockRegion(long libOffset, long cb, int dwLockType);
+        void Stat(out System.Runtime.InteropServices.ComTypes.STATSTG pstatstg, int grfStatFlag);
+    }
+    [Flags] 
+    internal enum STGM : int 
+    { 
+        DIRECT = 0x00000000, 
+        TRANSACTED = 0x00010000, 
+        SIMPLE = 0x08000000, 
+        READ = 0x00000000, 
+        WRITE = 0x00000001, 
+        READWRITE = 0x00000002, 
+        SHARE_DENY_NONE = 0x00000040, 
+        SHARE_DENY_READ = 0x00000030, 
+        SHARE_DENY_WRITE = 0x00000020, 
+        SHARE_EXCLUSIVE = 0x00000010, 
+        PRIORITY = 0x00040000, 
+        DELETEONRELEASE = 0x04000000, 
+        NOSCRATCH = 0x00100000, 
+        CREATE = 0x00001000, 
+        CONVERT = 0x00020000, 
+        FAILIFTHERE = 0x00000000, 
+        NOSNAPSHOT = 0x00200000, 
+        DIRECT_SWMR = 0x00400000, 
+    } 
+ 
+    internal enum STATFLAG : uint 
+    { 
+        STATFLAG_DEFAULT = 0, 
+        STATFLAG_NONAME = 1, 
+        STATFLAG_NOOPEN = 2 
+    } 
+ 
+    internal enum STGTY : int 
+    { 
+        STGTY_STORAGE = 1, 
+        STGTY_STREAM = 2, 
+        STGTY_LOCKBYTES = 3, 
+        STGTY_PROPERTY = 4 
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Utils/IArgument.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Utils/IArgument.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Utils/IArgument.cs	(revision 12707)
@@ -0,0 +1,48 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2011-01-01
+ * Jan Källman		    License changed GPL-->LGPL  2011-12-27
+ *******************************************************************************/
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.Utils
+{
+    /// <summary>
+    /// An argument
+    /// </summary>
+    /// <typeparam name="T">Argument Type</typeparam>
+    public interface IArgument<T>
+    {
+        T Value { get; }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Utils/IExcelCell.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Utils/IExcelCell.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Utils/IExcelCell.cs	(revision 12707)
@@ -0,0 +1,50 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Jan Källman		                Initial Release		        2009-10-01
+ * Jan Källman		License changed GPL-->LGPL 2011-12-16
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace OfficeOpenXml.Style
+{
+    internal interface IExcelCell
+    {
+        #region "public properties"
+        object Value {get;set;}
+        string StyleName { get; }
+        int StyleID { get; set; }
+        ExcelStyle Style { get; }
+        Uri Hyperlink { get; set; }
+        string Formula { get; set; }
+        string FormulaR1C1 { get; set; }
+        #endregion
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Utils/IValidationResult.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Utils/IValidationResult.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Utils/IValidationResult.cs	(revision 12707)
@@ -0,0 +1,13 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.Utils
+{
+    public interface IValidationResult
+    {
+        void IsTrue();
+        void IsFalse();
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Utils/Require.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Utils/Require.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Utils/Require.cs	(revision 12707)
@@ -0,0 +1,52 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm   		                Added       		        2011-01-01
+ * Jan Källman		    License changed GPL-->LGPL  2011-12-27
+ *******************************************************************************/
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.Utils
+{
+    /// <summary>
+    /// Utility for validation
+    /// </summary>
+    public static class Require
+    {
+        public static IArgument<T> Argument<T>(T argument)
+        {
+            return new Argument<T>(argument);
+        }
+
+
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Utils/SqRefUtility.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Utils/SqRefUtility.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Utils/SqRefUtility.cs	(revision 12707)
@@ -0,0 +1,39 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+
+namespace OfficeOpenXml.Utils
+{
+    /// <summary>
+    /// Class for handling translation between ExcelAddresses and sqref addresses.
+    /// </summary>
+    public static class SqRefUtility
+    {
+       /// <summary>
+       /// Transforms an address to a valid sqRef address.
+       /// </summary>
+       /// <param name="address">The address to transform</param>
+       /// <returns>A valid SqRef address</returns>
+       public static string ToSqRefAddress(string address)
+       {
+           Require.Argument(address).IsNotNullOrEmpty(address);
+           address = address.Replace(",", " ");
+           address = new Regex("[ ]+").Replace(address, " ");
+           return address;
+       }
+
+       /// <summary>
+       /// Transforms an sqRef address into a excel address
+       /// </summary>
+       /// <param name="address">The address to transform</param>
+       /// <returns>A valid excel address</returns>
+       public static string FromSqRefAddress(string address)
+       {
+           Require.Argument(address).IsNotNullOrEmpty(address);
+           address = address.Replace(" ", ",");
+           return address;
+       }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Utils/UriHelper.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Utils/UriHelper.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Utils/UriHelper.cs	(revision 12707)
@@ -0,0 +1,91 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.Utils
+{
+    internal class UriHelper
+    {
+        internal static Uri ResolvePartUri(Uri sourceUri, Uri targetUri)
+        {
+           if(targetUri.OriginalString.StartsWith("/"))
+            {
+                return targetUri;
+            }
+            string[] source = sourceUri.OriginalString.Split('/');
+            string[] target = targetUri.OriginalString.Split('/');
+
+            int t = target.Length - 1;
+            int s;
+            if(sourceUri.OriginalString.EndsWith("/")) //is the source a directory?
+            {
+                s = source.Length-1;
+            }
+            else
+            {
+                s=source.Length-2;
+            }
+
+            string file = target[t--];
+
+            while (t >= 0)
+            {
+                if (target[t] == ".")
+                {
+                    break;
+                }
+                else if (target[t] == "..")
+                {
+                    s--;
+                    t--;
+                }
+                else
+                {
+                    file = target[t--] + "/" + file;
+                }
+            }
+            if (s >= 0)
+            {
+                for(int i=s;i>=0;i--)
+                {
+                    file = source[i] + "/" + file;
+                }
+            }
+            return new Uri(file,UriKind.RelativeOrAbsolute);
+        }
+
+        internal static Uri GetRelativeUri(Uri WorksheetUri, Uri uri)
+        {
+            string[] source = WorksheetUri.OriginalString.Split('/');
+            string[] target = uri.OriginalString.Split('/');
+
+            int slen;
+            if (WorksheetUri.OriginalString.EndsWith("/"))
+            {
+                slen = source.Length;
+            }
+            else
+            {
+                slen = source.Length-1;
+            }
+            int i = 0;
+            while (i < slen && i < target.Length && source[i] == target[i])
+            {
+                i++;
+            }
+
+            string dirUp="";
+            for (int s = i; s < slen; s++)
+            {
+                dirUp += "../";
+            }
+            string file = "";
+            for (int t = i; t < target.Length; t++)
+            {                
+                file += (file==""?"":"/") + target[t];
+            }
+            return new Uri(dirUp+file,UriKind.Relative);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Utils/ValidationResult.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Utils/ValidationResult.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/Utils/ValidationResult.cs	(revision 12707)
@@ -0,0 +1,50 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.Utils
+{
+    public class ValidationResult : IValidationResult
+    {
+        public ValidationResult(bool result)
+            : this(result, null)
+        {
+            
+        }
+
+        public ValidationResult(bool result, string errorMessage)
+        {
+            _result = result;
+            _errorMessage = errorMessage;
+        }
+
+        private bool _result;
+        private string _errorMessage;
+
+        private void Throw()
+        {
+            if(string.IsNullOrEmpty(_errorMessage))
+            {
+                throw new InvalidOperationException();
+            }
+            throw new InvalidOperationException(_errorMessage);
+        }
+
+        void IValidationResult.IsTrue()
+        {
+            if (!_result)
+            {
+                Throw();
+            }
+        }
+
+        void IValidationResult.IsFalse()
+        {
+            if (_result)
+            {
+                Throw();
+            }
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/VBA/ExcelVBAModuleCollection.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/VBA/ExcelVBAModuleCollection.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/VBA/ExcelVBAModuleCollection.cs	(revision 12707)
@@ -0,0 +1,210 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Jan Källman		Added		12-APR-2012
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.VBA
+{
+    /// <summary>
+    /// Base class for VBA collections
+    /// </summary>
+    /// <typeparam name="T"></typeparam>
+    public class ExcelVBACollectionBase<T> : IEnumerable<T>
+    {
+        internal protected List<T> _list=new List<T>();        
+        public IEnumerator<T> GetEnumerator()
+        {
+            return _list.GetEnumerator();
+        }
+
+        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
+        {
+            return _list.GetEnumerator();
+        }
+        /// <summary>
+        /// Indexer
+        /// </summary>
+        /// <param name="Name">Name</param>
+        /// <returns></returns>
+        public T this [string Name]
+        {
+            get
+            {
+                return _list.Find((f) => f.GetType().GetProperty("Name").GetValue(f, null).ToString().Equals(Name,StringComparison.InvariantCultureIgnoreCase));
+            }
+        }
+        /// <summary>
+        /// Indexer
+        /// </summary>
+        /// <param name="Index">Position</param>
+        /// <returns></returns>
+        public T this[int Index]
+        {
+            get
+            {
+                return _list[Index];
+            }
+        }
+        /// <summary>
+        /// Number of items in the collection
+        /// </summary>
+        public int Count
+        {
+            get { return _list.Count; }
+        }
+        /// <summary>
+        /// If a specific name exists in the collection
+        /// </summary>
+        /// <param name="Name">The name</param>
+        /// <returns>True if the name exists</returns>
+        public bool Exists(string Name)
+        {
+            return _list.Exists((f) => f.GetType().GetProperty("Name").GetValue(f, null).ToString().Equals(Name,StringComparison.InvariantCultureIgnoreCase));
+        }
+        /// <summary>
+        /// Removes the item
+        /// </summary>
+        /// <param name="Item"></param>
+        public void Remove(T Item)
+        {
+            _list.Remove(Item);
+        }
+        /// <summary>
+        /// Removes the item at the specified index
+        /// </summary>
+        /// <param name="index">THe index</param>
+        public void RemoveAt(int index)
+        {
+            _list.RemoveAt(index);
+        }
+        
+        internal void Clear()
+        {
+            _list.Clear();
+        }
+    }
+    /// <summary>
+    /// Collection class for VBA modules
+    /// </summary>
+    public class ExcelVbaModuleCollection : ExcelVBACollectionBase<ExcelVBAModule>
+    {
+        ExcelVbaProject _project;
+        internal ExcelVbaModuleCollection (ExcelVbaProject project)
+	    {
+            _project=project;
+	    }
+        internal void Add(ExcelVBAModule Item)
+        {
+            _list.Add(Item);
+        }
+        /// <summary>
+        /// Adds a new VBA Module
+        /// </summary>
+        /// <param name="Name">The name of the module</param>
+        /// <returns>The module object</returns>
+        public ExcelVBAModule AddModule(string Name)
+        {
+            if (this[Name] != null)
+            {
+                throw(new ArgumentException("Vba modulename already exist."));
+            }
+            var m = new ExcelVBAModule();
+            m.Name = Name;
+            m.Type = eModuleType.Module;
+            m.Attributes._list.Add(new ExcelVbaModuleAttribute() { Name = "VB_Name", Value = Name, DataType = eAttributeDataType.String });
+            m.Type = eModuleType.Module;
+            _list.Add(m);
+            return m;
+        }
+        /// <summary>
+        /// Adds a new VBA class
+        /// </summary>
+        /// <param name="Name">The name of the class</param>
+        /// <param name="Exposed">Private or Public not createble</param>
+        /// <returns>The class object</returns>
+        public ExcelVBAModule AddClass(string Name, bool Exposed)
+        {
+            var m = new ExcelVBAModule();
+            m.Name = Name;            
+            m.Type = eModuleType.Class;
+            m.Attributes._list.Add(new ExcelVbaModuleAttribute() { Name = "VB_Name", Value = Name, DataType = eAttributeDataType.String });
+            m.Attributes._list.Add(new ExcelVbaModuleAttribute() { Name = "VB_Base", Value = "0{FCFB3D2A-A0FA-1068-A738-08002B3371B5}", DataType = eAttributeDataType.String });
+            m.Attributes._list.Add(new ExcelVbaModuleAttribute() { Name = "VB_GlobalNameSpace", Value = "False", DataType = eAttributeDataType.NonString });
+            m.Attributes._list.Add(new ExcelVbaModuleAttribute() { Name = "VB_Creatable", Value = "False", DataType = eAttributeDataType.NonString });
+            m.Attributes._list.Add(new ExcelVbaModuleAttribute() { Name = "VB_PredeclaredId", Value = "False", DataType = eAttributeDataType.NonString });
+            m.Attributes._list.Add(new ExcelVbaModuleAttribute() { Name = "VB_Exposed", Value = Exposed ? "True" : "False", DataType = eAttributeDataType.NonString });
+            m.Attributes._list.Add(new ExcelVbaModuleAttribute() { Name = "VB_TemplateDerived", Value = "False", DataType = eAttributeDataType.NonString });
+            m.Attributes._list.Add(new ExcelVbaModuleAttribute() { Name = "VB_Customizable", Value = "False", DataType = eAttributeDataType.NonString });
+
+            //m.Code = _project.GetBlankClassModule(Name, Exposed);
+            m.Private = !Exposed;
+            //m.ClassID=
+            _list.Add(m);
+            return m;
+        }
+    }
+    /// <summary>
+    /// A collection of the vba projects references
+    /// </summary>
+    public class ExcelVbaReferenceCollection : ExcelVBACollectionBase<ExcelVbaReference>
+    {        
+        internal ExcelVbaReferenceCollection()
+        {
+
+        }
+        /// <summary>
+        /// Adds a new reference 
+        /// </summary>
+        /// <param name="Item">The reference object</param>
+        public void Add(ExcelVbaReference Item)
+        {
+            _list.Add(Item);
+        }
+    }
+    /// <summary>
+    /// A collection of the module level attributes
+    /// </summary>
+    public class ExcelVbaModuleAttributesCollection : ExcelVBACollectionBase<ExcelVbaModuleAttribute>
+    {
+        internal string GetAttributeText()
+        {
+            StringBuilder sb=new StringBuilder();
+
+            foreach (var attr in this)
+            {
+                sb.AppendFormat("Attribute {0} = {1}\r\n", attr.Name, attr.DataType==eAttributeDataType.String ? "\"" + attr.Value + "\"" : attr.Value);
+            }
+            return sb.ToString();
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/VBA/ExcelVBAProject.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/VBA/ExcelVBAProject.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/VBA/ExcelVBAProject.cs	(revision 12707)
@@ -0,0 +1,1144 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * If you want to understand this code have a look at the Office VBA File Format Structure Specification (MS-OVBA.PDF) or
+ * http://msdn.microsoft.com/en-us/library/cc313094(v=office.12).aspx
+ * 
+ * * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Jan Källman		Added		26-MAR-2012
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.IO;
+using OfficeOpenXml.Utils;
+using System.Security.Cryptography.Pkcs;
+using System.Security.Cryptography.X509Certificates;
+using System.Security.Cryptography;
+using System.Text.RegularExpressions;
+
+namespace OfficeOpenXml.VBA
+{
+    /// <summary>
+    /// Represents the VBA project part of the package
+    /// </summary>
+    public class ExcelVbaProject
+    {
+        const string schemaRelVba = "http://schemas.microsoft.com/office/2006/relationships/vbaProject";
+        internal const string PartUri = @"/xl/vbaProject.bin";
+        #region Classes & Enums
+        /// <summary>
+        /// Type of system where the VBA project was created.
+        /// </summary>
+        public enum eSyskind
+        {
+            Win16 = 0,
+            Win32 = 1,
+            Macintosh = 2,
+            Win64 = 3
+        }
+
+        #endregion
+        internal ExcelVbaProject(ExcelWorkbook wb)
+        {
+            _wb = wb;
+            _pck = _wb._package.Package;
+            References = new ExcelVbaReferenceCollection();
+            Modules = new ExcelVbaModuleCollection(this);
+            var rel = _wb.Part.GetRelationshipsByType(schemaRelVba).FirstOrDefault();
+            if (rel != null)
+            {
+                Uri = UriHelper.ResolvePartUri(rel.SourceUri, rel.TargetUri);
+                Part = _pck.GetPart(Uri);
+#if !MONO
+                GetProject();                
+#endif
+            }
+            else
+            {
+                Lcid = 0;
+                Part = null;
+            }
+        }
+        internal ExcelWorkbook _wb;
+        internal Packaging.ZipPackage _pck;
+        #region Dir Stream Properties
+        /// <summary>
+        /// System kind. Default Win32.
+        /// </summary>
+        public eSyskind SystemKind { get; set; }
+        /// <summary>
+        /// Name of the project
+        /// </summary>
+        public string Name { get; set; }
+        /// <summary>
+        /// A description of the project
+        /// </summary>
+        public string Description { get; set; }
+        /// <summary>
+        /// A helpfile
+        /// </summary>
+        public string HelpFile1 { get; set; }
+        /// <summary>
+        /// Secondary helpfile
+        /// </summary>
+        public string HelpFile2 { get; set; }
+        /// <summary>
+        /// Context if refering the helpfile
+        /// </summary>
+        public int HelpContextID { get; set; }
+        /// <summary>
+        /// Conditional compilation constants
+        /// </summary>
+        public string Constants { get; set; }
+        /// <summary>
+        /// Codepage for encoding. Default is current regional setting.
+        /// </summary>
+        public int CodePage { get; internal set; }
+        internal int LibFlags { get; set; }
+        internal int MajorVersion { get; set; }
+        internal int MinorVersion { get; set; }
+        internal int Lcid { get; set; }
+        internal int LcidInvoke { get; set; }
+        internal string ProjectID { get; set; }
+        internal string ProjectStreamText { get; set; }
+        /// <summary>
+        /// Project references
+        /// </summary>        
+        public ExcelVbaReferenceCollection References { get; set; }
+        /// <summary>
+        /// Code Modules (Modules, classes, designer code)
+        /// </summary>
+        public ExcelVbaModuleCollection Modules { get; set; }
+        ExcelVbaSignature _signature = null;
+        /// <summary>
+        /// The digital signature
+        /// </summary>
+        public ExcelVbaSignature Signature
+        {
+            get
+            {
+                if (_signature == null)
+                {
+                    _signature=new ExcelVbaSignature(Part);
+                }
+                return _signature;
+            }
+        }
+        ExcelVbaProtection _protection=null;
+        /// <summary>
+        /// VBA protection 
+        /// </summary>
+        public ExcelVbaProtection Protection
+        {
+            get
+            {
+                if (_protection == null)
+                {
+                    _protection = new ExcelVbaProtection(this);
+                }
+                return _protection;
+            }
+        }
+        #endregion
+#if !MONO
+        #region Read Project
+        private void GetProject()
+        {
+
+            var stream = Part.GetStream();
+            byte[] vba;
+            vba = new byte[stream.Length];
+            stream.Read(vba, 0, (int)stream.Length);
+            Document = new CompoundDocument(vba);
+
+            ReadDirStream();
+            ProjectStreamText = Encoding.GetEncoding(CodePage).GetString(Document.Storage.DataStreams["PROJECT"]);
+            ReadModules();
+            ReadProjectProperties();
+        }
+        private void ReadModules()
+        {
+            foreach (var modul in Modules)
+            {
+                var stream = Document.Storage.SubStorage["VBA"].DataStreams[modul.streamName];
+                var byCode = CompoundDocument.DecompressPart(stream, (int)modul.ModuleOffset);
+                string code = Encoding.GetEncoding(CodePage).GetString(byCode);
+                int pos=0;
+                while(pos+9<code.Length && code.Substring(pos,9)=="Attribute")
+                {
+                    int linePos=code.IndexOf("\r\n",pos);
+                    string[] lineSplit;
+                    if(linePos>0)
+                    {
+                        lineSplit = code.Substring(pos + 9, linePos - pos - 9).Split('=');
+                    }
+                    else
+                    {
+                        lineSplit=code.Substring(pos+9).Split(new char[]{'='},1);
+                    }
+                    if (lineSplit.Length > 1)
+                    {
+                        lineSplit[1] = lineSplit[1].Trim();
+                        var attr = 
+                            new ExcelVbaModuleAttribute()
+                        {
+                            Name = lineSplit[0].Trim(),
+                            DataType = lineSplit[1].StartsWith("\"") ? eAttributeDataType.String : eAttributeDataType.NonString,
+                            Value = lineSplit[1].StartsWith("\"") ? lineSplit[1].Substring(1, lineSplit[1].Length - 2) : lineSplit[1]
+                        };
+                        modul.Attributes._list.Add(attr);
+                    }
+                    pos = linePos + 2;
+                }
+                modul.Code=code.Substring(pos);
+            }
+        }
+
+        private void ReadProjectProperties()
+        {
+            _protection = new ExcelVbaProtection(this);
+            string prevPackage = "";
+            var lines = Regex.Split(ProjectStreamText, "\r\n");
+            foreach (string line in lines)
+            {
+                if (line.StartsWith("["))
+                {
+
+                }
+                else
+                {
+                    var split = line.Split('=');
+                    if (split.Length > 1 && split[1].Length > 1 && split[1].StartsWith("\"")) //Remove any double qouates
+                    {
+                        split[1] = split[1].Substring(1, split[1].Length - 2);
+                    }
+                    switch (split[0])
+                    {
+                        case "ID":
+                            ProjectID = split[1];
+                            break;
+                        case "Document":
+                            string mn = split[1].Substring(0, split[1].IndexOf("/&H"));
+                            Modules[mn].Type = eModuleType.Document;
+                            break;
+                        case "Package":
+                            prevPackage = split[1];
+                            break;
+                        case "BaseClass":
+                            Modules[split[1]].Type = eModuleType.Designer;
+                            Modules[split[1]].ClassID = prevPackage;
+                            break;
+                        case "Module":
+                            Modules[split[1]].Type = eModuleType.Module;
+                            break;
+                        case "Class":
+                            Modules[split[1]].Type = eModuleType.Class;
+                            break;
+                        case "HelpFile":
+                        case "Name":
+                        case "HelpContextID":
+                        case "Description":
+                        case "VersionCompatible32":
+                            break;
+                        //393222000"
+                        case "CMG":
+                            byte[] cmg = Decrypt(split[1]);
+                            _protection.UserProtected = (cmg[0] & 1) != 0;
+                            _protection.HostProtected = (cmg[0] & 2) != 0;
+                            _protection.VbeProtected = (cmg[0] & 4) != 0;
+                            break;
+                        case "DPB":
+                            byte[] dpb = Decrypt(split[1]);
+                            if (dpb.Length >= 28)
+                            {
+                                byte reserved = dpb[0];
+                                var flags = new byte[3];
+                                Array.Copy(dpb, 1, flags, 0, 3);
+                                var keyNoNulls = new byte[4];
+                                _protection.PasswordKey = new byte[4];
+                                Array.Copy(dpb, 4, keyNoNulls, 0, 4);
+                                var hashNoNulls = new byte[20];
+                                _protection.PasswordHash = new byte[20];
+                                Array.Copy(dpb, 8, hashNoNulls, 0, 20);
+                                //Handle 0x00 bitwise 2.4.4.3 
+                                for (int i = 0; i < 24; i++)
+                                {
+                                    int bit = 128 >> (int)((i % 8));
+                                    if (i < 4)
+                                    {
+                                        if ((int)(flags[0] & bit) == 0)
+                                        {
+                                            _protection.PasswordKey[i] = 0;
+                                        }
+                                        else
+                                        {
+                                            _protection.PasswordKey[i] = keyNoNulls[i];
+                                        }
+                                    }
+                                    else
+                                    {
+                                        int flagIndex = (i - i % 8) / 8;
+                                        if ((int)(flags[flagIndex] & bit) == 0)
+                                        {
+                                            _protection.PasswordHash[i - 4] = 0;
+                                        }
+                                        else
+                                        {
+                                            _protection.PasswordHash[i - 4] = hashNoNulls[i - 4];
+                                        }
+                                    }
+                                }
+                            }
+                            break;
+                        case "GC":
+                            _protection.VisibilityState = Decrypt(split[1])[0] == 0xFF;
+
+                            break;
+                    }
+                }
+            }
+        }
+
+        /// <summary>
+        /// 2.4.3.3 Decryption
+        /// </summary>
+        /// <param name="value">Byte hex string</param>
+        /// <returns>The decrypted value</returns>
+        private byte[] Decrypt(string value)
+        {
+            byte[] enc = GetByte(value);
+            byte[] dec = new byte[(value.Length - 1)];
+            byte seed, version, projKey, ignoredLength;
+            seed = enc[0];
+            dec[0] = (byte)(enc[1] ^ seed);
+            dec[1] = (byte)(enc[2] ^ seed);
+            for (int i = 2; i < enc.Length - 1; i++)
+            {
+                dec[i] = (byte)(enc[i + 1] ^ (enc[i - 1] + dec[i - 1]));
+            }
+            version = dec[0];
+            projKey = dec[1];
+            ignoredLength = (byte)((seed & 6) / 2);
+            int datalength = BitConverter.ToInt32(dec, ignoredLength + 2);
+            var data = new byte[datalength];
+            Array.Copy(dec, 6 + ignoredLength, data, 0, datalength);
+            return data;
+        }
+        /// <summary>
+        /// 2.4.3.2 Encryption
+        /// </summary>
+        /// <param name="value"></param>
+        /// <returns>Byte hex string</returns>
+        private string Encrypt(byte[] value)
+        {
+            byte[] seed = new byte[1];
+            var rn = RandomNumberGenerator.Create();
+            rn.GetBytes(seed);
+            BinaryWriter br = new BinaryWriter(new MemoryStream());
+            byte[] enc = new byte[value.Length + 10];
+            enc[0] = seed[0];
+            enc[1] = (byte)(2 ^ seed[0]);
+
+            byte projKey = 0;
+
+            foreach (var c in ProjectID)
+            {
+                projKey += (byte)c;
+            }
+            enc[2] = (byte)(projKey ^ seed[0]);
+            var ignoredLength = (seed[0] & 6) / 2;
+            for (int i = 0; i < ignoredLength; i++)
+            {
+                br.Write(seed[0]);
+            }
+            br.Write(value.Length);
+            br.Write(value);
+
+            int pos = 3;
+            byte pb = projKey;
+            foreach (var b in ((MemoryStream)br.BaseStream).ToArray())
+            {
+                enc[pos] = (byte)(b ^ (enc[pos - 2] + pb));
+                pos++;
+                pb = b;
+            }
+
+            return GetString(enc, pos - 1);
+        }
+        private string GetString(byte[] value, int max)
+        {
+            string ret = "";
+            for (int i = 0; i <= max; i++)
+            {
+                if (value[i] < 16)
+                {
+                    ret += "0" + value[i].ToString("x");
+                }
+                else
+                {
+                    ret += value[i].ToString("x");
+                }
+            }
+            return ret.ToUpper(CultureInfo.InvariantCulture);
+        }
+        private byte[] GetByte(string value)
+        {
+            byte[] ret = new byte[value.Length / 2];
+            for (int i = 0; i < ret.Length; i++)
+            {
+                ret[i] = byte.Parse(value.Substring(i * 2, 2), System.Globalization.NumberStyles.AllowHexSpecifier);
+            }
+            return ret;
+        }
+        private void ReadDirStream()
+        {
+            byte[] dir = CompoundDocument.DecompressPart(Document.Storage.SubStorage["VBA"].DataStreams["dir"]);
+            MemoryStream ms = new MemoryStream(dir);
+            BinaryReader br = new BinaryReader(ms);
+            ExcelVbaReference currentRef = null;
+            string referenceName = "";
+            ExcelVBAModule currentModule = null;
+            bool terminate = false;
+            while (br.BaseStream.Position < br.BaseStream.Length && terminate == false)
+            {
+                ushort id = br.ReadUInt16();
+                uint size = br.ReadUInt32();
+                switch (id)
+                {
+                    case 0x01:
+                        SystemKind = (eSyskind)br.ReadUInt32();
+                        break;
+                    case 0x02:
+                        Lcid = (int)br.ReadUInt32();
+                        break;
+                    case 0x03:
+                        CodePage = (int)br.ReadUInt16();
+                        break;
+                    case 0x04:
+                        Name = GetString(br, size);
+                        break;
+                    case 0x05:
+                        Description = GetUnicodeString(br, size);
+                        break;
+                    case 0x06:
+                        HelpFile1 = GetString(br, size);
+                        break;
+                    case 0x3D:
+                        HelpFile2 = GetString(br, size);
+                        break;
+                    case 0x07:
+                        HelpContextID = (int)br.ReadUInt32();
+                        break;
+                    case 0x08:
+                        LibFlags = (int)br.ReadUInt32();
+                        break;
+                    case 0x09:
+                        MajorVersion = (int)br.ReadUInt32();
+                        MinorVersion = (int)br.ReadUInt16();
+                        break;
+                    case 0x0C:
+                        Constants = GetUnicodeString(br, size);
+                        break;
+                    case 0x0D:
+                        uint sizeLibID = br.ReadUInt32();
+                        var regRef = new ExcelVbaReference();
+                        regRef.Name = referenceName;
+                        regRef.ReferenceRecordID = id;
+                        regRef.Libid = GetString(br, sizeLibID);
+                        uint reserved1 = br.ReadUInt32();
+                        ushort reserved2 = br.ReadUInt16();
+                        References.Add(regRef);
+                        break;
+                    case 0x0E:
+                        var projRef = new ExcelVbaReferenceProject();
+                        projRef.ReferenceRecordID = id;
+                        projRef.Name = referenceName;
+                        sizeLibID = br.ReadUInt32();
+                        projRef.Libid = GetString(br, sizeLibID);
+                        sizeLibID = br.ReadUInt32();
+                        projRef.LibIdRelative = GetString(br, sizeLibID);
+                        projRef.MajorVersion = br.ReadUInt32();
+                        projRef.MinorVersion = br.ReadUInt16();
+                        References.Add(projRef);
+                        break;
+                    case 0x0F:
+                        ushort modualCount = br.ReadUInt16();
+                        break;
+                    case 0x13:
+                        ushort cookie = br.ReadUInt16();
+                        break;
+                    case 0x14:
+                        LcidInvoke = (int)br.ReadUInt32();
+                        break;
+                    case 0x16:
+                        referenceName = GetUnicodeString(br, size);
+                        break;
+                    case 0x19:
+                        currentModule = new ExcelVBAModule();
+                        currentModule.Name = GetUnicodeString(br, size);
+                        Modules.Add(currentModule);
+                        break;
+                    case 0x1A:
+                        currentModule.streamName = GetUnicodeString(br, size);
+                        break;
+                    case 0x1C:
+                        currentModule.Description = GetUnicodeString(br, size);
+                        break;
+                    case 0x1E:
+                        currentModule.HelpContext = (int)br.ReadUInt32();
+                        break;
+                    case 0x21:
+                    case 0x22:
+                        break;
+                    case 0x2B:      //Modul Terminator
+                        break;
+                    case 0x2C:
+                        currentModule.Cookie = br.ReadUInt16();
+                        break;
+                    case 0x31:
+                        currentModule.ModuleOffset = br.ReadUInt32();
+                        break;
+                    case 0x10:
+                        terminate = true;
+                        break;
+                    case 0x30:
+                        var extRef = (ExcelVbaReferenceControl)currentRef;
+                        var sizeExt = br.ReadUInt32();
+                        extRef.LibIdExternal = GetString(br, sizeExt);
+
+                        uint reserved4 = br.ReadUInt32();
+                        ushort reserved5 = br.ReadUInt16();
+                        extRef.OriginalTypeLib = new Guid(br.ReadBytes(16));
+                        extRef.Cookie = br.ReadUInt32();
+                        break;
+                    case 0x33:
+                        currentRef = new ExcelVbaReferenceControl();
+                        currentRef.ReferenceRecordID = id;
+                        currentRef.Name = referenceName;
+                        currentRef.Libid = GetString(br, size);
+                        References.Add(currentRef);
+                        break;
+                    case 0x2F:
+                        var contrRef = (ExcelVbaReferenceControl)currentRef;
+                        contrRef.ReferenceRecordID = id;
+
+                        var sizeTwiddled = br.ReadUInt32();
+                        contrRef.LibIdTwiddled = GetString(br, sizeTwiddled);
+                        var r1 = br.ReadUInt32();
+                        var r2 = br.ReadUInt16();
+
+                        break;
+                    case 0x25:
+                        currentModule.ReadOnly = true;
+                        break;
+                    case 0x28:
+                        currentModule.Private = true;
+                        break;
+                    default:
+                        break;
+                }
+            }
+        }
+        #endregion
+
+        #region Save Project
+        internal void Save()
+        {
+            if (Validate())
+            {
+                CompoundDocument doc = new CompoundDocument();
+                doc.Storage = new CompoundDocument.StoragePart();
+                var store = new CompoundDocument.StoragePart();
+                doc.Storage.SubStorage.Add("VBA", store);
+
+                store.DataStreams.Add("_VBA_PROJECT", CreateVBAProjectStream());
+                store.DataStreams.Add("dir", CreateDirStream());
+                foreach (var module in Modules)
+                {
+                    store.DataStreams.Add(module.Name, CompoundDocument.CompressPart(Encoding.GetEncoding(CodePage).GetBytes(module.Attributes.GetAttributeText() + module.Code)));
+                }
+
+                //Copy streams from the template, if used.
+                if (Document != null)
+                {
+                    foreach (var ss in Document.Storage.SubStorage)
+                    {
+                        if (ss.Key != "VBA")
+                        {
+                            doc.Storage.SubStorage.Add(ss.Key, ss.Value);
+                        }
+                    }
+                    foreach (var s in Document.Storage.DataStreams)
+                    {
+                        if (s.Key != "dir" && s.Key != "PROJECT" && s.Key != "PROJECTwm")
+                        {
+                            doc.Storage.DataStreams.Add(s.Key, s.Value);
+                        }
+                    }
+                }
+
+                doc.Storage.DataStreams.Add("PROJECT", CreateProjectStream());
+                doc.Storage.DataStreams.Add("PROJECTwm", CreateProjectwmStream());
+
+                if (Part == null)
+                {
+                    Uri = new Uri(PartUri, UriKind.Relative);
+                    Part = _pck.CreatePart(Uri, ExcelPackage.schemaVBA);
+                    var rel = _wb.Part.CreateRelationship(Uri, Packaging.TargetMode.Internal, schemaRelVba);
+                }
+                var vbaBuffer=doc.Save();
+                var st = Part.GetStream(FileMode.Create);
+                st.Write(vbaBuffer, 0, vbaBuffer.Length);
+                st.Flush();
+                //Save the digital signture
+                Signature.Save(this);
+            }
+        }
+
+        private bool Validate()
+        {
+            Description = Description ?? "";
+            HelpFile1 = HelpFile1 ?? "";
+            HelpFile2 = HelpFile2 ?? "";
+            Constants = Constants ?? "";
+            return true;
+        }
+
+        /// <summary>
+        /// MS-OVBA 2.3.4.1
+        /// </summary>
+        /// <returns></returns>
+        private byte[] CreateVBAProjectStream()
+        {
+            BinaryWriter bw = new BinaryWriter(new MemoryStream());
+            bw.Write((ushort)0x61CC); //Reserved1
+            bw.Write((ushort)0xFFFF); //Version
+            bw.Write((byte)0x0); //Reserved3
+            bw.Write((ushort)0x0); //Reserved4
+            return ((MemoryStream)bw.BaseStream).ToArray();
+        }
+        /// <summary>
+        /// MS-OVBA 2.3.4.1
+        /// </summary>
+        /// <returns></returns>
+        private byte[] CreateDirStream()
+        {
+            BinaryWriter bw = new BinaryWriter(new MemoryStream());
+
+            /****** PROJECTINFORMATION Record ******/
+            bw.Write((ushort)1);        //ID
+            bw.Write((uint)4);          //Size
+            bw.Write((uint)SystemKind); //SysKind
+
+            bw.Write((ushort)2);        //ID
+            bw.Write((uint)4);          //Size
+            bw.Write((uint)Lcid);       //Lcid
+
+            bw.Write((ushort)0x14);     //ID
+            bw.Write((uint)4);          //Size
+            bw.Write((uint)LcidInvoke); //Lcid Invoke
+
+            bw.Write((ushort)3);        //ID
+            bw.Write((uint)2);          //Size
+            bw.Write((ushort)CodePage);   //Codepage
+
+            //ProjectName
+            bw.Write((ushort)4);                                            //ID
+            bw.Write((uint)Name.Length);                             //Size
+            bw.Write(Encoding.GetEncoding(CodePage).GetBytes(Name)); //Project Name
+
+            //Description
+            bw.Write((ushort)5);                                            //ID
+            bw.Write((uint)Description.Length);                             //Size
+            bw.Write(Encoding.GetEncoding(CodePage).GetBytes(Description)); //Project Name
+            bw.Write((ushort)0x40);                                           //ID
+            bw.Write((uint)Description.Length*2);                           //Size
+            bw.Write(Encoding.Unicode.GetBytes(Description));               //Project Description
+
+            //Helpfiles
+            bw.Write((ushort)6);                                           //ID
+            bw.Write((uint)HelpFile1.Length);                              //Size
+            bw.Write(Encoding.GetEncoding(CodePage).GetBytes(HelpFile1));  //HelpFile1            
+            bw.Write((ushort)0x3D);                                           //ID
+            bw.Write((uint)HelpFile2.Length);                              //Size
+            bw.Write(Encoding.GetEncoding(CodePage).GetBytes(HelpFile2));  //HelpFile2
+
+            //Help context id
+            bw.Write((ushort)7);            //ID
+            bw.Write((uint)4);              //Size
+            bw.Write((uint)HelpContextID);  //Help context id
+
+            //Libflags
+            bw.Write((ushort)8);            //ID
+            bw.Write((uint)4);              //Size
+            bw.Write((uint)0);  //Help context id
+
+            //Vba Version
+            bw.Write((ushort)9);            //ID
+            bw.Write((uint)4);              //Reserved
+            bw.Write((uint)MajorVersion);   //Reserved
+            bw.Write((ushort)MinorVersion); //Help context id
+
+            //Constants
+            bw.Write((ushort)0x0C);           //ID
+            bw.Write((uint)Constants.Length);              //Size
+            bw.Write(Encoding.GetEncoding(CodePage).GetBytes(Constants));              //Help context id
+            bw.Write((ushort)0x3C);                                           //ID
+            bw.Write((uint)Constants.Length/2);                              //Size
+            bw.Write(Encoding.Unicode.GetBytes(Constants));  //HelpFile2
+
+            /****** PROJECTREFERENCES Record ******/
+            foreach (var reference in References)
+            {
+                WriteNameReference(bw, reference);
+
+                if (reference.ReferenceRecordID == 0x2F)
+                {
+                    WriteControlReference(bw, reference);
+                }
+                else if (reference.ReferenceRecordID == 0x33)
+                {
+                    WriteOrginalReference(bw, reference);
+                }
+                else if (reference.ReferenceRecordID == 0x0D)
+                {
+                    WriteRegisteredReference(bw, reference);
+                }
+                else if (reference.ReferenceRecordID == 0x0E)
+                {
+                    WriteProjectReference(bw, reference);
+                }
+            }
+
+            bw.Write((ushort)0x0F);
+            bw.Write((uint)0x02);
+            bw.Write((ushort)Modules.Count);
+            bw.Write((ushort)0x13);
+            bw.Write((uint)0x02);
+            bw.Write((ushort)0xFFFF);
+
+            foreach (var module in Modules)
+            {
+                WriteModuleRecord(bw, module);
+            }
+            bw.Write((ushort)0x10);             //Terminator
+            bw.Write((uint)0);              
+
+            return CompoundDocument.CompressPart(((MemoryStream)bw.BaseStream).ToArray());
+        }
+
+        private void WriteModuleRecord(BinaryWriter bw, ExcelVBAModule module)
+        {
+            bw.Write((ushort)0x19);
+            bw.Write((uint)module.Name.Length);
+            bw.Write(Encoding.GetEncoding(CodePage).GetBytes(module.Name));     //Name
+
+            bw.Write((ushort)0x47);
+            bw.Write((uint)module.Name.Length*2);
+            bw.Write(Encoding.Unicode.GetBytes(module.Name));                   //Name
+
+            bw.Write((ushort)0x1A);
+            bw.Write((uint)module.Name.Length);
+            bw.Write(Encoding.GetEncoding(CodePage).GetBytes(module.Name));     //Stream Name  
+
+            bw.Write((ushort)0x32);
+            bw.Write((uint)module.Name.Length*2);
+            bw.Write(Encoding.Unicode.GetBytes(module.Name));                   //Stream Name
+
+            module.Description = module.Description ?? "";
+            bw.Write((ushort)0x1C);
+            bw.Write((uint)module.Description.Length);
+            bw.Write(Encoding.GetEncoding(CodePage).GetBytes(module.Description));     //Description
+
+            bw.Write((ushort)0x48);
+            bw.Write((uint)module.Description.Length*2);
+            bw.Write(Encoding.Unicode.GetBytes(module.Description));                   //Description
+
+            bw.Write((ushort)0x31);
+            bw.Write((uint)4);
+            bw.Write((uint)0);                              //Module Stream Offset (No PerformanceCache)
+
+            bw.Write((ushort)0x1E);
+            bw.Write((uint)4);
+            bw.Write((uint)module.HelpContext);            //Help context ID
+
+            bw.Write((ushort)0x2C);
+            bw.Write((uint)2);
+            bw.Write((ushort)0xFFFF);            //Help context ID
+
+            bw.Write((ushort)(module.Type == eModuleType.Module ? 0x21 : 0x22));
+            bw.Write((uint)0);
+
+            if (module.ReadOnly)
+            {
+                bw.Write((ushort)0x25);
+                bw.Write((uint)0);              //Readonly
+            }
+
+            if (module.Private)
+            {
+                bw.Write((ushort)0x28);
+                bw.Write((uint)0);              //Private
+            }
+
+            bw.Write((ushort)0x2B);             //Terminator
+            bw.Write((uint)0);              
+        }
+
+        private void WriteNameReference(BinaryWriter bw, ExcelVbaReference reference)
+        {
+            //Name record
+            bw.Write((ushort)0x16);                                             //ID
+            bw.Write((uint)reference.Name.Length);                              //Size
+            bw.Write(Encoding.GetEncoding(CodePage).GetBytes(reference.Name));  //HelpFile1
+            bw.Write((ushort)0x3E);                                             //ID
+            bw.Write((uint)reference.Name.Length * 2);                            //Size
+            bw.Write(Encoding.Unicode.GetBytes(reference.Name));                //HelpFile2
+        }
+        private void WriteControlReference(BinaryWriter bw, ExcelVbaReference reference)
+        {
+            WriteOrginalReference(bw, reference);
+
+            bw.Write((ushort)0x2F);
+            var controlRef=(ExcelVbaReferenceControl)reference;
+            bw.Write((uint)(4 + controlRef.LibIdTwiddled.Length + 4 + 2));    // Size of SizeOfLibidTwiddled, LibidTwiddled, Reserved1, and Reserved2.
+            bw.Write((uint)controlRef.LibIdTwiddled.Length);                              //Size            
+            bw.Write(Encoding.GetEncoding(CodePage).GetBytes(controlRef.LibIdTwiddled));  //LibID
+            bw.Write((uint)0);      //Reserved1
+            bw.Write((ushort)0);    //Reserved2
+            WriteNameReference(bw, reference);  //Name record again
+            bw.Write((ushort)0x30); //Reserved3
+            bw.Write((uint)(4 + controlRef.LibIdExternal.Length + 4 + 2 + 16 + 4));    //Size of SizeOfLibidExtended, LibidExtended, Reserved4, Reserved5, OriginalTypeLib, and Cookie
+            bw.Write((uint)controlRef.LibIdExternal.Length);                              //Size            
+            bw.Write(Encoding.GetEncoding(CodePage).GetBytes(controlRef.LibIdExternal));  //LibID
+            bw.Write((uint)0);      //Reserved4
+            bw.Write((ushort)0);    //Reserved5
+            bw.Write(controlRef.OriginalTypeLib.ToByteArray());
+            bw.Write((uint)controlRef.Cookie);      //Cookie
+        }
+
+        private void WriteOrginalReference(BinaryWriter bw, ExcelVbaReference reference)
+        {
+            bw.Write((ushort)0x33);
+            bw.Write((uint)reference.Libid.Length);
+            bw.Write(Encoding.GetEncoding(CodePage).GetBytes(reference.Libid));  //LibID
+        }
+        private void WriteProjectReference(BinaryWriter bw, ExcelVbaReference reference)
+        {
+            bw.Write((ushort)0x0E);
+            var projRef = (ExcelVbaReferenceProject)reference;
+            bw.Write((uint)(4 + projRef.Libid.Length + 4 + projRef.LibIdRelative.Length+4+2));
+            bw.Write((uint)projRef.Libid.Length);
+            bw.Write(Encoding.GetEncoding(CodePage).GetBytes(projRef.Libid));  //LibAbsolute
+            bw.Write((uint)projRef.LibIdRelative.Length);
+            bw.Write(Encoding.GetEncoding(CodePage).GetBytes(projRef.LibIdRelative));  //LibIdRelative
+            bw.Write(projRef.MajorVersion);
+            bw.Write(projRef.MinorVersion);
+        }
+
+        private void WriteRegisteredReference(BinaryWriter bw, ExcelVbaReference reference)
+        {
+            bw.Write((ushort)0x0D);
+            bw.Write((uint)(4+reference.Libid.Length+4+2));
+            bw.Write((uint)reference.Libid.Length);
+            bw.Write(Encoding.GetEncoding(CodePage).GetBytes(reference.Libid));  //LibID            
+            bw.Write((uint)0);      //Reserved1
+            bw.Write((ushort)0);    //Reserved2
+        }
+
+        private byte[] CreateProjectwmStream()
+        {
+            BinaryWriter bw = new BinaryWriter(new MemoryStream());
+
+            foreach (var module in Modules)
+            {
+                bw.Write(Encoding.GetEncoding(CodePage).GetBytes(module.Name));     //Name
+                bw.Write((byte)0); //Null
+                bw.Write(Encoding.Unicode.GetBytes(module.Name));                   //Name
+                bw.Write((ushort)0); //Null
+            }
+            bw.Write((ushort)0); //Null
+            return CompoundDocument.CompressPart(((MemoryStream)bw.BaseStream).ToArray());
+        }       
+        private byte[] CreateProjectStream()
+        {
+            StringBuilder sb = new StringBuilder();
+            sb.AppendFormat("ID=\"{0}\"\r\n", ProjectID);
+            foreach(var module in Modules)
+            {
+                if (module.Type == eModuleType.Document)
+                {
+                    sb.AppendFormat("Document={0}/&H00000000\r\n", module.Name);
+                }
+                else if (module.Type == eModuleType.Module)
+                {
+                    sb.AppendFormat("Module={0}\r\n", module.Name);
+                }
+                else if (module.Type == eModuleType.Class)
+                {
+                    sb.AppendFormat("Class={0}\r\n", module.Name);
+                }
+                else
+                {
+                    //Designer
+                    sb.AppendFormat("Package={0}\r\n", module.ClassID);
+                    sb.AppendFormat("BaseClass={0}\r\n", module.Name);
+                }
+            }
+            if (HelpFile1 != "")
+            {
+                sb.AppendFormat("HelpFile={0}\r\n", HelpFile1);
+            }
+            sb.AppendFormat("Name=\"{0}\"\r\n", Name);
+            sb.AppendFormat("HelpContextID={0}\r\n", HelpContextID);
+
+            if (!string.IsNullOrEmpty(Description))
+            {
+                sb.AppendFormat("Description=\"{0}\"\r\n", Description);
+            }
+            sb.AppendFormat("VersionCompatible32=\"393222000\"\r\n");
+
+            sb.AppendFormat("CMG=\"{0}\"\r\n", WriteProtectionStat());
+            sb.AppendFormat("DPB=\"{0}\"\r\n", WritePassword());
+            sb.AppendFormat("GC=\"{0}\"\r\n\r\n", WriteVisibilityState());
+
+            sb.Append("[Host Extender Info]\r\n");
+            sb.Append("&H00000001={3832D640-CF90-11CF-8E43-00A0C911005A};VBE;&H00000000\r\n");
+            sb.Append("\r\n");
+            sb.Append("[Workspace]\r\n");
+            foreach(var module in Modules)
+            {
+                sb.AppendFormat("{0}=0, 0, 0, 0, C \r\n",module.Name);              
+            }
+            string s = sb.ToString();
+            return Encoding.GetEncoding(CodePage).GetBytes(s);
+        }
+        private string WriteProtectionStat()
+        {
+            int stat=(_protection.UserProtected ? 1:0) |  
+                     (_protection.HostProtected ? 2:0) |
+                     (_protection.VbeProtected ? 4:0);
+
+            return Encrypt(BitConverter.GetBytes(stat));    
+        }
+        private string WritePassword()
+        {
+            byte[] nullBits=new byte[3];
+            byte[] nullKey = new byte[4];
+            byte[] nullHash = new byte[20];
+            if (Protection.PasswordKey == null)
+            {
+                return Encrypt(new byte[] { 0 });
+            }
+            else
+            {
+                Array.Copy(Protection.PasswordKey, nullKey, 4);
+                Array.Copy(Protection.PasswordHash, nullHash, 20);
+
+                //Set Null bits
+                for (int i = 0; i < 24; i++)
+                {
+                    byte bit = (byte)(128 >> (int)((i % 8)));
+                    if (i < 4)
+                    {
+                        if (nullKey[i] == 0)
+                        {
+                            nullKey[i] = 1;
+                        }
+                        else
+                        {
+                            nullBits[0] |= bit;
+                        }
+                    }
+                    else
+                    {
+                        if (nullHash[i - 4] == 0)
+                        {
+                            nullHash[i - 4] = 1;
+                        }
+                        else
+                        {
+                            int byteIndex = (i - i % 8) / 8;
+                            nullBits[byteIndex] |= bit;
+                        }
+                    }
+                }
+                //Write the Password Hash Data Structure (2.4.4.1)
+                BinaryWriter bw = new BinaryWriter(new MemoryStream());
+                bw.Write((byte)0xFF);
+                bw.Write(nullBits);
+                bw.Write(nullKey);
+                bw.Write(nullHash);
+                bw.Write((byte)0);
+                return Encrypt(((MemoryStream)bw.BaseStream).ToArray());
+            }
+        }
+        private string WriteVisibilityState()
+        {
+            return Encrypt(new byte[] { (byte)(Protection.VisibilityState ? 0xFF : 0) }); 
+        }
+        #endregion
+        private string GetString(BinaryReader br, uint size)
+        {
+            return GetString(br, size, System.Text.Encoding.GetEncoding(CodePage));
+        }
+        private string GetString(BinaryReader br, uint size, Encoding enc)
+        {
+            if (size > 0)
+            {
+                byte[] byteTemp = new byte[size];
+                byteTemp = br.ReadBytes((int)size);
+                return enc.GetString(byteTemp);
+            }
+            else
+            {
+                return "";
+            }
+        }
+        private string GetUnicodeString(BinaryReader br, uint size)
+        {
+            string s = GetString(br, size);
+            int reserved = br.ReadUInt16();
+            uint sizeUC = br.ReadUInt32();
+            string sUC = GetString(br, sizeUC, System.Text.Encoding.Unicode);
+            return sUC.Length == 0 ? s : sUC;
+        }
+        internal CompoundDocument Document { get; set; }
+#endif
+        internal Packaging.ZipPackagePart Part { get; set; }
+        internal Uri Uri { get; private set; }
+#if !MONO
+        /// <summary>
+        /// Create a new VBA Project
+        /// </summary>
+        internal void Create()
+        {
+            if(Lcid>0)
+            {
+                throw (new InvalidOperationException("Package already contains a VBAProject"));
+            }
+            ProjectID = "{5DD90D76-4904-47A2-AF0D-D69B4673604E}";
+            Name = "VBAProject";
+            SystemKind = eSyskind.Win32;            //Default
+            Lcid = 1033;                            //English - United States
+            LcidInvoke = 1033;                      //English - United States
+            CodePage = Encoding.Default.CodePage;
+            MajorVersion = 1361024421;
+            MinorVersion = 6;
+            HelpContextID = 0;
+            Modules.Add(new ExcelVBAModule(_wb.CodeNameChange) { Name = "ThisWorkbook", Code = "", Attributes=GetDocumentAttributes("ThisWorkbook", "0{00020819-0000-0000-C000-000000000046}"), Type = eModuleType.Document, HelpContext = 0 });
+            foreach (var sheet in _wb.Worksheets)
+            {
+                var name = GetModuleNameFromWorksheet(sheet);
+                if (!Modules.Exists(name))
+                {
+                    Modules.Add(new ExcelVBAModule(sheet.CodeNameChange) { Name = name, Code = "", Attributes = GetDocumentAttributes(sheet.Name, "0{00020820-0000-0000-C000-000000000046}"), Type = eModuleType.Document, HelpContext = 0 });
+                }
+            }
+            _protection = new ExcelVbaProtection(this) { UserProtected = false, HostProtected = false, VbeProtected = false, VisibilityState = true };
+        }
+
+        internal string GetModuleNameFromWorksheet(ExcelWorksheet sheet)
+        {
+            var name = sheet.Name;
+            if (name.Any(c => c > 255) || this.Modules[name] != null)
+            {
+                int i = sheet.PositionID;
+                name = "Sheet" + i.ToString();
+                while (this.Modules[name] != null)
+                {
+                    name = "Sheet" + (++i).ToString(); ;
+                }
+            }            
+            return name;
+        }
+        internal ExcelVbaModuleAttributesCollection GetDocumentAttributes(string name, string clsid)
+        {
+            var attr = new ExcelVbaModuleAttributesCollection();
+            attr._list.Add(new ExcelVbaModuleAttribute() { Name = "VB_Name", Value = name, DataType = eAttributeDataType.String });
+            attr._list.Add(new ExcelVbaModuleAttribute() { Name = "VB_Base", Value = clsid, DataType = eAttributeDataType.String });
+            attr._list.Add(new ExcelVbaModuleAttribute() { Name = "VB_GlobalNameSpace", Value = "False", DataType = eAttributeDataType.NonString });
+            attr._list.Add(new ExcelVbaModuleAttribute() { Name = "VB_Creatable", Value = "False", DataType = eAttributeDataType.NonString });
+            attr._list.Add(new ExcelVbaModuleAttribute() { Name = "VB_PredeclaredId", Value = "True", DataType = eAttributeDataType.NonString });
+            attr._list.Add(new ExcelVbaModuleAttribute() { Name = "VB_Exposed", Value = "False", DataType = eAttributeDataType.NonString });
+            attr._list.Add(new ExcelVbaModuleAttribute() { Name = "VB_TemplateDerived", Value = "False", DataType = eAttributeDataType.NonString });
+            attr._list.Add(new ExcelVbaModuleAttribute() { Name = "VB_Customizable", Value = "True", DataType = eAttributeDataType.NonString });
+
+            return attr;
+        }
+
+
+        //internal string GetBlankDocumentModule(string name, string clsid)
+        //{
+        //    string ret=string.Format("Attribute VB_Name = \"{0}\"\r\n",name);
+        //    ret += string.Format("Attribute VB_Base = \"{0}\"\r\n", clsid);  //Microsoft.Office.Interop.Excel.WorksheetClass
+        //    ret += "Attribute VB_GlobalNameSpace = False\r\n";
+        //    ret += "Attribute VB_Creatable = False\r\n";
+        //    ret += "Attribute VB_PredeclaredId = True\r\n";
+        //    ret += "Attribute VB_Exposed = True\r\n";
+        //    ret += "Attribute VB_TemplateDerived = False\r\n";
+        //    ret += "Attribute VB_Customizable = True";
+        //    return ret;
+        //}
+        //internal string GetBlankModule(string name)
+        //{
+        //    return string.Format("Attribute VB_Name = \"{0}\"\r\n", name);
+        //}
+        //internal string GetBlankClassModule(string name, bool exposed)
+        //{
+        //    string ret=string.Format("Attribute VB_Name = \"{0}\"\r\n",name);
+        //    ret += string.Format("Attribute VB_Base = \"{0}\"\r\n", "0{FCFB3D2A-A0FA-1068-A738-08002B3371B5}");  
+        //    ret += "Attribute VB_GlobalNameSpace = False\r\n";
+        //    ret += "Attribute VB_Creatable = False\r\n";
+        //    ret += "Attribute VB_PredeclaredId = False\r\n";
+        //    ret += string.Format("Attribute VB_Exposed = {0}\r\n", exposed ? "True" : "False");
+        //    ret += "Attribute VB_TemplateDerived = False\r\n";
+        //    ret += "Attribute VB_Customizable = False\r\n";
+        //    return ret;
+        //}
+#endif
+        /// <summary>
+        /// Remove the project from the package
+        /// </summary>
+        public void Remove()
+        {
+            if (Part == null) return;
+
+            foreach (var rel in Part.GetRelationships())
+            {
+                _pck.DeleteRelationship(rel.Id);
+            }
+            if (_pck.PartExists(Uri))
+            {
+                _pck.DeletePart(Uri);
+            }
+            Part = null;
+            Modules.Clear();
+            References.Clear();
+            Lcid = 0;
+            LcidInvoke = 0;
+            CodePage = 0;
+            MajorVersion = 0;
+            MinorVersion = 0;
+            HelpContextID = 0;
+        }
+        public override string ToString()
+        {
+            return Name;
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/VBA/ExcelVBAReference.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/VBA/ExcelVBAReference.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/VBA/ExcelVBAReference.cs	(revision 12707)
@@ -0,0 +1,129 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Jan Källman		Added		26-MAR-2012
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.VBA
+{
+    /// <summary>
+    /// A VBA reference
+    /// </summary>
+    public class ExcelVbaReference
+    {
+        /// <summary>
+        /// Constructor.
+        /// Defaults ReferenceRecordID to 0xD
+        /// </summary>
+        public ExcelVbaReference()
+        {
+            ReferenceRecordID = 0xD;
+        }
+        /// <summary>
+        /// The reference record ID. See MS-OVBA documentation for more info. 
+        /// </summary>
+        public int ReferenceRecordID { get; internal set; }
+        /// <summary>
+        /// The name of the reference
+        /// </summary>
+        public string Name { get; set; }
+        /// <summary>
+        /// LibID
+        /// For more info check MS-OVBA 2.1.1.8 LibidReference and 2.3.4.2.2 PROJECTREFERENCES
+        /// </summary>
+        public string Libid { get; set; }
+        /// <summary>
+        /// A string representation of the object (the Name)
+        /// </summary>
+        /// <returns></returns>
+        public override string ToString()
+        {
+            return Name;
+        }
+    }
+    /// <summary>
+    /// A reference to a twiddled type library
+    /// </summary>
+    public class ExcelVbaReferenceControl : ExcelVbaReference
+    {
+        /// <summary>
+        /// Constructor.
+        /// Sets ReferenceRecordID to 0x2F
+        /// </summary>
+        public ExcelVbaReferenceControl()
+        {
+            ReferenceRecordID = 0x2F;
+        }
+        /// <summary>
+        /// LibIdExternal 
+        /// For more info check MS-OVBA 2.1.1.8 LibidReference and 2.3.4.2.2 PROJECTREFERENCES
+        /// </summary>
+        public string LibIdExternal { get; set; }
+        /// <summary>
+        /// LibIdTwiddled
+        /// For more info check MS-OVBA 2.1.1.8 LibidReference and 2.3.4.2.2 PROJECTREFERENCES
+        /// </summary>
+        public string LibIdTwiddled { get; set; }
+        /// <summary>
+        /// A GUID that specifies the Automation type library the extended type library was generated from.
+        /// </summary>
+        public Guid OriginalTypeLib { get; set; }
+        internal uint Cookie { get; set; }
+    }
+    /// <summary>
+    /// A reference to an external VBA project
+    /// </summary>
+    public class ExcelVbaReferenceProject : ExcelVbaReference
+    {
+        /// <summary>
+        /// Constructor.
+        /// Sets ReferenceRecordID to 0x0E
+        /// </summary>
+        public ExcelVbaReferenceProject()
+        {
+            ReferenceRecordID = 0x0E;
+        }
+        /// <summary>
+        /// LibIdRelative
+        /// For more info check MS-OVBA 2.1.1.8 LibidReference and 2.3.4.2.2 PROJECTREFERENCES
+        /// </summary>
+        public string LibIdRelative { get; set; }
+        /// <summary>
+        /// Major version of the referenced VBA project
+        /// </summary>
+        public uint MajorVersion { get; set; }
+        /// <summary>
+        /// Minor version of the referenced VBA project
+        /// </summary>
+        public ushort MinorVersion { get; set; }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/VBA/ExcelVBASignature.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/VBA/ExcelVBASignature.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/VBA/ExcelVBASignature.cs	(revision 12707)
@@ -0,0 +1,384 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Jan Källman		Added		26-MAR-2012
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Security.Cryptography.X509Certificates;
+using System.Security.Cryptography.Pkcs;
+using OfficeOpenXml.Utils;
+using System.IO;
+
+namespace OfficeOpenXml.VBA
+{
+    /// <summary>
+    /// The code signature properties of the project
+    /// </summary>
+    public class ExcelVbaSignature
+    {
+        const string schemaRelVbaSignature = "http://schemas.microsoft.com/office/2006/relationships/vbaProjectSignature";
+        Packaging.ZipPackagePart _vbaPart = null;
+        internal ExcelVbaSignature(Packaging.ZipPackagePart vbaPart)
+        {
+            _vbaPart = vbaPart;
+            GetSignature();
+        }
+        private void GetSignature()
+        {
+            if (_vbaPart == null) return;
+            var rel = _vbaPart.GetRelationshipsByType(schemaRelVbaSignature).FirstOrDefault();
+            if (rel != null)
+            {
+                Uri = UriHelper.ResolvePartUri(rel.SourceUri, rel.TargetUri);
+                Part = _vbaPart.Package.GetPart(Uri);
+
+                var stream = Part.GetStream();
+                BinaryReader br = new BinaryReader(stream);
+                uint cbSignature = br.ReadUInt32();        
+                uint signatureOffset = br.ReadUInt32();     //44 ??
+                uint cbSigningCertStore = br.ReadUInt32();  
+                uint certStoreOffset = br.ReadUInt32();     
+                uint cbProjectName = br.ReadUInt32();       
+                uint projectNameOffset = br.ReadUInt32();   
+                uint fTimestamp = br.ReadUInt32();
+                uint cbTimestampUrl = br.ReadUInt32();
+                uint timestampUrlOffset = br.ReadUInt32();  
+                byte[] signature = br.ReadBytes((int)cbSignature);
+                uint version = br.ReadUInt32();
+                uint fileType = br.ReadUInt32();
+
+                uint id = br.ReadUInt32();
+                while (id != 0)
+                {
+                    uint encodingType = br.ReadUInt32();
+                    uint length = br.ReadUInt32();
+                    if (length > 0)
+                    {
+                        byte[] value = br.ReadBytes((int)length);
+                        switch (id)
+                        {
+                            //Add property values here...
+                            case 0x20:
+                                Certificate = new X509Certificate2(value);
+                                break;
+                            default:
+                                break;
+                        }
+                    }
+                    id = br.ReadUInt32();
+                }
+                uint endel1 = br.ReadUInt32();  //0
+                uint endel2 = br.ReadUInt32();  //0
+                ushort rgchProjectNameBuffer = br.ReadUInt16();
+                ushort rgchTimestampBuffer = br.ReadUInt16();
+                Verifier = new SignedCms();
+                Verifier.Decode(signature);
+            }
+            else
+            {
+                Certificate = null;
+                Verifier = null;
+            }
+        }
+        //Create Oid from a bytearray
+        //private string ReadHash(byte[] content)
+        //{
+        //    StringBuilder builder = new StringBuilder();
+        //    int offset = 0x6;
+        //    if (0 < (content.Length))
+        //    {
+        //        byte num = content[offset];
+        //        byte num2 = (byte)(num / 40);
+        //        builder.Append(num2.ToString(null, null));
+        //        builder.Append(".");
+        //        num2 = (byte)(num % 40);
+        //        builder.Append(num2.ToString(null, null));
+        //        ulong num3 = 0L;
+        //        for (int i = offset + 1; i < content.Length; i++)
+        //        {
+        //            num2 = content[i];
+        //            num3 = (ulong)(ulong)(num3 << 7) + ((byte)(num2 & 0x7f));
+        //            if ((num2 & 0x80) == 0)
+        //            {
+        //                builder.Append(".");
+        //                builder.Append(num3.ToString(null, null));
+        //                num3 = 0L;
+        //            }
+        //            //1.2.840.113549.2.5
+        //        }
+        //    }
+
+
+        //    string oId = builder.ToString();
+
+        //    return oId;
+        //}
+        internal void Save(ExcelVbaProject proj)
+        {
+            if (Certificate == null)
+            {
+                return;
+            }
+            
+            if (Certificate.HasPrivateKey==false)    //No signature. Remove any Signature part
+            {
+                var storeCert = GetCertFromStore(StoreLocation.CurrentUser);
+                if (storeCert == null)
+                {
+                    storeCert = GetCertFromStore(StoreLocation.LocalMachine);
+                }
+                if (storeCert != null && storeCert.HasPrivateKey == true)
+                {
+                    Certificate = storeCert;
+                }
+                else
+                {
+                    foreach (var r in Part.GetRelationships())
+                    {
+                        Part.DeleteRelationship(r.Id);
+                    }
+                    Part.Package.DeletePart(Part.Uri);
+                    return;
+                }
+            }
+            var ms = new MemoryStream();
+            var bw = new BinaryWriter(ms);
+
+            byte[] certStore = GetCertStore();
+
+            byte[] cert = SignProject(proj);
+            bw.Write((uint)cert.Length);
+            bw.Write((uint)44);                  //?? 36 ref inside cert ??
+            bw.Write((uint)certStore.Length);    //cbSigningCertStore
+            bw.Write((uint)(cert.Length + 44));  //certStoreOffset
+            bw.Write((uint)0);                   //cbProjectName
+            bw.Write((uint)(cert.Length + certStore.Length + 44));    //projectNameOffset
+            bw.Write((uint)0);    //fTimestamp
+            bw.Write((uint)0);    //cbTimestampUrl
+            bw.Write((uint)(cert.Length + certStore.Length + 44 + 2));    //timestampUrlOffset
+            bw.Write(cert);
+            bw.Write(certStore);
+            bw.Write((ushort)0);//rgchProjectNameBuffer
+            bw.Write((ushort)0);//rgchTimestampBuffer
+            bw.Write((ushort)0);
+            bw.Flush();
+
+            var rel = proj.Part.GetRelationshipsByType(schemaRelVbaSignature).FirstOrDefault();
+            if (Part == null)
+            {
+
+                if (rel != null)
+                {
+                    Uri = rel.TargetUri;
+                    Part = proj._pck.GetPart(rel.TargetUri);
+                }
+                else
+                {
+                    Uri = new Uri("/xl/vbaProjectSignature.bin", UriKind.Relative);
+                    Part = proj._pck.CreatePart(Uri, ExcelPackage.schemaVBASignature);
+                }
+            }
+            if (rel == null)
+            {
+                proj.Part.CreateRelationship(UriHelper.ResolvePartUri(proj.Uri, Uri), Packaging.TargetMode.Internal, schemaRelVbaSignature);                
+            }
+            var b = ms.ToArray();
+            Part.GetStream(FileMode.Create).Write(b, 0, b.Length);            
+        }
+
+        private X509Certificate2 GetCertFromStore(StoreLocation loc)
+        {
+            try
+            {
+                X509Store store = new X509Store(loc);
+                store.Open(OpenFlags.ReadOnly);
+                try
+                {
+                    var storeCert = store.Certificates.Find(
+                                    X509FindType.FindByThumbprint,
+                                    Certificate.Thumbprint,
+                                    true
+                                    ).OfType<X509Certificate2>().FirstOrDefault();
+                    return storeCert;
+                }
+                finally
+                {
+                    store.Close();
+                }
+            }
+            catch
+            {
+                return null;
+            }
+        }
+
+        private byte[] GetCertStore()
+        {
+            var ms = new MemoryStream();
+            var bw = new BinaryWriter(ms);
+
+            bw.Write((uint)0); //Version
+            bw.Write((uint)0x54524543); //fileType
+
+            //SerializedCertificateEntry
+            var certData = Certificate.RawData;
+            bw.Write((uint)0x20);
+            bw.Write((uint)1);
+            bw.Write((uint)certData.Length);
+            bw.Write(certData);
+
+            //EndElementMarkerEntry
+            bw.Write((uint)0);
+            bw.Write((ulong)0);
+
+            bw.Flush();
+            return ms.ToArray();
+        }
+
+        private void WriteProp(BinaryWriter bw, int id, byte[] data)
+        {
+            bw.Write((uint)id);
+            bw.Write((uint)1);
+            bw.Write((uint)data.Length);
+            bw.Write(data);
+        }
+        internal byte[] SignProject(ExcelVbaProject proj)
+        {
+            if (!Certificate.HasPrivateKey)
+            {
+                //throw (new InvalidOperationException("The certificate doesn't have a private key"));
+                Certificate = null;
+                return null;
+            }
+            var hash = GetContentHash(proj);
+
+            BinaryWriter bw = new BinaryWriter(new MemoryStream());
+            bw.Write((byte)0x30); //Constructed Type 
+            bw.Write((byte)0x32); //Total length
+            bw.Write((byte)0x30); //Constructed Type 
+            bw.Write((byte)0x0E); //Length SpcIndirectDataContent
+            bw.Write((byte)0x06); //Oid Tag Indentifier 
+            bw.Write((byte)0x0A); //Lenght OId
+            bw.Write(new byte[] { 0x2B, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x02, 0x01, 0x1D }); //Encoded Oid 1.3.6.1.4.1.311.2.1.29
+            bw.Write((byte)0x04);   //Octet String Tag Identifier
+            bw.Write((byte)0x00);   //Zero length
+
+            bw.Write((byte)0x30); //Constructed Type (DigestInfo)
+            bw.Write((byte)0x20); //Length DigestInfo
+            bw.Write((byte)0x30); //Constructed Type (Algorithm)
+            bw.Write((byte)0x0C); //length AlgorithmIdentifier
+            bw.Write((byte)0x06); //Oid Tag Indentifier 
+            bw.Write((byte)0x08); //Lenght OId
+            bw.Write(new byte[] { 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x02, 0x05 }); //Encoded Oid for 1.2.840.113549.2.5 (AlgorithmIdentifier MD5)
+            bw.Write((byte)0x05);   //Null type identifier
+            bw.Write((byte)0x00);   //Null length
+            bw.Write((byte)0x04);   //Octet String Identifier
+            bw.Write((byte)hash.Length);   //Hash length
+            bw.Write(hash);                //Content hash
+
+            ContentInfo contentInfo = new ContentInfo(((MemoryStream)bw.BaseStream).ToArray());
+            contentInfo.ContentType.Value = "1.3.6.1.4.1.311.2.1.4";
+            Verifier = new SignedCms(contentInfo);
+            var signer = new CmsSigner(Certificate);
+            Verifier.ComputeSignature(signer, false);
+            return Verifier.Encode();
+        }
+
+        private byte[] GetContentHash(ExcelVbaProject proj)
+        {
+            //MS-OVBA 2.4.2
+            var enc = System.Text.Encoding.GetEncoding(proj.CodePage);
+            BinaryWriter bw = new BinaryWriter(new MemoryStream());
+            bw.Write(enc.GetBytes(proj.Name));
+            bw.Write(enc.GetBytes(proj.Constants));
+            foreach (var reference in proj.References)
+            {
+                if (reference.ReferenceRecordID == 0x0D)
+                {
+                    bw.Write((byte)0x7B);
+                }
+                if (reference.ReferenceRecordID == 0x0E)
+                {
+                    //var r = (ExcelVbaReferenceProject)reference;
+                    //BinaryWriter bwTemp = new BinaryWriter(new MemoryStream());
+                    //bwTemp.Write((uint)r.Libid.Length);
+                    //bwTemp.Write(enc.GetBytes(r.Libid));              
+                    //bwTemp.Write((uint)r.LibIdRelative.Length);
+                    //bwTemp.Write(enc.GetBytes(r.LibIdRelative));
+                    //bwTemp.Write(r.MajorVersion);
+                    //bwTemp.Write(r.MinorVersion);
+                    foreach (byte b in BitConverter.GetBytes((uint)reference.Libid.Length))  //Length will never be an UInt with 4 bytes that aren't 0 (> 0x00FFFFFF), so no need for the rest of the properties.
+                    {
+                        if (b != 0)
+                        {
+                            bw.Write(b);
+                        }
+                        else
+                        {
+                            break;
+                        }
+                    }
+                }
+            }
+            foreach (var module in proj.Modules)
+            {
+                var lines = module.Code.Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
+                foreach (var line in lines)
+                {
+                    if (!line.StartsWith("attribute", true, null))
+                    {
+                        bw.Write(enc.GetBytes(line));
+                    }
+                }
+            }
+            var buffer = (bw.BaseStream as MemoryStream).ToArray();
+            var hp = System.Security.Cryptography.MD5CryptoServiceProvider.Create();
+            return hp.ComputeHash(buffer);
+        }
+        /// <summary>
+        /// The certificate to sign the VBA project.
+        /// <remarks>
+        /// This certificate must have a private key.
+        /// There is no validation that the certificate is valid for codesigning, so make sure it's valid to sign Excel files (Excel 2010 is more strict that prior versions).
+        /// </remarks>
+        /// </summary>
+        public X509Certificate2 Certificate { get; set; }
+        /// <summary>
+        /// The verifier
+        /// </summary>
+        public SignedCms Verifier { get; internal set; }
+#if !MONO
+        internal CompoundDocument Signature { get; set; }
+#endif
+        internal Packaging.ZipPackagePart Part { get; set; }
+        internal Uri Uri { get; private set; }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/VBA/ExcelVbaModule.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/VBA/ExcelVbaModule.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/VBA/ExcelVbaModule.cs	(revision 12707)
@@ -0,0 +1,156 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Jan Källman		Added		26-MAR-2012
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.VBA
+{
+    /// <summary>
+    /// Type of VBA module
+    /// </summary>
+    public enum eModuleType
+    {
+        /// <summary>
+        /// A Workbook or Worksheet objects
+        /// </summary>
+        Document=0,
+        /// <summary>
+        /// A Module
+        /// </summary>
+        Module=1,
+        /// <summary>
+        /// A Class
+        /// </summary>
+        Class=2,
+        /// <summary>
+        /// Designer, typically a user form
+        /// </summary>
+        Designer=3
+    }
+    internal delegate void ModuleNameChange(string value);
+
+    /// <summary>
+    /// A VBA code module. 
+    /// </summary>
+    public class ExcelVBAModule
+    {
+        string _name = "";
+        ModuleNameChange _nameChangeCallback = null;
+        internal ExcelVBAModule()
+        {
+            Attributes = new ExcelVbaModuleAttributesCollection();
+        }
+        internal ExcelVBAModule(ModuleNameChange nameChangeCallback) :
+            this()
+        {
+            _nameChangeCallback = nameChangeCallback;
+        }
+        /// <summary>
+        /// The name of the module
+        /// </summary>
+        public string Name 
+        {   
+            get
+            {
+                return _name;
+            }
+            set
+            {
+                if (value.Any(c => c > 255))
+                {
+                    throw (new InvalidOperationException("Vba module names can't contain unicode characters"));
+                }
+                if (value != _name)
+                {
+                    _name = value;
+                    streamName = value;
+                    if (_nameChangeCallback != null)
+                    {
+                        _nameChangeCallback(value);
+                    }
+                }
+            }
+        }
+        /// <summary>
+        /// A description of the module
+        /// </summary>
+        public string Description { get; set; }
+        private string _code="";
+        /// <summary>
+        /// The code without any module level attributes.
+        /// <remarks>Can contain function level attributes.</remarks> 
+        /// </summary>
+        public string Code {
+            get
+            {
+                return _code;
+            }
+            set
+            {
+                if(value.StartsWith("Attribute",StringComparison.InvariantCultureIgnoreCase) || value.StartsWith("VERSION",StringComparison.InvariantCultureIgnoreCase))
+                {
+                    throw(new InvalidOperationException("Code can't start with an Attribute or VERSION keyword. Attributes can be accessed through the Attributes collection."));
+                }
+                _code = value;
+            }
+        }
+        /// <summary>
+        /// A reference to the helpfile
+        /// </summary>
+        public int HelpContext { get; set; }
+        /// <summary>
+        /// Module level attributes.
+        /// </summary>
+        public ExcelVbaModuleAttributesCollection Attributes { get; internal set; }
+        /// <summary>
+        /// Type of module
+        /// </summary>
+        public eModuleType Type { get; internal set; }
+        /// <summary>
+        /// If the module is readonly
+        /// </summary>
+        public bool ReadOnly { get; set; }
+        /// <summary>
+        /// If the module is private
+        /// </summary>
+        public bool Private { get; set; }
+        internal string streamName { get; set; }
+        internal ushort Cookie { get; set; }
+        internal uint ModuleOffset { get; set; }
+        internal string ClassID { get; set; }
+        public override string ToString()
+        {
+            return Name;
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/VBA/ExcelVbaModuleAttribute.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/VBA/ExcelVbaModuleAttribute.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/VBA/ExcelVbaModuleAttribute.cs	(revision 12707)
@@ -0,0 +1,45 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OfficeOpenXml.VBA
+{
+    /// <summary>
+    /// To determine if the attribute uses double quotes around the value
+    /// </summary>
+    public enum eAttributeDataType
+    {
+        /// <summary>
+        /// A string
+        /// </summary>
+        String=0,
+        /// <summary>
+        /// Not a string
+        /// </summary>
+        NonString=1
+    }
+    public class ExcelVbaModuleAttribute
+    {
+        internal ExcelVbaModuleAttribute()
+        {
+
+        }
+        /// <summary>
+        /// The name of the attribute
+        /// </summary>
+        public string Name { get; internal set; }
+        /// <summary>
+        /// The datatype. Determine if the attribute uses double quotes around the value.
+        /// </summary>
+        public eAttributeDataType DataType { get; internal set; }
+        /// <summary>
+        /// The value of the attribute without any double quotes.
+        /// </summary>
+        public string Value { get; set; }
+        public override string ToString()
+        {
+            return Name;
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/VBA/ExcelVbaProtection.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/VBA/ExcelVbaProtection.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/VBA/ExcelVbaProtection.cs	(revision 12707)
@@ -0,0 +1,112 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ *******************************************************************************
+ * Jan Källman		Added		12-APR-2012
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Security.Cryptography;
+
+namespace OfficeOpenXml.VBA
+{
+    /// <summary>
+    /// Vba security properties
+    /// </summary>
+    public class ExcelVbaProtection
+    {
+        ExcelVbaProject _project;
+        internal ExcelVbaProtection(ExcelVbaProject project)
+        {
+            _project = project;
+            VisibilityState = true;
+        }
+        /// <summary>
+        /// Specifies whether access to the VBA project was restricted by the user
+        /// </summary>
+        public bool UserProtected { get; internal set; }
+        /// <summary>
+        /// Specifies whether access to the VBA project was restricted by the VBA host application
+        /// </summary>
+        public bool HostProtected { get; internal set; }
+        /// <summary>
+        /// Specifies whether access to the VBA project was restricted by the VBA project editor
+        /// </summary>
+        public bool VbeProtected { get; internal set; }
+        /// <summary>
+        /// Specifies whether the VBA project is visible.
+        /// </summary>
+        public bool VisibilityState { get; internal set; }
+        internal byte[] PasswordHash { get; set; }
+        internal byte[] PasswordKey { get; set; }
+        /// <summary>
+        /// Password protect the VBA project.
+        /// An empty string or null will remove the password protection
+        /// </summary>
+        /// <param name="Password">The password</param>
+        public void SetPassword(string Password)
+        {
+
+            if (string.IsNullOrEmpty(Password))
+            {
+                PasswordHash = null;
+                PasswordKey = null;
+                VbeProtected = false;
+                HostProtected = false;
+                UserProtected = false;
+                VisibilityState = true;
+                _project.ProjectID = "{5DD90D76-4904-47A2-AF0D-D69B4673604E}";
+            }
+            else
+            {
+                //Join Password and Key
+                byte[] data;
+                //Set the key
+                PasswordKey = new byte[4];
+                RandomNumberGenerator r = RandomNumberGenerator.Create();
+                r.GetBytes(PasswordKey);
+
+                data = new byte[Password.Length + 4];
+                Array.Copy(Encoding.GetEncoding(_project.CodePage).GetBytes(Password), data, Password.Length);
+                VbeProtected = true;
+                VisibilityState = false;
+                Array.Copy(PasswordKey, 0, data, data.Length - 4, 4);
+
+                //Calculate Hash
+                var provider = SHA1.Create();
+                PasswordHash = provider.ComputeHash(data);
+                _project.ProjectID = "{00000000-0000-0000-0000-000000000000}";
+            }
+        }
+        //public void ValidatePassword(string Password)                     
+        //{
+
+        //}        
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/XmlHelper.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/XmlHelper.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/XmlHelper.cs	(revision 12707)
@@ -0,0 +1,830 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						         Date
+ * ******************************************************************************
+ * Jan Källman		    Initial Release		         2009-10-01
+ * Jan Källman		    License changed GPL-->LGPL 2011-12-27
+ * Eyal Seagull       Add "CreateComplexNode"    2012-04-03
+ * Eyal Seagull       Add "DeleteTopNode"        2012-04-13
+ *******************************************************************************/
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Xml;
+using OfficeOpenXml.Style;
+using System.Globalization;
+using System.IO;
+namespace OfficeOpenXml
+{
+	/// <summary>
+	/// Help class containing XML functions. 
+	/// Can be Inherited 
+	/// </summary>
+	public abstract class XmlHelper
+	{
+		internal delegate int ChangedEventHandler(StyleBase sender, Style.StyleChangeEventArgs e);
+
+		internal XmlHelper(XmlNamespaceManager nameSpaceManager)
+		{
+			TopNode = null;
+			NameSpaceManager = nameSpaceManager;
+		}
+
+		internal XmlHelper(XmlNamespaceManager nameSpaceManager, XmlNode topNode)
+		{
+			TopNode = topNode;
+			NameSpaceManager = nameSpaceManager;
+		}
+		//internal bool ChangedFlag;
+		internal XmlNamespaceManager NameSpaceManager { get; set; }
+		internal XmlNode TopNode { get; set; }
+		string[] _schemaNodeOrder = null;
+		/// <summary>
+		/// Schema order list
+		/// </summary>
+		internal string[] SchemaNodeOrder
+		{
+			get
+			{
+				return _schemaNodeOrder;
+			}
+			set
+			{
+				_schemaNodeOrder = value;
+			}
+		}
+		internal XmlNode CreateNode(string path)
+		{
+			if (path == "")
+				return TopNode;
+			else
+				return CreateNode(path, false);
+		}
+		internal XmlNode CreateNode(string path, bool insertFirst)
+		{
+			XmlNode node = TopNode;
+			XmlNode prependNode = null;
+			foreach (string subPath in path.Split('/'))
+			{
+				XmlNode subNode = node.SelectSingleNode(subPath, NameSpaceManager);
+				if (subNode == null)
+				{
+					string nodeName;
+					string nodePrefix;
+
+					string nameSpaceURI = "";
+					string[] nameSplit = subPath.Split(':');
+
+					if (SchemaNodeOrder != null && subPath[0] != '@')
+					{
+						insertFirst = false;
+						prependNode = GetPrependNode(subPath, node);
+					}
+
+					if (nameSplit.Length > 1)
+					{
+						nodePrefix = nameSplit[0];
+						if (nodePrefix[0] == '@') nodePrefix = nodePrefix.Substring(1, nodePrefix.Length - 1);
+						nameSpaceURI = NameSpaceManager.LookupNamespace(nodePrefix);
+						nodeName = nameSplit[1];
+					}
+					else
+					{
+						nodePrefix = "";
+						nameSpaceURI = "";
+						nodeName = nameSplit[0];
+					}
+					if (subPath.StartsWith("@"))
+					{
+						XmlAttribute addedAtt = node.OwnerDocument.CreateAttribute(subPath.Substring(1, subPath.Length - 1), nameSpaceURI);  //nameSpaceURI
+						node.Attributes.Append(addedAtt);
+					}
+					else
+					{
+						if (nodePrefix == "")
+						{
+							subNode = node.OwnerDocument.CreateElement(nodeName, nameSpaceURI);
+						}
+						else
+						{
+							if (nodePrefix == "" || (node.OwnerDocument != null && node.OwnerDocument.DocumentElement != null && node.OwnerDocument.DocumentElement.NamespaceURI == nameSpaceURI &&
+									node.OwnerDocument.DocumentElement.Prefix == ""))
+							{
+								subNode = node.OwnerDocument.CreateElement(nodeName, nameSpaceURI);
+							}
+							else
+							{
+								subNode = node.OwnerDocument.CreateElement(nodePrefix, nodeName, nameSpaceURI);
+							}
+						}
+						if (prependNode != null)
+						{
+							node.InsertBefore(subNode, prependNode);
+							prependNode = null;
+						}
+						else if (insertFirst)
+						{
+							node.PrependChild(subNode);
+						}
+						else
+						{
+							node.AppendChild(subNode);
+						}
+					}
+				}
+				node = subNode;
+			}
+			return node;
+		}
+
+		/// <summary>
+		/// Options to insert a node in the XmlDocument
+		/// </summary>
+		internal enum eNodeInsertOrder
+		{
+			/// <summary>
+			/// Insert as first node of "topNode"
+			/// </summary>
+			First,
+
+			/// <summary>
+			/// Insert as the last child of "topNode"
+			/// </summary>
+			Last,
+
+			/// <summary>
+			/// Insert after the "referenceNode"
+			/// </summary>
+			After,
+
+			/// <summary>
+			/// Insert before the "referenceNode"
+			/// </summary>
+			Before,
+
+			/// <summary>
+			/// Use the Schema List to insert in the right order. If the Schema list
+			/// is null or empty, consider "Last" as the selected option
+			/// </summary>
+			SchemaOrder
+		}
+
+		/// <summary>
+		/// Create a complex node. Insert the node according to SchemaOrder
+		/// using the TopNode as the parent
+		/// </summary>
+		/// <param name="path"></param>
+		/// <returns></returns>
+		internal XmlNode CreateComplexNode(
+			string path)
+		{
+			return CreateComplexNode(
+				TopNode,
+				path,
+				eNodeInsertOrder.SchemaOrder,
+				null);
+		}
+
+		/// <summary>
+		/// Create a complex node. Insert the node according to the <paramref name="path"/>
+		/// using the <paramref name="topNode"/> as the parent
+		/// </summary>
+		/// <param name="topNode"></param>
+		/// <param name="path"></param>
+		/// <returns></returns>
+		internal XmlNode CreateComplexNode(
+			XmlNode topNode,
+			string path)
+		{
+			return CreateComplexNode(
+				topNode,
+				path,
+				eNodeInsertOrder.SchemaOrder,
+				null);
+		}
+
+		/// <summary>
+		/// Creates complex XML nodes
+    /// </summary>
+    /// <remarks>
+		/// 1. "d:conditionalFormatting"
+		///		1.1. Creates/find the first "conditionalFormatting" node
+		/// 
+		/// 2. "d:conditionalFormatting/@sqref"
+		///		2.1. Creates/find the first "conditionalFormatting" node
+		///		2.2. Creates (if not exists) the @sqref attribute
+		///
+		/// 3. "d:conditionalFormatting/@id='7'/@sqref='A9:B99'"
+		///		3.1. Creates/find the first "conditionalFormatting" node
+		///		3.2. Creates/update its @id attribute to "7"
+		///		3.3. Creates/update its @sqref attribute to "A9:B99"
+		///
+		/// 4. "d:conditionalFormatting[@id='7']/@sqref='X1:X5'"
+		///		4.1. Creates/find the first "conditionalFormatting" node with @id=7
+		///		4.2. Creates/update its @sqref attribute to "X1:X5"
+		///	
+		/// 5. "d:conditionalFormatting[@id='7']/@id='8'/@sqref='X1:X5'/d:cfRule/@id='AB'"
+		///		5.1. Creates/find the first "conditionalFormatting" node with @id=7
+		///		5.2. Set its @id attribute to "8"
+		///		5.2. Creates/update its @sqref attribute and set it to "X1:X5"
+		///		5.3. Creates/find the first "cfRule" node (inside the node)
+		///		5.4. Creates/update its @id attribute to "AB"
+		///	
+		/// 6. "d:cfRule/@id=''"
+		///		6.1. Creates/find the first "cfRule" node
+		///		6.1. Remove the @id attribute
+    ///	</remarks>
+		/// <param name="topNode"></param>
+		/// <param name="path"></param>
+		/// <param name="nodeInsertOrder"></param>
+		/// <param name="referenceNode"></param>
+		/// <returns>The last node creates/found</returns>
+		internal XmlNode CreateComplexNode(
+			XmlNode topNode,
+			string path,
+			eNodeInsertOrder nodeInsertOrder,
+			XmlNode referenceNode)
+		{
+			// Path is obrigatory
+			if ((path == null) || (path == string.Empty))
+			{
+				return topNode;
+			}
+
+			XmlNode node = topNode;
+			string nameSpaceURI = string.Empty;
+
+      //TODO: BUG: when the "path" contains "/" in an attrribue value, it gives an error.
+
+			// Separate the XPath to Nodes and Attributes
+			foreach (string subPath in path.Split('/'))
+			{
+				// The subPath can be any one of those:
+				// nodeName
+				// x:nodeName
+				// nodeName[find criteria]
+				// x:nodeName[find criteria]
+				// @attribute
+				// @attribute='attribute value'
+
+				// Check if the subPath has at least one character
+				if (subPath.Length > 0)
+				{
+					// Check if the subPath is an attribute (with or without value)
+					if (subPath.StartsWith("@"))
+					{
+						// @attribute										--> Create attribute
+						// @attribute=''								--> Remove attribute
+						// @attribute='attribute value' --> Create attribute + update value
+						string[] attributeSplit = subPath.Split('=');
+						string attributeName = attributeSplit[0].Substring(1, attributeSplit[0].Length - 1);
+						string attributeValue = null;	// Null means no attribute value
+
+						// Check if we have an attribute value to set
+						if (attributeSplit.Length > 1)
+						{
+							// Remove the ' or " from the attribute value
+							attributeValue = attributeSplit[1].Replace("'", "").Replace("\"", "");
+						}
+
+						// Get the attribute (if exists)
+						XmlAttribute attribute = (XmlAttribute)(node.Attributes.GetNamedItem(attributeName));
+
+						// Remove the attribute if value is empty (not null)
+						if (attributeValue == string.Empty)
+						{
+							// Only if the attribute exists
+							if (attribute != null)
+							{
+								node.Attributes.Remove(attribute);
+							}
+						}
+						else
+						{
+							// Create the attribue if does not exists
+							if (attribute == null)
+							{
+								// Create the attribute
+								attribute = node.OwnerDocument.CreateAttribute(
+									attributeName);
+
+								// Add it to the current node
+								node.Attributes.Append(attribute);
+							}
+
+							// Update the attribute value
+							if (attributeValue != null)
+							{
+								node.Attributes[attributeName].Value = attributeValue;
+							}
+						}
+					}
+					else
+					{
+						// nodeName
+						// x:nodeName
+						// nodeName[find criteria]
+						// x:nodeName[find criteria]
+
+						// Look for the node (with or without filter criteria)
+						XmlNode subNode = node.SelectSingleNode(subPath, NameSpaceManager);
+
+						// Check if the node does not exists
+						if (subNode == null)
+						{
+							string nodeName;
+							string nodePrefix;
+							string[] nameSplit = subPath.Split(':');
+							nameSpaceURI = string.Empty;
+
+							// Check if the name has a prefix like "d:nodeName"
+							if (nameSplit.Length > 1)
+							{
+								nodePrefix = nameSplit[0];
+								nameSpaceURI = NameSpaceManager.LookupNamespace(nodePrefix);
+								nodeName = nameSplit[1];
+							}
+							else
+							{
+								nodePrefix = string.Empty;
+								nameSpaceURI = string.Empty;
+								nodeName = nameSplit[0];
+							}
+
+							// Check if we have a criteria part in the node name
+							if (nodeName.IndexOf("[") > 0)
+							{
+								// remove the criteria from the node name
+								nodeName = nodeName.Substring(0, nodeName.IndexOf("["));
+							}
+
+							if (nodePrefix == string.Empty)
+							{
+								subNode = node.OwnerDocument.CreateElement(nodeName, nameSpaceURI);
+							}
+							else
+							{
+								if (node.OwnerDocument != null
+									&& node.OwnerDocument.DocumentElement != null
+									&& node.OwnerDocument.DocumentElement.NamespaceURI == nameSpaceURI
+									&& node.OwnerDocument.DocumentElement.Prefix == string.Empty)
+								{
+									subNode = node.OwnerDocument.CreateElement(
+										nodeName,
+										nameSpaceURI);
+								}
+								else
+								{
+									subNode = node.OwnerDocument.CreateElement(
+										nodePrefix,
+										nodeName,
+										nameSpaceURI);
+								}
+							}
+
+							// Check if we need to use the "SchemaOrder"
+							if (nodeInsertOrder == eNodeInsertOrder.SchemaOrder)
+							{
+								// Check if the Schema Order List is empty
+								if ((SchemaNodeOrder == null) || (SchemaNodeOrder.Length == 0))
+								{
+									// Use the "Insert Last" option when Schema Order List is empty
+									nodeInsertOrder = eNodeInsertOrder.Last;
+								}
+								else
+								{
+									// Find the prepend node in order to insert
+									referenceNode = GetPrependNode(nodeName, node);
+
+									if (referenceNode != null)
+									{
+										nodeInsertOrder = eNodeInsertOrder.Before;
+									}
+									else
+									{
+										nodeInsertOrder = eNodeInsertOrder.Last;
+									}
+								}
+							}
+
+							switch (nodeInsertOrder)
+							{
+								case eNodeInsertOrder.After:
+									node.InsertAfter(subNode, referenceNode);
+                                    referenceNode = null;
+                                    break;
+
+								case eNodeInsertOrder.Before:
+									node.InsertBefore(subNode, referenceNode);
+                                    referenceNode = null;
+									break;
+
+								case eNodeInsertOrder.First:
+									node.PrependChild(subNode);
+									break;
+
+								case eNodeInsertOrder.Last:
+									node.AppendChild(subNode);
+									break;
+							}
+						}
+
+						// Make the newly created node the top node when the rest of the path
+						// is being evaluated. So newly created nodes will be the children of the
+						// one we just created.
+						node = subNode;
+					}
+				}
+			}
+
+			// Return the last created/found node
+			return node;
+		}
+
+		/// <summary>
+		/// return Prepend node
+		/// </summary>
+		/// <param name="nodeName">name of the node to check</param>
+		/// <param name="node">Topnode to check children</param>
+		/// <returns></returns>
+		private XmlNode GetPrependNode(string nodeName, XmlNode node)
+		{
+			int pos = GetNodePos(nodeName);
+			if (pos < 0)
+			{
+				return null;
+			}
+			XmlNode prependNode = null;
+			foreach (XmlNode childNode in node.ChildNodes)
+			{
+				int childPos = GetNodePos(childNode.Name);
+				if (childPos > -1)  //Found?
+				{
+					if (childPos > pos) //Position is before
+					{
+						prependNode = childNode;
+						break;
+					}
+				}
+			}
+			return prependNode;
+		}
+		private int GetNodePos(string nodeName)
+		{
+			int ix = nodeName.IndexOf(":");
+			if (ix > 0)
+			{
+				nodeName = nodeName.Substring(ix + 1, nodeName.Length - (ix + 1));
+			}
+			for (int i = 0; i < _schemaNodeOrder.Length; i++)
+			{
+				if (nodeName == _schemaNodeOrder[i])
+				{
+					return i;
+				}
+			}
+			return -1;
+		}
+		internal void DeleteAllNode(string path)
+		{
+			string[] split = path.Split('/');
+			XmlNode node = TopNode;
+			foreach (string s in split)
+			{
+				node = node.SelectSingleNode(s, NameSpaceManager);
+				if (node != null)
+				{
+					if (node is XmlAttribute)
+					{
+						(node as XmlAttribute).OwnerElement.Attributes.Remove(node as XmlAttribute);
+					}
+					else
+					{
+						node.ParentNode.RemoveChild(node);
+					}
+				}
+				else
+				{
+					break;
+				}
+			}
+		}
+		internal void DeleteNode(string path)
+		{
+			var node = TopNode.SelectSingleNode(path, NameSpaceManager);
+			if (node != null)
+			{
+				if (node is XmlAttribute)
+				{
+					var att = (XmlAttribute)node;
+					att.OwnerElement.Attributes.Remove(att);
+				}
+				else
+				{
+					node.ParentNode.RemoveChild(node);
+				}
+			}
+		}
+    internal void DeleteTopNode()
+    {
+      TopNode.ParentNode.RemoveChild(TopNode);
+    }
+		internal void SetXmlNodeString(string path, string value)
+		{
+			SetXmlNodeString(TopNode, path, value, false, false);
+		}
+		internal void SetXmlNodeString(string path, string value, bool removeIfBlank)
+		{
+			SetXmlNodeString(TopNode, path, value, removeIfBlank, false);
+		}
+		internal void SetXmlNodeString(XmlNode node, string path, string value)
+		{
+			SetXmlNodeString(node, path, value, false, false);
+		}
+		internal void SetXmlNodeString(XmlNode node, string path, string value, bool removeIfBlank)
+		{
+			SetXmlNodeString(node, path, value, removeIfBlank, false);
+		}
+		internal void SetXmlNodeString(XmlNode node, string path, string value, bool removeIfBlank, bool insertFirst)
+		{
+			if (node == null)
+			{
+				return;
+			}
+			if (value == "" && removeIfBlank)
+			{
+				DeleteAllNode(path);
+			}
+			else
+			{
+				XmlNode nameNode = node.SelectSingleNode(path, NameSpaceManager);
+				if (nameNode == null)
+				{
+					CreateNode(path, insertFirst);
+					nameNode = node.SelectSingleNode(path, NameSpaceManager);
+				}
+				//if (nameNode.InnerText != value) HasChanged();
+				nameNode.InnerText = value;
+			}
+		}
+		internal void SetXmlNodeBool(string path, bool value)
+		{
+			SetXmlNodeString(TopNode, path, value ? "1" : "0", false, false);
+		}
+		internal void SetXmlNodeBool(string path, bool value, bool removeIf)
+		{
+			if (value == removeIf)
+			{
+				var node = TopNode.SelectSingleNode(path, NameSpaceManager);
+				if (node != null)
+				{
+					if (node is XmlAttribute)
+					{
+						var elem = (node as XmlAttribute).OwnerElement;
+						elem.ParentNode.RemoveChild(elem);
+					}
+					else
+					{
+						TopNode.RemoveChild(node);
+					}
+				}
+			}
+			else
+			{
+				SetXmlNodeString(TopNode, path, value ? "1" : "0", false, false);
+			}
+		}
+		internal bool ExistNode(string path)
+		{
+			if (TopNode == null || TopNode.SelectSingleNode(path, NameSpaceManager) == null)
+			{
+				return false;
+			}
+			else
+			{
+				return true;
+			}
+		}
+		internal bool? GetXmlNodeBoolNullable(string path)
+		{
+			var value = GetXmlNodeString(path);
+			if (string.IsNullOrEmpty(value))
+			{
+				return null;
+			}
+			return GetXmlNodeBool(path);
+		}
+		internal bool GetXmlNodeBool(string path)
+		{
+			return GetXmlNodeBool(path, false);
+		}
+		internal bool GetXmlNodeBool(string path, bool blankValue)
+		{
+			string value = GetXmlNodeString(path);
+			if (value == "1" || value == "-1" || value.Equals("true",StringComparison.InvariantCultureIgnoreCase))
+			{
+				return true;
+			}
+			else if (value == "")
+			{
+				return blankValue;
+			}
+			else
+			{
+				return false;
+			}
+		}
+		internal int GetXmlNodeInt(string path)
+		{
+			int i;
+			if (int.TryParse(GetXmlNodeString(path), out i))
+			{
+				return i;
+			}
+			else
+			{
+				return int.MinValue;
+			}
+		}
+        internal int? GetXmlNodeIntNull(string path)
+        {
+            int i;
+            string s = GetXmlNodeString(path);
+            if (s!="" && int.TryParse(s, out i))
+            {
+                return i;
+            }
+            else
+            {
+                return null;
+            }
+        }
+
+		internal decimal GetXmlNodeDecimal(string path)
+		{
+			decimal d;
+			if (decimal.TryParse(GetXmlNodeString(path), NumberStyles.Any, CultureInfo.InvariantCulture, out d))
+			{
+				return d;
+			}
+			else
+			{
+				return 0;
+			}
+		}
+        internal decimal? GetXmlNodeDecimalNull(string path)
+        {
+            decimal d;
+            if (decimal.TryParse(GetXmlNodeString(path), NumberStyles.Any, CultureInfo.InvariantCulture, out d))
+            {
+                return d;
+            }
+            else
+            {
+                return null;
+            }
+        }
+        internal double? GetXmlNodeDoubleNull(string path)
+		{
+			string s = GetXmlNodeString(path);
+			if (s == "")
+			{
+				return null;
+			}
+			else
+			{
+				double v;
+				if (double.TryParse(s, NumberStyles.Number, CultureInfo.InvariantCulture, out v))
+				{
+					return v;
+				}
+				else
+				{
+					return null;
+				}
+			}
+		}
+		internal double GetXmlNodeDouble(string path)
+		{
+			string s = GetXmlNodeString(path);
+			if (s == "")
+			{
+				return double.NaN;
+			}
+			else
+			{
+				double v;
+				if (double.TryParse(s, NumberStyles.Number, CultureInfo.InvariantCulture, out v))
+				{
+					return v;
+				}
+				else
+				{
+					return double.NaN;
+				}
+			}
+		}
+    internal string GetXmlNodeString(XmlNode node, string path)
+    {
+      if (node == null)
+      {
+        return "";
+      }
+
+      XmlNode nameNode = node.SelectSingleNode(path, NameSpaceManager);
+
+      if (nameNode != null)
+      {
+        if (nameNode.NodeType == XmlNodeType.Attribute)
+        {
+          return nameNode.Value != null ? nameNode.Value : "";
+        }
+        else
+        {
+          return nameNode.InnerText;
+        }
+      }
+      else
+      {
+        return "";
+      }
+    }
+		internal string GetXmlNodeString(string path)
+		{
+            return GetXmlNodeString(TopNode, path);
+		}
+		internal static Uri GetNewUri(Packaging.ZipPackage package, string sUri)
+		{
+			return GetNewUri(package, sUri, 1);
+		}
+        internal static Uri GetNewUri(Packaging.ZipPackage package, string sUri, int id)
+		{
+			Uri uri;
+			do
+			{
+				uri = new Uri(string.Format(sUri, id++), UriKind.Relative);
+			}
+			while (package.PartExists(uri));
+			return uri;
+		}
+		/// <summary>
+		/// Insert the new node before any of the nodes in the comma separeted list
+		/// </summary>
+		/// <param name="parentNode">Parent node</param>
+		/// <param name="beforeNodes">comma separated list containing nodes to insert after. Left to right order</param>
+		/// <param name="newNode">The new node to be inserterd</param>
+		internal void InserAfter(XmlNode parentNode, string beforeNodes, XmlNode newNode)
+		{
+			string[] nodePaths = beforeNodes.Split(',');
+
+			foreach (string nodePath in nodePaths)
+			{
+				XmlNode node = parentNode.SelectSingleNode(nodePath, NameSpaceManager);
+				if (node != null)
+				{
+					parentNode.InsertAfter(newNode, node);
+					return;
+				}
+			}
+			parentNode.InsertAfter(newNode, null);
+		}
+        internal static void LoadXmlSafe(XmlDocument xmlDoc, Stream stream)
+        {
+            XmlReaderSettings settings = new XmlReaderSettings();
+            //Disable entity parsing (to aviod xmlbombs, External Entity Attacks etc).
+            settings.ProhibitDtd = true;
+            XmlReader reader = XmlReader.Create(stream, settings);
+            xmlDoc.Load(reader);
+        }
+        internal static void LoadXmlSafe(XmlDocument xmlDoc, string xml, Encoding encoding)
+        {
+            var stream = new MemoryStream(encoding.GetBytes(xml));
+            LoadXmlSafe(xmlDoc, stream);
+        }
+	}
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/XmlHelperFactory.cs
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/XmlHelperFactory.cs	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/XmlHelperFactory.cs	(revision 12707)
@@ -0,0 +1,64 @@
+﻿/*******************************************************************************
+ * You may amend and distribute as you like, but don't remove this header!
+ *
+ * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
+ * See http://www.codeplex.com/EPPlus for details.
+ *
+ * Copyright (C) 2011  Jan Källman
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
+ * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
+ *
+ * All code and executables are provided "as is" with no warranty either express or implied. 
+ * The author accepts no liability for any damage or loss of business that this product may cause.
+ *
+ * Code change notes:
+ * 
+ * Author							Change						Date
+ * ******************************************************************************
+ * Mats Alm 		    Initial Release		        2011-05-01
+ * Jan Källman		    License changed GPL-->LGPL  2011-12-27
+ *******************************************************************************/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Xml;
+
+namespace OfficeOpenXml
+{
+    internal class XmlHelperInstance : XmlHelper
+    {
+        internal XmlHelperInstance(XmlNamespaceManager namespaceManager)
+            : base(namespaceManager)
+        {}
+
+        internal XmlHelperInstance(XmlNamespaceManager namespaceManager, XmlNode topNode)
+            : base(namespaceManager, topNode)
+        {}
+
+    }
+
+    internal static class XmlHelperFactory
+    {
+        internal static XmlHelper Create(XmlNamespaceManager namespaceManager)
+        {
+            return new XmlHelperInstance(namespaceManager);
+        }
+
+        internal static XmlHelper Create(XmlNamespaceManager namespaceManager, XmlNode topNode)
+        {
+            return new XmlHelperInstance(namespaceManager, topNode);
+        }
+    }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/HeuristicLab.EPPlus-4.0.3/EPPlus License-4.0.3.txt
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/HeuristicLab.EPPlus-4.0.3/EPPlus License-4.0.3.txt	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/HeuristicLab.EPPlus-4.0.3/EPPlus License-4.0.3.txt	(revision 12707)
@@ -0,0 +1,147 @@
+HeuristicLab.EPPlus uses the EPPlus from http://epplus.codeplex.com/.
+                 
+GNU Library General Public License (LGPL)
+
+Version 2.1, February 1999
+
+Copyright (C) 1991, 1999 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.]
+
+Preamble
+
+The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users.
+
+This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below.
+
+When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things.
+
+To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it.
+
+For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights.
+
+We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library.
+
+To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others.
+
+Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license.
+
+Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs.
+
+When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library.
+
+We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances.
+
+For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License.
+
+In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system.
+
+Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library.
+
+The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run.
+
+TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you".
+
+A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables.
+
+The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".)
+
+"Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library.
+
+Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does.
+
+1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library.
+
+You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.
+
+2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:
+
+a) The modified work must itself be a software library.
+
+b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change.
+
+c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License.
+
+d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful.
+
+(For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.
+
+3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices.
+
+Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy.
+
+This option is useful when you wish to copy part of the code of the Library into a program that is not a library.
+
+4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange.
+
+If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code.
+
+5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License.
+
+However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables.
+
+When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law.
+
+If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.)
+
+Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself.
+
+6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications.
+
+You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things:
+
+a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.)
+
+b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with.
+
+c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution.
+
+d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place.
+
+e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy.
+
+For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.
+
+It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute.
+
+7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things:
+
+a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above.
+
+b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work.
+
+8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.
+
+9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it.
+
+10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License.
+
+11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.
+
+This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.
+
+12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.
+
+13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation.
+
+14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.
+
+NO WARRANTY
+
+15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/HeuristicLab.EPPlus-4.0.3/HeuristicLab.EPPlus-4.0.3.csproj
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/HeuristicLab.EPPlus-4.0.3/HeuristicLab.EPPlus-4.0.3.csproj	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/HeuristicLab.EPPlus-4.0.3/HeuristicLab.EPPlus-4.0.3.csproj	(revision 12707)
@@ -0,0 +1,137 @@
+﻿<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{675A6EE4-DE7C-413E-8BEF-EB21E0384C87}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>HeuristicLab.EPPlus</RootNamespace>
+    <AssemblyName>HeuristicLab.EPPlus-4.0.3</AssemblyName>
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <TargetFrameworkProfile />
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>..\..\..\..\bin\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <Prefer32Bit>false</Prefer32Bit>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>..\..\..\..\bin\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <Prefer32Bit>false</Prefer32Bit>
+  </PropertyGroup>
+  <PropertyGroup>
+    <SignAssembly>true</SignAssembly>
+  </PropertyGroup>
+  <PropertyGroup>
+    <AssemblyOriginatorKeyFile>HeuristicLab.snk</AssemblyOriginatorKeyFile>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>..\..\..\..\bin\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <DebugType>full</DebugType>
+    <PlatformTarget>x64</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+    <Prefer32Bit>false</Prefer32Bit>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
+    <OutputPath>..\..\..\..\bin\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <Optimize>true</Optimize>
+    <DebugType>pdbonly</DebugType>
+    <PlatformTarget>x64</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+    <Prefer32Bit>false</Prefer32Bit>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>..\..\..\..\bin\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <DebugType>full</DebugType>
+    <PlatformTarget>x86</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+    <Prefer32Bit>false</Prefer32Bit>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
+    <OutputPath>..\..\..\..\bin\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <Optimize>true</Optimize>
+    <DebugType>pdbonly</DebugType>
+    <PlatformTarget>x86</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+    <Prefer32Bit>false</Prefer32Bit>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="epplus-4.0.3 memory improvement.diff" />
+    <None Include="Plugin.cs.frame" />
+    <Compile Include="Plugin.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <None Include="HeuristicLab.snk" />
+    <None Include="Properties\AssemblyInfo.cs.frame" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\..\..\..\HeuristicLab.PluginInfrastructure\3.3\HeuristicLab.PluginInfrastructure-3.3.csproj">
+      <Project>{94186a6a-5176-4402-ae83-886557b53cca}</Project>
+      <Name>HeuristicLab.PluginInfrastructure-3.3</Name>
+      <Private>False</Private>
+    </ProjectReference>
+    <ProjectReference Include="..\EPPlus-4.0.3\EPPlus-4.0.3.csproj">
+      <Project>{832ea4f3-20f7-42d7-b079-b588ba559e5f}</Project>
+      <Name>EPPlus-4.0.3</Name>
+      <Private>True</Private>
+    </ProjectReference>
+  </ItemGroup>
+  <ItemGroup>
+    <Content Include="EPPlus License-4.0.3.txt">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Content>
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <PropertyGroup>
+    <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">set Path=%25Path%25;$(ProjectDir);$(SolutionDir)
+set ProjectDir=$(ProjectDir)
+set SolutionDir=$(SolutionDir)
+set Outdir=$(Outdir)
+
+call PreBuildEvent.cmd
+</PreBuildEvent>
+    <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
+export ProjectDir=$(ProjectDir)
+export SolutionDir=$(SolutionDir)
+
+$SolutionDir/PreBuildEvent.sh
+</PreBuildEvent>
+  </PropertyGroup>
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/HeuristicLab.EPPlus-4.0.3/Plugin.cs.frame
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/HeuristicLab.EPPlus-4.0.3/Plugin.cs.frame	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/HeuristicLab.EPPlus-4.0.3/Plugin.cs.frame	(revision 12707)
@@ -0,0 +1,31 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using HeuristicLab.PluginInfrastructure;
+
+namespace HeuristicLab.EPPlus {
+  [Plugin("HeuristicLab.EPPlus", "HeuristicLab wrapper for EPPlus", "4.0.3.$WCREV$")]
+  [PluginFile("HeuristicLab.EPPlus-4.0.3.dll", PluginFileType.Assembly)]
+  [PluginFile("EPPlus-4.0.3.dll", PluginFileType.Assembly)]
+  [PluginFile("EPPlus License-4.0.3.txt", PluginFileType.License)]
+  public class HeuristicLabEPPlusPlugin : PluginBase {
+  }
+}
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/HeuristicLab.EPPlus-4.0.3/Properties/AssemblyInfo.cs.frame
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/HeuristicLab.EPPlus-4.0.3/Properties/AssemblyInfo.cs.frame	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/HeuristicLab.EPPlus-4.0.3/Properties/AssemblyInfo.cs.frame	(revision 12707)
@@ -0,0 +1,57 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+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("HeuristicLab.EPPlus")]
+[assembly: AssemblyDescription("Provides an interface to EPPlus")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("HeuristicLab")]
+[assembly: AssemblyCopyright("(c) 2002-2015 HEAL")]
+[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("f70ed15d-9703-4c6f-b2f0-89ae40be305d")]
+
+// 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("4.0.3")]
+[assembly: AssemblyFileVersion("4.0.3.$WCREV$")]
Index: /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/HeuristicLab.EPPlus-4.0.3/epplus-4.0.3 memory improvement.diff
===================================================================
--- /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/HeuristicLab.EPPlus-4.0.3/epplus-4.0.3 memory improvement.diff	(revision 12707)
+++ /stable/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/HeuristicLab.EPPlus-4.0.3/epplus-4.0.3 memory improvement.diff	(revision 12707)
@@ -0,0 +1,287 @@
+diff --git a/EPPlus-4.0.3/ExcelCellBase.cs b/EPPlus-4.0.3/ExcelCellBase.cs
+--- a/EPPlus-4.0.3/ExcelCellBase.cs
++++ b/EPPlus-4.0.3/ExcelCellBase.cs
+@@ -480,17 +480,15 @@
+             bool fixedRow, fixedCol;
+             return GetRowCol(address, out row, out col, throwException, out fixedRow, out fixedCol);
+         }
+-        internal static bool GetRowCol(string address, out int row, out int col, bool throwException, out bool fixedRow, out bool fixedCol)
+-        {
++        internal static bool GetRowCol(string address, out int row, out int col, bool throwException, out bool fixedRow, out bool fixedCol) {
+             bool colPart = true;
+-            string sRow = "", sCol = "";
++            int colStartIx = 0;
++            int colLength = 0;
+             col = 0;
++            row = 0;
+             fixedRow = false;
+             fixedCol = false;
+-            if (address.IndexOf(':') > 0)  //If it is a mult-cell address use 
+-            {
+-                address = address.Substring(0, address.IndexOf(':'));
+-            }
++
+             if (address.EndsWith("#REF!"))
+             {
+                 row = 0;
+@@ -501,71 +499,56 @@
+             int sheetMarkerIndex = address.IndexOf('!');
+             if (sheetMarkerIndex >= 0)
+             {
+-                address = address.Substring(sheetMarkerIndex + 1);
++                colStartIx = sheetMarkerIndex + 1;
+             }
+ 
+-            address = address.ToUpper(CultureInfo.InvariantCulture);
+-            for (int i = 0; i < address.Length; i++)
++            for (int i = colStartIx; i < address.Length; i++)
+             {
+-                if ((address[i] >= 'A' && address[i] <= 'Z') && colPart && sCol.Length <= 3)
++                char c = address[i];
++                if (colPart && ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')) && colLength <= 3)
+                 {
+-                    sCol += address[i];
++                    col *= 26;
++                    col += ((int)c) - 64;
++                    colLength++;
+                 }
+-                else if (address[i] >= '0' && address[i] <= '9')
++                else if (c >= '0' && c <= '9')
+                 {
+-                    sRow += address[i];
++                    row *= 10;
++                    row += ((int)c) - 48;
+                     colPart = false;
+                 }
+-                else if (address[i] == '$')
++                else if (c == '$')
+                 {
+-                    if (i == 0) 
+-                        fixedCol = true; 
+-                    else 
++                    if (i == colStartIx)
++                    {
++                        colStartIx++;
++                        fixedCol = true;
++                    }
++                    else
++                    {
++                        colPart = false;
+                         fixedRow = true;
++                    }
++                }
++                else if (c == ':')
++                {
++                    break;
+                 }
+                 else
+                 {
++                    row = 0;
++                    col = 0;
+                     if (throwException)
+                     {
+                         throw (new Exception(string.Format("Invalid Address format {0}", address)));
+                     }
+                     else
+                     {
+-                        row = 0;
+-                        col = 0;
+                         return false;
+                     }
+                 }
+             }
+-
+-            // Get the column number
+-            if (sCol != "")
+-            {
+-                col = GetColumn(sCol);
+-            }
+-            else
+-            {
+-                col = 0;
+-                int.TryParse(sRow, out row);
+-                return row>0;
+-            }
+-            // Get the row number
+-            if (sRow == "") //Blank, fullRow
+-            {
+-                //if (throwException)
+-                //{
+-                //    throw (new Exception(string.Format("Invalid Address format {0}", address)));
+-                //}
+-                //else
+-                //{                    
+-                row = 0;
+-                return col > 0;
+-                //}
+-            }
+-            else
+-            {
+-                return int.TryParse(sRow, out row);
+-            }
++            return row != 0 || col != 0;
+         }
+ 
+         private static int GetColumn(string sCol)
+diff --git a/EPPlus-4.0.3/ExcelRangeBase.cs b/EPPlus-4.0.3/ExcelRangeBase.cs
+--- a/EPPlus-4.0.3/ExcelRangeBase.cs
++++ b/EPPlus-4.0.3/ExcelRangeBase.cs
+@@ -58,7 +58,7 @@
+     /// <summary>
+ 	/// A range of cells 
+ 	/// </summary>
+-	public class ExcelRangeBase : ExcelAddress, IExcelCell, IDisposable, IEnumerable<ExcelRangeBase>, IEnumerator<ExcelRangeBase>
++	public class ExcelRangeBase : ExcelAddress, IExcelCell, IEnumerable<ExcelRangeBase>
+ 	{
+ 		/// <summary>
+ 		/// Reference to the worksheet
+@@ -2757,69 +2757,84 @@
+         CellsStoreEnumerator<object> cellEnum;
+ 		public IEnumerator<ExcelRangeBase> GetEnumerator()
+ 		{
+-			Reset();
+-			return this;
++            return new ExcelRangeBaseEnumerator(this);
+ 		}
+ 
+ 		IEnumerator IEnumerable.GetEnumerator()
+ 		{
+-			Reset();
+-			return this;
++            return new ExcelRangeBaseEnumerator(this);
+ 		}
+ 
+ 		/// <summary>
+ 		/// The current range when enumerating
+ 		/// </summary>
+-		public ExcelRangeBase Current
+-		{
+-			get
+-			{
+-				return new ExcelRangeBase(_worksheet, ExcelAddressBase.GetAddress(cellEnum.Row, cellEnum.Column));
+-			}
+-		}
++        public class ExcelRangeBaseEnumerator : IEnumerator<ExcelRangeBase> {
++            private CellsStoreEnumerator<object> _cellEnum;
++            private int _enumAddressIx = -1;
++            private ExcelRangeBase _range;
++            private ExcelRangeBase _current;
+ 
+-		/// <summary>
+-		/// The current range when enumerating
+-		/// </summary>
+-		object IEnumerator.Current
+-		{
+-			get
+-			{
+-				return ((object)(new ExcelRangeBase(_worksheet, ExcelAddressBase.GetAddress(cellEnum.Row, cellEnum.Column))));
+-			}
+-		}
+-
+-		int _enumAddressIx = -1;
+-        public bool MoveNext()
+-		{
+-            if (cellEnum.Next())
+-            {
+-                return true;
+-            }
+-            else if (_addresses!=null)
+-            {
+-                _enumAddressIx++;
+-                if (_enumAddressIx < _addresses.Count)
+-                {
+-                    cellEnum = new CellsStoreEnumerator<object>(_worksheet._values, 
+-                        _addresses[_enumAddressIx]._fromRow, 
+-                        _addresses[_enumAddressIx]._fromCol, 
+-                        _addresses[_enumAddressIx]._toRow, 
+-                        _addresses[_enumAddressIx]._toCol);
+-                    return MoveNext();
+-                }
+-                else
+-                {
+-                    return false;
++            /// <summary>
++            /// The current range when enumerating
++            /// </summary>
++            public ExcelRangeBase Current {
++                get {
++                    return _current;
+                 }
+             }
+-            return false;
+-		}
+ 
+-		public void Reset()
+-		{
+-            _enumAddressIx = -1;
+-            cellEnum = new CellsStoreEnumerator<object>(_worksheet._values, _fromRow, _fromCol, _toRow, _toCol);
++            /// <summary>
++            /// The current range when enumerating
++            /// </summary>
++            object IEnumerator.Current {
++                get {
++                    return _current;
++                }
++            }
++
++            public ExcelRangeBaseEnumerator(ExcelRangeBase range) {
++                this._range = range;
++                Reset();
++            }
++            public bool MoveNext() {
++                if (_cellEnum.Next()) {
++                    _current._fromCol = _cellEnum.Column;
++                    _current._fromRow = _cellEnum.Row;
++                    _current._toCol = _cellEnum.Column;
++                    _current._toRow = _cellEnum.Row;
++                    _current.Address = GetAddress(_current._fromRow, _current._fromCol);
++                    return true;
++                }
++                else if (_range._addresses != null) {
++                    _enumAddressIx++;
++                    if (_enumAddressIx < _range._addresses.Count) {
++                        _cellEnum = new CellsStoreEnumerator<object>(_range._worksheet._values,
++                            _range._addresses[_enumAddressIx]._fromRow,
++                            _range._addresses[_enumAddressIx]._fromCol,
++                            _range._addresses[_enumAddressIx]._toRow,
++                            _range._addresses[_enumAddressIx]._toCol);
++                        return MoveNext();
++                    }
++                    else {
++                        return false;
++                    }
++                }
++                return false;
++            }
++
++            public void Reset() {
++                _enumAddressIx = -1;
++                _cellEnum = new CellsStoreEnumerator<object>(_range._worksheet._values, _range._fromRow, _range._fromCol, _range._toRow, _range._toCol);
++                _current = new ExcelRangeBase(_range._worksheet, ExcelAddressBase.GetAddress(_cellEnum.Row, _cellEnum.Column));
++            }
++
++            public void Dispose() {
++                if (_cellEnum != null) {
++                    _cellEnum.Dispose();
++                    _cellEnum = null;
++                }
++            }
++
+         }
+ 
+         //private void GetNextIndexEnum(int fromRow, int fromCol, int toRow, int toCol)
+diff --git a/EPPlus-4.0.3/Table/PivotTable/ExcelPivotTable.cs b/EPPlus-4.0.3/Table/PivotTable/ExcelPivotTable.cs
+--- a/EPPlus-4.0.3/Table/PivotTable/ExcelPivotTable.cs
++++ b/EPPlus-4.0.3/Table/PivotTable/ExcelPivotTable.cs
+@@ -150,10 +150,7 @@
+ 
+             LoadFields();
+ 
+-            using (var r=sheet.Cells[address.Address])
+-            {
+-                r.Clear();
+-            }
++            sheet.Cells[address.Address].Clear();
+         }
+         private void init()
+         {
Index: /stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views-3.4.csproj
===================================================================
--- /stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views-3.4.csproj	(revision 12706)
+++ /stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views-3.4.csproj	(revision 12707)
@@ -99,7 +99,5 @@
   </PropertyGroup>
   <ItemGroup>
-    <Reference Include="EPPlus-3.1.3, Version=3.1.3.0, Culture=neutral, PublicKeyToken=ea159fdaa78159a1, processorArchitecture=MSIL">
-      <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\..\bin\EPPlus-3.1.3.dll</HintPath>
+    <Reference Include="EPPlus-4.0.3, Version=4.0.3.0, Culture=neutral, PublicKeyToken=ea159fdaa78159a1, processorArchitecture=MSIL">
       <Private>False</Private>
     </Reference>
Index: /stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views/3.4/Plugin.cs.frame
===================================================================
--- /stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views/3.4/Plugin.cs.frame	(revision 12706)
+++ /stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views/3.4/Plugin.cs.frame	(revision 12707)
@@ -34,5 +34,5 @@
   [PluginDependency("HeuristicLab.Data", "3.3")]
   [PluginDependency("HeuristicLab.Encodings.SymbolicExpressionTreeEncoding", "3.4")]
-  [PluginDependency("HeuristicLab.EPPlus", "3.1")]
+  [PluginDependency("HeuristicLab.EPPlus", "4.0.1")]
   [PluginDependency("HeuristicLab.MainForm", "3.3")]
   [PluginDependency("HeuristicLab.MainForm.WindowsForms", "3.3")]
Index: /stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Views-3.4.csproj
===================================================================
--- /stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Views-3.4.csproj	(revision 12706)
+++ /stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Views-3.4.csproj	(revision 12707)
@@ -103,7 +103,5 @@
       <Private>False</Private>
     </Reference>
-    <Reference Include="EPPlus-3.1.3, Version=3.1.3.0, Culture=neutral, PublicKeyToken=ea159fdaa78159a1, processorArchitecture=MSIL">
-      <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\..\bin\EPPlus-3.1.3.dll</HintPath>
+    <Reference Include="EPPlus-4.0.3, Version=4.0.3.0, Culture=neutral, PublicKeyToken=ea159fdaa78159a1, processorArchitecture=MSIL">
       <Private>False</Private>
     </Reference>
Index: /stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Plugin.cs.frame
===================================================================
--- /stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Plugin.cs.frame	(revision 12706)
+++ /stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Plugin.cs.frame	(revision 12707)
@@ -37,5 +37,5 @@
   [PluginDependency("HeuristicLab.Data", "3.3")]
   [PluginDependency("HeuristicLab.Data.Views", "3.3")]
-  [PluginDependency("HeuristicLab.EPPlus", "3.1")]
+  [PluginDependency("HeuristicLab.EPPlus", "4.0.3")]
   [PluginDependency("HeuristicLab.Encodings.SymbolicExpressionTreeEncoding", "3.4")]
   [PluginDependency("HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views", "3.4")]
