Remove unnecessary code from EPPlus.
- VBA Macros
- Drawings and embedded images
- Charts
- Font sizes
- Column auto-size
This eliminates the drawing dependencies and reduces the binary size.
Change-Id: Id7978a4eb8c68b9305495dca98bc041f0c7b3f4d
Reviewed-on: https://gnocchi-internal-review.git.corp.google.com/c/third_party/epplus/+/207105
Reviewed-by: Hughes Hilton <hugheshilton@google.com>
diff --git a/EPPlus/Compatibility/ImageCompat.cs b/EPPlus/Compatibility/ImageCompat.cs
deleted file mode 100644
index e7aefde..0000000
--- a/EPPlus/Compatibility/ImageCompat.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-using System.IO;
-using IronSoftware.Drawing;
-
-namespace OfficeOpenXml.Compatibility
-{
- internal class ImageCompat
- {
- internal static byte[] GetImageAsByteArray(AnyBitmap image)
- {
- var ms = new MemoryStream();
- if (image.GetImageFormat() == AnyBitmap.ImageFormat.Gif ||
- image.GetImageFormat() == AnyBitmap.ImageFormat.Bmp ||
- image.GetImageFormat() == AnyBitmap.ImageFormat.Png ||
- image.GetImageFormat() == AnyBitmap.ImageFormat.Tiff)
- {
- image.ExportStream(ms, image.GetImageFormat());
- }
- else
- {
- image.ExportStream(ms, AnyBitmap.ImageFormat.Jpeg);
- }
-
- return ms.ToArray();
- }
- }
-}
diff --git a/EPPlus/Drawing/Chart/ExcelBarChart.cs b/EPPlus/Drawing/Chart/ExcelBarChart.cs
deleted file mode 100644
index a4a23c6..0000000
--- a/EPPlus/Drawing/Chart/ExcelBarChart.cs
+++ /dev/null
@@ -1,493 +0,0 @@
-/*******************************************************************************
- * You may amend and distribute as you like, but don't remove this header!
- *
- * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
- * See http://www.codeplex.com/EPPlus for details.
- *
- * Copyright (C) 2011 Jan Källman
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
-
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
- * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
- *
- * All code and executables are provided "as is" with no warranty either express or 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);
- }
- }
-}
diff --git a/EPPlus/Drawing/Chart/ExcelBarChartSerie.cs b/EPPlus/Drawing/Chart/ExcelBarChartSerie.cs
deleted file mode 100644
index 9de589e..0000000
--- a/EPPlus/Drawing/Chart/ExcelBarChartSerie.cs
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * You may amend and distribute as you like, but don't remove this header!
- *
- * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
- * See http://www.codeplex.com/EPPlus for details.
- *
- * Copyright (C) 2011 Jan Källman
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
-
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
- * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
- *
- * All code and executables are provided "as is" with no warranty either express or 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);
- }
- }
- }
-}
diff --git a/EPPlus/Drawing/Chart/ExcelBubbleChart.cs b/EPPlus/Drawing/Chart/ExcelBubbleChart.cs
deleted file mode 100644
index 8d1cd0a..0000000
--- a/EPPlus/Drawing/Chart/ExcelBubbleChart.cs
+++ /dev/null
@@ -1,136 +0,0 @@
-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;
- }
- }
- }
-}
diff --git a/EPPlus/Drawing/Chart/ExcelBubbleChartSerie.cs b/EPPlus/Drawing/Chart/ExcelBubbleChartSerie.cs
deleted file mode 100644
index bb491d7..0000000
--- a/EPPlus/Drawing/Chart/ExcelBubbleChartSerie.cs
+++ /dev/null
@@ -1,161 +0,0 @@
-/*******************************************************************************
- * You may amend and distribute as you like, but don't remove this header!
- *
- * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
- * See http://www.codeplex.com/EPPlus for details.
- *
- * Copyright (C) 2011 Jan Källman
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
-
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
- * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
- *
- * All code and executables are provided "as is" with no warranty either express or 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());
- }
- }
-}
diff --git a/EPPlus/Drawing/Chart/ExcelChart.cs b/EPPlus/Drawing/Chart/ExcelChart.cs
deleted file mode 100644
index 119905f..0000000
--- a/EPPlus/Drawing/Chart/ExcelChart.cs
+++ /dev/null
@@ -1,1932 +0,0 @@
-/*******************************************************************************
- * You may amend and distribute as you like, but don't remove this header!
- *
- * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
- * See http://www.codeplex.com/EPPlus for details.
- *
- * Copyright (C) 2011 Jan Källman
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
-
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
- * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
- *
- * All code and executables are provided "as is" with no warranty either express or 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();
- }
- }
-}
diff --git a/EPPlus/Drawing/Chart/ExcelChartAxis.cs b/EPPlus/Drawing/Chart/ExcelChartAxis.cs
deleted file mode 100644
index a597baf..0000000
--- a/EPPlus/Drawing/Chart/ExcelChartAxis.cs
+++ /dev/null
@@ -1,762 +0,0 @@
-/*******************************************************************************
- * You may amend and distribute as you like, but don't remove this header!
- *
- * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
- * See http://www.codeplex.com/EPPlus for details.
- *
- * Copyright (C) 2011 Jan Källman
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
-
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
- * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
- *
- * All code and executables are provided "as is" with no warranty either express or 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
- }
-}
diff --git a/EPPlus/Drawing/Chart/ExcelChartCollection.cs b/EPPlus/Drawing/Chart/ExcelChartCollection.cs
deleted file mode 100644
index 5fff22f..0000000
--- a/EPPlus/Drawing/Chart/ExcelChartCollection.cs
+++ /dev/null
@@ -1,108 +0,0 @@
-/*******************************************************************************
- * You may amend and distribute as you like, but don't remove this header!
- *
- * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
- * See http://www.codeplex.com/EPPlus for details.
- *
- * Copyright (C) 2011 Jan Källman
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
-
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
- * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
- *
- * All code and executables are provided "as is" with no warranty either express or 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]);
- }
- }
-
-
-}
-}
diff --git a/EPPlus/Drawing/Chart/ExcelChartDataLabel.cs b/EPPlus/Drawing/Chart/ExcelChartDataLabel.cs
deleted file mode 100644
index bb39978..0000000
--- a/EPPlus/Drawing/Chart/ExcelChartDataLabel.cs
+++ /dev/null
@@ -1,290 +0,0 @@
-/*******************************************************************************
- * You may amend and distribute as you like, but don't remove this header!
- *
- * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
- * See http://www.codeplex.com/EPPlus for details.
- *
- * Copyright (C) 2011 Jan Källman
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
-
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
- * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
- *
- * All code and executables are provided "as is" with no warranty either express or 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
- }
-}
diff --git a/EPPlus/Drawing/Chart/ExcelChartLegend.cs b/EPPlus/Drawing/Chart/ExcelChartLegend.cs
deleted file mode 100644
index f5b17b2..0000000
--- a/EPPlus/Drawing/Chart/ExcelChartLegend.cs
+++ /dev/null
@@ -1,200 +0,0 @@
-/*******************************************************************************
- * You may amend and distribute as you like, but don't remove this header!
- *
- * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
- * See http://www.codeplex.com/EPPlus for details.
- *
- * Copyright (C) 2011 Jan Källman
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
-
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
- * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
- *
- * All code and executables are provided "as is" with no warranty either express or 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 />";
- }
- }
-}
diff --git a/EPPlus/Drawing/Chart/ExcelChartPlotArea.cs b/EPPlus/Drawing/Chart/ExcelChartPlotArea.cs
deleted file mode 100644
index 0fbbabe..0000000
--- a/EPPlus/Drawing/Chart/ExcelChartPlotArea.cs
+++ /dev/null
@@ -1,88 +0,0 @@
-/*******************************************************************************
- * You may amend and distribute as you like, but don't remove this header!
- *
- * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
- * See http://www.codeplex.com/EPPlus for details.
- *
- * Copyright (C) 2011 Jan Källman
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
-
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
- * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
- *
- * All code and executables are provided "as is" with no warranty either express or 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;
- }
- }
- }
-}
diff --git a/EPPlus/Drawing/Chart/ExcelChartSerie.cs b/EPPlus/Drawing/Chart/ExcelChartSerie.cs
deleted file mode 100644
index 12967b4..0000000
--- a/EPPlus/Drawing/Chart/ExcelChartSerie.cs
+++ /dev/null
@@ -1,222 +0,0 @@
-/*******************************************************************************
- * You may amend and distribute as you like, but don't remove this header!
- *
- * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
- * See http://www.codeplex.com/EPPlus for details.
- *
- * Copyright (C) 2011 Jan Källman
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
-
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
- * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
- *
- * All code and executables are provided "as is" with no warranty either express or 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;
- }
- }
- }
-}
diff --git a/EPPlus/Drawing/Chart/ExcelChartSerieDataLabel.cs b/EPPlus/Drawing/Chart/ExcelChartSerieDataLabel.cs
deleted file mode 100644
index 37384f7..0000000
--- a/EPPlus/Drawing/Chart/ExcelChartSerieDataLabel.cs
+++ /dev/null
@@ -1,118 +0,0 @@
-/*******************************************************************************
- * You may amend and distribute as you like, but don't remove this header!
- *
- * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
- * See http://www.codeplex.com/EPPlus for details.
- *
- * Copyright (C) 2011 Jan Källman
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
-
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
- * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
- *
- * All code and executables are provided "as is" with no warranty either express or 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;
- }
- }
- }
-}
diff --git a/EPPlus/Drawing/Chart/ExcelChartSeries.cs b/EPPlus/Drawing/Chart/ExcelChartSeries.cs
deleted file mode 100644
index 55bb028..0000000
--- a/EPPlus/Drawing/Chart/ExcelChartSeries.cs
+++ /dev/null
@@ -1,406 +0,0 @@
-/*******************************************************************************
- * You may amend and distribute as you like, but don't remove this header!
- *
- * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
- * See http://www.codeplex.com/EPPlus for details.
- *
- * Copyright (C) 2011 Jan Källman
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
-
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
- * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
- *
- * All code and executables are provided "as is" with no warranty either express or 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
- }
-}
diff --git a/EPPlus/Drawing/Chart/ExcelChartSurface.cs b/EPPlus/Drawing/Chart/ExcelChartSurface.cs
deleted file mode 100644
index 7f7290b..0000000
--- a/EPPlus/Drawing/Chart/ExcelChartSurface.cs
+++ /dev/null
@@ -1,102 +0,0 @@
-/*******************************************************************************
- * You may amend and distribute as you like, but don't remove this header!
- *
- * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
- * See http://www.codeplex.com/EPPlus for details.
- *
- * Copyright (C) 2011 Jan Källman
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
-
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
- * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
- *
- * All code and executables are provided "as is" with no warranty either express or 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
- }
-}
diff --git a/EPPlus/Drawing/Chart/ExcelChartTitle.cs b/EPPlus/Drawing/Chart/ExcelChartTitle.cs
deleted file mode 100644
index 74a79f6..0000000
--- a/EPPlus/Drawing/Chart/ExcelChartTitle.cs
+++ /dev/null
@@ -1,236 +0,0 @@
-/************** *****************************************************************
- * You may amend and distribute as you like, but don't remove this header!
- *
- * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
- * See http://www.codeplex.com/EPPlus for details.
- *
- * Copyright (C) 2011 Jan Källman
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
-
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
- * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
- *
- * All code and executables are provided "as is" with no warranty either express or 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());
- }
- }
- }
-}
diff --git a/EPPlus/Drawing/Chart/ExcelChartTrendline.cs b/EPPlus/Drawing/Chart/ExcelChartTrendline.cs
deleted file mode 100644
index 05f8da3..0000000
--- a/EPPlus/Drawing/Chart/ExcelChartTrendline.cs
+++ /dev/null
@@ -1,298 +0,0 @@
-/*******************************************************************************
- * You may amend and distribute as you like, but don't remove this header!
- *
- * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
- * See http://www.codeplex.com/EPPlus for details.
- *
- * Copyright (C) 2011 Jan Källman
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
-
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
- * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
- *
- * All code and executables are provided "as is" with no warranty either express or 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);
- }
- }
- }
-}
diff --git a/EPPlus/Drawing/Chart/ExcelDoughnutChart.cs b/EPPlus/Drawing/Chart/ExcelDoughnutChart.cs
deleted file mode 100644
index cd5df2d..0000000
--- a/EPPlus/Drawing/Chart/ExcelDoughnutChart.cs
+++ /dev/null
@@ -1,127 +0,0 @@
-/*******************************************************************************
- * You may amend and distribute as you like, but don't remove this header!
- *
- * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
- * See http://www.codeplex.com/EPPlus for details.
- *
- * Copyright (C) 2011 Jan Källman
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
-
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
- * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
- *
- * All code and executables are provided "as is" with no warranty either express or 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);
- }
- }
-}
diff --git a/EPPlus/Drawing/Chart/ExcelLineChart.cs b/EPPlus/Drawing/Chart/ExcelLineChart.cs
deleted file mode 100644
index 4fee949..0000000
--- a/EPPlus/Drawing/Chart/ExcelLineChart.cs
+++ /dev/null
@@ -1,150 +0,0 @@
-/*******************************************************************************
- * You may amend and distribute as you like, but don't remove this header!
- *
- * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
- * See http://www.codeplex.com/EPPlus for details.
- *
- * Copyright (C) 2011 Jan Källman
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
-
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
- * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
- *
- * All code and executables are provided "as is" with no warranty either express or 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);
- }
- }
-}
diff --git a/EPPlus/Drawing/Chart/ExcelLineChartSerie.cs b/EPPlus/Drawing/Chart/ExcelLineChartSerie.cs
deleted file mode 100644
index eb4cdeb..0000000
--- a/EPPlus/Drawing/Chart/ExcelLineChartSerie.cs
+++ /dev/null
@@ -1,110 +0,0 @@
-/*******************************************************************************
- * You may amend and distribute as you like, but don't remove this header!
- *
- * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
- * See http://www.codeplex.com/EPPlus for details.
- *
- * Copyright (C) 2011 Jan Källman
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
-
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
- * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
- *
- * All code and executables are provided "as is" with no warranty either express or 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);
- }
- }
- }
-}
diff --git a/EPPlus/Drawing/Chart/ExcelOfPieChart.cs b/EPPlus/Drawing/Chart/ExcelOfPieChart.cs
deleted file mode 100644
index 82aba60..0000000
--- a/EPPlus/Drawing/Chart/ExcelOfPieChart.cs
+++ /dev/null
@@ -1,116 +0,0 @@
-/*******************************************************************************
- * You may amend and distribute as you like, but don't remove this header!
- *
- * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
- * See http://www.codeplex.com/EPPlus for details.
- *
- * Copyright (C) 2011 Jan Källman
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
-
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
- * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
- *
- * All code and executables are provided "as is" with no warranty either express or 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);
- }
- }
-}
diff --git a/EPPlus/Drawing/Chart/ExcelPieChart.cs b/EPPlus/Drawing/Chart/ExcelPieChart.cs
deleted file mode 100644
index 6909c1f..0000000
--- a/EPPlus/Drawing/Chart/ExcelPieChart.cs
+++ /dev/null
@@ -1,106 +0,0 @@
-/*******************************************************************************
- * You may amend and distribute as you like, but don't remove this header!
- *
- * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
- * See http://www.codeplex.com/EPPlus for details.
- *
- * Copyright (C) 2011 Jan Källman
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
-
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
- * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
- *
- * All code and executables are provided "as is" with no warranty either express or 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);
- }
- }
-}
diff --git a/EPPlus/Drawing/Chart/ExcelPieChartSerie.cs b/EPPlus/Drawing/Chart/ExcelPieChartSerie.cs
deleted file mode 100644
index ad0f960..0000000
--- a/EPPlus/Drawing/Chart/ExcelPieChartSerie.cs
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * You may amend and distribute as you like, but don't remove this header!
- *
- * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
- * See http://www.codeplex.com/EPPlus for details.
- *
- * Copyright (C) 2011 Jan Källman
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
-
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
- * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
- *
- * All code and executables are provided "as is" with no warranty either express or 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;
- }
- }
-
- }
-}
diff --git a/EPPlus/Drawing/Chart/ExcelRadarChart.cs b/EPPlus/Drawing/Chart/ExcelRadarChart.cs
deleted file mode 100644
index 12cfd7c..0000000
--- a/EPPlus/Drawing/Chart/ExcelRadarChart.cs
+++ /dev/null
@@ -1,151 +0,0 @@
-/*******************************************************************************
- * You may amend and distribute as you like, but don't remove this header!
- *
- * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
- * See http://www.codeplex.com/EPPlus for details.
- *
- * Copyright (C) 2011 Jan Källman
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
-
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
- * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
- *
- * All code and executables are provided "as is" with no warranty either express or 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;
- }
- }
- }
-}
diff --git a/EPPlus/Drawing/Chart/ExcelRadarChartSerie.cs b/EPPlus/Drawing/Chart/ExcelRadarChartSerie.cs
deleted file mode 100644
index a9e2055..0000000
--- a/EPPlus/Drawing/Chart/ExcelRadarChartSerie.cs
+++ /dev/null
@@ -1,116 +0,0 @@
-/*******************************************************************************
- * You may amend and distribute as you like, but don't remove this header!
- *
- * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
- * See http://www.codeplex.com/EPPlus for details.
- *
- * Copyright (C) 2011 Jan Källman
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
-
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
- * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
- *
- * All code and executables are provided "as is" with no warranty either express or 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));
- }
- }
-
- }
-}
diff --git a/EPPlus/Drawing/Chart/ExcelScatterChart.cs b/EPPlus/Drawing/Chart/ExcelScatterChart.cs
deleted file mode 100644
index 817a308..0000000
--- a/EPPlus/Drawing/Chart/ExcelScatterChart.cs
+++ /dev/null
@@ -1,170 +0,0 @@
-/*******************************************************************************
- * You may amend and distribute as you like, but don't remove this header!
- *
- * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
- * See http://www.codeplex.com/EPPlus for details.
- *
- * Copyright (C) 2011 Jan Källman
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
-
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
- * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
- *
- * All code and executables are provided "as is" with no warranty either express or 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);
- }
-
- }
-}
diff --git a/EPPlus/Drawing/Chart/ExcelScatterChartSerie.cs b/EPPlus/Drawing/Chart/ExcelScatterChartSerie.cs
deleted file mode 100644
index 2906c2c..0000000
--- a/EPPlus/Drawing/Chart/ExcelScatterChartSerie.cs
+++ /dev/null
@@ -1,131 +0,0 @@
-/*******************************************************************************
- * You may amend and distribute as you like, but don't remove this header!
- *
- * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
- * See http://www.codeplex.com/EPPlus for details.
- *
- * Copyright (C) 2011 Jan Källman
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
-
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
- * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
- *
- * All code and executables are provided "as is" with no warranty either express or 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);
- }
- }
- set
- {
- if (_chartSeries.Chart.ChartType == eChartType.XYScatterLinesNoMarkers ||
- _chartSeries.Chart.ChartType == eChartType.XYScatterSmoothNoMarkers)
- {
- throw (new InvalidOperationException("Can't set marker style for this charttype."));
- }
- SetXmlNodeString(markerPath, value.ToString().ToLower(CultureInfo.InvariantCulture));
- }
- }
- }
-}
diff --git a/EPPlus/Drawing/Chart/ExcelSurfaceChart.cs b/EPPlus/Drawing/Chart/ExcelSurfaceChart.cs
deleted file mode 100644
index 4868150..0000000
--- a/EPPlus/Drawing/Chart/ExcelSurfaceChart.cs
+++ /dev/null
@@ -1,159 +0,0 @@
-/*******************************************************************************
- * You may amend and distribute as you like, but don't remove this header!
- *
- * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
- * See http://www.codeplex.com/EPPlus for details.
- *
- * Copyright (C) 2011 Jan Källman
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
-
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
- * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
- *
- * All code and executables are provided "as is" with no warranty either express or 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;
- }
- }
- }
- }
-}
diff --git a/EPPlus/Drawing/Chart/ExcelSurfaceChartSerie.cs b/EPPlus/Drawing/Chart/ExcelSurfaceChartSerie.cs
deleted file mode 100644
index 07f86c6..0000000
--- a/EPPlus/Drawing/Chart/ExcelSurfaceChartSerie.cs
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * You may amend and distribute as you like, but don't remove this header!
- *
- * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
- * See http://www.codeplex.com/EPPlus for details.
- *
- * Copyright (C) 2011 Jan Källman
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
-
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
- * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
- *
- * All code and executables are provided "as is" with no warranty either express or 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)
- {
- }
- }
-}
diff --git a/EPPlus/Drawing/ExcelDrawingBase.cs b/EPPlus/Drawing/ExcelDrawingBase.cs
deleted file mode 100644
index a1cc4a7..0000000
--- a/EPPlus/Drawing/ExcelDrawingBase.cs
+++ /dev/null
@@ -1,662 +0,0 @@
-/*******************************************************************************
- * You may amend and distribute as you like, but don't remove this header!
- *
- * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
- * See http://www.codeplex.com/EPPlus for details.
- *
- * Copyright (C) 2011 Jan Källman
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
-
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
- * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
- *
- * All code and executables are provided "as is" with no warranty either express or 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;
- }
- }
-}
diff --git a/EPPlus/Drawing/ExcelDrawingBorder.cs b/EPPlus/Drawing/ExcelDrawingBorder.cs
deleted file mode 100644
index 96d804b..0000000
--- a/EPPlus/Drawing/ExcelDrawingBorder.cs
+++ /dev/null
@@ -1,227 +0,0 @@
-/*******************************************************************************
- * You may amend and distribute as you like, but don't remove this header!
- *
- * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
- * See http://www.codeplex.com/EPPlus for details.
- *
- * Copyright (C) 2011 Jan Källman
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
-
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
- * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
- *
- * All code and executables are provided "as is" with no warranty either express or 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
- // {
-
- // }
- //}
- }
-}
diff --git a/EPPlus/Drawing/ExcelDrawingFill.cs b/EPPlus/Drawing/ExcelDrawingFill.cs
deleted file mode 100644
index 1ccbb20..0000000
--- a/EPPlus/Drawing/ExcelDrawingFill.cs
+++ /dev/null
@@ -1,204 +0,0 @@
-/*******************************************************************************
- * You may amend and distribute as you like, but don't remove this header!
- *
- * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
- * See http://www.codeplex.com/EPPlus for details.
- *
- * Copyright (C) 2011 Jan Källman
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
-
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
- * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
- *
- * All code and executables are provided "as is" with no warranty either express or 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());
- }
- }
- }
-}
diff --git a/EPPlus/Drawing/ExcelDrawingLineEnd.cs b/EPPlus/Drawing/ExcelDrawingLineEnd.cs
deleted file mode 100644
index 9a17319..0000000
--- a/EPPlus/Drawing/ExcelDrawingLineEnd.cs
+++ /dev/null
@@ -1,220 +0,0 @@
-using System;
-using System.Xml;
-
-
-/// <summary>
-/// Line end style.
-/// </summary>
-public enum eEndStyle //ST_LineEndType
-{
- /// <summary>
- /// No end
- /// </summary>
- None,
- /// <summary>
- /// Triangle arrow head
- /// </summary>
- Triangle,
- /// <summary>
- /// Stealth arrow head
- /// </summary>
- Stealth,
- /// <summary>
- /// Diamond
- /// </summary>
- Diamond,
- /// <summary>
- /// Oval
- /// </summary>
- Oval,
- /// <summary>
- /// Line arrow head
- /// </summary>
- Arrow
-}
-
-/// <summary>
-/// Lend end size.
-/// </summary>
-public enum eEndSize
-{
- /// <summary>
- /// Smal
- /// </summary>
- Small,
- /// <summary>
- /// Medium
- /// </summary>
- Medium,
- /// <summary>
- /// Large
- /// </summary>
- Large
-}
-
-namespace OfficeOpenXml.Drawing
-{
- /// <summary>
- /// Properties for drawing line ends
- /// </summary>
- public sealed class ExcelDrawingLineEnd:XmlHelper
- {
- string _linePath;
- internal ExcelDrawingLineEnd(XmlNamespaceManager nameSpaceManager, XmlNode topNode, string linePath) :
- base(nameSpaceManager, topNode)
- {
- SchemaNodeOrder = new string[] { "headEnd", "tailEnd" };
- _linePath = linePath;
- }
- string _headEndStylePath = "xdr:sp/xdr:spPr/a:ln/a:headEnd/@type";
- /// <summary>
- /// HeaderEnd
- /// </summary>
- public eEndStyle HeadEnd
- {
- get
- {
- return TranslateEndStyle(GetXmlNodeString(_headEndStylePath));
- }
- set
- {
- CreateNode(_linePath, false);
- SetXmlNodeString(_headEndStylePath, TranslateEndStyleText(value));
- }
- }
- string _tailEndStylePath = "xdr:sp/xdr:spPr/a:ln/a:tailEnd/@type";
- /// <summary>
- /// HeaderEnd
- /// </summary>
- public eEndStyle TailEnd
- {
- get
- {
- return TranslateEndStyle(GetXmlNodeString(_tailEndStylePath));
- }
- set
- {
- CreateNode(_linePath, false);
- SetXmlNodeString(_tailEndStylePath, TranslateEndStyleText(value));
- }
- }
-
- string _tailEndSizeWidthPath = "xdr:sp/xdr:spPr/a:ln/a:tailEnd/@w";
- /// <summary>
- /// TailEndSizeWidth
- /// </summary>
- public eEndSize TailEndSizeWidth
- {
- get
- {
- return TranslateEndSize(GetXmlNodeString(_tailEndSizeWidthPath));
- }
- set
- {
- CreateNode(_linePath, false);
- SetXmlNodeString(_tailEndSizeWidthPath, TranslateEndSizeText(value));
- }
- }
-
- string _tailEndSizeHeightPath = "xdr:sp/xdr:spPr/a:ln/a:tailEnd/@len";
- /// <summary>
- /// TailEndSizeHeight
- /// </summary>
- public eEndSize TailEndSizeHeight
- {
- get
- {
- return TranslateEndSize(GetXmlNodeString(_tailEndSizeHeightPath));
- }
- set
- {
- CreateNode(_linePath, false);
- SetXmlNodeString(_tailEndSizeHeightPath, TranslateEndSizeText(value));
- }
- }
-
- string _headEndSizeWidthPath = "xdr:sp/xdr:spPr/a:ln/a:headEnd/@w";
- /// <summary>
- /// TailEndSizeWidth
- /// </summary>
- public eEndSize HeadEndSizeWidth
- {
- get
- {
- return TranslateEndSize(GetXmlNodeString(_headEndSizeWidthPath));
- }
- set
- {
- CreateNode(_linePath, false);
- SetXmlNodeString(_headEndSizeWidthPath, TranslateEndSizeText(value));
- }
- }
-
- string _headEndSizeHeightPath = "xdr:sp/xdr:spPr/a:ln/a:headEnd/@len";
- /// <summary>
- /// TailEndSizeHeight
- /// </summary>
- public eEndSize HeadEndSizeHeight
- {
- get
- {
- return TranslateEndSize(GetXmlNodeString(_headEndSizeHeightPath));
- }
- set
- {
- CreateNode(_linePath, false);
- SetXmlNodeString(_headEndSizeHeightPath, TranslateEndSizeText(value));
- }
- }
-
- #region "Translate Enum functions"
- private string TranslateEndStyleText(eEndStyle value)
- {
- return value.ToString().ToLower();
- }
- private eEndStyle TranslateEndStyle(string text)
- {
- switch (text)
- {
- case "none":
- case "arrow":
- case "diamond":
- case "oval":
- case "stealth":
- case "triangle":
- return (eEndStyle)Enum.Parse(typeof(eEndStyle), text, true);
- default:
- throw (new Exception("Invalid Endstyle"));
- }
- }
-
- private string TranslateEndSizeText(eEndSize value)
- {
- string text = value.ToString();
- switch (value)
- {
- case eEndSize.Small:
- return "sm";
- case eEndSize.Medium:
- return "med";
- case eEndSize.Large:
- return "lg";
- default:
- throw (new Exception("Invalid Endsize"));
- }
- }
- private eEndSize TranslateEndSize(string text)
- {
- switch (text)
- {
- case "sm":
- case "med":
- case "lg":
- return (eEndSize)Enum.Parse(typeof(eEndSize), text, true);
- default:
- throw (new Exception("Invalid Endsize"));
- }
- }
- #endregion
- }
-}
\ No newline at end of file
diff --git a/EPPlus/Drawing/ExcelDrawings.cs b/EPPlus/Drawing/ExcelDrawings.cs
deleted file mode 100644
index 97a1483..0000000
--- a/EPPlus/Drawing/ExcelDrawings.cs
+++ /dev/null
@@ -1,622 +0,0 @@
-/*******************************************************************************
- * You may amend and distribute as you like, but don't remove this header!
- *
- * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
- * See http://www.codeplex.com/EPPlus for details.
- *
- * Copyright (C) 2011 Jan Källman
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
-
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
- * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
- *
- * All code and executables are provided "as is" with no warranty either express or 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.Linq;
-using IronSoftware.Drawing;
-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, AnyBitmap 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, AnyBitmap 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;
- }
- /// <summary>
- /// Add a new shape to the worksheet
- /// </summary>
- /// <param name="Name">Name</param>
- /// <param name="Source">Source shape</param>
- /// <returns>The shape object</returns>
- public ExcelShape AddShape(string Name, ExcelShape Source)
- {
- 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();
- drawNode.InnerXml = Source.TopNode.InnerXml;
-
- ExcelShape shape = new ExcelShape(this, drawNode);
- shape.Name = Name;
- shape.Style = Source.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;
- }
- }
-}
diff --git a/EPPlus/Drawing/ExcelPicture.cs b/EPPlus/Drawing/ExcelPicture.cs
deleted file mode 100644
index 213dd24..0000000
--- a/EPPlus/Drawing/ExcelPicture.cs
+++ /dev/null
@@ -1,420 +0,0 @@
-/*******************************************************************************
- * You may amend and distribute as you like, but don't remove this header!
- *
- * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
- * See http://www.codeplex.com/EPPlus for details.
- *
- * Copyright (C) 2011 Jan Källman
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
-
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
- * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
- *
- * All code and executables are provided "as is" with no warranty either express or 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.Diagnostics;
-using IronSoftware.Drawing;
-using OfficeOpenXml.Compatibility;
-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 = AnyBitmap.FromStream(Part.GetStream());
-#if (Core)
- byte[] iby = ImageCompat.GetImageAsByteArray(_image);
-#else
- ImageConverter ic=new ImageConverter();
- var iby=(byte[])ic.ConvertTo(_image, typeof(byte[]));
-#endif
- 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, AnyBitmap image) :
- this(drawings, node, image, null)
- {
- }
- internal ExcelPicture(ExcelDrawings drawings, XmlNode node, AnyBitmap 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 = AnyBitmap.FromStream(imagestream);
-#if (Core)
- var img=ImageCompat.GetImageAsByteArray(_image);
-#else
- ImageConverter ic = new ImageConverter();
- var img = (byte[])ic.ConvertTo(_image, typeof(byte[]));
-#endif
- 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);
- }
- ImageHash = ii.Hash;
- 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(AnyBitmap image)
- {
-#if (Core)
- byte[] img = ImageCompat.GetImageAsByteArray(image);
-#else
- ImageConverter ic = new ImageConverter();
- byte[] img = (byte[])ic.ConvertTo(image, typeof(byte[]));
-#endif
- var ii = _drawings._package.AddImage(img);
-
- ImageHash = ii.Hash;
- 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;
- ImageHash = ii.Hash;
- }
-
- //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);
-
- return RelPic.Id;
- }
- private void SetPosDefaults(AnyBitmap image)
- {
- EditAs = eEditAs.OneCell;
- SetPixelWidth(image.Width, (float)image.HorizontalResolution.Value);
- SetPixelHeight(image.Height, (float)image.VerticalResolution.Value);
- }
-
- 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; }
- AnyBitmap _image = null;
- /// <summary>
- /// The Image
- /// </summary>
- public AnyBitmap 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));
- }
- }
- }
- }
- AnyBitmap.ImageFormat _imageFormat=AnyBitmap.ImageFormat.Jpeg;
- /// <summary>
- /// Image format
- /// If the picture is created from an Image this type is always Jpeg
- /// </summary>
- public AnyBitmap.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, (float)Image.HorizontalResolution.Value);
- SetPixelHeight(height, (float)Image.VerticalResolution.Value);
- }
- }
- 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;
- }
- }
-}
diff --git a/EPPlus/Drawing/ExcelShape.cs b/EPPlus/Drawing/ExcelShape.cs
deleted file mode 100644
index d0c8369..0000000
--- a/EPPlus/Drawing/ExcelShape.cs
+++ /dev/null
@@ -1,553 +0,0 @@
-/*******************************************************************************
- * You may amend and distribute as you like, but don't remove this header!
- *
- * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
- * See http://www.codeplex.com/EPPlus for details.
- *
- * Copyright (C) 2011 Jan Källman
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
-
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
- * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
- *
- * All code and executables are provided "as is" with no warranty either express or 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; }
- }
- }
-}
diff --git a/EPPlus/Drawing/ExcelView3D.cs b/EPPlus/Drawing/ExcelView3D.cs
deleted file mode 100644
index 5e47f9f..0000000
--- a/EPPlus/Drawing/ExcelView3D.cs
+++ /dev/null
@@ -1,151 +0,0 @@
-/*******************************************************************************
- * You may amend and distribute as you like, but don't remove this header!
- *
- * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
- * See http://www.codeplex.com/EPPlus for details.
- *
- * Copyright (C) 2011 Jan Källman
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
-
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
- * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
- *
- * All code and executables are provided "as is" with no warranty either express or 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());
- }
- }
- }
-}
diff --git a/EPPlus/Drawing/Vml/ExcelVmlDrawingBase.cs b/EPPlus/Drawing/Vml/ExcelVmlDrawingBase.cs
index 7ba6ed2..cef41dc 100644
--- a/EPPlus/Drawing/Vml/ExcelVmlDrawingBase.cs
+++ b/EPPlus/Drawing/Vml/ExcelVmlDrawingBase.cs
@@ -29,12 +29,8 @@
* 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
{
diff --git a/EPPlus/Drawing/Vml/ExcelVmlDrawingBaseCollection.cs b/EPPlus/Drawing/Vml/ExcelVmlDrawingBaseCollection.cs
index 3207e34..5fa0e82 100644
--- a/EPPlus/Drawing/Vml/ExcelVmlDrawingBaseCollection.cs
+++ b/EPPlus/Drawing/Vml/ExcelVmlDrawingBaseCollection.cs
@@ -30,10 +30,7 @@
* 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
{
diff --git a/EPPlus/Drawing/Vml/ExcelVmlDrawingComment.cs b/EPPlus/Drawing/Vml/ExcelVmlDrawingComment.cs
index 366d26b..270eb24 100644
--- a/EPPlus/Drawing/Vml/ExcelVmlDrawingComment.cs
+++ b/EPPlus/Drawing/Vml/ExcelVmlDrawingComment.cs
@@ -30,8 +30,6 @@
* 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;
diff --git a/EPPlus/Drawing/Vml/ExcelVmlDrawingCommentCollection.cs b/EPPlus/Drawing/Vml/ExcelVmlDrawingCommentCollection.cs
index 5891ff3..27add95 100644
--- a/EPPlus/Drawing/Vml/ExcelVmlDrawingCommentCollection.cs
+++ b/EPPlus/Drawing/Vml/ExcelVmlDrawingCommentCollection.cs
@@ -31,7 +31,6 @@
*******************************************************************************/
using System;
using System.Collections.Generic;
-using System.Text;
using System.Xml;
using System.Collections;
diff --git a/EPPlus/Drawing/Vml/ExcelVmlDrawingPicture.cs b/EPPlus/Drawing/Vml/ExcelVmlDrawingPicture.cs
deleted file mode 100644
index c46ab6b..0000000
--- a/EPPlus/Drawing/Vml/ExcelVmlDrawingPicture.cs
+++ /dev/null
@@ -1,358 +0,0 @@
-/*******************************************************************************
- * You may amend and distribute as you like, but don't remove this header!
- *
- * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
- * See http://www.codeplex.com/EPPlus for details.
- *
- * Copyright (C) 2011 Jan Källman
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
-
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
- * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
- *
- * All code and executables are provided "as is" with no warranty either express or 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;
-using IronSoftware.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 AnyBitmap Image
- {
- get
- {
- var pck = _worksheet._package.Package;
- if (pck.PartExists(ImageUri))
- {
- var part = pck.GetPart(ImageUri);
- return AnyBitmap.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
- }
-}
diff --git a/EPPlus/Drawing/Vml/ExcelVmlDrawingPictureCollection.cs b/EPPlus/Drawing/Vml/ExcelVmlDrawingPictureCollection.cs
deleted file mode 100644
index 3222fb0..0000000
--- a/EPPlus/Drawing/Vml/ExcelVmlDrawingPictureCollection.cs
+++ /dev/null
@@ -1,172 +0,0 @@
-/*******************************************************************************
- * You may amend and distribute as you like, but don't remove this header!
- *
- * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
- * See http://www.codeplex.com/EPPlus for details.
- *
- * Copyright (C) 2011 Jan Källman
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
-
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
- * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
- *
- * All code and executables are provided "as is" with no warranty either express or 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
- }
-}
diff --git a/EPPlus/Drawing/Vml/ExcelVmlDrawingPosition.cs b/EPPlus/Drawing/Vml/ExcelVmlDrawingPosition.cs
index 2f33054..bd3d1b4 100644
--- a/EPPlus/Drawing/Vml/ExcelVmlDrawingPosition.cs
+++ b/EPPlus/Drawing/Vml/ExcelVmlDrawingPosition.cs
@@ -30,8 +30,6 @@
* 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
{
diff --git a/EPPlus/EPPlusSDK.csproj b/EPPlus/EPPlusSDK.csproj
index 53ab074..9b5f21b 100644
--- a/EPPlus/EPPlusSDK.csproj
+++ b/EPPlus/EPPlusSDK.csproj
@@ -7,11 +7,10 @@
<Version>1.0.3</Version>
<DefaultItemExcludes>$(DefaultItemExcludes);Properties/AssemblyInfo.cs;FormulaParsing/LexicalAnalysis/TokenSeparatorHandlers/**;FormulaParsing/LexicalAnalysis/TokenHandler.cs;FormulaParsing/Excel/Functions/Math/Rank.cs</DefaultItemExcludes>
<DefineConstants>Core;STANDARD20</DefineConstants>
+ <ImplicitUsings>disable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
- <PackageReference Include="IronSoftware.System.Drawing" Version="2024.3.4" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
- <PackageReference Include="SixLabors.ImageSharp" Version="3.1.4" /> <!--Do not remove - b/335372123 and others-->
<PackageReference Include="System.CodeDom" Version="5.0.0" />
<PackageReference Include="System.Drawing.Common" Version="6.0.0" />
<PackageReference Include="System.Security.Cryptography.Pkcs" Version="5.0.1" />
diff --git a/EPPlus/ExcelBackgroundImage.cs b/EPPlus/ExcelBackgroundImage.cs
deleted file mode 100644
index 601cf09..0000000
--- a/EPPlus/ExcelBackgroundImage.cs
+++ /dev/null
@@ -1,174 +0,0 @@
-/*******************************************************************************
- * You may amend and distribute as you like, but don't remove this header!
- *
- * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
- * See http://www.codeplex.com/EPPlus for details.
- *
- * Copyright (C) 2011 Jan Källman
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
-
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
- * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
- *
- * All code and executables are provided "as is" with no warranty either express or 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.Compatibility;
-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
- {
-#if (Core)
- var img=ImageCompat.GetImageAsByteArray(value);
-#else
- ImageConverter ic = new ImageConverter();
- byte[] img = (byte[])ic.ConvertTo(value, typeof(byte[]));
-#endif
- 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));
- }
-
- 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);
-#if (Core)
- var fileBytes=ImageCompat.GetImageAsByteArray(img);
-#else
- var ic = new ImageConverter();
- byte[] fileBytes = (byte[])ic.ConvertTo(img, typeof(byte[]));
-#endif
- 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 != "")
- {
-#if (Core)
- var img=ImageCompat.GetImageAsByteArray(Image);
-#else
- var ic = new ImageConverter();
- byte[] img = (byte[])ic.ConvertTo(Image, typeof(byte[]));
-#endif
- 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);
- }
- }
-
- }
- }
- }
-}
diff --git a/EPPlus/ExcelColumn.cs b/EPPlus/ExcelColumn.cs
index 9e26ced..56ea994 100644
--- a/EPPlus/ExcelColumn.cs
+++ b/EPPlus/ExcelColumn.cs
@@ -4,7 +4,7 @@
* EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
* See http://www.codeplex.com/EPPlus for details.
*
- * Copyright (C) 2011 Jan Källman
+ * Copyright (C) 2011 Jan K�llman
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -26,8 +26,8 @@
*
* Author Change Date
*******************************************************************************
- * Jan Källman Initial Release 2009-10-01
- * Jan Källman License changed GPL-->LGPL 2011-12-27
+ * Jan K�llman Initial Release 2009-10-01
+ * Jan K�llman License changed GPL-->LGPL 2011-12-27
*******************************************************************************/
using System;
using System.Xml;
@@ -116,16 +116,7 @@
}
set
{
- if (_worksheet._package.DoAdjustDrawings)
- {
- var pos = _worksheet.Drawings.GetDrawingWidths();
- _hidden = value;
- _worksheet.Drawings.AdjustWidth(pos);
- }
- else
- {
- _hidden = value;
- }
+ _hidden = value;
}
}
#endregion
@@ -157,16 +148,7 @@
}
set
{
- if (_worksheet._package.DoAdjustDrawings)
- {
- var pos = _worksheet.Drawings.GetDrawingWidths();
- _width = value;
- _worksheet.Drawings.AdjustWidth(pos);
- }
- else
- {
- _width = value;
- }
+ _width = value;
if (_hidden && value!=0)
{
@@ -270,39 +252,7 @@
{
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>
diff --git a/EPPlus/ExcelHeaderFooter.cs b/EPPlus/ExcelHeaderFooter.cs
index 3f978c4..ce72dd8 100644
--- a/EPPlus/ExcelHeaderFooter.cs
+++ b/EPPlus/ExcelHeaderFooter.cs
@@ -30,36 +30,9 @@
* 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.Compatibility;
-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
@@ -116,94 +89,6 @@
/// 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
-#if (Core)
- var img=ImageCompat.GetImageAsByteArray(Picture);
-#else
- ImageConverter ic = new ImageConverter();
- byte[] img = (byte[])ic.ConvertTo(Picture, typeof(byte[]));
-#endif
- 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));
- }
-
- 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);
-#if (Core)
- var imgBytes=ImageCompat.GetImageAsByteArray(Picture);
-#else
- var ic = new ImageConverter();
- byte[] imgBytes = (byte[])ic.ConvertTo(Picture, typeof(byte[]));
-#endif
- 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
@@ -433,36 +318,6 @@
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>
@@ -505,40 +360,6 @@
}
}
}
- 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 = "";
diff --git a/EPPlus/ExcelPackage.cs b/EPPlus/ExcelPackage.cs
index 55539b0..bb2b983 100644
--- a/EPPlus/ExcelPackage.cs
+++ b/EPPlus/ExcelPackage.cs
@@ -4,7 +4,7 @@
* EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
* See http://www.codeplex.com/EPPlus for details.
*
- * Copyright (C) 2011 Jan Källman
+ * Copyright (C) 2011 Jan Källman
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -26,21 +26,18 @@
*
* Author Change Date
* ******************************************************************************
- * Jan Källman Initial Release 2009-10-01
- * Starnuto Di Topo & Jan Källman Added stream constructors
+ * 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
+ * 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
{
@@ -143,14 +140,14 @@
///
/// // set some document properties
/// package.Workbook.Properties.Title = "Invertory";
- /// package.Workbook.Properties.Author = "Jan Källman";
+ /// 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("Checked by", "Jan K�llman");
/// package.Workbook.Properties.SetCustomPropertyValue("AssemblyName", "EPPlus");
///
/// // save our new workbook and we are done!
@@ -243,7 +240,6 @@
/// </summary>
public ExcelPackage()
{
- Init();
ConstructNewFile(null);
}
/// <summary>
@@ -252,7 +248,6 @@
/// <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);
}
@@ -263,7 +258,6 @@
/// <param name="password">Password for an encrypted package</param>
public ExcelPackage(FileInfo newFile, string password)
{
- Init();
File = newFile;
ConstructNewFile(password);
}
@@ -275,7 +269,6 @@
/// <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);
}
@@ -288,7 +281,6 @@
/// <param name="password">Password to decrypted the template</param>
public ExcelPackage(FileInfo newFile, FileInfo template, string password)
{
- Init();
File = newFile;
CreateFromTemplate(template, password);
}
@@ -299,7 +291,6 @@
/// <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)
{
@@ -314,7 +305,6 @@
/// <param name="password">Password to decrypted the template</param>
public ExcelPackage(FileInfo template, bool useStream, string password)
{
- Init();
CreateFromTemplate(template, password);
if (useStream == false)
{
@@ -327,7 +317,6 @@
/// <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;
@@ -350,8 +339,6 @@
{
throw new Exception("The stream must be read/write");
}
-
- Init();
if (newStream.Length > 0)
{
Load(newStream,Password);
@@ -380,7 +367,6 @@
{
throw new Exception("The stream must be read/write");
}
- Init();
Load(templateStream, newStream, null);
}
/// <summary>
@@ -399,7 +385,6 @@
{
throw new Exception("The stream must be read/write");
}
- Init();
Load(templateStream, newStream, Password);
}
#endregion
@@ -493,13 +478,6 @@
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>
@@ -659,15 +637,6 @@
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,
@@ -704,37 +673,6 @@
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
diff --git a/EPPlus/ExcelRangeBase.cs b/EPPlus/ExcelRangeBase.cs
index 123faa2..d3c3c20 100644
--- a/EPPlus/ExcelRangeBase.cs
+++ b/EPPlus/ExcelRangeBase.cs
@@ -774,159 +774,6 @@
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))
- {
- g.PageUnit = GraphicsUnit.Pixel;
- var normalSize = (float)Math.Truncate(g.MeasureString("00", nfont, 10000, StringFormat.GenericTypographic).Width - g.MeasureString("0", nfont, 10000, StringFormat.GenericTypographic).Width);
- 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, 10000, StringFormat.GenericTypographic);
- 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)
{
diff --git a/EPPlus/ExcelRow.cs b/EPPlus/ExcelRow.cs
index 0cc2d1f..18eaf34 100644
--- a/EPPlus/ExcelRow.cs
+++ b/EPPlus/ExcelRow.cs
@@ -4,7 +4,7 @@
* EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
* See http://www.codeplex.com/EPPlus for details.
*
- * Copyright (C) 2011 Jan Källman
+ * Copyright (C) 2011 Jan K�llman
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -26,8 +26,8 @@
*
* Author Change Date
* ******************************************************************************
- * Jan Källman Initial Release 2009-10-01
- * Jan Källman License changed GPL-->LGPL 2011-12-27
+ * Jan K�llman Initial Release 2009-10-01
+ * Jan K�llman License changed GPL-->LGPL 2011-12-27
*******************************************************************************/
using System;
@@ -144,16 +144,7 @@
set
{
var r = GetRowInternal();
- if (_worksheet._package.DoAdjustDrawings)
- {
- var pos = _worksheet.Drawings.GetDrawingWidths();
- r.Height = value;
- _worksheet.Drawings.AdjustHeight(pos);
- }
- else
- {
- r.Height = value;
- }
+ r.Height = value;
if (r.Hidden && value != 0)
{
diff --git a/EPPlus/ExcelWorkbook.cs b/EPPlus/ExcelWorkbook.cs
index 0e1a022..e47b791 100644
--- a/EPPlus/ExcelWorkbook.cs
+++ b/EPPlus/ExcelWorkbook.cs
@@ -4,7 +4,7 @@
* EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
* See http://www.codeplex.com/EPPlus for details.
*
- * Copyright (C) 2011 Jan Källman
+ * Copyright (C) 2011 Jan Källman
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -26,8 +26,8 @@
*
* Author Change Date
* ******************************************************************************
- * Jan Källman Initial Release 2011-01-01
- * Jan Källman License changed GPL-->LGPL 2011-12-27
+ * 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;
@@ -37,7 +37,6 @@
using System.Collections.Generic;
using System.Text;
using System.Globalization;
-using OfficeOpenXml.VBA;
using OfficeOpenXml.Utils;
using OfficeOpenXml.FormulaParsing;
using OfficeOpenXml.FormulaParsing.LexicalAnalysis;
@@ -433,45 +432,7 @@
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>
@@ -521,20 +482,6 @@
{
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
@@ -762,7 +709,8 @@
DeleteCalcChain();
- if (_vba == null && !_package.Package.PartExists(new Uri(ExcelVbaProject.PartUri, UriKind.Relative)))
+ const string vbaPartUri = "/xl/vbaProject.bin";
+ if (!_package.Package.PartExists(new Uri(vbaPartUri, UriKind.Relative)))
{
if (Part.ContentType != ExcelPackage.contentTypeWorkbookDefault)
{
@@ -814,15 +762,6 @@
// Data validation
ValidateDataValidations();
-
- //VBA
- if (_vba!=null)
- {
-#if !MONO
- VbaProject.Save();
-#endif
- }
-
}
private void DeleteCalcChain()
{
@@ -1096,7 +1035,6 @@
_sharedStringsList.Clear();
_sharedStringsList = null;
}
- _vba = null;
if (_worksheets != null)
{
_worksheets.Dispose();
diff --git a/EPPlus/ExcelWorksheet.cs b/EPPlus/ExcelWorksheet.cs
index 67994dd..6ee3dd1 100644
--- a/EPPlus/ExcelWorksheet.cs
+++ b/EPPlus/ExcelWorksheet.cs
@@ -34,15 +34,9 @@
using System.Xml;
using System.Collections.Generic;
using System.IO;
-using System.Configuration;
-using OfficeOpenXml.Drawing;
-using System.Diagnostics;
-using OfficeOpenXml.FormulaParsing.Excel.Functions.Logical;
-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;
@@ -52,11 +46,9 @@
using System.ComponentModel;
using OfficeOpenXml.ConditionalFormatting;
using OfficeOpenXml.Utils;
-using Ionic.Zip;
-using IronSoftware.Drawing;
using OfficeOpenXml.FormulaParsing.LexicalAnalysis;
-using OfficeOpenXml.FormulaParsing;
using OfficeOpenXml.Packaging.Ionic.Zip;
+
namespace OfficeOpenXml
{
/// <summary>
@@ -90,23 +82,10 @@
/// </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
@@ -714,28 +693,6 @@
}
}
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
{
@@ -752,20 +709,7 @@
{
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.
@@ -838,8 +782,6 @@
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);
@@ -865,7 +807,6 @@
else
LoadXmlSafe(_worksheetXml, xml, encoding);
- _package.DoAdjustDrawings = doAdjust;
ClearNodes();
}
/// <summary>
@@ -2930,42 +2871,12 @@
{
this.SetXmlNodeString("d:dimension/@ref", d.Address);
}
-
-
- if (!HasDrawings() || 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)
{
@@ -4043,30 +3954,7 @@
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;
- }
- }
-
- public bool HasDrawings()
- {
- return (_drawings != null);
- }
-
- #endregion
+
ExcelTableCollection _tables = null;
/// <summary>
/// Tables defined in the worksheet.
@@ -4137,21 +4025,7 @@
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!
@@ -4347,7 +4221,6 @@
_vmlDrawings = null;
_conditionalFormatting = null;
_dataValidation = null;
- _drawings = null;
}
/// <summary>
diff --git a/EPPlus/ExcelWorksheets.cs b/EPPlus/ExcelWorksheets.cs
index ef13eaa..475af58 100644
--- a/EPPlus/ExcelWorksheets.cs
+++ b/EPPlus/ExcelWorksheets.cs
@@ -4,7 +4,7 @@
* EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
* See http://www.codeplex.com/EPPlus for details.
*
- * Copyright (C) 2011 Jan K�llman
+ * Copyright (C) 2011 Jan Källman
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -26,26 +26,16 @@
*
* Author Change Date
* ******************************************************************************
- * Jan K�llman Initial Release 2009-10-01
- * Jan K�llman License changed GPL-->LGPL 2011-12-27
+ * 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.FormulaParsing.Excel.Functions.Logical;
-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>
@@ -148,11 +138,6 @@
/// <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)
@@ -162,589 +147,28 @@
{
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);
+ GetSheetURI(ref Name, out sheetID, out uriWorksheet, false);
+ Packaging.ZipPackagePart worksheetPart = _pck.Package.CreatePart(uriWorksheet, 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);
+ XmlDocument worksheetXml = CreateNewWorksheet(false);
worksheetXml.Save(streamWorksheet);
_pck.Package.Flush();
- string rel = CreateWorkbookRel(Name, sheetID, uriWorksheet, isChart);
+ string rel = CreateWorkbookRel(Name, sheetID, uriWorksheet, false);
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.TopNode != null && Copy.TopNode.SelectSingleNode("d:headerFooter", NameSpaceManager)==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");
- added.DeleteNode("d:legacyDrawingHF");
-
- //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.ExportStream(picPart.GetStream(FileMode.Create, FileAccess.Write), pic.ImageFormat);
- }
-
- var rel = part.CreateRelationship(UriHelper.GetRelativeUri(workSheet.WorksheetUri, uri), Packaging.TargetMode.Internal, ExcelPackage.schemaRelationships + "/image");
- //Fixes problem with invalid image when the same image is used more than once.
- XmlNode relAtt =
- drawXml.SelectSingleNode(
- string.Format(
- "//xdr:pic/xdr:nvPicPr/xdr:cNvPr/@name[.='{0}']/../../../xdr:blipFill/a:blip/@r:embed",
- pic.Name), Copy.Drawings.NameSpaceManager);
- if(relAtt!=null)
- {
- relAtt.Value = rel.Id;
- }
- if (_pck._images.ContainsKey(pic.ImageHash))
- {
- _pck._images[pic.ImageHash].RefCount++;
- }
- }
- }
- //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)
{
@@ -863,127 +287,7 @@
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];
- if (rel.RelationshipType != ExcelPackage.schemaImage)
- {
- 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>
@@ -1016,21 +320,6 @@
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)
{
diff --git a/EPPlus/FontSize.cs b/EPPlus/FontSize.cs
deleted file mode 100644
index 165a726..0000000
--- a/EPPlus/FontSize.cs
+++ /dev/null
@@ -1,242 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace OfficeOpenXml
-{
- public class FontSizeInfo
- {
- public FontSizeInfo(float height, float width)
- {
- Width = width;
- Height = height;
- }
- public float Height { get; set; }
- public float Width { get; set; }
- }
- public static class FontSize
- {
- public readonly static Dictionary<string, Dictionary<float, FontSizeInfo>> FontHeights = new Dictionary<string, Dictionary<float, FontSizeInfo>>(StringComparer.InvariantCultureIgnoreCase)
- {
- {"Times New Roman",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,6)},{11,new FontSizeInfo(20,7)},{12,new FontSizeInfo(21,8)},{14,new FontSizeInfo(25,9)},{16,new FontSizeInfo(27,11)},{18,new FontSizeInfo(31,12)},{20,new FontSizeInfo(35,14)},{22,new FontSizeInfo(37,14)},{24,new FontSizeInfo(41,16)},{26,new FontSizeInfo(44,18)},{28,new FontSizeInfo(47,19)},{36,new FontSizeInfo(61,24)},{48,new FontSizeInfo(82,32)},{72,new FontSizeInfo(122,48)},{96,new FontSizeInfo(164,64)},{128,new FontSizeInfo(216,86)},{256,new FontSizeInfo(428,171)}}},
- {"Arial",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(20,8)},{12,new FontSizeInfo(21,9)},{14,new FontSizeInfo(24,11)},{16,new FontSizeInfo(27,12)},{18,new FontSizeInfo(31,13)},{20,new FontSizeInfo(34,15)},{22,new FontSizeInfo(36,16)},{24,new FontSizeInfo(40,18)},{26,new FontSizeInfo(44,19)},{28,new FontSizeInfo(46,21)},{36,new FontSizeInfo(59,27)},{48,new FontSizeInfo(79,36)},{72,new FontSizeInfo(120,53)},{96,new FontSizeInfo(159,71)},{128,new FontSizeInfo(213,95)},{256,new FontSizeInfo(424,190)}}},
- {"Courier New",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,7)},{10,new FontSizeInfo(20,8)},{11,new FontSizeInfo(20,9)},{12,new FontSizeInfo(21,10)},{14,new FontSizeInfo(25,11)},{16,new FontSizeInfo(28,13)},{18,new FontSizeInfo(32,14)},{20,new FontSizeInfo(35,16)},{22,new FontSizeInfo(38,17)},{24,new FontSizeInfo(42,19)},{26,new FontSizeInfo(46,21)},{28,new FontSizeInfo(48,22)},{36,new FontSizeInfo(62,29)},{48,new FontSizeInfo(83,38)},{72,new FontSizeInfo(123,58)},{96,new FontSizeInfo(164,77)},{128,new FontSizeInfo(219,103)},{256,new FontSizeInfo(444,205)}}},
- {"Symbol",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,4)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(20,8)},{12,new FontSizeInfo(21,8)},{14,new FontSizeInfo(24,10)},{16,new FontSizeInfo(29,11)},{18,new FontSizeInfo(31,12)},{20,new FontSizeInfo(35,14)},{22,new FontSizeInfo(38,15)},{24,new FontSizeInfo(40,16)},{26,new FontSizeInfo(44,18)},{28,new FontSizeInfo(48,19)},{36,new FontSizeInfo(60,24)},{48,new FontSizeInfo(79,32)},{72,new FontSizeInfo(120,48)},{96,new FontSizeInfo(159,64)},{128,new FontSizeInfo(212,86)},{256,new FontSizeInfo(421,171)}}},
- {"Wingdings",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,11)},{8,new FontSizeInfo(20,15)},{10,new FontSizeInfo(20,17)},{11,new FontSizeInfo(20,20)},{12,new FontSizeInfo(21,22)},{14,new FontSizeInfo(24,26)},{16,new FontSizeInfo(26,28)},{18,new FontSizeInfo(30,32)},{20,new FontSizeInfo(34,36)},{22,new FontSizeInfo(36,39)},{24,new FontSizeInfo(40,43)},{26,new FontSizeInfo(43,47)},{28,new FontSizeInfo(46,50)},{36,new FontSizeInfo(59,64)},{48,new FontSizeInfo(79,86)},{72,new FontSizeInfo(117,129)},{96,new FontSizeInfo(156,172)},{128,new FontSizeInfo(208,230)},{256,new FontSizeInfo(414,457)}}},
- {"SimSun",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(20,8)},{12,new FontSizeInfo(21,8)},{14,new FontSizeInfo(25,10)},{16,new FontSizeInfo(27,11)},{18,new FontSizeInfo(30,12)},{20,new FontSizeInfo(34,14)},{22,new FontSizeInfo(36,15)},{24,new FontSizeInfo(42,16)},{26,new FontSizeInfo(45,18)},{28,new FontSizeInfo(47,19)},{36,new FontSizeInfo(62,24)},{48,new FontSizeInfo(82,32)},{72,new FontSizeInfo(123,48)},{96,new FontSizeInfo(163,64)},{128,new FontSizeInfo(218,86)},{256,new FontSizeInfo(436,171)}}},
- {"Century",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(20,8)},{12,new FontSizeInfo(21,9)},{14,new FontSizeInfo(24,11)},{16,new FontSizeInfo(27,12)},{18,new FontSizeInfo(30,13)},{20,new FontSizeInfo(34,15)},{22,new FontSizeInfo(36,16)},{24,new FontSizeInfo(40,18)},{26,new FontSizeInfo(44,19)},{28,new FontSizeInfo(46,21)},{36,new FontSizeInfo(59,27)},{48,new FontSizeInfo(79,36)},{72,new FontSizeInfo(118,53)},{96,new FontSizeInfo(157,71)},{128,new FontSizeInfo(209,95)},{256,new FontSizeInfo(416,190)}}},
- {"Sylfaen",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(21,7)},{11,new FontSizeInfo(20,8)},{12,new FontSizeInfo(24,8)},{14,new FontSizeInfo(26,10)},{16,new FontSizeInfo(28,11)},{18,new FontSizeInfo(32,12)},{20,new FontSizeInfo(36,14)},{22,new FontSizeInfo(41,15)},{24,new FontSizeInfo(44,16)},{26,new FontSizeInfo(48,18)},{28,new FontSizeInfo(49,19)},{36,new FontSizeInfo(63,24)},{48,new FontSizeInfo(86,32)},{72,new FontSizeInfo(129,48)},{96,new FontSizeInfo(167,64)},{128,new FontSizeInfo(224,86)},{256,new FontSizeInfo(452,171)}}},
- {"Cambria Math",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(85,6)},{10,new FontSizeInfo(102,7)},{11,new FontSizeInfo(117,8)},{12,new FontSizeInfo(124,9)},{14,new FontSizeInfo(147,11)},{16,new FontSizeInfo(162,12)},{18,new FontSizeInfo(186,13)},{20,new FontSizeInfo(209,15)},{22,new FontSizeInfo(223,16)},{24,new FontSizeInfo(248,18)},{26,new FontSizeInfo(270,19)},{28,new FontSizeInfo(285,20)},{36,new FontSizeInfo(371,27)},{48,new FontSizeInfo(493,35)},{72,new FontSizeInfo(739,53)},{96,new FontSizeInfo(986,71)},{128,new FontSizeInfo(1317,95)},{256,new FontSizeInfo(2047,189)}}},
- {"Yu Gothic",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(22,7)},{11,new FontSizeInfo(25,8)},{12,new FontSizeInfo(26,9)},{14,new FontSizeInfo(32,11)},{16,new FontSizeInfo(34,12)},{18,new FontSizeInfo(40,13)},{20,new FontSizeInfo(44,15)},{22,new FontSizeInfo(47,16)},{24,new FontSizeInfo(53,18)},{26,new FontSizeInfo(57,19)},{28,new FontSizeInfo(59,21)},{36,new FontSizeInfo(78,27)},{48,new FontSizeInfo(102,36)},{72,new FontSizeInfo(154,53)},{96,new FontSizeInfo(206,71)},{128,new FontSizeInfo(276,95)},{256,new FontSizeInfo(551,190)}}},
- {"DengXian",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,8)},{11,new FontSizeInfo(20,9)},{12,new FontSizeInfo(21,9)},{14,new FontSizeInfo(25,11)},{16,new FontSizeInfo(27,12)},{18,new FontSizeInfo(31,14)},{20,new FontSizeInfo(35,16)},{22,new FontSizeInfo(37,17)},{24,new FontSizeInfo(41,19)},{26,new FontSizeInfo(45,20)},{28,new FontSizeInfo(47,21)},{36,new FontSizeInfo(61,28)},{48,new FontSizeInfo(81,37)},{72,new FontSizeInfo(121,56)},{96,new FontSizeInfo(161,74)},{128,new FontSizeInfo(215,99)},{256,new FontSizeInfo(428,197)}}},
- {"Arial Unicode MS",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(21,7)},{11,new FontSizeInfo(22,8)},{12,new FontSizeInfo(23,9)},{14,new FontSizeInfo(27,11)},{16,new FontSizeInfo(30,12)},{18,new FontSizeInfo(36,13)},{20,new FontSizeInfo(39,15)},{22,new FontSizeInfo(42,16)},{24,new FontSizeInfo(46,18)},{26,new FontSizeInfo(49,19)},{28,new FontSizeInfo(54,21)},{36,new FontSizeInfo(68,27)},{48,new FontSizeInfo(90,36)},{72,new FontSizeInfo(137,53)},{96,new FontSizeInfo(182,71)},{128,new FontSizeInfo(242,95)},{256,new FontSizeInfo(480,190)}}},
- {"Calibri Light",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(20,8)},{12,new FontSizeInfo(21,8)},{14,new FontSizeInfo(25,10)},{16,new FontSizeInfo(28,11)},{18,new FontSizeInfo(31,12)},{20,new FontSizeInfo(35,14)},{22,new FontSizeInfo(38,15)},{24,new FontSizeInfo(42,16)},{26,new FontSizeInfo(45,18)},{28,new FontSizeInfo(48,19)},{36,new FontSizeInfo(62,24)},{48,new FontSizeInfo(82,32)},{72,new FontSizeInfo(123,49)},{96,new FontSizeInfo(163,65)},{128,new FontSizeInfo(218,87)},{256,new FontSizeInfo(434,173)}}},
- {"Calibri",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(20,7)},{12,new FontSizeInfo(21,8)},{14,new FontSizeInfo(25,10)},{16,new FontSizeInfo(28,11)},{18,new FontSizeInfo(31,12)},{20,new FontSizeInfo(35,14)},{22,new FontSizeInfo(38,15)},{24,new FontSizeInfo(42,16)},{26,new FontSizeInfo(45,18)},{28,new FontSizeInfo(48,19)},{36,new FontSizeInfo(62,24)},{48,new FontSizeInfo(82,32)},{72,new FontSizeInfo(123,49)},{96,new FontSizeInfo(163,65)},{128,new FontSizeInfo(218,87)},{256,new FontSizeInfo(434,173)}}},
- {"Georgia",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,8)},{10,new FontSizeInfo(20,9)},{11,new FontSizeInfo(20,9)},{12,new FontSizeInfo(21,10)},{14,new FontSizeInfo(24,12)},{16,new FontSizeInfo(27,13)},{18,new FontSizeInfo(31,15)},{20,new FontSizeInfo(34,17)},{22,new FontSizeInfo(36,18)},{24,new FontSizeInfo(40,20)},{26,new FontSizeInfo(44,21)},{28,new FontSizeInfo(46,23)},{36,new FontSizeInfo(60,29)},{48,new FontSizeInfo(79,39)},{72,new FontSizeInfo(118,59)},{96,new FontSizeInfo(157,79)},{128,new FontSizeInfo(209,105)},{256,new FontSizeInfo(417,209)}}},
- {"Cambria",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(20,8)},{12,new FontSizeInfo(21,9)},{14,new FontSizeInfo(24,11)},{16,new FontSizeInfo(27,12)},{18,new FontSizeInfo(30,13)},{20,new FontSizeInfo(34,15)},{22,new FontSizeInfo(36,16)},{24,new FontSizeInfo(40,18)},{26,new FontSizeInfo(44,19)},{28,new FontSizeInfo(46,20)},{36,new FontSizeInfo(60,27)},{48,new FontSizeInfo(79,35)},{72,new FontSizeInfo(118,53)},{96,new FontSizeInfo(157,71)},{128,new FontSizeInfo(210,95)},{256,new FontSizeInfo(418,189)}}},
- {"Marlett",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,8)},{8,new FontSizeInfo(20,11)},{10,new FontSizeInfo(20,13)},{11,new FontSizeInfo(22,15)},{12,new FontSizeInfo(23,16)},{14,new FontSizeInfo(26,19)},{16,new FontSizeInfo(28,21)},{18,new FontSizeInfo(31,24)},{20,new FontSizeInfo(34,27)},{22,new FontSizeInfo(36,29)},{24,new FontSizeInfo(39,32)},{26,new FontSizeInfo(42,35)},{28,new FontSizeInfo(44,37)},{36,new FontSizeInfo(55,48)},{48,new FontSizeInfo(71,64)},{72,new FontSizeInfo(103,96)},{96,new FontSizeInfo(135,128)},{128,new FontSizeInfo(178,171)},{256,new FontSizeInfo(348,341)}}},
- {"Arial Black",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,7)},{10,new FontSizeInfo(21,9)},{11,new FontSizeInfo(25,10)},{12,new FontSizeInfo(26,11)},{14,new FontSizeInfo(30,13)},{16,new FontSizeInfo(33,14)},{18,new FontSizeInfo(36,16)},{20,new FontSizeInfo(42,18)},{22,new FontSizeInfo(45,19)},{24,new FontSizeInfo(49,21)},{26,new FontSizeInfo(55,23)},{28,new FontSizeInfo(57,25)},{36,new FontSizeInfo(74,32)},{48,new FontSizeInfo(97,43)},{72,new FontSizeInfo(147,64)},{96,new FontSizeInfo(195,85)},{128,new FontSizeInfo(259,114)},{256,new FontSizeInfo(516,227)}}},
- {"Candara",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(20,8)},{12,new FontSizeInfo(21,9)},{14,new FontSizeInfo(25,10)},{16,new FontSizeInfo(28,12)},{18,new FontSizeInfo(31,13)},{20,new FontSizeInfo(35,15)},{22,new FontSizeInfo(38,16)},{24,new FontSizeInfo(42,18)},{26,new FontSizeInfo(45,19)},{28,new FontSizeInfo(48,20)},{36,new FontSizeInfo(62,26)},{48,new FontSizeInfo(82,35)},{72,new FontSizeInfo(123,53)},{96,new FontSizeInfo(163,71)},{128,new FontSizeInfo(218,94)},{256,new FontSizeInfo(434,188)}}},
- {"Comic Sans MS",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,7)},{10,new FontSizeInfo(21,8)},{11,new FontSizeInfo(22,9)},{12,new FontSizeInfo(26,10)},{14,new FontSizeInfo(28,12)},{16,new FontSizeInfo(32,13)},{18,new FontSizeInfo(36,15)},{20,new FontSizeInfo(42,16)},{22,new FontSizeInfo(44,18)},{24,new FontSizeInfo(50,20)},{26,new FontSizeInfo(54,21)},{28,new FontSizeInfo(57,23)},{36,new FontSizeInfo(73,29)},{48,new FontSizeInfo(98,39)},{72,new FontSizeInfo(147,59)},{96,new FontSizeInfo(190,78)},{128,new FontSizeInfo(258,104)},{256,new FontSizeInfo(511,208)}}},
- {"Consolas",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(20,8)},{12,new FontSizeInfo(21,9)},{14,new FontSizeInfo(25,10)},{16,new FontSizeInfo(27,12)},{18,new FontSizeInfo(31,13)},{20,new FontSizeInfo(35,15)},{22,new FontSizeInfo(37,16)},{24,new FontSizeInfo(41,18)},{26,new FontSizeInfo(45,19)},{28,new FontSizeInfo(47,20)},{36,new FontSizeInfo(61,26)},{48,new FontSizeInfo(81,35)},{72,new FontSizeInfo(121,53)},{96,new FontSizeInfo(161,70)},{128,new FontSizeInfo(215,94)},{256,new FontSizeInfo(428,187)}}},
- {"Constantia",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(20,8)},{12,new FontSizeInfo(21,9)},{14,new FontSizeInfo(25,10)},{16,new FontSizeInfo(28,11)},{18,new FontSizeInfo(31,13)},{20,new FontSizeInfo(35,15)},{22,new FontSizeInfo(38,16)},{24,new FontSizeInfo(42,17)},{26,new FontSizeInfo(45,19)},{28,new FontSizeInfo(48,20)},{36,new FontSizeInfo(62,26)},{48,new FontSizeInfo(82,35)},{72,new FontSizeInfo(123,52)},{96,new FontSizeInfo(163,70)},{128,new FontSizeInfo(218,93)},{256,new FontSizeInfo(434,186)}}},
- {"Corbel",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(20,8)},{12,new FontSizeInfo(21,8)},{14,new FontSizeInfo(25,10)},{16,new FontSizeInfo(28,11)},{18,new FontSizeInfo(31,13)},{20,new FontSizeInfo(35,14)},{22,new FontSizeInfo(38,15)},{24,new FontSizeInfo(42,17)},{26,new FontSizeInfo(45,18)},{28,new FontSizeInfo(48,19)},{36,new FontSizeInfo(62,25)},{48,new FontSizeInfo(82,34)},{72,new FontSizeInfo(123,50)},{96,new FontSizeInfo(163,67)},{128,new FontSizeInfo(218,90)},{256,new FontSizeInfo(434,179)}}},
- {"Ebrima",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(22,8)},{12,new FontSizeInfo(23,9)},{14,new FontSizeInfo(27,10)},{16,new FontSizeInfo(34,11)},{18,new FontSizeInfo(35,13)},{20,new FontSizeInfo(41,15)},{22,new FontSizeInfo(44,16)},{24,new FontSizeInfo(50,17)},{26,new FontSizeInfo(51,19)},{28,new FontSizeInfo(54,20)},{36,new FontSizeInfo(70,26)},{48,new FontSizeInfo(94,35)},{72,new FontSizeInfo(138,52)},{96,new FontSizeInfo(184,69)},{128,new FontSizeInfo(245,92)},{256,new FontSizeInfo(490,184)}}},
- {"Franklin Gothic Medium",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,8)},{11,new FontSizeInfo(21,9)},{12,new FontSizeInfo(22,9)},{14,new FontSizeInfo(26,11)},{16,new FontSizeInfo(28,12)},{18,new FontSizeInfo(32,14)},{20,new FontSizeInfo(36,16)},{22,new FontSizeInfo(39,17)},{24,new FontSizeInfo(40,19)},{26,new FontSizeInfo(44,21)},{28,new FontSizeInfo(46,22)},{36,new FontSizeInfo(64,28)},{48,new FontSizeInfo(85,38)},{72,new FontSizeInfo(126,56)},{96,new FontSizeInfo(168,75)},{128,new FontSizeInfo(224,100)},{256,new FontSizeInfo(416,200)}}},
- {"Gabriola",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(25,4)},{10,new FontSizeInfo(26,5)},{11,new FontSizeInfo(32,6)},{12,new FontSizeInfo(33,6)},{14,new FontSizeInfo(40,8)},{16,new FontSizeInfo(44,8)},{18,new FontSizeInfo(51,10)},{20,new FontSizeInfo(56,11)},{22,new FontSizeInfo(61,12)},{24,new FontSizeInfo(66,13)},{26,new FontSizeInfo(73,14)},{28,new FontSizeInfo(76,15)},{36,new FontSizeInfo(98,19)},{48,new FontSizeInfo(131,26)},{72,new FontSizeInfo(195,38)},{96,new FontSizeInfo(262,51)},{128,new FontSizeInfo(349,69)},{256,new FontSizeInfo(693,137)}}},
- {"Gadugi",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(20,8)},{12,new FontSizeInfo(21,9)},{14,new FontSizeInfo(24,10)},{16,new FontSizeInfo(27,11)},{18,new FontSizeInfo(31,13)},{20,new FontSizeInfo(34,15)},{22,new FontSizeInfo(37,16)},{24,new FontSizeInfo(40,17)},{26,new FontSizeInfo(44,19)},{28,new FontSizeInfo(47,20)},{36,new FontSizeInfo(60,26)},{48,new FontSizeInfo(81,35)},{72,new FontSizeInfo(120,52)},{96,new FontSizeInfo(159,69)},{128,new FontSizeInfo(213,92)},{256,new FontSizeInfo(482,184)}}},
- {"Impact",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(21,8)},{12,new FontSizeInfo(22,9)},{14,new FontSizeInfo(24,10)},{16,new FontSizeInfo(28,11)},{18,new FontSizeInfo(30,13)},{20,new FontSizeInfo(36,15)},{22,new FontSizeInfo(38,16)},{24,new FontSizeInfo(40,17)},{26,new FontSizeInfo(45,19)},{28,new FontSizeInfo(46,20)},{36,new FontSizeInfo(63,26)},{48,new FontSizeInfo(83,35)},{72,new FontSizeInfo(119,52)},{96,new FontSizeInfo(158,69)},{128,new FontSizeInfo(212,93)},{256,new FontSizeInfo(420,185)}}},
- {"Javanese Text",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(30,6)},{10,new FontSizeInfo(33,8)},{11,new FontSizeInfo(39,9)},{12,new FontSizeInfo(41,9)},{14,new FontSizeInfo(49,11)},{16,new FontSizeInfo(53,12)},{18,new FontSizeInfo(61,14)},{20,new FontSizeInfo(70,16)},{22,new FontSizeInfo(74,17)},{24,new FontSizeInfo(82,19)},{26,new FontSizeInfo(90,21)},{28,new FontSizeInfo(94,22)},{36,new FontSizeInfo(122,28)},{48,new FontSizeInfo(162,38)},{72,new FontSizeInfo(243,57)},{96,new FontSizeInfo(324,76)},{128,new FontSizeInfo(433,101)},{256,new FontSizeInfo(860,200)}}},
- {"Leelawadee UI",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(22,8)},{12,new FontSizeInfo(23,9)},{14,new FontSizeInfo(27,10)},{16,new FontSizeInfo(34,11)},{18,new FontSizeInfo(35,13)},{20,new FontSizeInfo(41,15)},{22,new FontSizeInfo(44,16)},{24,new FontSizeInfo(50,17)},{26,new FontSizeInfo(51,19)},{28,new FontSizeInfo(54,20)},{36,new FontSizeInfo(70,26)},{48,new FontSizeInfo(92,35)},{72,new FontSizeInfo(136,52)},{96,new FontSizeInfo(180,69)},{128,new FontSizeInfo(241,92)},{256,new FontSizeInfo(482,184)}}},
- {"Leelawadee UI Semilight",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(22,8)},{12,new FontSizeInfo(23,9)},{14,new FontSizeInfo(27,10)},{16,new FontSizeInfo(34,12)},{18,new FontSizeInfo(35,13)},{20,new FontSizeInfo(41,15)},{22,new FontSizeInfo(44,16)},{24,new FontSizeInfo(50,18)},{26,new FontSizeInfo(51,19)},{28,new FontSizeInfo(54,20)},{36,new FontSizeInfo(70,26)},{48,new FontSizeInfo(92,35)},{72,new FontSizeInfo(136,53)},{96,new FontSizeInfo(180,70)},{128,new FontSizeInfo(241,94)},{256,new FontSizeInfo(482,187)}}},
- {"Lucida Console",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,7)},{10,new FontSizeInfo(20,8)},{11,new FontSizeInfo(20,9)},{12,new FontSizeInfo(21,10)},{14,new FontSizeInfo(24,11)},{16,new FontSizeInfo(26,13)},{18,new FontSizeInfo(30,14)},{20,new FontSizeInfo(34,16)},{22,new FontSizeInfo(36,17)},{24,new FontSizeInfo(40,19)},{26,new FontSizeInfo(43,21)},{28,new FontSizeInfo(46,22)},{36,new FontSizeInfo(59,29)},{48,new FontSizeInfo(79,39)},{72,new FontSizeInfo(117,58)},{96,new FontSizeInfo(156,77)},{128,new FontSizeInfo(208,103)},{256,new FontSizeInfo(414,205)}}},
- {"Lucida Sans Unicode",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,7)},{10,new FontSizeInfo(20,8)},{11,new FontSizeInfo(20,9)},{12,new FontSizeInfo(22,10)},{14,new FontSizeInfo(24,12)},{16,new FontSizeInfo(26,13)},{18,new FontSizeInfo(30,15)},{20,new FontSizeInfo(36,17)},{22,new FontSizeInfo(36,18)},{24,new FontSizeInfo(40,20)},{26,new FontSizeInfo(43,22)},{28,new FontSizeInfo(46,23)},{36,new FontSizeInfo(61,30)},{48,new FontSizeInfo(79,40)},{72,new FontSizeInfo(117,61)},{96,new FontSizeInfo(158,81)},{128,new FontSizeInfo(210,108)},{256,new FontSizeInfo(558,216)}}},
- {"Malgun Gothic",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(22,8)},{12,new FontSizeInfo(23,9)},{14,new FontSizeInfo(27,10)},{16,new FontSizeInfo(35,12)},{18,new FontSizeInfo(35,13)},{20,new FontSizeInfo(42,15)},{22,new FontSizeInfo(45,16)},{24,new FontSizeInfo(51,18)},{26,new FontSizeInfo(52,19)},{28,new FontSizeInfo(55,20)},{36,new FontSizeInfo(72,26)},{48,new FontSizeInfo(93,35)},{72,new FontSizeInfo(137,53)},{96,new FontSizeInfo(181,71)},{128,new FontSizeInfo(242,94)},{256,new FontSizeInfo(484,188)}}},
- {"Malgun Gothic Semilight",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(22,8)},{12,new FontSizeInfo(23,9)},{14,new FontSizeInfo(27,11)},{16,new FontSizeInfo(35,12)},{18,new FontSizeInfo(35,13)},{20,new FontSizeInfo(42,15)},{22,new FontSizeInfo(45,16)},{24,new FontSizeInfo(51,18)},{26,new FontSizeInfo(52,20)},{28,new FontSizeInfo(55,21)},{36,new FontSizeInfo(72,27)},{48,new FontSizeInfo(93,36)},{72,new FontSizeInfo(137,54)},{96,new FontSizeInfo(181,72)},{128,new FontSizeInfo(242,96)},{256,new FontSizeInfo(484,190)}}},
- {"Microsoft Himalaya",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,4)},{10,new FontSizeInfo(21,4)},{11,new FontSizeInfo(22,5)},{12,new FontSizeInfo(24,5)},{14,new FontSizeInfo(28,6)},{16,new FontSizeInfo(31,7)},{18,new FontSizeInfo(35,8)},{20,new FontSizeInfo(39,9)},{22,new FontSizeInfo(42,10)},{24,new FontSizeInfo(46,11)},{26,new FontSizeInfo(50,12)},{28,new FontSizeInfo(53,12)},{36,new FontSizeInfo(69,16)},{48,new FontSizeInfo(91,21)},{72,new FontSizeInfo(136,32)},{96,new FontSizeInfo(181,43)},{128,new FontSizeInfo(242,57)},{256,new FontSizeInfo(481,114)}}},
- {"Microsoft JhengHei",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,8)},{11,new FontSizeInfo(20,9)},{12,new FontSizeInfo(21,9)},{14,new FontSizeInfo(25,11)},{16,new FontSizeInfo(28,12)},{18,new FontSizeInfo(31,14)},{20,new FontSizeInfo(35,16)},{22,new FontSizeInfo(37,17)},{24,new FontSizeInfo(41,19)},{26,new FontSizeInfo(45,20)},{28,new FontSizeInfo(48,21)},{36,new FontSizeInfo(62,28)},{48,new FontSizeInfo(82,37)},{72,new FontSizeInfo(122,56)},{96,new FontSizeInfo(162,74)},{128,new FontSizeInfo(217,99)},{256,new FontSizeInfo(481,198)}}},
- {"Microsoft JhengHei UI",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,8)},{11,new FontSizeInfo(20,9)},{12,new FontSizeInfo(21,9)},{14,new FontSizeInfo(25,11)},{16,new FontSizeInfo(27,12)},{18,new FontSizeInfo(31,14)},{20,new FontSizeInfo(37,16)},{22,new FontSizeInfo(38,17)},{24,new FontSizeInfo(42,19)},{26,new FontSizeInfo(45,20)},{28,new FontSizeInfo(48,21)},{36,new FontSizeInfo(62,28)},{48,new FontSizeInfo(82,37)},{72,new FontSizeInfo(123,56)},{96,new FontSizeInfo(164,74)},{128,new FontSizeInfo(218,99)},{256,new FontSizeInfo(439,198)}}},
- {"Microsoft JhengHei Light",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(20,9)},{12,new FontSizeInfo(21,9)},{14,new FontSizeInfo(25,11)},{16,new FontSizeInfo(28,12)},{18,new FontSizeInfo(31,14)},{20,new FontSizeInfo(35,16)},{22,new FontSizeInfo(37,17)},{24,new FontSizeInfo(41,18)},{26,new FontSizeInfo(45,20)},{28,new FontSizeInfo(48,21)},{36,new FontSizeInfo(62,28)},{48,new FontSizeInfo(82,37)},{72,new FontSizeInfo(122,55)},{96,new FontSizeInfo(162,74)},{128,new FontSizeInfo(217,98)},{256,new FontSizeInfo(481,196)}}},
- {"Microsoft JhengHei UI Light",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(20,9)},{12,new FontSizeInfo(21,9)},{14,new FontSizeInfo(25,11)},{16,new FontSizeInfo(28,12)},{18,new FontSizeInfo(31,14)},{20,new FontSizeInfo(35,16)},{22,new FontSizeInfo(37,17)},{24,new FontSizeInfo(41,18)},{26,new FontSizeInfo(45,20)},{28,new FontSizeInfo(48,21)},{36,new FontSizeInfo(62,28)},{48,new FontSizeInfo(82,37)},{72,new FontSizeInfo(122,55)},{96,new FontSizeInfo(162,74)},{128,new FontSizeInfo(217,98)},{256,new FontSizeInfo(439,196)}}},
- {"Microsoft New Tai Lue",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(21,7)},{11,new FontSizeInfo(22,8)},{12,new FontSizeInfo(23,9)},{14,new FontSizeInfo(27,10)},{16,new FontSizeInfo(30,11)},{18,new FontSizeInfo(35,13)},{20,new FontSizeInfo(38,15)},{22,new FontSizeInfo(41,16)},{24,new FontSizeInfo(45,17)},{26,new FontSizeInfo(49,19)},{28,new FontSizeInfo(52,20)},{36,new FontSizeInfo(67,26)},{48,new FontSizeInfo(89,35)},{72,new FontSizeInfo(134,52)},{96,new FontSizeInfo(178,69)},{128,new FontSizeInfo(237,92)},{256,new FontSizeInfo(472,184)}}},
- {"Microsoft PhagsPa",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(22,8)},{12,new FontSizeInfo(23,9)},{14,new FontSizeInfo(26,10)},{16,new FontSizeInfo(29,11)},{18,new FontSizeInfo(33,13)},{20,new FontSizeInfo(36,15)},{22,new FontSizeInfo(39,16)},{24,new FontSizeInfo(43,17)},{26,new FontSizeInfo(48,19)},{28,new FontSizeInfo(51,20)},{36,new FontSizeInfo(64,26)},{48,new FontSizeInfo(86,35)},{72,new FontSizeInfo(128,52)},{96,new FontSizeInfo(171,69)},{128,new FontSizeInfo(228,92)},{256,new FontSizeInfo(452,184)}}},
- {"Microsoft Sans Serif",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(20,8)},{12,new FontSizeInfo(21,9)},{14,new FontSizeInfo(25,10)},{16,new FontSizeInfo(27,12)},{18,new FontSizeInfo(31,13)},{20,new FontSizeInfo(33,15)},{22,new FontSizeInfo(36,16)},{24,new FontSizeInfo(41,18)},{26,new FontSizeInfo(43,19)},{28,new FontSizeInfo(45,21)},{36,new FontSizeInfo(60,27)},{48,new FontSizeInfo(79,36)},{72,new FontSizeInfo(117,53)},{96,new FontSizeInfo(157,71)},{128,new FontSizeInfo(208,95)},{256,new FontSizeInfo(414,190)}}},
- {"Microsoft Tai Le",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(21,8)},{12,new FontSizeInfo(23,9)},{14,new FontSizeInfo(26,10)},{16,new FontSizeInfo(29,11)},{18,new FontSizeInfo(33,13)},{20,new FontSizeInfo(37,15)},{22,new FontSizeInfo(40,16)},{24,new FontSizeInfo(44,17)},{26,new FontSizeInfo(48,19)},{28,new FontSizeInfo(51,20)},{36,new FontSizeInfo(66,26)},{48,new FontSizeInfo(87,35)},{72,new FontSizeInfo(130,52)},{96,new FontSizeInfo(173,69)},{128,new FontSizeInfo(231,92)},{256,new FontSizeInfo(459,184)}}},
- {"Microsoft YaHei",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(21,6)},{10,new FontSizeInfo(22,8)},{11,new FontSizeInfo(22,9)},{12,new FontSizeInfo(23,9)},{14,new FontSizeInfo(27,11)},{16,new FontSizeInfo(30,12)},{18,new FontSizeInfo(33,14)},{20,new FontSizeInfo(37,16)},{22,new FontSizeInfo(40,17)},{24,new FontSizeInfo(43,19)},{26,new FontSizeInfo(49,21)},{28,new FontSizeInfo(51,22)},{36,new FontSizeInfo(65,28)},{48,new FontSizeInfo(86,38)},{72,new FontSizeInfo(128,56)},{96,new FontSizeInfo(170,75)},{128,new FontSizeInfo(228,100)},{256,new FontSizeInfo(471,200)}}},
- {"Microsoft YaHei UI",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(21,6)},{10,new FontSizeInfo(22,8)},{11,new FontSizeInfo(22,9)},{12,new FontSizeInfo(23,9)},{14,new FontSizeInfo(27,11)},{16,new FontSizeInfo(30,12)},{18,new FontSizeInfo(33,14)},{20,new FontSizeInfo(37,16)},{22,new FontSizeInfo(40,17)},{24,new FontSizeInfo(43,19)},{26,new FontSizeInfo(49,21)},{28,new FontSizeInfo(51,22)},{36,new FontSizeInfo(65,28)},{48,new FontSizeInfo(86,38)},{72,new FontSizeInfo(128,56)},{96,new FontSizeInfo(170,75)},{128,new FontSizeInfo(228,100)},{256,new FontSizeInfo(439,200)}}},
- {"Microsoft YaHei Light",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(21,6)},{10,new FontSizeInfo(22,7)},{11,new FontSizeInfo(22,9)},{12,new FontSizeInfo(23,9)},{14,new FontSizeInfo(27,11)},{16,new FontSizeInfo(30,12)},{18,new FontSizeInfo(33,14)},{20,new FontSizeInfo(37,15)},{22,new FontSizeInfo(42,17)},{24,new FontSizeInfo(45,18)},{26,new FontSizeInfo(51,20)},{28,new FontSizeInfo(53,21)},{36,new FontSizeInfo(67,28)},{48,new FontSizeInfo(88,37)},{72,new FontSizeInfo(132,55)},{96,new FontSizeInfo(176,73)},{128,new FontSizeInfo(236,98)},{256,new FontSizeInfo(459,195)}}},
- {"Microsoft YaHei UI Light",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(21,6)},{10,new FontSizeInfo(22,7)},{11,new FontSizeInfo(22,9)},{12,new FontSizeInfo(23,9)},{14,new FontSizeInfo(27,11)},{16,new FontSizeInfo(30,12)},{18,new FontSizeInfo(33,14)},{20,new FontSizeInfo(37,15)},{22,new FontSizeInfo(40,17)},{24,new FontSizeInfo(43,18)},{26,new FontSizeInfo(49,20)},{28,new FontSizeInfo(51,21)},{36,new FontSizeInfo(65,28)},{48,new FontSizeInfo(86,37)},{72,new FontSizeInfo(128,55)},{96,new FontSizeInfo(170,73)},{128,new FontSizeInfo(228,98)},{256,new FontSizeInfo(469,195)}}},
- {"Microsoft Yi Baiti",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(20,8)},{12,new FontSizeInfo(21,8)},{14,new FontSizeInfo(24,10)},{16,new FontSizeInfo(26,11)},{18,new FontSizeInfo(29,12)},{20,new FontSizeInfo(32,14)},{22,new FontSizeInfo(34,15)},{24,new FontSizeInfo(38,16)},{26,new FontSizeInfo(41,18)},{28,new FontSizeInfo(43,19)},{36,new FontSizeInfo(56,25)},{48,new FontSizeInfo(74,33)},{72,new FontSizeInfo(0,49)},{96,new FontSizeInfo(149,66)},{128,new FontSizeInfo(198,88)},{256,new FontSizeInfo(398,175)}}},
- {"MingLiU-ExtB",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(21,8)},{12,new FontSizeInfo(22,8)},{14,new FontSizeInfo(26,10)},{16,new FontSizeInfo(28,11)},{18,new FontSizeInfo(34,12)},{20,new FontSizeInfo(37,14)},{22,new FontSizeInfo(40,15)},{24,new FontSizeInfo(43,16)},{26,new FontSizeInfo(49,18)},{28,new FontSizeInfo(51,19)},{36,new FontSizeInfo(67,24)},{48,new FontSizeInfo(90,32)},{72,new FontSizeInfo(0,48)},{96,new FontSizeInfo(179,64)},{128,new FontSizeInfo(238,86)},{256,new FontSizeInfo(476,171)}}},
- {"PMingLiU-ExtB",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,5)},{10,new FontSizeInfo(20,6)},{11,new FontSizeInfo(21,7)},{12,new FontSizeInfo(22,8)},{14,new FontSizeInfo(26,9)},{16,new FontSizeInfo(28,10)},{18,new FontSizeInfo(34,11)},{20,new FontSizeInfo(37,13)},{22,new FontSizeInfo(40,14)},{24,new FontSizeInfo(43,15)},{26,new FontSizeInfo(49,16)},{28,new FontSizeInfo(51,17)},{36,new FontSizeInfo(67,23)},{48,new FontSizeInfo(90,30)},{72,new FontSizeInfo(0,45)},{96,new FontSizeInfo(179,60)},{128,new FontSizeInfo(238,80)},{256,new FontSizeInfo(476,160)}}},
- {"MingLiU_HKSCS-ExtB",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(21,8)},{12,new FontSizeInfo(22,8)},{14,new FontSizeInfo(26,10)},{16,new FontSizeInfo(28,11)},{18,new FontSizeInfo(34,12)},{20,new FontSizeInfo(37,14)},{22,new FontSizeInfo(40,15)},{24,new FontSizeInfo(43,16)},{26,new FontSizeInfo(49,18)},{28,new FontSizeInfo(51,19)},{36,new FontSizeInfo(67,24)},{48,new FontSizeInfo(90,32)},{72,new FontSizeInfo(0,48)},{96,new FontSizeInfo(179,64)},{128,new FontSizeInfo(238,86)},{256,new FontSizeInfo(476,171)}}},
- {"Mongolian Baiti",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(20,8)},{12,new FontSizeInfo(21,8)},{14,new FontSizeInfo(24,10)},{16,new FontSizeInfo(27,11)},{18,new FontSizeInfo(30,12)},{20,new FontSizeInfo(34,14)},{22,new FontSizeInfo(38,15)},{24,new FontSizeInfo(42,16)},{26,new FontSizeInfo(46,18)},{28,new FontSizeInfo(48,19)},{36,new FontSizeInfo(61,24)},{48,new FontSizeInfo(83,32)},{72,new FontSizeInfo(0,48)},{96,new FontSizeInfo(167,64)},{128,new FontSizeInfo(223,86)},{256,new FontSizeInfo(447,171)}}},
- {"MV Boli",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(21,8)},{10,new FontSizeInfo(20,9)},{11,new FontSizeInfo(22,11)},{12,new FontSizeInfo(23,11)},{14,new FontSizeInfo(27,13)},{16,new FontSizeInfo(30,15)},{18,new FontSizeInfo(33,17)},{20,new FontSizeInfo(35,19)},{22,new FontSizeInfo(42,20)},{24,new FontSizeInfo(43,22)},{26,new FontSizeInfo(49,25)},{28,new FontSizeInfo(51,26)},{36,new FontSizeInfo(65,34)},{48,new FontSizeInfo(89,45)},{72,new FontSizeInfo(0,67)},{96,new FontSizeInfo(171,90)},{128,new FontSizeInfo(231,120)},{256,new FontSizeInfo(597,239)}}},
- {"Myanmar Text",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(25,6)},{10,new FontSizeInfo(26,7)},{11,new FontSizeInfo(29,8)},{12,new FontSizeInfo(31,9)},{14,new FontSizeInfo(36,10)},{16,new FontSizeInfo(39,11)},{18,new FontSizeInfo(45,13)},{20,new FontSizeInfo(50,15)},{22,new FontSizeInfo(53,16)},{24,new FontSizeInfo(58,17)},{26,new FontSizeInfo(64,19)},{28,new FontSizeInfo(67,20)},{36,new FontSizeInfo(88,26)},{48,new FontSizeInfo(116,35)},{72,new FontSizeInfo(0,52)},{96,new FontSizeInfo(233,69)},{128,new FontSizeInfo(309,92)},{256,new FontSizeInfo(647,184)}}},
- {"Nirmala UI",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(22,8)},{12,new FontSizeInfo(23,9)},{14,new FontSizeInfo(27,10)},{16,new FontSizeInfo(34,11)},{18,new FontSizeInfo(35,13)},{20,new FontSizeInfo(41,15)},{22,new FontSizeInfo(44,16)},{24,new FontSizeInfo(50,17)},{26,new FontSizeInfo(51,19)},{28,new FontSizeInfo(54,20)},{36,new FontSizeInfo(70,26)},{48,new FontSizeInfo(92,35)},{72,new FontSizeInfo(0,52)},{96,new FontSizeInfo(180,69)},{128,new FontSizeInfo(241,92)},{256,new FontSizeInfo(482,184)}}},
- {"Nirmala UI Semilight",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(22,8)},{12,new FontSizeInfo(23,9)},{14,new FontSizeInfo(27,10)},{16,new FontSizeInfo(34,12)},{18,new FontSizeInfo(35,13)},{20,new FontSizeInfo(41,15)},{22,new FontSizeInfo(44,16)},{24,new FontSizeInfo(50,18)},{26,new FontSizeInfo(51,19)},{28,new FontSizeInfo(54,20)},{36,new FontSizeInfo(70,26)},{48,new FontSizeInfo(92,35)},{72,new FontSizeInfo(0,53)},{96,new FontSizeInfo(180,70)},{128,new FontSizeInfo(241,94)},{256,new FontSizeInfo(482,187)}}},
- {"Palatino Linotype",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(21,6)},{10,new FontSizeInfo(21,7)},{11,new FontSizeInfo(22,8)},{12,new FontSizeInfo(24,8)},{14,new FontSizeInfo(28,10)},{16,new FontSizeInfo(30,11)},{18,new FontSizeInfo(34,12)},{20,new FontSizeInfo(38,14)},{22,new FontSizeInfo(40,15)},{24,new FontSizeInfo(47,16)},{26,new FontSizeInfo(50,18)},{28,new FontSizeInfo(53,19)},{36,new FontSizeInfo(67,24)},{48,new FontSizeInfo(90,32)},{72,new FontSizeInfo(0,48)},{96,new FontSizeInfo(178,64)},{128,new FontSizeInfo(240,86)},{256,new FontSizeInfo(478,171)}}},
- {"Segoe MDL2 Assets",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,7)},{10,new FontSizeInfo(20,8)},{11,new FontSizeInfo(22,10)},{12,new FontSizeInfo(23,10)},{14,new FontSizeInfo(26,12)},{16,new FontSizeInfo(28,14)},{18,new FontSizeInfo(31,15)},{20,new FontSizeInfo(34,17)},{22,new FontSizeInfo(36,19)},{24,new FontSizeInfo(39,21)},{26,new FontSizeInfo(42,23)},{28,new FontSizeInfo(44,24)},{36,new FontSizeInfo(55,31)},{48,new FontSizeInfo(71,41)},{72,new FontSizeInfo(0,62)},{96,new FontSizeInfo(135,83)},{128,new FontSizeInfo(178,110)},{256,new FontSizeInfo(348,219)}}},
- {"Segoe Print",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(24,8)},{10,new FontSizeInfo(28,10)},{11,new FontSizeInfo(31,11)},{12,new FontSizeInfo(33,12)},{14,new FontSizeInfo(39,14)},{16,new FontSizeInfo(42,15)},{18,new FontSizeInfo(49,18)},{20,new FontSizeInfo(55,20)},{22,new FontSizeInfo(58,21)},{24,new FontSizeInfo(65,23)},{26,new FontSizeInfo(71,26)},{28,new FontSizeInfo(74,27)},{36,new FontSizeInfo(97,35)},{48,new FontSizeInfo(129,47)},{72,new FontSizeInfo(0,70)},{96,new FontSizeInfo(259,94)},{128,new FontSizeInfo(347,125)},{256,new FontSizeInfo(687,248)}}},
- {"Segoe Script",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(22,8)},{10,new FontSizeInfo(23,10)},{11,new FontSizeInfo(25,11)},{12,new FontSizeInfo(27,12)},{14,new FontSizeInfo(33,14)},{16,new FontSizeInfo(36,15)},{18,new FontSizeInfo(41,18)},{20,new FontSizeInfo(45,20)},{22,new FontSizeInfo(50,21)},{24,new FontSizeInfo(55,23)},{26,new FontSizeInfo(59,26)},{28,new FontSizeInfo(62,27)},{36,new FontSizeInfo(81,35)},{48,new FontSizeInfo(109,47)},{72,new FontSizeInfo(0,70)},{96,new FontSizeInfo(214,94)},{128,new FontSizeInfo(287,125)},{256,new FontSizeInfo(571,248)}}},
- {"Segoe UI",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(22,8)},{12,new FontSizeInfo(23,9)},{14,new FontSizeInfo(27,10)},{16,new FontSizeInfo(34,11)},{18,new FontSizeInfo(35,13)},{20,new FontSizeInfo(41,15)},{22,new FontSizeInfo(44,16)},{24,new FontSizeInfo(50,17)},{26,new FontSizeInfo(51,19)},{28,new FontSizeInfo(54,20)},{36,new FontSizeInfo(70,26)},{48,new FontSizeInfo(92,35)},{72,new FontSizeInfo(0,52)},{96,new FontSizeInfo(180,69)},{128,new FontSizeInfo(241,92)},{256,new FontSizeInfo(482,184)}}},
- {"Segoe UI Black",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,7)},{10,new FontSizeInfo(20,8)},{11,new FontSizeInfo(22,9)},{12,new FontSizeInfo(23,10)},{14,new FontSizeInfo(27,12)},{16,new FontSizeInfo(34,13)},{18,new FontSizeInfo(35,15)},{20,new FontSizeInfo(41,17)},{22,new FontSizeInfo(44,18)},{24,new FontSizeInfo(50,20)},{26,new FontSizeInfo(51,22)},{28,new FontSizeInfo(54,23)},{36,new FontSizeInfo(70,30)},{48,new FontSizeInfo(92,40)},{72,new FontSizeInfo(0,60)},{96,new FontSizeInfo(182,79)},{128,new FontSizeInfo(245,106)},{256,new FontSizeInfo(488,212)}}},
- {"Segoe UI Emoji",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(22,8)},{12,new FontSizeInfo(23,9)},{14,new FontSizeInfo(27,10)},{16,new FontSizeInfo(34,11)},{18,new FontSizeInfo(35,13)},{20,new FontSizeInfo(41,15)},{22,new FontSizeInfo(44,16)},{24,new FontSizeInfo(50,17)},{26,new FontSizeInfo(51,19)},{28,new FontSizeInfo(54,20)},{36,new FontSizeInfo(70,26)},{48,new FontSizeInfo(92,35)},{72,new FontSizeInfo(0,52)},{96,new FontSizeInfo(180,69)},{128,new FontSizeInfo(241,92)},{256,new FontSizeInfo(482,184)}}},
- {"Segoe UI Historic",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(22,8)},{12,new FontSizeInfo(23,9)},{14,new FontSizeInfo(27,10)},{16,new FontSizeInfo(34,11)},{18,new FontSizeInfo(35,13)},{20,new FontSizeInfo(41,15)},{22,new FontSizeInfo(44,16)},{24,new FontSizeInfo(50,17)},{26,new FontSizeInfo(51,19)},{28,new FontSizeInfo(54,20)},{36,new FontSizeInfo(70,26)},{48,new FontSizeInfo(92,35)},{72,new FontSizeInfo(0,52)},{96,new FontSizeInfo(180,69)},{128,new FontSizeInfo(241,92)},{256,new FontSizeInfo(482,184)}}},
- {"Segoe UI Light",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(22,8)},{12,new FontSizeInfo(23,8)},{14,new FontSizeInfo(27,10)},{16,new FontSizeInfo(34,11)},{18,new FontSizeInfo(35,13)},{20,new FontSizeInfo(41,14)},{22,new FontSizeInfo(44,15)},{24,new FontSizeInfo(50,17)},{26,new FontSizeInfo(51,19)},{28,new FontSizeInfo(54,20)},{36,new FontSizeInfo(70,25)},{48,new FontSizeInfo(92,34)},{72,new FontSizeInfo(0,51)},{96,new FontSizeInfo(180,68)},{128,new FontSizeInfo(241,91)},{256,new FontSizeInfo(482,181)}}},
- {"Segoe UI Semibold",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(22,9)},{12,new FontSizeInfo(23,9)},{14,new FontSizeInfo(27,11)},{16,new FontSizeInfo(34,12)},{18,new FontSizeInfo(35,14)},{20,new FontSizeInfo(41,16)},{22,new FontSizeInfo(44,17)},{24,new FontSizeInfo(50,18)},{26,new FontSizeInfo(51,20)},{28,new FontSizeInfo(54,21)},{36,new FontSizeInfo(70,28)},{48,new FontSizeInfo(92,37)},{72,new FontSizeInfo(0,55)},{96,new FontSizeInfo(180,74)},{128,new FontSizeInfo(241,99)},{256,new FontSizeInfo(482,196)}}},
- {"Segoe UI Semilight",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(22,8)},{12,new FontSizeInfo(23,9)},{14,new FontSizeInfo(27,10)},{16,new FontSizeInfo(34,12)},{18,new FontSizeInfo(35,13)},{20,new FontSizeInfo(41,15)},{22,new FontSizeInfo(44,16)},{24,new FontSizeInfo(50,18)},{26,new FontSizeInfo(51,19)},{28,new FontSizeInfo(54,20)},{36,new FontSizeInfo(70,26)},{48,new FontSizeInfo(92,35)},{72,new FontSizeInfo(0,53)},{96,new FontSizeInfo(180,70)},{128,new FontSizeInfo(241,94)},{256,new FontSizeInfo(482,187)}}},
- {"Segoe UI Symbol",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(22,8)},{12,new FontSizeInfo(23,9)},{14,new FontSizeInfo(27,10)},{16,new FontSizeInfo(34,11)},{18,new FontSizeInfo(35,13)},{20,new FontSizeInfo(41,15)},{22,new FontSizeInfo(44,16)},{24,new FontSizeInfo(50,17)},{26,new FontSizeInfo(51,19)},{28,new FontSizeInfo(54,20)},{36,new FontSizeInfo(70,26)},{48,new FontSizeInfo(92,35)},{72,new FontSizeInfo(0,52)},{96,new FontSizeInfo(180,69)},{128,new FontSizeInfo(241,92)},{256,new FontSizeInfo(482,184)}}},
- {"NSimSun",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(20,8)},{12,new FontSizeInfo(21,8)},{14,new FontSizeInfo(25,10)},{16,new FontSizeInfo(27,11)},{18,new FontSizeInfo(30,12)},{20,new FontSizeInfo(34,14)},{22,new FontSizeInfo(36,15)},{24,new FontSizeInfo(42,16)},{26,new FontSizeInfo(45,18)},{28,new FontSizeInfo(47,19)},{36,new FontSizeInfo(62,24)},{48,new FontSizeInfo(82,32)},{72,new FontSizeInfo(0,48)},{96,new FontSizeInfo(163,64)},{128,new FontSizeInfo(218,86)},{256,new FontSizeInfo(436,171)}}},
- {"SimSun-ExtB",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(20,8)},{12,new FontSizeInfo(21,8)},{14,new FontSizeInfo(24,10)},{16,new FontSizeInfo(26,11)},{18,new FontSizeInfo(29,12)},{20,new FontSizeInfo(32,14)},{22,new FontSizeInfo(34,15)},{24,new FontSizeInfo(38,16)},{26,new FontSizeInfo(41,18)},{28,new FontSizeInfo(43,19)},{36,new FontSizeInfo(56,24)},{48,new FontSizeInfo(74,32)},{72,new FontSizeInfo(0,48)},{96,new FontSizeInfo(147,64)},{128,new FontSizeInfo(196,86)},{256,new FontSizeInfo(390,171)}}},
- {"Sitka Small",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(21,8)},{10,new FontSizeInfo(22,9)},{11,new FontSizeInfo(27,10)},{12,new FontSizeInfo(28,11)},{14,new FontSizeInfo(32,13)},{16,new FontSizeInfo(36,15)},{18,new FontSizeInfo(40,17)},{20,new FontSizeInfo(46,19)},{22,new FontSizeInfo(49,20)},{24,new FontSizeInfo(55,22)},{26,new FontSizeInfo(59,24)},{28,new FontSizeInfo(61,26)},{36,new FontSizeInfo(80,33)},{48,new FontSizeInfo(106,44)},{72,new FontSizeInfo(0,66)},{96,new FontSizeInfo(212,88)},{128,new FontSizeInfo(284,118)},{256,new FontSizeInfo(564,235)}}},
- {"Sitka Text",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(21,7)},{10,new FontSizeInfo(22,8)},{11,new FontSizeInfo(24,10)},{12,new FontSizeInfo(26,10)},{14,new FontSizeInfo(32,12)},{16,new FontSizeInfo(34,13)},{18,new FontSizeInfo(40,15)},{20,new FontSizeInfo(44,17)},{22,new FontSizeInfo(47,18)},{24,new FontSizeInfo(53,20)},{26,new FontSizeInfo(56,22)},{28,new FontSizeInfo(59,24)},{36,new FontSizeInfo(77,31)},{48,new FontSizeInfo(102,41)},{72,new FontSizeInfo(0,61)},{96,new FontSizeInfo(205,81)},{128,new FontSizeInfo(273,109)},{256,new FontSizeInfo(544,216)}}},
- {"Sitka Subheading",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(21,7)},{10,new FontSizeInfo(22,8)},{11,new FontSizeInfo(24,9)},{12,new FontSizeInfo(26,9)},{14,new FontSizeInfo(32,11)},{16,new FontSizeInfo(34,12)},{18,new FontSizeInfo(40,14)},{20,new FontSizeInfo(44,16)},{22,new FontSizeInfo(47,17)},{24,new FontSizeInfo(53,19)},{26,new FontSizeInfo(56,21)},{28,new FontSizeInfo(59,22)},{36,new FontSizeInfo(77,28)},{48,new FontSizeInfo(102,38)},{72,new FontSizeInfo(0,57)},{96,new FontSizeInfo(205,76)},{128,new FontSizeInfo(273,101)},{256,new FontSizeInfo(544,201)}}},
- {"Sitka Heading",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(21,6)},{10,new FontSizeInfo(22,7)},{11,new FontSizeInfo(24,8)},{12,new FontSizeInfo(26,9)},{14,new FontSizeInfo(32,11)},{16,new FontSizeInfo(34,12)},{18,new FontSizeInfo(40,13)},{20,new FontSizeInfo(44,15)},{22,new FontSizeInfo(47,16)},{24,new FontSizeInfo(53,18)},{26,new FontSizeInfo(56,20)},{28,new FontSizeInfo(59,21)},{36,new FontSizeInfo(77,27)},{48,new FontSizeInfo(102,36)},{72,new FontSizeInfo(0,54)},{96,new FontSizeInfo(205,71)},{128,new FontSizeInfo(273,95)},{256,new FontSizeInfo(544,190)}}},
- {"Sitka Display",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(21,6)},{10,new FontSizeInfo(22,7)},{11,new FontSizeInfo(24,8)},{12,new FontSizeInfo(26,8)},{14,new FontSizeInfo(32,10)},{16,new FontSizeInfo(34,11)},{18,new FontSizeInfo(40,13)},{20,new FontSizeInfo(44,14)},{22,new FontSizeInfo(47,15)},{24,new FontSizeInfo(53,17)},{26,new FontSizeInfo(56,19)},{28,new FontSizeInfo(59,20)},{36,new FontSizeInfo(77,25)},{48,new FontSizeInfo(102,34)},{72,new FontSizeInfo(0,51)},{96,new FontSizeInfo(205,68)},{128,new FontSizeInfo(273,91)},{256,new FontSizeInfo(544,181)}}},
- {"Sitka Banner",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(21,6)},{10,new FontSizeInfo(22,7)},{11,new FontSizeInfo(24,8)},{12,new FontSizeInfo(26,8)},{14,new FontSizeInfo(32,10)},{16,new FontSizeInfo(34,11)},{18,new FontSizeInfo(40,12)},{20,new FontSizeInfo(44,14)},{22,new FontSizeInfo(47,15)},{24,new FontSizeInfo(53,16)},{26,new FontSizeInfo(56,18)},{28,new FontSizeInfo(59,19)},{36,new FontSizeInfo(77,24)},{48,new FontSizeInfo(102,32)},{72,new FontSizeInfo(0,49)},{96,new FontSizeInfo(205,65)},{128,new FontSizeInfo(273,87)},{256,new FontSizeInfo(544,173)}}},
- {"Tahoma",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(20,8)},{12,new FontSizeInfo(21,9)},{14,new FontSizeInfo(24,10)},{16,new FontSizeInfo(26,11)},{18,new FontSizeInfo(30,13)},{20,new FontSizeInfo(34,15)},{22,new FontSizeInfo(36,16)},{24,new FontSizeInfo(40,17)},{26,new FontSizeInfo(43,19)},{28,new FontSizeInfo(46,20)},{36,new FontSizeInfo(59,26)},{48,new FontSizeInfo(78,35)},{72,new FontSizeInfo(0,52)},{96,new FontSizeInfo(155,70)},{128,new FontSizeInfo(207,93)},{256,new FontSizeInfo(412,186)}}},
- {"Trebuchet MS",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(21,6)},{10,new FontSizeInfo(21,7)},{11,new FontSizeInfo(22,8)},{12,new FontSizeInfo(24,8)},{14,new FontSizeInfo(25,10)},{16,new FontSizeInfo(28,11)},{18,new FontSizeInfo(31,13)},{20,new FontSizeInfo(37,14)},{22,new FontSizeInfo(38,15)},{24,new FontSizeInfo(41,17)},{26,new FontSizeInfo(45,18)},{28,new FontSizeInfo(48,19)},{36,new FontSizeInfo(62,25)},{48,new FontSizeInfo(82,34)},{72,new FontSizeInfo(0,50)},{96,new FontSizeInfo(164,67)},{128,new FontSizeInfo(219,90)},{256,new FontSizeInfo(418,179)}}},
- {"Verdana",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,7)},{10,new FontSizeInfo(20,8)},{11,new FontSizeInfo(20,10)},{12,new FontSizeInfo(21,10)},{14,new FontSizeInfo(24,12)},{16,new FontSizeInfo(26,13)},{18,new FontSizeInfo(30,15)},{20,new FontSizeInfo(33,17)},{22,new FontSizeInfo(36,18)},{24,new FontSizeInfo(39,20)},{26,new FontSizeInfo(43,22)},{28,new FontSizeInfo(47,24)},{36,new FontSizeInfo(61,31)},{48,new FontSizeInfo(80,41)},{72,new FontSizeInfo(0,61)},{96,new FontSizeInfo(156,81)},{128,new FontSizeInfo(207,109)},{256,new FontSizeInfo(418,216)}}},
- {"Webdings",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(24,8)},{8,new FontSizeInfo(22,11)},{10,new FontSizeInfo(21,13)},{11,new FontSizeInfo(21,15)},{12,new FontSizeInfo(21,16)},{14,new FontSizeInfo(26,19)},{16,new FontSizeInfo(27,21)},{18,new FontSizeInfo(31,24)},{20,new FontSizeInfo(35,27)},{22,new FontSizeInfo(36,29)},{24,new FontSizeInfo(40,32)},{26,new FontSizeInfo(43,35)},{28,new FontSizeInfo(46,37)},{36,new FontSizeInfo(59,48)},{48,new FontSizeInfo(78,64)},{72,new FontSizeInfo(0,96)},{96,new FontSizeInfo(155,128)},{128,new FontSizeInfo(206,171)},{256,new FontSizeInfo(410,341)}}},
- {"Yu Gothic UI",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(22,8)},{12,new FontSizeInfo(23,9)},{14,new FontSizeInfo(27,10)},{16,new FontSizeInfo(34,11)},{18,new FontSizeInfo(35,13)},{20,new FontSizeInfo(41,15)},{22,new FontSizeInfo(44,16)},{24,new FontSizeInfo(50,17)},{26,new FontSizeInfo(51,19)},{28,new FontSizeInfo(54,20)},{36,new FontSizeInfo(70,26)},{48,new FontSizeInfo(92,35)},{72,new FontSizeInfo(0,52)},{96,new FontSizeInfo(180,69)},{128,new FontSizeInfo(241,92)},{256,new FontSizeInfo(482,184)}}},
- {"Yu Gothic UI Semibold",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(22,9)},{12,new FontSizeInfo(23,9)},{14,new FontSizeInfo(27,11)},{16,new FontSizeInfo(34,12)},{18,new FontSizeInfo(35,14)},{20,new FontSizeInfo(41,16)},{22,new FontSizeInfo(44,17)},{24,new FontSizeInfo(50,18)},{26,new FontSizeInfo(51,20)},{28,new FontSizeInfo(54,21)},{36,new FontSizeInfo(70,28)},{48,new FontSizeInfo(92,37)},{72,new FontSizeInfo(0,55)},{96,new FontSizeInfo(180,74)},{128,new FontSizeInfo(241,99)},{256,new FontSizeInfo(482,196)}}},
- {"Yu Gothic Light",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(22,7)},{11,new FontSizeInfo(24,8)},{12,new FontSizeInfo(26,9)},{14,new FontSizeInfo(32,10)},{16,new FontSizeInfo(34,11)},{18,new FontSizeInfo(40,13)},{20,new FontSizeInfo(44,14)},{22,new FontSizeInfo(47,16)},{24,new FontSizeInfo(53,17)},{26,new FontSizeInfo(56,19)},{28,new FontSizeInfo(61,20)},{36,new FontSizeInfo(77,26)},{48,new FontSizeInfo(102,34)},{72,new FontSizeInfo(0,51)},{96,new FontSizeInfo(205,69)},{128,new FontSizeInfo(275,92)},{256,new FontSizeInfo(550,183)}}},
- {"Yu Gothic UI Light",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(22,8)},{12,new FontSizeInfo(23,9)},{14,new FontSizeInfo(27,10)},{16,new FontSizeInfo(34,11)},{18,new FontSizeInfo(35,13)},{20,new FontSizeInfo(41,14)},{22,new FontSizeInfo(44,15)},{24,new FontSizeInfo(50,17)},{26,new FontSizeInfo(51,19)},{28,new FontSizeInfo(54,20)},{36,new FontSizeInfo(70,25)},{48,new FontSizeInfo(92,34)},{72,new FontSizeInfo(0,51)},{96,new FontSizeInfo(180,68)},{128,new FontSizeInfo(241,91)},{256,new FontSizeInfo(482,181)}}},
- {"Yu Gothic Medium",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(22,7)},{11,new FontSizeInfo(24,8)},{12,new FontSizeInfo(26,9)},{14,new FontSizeInfo(32,11)},{16,new FontSizeInfo(34,12)},{18,new FontSizeInfo(40,13)},{20,new FontSizeInfo(44,15)},{22,new FontSizeInfo(47,16)},{24,new FontSizeInfo(53,18)},{26,new FontSizeInfo(56,19)},{28,new FontSizeInfo(61,21)},{36,new FontSizeInfo(77,27)},{48,new FontSizeInfo(102,36)},{72,new FontSizeInfo(0,53)},{96,new FontSizeInfo(205,71)},{128,new FontSizeInfo(275,95)},{256,new FontSizeInfo(549,189)}}},
- {"Yu Gothic UI Semilight",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(22,8)},{12,new FontSizeInfo(23,9)},{14,new FontSizeInfo(27,10)},{16,new FontSizeInfo(34,12)},{18,new FontSizeInfo(35,13)},{20,new FontSizeInfo(41,15)},{22,new FontSizeInfo(44,16)},{24,new FontSizeInfo(50,18)},{26,new FontSizeInfo(51,19)},{28,new FontSizeInfo(54,20)},{36,new FontSizeInfo(70,26)},{48,new FontSizeInfo(92,35)},{72,new FontSizeInfo(0,53)},{96,new FontSizeInfo(180,70)},{128,new FontSizeInfo(241,94)},{256,new FontSizeInfo(482,187)}}},
- {"MT Extra",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,8)},{8,new FontSizeInfo(20,11)},{10,new FontSizeInfo(20,13)},{11,new FontSizeInfo(21,15)},{12,new FontSizeInfo(24,16)},{14,new FontSizeInfo(28,19)},{16,new FontSizeInfo(30,21)},{18,new FontSizeInfo(36,24)},{20,new FontSizeInfo(40,28)},{22,new FontSizeInfo(42,30)},{24,new FontSizeInfo(48,33)},{26,new FontSizeInfo(51,36)},{28,new FontSizeInfo(56,38)},{36,new FontSizeInfo(71,49)},{48,new FontSizeInfo(95,65)},{72,new FontSizeInfo(0,98)},{96,new FontSizeInfo(192,131)},{128,new FontSizeInfo(257,174)},{256,new FontSizeInfo(511,347)}}},
- {"Agency FB",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,5)},{10,new FontSizeInfo(20,5)},{11,new FontSizeInfo(20,6)},{12,new FontSizeInfo(21,6)},{14,new FontSizeInfo(26,8)},{16,new FontSizeInfo(26,9)},{18,new FontSizeInfo(30,10)},{20,new FontSizeInfo(34,11)},{22,new FontSizeInfo(36,11)},{24,new FontSizeInfo(44,14)},{26,new FontSizeInfo(45,15)},{28,new FontSizeInfo(48,16)},{36,new FontSizeInfo(62,21)},{48,new FontSizeInfo(81,28)},{72,new FontSizeInfo(0,42)},{96,new FontSizeInfo(161,56)},{128,new FontSizeInfo(216,74)},{256,new FontSizeInfo(430,148)}}},
- {"Algerian",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,7)},{10,new FontSizeInfo(20,8)},{11,new FontSizeInfo(21,9)},{12,new FontSizeInfo(23,10)},{14,new FontSizeInfo(26,11)},{16,new FontSizeInfo(29,13)},{18,new FontSizeInfo(34,14)},{20,new FontSizeInfo(38,16)},{22,new FontSizeInfo(40,17)},{24,new FontSizeInfo(46,19)},{26,new FontSizeInfo(50,21)},{28,new FontSizeInfo(52,22)},{36,new FontSizeInfo(68,29)},{48,new FontSizeInfo(91,38)},{72,new FontSizeInfo(0,58)},{96,new FontSizeInfo(184,77)},{128,new FontSizeInfo(244,103)},{256,new FontSizeInfo(488,205)}}},
- {"Book Antiqua",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(22,8)},{12,new FontSizeInfo(21,8)},{14,new FontSizeInfo(25,10)},{16,new FontSizeInfo(28,11)},{18,new FontSizeInfo(31,12)},{20,new FontSizeInfo(35,14)},{22,new FontSizeInfo(38,15)},{24,new FontSizeInfo(42,16)},{26,new FontSizeInfo(45,18)},{28,new FontSizeInfo(48,19)},{36,new FontSizeInfo(62,24)},{48,new FontSizeInfo(83,32)},{72,new FontSizeInfo(0,48)},{96,new FontSizeInfo(164,64)},{128,new FontSizeInfo(220,86)},{256,new FontSizeInfo(438,171)}}},
- {"Arial Narrow",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,5)},{10,new FontSizeInfo(20,6)},{11,new FontSizeInfo(22,7)},{12,new FontSizeInfo(21,7)},{14,new FontSizeInfo(24,9)},{16,new FontSizeInfo(27,10)},{18,new FontSizeInfo(31,11)},{20,new FontSizeInfo(34,12)},{22,new FontSizeInfo(36,13)},{24,new FontSizeInfo(40,15)},{26,new FontSizeInfo(45,16)},{28,new FontSizeInfo(47,17)},{36,new FontSizeInfo(61,22)},{48,new FontSizeInfo(80,29)},{72,new FontSizeInfo(0,44)},{96,new FontSizeInfo(157,58)},{128,new FontSizeInfo(210,78)},{256,new FontSizeInfo(418,156)}}},
- {"Arial Rounded MT Bold",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,7)},{10,new FontSizeInfo(20,8)},{11,new FontSizeInfo(20,9)},{12,new FontSizeInfo(21,10)},{14,new FontSizeInfo(24,11)},{16,new FontSizeInfo(26,12)},{18,new FontSizeInfo(30,14)},{20,new FontSizeInfo(34,16)},{22,new FontSizeInfo(36,17)},{24,new FontSizeInfo(40,19)},{26,new FontSizeInfo(43,21)},{28,new FontSizeInfo(46,22)},{36,new FontSizeInfo(59,29)},{48,new FontSizeInfo(79,38)},{72,new FontSizeInfo(0,57)},{96,new FontSizeInfo(156,76)},{128,new FontSizeInfo(208,102)},{256,new FontSizeInfo(414,202)}}},
- {"Baskerville Old Face",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,5)},{10,new FontSizeInfo(20,6)},{11,new FontSizeInfo(20,7)},{12,new FontSizeInfo(21,8)},{14,new FontSizeInfo(25,9)},{16,new FontSizeInfo(27,10)},{18,new FontSizeInfo(31,12)},{20,new FontSizeInfo(35,13)},{22,new FontSizeInfo(38,14)},{24,new FontSizeInfo(41,16)},{26,new FontSizeInfo(45,17)},{28,new FontSizeInfo(48,18)},{36,new FontSizeInfo(61,24)},{48,new FontSizeInfo(82,31)},{72,new FontSizeInfo(0,47)},{96,new FontSizeInfo(162,63)},{128,new FontSizeInfo(216,84)},{256,new FontSizeInfo(430,168)}}},
- {"Bauhaus 93",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(23,9)},{12,new FontSizeInfo(25,9)},{14,new FontSizeInfo(28,11)},{16,new FontSizeInfo(33,12)},{18,new FontSizeInfo(37,14)},{20,new FontSizeInfo(42,15)},{22,new FontSizeInfo(45,16)},{24,new FontSizeInfo(50,18)},{26,new FontSizeInfo(54,20)},{28,new FontSizeInfo(57,21)},{36,new FontSizeInfo(74,27)},{48,new FontSizeInfo(100,36)},{72,new FontSizeInfo(0,55)},{96,new FontSizeInfo(199,73)},{128,new FontSizeInfo(266,97)},{256,new FontSizeInfo(531,194)}}},
- {"Bell MT",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(21,8)},{12,new FontSizeInfo(21,8)},{14,new FontSizeInfo(25,10)},{16,new FontSizeInfo(28,11)},{18,new FontSizeInfo(31,12)},{20,new FontSizeInfo(35,14)},{22,new FontSizeInfo(38,15)},{24,new FontSizeInfo(42,16)},{26,new FontSizeInfo(45,18)},{28,new FontSizeInfo(48,19)},{36,new FontSizeInfo(62,24)},{48,new FontSizeInfo(82,32)},{72,new FontSizeInfo(0,48)},{96,new FontSizeInfo(163,64)},{128,new FontSizeInfo(218,86)},{256,new FontSizeInfo(433,171)}}},
- {"Bernard MT Condensed",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,5)},{10,new FontSizeInfo(20,6)},{11,new FontSizeInfo(20,7)},{12,new FontSizeInfo(21,8)},{14,new FontSizeInfo(24,9)},{16,new FontSizeInfo(26,10)},{18,new FontSizeInfo(30,12)},{20,new FontSizeInfo(33,13)},{22,new FontSizeInfo(36,14)},{24,new FontSizeInfo(39,16)},{26,new FontSizeInfo(43,17)},{28,new FontSizeInfo(45,18)},{36,new FontSizeInfo(59,24)},{48,new FontSizeInfo(79,31)},{72,new FontSizeInfo(0,47)},{96,new FontSizeInfo(156,63)},{128,new FontSizeInfo(208,84)},{256,new FontSizeInfo(416,167)}}},
- {"Bodoni MT",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(21,5)},{10,new FontSizeInfo(20,6)},{11,new FontSizeInfo(20,7)},{12,new FontSizeInfo(21,8)},{14,new FontSizeInfo(26,9)},{16,new FontSizeInfo(27,10)},{18,new FontSizeInfo(32,12)},{20,new FontSizeInfo(35,13)},{22,new FontSizeInfo(39,14)},{24,new FontSizeInfo(42,16)},{26,new FontSizeInfo(45,17)},{28,new FontSizeInfo(48,18)},{36,new FontSizeInfo(61,24)},{48,new FontSizeInfo(83,31)},{72,new FontSizeInfo(0,47)},{96,new FontSizeInfo(164,63)},{128,new FontSizeInfo(220,84)},{256,new FontSizeInfo(438,167)}}},
- {"Bodoni MT Black",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,7)},{10,new FontSizeInfo(20,9)},{11,new FontSizeInfo(20,10)},{12,new FontSizeInfo(21,11)},{14,new FontSizeInfo(25,12)},{16,new FontSizeInfo(27,14)},{18,new FontSizeInfo(31,16)},{20,new FontSizeInfo(35,18)},{22,new FontSizeInfo(37,19)},{24,new FontSizeInfo(41,21)},{26,new FontSizeInfo(45,23)},{28,new FontSizeInfo(47,24)},{36,new FontSizeInfo(61,31)},{48,new FontSizeInfo(81,42)},{72,new FontSizeInfo(0,63)},{96,new FontSizeInfo(161,84)},{128,new FontSizeInfo(215,112)},{256,new FontSizeInfo(428,224)}}},
- {"Bodoni MT Condensed",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,4)},{10,new FontSizeInfo(20,4)},{11,new FontSizeInfo(20,5)},{12,new FontSizeInfo(21,5)},{14,new FontSizeInfo(25,6)},{16,new FontSizeInfo(27,7)},{18,new FontSizeInfo(31,8)},{20,new FontSizeInfo(35,9)},{22,new FontSizeInfo(38,10)},{24,new FontSizeInfo(41,11)},{26,new FontSizeInfo(45,12)},{28,new FontSizeInfo(48,13)},{36,new FontSizeInfo(61,16)},{48,new FontSizeInfo(82,22)},{72,new FontSizeInfo(0,32)},{96,new FontSizeInfo(162,43)},{128,new FontSizeInfo(216,58)},{256,new FontSizeInfo(431,115)}}},
- {"Bodoni MT Poster Compressed",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,4)},{10,new FontSizeInfo(20,5)},{11,new FontSizeInfo(20,5)},{12,new FontSizeInfo(21,6)},{14,new FontSizeInfo(24,6)},{16,new FontSizeInfo(27,7)},{18,new FontSizeInfo(30,8)},{20,new FontSizeInfo(34,8)},{22,new FontSizeInfo(36,9)},{24,new FontSizeInfo(40,9)},{26,new FontSizeInfo(44,10)},{28,new FontSizeInfo(46,10)},{36,new FontSizeInfo(59,14)},{48,new FontSizeInfo(79,18)},{72,new FontSizeInfo(0,28)},{96,new FontSizeInfo(157,38)},{128,new FontSizeInfo(209,49)},{256,new FontSizeInfo(416,96)}}},
- {"Bookman Old Style",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,7)},{10,new FontSizeInfo(21,8)},{11,new FontSizeInfo(20,9)},{12,new FontSizeInfo(21,10)},{14,new FontSizeInfo(24,12)},{16,new FontSizeInfo(27,13)},{18,new FontSizeInfo(31,15)},{20,new FontSizeInfo(34,17)},{22,new FontSizeInfo(37,18)},{24,new FontSizeInfo(42,20)},{26,new FontSizeInfo(44,22)},{28,new FontSizeInfo(47,23)},{36,new FontSizeInfo(61,30)},{48,new FontSizeInfo(82,40)},{72,new FontSizeInfo(0,60)},{96,new FontSizeInfo(163,79)},{128,new FontSizeInfo(218,106)},{256,new FontSizeInfo(437,211)}}},
- {"Bradley Hand ITC",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,7)},{10,new FontSizeInfo(21,8)},{11,new FontSizeInfo(22,10)},{12,new FontSizeInfo(23,10)},{14,new FontSizeInfo(28,12)},{16,new FontSizeInfo(30,14)},{18,new FontSizeInfo(35,15)},{20,new FontSizeInfo(39,17)},{22,new FontSizeInfo(42,19)},{24,new FontSizeInfo(46,21)},{26,new FontSizeInfo(50,23)},{28,new FontSizeInfo(53,24)},{36,new FontSizeInfo(68,31)},{48,new FontSizeInfo(90,41)},{72,new FontSizeInfo(0,62)},{96,new FontSizeInfo(180,82)},{128,new FontSizeInfo(240,110)},{256,new FontSizeInfo(478,219)}}},
- {"Britannic Bold",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,7)},{10,new FontSizeInfo(20,8)},{11,new FontSizeInfo(20,9)},{12,new FontSizeInfo(21,10)},{14,new FontSizeInfo(24,12)},{16,new FontSizeInfo(26,13)},{18,new FontSizeInfo(30,15)},{20,new FontSizeInfo(34,17)},{22,new FontSizeInfo(36,18)},{24,new FontSizeInfo(40,20)},{26,new FontSizeInfo(43,21)},{28,new FontSizeInfo(46,23)},{36,new FontSizeInfo(59,29)},{48,new FontSizeInfo(79,39)},{72,new FontSizeInfo(0,59)},{96,new FontSizeInfo(156,78)},{128,new FontSizeInfo(208,105)},{256,new FontSizeInfo(414,209)}}},
- {"Berlin Sans FB",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,7)},{10,new FontSizeInfo(20,8)},{11,new FontSizeInfo(20,9)},{12,new FontSizeInfo(21,10)},{14,new FontSizeInfo(24,11)},{16,new FontSizeInfo(26,13)},{18,new FontSizeInfo(30,14)},{20,new FontSizeInfo(33,16)},{22,new FontSizeInfo(36,17)},{24,new FontSizeInfo(39,19)},{26,new FontSizeInfo(43,21)},{28,new FontSizeInfo(45,22)},{36,new FontSizeInfo(59,29)},{48,new FontSizeInfo(78,38)},{72,new FontSizeInfo(0,57)},{96,new FontSizeInfo(155,76)},{128,new FontSizeInfo(207,102)},{256,new FontSizeInfo(411,203)}}},
- {"Berlin Sans FB Demi",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,7)},{10,new FontSizeInfo(20,8)},{11,new FontSizeInfo(20,9)},{12,new FontSizeInfo(21,10)},{14,new FontSizeInfo(24,12)},{16,new FontSizeInfo(26,13)},{18,new FontSizeInfo(30,15)},{20,new FontSizeInfo(34,17)},{22,new FontSizeInfo(36,18)},{24,new FontSizeInfo(40,20)},{26,new FontSizeInfo(43,22)},{28,new FontSizeInfo(46,23)},{36,new FontSizeInfo(59,30)},{48,new FontSizeInfo(78,40)},{72,new FontSizeInfo(0,60)},{96,new FontSizeInfo(155,81)},{128,new FontSizeInfo(207,108)},{256,new FontSizeInfo(412,215)}}},
- {"Broadway",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,7)},{10,new FontSizeInfo(20,8)},{11,new FontSizeInfo(20,10)},{12,new FontSizeInfo(21,10)},{14,new FontSizeInfo(24,12)},{16,new FontSizeInfo(27,14)},{18,new FontSizeInfo(30,16)},{20,new FontSizeInfo(34,17)},{22,new FontSizeInfo(36,19)},{24,new FontSizeInfo(40,21)},{26,new FontSizeInfo(44,23)},{28,new FontSizeInfo(46,24)},{36,new FontSizeInfo(60,31)},{48,new FontSizeInfo(79,41)},{72,new FontSizeInfo(0,62)},{96,new FontSizeInfo(157,83)},{128,new FontSizeInfo(210,111)},{256,new FontSizeInfo(417,219)}}},
- {"Brush Script MT",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(21,8)},{12,new FontSizeInfo(22,8)},{14,new FontSizeInfo(26,10)},{16,new FontSizeInfo(29,11)},{18,new FontSizeInfo(33,12)},{20,new FontSizeInfo(37,14)},{22,new FontSizeInfo(40,15)},{24,new FontSizeInfo(44,16)},{26,new FontSizeInfo(48,18)},{28,new FontSizeInfo(51,19)},{36,new FontSizeInfo(65,24)},{48,new FontSizeInfo(87,33)},{72,new FontSizeInfo(0,49)},{96,new FontSizeInfo(172,65)},{128,new FontSizeInfo(230,87)},{256,new FontSizeInfo(457,174)}}},
- {"Bookshelf Symbol 7",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,6)},{8,new FontSizeInfo(20,8)},{10,new FontSizeInfo(20,10)},{11,new FontSizeInfo(20,11)},{12,new FontSizeInfo(21,12)},{14,new FontSizeInfo(24,14)},{16,new FontSizeInfo(26,16)},{18,new FontSizeInfo(29,18)},{20,new FontSizeInfo(32,20)},{22,new FontSizeInfo(34,21)},{24,new FontSizeInfo(38,24)},{26,new FontSizeInfo(41,26)},{28,new FontSizeInfo(43,27)},{36,new FontSizeInfo(56,35)},{48,new FontSizeInfo(74,47)},{72,new FontSizeInfo(0,71)},{96,new FontSizeInfo(147,95)},{128,new FontSizeInfo(196,126)},{256,new FontSizeInfo(390,251)}}},
- {"Californian FB",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(21,5)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(20,9)},{12,new FontSizeInfo(21,9)},{14,new FontSizeInfo(25,11)},{16,new FontSizeInfo(27,12)},{18,new FontSizeInfo(31,13)},{20,new FontSizeInfo(35,14)},{22,new FontSizeInfo(37,15)},{24,new FontSizeInfo(41,17)},{26,new FontSizeInfo(45,18)},{28,new FontSizeInfo(47,19)},{36,new FontSizeInfo(61,26)},{48,new FontSizeInfo(81,34)},{72,new FontSizeInfo(0,51)},{96,new FontSizeInfo(162,68)},{128,new FontSizeInfo(216,91)},{256,new FontSizeInfo(429,181)}}},
- {"Calisto MT",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(20,8)},{12,new FontSizeInfo(21,8)},{14,new FontSizeInfo(24,10)},{16,new FontSizeInfo(27,11)},{18,new FontSizeInfo(31,12)},{20,new FontSizeInfo(34,14)},{22,new FontSizeInfo(37,15)},{24,new FontSizeInfo(40,16)},{26,new FontSizeInfo(44,18)},{28,new FontSizeInfo(46,19)},{36,new FontSizeInfo(60,24)},{48,new FontSizeInfo(80,33)},{72,new FontSizeInfo(0,49)},{96,new FontSizeInfo(158,65)},{128,new FontSizeInfo(211,87)},{256,new FontSizeInfo(420,174)}}},
- {"Castellar",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,8)},{10,new FontSizeInfo(20,9)},{11,new FontSizeInfo(20,11)},{12,new FontSizeInfo(21,12)},{14,new FontSizeInfo(25,14)},{16,new FontSizeInfo(28,15)},{18,new FontSizeInfo(32,17)},{20,new FontSizeInfo(36,19)},{22,new FontSizeInfo(38,21)},{24,new FontSizeInfo(42,23)},{26,new FontSizeInfo(46,25)},{28,new FontSizeInfo(48,27)},{36,new FontSizeInfo(62,35)},{48,new FontSizeInfo(83,46)},{72,new FontSizeInfo(0,69)},{96,new FontSizeInfo(165,92)},{128,new FontSizeInfo(220,123)},{256,new FontSizeInfo(437,245)}}},
- {"Century Schoolbook",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(20,8)},{12,new FontSizeInfo(21,9)},{14,new FontSizeInfo(24,11)},{16,new FontSizeInfo(27,12)},{18,new FontSizeInfo(30,13)},{20,new FontSizeInfo(34,15)},{22,new FontSizeInfo(36,16)},{24,new FontSizeInfo(40,18)},{26,new FontSizeInfo(44,19)},{28,new FontSizeInfo(46,21)},{36,new FontSizeInfo(59,27)},{48,new FontSizeInfo(79,36)},{72,new FontSizeInfo(0,53)},{96,new FontSizeInfo(157,71)},{128,new FontSizeInfo(209,95)},{256,new FontSizeInfo(416,190)}}},
- {"Centaur",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,5)},{10,new FontSizeInfo(20,6)},{11,new FontSizeInfo(20,7)},{12,new FontSizeInfo(21,8)},{14,new FontSizeInfo(25,9)},{16,new FontSizeInfo(28,10)},{18,new FontSizeInfo(32,12)},{20,new FontSizeInfo(36,13)},{22,new FontSizeInfo(38,14)},{24,new FontSizeInfo(42,16)},{26,new FontSizeInfo(46,17)},{28,new FontSizeInfo(48,18)},{36,new FontSizeInfo(62,24)},{48,new FontSizeInfo(83,31)},{72,new FontSizeInfo(0,47)},{96,new FontSizeInfo(165,63)},{128,new FontSizeInfo(220,84)},{256,new FontSizeInfo(440,167)}}},
- {"Chiller",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,5)},{10,new FontSizeInfo(20,6)},{11,new FontSizeInfo(21,7)},{12,new FontSizeInfo(22,8)},{14,new FontSizeInfo(26,9)},{16,new FontSizeInfo(28,10)},{18,new FontSizeInfo(32,11)},{20,new FontSizeInfo(36,13)},{22,new FontSizeInfo(39,14)},{24,new FontSizeInfo(43,15)},{26,new FontSizeInfo(47,16)},{28,new FontSizeInfo(49,17)},{36,new FontSizeInfo(64,23)},{48,new FontSizeInfo(85,30)},{72,new FontSizeInfo(0,45)},{96,new FontSizeInfo(168,60)},{128,new FontSizeInfo(224,80)},{256,new FontSizeInfo(446,160)}}},
- {"Colonna MT",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(21,8)},{12,new FontSizeInfo(23,8)},{14,new FontSizeInfo(27,10)},{16,new FontSizeInfo(29,11)},{18,new FontSizeInfo(33,12)},{20,new FontSizeInfo(37,14)},{22,new FontSizeInfo(40,15)},{24,new FontSizeInfo(44,16)},{26,new FontSizeInfo(48,18)},{28,new FontSizeInfo(51,19)},{36,new FontSizeInfo(66,24)},{48,new FontSizeInfo(87,32)},{72,new FontSizeInfo(0,48)},{96,new FontSizeInfo(173,64)},{128,new FontSizeInfo(231,86)},{256,new FontSizeInfo(459,171)}}},
- {"Cooper Black",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,7)},{10,new FontSizeInfo(20,8)},{11,new FontSizeInfo(20,9)},{12,new FontSizeInfo(21,10)},{14,new FontSizeInfo(24,11)},{16,new FontSizeInfo(27,13)},{18,new FontSizeInfo(30,14)},{20,new FontSizeInfo(34,16)},{22,new FontSizeInfo(37,17)},{24,new FontSizeInfo(40,19)},{26,new FontSizeInfo(44,21)},{28,new FontSizeInfo(46,22)},{36,new FontSizeInfo(60,29)},{48,new FontSizeInfo(80,38)},{72,new FontSizeInfo(0,58)},{96,new FontSizeInfo(158,77)},{128,new FontSizeInfo(211,103)},{256,new FontSizeInfo(420,205)}}},
- {"Copperplate Gothic Bold",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,8)},{10,new FontSizeInfo(20,9)},{11,new FontSizeInfo(20,11)},{12,new FontSizeInfo(21,11)},{14,new FontSizeInfo(24,14)},{16,new FontSizeInfo(27,15)},{18,new FontSizeInfo(30,17)},{20,new FontSizeInfo(34,19)},{22,new FontSizeInfo(37,21)},{24,new FontSizeInfo(40,23)},{26,new FontSizeInfo(44,25)},{28,new FontSizeInfo(46,26)},{36,new FontSizeInfo(60,34)},{48,new FontSizeInfo(80,46)},{72,new FontSizeInfo(0,68)},{96,new FontSizeInfo(158,91)},{128,new FontSizeInfo(211,122)},{256,new FontSizeInfo(420,243)}}},
- {"Copperplate Gothic Light",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,8)},{10,new FontSizeInfo(20,9)},{11,new FontSizeInfo(20,11)},{12,new FontSizeInfo(21,12)},{14,new FontSizeInfo(24,14)},{16,new FontSizeInfo(26,15)},{18,new FontSizeInfo(30,17)},{20,new FontSizeInfo(34,19)},{22,new FontSizeInfo(36,21)},{24,new FontSizeInfo(40,23)},{26,new FontSizeInfo(43,25)},{28,new FontSizeInfo(46,27)},{36,new FontSizeInfo(59,35)},{48,new FontSizeInfo(78,46)},{72,new FontSizeInfo(0,69)},{96,new FontSizeInfo(157,92)},{128,new FontSizeInfo(209,123)},{256,new FontSizeInfo(418,246)}}},
- {"Curlz MT",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(20,8)},{12,new FontSizeInfo(22,9)},{14,new FontSizeInfo(28,10)},{16,new FontSizeInfo(30,11)},{18,new FontSizeInfo(34,13)},{20,new FontSizeInfo(38,15)},{22,new FontSizeInfo(41,16)},{24,new FontSizeInfo(45,17)},{26,new FontSizeInfo(48,19)},{28,new FontSizeInfo(51,20)},{36,new FontSizeInfo(65,26)},{48,new FontSizeInfo(88,34)},{72,new FontSizeInfo(0,52)},{96,new FontSizeInfo(173,69)},{128,new FontSizeInfo(233,92)},{256,new FontSizeInfo(462,183)}}},
- {"Elephant",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,8)},{10,new FontSizeInfo(20,10)},{11,new FontSizeInfo(21,11)},{12,new FontSizeInfo(22,12)},{14,new FontSizeInfo(26,14)},{16,new FontSizeInfo(28,16)},{18,new FontSizeInfo(32,18)},{20,new FontSizeInfo(36,20)},{22,new FontSizeInfo(39,22)},{24,new FontSizeInfo(43,24)},{26,new FontSizeInfo(47,27)},{28,new FontSizeInfo(49,28)},{36,new FontSizeInfo(64,36)},{48,new FontSizeInfo(85,49)},{72,new FontSizeInfo(0,73)},{96,new FontSizeInfo(168,97)},{128,new FontSizeInfo(224,130)},{256,new FontSizeInfo(446,258)}}},
- {"Engravers MT",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,7)},{10,new FontSizeInfo(20,8)},{11,new FontSizeInfo(20,10)},{12,new FontSizeInfo(21,10)},{14,new FontSizeInfo(24,12)},{16,new FontSizeInfo(27,14)},{18,new FontSizeInfo(30,16)},{20,new FontSizeInfo(34,17)},{22,new FontSizeInfo(37,19)},{24,new FontSizeInfo(40,21)},{26,new FontSizeInfo(44,23)},{28,new FontSizeInfo(46,24)},{36,new FontSizeInfo(60,31)},{48,new FontSizeInfo(80,41)},{72,new FontSizeInfo(0,62)},{96,new FontSizeInfo(158,83)},{128,new FontSizeInfo(211,110)},{256,new FontSizeInfo(419,219)}}},
- {"Eras Bold ITC",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,7)},{10,new FontSizeInfo(20,8)},{11,new FontSizeInfo(20,10)},{12,new FontSizeInfo(21,10)},{14,new FontSizeInfo(25,12)},{16,new FontSizeInfo(27,14)},{18,new FontSizeInfo(31,16)},{20,new FontSizeInfo(35,18)},{22,new FontSizeInfo(37,19)},{24,new FontSizeInfo(41,21)},{26,new FontSizeInfo(45,23)},{28,new FontSizeInfo(47,24)},{36,new FontSizeInfo(61,31)},{48,new FontSizeInfo(81,42)},{72,new FontSizeInfo(0,63)},{96,new FontSizeInfo(161,83)},{128,new FontSizeInfo(215,111)},{256,new FontSizeInfo(425,222)}}},
- {"Eras Demi ITC",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,7)},{10,new FontSizeInfo(20,8)},{11,new FontSizeInfo(20,9)},{12,new FontSizeInfo(21,10)},{14,new FontSizeInfo(25,12)},{16,new FontSizeInfo(27,13)},{18,new FontSizeInfo(31,15)},{20,new FontSizeInfo(35,16)},{22,new FontSizeInfo(37,18)},{24,new FontSizeInfo(41,20)},{26,new FontSizeInfo(45,21)},{28,new FontSizeInfo(47,23)},{36,new FontSizeInfo(61,29)},{48,new FontSizeInfo(81,39)},{72,new FontSizeInfo(0,59)},{96,new FontSizeInfo(161,78)},{128,new FontSizeInfo(215,104)},{256,new FontSizeInfo(425,208)}}},
- {"Eras Light ITC",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(20,8)},{12,new FontSizeInfo(22,9)},{14,new FontSizeInfo(25,10)},{16,new FontSizeInfo(28,11)},{18,new FontSizeInfo(31,13)},{20,new FontSizeInfo(35,14)},{22,new FontSizeInfo(37,16)},{24,new FontSizeInfo(41,17)},{26,new FontSizeInfo(45,19)},{28,new FontSizeInfo(47,20)},{36,new FontSizeInfo(61,26)},{48,new FontSizeInfo(81,34)},{72,new FontSizeInfo(0,51)},{96,new FontSizeInfo(161,69)},{128,new FontSizeInfo(215,92)},{256,new FontSizeInfo(427,183)}}},
- {"Eras Medium ITC",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(20,9)},{12,new FontSizeInfo(21,9)},{14,new FontSizeInfo(25,11)},{16,new FontSizeInfo(27,12)},{18,new FontSizeInfo(31,14)},{20,new FontSizeInfo(35,15)},{22,new FontSizeInfo(37,17)},{24,new FontSizeInfo(41,18)},{26,new FontSizeInfo(45,20)},{28,new FontSizeInfo(47,21)},{36,new FontSizeInfo(61,27)},{48,new FontSizeInfo(81,37)},{72,new FontSizeInfo(0,55)},{96,new FontSizeInfo(161,73)},{128,new FontSizeInfo(215,98)},{256,new FontSizeInfo(426,195)}}},
- {"Felix Titling",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,8)},{11,new FontSizeInfo(20,9)},{12,new FontSizeInfo(21,9)},{14,new FontSizeInfo(25,11)},{16,new FontSizeInfo(27,12)},{18,new FontSizeInfo(31,14)},{20,new FontSizeInfo(35,16)},{22,new FontSizeInfo(37,17)},{24,new FontSizeInfo(41,19)},{26,new FontSizeInfo(44,20)},{28,new FontSizeInfo(47,22)},{36,new FontSizeInfo(61,28)},{48,new FontSizeInfo(80,37)},{72,new FontSizeInfo(0,56)},{96,new FontSizeInfo(160,75)},{128,new FontSizeInfo(213,100)},{256,new FontSizeInfo(424,198)}}},
- {"Forte",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(21,8)},{12,new FontSizeInfo(22,8)},{14,new FontSizeInfo(28,10)},{16,new FontSizeInfo(30,11)},{18,new FontSizeInfo(34,13)},{20,new FontSizeInfo(40,14)},{22,new FontSizeInfo(42,15)},{24,new FontSizeInfo(46,17)},{26,new FontSizeInfo(51,19)},{28,new FontSizeInfo(54,20)},{36,new FontSizeInfo(71,25)},{48,new FontSizeInfo(95,34)},{72,new FontSizeInfo(0,51)},{96,new FontSizeInfo(188,68)},{128,new FontSizeInfo(253,91)},{256,new FontSizeInfo(503,181)}}},
- {"Franklin Gothic Book",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,8)},{11,new FontSizeInfo(21,9)},{12,new FontSizeInfo(22,9)},{14,new FontSizeInfo(26,11)},{16,new FontSizeInfo(28,12)},{18,new FontSizeInfo(32,14)},{20,new FontSizeInfo(36,16)},{22,new FontSizeInfo(39,17)},{24,new FontSizeInfo(40,19)},{26,new FontSizeInfo(44,21)},{28,new FontSizeInfo(46,22)},{36,new FontSizeInfo(64,28)},{48,new FontSizeInfo(85,38)},{72,new FontSizeInfo(0,56)},{96,new FontSizeInfo(168,75)},{128,new FontSizeInfo(224,100)},{256,new FontSizeInfo(416,200)}}},
- {"Franklin Gothic Demi",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,8)},{11,new FontSizeInfo(21,9)},{12,new FontSizeInfo(22,9)},{14,new FontSizeInfo(26,11)},{16,new FontSizeInfo(28,12)},{18,new FontSizeInfo(32,14)},{20,new FontSizeInfo(36,16)},{22,new FontSizeInfo(39,17)},{24,new FontSizeInfo(40,19)},{26,new FontSizeInfo(44,21)},{28,new FontSizeInfo(46,22)},{36,new FontSizeInfo(64,28)},{48,new FontSizeInfo(85,38)},{72,new FontSizeInfo(0,56)},{96,new FontSizeInfo(168,75)},{128,new FontSizeInfo(224,100)},{256,new FontSizeInfo(416,200)}}},
- {"Franklin Gothic Demi Cond",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(21,8)},{12,new FontSizeInfo(22,8)},{14,new FontSizeInfo(26,10)},{16,new FontSizeInfo(28,11)},{18,new FontSizeInfo(32,12)},{20,new FontSizeInfo(36,14)},{22,new FontSizeInfo(39,15)},{24,new FontSizeInfo(40,16)},{26,new FontSizeInfo(44,18)},{28,new FontSizeInfo(46,19)},{36,new FontSizeInfo(64,25)},{48,new FontSizeInfo(85,33)},{72,new FontSizeInfo(0,49)},{96,new FontSizeInfo(168,65)},{128,new FontSizeInfo(224,87)},{256,new FontSizeInfo(416,174)}}},
- {"Franklin Gothic Heavy",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,8)},{11,new FontSizeInfo(21,9)},{12,new FontSizeInfo(22,9)},{14,new FontSizeInfo(26,11)},{16,new FontSizeInfo(28,12)},{18,new FontSizeInfo(32,14)},{20,new FontSizeInfo(36,16)},{22,new FontSizeInfo(39,17)},{24,new FontSizeInfo(40,19)},{26,new FontSizeInfo(44,21)},{28,new FontSizeInfo(46,22)},{36,new FontSizeInfo(64,28)},{48,new FontSizeInfo(85,38)},{72,new FontSizeInfo(0,56)},{96,new FontSizeInfo(168,75)},{128,new FontSizeInfo(224,100)},{256,new FontSizeInfo(416,200)}}},
- {"Franklin Gothic Medium Cond",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(21,8)},{12,new FontSizeInfo(22,8)},{14,new FontSizeInfo(26,10)},{16,new FontSizeInfo(28,11)},{18,new FontSizeInfo(32,12)},{20,new FontSizeInfo(36,14)},{22,new FontSizeInfo(39,15)},{24,new FontSizeInfo(40,16)},{26,new FontSizeInfo(44,18)},{28,new FontSizeInfo(46,19)},{36,new FontSizeInfo(64,25)},{48,new FontSizeInfo(85,33)},{72,new FontSizeInfo(0,49)},{96,new FontSizeInfo(168,65)},{128,new FontSizeInfo(224,87)},{256,new FontSizeInfo(416,174)}}},
- {"Freestyle Script",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,4)},{10,new FontSizeInfo(20,5)},{11,new FontSizeInfo(21,6)},{12,new FontSizeInfo(23,6)},{14,new FontSizeInfo(26,7)},{16,new FontSizeInfo(29,8)},{18,new FontSizeInfo(33,9)},{20,new FontSizeInfo(37,10)},{22,new FontSizeInfo(40,10)},{24,new FontSizeInfo(43,12)},{26,new FontSizeInfo(48,13)},{28,new FontSizeInfo(50,13)},{36,new FontSizeInfo(65,17)},{48,new FontSizeInfo(86,23)},{72,new FontSizeInfo(0,33)},{96,new FontSizeInfo(172,44)},{128,new FontSizeInfo(228,58)},{256,new FontSizeInfo(454,117)}}},
- {"French Script MT",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,4)},{10,new FontSizeInfo(20,5)},{11,new FontSizeInfo(21,5)},{12,new FontSizeInfo(22,6)},{14,new FontSizeInfo(26,7)},{16,new FontSizeInfo(28,8)},{18,new FontSizeInfo(32,9)},{20,new FontSizeInfo(36,10)},{22,new FontSizeInfo(39,11)},{24,new FontSizeInfo(43,12)},{26,new FontSizeInfo(47,13)},{28,new FontSizeInfo(49,14)},{36,new FontSizeInfo(64,18)},{48,new FontSizeInfo(85,23)},{72,new FontSizeInfo(0,35)},{96,new FontSizeInfo(168,47)},{128,new FontSizeInfo(224,62)},{256,new FontSizeInfo(446,125)}}},
- {"Footlight MT Light",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(20,8)},{12,new FontSizeInfo(21,9)},{14,new FontSizeInfo(24,11)},{16,new FontSizeInfo(27,12)},{18,new FontSizeInfo(30,13)},{20,new FontSizeInfo(34,15)},{22,new FontSizeInfo(37,16)},{24,new FontSizeInfo(40,18)},{26,new FontSizeInfo(44,19)},{28,new FontSizeInfo(46,20)},{36,new FontSizeInfo(60,27)},{48,new FontSizeInfo(79,35)},{72,new FontSizeInfo(0,53)},{96,new FontSizeInfo(158,71)},{128,new FontSizeInfo(210,94)},{256,new FontSizeInfo(419,188)}}},
- {"Garamond",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,5)},{10,new FontSizeInfo(20,6)},{11,new FontSizeInfo(20,7)},{12,new FontSizeInfo(21,8)},{14,new FontSizeInfo(25,9)},{16,new FontSizeInfo(28,10)},{18,new FontSizeInfo(31,11)},{20,new FontSizeInfo(35,13)},{22,new FontSizeInfo(38,14)},{24,new FontSizeInfo(41,15)},{26,new FontSizeInfo(45,16)},{28,new FontSizeInfo(48,17)},{36,new FontSizeInfo(62,23)},{48,new FontSizeInfo(82,30)},{72,new FontSizeInfo(0,45)},{96,new FontSizeInfo(163,60)},{128,new FontSizeInfo(217,80)},{256,new FontSizeInfo(432,160)}}},
- {"Gigi",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(21,5)},{10,new FontSizeInfo(22,7)},{11,new FontSizeInfo(22,7)},{12,new FontSizeInfo(24,7)},{14,new FontSizeInfo(28,10)},{16,new FontSizeInfo(31,12)},{18,new FontSizeInfo(35,12)},{20,new FontSizeInfo(39,14)},{22,new FontSizeInfo(42,14)},{24,new FontSizeInfo(46,17)},{26,new FontSizeInfo(50,19)},{28,new FontSizeInfo(53,19)},{36,new FontSizeInfo(69,24)},{48,new FontSizeInfo(91,33)},{72,new FontSizeInfo(0,50)},{96,new FontSizeInfo(182,66)},{128,new FontSizeInfo(242,88)},{256,new FontSizeInfo(482,175)}}},
- {"Gill Sans MT",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(21,6)},{10,new FontSizeInfo(21,7)},{11,new FontSizeInfo(23,8)},{12,new FontSizeInfo(26,8)},{14,new FontSizeInfo(29,10)},{16,new FontSizeInfo(33,11)},{18,new FontSizeInfo(37,12)},{20,new FontSizeInfo(41,14)},{22,new FontSizeInfo(43,15)},{24,new FontSizeInfo(48,16)},{26,new FontSizeInfo(51,18)},{28,new FontSizeInfo(56,19)},{36,new FontSizeInfo(71,24)},{48,new FontSizeInfo(91,32)},{72,new FontSizeInfo(0,48)},{96,new FontSizeInfo(184,64)},{128,new FontSizeInfo(243,86)},{256,new FontSizeInfo(421,171)}}},
- {"Gill Sans MT Condensed",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,4)},{10,new FontSizeInfo(21,5)},{11,new FontSizeInfo(21,5)},{12,new FontSizeInfo(22,6)},{14,new FontSizeInfo(27,7)},{16,new FontSizeInfo(29,8)},{18,new FontSizeInfo(32,9)},{20,new FontSizeInfo(37,10)},{22,new FontSizeInfo(39,11)},{24,new FontSizeInfo(43,12)},{26,new FontSizeInfo(47,13)},{28,new FontSizeInfo(50,14)},{36,new FontSizeInfo(64,18)},{48,new FontSizeInfo(86,23)},{72,new FontSizeInfo(0,35)},{96,new FontSizeInfo(169,47)},{128,new FontSizeInfo(226,62)},{256,new FontSizeInfo(434,125)}}},
- {"Gill Sans Ultra Bold Condensed",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(22,8)},{11,new FontSizeInfo(21,9)},{12,new FontSizeInfo(23,9)},{14,new FontSizeInfo(27,11)},{16,new FontSizeInfo(30,12)},{18,new FontSizeInfo(33,14)},{20,new FontSizeInfo(38,16)},{22,new FontSizeInfo(41,17)},{24,new FontSizeInfo(45,19)},{26,new FontSizeInfo(49,20)},{28,new FontSizeInfo(51,22)},{36,new FontSizeInfo(69,28)},{48,new FontSizeInfo(89,37)},{72,new FontSizeInfo(0,56)},{96,new FontSizeInfo(176,74)},{128,new FontSizeInfo(235,99)},{256,new FontSizeInfo(428,198)}}},
- {"Gill Sans Ultra Bold",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(23,9)},{10,new FontSizeInfo(22,11)},{11,new FontSizeInfo(21,13)},{12,new FontSizeInfo(24,14)},{14,new FontSizeInfo(27,16)},{16,new FontSizeInfo(31,18)},{18,new FontSizeInfo(35,21)},{20,new FontSizeInfo(41,23)},{22,new FontSizeInfo(44,25)},{24,new FontSizeInfo(45,27)},{26,new FontSizeInfo(50,30)},{28,new FontSizeInfo(53,32)},{36,new FontSizeInfo(71,41)},{48,new FontSizeInfo(93,55)},{72,new FontSizeInfo(0,82)},{96,new FontSizeInfo(181,109)},{128,new FontSizeInfo(241,146)},{256,new FontSizeInfo(428,291)}}},
- {"Gloucester MT Extra Condensed",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,4)},{10,new FontSizeInfo(20,5)},{11,new FontSizeInfo(20,6)},{12,new FontSizeInfo(21,6)},{14,new FontSizeInfo(24,7)},{16,new FontSizeInfo(27,8)},{18,new FontSizeInfo(30,9)},{20,new FontSizeInfo(34,10)},{22,new FontSizeInfo(36,11)},{24,new FontSizeInfo(40,12)},{26,new FontSizeInfo(44,14)},{28,new FontSizeInfo(46,14)},{36,new FontSizeInfo(59,19)},{48,new FontSizeInfo(79,25)},{72,new FontSizeInfo(0,37)},{96,new FontSizeInfo(157,49)},{128,new FontSizeInfo(209,66)},{256,new FontSizeInfo(416,132)}}},
- {"Gill Sans MT Ext Condensed Bold",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,4)},{10,new FontSizeInfo(20,4)},{11,new FontSizeInfo(20,5)},{12,new FontSizeInfo(23,6)},{14,new FontSizeInfo(25,7)},{16,new FontSizeInfo(27,7)},{18,new FontSizeInfo(33,8)},{20,new FontSizeInfo(35,9)},{22,new FontSizeInfo(37,10)},{24,new FontSizeInfo(41,11)},{26,new FontSizeInfo(45,12)},{28,new FontSizeInfo(47,13)},{36,new FontSizeInfo(61,17)},{48,new FontSizeInfo(81,22)},{72,new FontSizeInfo(0,33)},{96,new FontSizeInfo(161,44)},{128,new FontSizeInfo(214,59)},{256,new FontSizeInfo(410,117)}}},
- {"Century Gothic",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(21,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(22,8)},{12,new FontSizeInfo(23,9)},{14,new FontSizeInfo(24,11)},{16,new FontSizeInfo(26,12)},{18,new FontSizeInfo(32,13)},{20,new FontSizeInfo(35,15)},{22,new FontSizeInfo(38,16)},{24,new FontSizeInfo(41,18)},{26,new FontSizeInfo(44,19)},{28,new FontSizeInfo(46,21)},{36,new FontSizeInfo(61,27)},{48,new FontSizeInfo(82,35)},{72,new FontSizeInfo(0,53)},{96,new FontSizeInfo(158,71)},{128,new FontSizeInfo(214,95)},{256,new FontSizeInfo(427,189)}}},
- {"Goudy Old Style",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(21,8)},{12,new FontSizeInfo(22,8)},{14,new FontSizeInfo(25,10)},{16,new FontSizeInfo(28,11)},{18,new FontSizeInfo(31,12)},{20,new FontSizeInfo(35,14)},{22,new FontSizeInfo(40,15)},{24,new FontSizeInfo(43,16)},{26,new FontSizeInfo(47,18)},{28,new FontSizeInfo(50,19)},{36,new FontSizeInfo(63,24)},{48,new FontSizeInfo(86,32)},{72,new FontSizeInfo(0,48)},{96,new FontSizeInfo(173,64)},{128,new FontSizeInfo(231,86)},{256,new FontSizeInfo(451,171)}}},
- {"Goudy Stout",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,9)},{10,new FontSizeInfo(21,11)},{11,new FontSizeInfo(21,12)},{12,new FontSizeInfo(23,13)},{14,new FontSizeInfo(27,16)},{16,new FontSizeInfo(29,17)},{18,new FontSizeInfo(33,20)},{20,new FontSizeInfo(39,22)},{22,new FontSizeInfo(42,24)},{24,new FontSizeInfo(46,26)},{26,new FontSizeInfo(50,29)},{28,new FontSizeInfo(53,31)},{36,new FontSizeInfo(68,40)},{48,new FontSizeInfo(89,53)},{72,new FontSizeInfo(0,79)},{96,new FontSizeInfo(178,106)},{128,new FontSizeInfo(238,141)},{256,new FontSizeInfo(473,280)}}},
- {"Harlow Solid Italic",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,5)},{10,new FontSizeInfo(21,6)},{11,new FontSizeInfo(22,7)},{12,new FontSizeInfo(23,7)},{14,new FontSizeInfo(27,9)},{16,new FontSizeInfo(30,10)},{18,new FontSizeInfo(34,11)},{20,new FontSizeInfo(38,13)},{22,new FontSizeInfo(41,14)},{24,new FontSizeInfo(45,15)},{26,new FontSizeInfo(50,16)},{28,new FontSizeInfo(52,17)},{36,new FontSizeInfo(68,22)},{48,new FontSizeInfo(90,30)},{72,new FontSizeInfo(0,45)},{96,new FontSizeInfo(179,60)},{128,new FontSizeInfo(238,80)},{256,new FontSizeInfo(474,159)}}},
- {"Harrington",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(20,8)},{12,new FontSizeInfo(21,9)},{14,new FontSizeInfo(24,11)},{16,new FontSizeInfo(27,12)},{18,new FontSizeInfo(31,13)},{20,new FontSizeInfo(34,15)},{22,new FontSizeInfo(37,16)},{24,new FontSizeInfo(40,18)},{26,new FontSizeInfo(44,19)},{28,new FontSizeInfo(47,21)},{36,new FontSizeInfo(60,27)},{48,new FontSizeInfo(80,36)},{72,new FontSizeInfo(0,53)},{96,new FontSizeInfo(159,71)},{128,new FontSizeInfo(211,95)},{256,new FontSizeInfo(421,189)}}},
- {"Haettenschweiler",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,5)},{10,new FontSizeInfo(20,6)},{11,new FontSizeInfo(20,7)},{12,new FontSizeInfo(21,7)},{14,new FontSizeInfo(24,8)},{16,new FontSizeInfo(26,9)},{18,new FontSizeInfo(29,11)},{20,new FontSizeInfo(32,12)},{22,new FontSizeInfo(34,13)},{24,new FontSizeInfo(37,14)},{26,new FontSizeInfo(40,15)},{28,new FontSizeInfo(43,16)},{36,new FontSizeInfo(55,21)},{48,new FontSizeInfo(73,28)},{72,new FontSizeInfo(0,42)},{96,new FontSizeInfo(148,56)},{128,new FontSizeInfo(198,75)},{256,new FontSizeInfo(391,150)}}},
- {"High Tower Text",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,5)},{10,new FontSizeInfo(20,6)},{11,new FontSizeInfo(20,7)},{12,new FontSizeInfo(21,8)},{14,new FontSizeInfo(25,9)},{16,new FontSizeInfo(27,10)},{18,new FontSizeInfo(31,12)},{20,new FontSizeInfo(35,13)},{22,new FontSizeInfo(37,14)},{24,new FontSizeInfo(41,15)},{26,new FontSizeInfo(45,17)},{28,new FontSizeInfo(48,18)},{36,new FontSizeInfo(62,23)},{48,new FontSizeInfo(82,31)},{72,new FontSizeInfo(0,46)},{96,new FontSizeInfo(163,62)},{128,new FontSizeInfo(217,82)},{256,new FontSizeInfo(432,164)}}},
- {"Imprint MT Shadow",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(20,8)},{12,new FontSizeInfo(21,8)},{14,new FontSizeInfo(25,10)},{16,new FontSizeInfo(27,11)},{18,new FontSizeInfo(31,12)},{20,new FontSizeInfo(35,14)},{22,new FontSizeInfo(37,15)},{24,new FontSizeInfo(41,16)},{26,new FontSizeInfo(45,18)},{28,new FontSizeInfo(47,19)},{36,new FontSizeInfo(61,24)},{48,new FontSizeInfo(81,33)},{72,new FontSizeInfo(0,49)},{96,new FontSizeInfo(161,65)},{128,new FontSizeInfo(215,87)},{256,new FontSizeInfo(427,174)}}},
- {"Informal Roman",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(21,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(22,8)},{12,new FontSizeInfo(23,9)},{14,new FontSizeInfo(27,10)},{16,new FontSizeInfo(29,11)},{18,new FontSizeInfo(33,13)},{20,new FontSizeInfo(39,15)},{22,new FontSizeInfo(42,16)},{24,new FontSizeInfo(45,17)},{26,new FontSizeInfo(49,19)},{28,new FontSizeInfo(53,20)},{36,new FontSizeInfo(69,25)},{48,new FontSizeInfo(91,34)},{72,new FontSizeInfo(0,51)},{96,new FontSizeInfo(183,68)},{128,new FontSizeInfo(245,91)},{256,new FontSizeInfo(479,181)}}},
- {"Blackadder ITC",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(21,4)},{10,new FontSizeInfo(21,5)},{11,new FontSizeInfo(22,6)},{12,new FontSizeInfo(23,6)},{14,new FontSizeInfo(28,8)},{16,new FontSizeInfo(30,8)},{18,new FontSizeInfo(34,9)},{20,new FontSizeInfo(38,11)},{22,new FontSizeInfo(41,11)},{24,new FontSizeInfo(45,13)},{26,new FontSizeInfo(50,14)},{28,new FontSizeInfo(52,15)},{36,new FontSizeInfo(68,19)},{48,new FontSizeInfo(90,25)},{72,new FontSizeInfo(0,38)},{96,new FontSizeInfo(179,51)},{128,new FontSizeInfo(238,67)},{256,new FontSizeInfo(474,135)}}},
- {"Edwardian Script ITC",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,5)},{10,new FontSizeInfo(20,6)},{11,new FontSizeInfo(21,7)},{12,new FontSizeInfo(22,8)},{14,new FontSizeInfo(26,9)},{16,new FontSizeInfo(29,10)},{18,new FontSizeInfo(33,11)},{20,new FontSizeInfo(37,13)},{22,new FontSizeInfo(40,14)},{24,new FontSizeInfo(44,15)},{26,new FontSizeInfo(47,17)},{28,new FontSizeInfo(50,18)},{36,new FontSizeInfo(65,23)},{48,new FontSizeInfo(86,31)},{72,new FontSizeInfo(0,46)},{96,new FontSizeInfo(171,61)},{128,new FontSizeInfo(228,82)},{256,new FontSizeInfo(454,163)}}},
- {"Kristen ITC",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(21,7)},{10,new FontSizeInfo(21,8)},{11,new FontSizeInfo(24,9)},{12,new FontSizeInfo(25,10)},{14,new FontSizeInfo(29,11)},{16,new FontSizeInfo(31,13)},{18,new FontSizeInfo(35,14)},{20,new FontSizeInfo(37,16)},{22,new FontSizeInfo(42,17)},{24,new FontSizeInfo(46,19)},{26,new FontSizeInfo(49,21)},{28,new FontSizeInfo(53,22)},{36,new FontSizeInfo(68,29)},{48,new FontSizeInfo(91,38)},{72,new FontSizeInfo(0,58)},{96,new FontSizeInfo(178,77)},{128,new FontSizeInfo(240,103)},{256,new FontSizeInfo(473,205)}}},
- {"Jokerman",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(22,8)},{10,new FontSizeInfo(23,9)},{11,new FontSizeInfo(25,11)},{12,new FontSizeInfo(27,11)},{14,new FontSizeInfo(31,14)},{16,new FontSizeInfo(35,15)},{18,new FontSizeInfo(39,17)},{20,new FontSizeInfo(43,19)},{22,new FontSizeInfo(48,21)},{24,new FontSizeInfo(52,23)},{26,new FontSizeInfo(56,25)},{28,new FontSizeInfo(61,26)},{36,new FontSizeInfo(76,34)},{48,new FontSizeInfo(101,46)},{72,new FontSizeInfo(0,69)},{96,new FontSizeInfo(202,91)},{128,new FontSizeInfo(270,122)},{256,new FontSizeInfo(569,244)}}},
- {"Juice ITC",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,4)},{10,new FontSizeInfo(20,5)},{11,new FontSizeInfo(20,6)},{12,new FontSizeInfo(21,6)},{14,new FontSizeInfo(24,7)},{16,new FontSizeInfo(27,8)},{18,new FontSizeInfo(30,8)},{20,new FontSizeInfo(34,10)},{22,new FontSizeInfo(36,11)},{24,new FontSizeInfo(40,11)},{26,new FontSizeInfo(44,13)},{28,new FontSizeInfo(46,14)},{36,new FontSizeInfo(62,18)},{48,new FontSizeInfo(81,24)},{72,new FontSizeInfo(0,36)},{96,new FontSizeInfo(164,48)},{128,new FontSizeInfo(218,64)},{256,new FontSizeInfo(436,128)}}},
- {"Kunstler Script",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,4)},{10,new FontSizeInfo(20,5)},{11,new FontSizeInfo(20,5)},{12,new FontSizeInfo(21,6)},{14,new FontSizeInfo(25,7)},{16,new FontSizeInfo(28,7)},{18,new FontSizeInfo(31,8)},{20,new FontSizeInfo(35,10)},{22,new FontSizeInfo(38,10)},{24,new FontSizeInfo(42,11)},{26,new FontSizeInfo(45,12)},{28,new FontSizeInfo(48,13)},{36,new FontSizeInfo(62,17)},{48,new FontSizeInfo(82,23)},{72,new FontSizeInfo(0,34)},{96,new FontSizeInfo(163,45)},{128,new FontSizeInfo(218,60)},{256,new FontSizeInfo(437,120)}}},
- {"Wide Latin",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,14)},{10,new FontSizeInfo(20,16)},{11,new FontSizeInfo(20,19)},{12,new FontSizeInfo(21,20)},{14,new FontSizeInfo(25,24)},{16,new FontSizeInfo(28,26)},{18,new FontSizeInfo(31,30)},{20,new FontSizeInfo(35,33)},{22,new FontSizeInfo(38,36)},{24,new FontSizeInfo(42,40)},{26,new FontSizeInfo(45,43)},{28,new FontSizeInfo(48,46)},{36,new FontSizeInfo(62,59)},{48,new FontSizeInfo(82,79)},{72,new FontSizeInfo(0,119)},{96,new FontSizeInfo(163,158)},{128,new FontSizeInfo(218,212)},{256,new FontSizeInfo(433,422)}}},
- {"Lucida Bright",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,7)},{10,new FontSizeInfo(20,8)},{11,new FontSizeInfo(20,9)},{12,new FontSizeInfo(21,10)},{14,new FontSizeInfo(24,12)},{16,new FontSizeInfo(26,13)},{18,new FontSizeInfo(30,15)},{20,new FontSizeInfo(34,16)},{22,new FontSizeInfo(36,18)},{24,new FontSizeInfo(39,19)},{26,new FontSizeInfo(43,21)},{28,new FontSizeInfo(45,23)},{36,new FontSizeInfo(59,29)},{48,new FontSizeInfo(80,39)},{72,new FontSizeInfo(0,58)},{96,new FontSizeInfo(159,78)},{128,new FontSizeInfo(213,104)},{256,new FontSizeInfo(426,207)}}},
- {"Lucida Calligraphy",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,8)},{10,new FontSizeInfo(20,10)},{11,new FontSizeInfo(23,11)},{12,new FontSizeInfo(24,12)},{14,new FontSizeInfo(26,14)},{16,new FontSizeInfo(29,15)},{18,new FontSizeInfo(35,17)},{20,new FontSizeInfo(39,19)},{22,new FontSizeInfo(41,20)},{24,new FontSizeInfo(45,22)},{26,new FontSizeInfo(49,24)},{28,new FontSizeInfo(52,26)},{36,new FontSizeInfo(69,33)},{48,new FontSizeInfo(92,44)},{72,new FontSizeInfo(0,65)},{96,new FontSizeInfo(183,86)},{128,new FontSizeInfo(246,115)},{256,new FontSizeInfo(489,227)}}},
- {"Leelawadee",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,6)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(20,9)},{12,new FontSizeInfo(21,9)},{14,new FontSizeInfo(25,11)},{16,new FontSizeInfo(27,12)},{18,new FontSizeInfo(31,14)},{20,new FontSizeInfo(34,16)},{22,new FontSizeInfo(37,17)},{24,new FontSizeInfo(41,18)},{26,new FontSizeInfo(44,20)},{28,new FontSizeInfo(47,21)},{36,new FontSizeInfo(60,28)},{48,new FontSizeInfo(80,37)},{72,new FontSizeInfo(0,55)},{96,new FontSizeInfo(160,74)},{128,new FontSizeInfo(213,98)},{256,new FontSizeInfo(423,196)}}},
- {"Lucida Fax",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,6)},{8,new FontSizeInfo(20,7)},{10,new FontSizeInfo(20,9)},{11,new FontSizeInfo(20,10)},{12,new FontSizeInfo(21,11)},{14,new FontSizeInfo(24,13)},{16,new FontSizeInfo(27,14)},{18,new FontSizeInfo(30,16)},{20,new FontSizeInfo(34,18)},{22,new FontSizeInfo(36,19)},{24,new FontSizeInfo(40,21)},{26,new FontSizeInfo(44,23)},{28,new FontSizeInfo(46,25)},{36,new FontSizeInfo(59,32)},{48,new FontSizeInfo(78,42)},{72,new FontSizeInfo(0,64)},{96,new FontSizeInfo(157,85)},{128,new FontSizeInfo(211,113)},{256,new FontSizeInfo(422,226)}}},
- {"Lucida Handwriting",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,6)},{8,new FontSizeInfo(20,8)},{10,new FontSizeInfo(20,10)},{11,new FontSizeInfo(21,11)},{12,new FontSizeInfo(24,12)},{14,new FontSizeInfo(26,14)},{16,new FontSizeInfo(29,15)},{18,new FontSizeInfo(33,17)},{20,new FontSizeInfo(39,19)},{22,new FontSizeInfo(41,21)},{24,new FontSizeInfo(45,23)},{26,new FontSizeInfo(49,25)},{28,new FontSizeInfo(52,26)},{36,new FontSizeInfo(69,33)},{48,new FontSizeInfo(90,44)},{72,new FontSizeInfo(0,66)},{96,new FontSizeInfo(181,87)},{128,new FontSizeInfo(242,116)},{256,new FontSizeInfo(483,231)}}},
- {"Lucida Sans",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,6)},{8,new FontSizeInfo(20,7)},{10,new FontSizeInfo(20,9)},{11,new FontSizeInfo(20,10)},{12,new FontSizeInfo(21,11)},{14,new FontSizeInfo(24,13)},{16,new FontSizeInfo(27,14)},{18,new FontSizeInfo(30,16)},{20,new FontSizeInfo(34,18)},{22,new FontSizeInfo(36,19)},{24,new FontSizeInfo(40,21)},{26,new FontSizeInfo(43,23)},{28,new FontSizeInfo(46,24)},{36,new FontSizeInfo(59,32)},{48,new FontSizeInfo(80,42)},{72,new FontSizeInfo(0,63)},{96,new FontSizeInfo(159,84)},{128,new FontSizeInfo(213,113)},{256,new FontSizeInfo(426,225)}}},
- {"Lucida Sans Typewriter",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,6)},{8,new FontSizeInfo(20,7)},{10,new FontSizeInfo(20,8)},{11,new FontSizeInfo(20,9)},{12,new FontSizeInfo(21,10)},{14,new FontSizeInfo(24,11)},{16,new FontSizeInfo(26,13)},{18,new FontSizeInfo(30,14)},{20,new FontSizeInfo(34,16)},{22,new FontSizeInfo(36,17)},{24,new FontSizeInfo(40,19)},{26,new FontSizeInfo(43,21)},{28,new FontSizeInfo(46,22)},{36,new FontSizeInfo(59,29)},{48,new FontSizeInfo(80,39)},{72,new FontSizeInfo(0,58)},{96,new FontSizeInfo(159,77)},{128,new FontSizeInfo(213,103)},{256,new FontSizeInfo(424,205)}}},
- {"Magneto",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,6)},{8,new FontSizeInfo(20,8)},{10,new FontSizeInfo(20,10)},{11,new FontSizeInfo(21,12)},{12,new FontSizeInfo(22,12)},{14,new FontSizeInfo(26,15)},{16,new FontSizeInfo(28,16)},{18,new FontSizeInfo(32,19)},{20,new FontSizeInfo(36,21)},{22,new FontSizeInfo(39,22)},{24,new FontSizeInfo(43,25)},{26,new FontSizeInfo(47,27)},{28,new FontSizeInfo(49,29)},{36,new FontSizeInfo(64,37)},{48,new FontSizeInfo(84,49)},{72,new FontSizeInfo(0,74)},{96,new FontSizeInfo(168,99)},{128,new FontSizeInfo(224,132)},{256,new FontSizeInfo(445,263)}}},
- {"Maiandra GD",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,6)},{8,new FontSizeInfo(20,7)},{10,new FontSizeInfo(20,9)},{11,new FontSizeInfo(20,10)},{12,new FontSizeInfo(21,10)},{14,new FontSizeInfo(24,12)},{16,new FontSizeInfo(27,13)},{18,new FontSizeInfo(31,15)},{20,new FontSizeInfo(34,17)},{22,new FontSizeInfo(37,18)},{24,new FontSizeInfo(41,20)},{26,new FontSizeInfo(44,22)},{28,new FontSizeInfo(47,23)},{36,new FontSizeInfo(60,29)},{48,new FontSizeInfo(80,39)},{72,new FontSizeInfo(0,57)},{96,new FontSizeInfo(159,76)},{128,new FontSizeInfo(212,102)},{256,new FontSizeInfo(422,200)}}},
- {"Matura MT Script Capitals",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,6)},{8,new FontSizeInfo(21,8)},{10,new FontSizeInfo(22,10)},{11,new FontSizeInfo(23,11)},{12,new FontSizeInfo(25,12)},{14,new FontSizeInfo(29,13)},{16,new FontSizeInfo(32,15)},{18,new FontSizeInfo(36,17)},{20,new FontSizeInfo(41,19)},{22,new FontSizeInfo(44,20)},{24,new FontSizeInfo(48,22)},{26,new FontSizeInfo(53,24)},{28,new FontSizeInfo(56,25)},{36,new FontSizeInfo(72,33)},{48,new FontSizeInfo(95,42)},{72,new FontSizeInfo(0,63)},{96,new FontSizeInfo(190,84)},{128,new FontSizeInfo(253,111)},{256,new FontSizeInfo(504,221)}}},
- {"Mistral",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,6)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(21,8)},{12,new FontSizeInfo(22,8)},{14,new FontSizeInfo(26,10)},{16,new FontSizeInfo(29,10)},{18,new FontSizeInfo(33,12)},{20,new FontSizeInfo(37,13)},{22,new FontSizeInfo(39,14)},{24,new FontSizeInfo(43,15)},{26,new FontSizeInfo(47,17)},{28,new FontSizeInfo(50,18)},{36,new FontSizeInfo(64,23)},{48,new FontSizeInfo(85,30)},{72,new FontSizeInfo(0,44)},{96,new FontSizeInfo(169,59)},{128,new FontSizeInfo(226,78)},{256,new FontSizeInfo(450,154)}}},
- {"Modern No. 20",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,6)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(20,8)},{12,new FontSizeInfo(21,8)},{14,new FontSizeInfo(24,10)},{16,new FontSizeInfo(27,11)},{18,new FontSizeInfo(30,12)},{20,new FontSizeInfo(34,13)},{22,new FontSizeInfo(36,14)},{24,new FontSizeInfo(40,16)},{26,new FontSizeInfo(43,17)},{28,new FontSizeInfo(46,18)},{36,new FontSizeInfo(59,23)},{48,new FontSizeInfo(80,30)},{72,new FontSizeInfo(0,45)},{96,new FontSizeInfo(160,59)},{128,new FontSizeInfo(214,79)},{256,new FontSizeInfo(427,156)}}},
- {"Microsoft Uighur",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,6)},{8,new FontSizeInfo(23,4)},{10,new FontSizeInfo(23,5)},{11,new FontSizeInfo(24,6)},{12,new FontSizeInfo(25,6)},{14,new FontSizeInfo(30,7)},{16,new FontSizeInfo(33,8)},{18,new FontSizeInfo(37,9)},{20,new FontSizeInfo(42,10)},{22,new FontSizeInfo(45,11)},{24,new FontSizeInfo(52,12)},{26,new FontSizeInfo(56,13)},{28,new FontSizeInfo(59,14)},{36,new FontSizeInfo(76,18)},{48,new FontSizeInfo(102,24)},{72,new FontSizeInfo(0,36)},{96,new FontSizeInfo(202,48)},{128,new FontSizeInfo(272,64)},{256,new FontSizeInfo(476,128)}}},
- {"Monotype Corsiva",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,6)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(20,8)},{12,new FontSizeInfo(21,8)},{14,new FontSizeInfo(25,9)},{16,new FontSizeInfo(28,10)},{18,new FontSizeInfo(31,12)},{20,new FontSizeInfo(36,13)},{22,new FontSizeInfo(39,14)},{24,new FontSizeInfo(42,15)},{26,new FontSizeInfo(47,16)},{28,new FontSizeInfo(49,17)},{36,new FontSizeInfo(62,22)},{48,new FontSizeInfo(85,29)},{72,new FontSizeInfo(0,43)},{96,new FontSizeInfo(170,57)},{128,new FontSizeInfo(225,76)},{256,new FontSizeInfo(453,151)}}},
- {"Niagara Engraved",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,6)},{8,new FontSizeInfo(21,5)},{10,new FontSizeInfo(20,5)},{11,new FontSizeInfo(20,5)},{12,new FontSizeInfo(21,6)},{14,new FontSizeInfo(24,7)},{16,new FontSizeInfo(26,8)},{18,new FontSizeInfo(29,9)},{20,new FontSizeInfo(33,9)},{22,new FontSizeInfo(35,10)},{24,new FontSizeInfo(39,11)},{26,new FontSizeInfo(43,11)},{28,new FontSizeInfo(45,12)},{36,new FontSizeInfo(58,15)},{48,new FontSizeInfo(77,20)},{72,new FontSizeInfo(0,30)},{96,new FontSizeInfo(154,39)},{128,new FontSizeInfo(207,52)},{256,new FontSizeInfo(407,103)}}},
- {"Niagara Solid",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,6)},{8,new FontSizeInfo(21,5)},{10,new FontSizeInfo(20,5)},{11,new FontSizeInfo(20,6)},{12,new FontSizeInfo(21,6)},{14,new FontSizeInfo(24,7)},{16,new FontSizeInfo(26,8)},{18,new FontSizeInfo(29,9)},{20,new FontSizeInfo(33,9)},{22,new FontSizeInfo(35,10)},{24,new FontSizeInfo(39,11)},{26,new FontSizeInfo(43,11)},{28,new FontSizeInfo(45,12)},{36,new FontSizeInfo(58,15)},{48,new FontSizeInfo(77,20)},{72,new FontSizeInfo(0,30)},{96,new FontSizeInfo(154,39)},{128,new FontSizeInfo(207,52)},{256,new FontSizeInfo(407,103)}}},
- {"OCR A Extended",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,6)},{8,new FontSizeInfo(20,8)},{10,new FontSizeInfo(20,9)},{11,new FontSizeInfo(20,10)},{12,new FontSizeInfo(21,11)},{14,new FontSizeInfo(24,12)},{16,new FontSizeInfo(26,14)},{18,new FontSizeInfo(29,15)},{20,new FontSizeInfo(33,17)},{22,new FontSizeInfo(35,19)},{24,new FontSizeInfo(39,20)},{26,new FontSizeInfo(42,22)},{28,new FontSizeInfo(45,23)},{36,new FontSizeInfo(57,30)},{48,new FontSizeInfo(76,40)},{72,new FontSizeInfo(0,59)},{96,new FontSizeInfo(152,78)},{128,new FontSizeInfo(202,104)},{256,new FontSizeInfo(402,207)}}},
- {"Old English Text MT",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,6)},{8,new FontSizeInfo(20,7)},{10,new FontSizeInfo(20,8)},{11,new FontSizeInfo(21,9)},{12,new FontSizeInfo(21,9)},{14,new FontSizeInfo(24,11)},{16,new FontSizeInfo(27,12)},{18,new FontSizeInfo(30,13)},{20,new FontSizeInfo(34,15)},{22,new FontSizeInfo(36,16)},{24,new FontSizeInfo(40,17)},{26,new FontSizeInfo(44,19)},{28,new FontSizeInfo(46,20)},{36,new FontSizeInfo(59,25)},{48,new FontSizeInfo(79,34)},{72,new FontSizeInfo(0,50)},{96,new FontSizeInfo(157,66)},{128,new FontSizeInfo(209,88)},{256,new FontSizeInfo(418,175)}}},
- {"Onyx",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,6)},{8,new FontSizeInfo(20,5)},{10,new FontSizeInfo(20,6)},{11,new FontSizeInfo(20,6)},{12,new FontSizeInfo(21,7)},{14,new FontSizeInfo(24,7)},{16,new FontSizeInfo(26,8)},{18,new FontSizeInfo(29,9)},{20,new FontSizeInfo(33,9)},{22,new FontSizeInfo(35,10)},{24,new FontSizeInfo(39,10)},{26,new FontSizeInfo(42,11)},{28,new FontSizeInfo(45,11)},{36,new FontSizeInfo(58,15)},{48,new FontSizeInfo(77,19)},{72,new FontSizeInfo(0,29)},{96,new FontSizeInfo(152,39)},{128,new FontSizeInfo(203,50)},{256,new FontSizeInfo(416,97)}}},
- {"MS Outlook",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,7)},{10,new FontSizeInfo(20,8)},{11,new FontSizeInfo(20,9)},{12,new FontSizeInfo(21,9)},{14,new FontSizeInfo(24,11)},{16,new FontSizeInfo(26,12)},{18,new FontSizeInfo(29,13)},{20,new FontSizeInfo(34,15)},{22,new FontSizeInfo(36,16)},{24,new FontSizeInfo(40,17)},{26,new FontSizeInfo(43,19)},{28,new FontSizeInfo(46,20)},{36,new FontSizeInfo(59,25)},{48,new FontSizeInfo(78,33)},{72,new FontSizeInfo(0,49)},{96,new FontSizeInfo(154,65)},{128,new FontSizeInfo(206,87)},{256,new FontSizeInfo(410,172)}}},
- {"Palace Script MT",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,6)},{8,new FontSizeInfo(20,4)},{10,new FontSizeInfo(20,5)},{11,new FontSizeInfo(20,6)},{12,new FontSizeInfo(21,6)},{14,new FontSizeInfo(25,7)},{16,new FontSizeInfo(27,8)},{18,new FontSizeInfo(31,9)},{20,new FontSizeInfo(35,9)},{22,new FontSizeInfo(37,10)},{24,new FontSizeInfo(41,11)},{26,new FontSizeInfo(44,12)},{28,new FontSizeInfo(47,13)},{36,new FontSizeInfo(61,16)},{48,new FontSizeInfo(81,21)},{72,new FontSizeInfo(0,31)},{96,new FontSizeInfo(160,41)},{128,new FontSizeInfo(213,55)},{256,new FontSizeInfo(425,108)}}},
- {"Papyrus",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,6)},{8,new FontSizeInfo(23,7)},{10,new FontSizeInfo(24,9)},{11,new FontSizeInfo(26,10)},{12,new FontSizeInfo(27,10)},{14,new FontSizeInfo(32,12)},{16,new FontSizeInfo(35,14)},{18,new FontSizeInfo(40,15)},{20,new FontSizeInfo(44,16)},{22,new FontSizeInfo(49,18)},{24,new FontSizeInfo(54,20)},{26,new FontSizeInfo(58,22)},{28,new FontSizeInfo(61,22)},{36,new FontSizeInfo(80,29)},{48,new FontSizeInfo(104,38)},{72,new FontSizeInfo(0,56)},{96,new FontSizeInfo(210,74)},{128,new FontSizeInfo(279,99)},{256,new FontSizeInfo(556,197)}}},
- {"Parchment",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,6)},{8,new FontSizeInfo(20,4)},{10,new FontSizeInfo(21,4)},{11,new FontSizeInfo(22,4)},{12,new FontSizeInfo(23,4)},{14,new FontSizeInfo(27,5)},{16,new FontSizeInfo(29,5)},{18,new FontSizeInfo(33,6)},{20,new FontSizeInfo(36,7)},{22,new FontSizeInfo(39,7)},{24,new FontSizeInfo(43,8)},{26,new FontSizeInfo(46,8)},{28,new FontSizeInfo(49,9)},{36,new FontSizeInfo(64,11)},{48,new FontSizeInfo(85,14)},{72,new FontSizeInfo(0,21)},{96,new FontSizeInfo(169,28)},{128,new FontSizeInfo(226,37)},{256,new FontSizeInfo(450,73)}}},
- {"Perpetua",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,5)},{10,new FontSizeInfo(20,6)},{11,new FontSizeInfo(21,7)},{12,new FontSizeInfo(22,7)},{14,new FontSizeInfo(26,9)},{16,new FontSizeInfo(29,10)},{18,new FontSizeInfo(33,11)},{20,new FontSizeInfo(37,12)},{22,new FontSizeInfo(39,13)},{24,new FontSizeInfo(43,15)},{26,new FontSizeInfo(47,16)},{28,new FontSizeInfo(50,17)},{36,new FontSizeInfo(65,22)},{48,new FontSizeInfo(86,29)},{72,new FontSizeInfo(0,44)},{96,new FontSizeInfo(171,59)},{128,new FontSizeInfo(228,78)},{256,new FontSizeInfo(453,156)}}},
- {"Perpetua Titling MT",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,7)},{10,new FontSizeInfo(20,9)},{11,new FontSizeInfo(20,10)},{12,new FontSizeInfo(21,11)},{14,new FontSizeInfo(24,13)},{16,new FontSizeInfo(27,14)},{18,new FontSizeInfo(30,16)},{20,new FontSizeInfo(34,18)},{22,new FontSizeInfo(36,19)},{24,new FontSizeInfo(40,21)},{26,new FontSizeInfo(44,23)},{28,new FontSizeInfo(46,25)},{36,new FontSizeInfo(60,32)},{48,new FontSizeInfo(79,43)},{72,new FontSizeInfo(0,64)},{96,new FontSizeInfo(158,85)},{128,new FontSizeInfo(210,114)},{256,new FontSizeInfo(418,227)}}},
- {"Playbill",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,4)},{10,new FontSizeInfo(20,5)},{11,new FontSizeInfo(20,5)},{12,new FontSizeInfo(21,6)},{14,new FontSizeInfo(24,7)},{16,new FontSizeInfo(26,7)},{18,new FontSizeInfo(29,9)},{20,new FontSizeInfo(33,10)},{22,new FontSizeInfo(35,10)},{24,new FontSizeInfo(39,11)},{26,new FontSizeInfo(42,12)},{28,new FontSizeInfo(45,13)},{36,new FontSizeInfo(58,17)},{48,new FontSizeInfo(77,23)},{72,new FontSizeInfo(0,34)},{96,new FontSizeInfo(153,46)},{128,new FontSizeInfo(203,61)},{256,new FontSizeInfo(405,122)}}},
- {"Poor Richard",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(20,8)},{12,new FontSizeInfo(21,9)},{14,new FontSizeInfo(25,10)},{16,new FontSizeInfo(27,12)},{18,new FontSizeInfo(30,13)},{20,new FontSizeInfo(34,15)},{22,new FontSizeInfo(37,16)},{24,new FontSizeInfo(40,18)},{26,new FontSizeInfo(45,19)},{28,new FontSizeInfo(48,20)},{36,new FontSizeInfo(60,26)},{48,new FontSizeInfo(79,35)},{72,new FontSizeInfo(0,53)},{96,new FontSizeInfo(157,70)},{128,new FontSizeInfo(209,94)},{256,new FontSizeInfo(416,187)}}},
- {"Pristina",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(21,5)},{10,new FontSizeInfo(22,7)},{11,new FontSizeInfo(23,8)},{12,new FontSizeInfo(24,8)},{14,new FontSizeInfo(29,9)},{16,new FontSizeInfo(32,10)},{18,new FontSizeInfo(36,12)},{20,new FontSizeInfo(40,13)},{22,new FontSizeInfo(43,14)},{24,new FontSizeInfo(47,15)},{26,new FontSizeInfo(52,16)},{28,new FontSizeInfo(55,17)},{36,new FontSizeInfo(71,23)},{48,new FontSizeInfo(94,30)},{72,new FontSizeInfo(0,45)},{96,new FontSizeInfo(187,61)},{128,new FontSizeInfo(248,81)},{256,new FontSizeInfo(494,162)}}},
- {"Rage Italic",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(21,6)},{10,new FontSizeInfo(21,7)},{11,new FontSizeInfo(22,8)},{12,new FontSizeInfo(24,8)},{14,new FontSizeInfo(28,10)},{16,new FontSizeInfo(31,11)},{18,new FontSizeInfo(35,12)},{20,new FontSizeInfo(39,14)},{22,new FontSizeInfo(42,15)},{24,new FontSizeInfo(46,17)},{26,new FontSizeInfo(50,18)},{28,new FontSizeInfo(53,19)},{36,new FontSizeInfo(69,25)},{48,new FontSizeInfo(91,33)},{72,new FontSizeInfo(0,50)},{96,new FontSizeInfo(182,66)},{128,new FontSizeInfo(242,89)},{256,new FontSizeInfo(482,177)}}},
- {"Ravie",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(22,10)},{10,new FontSizeInfo(22,12)},{11,new FontSizeInfo(24,14)},{12,new FontSizeInfo(25,15)},{14,new FontSizeInfo(29,18)},{16,new FontSizeInfo(34,20)},{18,new FontSizeInfo(37,23)},{20,new FontSizeInfo(38,26)},{22,new FontSizeInfo(42,28)},{24,new FontSizeInfo(46,30)},{26,new FontSizeInfo(52,33)},{28,new FontSizeInfo(53,35)},{36,new FontSizeInfo(67,46)},{48,new FontSizeInfo(91,61)},{72,new FontSizeInfo(0,91)},{96,new FontSizeInfo(179,122)},{128,new FontSizeInfo(238,162)},{256,new FontSizeInfo(472,324)}}},
- {"MS Reference Sans Serif",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,7)},{10,new FontSizeInfo(20,8)},{11,new FontSizeInfo(20,10)},{12,new FontSizeInfo(21,10)},{14,new FontSizeInfo(26,12)},{16,new FontSizeInfo(27,13)},{18,new FontSizeInfo(30,15)},{20,new FontSizeInfo(36,17)},{22,new FontSizeInfo(36,18)},{24,new FontSizeInfo(42,20)},{26,new FontSizeInfo(46,22)},{28,new FontSizeInfo(48,24)},{36,new FontSizeInfo(62,31)},{48,new FontSizeInfo(81,41)},{72,new FontSizeInfo(0,61)},{96,new FontSizeInfo(159,81)},{128,new FontSizeInfo(211,109)},{256,new FontSizeInfo(418,216)}}},
- {"MS Reference Specialty",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,10)},{8,new FontSizeInfo(20,13)},{10,new FontSizeInfo(20,16)},{11,new FontSizeInfo(20,18)},{12,new FontSizeInfo(21,19)},{14,new FontSizeInfo(24,23)},{16,new FontSizeInfo(27,25)},{18,new FontSizeInfo(32,29)},{20,new FontSizeInfo(34,32)},{22,new FontSizeInfo(36,35)},{24,new FontSizeInfo(42,38)},{26,new FontSizeInfo(44,42)},{28,new FontSizeInfo(48,44)},{36,new FontSizeInfo(59,58)},{48,new FontSizeInfo(81,77)},{72,new FontSizeInfo(0,115)},{96,new FontSizeInfo(159,153)},{128,new FontSizeInfo(213,205)},{256,new FontSizeInfo(423,408)}}},
- {"Rockwell Condensed",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,4)},{10,new FontSizeInfo(20,5)},{11,new FontSizeInfo(20,5)},{12,new FontSizeInfo(21,6)},{14,new FontSizeInfo(24,7)},{16,new FontSizeInfo(27,8)},{18,new FontSizeInfo(31,9)},{20,new FontSizeInfo(34,10)},{22,new FontSizeInfo(37,11)},{24,new FontSizeInfo(41,12)},{26,new FontSizeInfo(44,13)},{28,new FontSizeInfo(47,14)},{36,new FontSizeInfo(60,18)},{48,new FontSizeInfo(80,23)},{72,new FontSizeInfo(0,35)},{96,new FontSizeInfo(159,47)},{128,new FontSizeInfo(212,62)},{256,new FontSizeInfo(422,125)}}},
- {"Rockwell",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(20,8)},{12,new FontSizeInfo(21,9)},{14,new FontSizeInfo(24,10)},{16,new FontSizeInfo(27,11)},{18,new FontSizeInfo(30,13)},{20,new FontSizeInfo(34,15)},{22,new FontSizeInfo(36,16)},{24,new FontSizeInfo(40,17)},{26,new FontSizeInfo(44,19)},{28,new FontSizeInfo(46,20)},{36,new FontSizeInfo(60,26)},{48,new FontSizeInfo(80,35)},{72,new FontSizeInfo(0,52)},{96,new FontSizeInfo(158,69)},{128,new FontSizeInfo(210,93)},{256,new FontSizeInfo(420,185)}}},
- {"Rockwell Extra Bold",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,8)},{10,new FontSizeInfo(20,9)},{11,new FontSizeInfo(20,10)},{12,new FontSizeInfo(21,11)},{14,new FontSizeInfo(24,13)},{16,new FontSizeInfo(27,14)},{18,new FontSizeInfo(30,17)},{20,new FontSizeInfo(34,19)},{22,new FontSizeInfo(37,20)},{24,new FontSizeInfo(40,22)},{26,new FontSizeInfo(44,24)},{28,new FontSizeInfo(46,25)},{36,new FontSizeInfo(60,33)},{48,new FontSizeInfo(80,44)},{72,new FontSizeInfo(0,66)},{96,new FontSizeInfo(158,88)},{128,new FontSizeInfo(211,118)},{256,new FontSizeInfo(420,234)}}},
- {"Script MT Bold",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(20,8)},{12,new FontSizeInfo(21,8)},{14,new FontSizeInfo(25,10)},{16,new FontSizeInfo(27,11)},{18,new FontSizeInfo(31,13)},{20,new FontSizeInfo(35,14)},{22,new FontSizeInfo(37,15)},{24,new FontSizeInfo(41,17)},{26,new FontSizeInfo(45,18)},{28,new FontSizeInfo(47,20)},{36,new FontSizeInfo(61,25)},{48,new FontSizeInfo(81,34)},{72,new FontSizeInfo(0,51)},{96,new FontSizeInfo(161,68)},{128,new FontSizeInfo(215,90)},{256,new FontSizeInfo(428,180)}}},
- {"Showcard Gothic",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,8)},{11,new FontSizeInfo(20,9)},{12,new FontSizeInfo(22,9)},{14,new FontSizeInfo(24,11)},{16,new FontSizeInfo(30,12)},{18,new FontSizeInfo(32,14)},{20,new FontSizeInfo(35,16)},{22,new FontSizeInfo(38,17)},{24,new FontSizeInfo(42,19)},{26,new FontSizeInfo(47,21)},{28,new FontSizeInfo(48,22)},{36,new FontSizeInfo(63,28)},{48,new FontSizeInfo(82,38)},{72,new FontSizeInfo(0,57)},{96,new FontSizeInfo(165,76)},{128,new FontSizeInfo(219,101)},{256,new FontSizeInfo(435,200)}}},
- {"Snap ITC",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,10)},{10,new FontSizeInfo(20,11)},{11,new FontSizeInfo(20,13)},{12,new FontSizeInfo(24,14)},{14,new FontSizeInfo(26,16)},{16,new FontSizeInfo(28,18)},{18,new FontSizeInfo(32,21)},{20,new FontSizeInfo(37,23)},{22,new FontSizeInfo(38,25)},{24,new FontSizeInfo(44,28)},{26,new FontSizeInfo(46,30)},{28,new FontSizeInfo(50,32)},{36,new FontSizeInfo(65,42)},{48,new FontSizeInfo(84,55)},{72,new FontSizeInfo(0,83)},{96,new FontSizeInfo(167,111)},{128,new FontSizeInfo(225,148)},{256,new FontSizeInfo(443,295)}}},
- {"Stencil",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(20,9)},{12,new FontSizeInfo(21,9)},{14,new FontSizeInfo(25,11)},{16,new FontSizeInfo(28,12)},{18,new FontSizeInfo(32,14)},{20,new FontSizeInfo(35,16)},{22,new FontSizeInfo(38,17)},{24,new FontSizeInfo(42,18)},{26,new FontSizeInfo(46,20)},{28,new FontSizeInfo(48,21)},{36,new FontSizeInfo(62,28)},{48,new FontSizeInfo(83,37)},{72,new FontSizeInfo(0,55)},{96,new FontSizeInfo(164,74)},{128,new FontSizeInfo(219,98)},{256,new FontSizeInfo(436,196)}}},
- {"Tw Cen MT",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(20,8)},{12,new FontSizeInfo(21,9)},{14,new FontSizeInfo(25,10)},{16,new FontSizeInfo(27,12)},{18,new FontSizeInfo(31,13)},{20,new FontSizeInfo(34,15)},{22,new FontSizeInfo(37,16)},{24,new FontSizeInfo(40,18)},{26,new FontSizeInfo(44,19)},{28,new FontSizeInfo(47,20)},{36,new FontSizeInfo(60,26)},{48,new FontSizeInfo(80,35)},{72,new FontSizeInfo(0,53)},{96,new FontSizeInfo(159,71)},{128,new FontSizeInfo(212,94)},{256,new FontSizeInfo(421,188)}}},
- {"Tw Cen MT Condensed",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,4)},{10,new FontSizeInfo(20,5)},{11,new FontSizeInfo(20,5)},{12,new FontSizeInfo(21,6)},{14,new FontSizeInfo(25,7)},{16,new FontSizeInfo(27,8)},{18,new FontSizeInfo(31,9)},{20,new FontSizeInfo(34,10)},{22,new FontSizeInfo(37,11)},{24,new FontSizeInfo(41,12)},{26,new FontSizeInfo(45,13)},{28,new FontSizeInfo(48,14)},{36,new FontSizeInfo(61,18)},{48,new FontSizeInfo(80,23)},{72,new FontSizeInfo(0,35)},{96,new FontSizeInfo(160,47)},{128,new FontSizeInfo(214,62)},{256,new FontSizeInfo(424,125)}}},
- {"Tw Cen MT Condensed Extra Bold",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,5)},{10,new FontSizeInfo(20,6)},{11,new FontSizeInfo(20,7)},{12,new FontSizeInfo(22,8)},{14,new FontSizeInfo(25,9)},{16,new FontSizeInfo(27,10)},{18,new FontSizeInfo(31,12)},{20,new FontSizeInfo(35,13)},{22,new FontSizeInfo(38,14)},{24,new FontSizeInfo(42,16)},{26,new FontSizeInfo(45,17)},{28,new FontSizeInfo(48,18)},{36,new FontSizeInfo(62,24)},{48,new FontSizeInfo(81,31)},{72,new FontSizeInfo(0,47)},{96,new FontSizeInfo(165,63)},{128,new FontSizeInfo(218,84)},{256,new FontSizeInfo(414,167)}}},
- {"Tempus Sans ITC",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,7)},{10,new FontSizeInfo(20,9)},{11,new FontSizeInfo(21,10)},{12,new FontSizeInfo(22,11)},{14,new FontSizeInfo(26,13)},{16,new FontSizeInfo(29,14)},{18,new FontSizeInfo(33,16)},{20,new FontSizeInfo(37,18)},{22,new FontSizeInfo(40,19)},{24,new FontSizeInfo(44,21)},{26,new FontSizeInfo(48,23)},{28,new FontSizeInfo(51,25)},{36,new FontSizeInfo(65,32)},{48,new FontSizeInfo(87,43)},{72,new FontSizeInfo(0,64)},{96,new FontSizeInfo(173,85)},{128,new FontSizeInfo(230,114)},{256,new FontSizeInfo(458,226)}}},
- {"Viner Hand ITC",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(23,7)},{10,new FontSizeInfo(24,9)},{11,new FontSizeInfo(25,10)},{12,new FontSizeInfo(27,11)},{14,new FontSizeInfo(32,13)},{16,new FontSizeInfo(35,14)},{18,new FontSizeInfo(40,16)},{20,new FontSizeInfo(45,18)},{22,new FontSizeInfo(48,20)},{24,new FontSizeInfo(53,22)},{26,new FontSizeInfo(58,24)},{28,new FontSizeInfo(61,25)},{36,new FontSizeInfo(79,33)},{48,new FontSizeInfo(104,43)},{72,new FontSizeInfo(0,65)},{96,new FontSizeInfo(208,87)},{128,new FontSizeInfo(277,116)},{256,new FontSizeInfo(552,232)}}},
- {"Vivaldi",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,5)},{10,new FontSizeInfo(20,6)},{11,new FontSizeInfo(20,6)},{12,new FontSizeInfo(22,7)},{14,new FontSizeInfo(25,8)},{16,new FontSizeInfo(28,9)},{18,new FontSizeInfo(32,10)},{20,new FontSizeInfo(36,12)},{22,new FontSizeInfo(38,12)},{24,new FontSizeInfo(42,14)},{26,new FontSizeInfo(46,15)},{28,new FontSizeInfo(49,16)},{36,new FontSizeInfo(63,20)},{48,new FontSizeInfo(83,27)},{72,new FontSizeInfo(0,41)},{96,new FontSizeInfo(168,55)},{128,new FontSizeInfo(225,73)},{256,new FontSizeInfo(448,146)}}},
- {"Vladimir Script",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,5)},{10,new FontSizeInfo(20,6)},{11,new FontSizeInfo(21,7)},{12,new FontSizeInfo(22,7)},{14,new FontSizeInfo(26,9)},{16,new FontSizeInfo(29,10)},{18,new FontSizeInfo(32,11)},{20,new FontSizeInfo(36,13)},{22,new FontSizeInfo(39,13)},{24,new FontSizeInfo(43,15)},{26,new FontSizeInfo(47,16)},{28,new FontSizeInfo(50,17)},{36,new FontSizeInfo(64,22)},{48,new FontSizeInfo(85,30)},{72,new FontSizeInfo(0,44)},{96,new FontSizeInfo(169,59)},{128,new FontSizeInfo(225,79)},{256,new FontSizeInfo(448,158)}}},
- {"Wingdings 2",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,9)},{8,new FontSizeInfo(20,12)},{10,new FontSizeInfo(20,15)},{11,new FontSizeInfo(20,17)},{12,new FontSizeInfo(21,18)},{14,new FontSizeInfo(24,22)},{16,new FontSizeInfo(26,24)},{18,new FontSizeInfo(30,27)},{20,new FontSizeInfo(34,31)},{22,new FontSizeInfo(36,33)},{24,new FontSizeInfo(40,36)},{26,new FontSizeInfo(43,40)},{28,new FontSizeInfo(46,42)},{36,new FontSizeInfo(59,54)},{48,new FontSizeInfo(79,73)},{72,new FontSizeInfo(0,109)},{96,new FontSizeInfo(156,145)},{128,new FontSizeInfo(208,194)},{256,new FontSizeInfo(414,386)}}},
- {"Wingdings 3",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,4)},{8,new FontSizeInfo(20,10)},{10,new FontSizeInfo(20,12)},{11,new FontSizeInfo(20,13)},{12,new FontSizeInfo(21,14)},{14,new FontSizeInfo(25,17)},{16,new FontSizeInfo(27,19)},{18,new FontSizeInfo(30,21)},{20,new FontSizeInfo(34,24)},{22,new FontSizeInfo(35,26)},{24,new FontSizeInfo(40,29)},{26,new FontSizeInfo(43,19)},{28,new FontSizeInfo(46,33)},{36,new FontSizeInfo(59,27)},{48,new FontSizeInfo(79,35)},{72,new FontSizeInfo(0,53)},{96,new FontSizeInfo(156,71)},{128,new FontSizeInfo(208,95)},{256,new FontSizeInfo(414,189)}}},
- {"Buxton Sketch",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(21,7)},{11,new FontSizeInfo(22,9)},{12,new FontSizeInfo(23,9)},{14,new FontSizeInfo(27,11)},{16,new FontSizeInfo(30,12)},{18,new FontSizeInfo(34,14)},{20,new FontSizeInfo(38,16)},{22,new FontSizeInfo(41,17)},{24,new FontSizeInfo(45,18)},{26,new FontSizeInfo(49,20)},{28,new FontSizeInfo(52,21)},{36,new FontSizeInfo(67,28)},{48,new FontSizeInfo(90,37)},{72,new FontSizeInfo(0,55)},{96,new FontSizeInfo(178,74)},{128,new FontSizeInfo(238,99)},{256,new FontSizeInfo(473,196)}}},
- {"Segoe Marker",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,5)},{10,new FontSizeInfo(20,6)},{11,new FontSizeInfo(20,6)},{12,new FontSizeInfo(21,7)},{14,new FontSizeInfo(24,8)},{16,new FontSizeInfo(27,9)},{18,new FontSizeInfo(31,10)},{20,new FontSizeInfo(34,12)},{22,new FontSizeInfo(37,12)},{24,new FontSizeInfo(41,14)},{26,new FontSizeInfo(44,15)},{28,new FontSizeInfo(47,16)},{36,new FontSizeInfo(60,20)},{48,new FontSizeInfo(80,27)},{72,new FontSizeInfo(0,41)},{96,new FontSizeInfo(159,55)},{128,new FontSizeInfo(212,73)},{256,new FontSizeInfo(422,146)}}},
- {"SketchFlow Print",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,8)},{10,new FontSizeInfo(20,10)},{11,new FontSizeInfo(20,11)},{12,new FontSizeInfo(21,12)},{14,new FontSizeInfo(25,14)},{16,new FontSizeInfo(28,15)},{18,new FontSizeInfo(31,17)},{20,new FontSizeInfo(35,20)},{22,new FontSizeInfo(38,21)},{24,new FontSizeInfo(41,23)},{26,new FontSizeInfo(45,25)},{28,new FontSizeInfo(48,27)},{36,new FontSizeInfo(61,35)},{48,new FontSizeInfo(81,47)},{72,new FontSizeInfo(0,70)},{96,new FontSizeInfo(161,93)},{128,new FontSizeInfo(215,124)},{256,new FontSizeInfo(427,248)}}},
- {"Microsoft MHei",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(22,8)},{12,new FontSizeInfo(23,9)},{14,new FontSizeInfo(29,10)},{16,new FontSizeInfo(31,12)},{18,new FontSizeInfo(35,13)},{20,new FontSizeInfo(39,15)},{22,new FontSizeInfo(41,16)},{24,new FontSizeInfo(47,18)},{26,new FontSizeInfo(51,19)},{28,new FontSizeInfo(53,20)},{36,new FontSizeInfo(69,26)},{48,new FontSizeInfo(91,35)},{72,new FontSizeInfo(0,53)},{96,new FontSizeInfo(181,70)},{128,new FontSizeInfo(243,94)},{256,new FontSizeInfo(482,187)}}},
- {"Microsoft NeoGothic",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(22,8)},{12,new FontSizeInfo(23,9)},{14,new FontSizeInfo(29,11)},{16,new FontSizeInfo(31,12)},{18,new FontSizeInfo(35,13)},{20,new FontSizeInfo(39,15)},{22,new FontSizeInfo(41,16)},{24,new FontSizeInfo(47,18)},{26,new FontSizeInfo(51,20)},{28,new FontSizeInfo(53,21)},{36,new FontSizeInfo(69,27)},{48,new FontSizeInfo(91,36)},{72,new FontSizeInfo(0,54)},{96,new FontSizeInfo(181,72)},{128,new FontSizeInfo(243,96)},{256,new FontSizeInfo(482,191)}}},
- {"Segoe WP Black",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,7)},{10,new FontSizeInfo(20,8)},{11,new FontSizeInfo(22,9)},{12,new FontSizeInfo(23,10)},{14,new FontSizeInfo(29,12)},{16,new FontSizeInfo(31,13)},{18,new FontSizeInfo(35,15)},{20,new FontSizeInfo(39,17)},{22,new FontSizeInfo(41,18)},{24,new FontSizeInfo(47,20)},{26,new FontSizeInfo(51,22)},{28,new FontSizeInfo(53,23)},{36,new FontSizeInfo(69,30)},{48,new FontSizeInfo(91,40)},{72,new FontSizeInfo(0,60)},{96,new FontSizeInfo(181,79)},{128,new FontSizeInfo(243,106)},{256,new FontSizeInfo(482,212)}}},
- {"Segoe WP",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(22,8)},{12,new FontSizeInfo(23,9)},{14,new FontSizeInfo(27,11)},{16,new FontSizeInfo(34,12)},{18,new FontSizeInfo(35,13)},{20,new FontSizeInfo(41,15)},{22,new FontSizeInfo(44,16)},{24,new FontSizeInfo(50,18)},{26,new FontSizeInfo(51,20)},{28,new FontSizeInfo(54,21)},{36,new FontSizeInfo(70,27)},{48,new FontSizeInfo(92,36)},{72,new FontSizeInfo(0,54)},{96,new FontSizeInfo(180,72)},{128,new FontSizeInfo(241,96)},{256,new FontSizeInfo(482,191)}}},
- {"Segoe WP Semibold",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(22,9)},{12,new FontSizeInfo(23,9)},{14,new FontSizeInfo(27,11)},{16,new FontSizeInfo(34,12)},{18,new FontSizeInfo(35,14)},{20,new FontSizeInfo(41,16)},{22,new FontSizeInfo(44,17)},{24,new FontSizeInfo(50,18)},{26,new FontSizeInfo(51,20)},{28,new FontSizeInfo(54,21)},{36,new FontSizeInfo(70,28)},{48,new FontSizeInfo(92,37)},{72,new FontSizeInfo(0,55)},{96,new FontSizeInfo(180,74)},{128,new FontSizeInfo(241,99)},{256,new FontSizeInfo(482,196)}}},
- {"Segoe WP Light",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(22,8)},{12,new FontSizeInfo(23,8)},{14,new FontSizeInfo(27,10)},{16,new FontSizeInfo(34,11)},{18,new FontSizeInfo(35,13)},{20,new FontSizeInfo(41,14)},{22,new FontSizeInfo(44,15)},{24,new FontSizeInfo(50,17)},{26,new FontSizeInfo(51,19)},{28,new FontSizeInfo(54,20)},{36,new FontSizeInfo(70,25)},{48,new FontSizeInfo(92,34)},{72,new FontSizeInfo(0,51)},{96,new FontSizeInfo(180,68)},{128,new FontSizeInfo(241,91)},{256,new FontSizeInfo(482,181)}}},
- {"Segoe WP SemiLight",new Dictionary<float,FontSizeInfo>(){{6,new FontSizeInfo(20,5)},{8,new FontSizeInfo(20,6)},{10,new FontSizeInfo(20,7)},{11,new FontSizeInfo(22,8)},{12,new FontSizeInfo(23,9)},{14,new FontSizeInfo(27,10)},{16,new FontSizeInfo(34,12)},{18,new FontSizeInfo(35,13)},{20,new FontSizeInfo(41,15)},{22,new FontSizeInfo(44,16)},{24,new FontSizeInfo(50,18)},{26,new FontSizeInfo(51,19)},{28,new FontSizeInfo(54,20)},{36,new FontSizeInfo(70,26)},{48,new FontSizeInfo(92,35)},{72,new FontSizeInfo(0,53)},{96,new FontSizeInfo(180,70)},{128,new FontSizeInfo(241,94)},{256,new FontSizeInfo(482,187)}}}
- };
- }
-}
diff --git a/EPPlus/VBA/ExcelVBAModuleCollection.cs b/EPPlus/VBA/ExcelVBAModuleCollection.cs
deleted file mode 100644
index 67f55ef..0000000
--- a/EPPlus/VBA/ExcelVBAModuleCollection.cs
+++ /dev/null
@@ -1,210 +0,0 @@
-/*******************************************************************************
- * You may amend and distribute as you like, but don't remove this header!
- *
- * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
- * See http://www.codeplex.com/EPPlus for details.
- *
- * Copyright (C) 2011 Jan Källman
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
-
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
- * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
- *
- * All code and executables are provided "as is" with no warranty either express or 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();
- }
- }
-}
diff --git a/EPPlus/VBA/ExcelVBAProject.cs b/EPPlus/VBA/ExcelVBAProject.cs
deleted file mode 100644
index 0cdb472..0000000
--- a/EPPlus/VBA/ExcelVBAProject.cs
+++ /dev/null
@@ -1,1144 +0,0 @@
-/*******************************************************************************
- * You may amend and distribute as you like, but don't remove this header!
- *
- * 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;
- }
- }
-}
diff --git a/EPPlus/VBA/ExcelVBAReference.cs b/EPPlus/VBA/ExcelVBAReference.cs
deleted file mode 100644
index ffe1dd9..0000000
--- a/EPPlus/VBA/ExcelVBAReference.cs
+++ /dev/null
@@ -1,129 +0,0 @@
-/*******************************************************************************
- * You may amend and distribute as you like, but don't remove this header!
- *
- * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
- * See http://www.codeplex.com/EPPlus for details.
- *
- * Copyright (C) 2011 Jan Källman
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
-
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
- * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
- *
- * All code and executables are provided "as is" with no warranty either express or 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; }
- }
-}
diff --git a/EPPlus/VBA/ExcelVBASignature.cs b/EPPlus/VBA/ExcelVBASignature.cs
deleted file mode 100644
index aae288d..0000000
--- a/EPPlus/VBA/ExcelVBASignature.cs
+++ /dev/null
@@ -1,384 +0,0 @@
-/*******************************************************************************
- * You may amend and distribute as you like, but don't remove this header!
- *
- * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
- * See http://www.codeplex.com/EPPlus for details.
- *
- * Copyright (C) 2011 Jan Källman
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
-
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
- * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
- *
- * All code and executables are provided "as is" with no warranty either express or 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; }
- }
-}
diff --git a/EPPlus/VBA/ExcelVbaModule.cs b/EPPlus/VBA/ExcelVbaModule.cs
deleted file mode 100644
index 3097d83..0000000
--- a/EPPlus/VBA/ExcelVbaModule.cs
+++ /dev/null
@@ -1,156 +0,0 @@
-/*******************************************************************************
- * You may amend and distribute as you like, but don't remove this header!
- *
- * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
- * See http://www.codeplex.com/EPPlus for details.
- *
- * Copyright (C) 2011 Jan Källman
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
-
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
- * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
- *
- * All code and executables are provided "as is" with no warranty either express or 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;
- }
- }
-}
diff --git a/EPPlus/VBA/ExcelVbaModuleAttribute.cs b/EPPlus/VBA/ExcelVbaModuleAttribute.cs
deleted file mode 100644
index 4c2570c..0000000
--- a/EPPlus/VBA/ExcelVbaModuleAttribute.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-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;
- }
- }
-}
diff --git a/EPPlus/VBA/ExcelVbaProtection.cs b/EPPlus/VBA/ExcelVbaProtection.cs
deleted file mode 100644
index ddffec7..0000000
--- a/EPPlus/VBA/ExcelVbaProtection.cs
+++ /dev/null
@@ -1,112 +0,0 @@
-/*******************************************************************************
- * You may amend and distribute as you like, but don't remove this header!
- *
- * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
- * See http://www.codeplex.com/EPPlus for details.
- *
- * Copyright (C) 2011 Jan Källman
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
-
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- *
- * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
- * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
- *
- * All code and executables are provided "as is" with no warranty either express or 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)
- //{
-
- //}
- }
-}