diff --git a/src/DrawingRendererTest/DrawingRendererTest.csproj b/src/DrawingRendererTest/DrawingRendererTest.csproj
deleted file mode 100644
index 0c0a0f3c18..0000000000
--- a/src/DrawingRendererTest/DrawingRendererTest.csproj
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-
- net8.0
- latest
- enable
- enable
- True
- EPPlus.Export.ImageRenderer.Tests.snk
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/DrawingRendererTest/Test1.cs b/src/DrawingRendererTest/Test1.cs
deleted file mode 100644
index 031d99e52a..0000000000
--- a/src/DrawingRendererTest/Test1.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-namespace DrawingRendererTest
-{
- [TestClass]
- public sealed class Test1
- {
- [TestMethod]
- public void TestMethod1()
- {
- }
- }
-}
diff --git a/src/EPPlus.Export.ImageRenderer.Test/Chart/BarChartTests.cs b/src/EPPlus.DrawingRenderer.Tests/Chart/BarChartTests.cs
similarity index 100%
rename from src/EPPlus.Export.ImageRenderer.Test/Chart/BarChartTests.cs
rename to src/EPPlus.DrawingRenderer.Tests/Chart/BarChartTests.cs
diff --git a/src/EPPlus.Export.ImageRenderer.Test/Chart/ColumnChartTests.cs b/src/EPPlus.DrawingRenderer.Tests/Chart/ColumnChartTests.cs
similarity index 100%
rename from src/EPPlus.Export.ImageRenderer.Test/Chart/ColumnChartTests.cs
rename to src/EPPlus.DrawingRenderer.Tests/Chart/ColumnChartTests.cs
diff --git a/src/EPPlus.Export.ImageRenderer.Test/Chart/ComboChartTests.cs b/src/EPPlus.DrawingRenderer.Tests/Chart/ComboChartTests.cs
similarity index 100%
rename from src/EPPlus.Export.ImageRenderer.Test/Chart/ComboChartTests.cs
rename to src/EPPlus.DrawingRenderer.Tests/Chart/ComboChartTests.cs
diff --git a/src/EPPlus.Export.ImageRenderer.Test/Chart/LineChartToSvgTests.cs b/src/EPPlus.DrawingRenderer.Tests/Chart/LineChartToSvgTests.cs
similarity index 96%
rename from src/EPPlus.Export.ImageRenderer.Test/Chart/LineChartToSvgTests.cs
rename to src/EPPlus.DrawingRenderer.Tests/Chart/LineChartToSvgTests.cs
index 88da23291c..52eab80bd2 100644
--- a/src/EPPlus.Export.ImageRenderer.Test/Chart/LineChartToSvgTests.cs
+++ b/src/EPPlus.DrawingRenderer.Tests/Chart/LineChartToSvgTests.cs
@@ -78,16 +78,16 @@ public void GenerateSvgForComboCharts_sheet4()
using (var p = OpenTemplatePackage("ChartForSvg.xlsx"))
{
var ws = p.Workbook.Worksheets[3];
- //var ix = 1;
- //var c = ws.Drawings[ix];
- //var svg = renderer.RenderDrawingToSvg(c);
- //SaveTextFileToWorkbook($"svg\\ChartForSvg_sheet2_{ix++}.svg", svg);
var ix = 1;
- foreach (ExcelChart c in ws.Drawings)
- {
- var svg = c.ToSvg();
- SaveTextFileToWorkbook($"svg\\ChartForSvg_Combo_Sheet4{ix++}.svg", svg);
- }
+ var c = ws.Drawings[ix];
+ var svg = c.ToSvg();
+ SaveTextFileToWorkbook($"svg\\ChartForSvg_sheet2_{ix++}.svg", svg);
+ //var ix = 1;
+ //foreach (ExcelChart c in ws.Drawings)
+ //{
+ // var svg = c.ToSvg();
+ // SaveTextFileToWorkbook($"svg\\ChartForSvg_Combo_Sheet4{ix++}.svg", svg);
+ //}
}
}
[TestMethod]
diff --git a/src/EPPlus.Export.ImageRenderer.Test/Chart/PieChartTests.cs b/src/EPPlus.DrawingRenderer.Tests/Chart/PieChartTests.cs
similarity index 100%
rename from src/EPPlus.Export.ImageRenderer.Test/Chart/PieChartTests.cs
rename to src/EPPlus.DrawingRenderer.Tests/Chart/PieChartTests.cs
diff --git a/src/EPPlus.Export.ImageRenderer.Test/Chart/TrendlineTests.cs b/src/EPPlus.DrawingRenderer.Tests/Chart/TrendlineTests.cs
similarity index 100%
rename from src/EPPlus.Export.ImageRenderer.Test/Chart/TrendlineTests.cs
rename to src/EPPlus.DrawingRenderer.Tests/Chart/TrendlineTests.cs
diff --git a/src/EPPlus.Export.ImageRenderer.Test/DrawingShapeRenderer/SvgStandAloneTests.cs b/src/EPPlus.DrawingRenderer.Tests/DrawingShapeRenderer/SvgStandAloneTests.cs
similarity index 52%
rename from src/EPPlus.Export.ImageRenderer.Test/DrawingShapeRenderer/SvgStandAloneTests.cs
rename to src/EPPlus.DrawingRenderer.Tests/DrawingShapeRenderer/SvgStandAloneTests.cs
index 11bc767dc9..f4dbcfd416 100644
--- a/src/EPPlus.Export.ImageRenderer.Test/DrawingShapeRenderer/SvgStandAloneTests.cs
+++ b/src/EPPlus.DrawingRenderer.Tests/DrawingShapeRenderer/SvgStandAloneTests.cs
@@ -10,6 +10,9 @@
using System.Text;
using System.Threading.Tasks;
using EPPlus.DrawingRenderer.RenderItems.SvgItem;
+using EPPlus.Fonts.OpenType.Integration.RichText;
+using EPPlus.Fonts.OpenType.Integration.DataHolders;
+using System.Drawing;
namespace EPPlus.Export.ImageRenderer.Tests.DrawingShapeRenderer
{
@@ -52,12 +55,12 @@ public void SvgRectTest()
}
[TestMethod]
- public void SvgTextBoxTest()
+ public void SvgTextRun()
{
BoundingBox bounds = new BoundingBox(0, 0, 500, 500);
StringBuilder sb = new StringBuilder();
var svgShapeRenderer = new SvgShapeRenderer(bounds, sb);
-
+
var baseGroup = new GroupRenderItem(bounds);
@@ -67,31 +70,72 @@ public void SvgTextBoxTest()
background.Height = bounds.Height;
background.FillColor = "aliceBlue";
- //var textBody = new RenderTextBody(baseGroup.Bounds, true);
+ baseGroup.AddChildItem(background);
+
+ var rt = new RichTextFormatSimple();
+ rt.Text = "My text";
+ rt.UnderlineType = 1;
+ rt.FontColor = System.Drawing.Color.Black;
+ rt.Family = "Archivo Narrow";
+ rt.SubFamily = OfficeOpenXml.Interfaces.Fonts.FontSubFamily.Regular;
+ rt.Size = 12f;
+
+ //var paragraph = new SvgParagraphRenderItem()
+
+ var textRun = new SvgTextRunRenderItem(baseGroup.Bounds, rt, rt.Text);
+ baseGroup.AddChildItem(textRun);
+
+
+ List items = new List() { baseGroup };
+ svgShapeRenderer.Render(items);
+
+ var svg = sb.ToString();
+
+
+ SaveTextFileToWorkbook("svg\\textRunStandAlone.svg", svg);
+ }
+
+ [TestMethod]
+ public void SvgTextBodyTest()
+ {
+ BoundingBox bounds = new BoundingBox(0, 0, 500, 500);
+ StringBuilder sb = new StringBuilder();
+ var svgShapeRenderer = new SvgShapeRenderer(bounds, sb);
- //textBody.
- //textBody.Text = "Hello";
- //var para = new SvgParagraphRenderItem(textBody, textBody.Bounds);
-
- //var para2 = new DrawingParagraphRenderItem(textBody, textBody.Bounds);
- //textBody.Paragraphs.Add
+ var baseGroup = new GroupRenderItem(bounds);
+ var background = new RectRenderItem(baseGroup.Bounds);
- //para.Runs.Add()
+ background.Width = bounds.Width;
+ background.Height = bounds.Height;
+ background.FillColor = "aliceBlue";
- //baseGroup.AddChildItem(background);
- //baseGroup.AddChildItem(textBody);
+ baseGroup.Bounds.Width = bounds.Width;
+ baseGroup.Bounds.Height = bounds.Height;
+
+ var textBody = new SvgTextBodyRenderItem(baseGroup.Bounds, true);
+ var paragraph = textBody.AddParagraph("Hello");
+
+ paragraph.AddText(" There");
+
+ var rtItem = new RichTextFormatSimple("Second paragraph", "Archivo Narrow", 16f, true);
+ rtItem.FontColor = Color.DarkGreen;
+ var para2 = textBody.AddParagraph(rtItem);
+
+ baseGroup.AddChildItem(textBody);
+ baseGroup.AddChildItem(background);
List items = new List() { baseGroup };
+ textBody.AppendRenderItems(items);
svgShapeRenderer.Render(items);
var svg = sb.ToString();
- SaveTextFileToWorkbook("svg\\textBoxStandAlone.svg", svg);
+ SaveTextFileToWorkbook("svg\\textBodyStandAlone.svg", svg);
}
}
}
diff --git a/src/EPPlus.Export.ImageRenderer.Test/EPPlus.Export.ImageRenderer.Tests.csproj b/src/EPPlus.DrawingRenderer.Tests/EPPlus.DrawingRenderer.Tests.csproj
similarity index 90%
rename from src/EPPlus.Export.ImageRenderer.Test/EPPlus.Export.ImageRenderer.Tests.csproj
rename to src/EPPlus.DrawingRenderer.Tests/EPPlus.DrawingRenderer.Tests.csproj
index 234439b818..613f6b4ecc 100644
--- a/src/EPPlus.Export.ImageRenderer.Test/EPPlus.Export.ImageRenderer.Tests.csproj
+++ b/src/EPPlus.DrawingRenderer.Tests/EPPlus.DrawingRenderer.Tests.csproj
@@ -6,7 +6,7 @@
enable
enable
True
- EPPlus.Export.ImageRenderer.Tests.snk
+ EPPlus.DrawingRenderer.Tests.snk
diff --git a/src/EPPlus.Export.ImageRenderer.Test/EPPlus.Export.ImageRenderer.Tests.snk b/src/EPPlus.DrawingRenderer.Tests/EPPlus.DrawingRenderer.Tests.snk
similarity index 100%
rename from src/EPPlus.Export.ImageRenderer.Test/EPPlus.Export.ImageRenderer.Tests.snk
rename to src/EPPlus.DrawingRenderer.Tests/EPPlus.DrawingRenderer.Tests.snk
diff --git a/src/EPPlus.Export.ImageRenderer.Test/GroupItemNewTest.cs b/src/EPPlus.DrawingRenderer.Tests/GroupItemNewTest.cs
similarity index 100%
rename from src/EPPlus.Export.ImageRenderer.Test/GroupItemNewTest.cs
rename to src/EPPlus.DrawingRenderer.Tests/GroupItemNewTest.cs
diff --git a/src/DrawingRendererTest/MSTestSettings.cs b/src/EPPlus.DrawingRenderer.Tests/MSTestSettings.cs
similarity index 100%
rename from src/DrawingRendererTest/MSTestSettings.cs
rename to src/EPPlus.DrawingRenderer.Tests/MSTestSettings.cs
diff --git a/src/EPPlus.Export.ImageRenderer.Test/PresetShapeDefinitionTests.cs b/src/EPPlus.DrawingRenderer.Tests/PresetShapeDefinitionTests.cs
similarity index 100%
rename from src/EPPlus.Export.ImageRenderer.Test/PresetShapeDefinitionTests.cs
rename to src/EPPlus.DrawingRenderer.Tests/PresetShapeDefinitionTests.cs
diff --git a/src/EPPlus.Export.ImageRenderer.Test/Shape/ShapeToSvgTests.cs b/src/EPPlus.DrawingRenderer.Tests/Shape/ShapeToSvgTests.cs
similarity index 98%
rename from src/EPPlus.Export.ImageRenderer.Test/Shape/ShapeToSvgTests.cs
rename to src/EPPlus.DrawingRenderer.Tests/Shape/ShapeToSvgTests.cs
index 995ba255ba..48c1479b8e 100644
--- a/src/EPPlus.Export.ImageRenderer.Test/Shape/ShapeToSvgTests.cs
+++ b/src/EPPlus.DrawingRenderer.Tests/Shape/ShapeToSvgTests.cs
@@ -637,5 +637,20 @@ public void CreateChartsWithDifferentSize()
SaveAndCleanup(p);
}
}
+
+ [TestMethod]
+ public void SuperAndSubScript()
+ {
+ ExcelPackage.License.SetNonCommercialOrganization("EPPlus Project");
+ using (var p = OpenTemplatePackage("SuperAndSubScript.xlsx"))
+ {
+ var ws = p.Workbook.Worksheets[0];
+
+ var currShape = ws.Drawings[0];
+
+ var svg = currShape.ToSvg();
+ SaveTextFileToWorkbook("svg\\SuperAndSubScript.svg", svg);
+ }
+ }
}
}
diff --git a/src/EPPlus.Export.ImageRenderer.Test/StyleTests.cs b/src/EPPlus.DrawingRenderer.Tests/StyleTests.cs
similarity index 100%
rename from src/EPPlus.Export.ImageRenderer.Test/StyleTests.cs
rename to src/EPPlus.DrawingRenderer.Tests/StyleTests.cs
diff --git a/src/EPPlus.Export.ImageRenderer.Test/TestBase.cs b/src/EPPlus.DrawingRenderer.Tests/TestBase.cs
similarity index 100%
rename from src/EPPlus.Export.ImageRenderer.Test/TestBase.cs
rename to src/EPPlus.DrawingRenderer.Tests/TestBase.cs
diff --git a/src/EPPlus.Export.ImageRenderer.Test/TestFontMeasurer.cs b/src/EPPlus.DrawingRenderer.Tests/TestFontMeasurer.cs
similarity index 100%
rename from src/EPPlus.Export.ImageRenderer.Test/TestFontMeasurer.cs
rename to src/EPPlus.DrawingRenderer.Tests/TestFontMeasurer.cs
diff --git a/src/EPPlus.Export.ImageRenderer.Test/TextRenderTests.cs b/src/EPPlus.DrawingRenderer.Tests/TextRenderTests.cs
similarity index 100%
rename from src/EPPlus.Export.ImageRenderer.Test/TextRenderTests.cs
rename to src/EPPlus.DrawingRenderer.Tests/TextRenderTests.cs
diff --git a/src/EPPlus.Export.ImageRenderer.Test/TextboxTest.cs b/src/EPPlus.DrawingRenderer.Tests/TextboxTest.cs
similarity index 100%
rename from src/EPPlus.Export.ImageRenderer.Test/TextboxTest.cs
rename to src/EPPlus.DrawingRenderer.Tests/TextboxTest.cs
diff --git a/src/EPPlus.DrawingRenderer/RenderItems/SvgItem/SvgParagraphRenderItem.cs b/src/EPPlus.DrawingRenderer/RenderItems/SvgItem/SvgParagraphRenderItem.cs
index cd382a1761..72081685e5 100644
--- a/src/EPPlus.DrawingRenderer/RenderItems/SvgItem/SvgParagraphRenderItem.cs
+++ b/src/EPPlus.DrawingRenderer/RenderItems/SvgItem/SvgParagraphRenderItem.cs
@@ -1,17 +1,38 @@
using EPPlus.Export.ImageRenderer.RenderItems.Shared;
+using EPPlus.Fonts.OpenType.Integration.DataHolders;
using EPPlus.Graphics;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
+
namespace EPPlus.DrawingRenderer.RenderItems.SvgItem
{
public class SvgParagraphRenderItem : ParagraphRenderItem
{
- public SvgParagraphRenderItem(RenderTextBody body, BoundingBox parent) : base(parent)
+ public SvgParagraphRenderItem(RenderTextBody body, BoundingBox parent, string text, bool setDefaultFont = true) : base(parent, body, text, setDefaultFont)
+ {
+ ImportStyles();
+ }
+ public SvgParagraphRenderItem(RenderTextBody textBody, BoundingBox parent, IRichTextFormatSimple rtFormat): base(parent, textBody, rtFormat)
{
+ ImportStyles();
+ }
+ private void ImportStyles()
+ {
+ //Import RichText data to each run
+ foreach (var run in Runs)
+ {
+ var textRun = (SvgTextRunRenderItem)run;
+ var rtOptions = _layoutSystem.InputFragments[run.OriginalRtIdx].RichTextOptions;
+ if (_layoutSystem.InputFragments.Count != 0 && run.OriginalRtIdx != -1 && rtOptions is IRichTextFormatSimple)
+ {
+ textRun.ImportRichTextData((IRichTextFormatSimple)rtOptions);
+ }
+ else
+ {
+ //If not use the default for the whole paragraph (potentially user specified)
+ run.ImportFontData(DefaultParagraphFont);
+ }
+ }
}
public override RenderItemType Type => RenderItemType.Paragraph;
diff --git a/src/EPPlus.DrawingRenderer/RenderItems/SvgItem/SvgTextBodyRenderItem.cs b/src/EPPlus.DrawingRenderer/RenderItems/SvgItem/SvgTextBodyRenderItem.cs
new file mode 100644
index 0000000000..70ef9e714e
--- /dev/null
+++ b/src/EPPlus.DrawingRenderer/RenderItems/SvgItem/SvgTextBodyRenderItem.cs
@@ -0,0 +1,29 @@
+using EPPlus.Export.ImageRenderer.RenderItems.Shared;
+using EPPlus.Fonts.OpenType.Integration.DataHolders;
+using EPPlus.Graphics;
+
+
+namespace EPPlus.DrawingRenderer.RenderItems.SvgItem
+{
+ public class SvgTextBodyRenderItem : RenderTextBody
+ {
+ public SvgTextBodyRenderItem(BoundingBox parent, bool autoSize) : base(parent, autoSize)
+ {
+ }
+
+ public SvgTextBodyRenderItem(BoundingBox parent, double left, double top, double maxWidth, double maxHeight, bool clampedToParent = false, bool autoSize = false) : base(parent, left, top, maxWidth, maxHeight, clampedToParent, autoSize)
+ {
+
+ }
+
+ protected override ParagraphRenderItem CreateParagraph(BoundingBox parent, string textIfEmpty = "")
+ {
+ return new SvgParagraphRenderItem(this, parent, textIfEmpty);
+ }
+
+ protected override ParagraphRenderItem CreateParagraph(BoundingBox parent, IRichTextFormatSimple richText)
+ {
+ return new SvgParagraphRenderItem(this, parent, richText);
+ }
+ }
+}
diff --git a/src/EPPlus.DrawingRenderer/RenderItems/SvgItem/SvgTextRunRenderItem.cs b/src/EPPlus.DrawingRenderer/RenderItems/SvgItem/SvgTextRunRenderItem.cs
index cbd24475fe..e681ac1eef 100644
--- a/src/EPPlus.DrawingRenderer/RenderItems/SvgItem/SvgTextRunRenderItem.cs
+++ b/src/EPPlus.DrawingRenderer/RenderItems/SvgItem/SvgTextRunRenderItem.cs
@@ -9,7 +9,7 @@
namespace EPPlus.DrawingRenderer.RenderItems.SvgItem
{
- internal class SvgTextRunRenderItem : TextRunRenderItem
+ public class SvgTextRunRenderItem : TextRunRenderItem
{
public SvgTextRunRenderItem(BoundingBox parent) : base(parent)
{
diff --git a/src/EPPlus.DrawingRenderer/RenderItems/Textbox/ParagraphRenderItem.cs b/src/EPPlus.DrawingRenderer/RenderItems/Textbox/ParagraphRenderItem.cs
index f2a773515b..2211eeb9ab 100644
--- a/src/EPPlus.DrawingRenderer/RenderItems/Textbox/ParagraphRenderItem.cs
+++ b/src/EPPlus.DrawingRenderer/RenderItems/Textbox/ParagraphRenderItem.cs
@@ -79,19 +79,19 @@ public abstract class ParagraphRenderItem : RenderItem
protected LayoutSystem _layoutSystem;
- protected List _textFragments;
+ protected RichTextCollectionBase _textFragments = new RichTextCollectionBase();
public double ParagraphLineSpacing { get; protected set; }
public TextAlignment HorizontalAlignment { get; protected set; }
public List Runs { get; set; } = new List();
public TextLineCollection Lines { get; protected set; }
public bool DisplayBounds { get; set; } = false;
- public MeasurementFont ParagraphFont;
+
public override RenderItemType Type => RenderItemType.Paragraph;
public bool AutoSize = false;
- public OpenTypeFontInfoBase DefaultParagraphFont;
+ public FontFormatBase DefaultParagraphFont;
protected double ParentMaxWidth;
protected double ParentMaxHeight;
@@ -100,6 +100,8 @@ public abstract class ParagraphRenderItem : RenderItem
protected double? _lsMultiplier = null;
+ protected bool TextIfEmptyIsNull { get; set; }
+
protected bool LinespacingIsExact
{
get
@@ -109,26 +111,36 @@ protected bool LinespacingIsExact
}
protected TextLineSpacing _lsType;
-
protected double? _centerAdjustment;
-
- protected ParagraphRenderItem(BoundingBox parent) : base(parent)
+ protected ParagraphRenderItem(BoundingBox parent, bool setFallbackDefaultFont = true) : base(parent)
{
Bounds.Name = "Paragraph";
+ if (setFallbackDefaultFont)
+ {
+ var defaultFont = new MeasurementFont { FontFamily = "Aptos Narrow", Size = 11, Style = MeasurementFontStyles.Regular };
+ DefaultParagraphFont = new FontFormatBase(defaultFont);
+ FillColor = "black";
+ }
}
- protected ParagraphRenderItem(BoundingBox parent, RenderTextBody textBody, bool setFallbackDefaultFont = true) : base(parent)
+ protected ParagraphRenderItem(BoundingBox parent, RenderTextBody textBody, bool setFallbackDefaultFont = true) : this(parent, setFallbackDefaultFont)
{
- SetParentProps(textBody);
+ InitBasedOnParent(textBody);
Bounds.Name = "Paragraph";
+ }
- if(setFallbackDefaultFont)
- {
- var defaultFont = new MeasurementFont { FontFamily = "Aptos Narrow", Size = 11, Style = MeasurementFontStyles.Regular };
- ParagraphFont = defaultFont;
- DefaultParagraphFont = new OpenTypeFontInfoBase(ParagraphFont);
- }
+ protected ParagraphRenderItem(BoundingBox parent, RenderTextBody textBody, string text, bool setFallbackDefaultFont = true) : this(parent, textBody, setFallbackDefaultFont)
+ {
+ _lsMultiplier = 1d;
+ ImportLinesAndTextRunsBase(text);
+ }
+
+ protected ParagraphRenderItem(BoundingBox parent, RenderTextBody textBody, IRichTextFormatSimple rtFormat) : this(parent, textBody, false)
+ {
+ _lsMultiplier = 1d;
+ DefaultParagraphFont = new FontFormatBase(rtFormat.Family, rtFormat.SubFamily, rtFormat.Size);
+ AddRichText(rtFormat);
}
protected double GetAlignmentHorizontal(TextAlignment txAlignment)
@@ -152,7 +164,7 @@ protected double GetAlignmentHorizontal(TextAlignment txAlignment)
}
- void SetParentProps(RenderTextBody textBody)
+ void InitBasedOnParent(RenderTextBody textBody)
{
ParentTextBody = textBody;
ParentMaxWidth = textBody.MaxWidth;
@@ -162,18 +174,76 @@ void SetParentProps(RenderTextBody textBody)
TextLineCollection WrapFragmentsToLines(List? fragments = null)
{
- if (fragments == null && _layoutSystem == null)
+ //This is highly innefficent. Really, LayoutSystem should be
+ //Holding the fragments from the start/wrapping should only be done when textFragments are fully complete
+ _layoutSystem = new LayoutSystem(_textFragments);
+
+ //if (fragments == null && _layoutSystem == null)
+ //{
+ // _layoutSystem = new LayoutSystem(_textFragments);
+ //}
+
+ double maxWidthInPoints;
+ if(AutoSize)
{
- fragments = _textFragments;
- _layoutSystem = new LayoutSystem(fragments);
+ maxWidthInPoints = Math.Round(ParentMaxWidth - RightMargin - LeftMargin, 0, MidpointRounding.AwayFromZero);
}
- var maxWidthPoints = Math.Round(ParentMaxWidth, 0, MidpointRounding.AwayFromZero);
- return _layoutSystem.Wrap(maxWidthPoints);
+ else
+ {
+ maxWidthInPoints = Bounds.Width;
+ }
+ return _layoutSystem.Wrap(maxWidthInPoints);
}
- protected void AddTextLinesAndSpacing(string textIfEmpty)
+ private void AddRichTextBase(IRichTextFormatSimple rt)
+ {
+ if (_textFragments == null)
+ {
+ _textFragments = new RichTextCollectionBase();
+ }
+
+ if (string.IsNullOrEmpty(rt.Text) == false)
+ {
+ _textFragments.Add(rt);
+ }
+ }
+
+ protected void AddDefaultTextFragment(string text)
+ {
+ var defaults = new RichTextFormatSimple();
+ defaults.Text = text;
+ defaults.SetFont(DefaultParagraphFont);
+
+ AddRichTextBase(defaults);
+ }
+
+ protected void ImportLinesAndTextRunsBase(string textIfEmpty)
+ {
+ if(string.IsNullOrEmpty(textIfEmpty))
+ {
+ TextIfEmptyIsNull = true;
+ }
+ else
+ {
+ TextIfEmptyIsNull = false;
+ }
+
+ AddDefaultTextFragment(textIfEmpty);
+
+ Bounds.Left = GetAlignmentHorizontal(HorizontalAlignment);
+ if (HorizontalAlignment == TextAlignment.Center)
+ {
+ _centerAdjustment = GetAlignmentHorizontal(HorizontalAlignment);
+ }
+
+ WrapTextFragmentsAndGenerateTextRuns();
+
+ }
+
+ protected void WrapTextFragmentsAndGenerateTextRuns()
{
Lines = WrapFragmentsToLines();
+ Runs.Clear();
//In points
double widthOfLargestLine = 0;
@@ -192,7 +262,7 @@ protected void AddTextLinesAndSpacing(string textIfEmpty)
widthOfLargestLine = Lines.LargestWidthWithoutSpace;
combinedHeight = Lines.GetHeightOfCollection(_lsMultiplier, lineSpacingResult);
- SetHorizontalAlignment(widthOfLargestLine, string.IsNullOrEmpty(textIfEmpty));
+ SetHorizontalAlignment(widthOfLargestLine);
int lineIdx = 0;
foreach (var line in Lines)
@@ -246,9 +316,9 @@ protected double CalculatePrevWidthBasedOnAlignment(double lineDist)
return prevWidth;
}
- protected void SetHorizontalAlignment(double widthOfLargestLine, bool textIfEmptyIsNull)
+ protected void SetHorizontalAlignment(double widthOfLargestLine)
{
- if (HorizontalAlignment == TextAlignment.Center && AutoSize && _centerAdjustment != null && textIfEmptyIsNull)
+ if (HorizontalAlignment == TextAlignment.Center && AutoSize && _centerAdjustment != null && TextIfEmptyIsNull)
{
//Bounds of the paragraph should be bounds of the text itself.
//Therefore we must know the starting point to set accurate left and offset from left.
@@ -262,6 +332,17 @@ protected void SetHorizontalAlignment(double widthOfLargestLine, bool textIfEmpt
}
}
+ public void AddRichText(IRichTextFormatSimple richText)
+ {
+ AddRichTextBase(richText);
+ WrapTextFragmentsAndGenerateTextRuns();
+ }
+
+ public void AddText(string text)
+ {
+ ImportLinesAndTextRunsBase(text);
+ }
+
protected abstract TextRunRenderItem CreateTextRun(BoundingBox parent, string displayText, int origRtIdx);
}
}
diff --git a/src/EPPlus.DrawingRenderer/RenderItems/Textbox/RenderTextBody.cs b/src/EPPlus.DrawingRenderer/RenderItems/Textbox/RenderTextBody.cs
index f91437e3d1..204b101fbe 100644
--- a/src/EPPlus.DrawingRenderer/RenderItems/Textbox/RenderTextBody.cs
+++ b/src/EPPlus.DrawingRenderer/RenderItems/Textbox/RenderTextBody.cs
@@ -1,4 +1,5 @@
using EPPlus.Export.ImageRenderer.RenderItems.Shared;
+using EPPlus.Fonts.OpenType.Integration.DataHolders;
using EPPlus.Graphics;
namespace EPPlus.DrawingRenderer.RenderItems
@@ -110,12 +111,24 @@ public void AppendRenderItems(List renderItems)
}
}
- public void AddParagraph(double startingY, string text = null)
+ public ParagraphRenderItem AddParagraph(IRichTextFormatSimple rtFormat)
+ {
+ var paragraph = CreateParagraph(Bounds, rtFormat);
+ AdjustAndAddParagraph(paragraph);
+ return paragraph;
+ }
+
+ public ParagraphRenderItem AddParagraph(string text = null)
{
var paragraph = CreateParagraph(Bounds, text);
+ AdjustAndAddParagraph(paragraph);
+ return paragraph;
+ }
+
+ private void AdjustAndAddParagraph(ParagraphRenderItem paragraph)
+ {
paragraph.Bounds.Name = $"Container{Paragraphs.Count}";
- paragraph.Bounds.Top = startingY;
- Text = text;
+ paragraph.Bounds.Top = GetTopToAddNextParagraphAt();
if (AutoSize)
{
@@ -136,6 +149,46 @@ public void AddParagraph(double startingY, string text = null)
Paragraphs.Add(paragraph);
}
+ private double GetTopToAddNextParagraphAt()
+ {
+ double paragraphTop = 0;
+
+ if (Paragraphs.Count != 0)
+ {
+ paragraphTop = Paragraphs.Last().Bounds.Bottom;
+ }
+ return paragraphTop;
+ }
+
+
+ ///
+ /// Get the start of text space vertically
+ ///
+ ///
+ protected double GetAlignmentVertical()
+ {
+ double alignmentY = 0;
+
+ switch (VerticalAlignment)
+ {
+ case TextAnchoringType.Top:
+ alignmentY = Bounds.Top;
+ break;
+ //Center means center of a Shape's ENTIRE bounding box height.
+ //Not center of the Inset GetRectangle
+ case TextAnchoringType.Center:
+ alignmentY = (MaxHeight - Bounds.Height) / 2 + Bounds.Top;
+ break;
+ case TextAnchoringType.Bottom:
+ alignmentY = MaxHeight - Bounds.Height;
+ break;
+ }
+
+ return alignmentY;
+ }
+
protected abstract ParagraphRenderItem CreateParagraph(BoundingBox parent, string textIfEmpty = "");
+
+ protected abstract ParagraphRenderItem CreateParagraph(BoundingBox parent, IRichTextFormatSimple richText);
}
}
diff --git a/src/EPPlus.DrawingRenderer/RenderItems/Textbox/RichTextFormatDrawing/IRichTextFormatDrawing.cs b/src/EPPlus.DrawingRenderer/RenderItems/Textbox/RichTextFormatDrawing/IRichTextFormatDrawing.cs
new file mode 100644
index 0000000000..548a9ab0ec
--- /dev/null
+++ b/src/EPPlus.DrawingRenderer/RenderItems/Textbox/RichTextFormatDrawing/IRichTextFormatDrawing.cs
@@ -0,0 +1,36 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using EPPlus.Fonts.OpenType.Integration.DataHolders;
+using EPPlus.Export.ImageRenderer.RenderItems.Shared;
+using System.Drawing;
+
+namespace EPPlus.DrawingRenderer.RenderItems.Textbox
+{
+ ///
+ /// TODO: Move this to interfaces. Only here in order to not break existing references in PDF
+ /// (This should be moved when IRichTextFormatSimple is moved)
+ ///
+ /// Rich text data for drawings
+ ///
+ public interface IRichTextFormatDrawing : IRichTextFormatSimple
+ {
+ public new eDrawingStrikeType StrikeType { get; set; } /*{ get { return (DrawingStrikeType)StrikeType; } set { StrikeType = (int)value; } }*/
+ public new eDrawingUnderLineType UnderlineType { get; set; }
+ Color? HighLightColor { get; set; }
+ ///
+ /// The spacing between characters within a text run.
+ ///
+ double Spacing { get; set; }
+
+ ///
+ /// +Superscript or -Subscript offset in percent
+ /// (default 30% Super and -25% subscript)
+ ///
+ public double Baseline { get; set; }
+
+ //TODO: Advanced fills/Textoutline
+ //TODO: Effects once implemented in Epplus
+ }
+}
diff --git a/src/EPPlus.DrawingRenderer/RenderItems/Textbox/RichTextFormatDrawing/RichTextFormatDrawing.cs b/src/EPPlus.DrawingRenderer/RenderItems/Textbox/RichTextFormatDrawing/RichTextFormatDrawing.cs
new file mode 100644
index 0000000000..07c5e253e9
--- /dev/null
+++ b/src/EPPlus.DrawingRenderer/RenderItems/Textbox/RichTextFormatDrawing/RichTextFormatDrawing.cs
@@ -0,0 +1,105 @@
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using EPPlus.Export.ImageRenderer.RenderItems.Shared;
+using EPPlus.Fonts.OpenType.Integration.DataHolders;
+
+namespace EPPlus.DrawingRenderer.RenderItems.Textbox
+{
+ ///
+ /// Default richText data class for drawings
+ ///
+ public class RichTextFormatDrawing : RichTextFormatSimple, IRichTextFormatDrawing
+ {
+ public new eDrawingStrikeType StrikeType { get => (eDrawingStrikeType)base.StrikeType; set => base.StrikeType = (int)value; }
+ public new eDrawingUnderLineType UnderlineType { get => (eDrawingUnderLineType)base.UnderlineType; set => base.UnderlineType = (int)value; }
+
+ public Color? HighLightColor { get; set; }
+ public double Spacing { get; set; } = 0d;
+
+ double _baseLine = 0d;
+
+ private bool _subScript = false;
+ private bool _superScript = false;
+
+ ///
+ /// +Superscript or -Subscript offset in percent
+ /// (default 30% Super and -25% subscript)
+ ///
+ public double Baseline
+ {
+ get
+ {
+ return _baseLine;
+ }
+ set
+ {
+ if (value > 0d)
+ {
+ _superScript = true;
+ _subScript = false;
+ }
+ else if (value < 0d)
+ {
+ _superScript = false;
+ _subScript = true;
+ }
+ else
+ {
+ //When offset is 0 it is neither a sub or super script
+ _superScript = false;
+ _subScript = false;
+ }
+
+ _baseLine = value;
+ }
+ }
+ public new bool SubScript
+ {
+ get
+ {
+ return _subScript;
+ }
+ set
+ {
+ if (value == true)
+ {
+ _superScript = false;
+ Baseline = -25d;
+ }
+ _subScript = value;
+ }
+ }
+
+ public new bool SuperScript
+ {
+ get
+ {
+ return _superScript;
+ }
+ set
+ {
+ if (value == true)
+ {
+ _subScript = false;
+ Baseline = 30d;
+ }
+ _superScript = value;
+ }
+ }
+
+ public RichTextFormatDrawing() : base()
+ {
+ StrikeType = eDrawingStrikeType.No;
+ UnderlineType = eDrawingUnderLineType.None;
+ }
+
+ public RichTextFormatDrawing(string text, string fontFamily, float size, bool bold = false, bool italic = false) : base(text, fontFamily, size, bold, italic)
+ {
+ StrikeType = eDrawingStrikeType.No;
+ UnderlineType = eDrawingUnderLineType.None;
+ }
+ }
+}
diff --git a/src/EPPlus.DrawingRenderer/RenderItems/Textbox/TextRunRenderItem.cs b/src/EPPlus.DrawingRenderer/RenderItems/Textbox/TextRunRenderItem.cs
index 8a9cc4ba86..f9e0793632 100644
--- a/src/EPPlus.DrawingRenderer/RenderItems/Textbox/TextRunRenderItem.cs
+++ b/src/EPPlus.DrawingRenderer/RenderItems/Textbox/TextRunRenderItem.cs
@@ -7,13 +7,14 @@
using OfficeOpenXml.Interfaces.RichText;
using System.Drawing;
using System.Text.RegularExpressions;
+using EPPlusImageRenderer.Utils;
namespace EPPlus.Export.ImageRenderer.RenderItems.Shared
{
///
/// Linestyle
///
- public enum UnderLineType
+ public enum eDrawingUnderLineType
{
///
/// Dashed
@@ -91,7 +92,7 @@ public enum UnderLineType
///
/// BulletType of font strike
///
- public enum StrikeType
+ public enum eDrawingStrikeType
{
///
/// Double-lined font strike
@@ -118,14 +119,14 @@ public abstract class TextRunRenderItem : RenderItem
public IFontFormatBase _measurementFont { get; internal protected set; }
protected bool _isFirstInParagraph;
- public double FontSizeInPixels { get; protected set; }
+ public double FontSizeInPixels { get; protected set; }
public List Lines { get; set; }
protected internal bool _isItalic = false;
protected internal bool _isBold = false;
- protected internal UnderLineType _underLineType = UnderLineType.None;
- protected internal StrikeType _strikeType;
+ protected internal eDrawingUnderLineType _underLineType = eDrawingUnderLineType.None;
+ protected internal eDrawingStrikeType _strikeType;
protected internal Color _underlineColor;
protected internal double _baseline;
@@ -148,6 +149,12 @@ public void ImportFontData(IFontFormatBase font)
InitializeBase(font);
}
+ public void ImportRichTextData(IRichTextFormatSimple rt)
+ {
+ InitializeBase(rt);
+ FillColor = "#" + rt.FontColor.To6CharHexStringImage();
+ }
+
internal protected void InitializeBase(IFontFormatBase font)
{
//Should be ascent-only?
diff --git a/src/EPPlus.DrawingRenderer/Svg/SvgBaseRenderer.cs b/src/EPPlus.DrawingRenderer/Svg/SvgBaseRenderer.cs
index c27b9f1876..3bf5da9712 100644
--- a/src/EPPlus.DrawingRenderer/Svg/SvgBaseRenderer.cs
+++ b/src/EPPlus.DrawingRenderer/Svg/SvgBaseRenderer.cs
@@ -10,9 +10,14 @@ protected SvgBaseRenderer(StringBuilder outputStream) : base(outputStream)
{
}
- protected void RenderBase(T item)
+
+ ///
+ /// Used if you wish to render base to a different string builder first
+ ///
+ ///
+ ///
+ protected void RenderBaseToSpecified(T item, StringBuilder sb)
{
- var sb = OutputStream;
if (item.Bounds.Name != null)
{
sb.Append($" id=\"{item.Bounds.Name}\" ");
@@ -69,6 +74,12 @@ protected void RenderBase(T item)
sb.Append($"stroke-miterlimit =\"{item.StrokeMiterLimit}\" ");
}
}
+
+ protected void RenderBase(T item)
+ {
+ var sb = OutputStream;
+ RenderBaseToSpecified(item, sb);
+ }
protected void RenderCompoundItems(T li, double? borderWidth, string color, string filter)
{
var tmpBorderWidth = li.BorderWidth;
diff --git a/src/EPPlus.DrawingRenderer/Svg/SvgParagraphRenderer.cs b/src/EPPlus.DrawingRenderer/Svg/SvgParagraphRenderer.cs
index 1f79dbe911..f4944d5223 100644
--- a/src/EPPlus.DrawingRenderer/Svg/SvgParagraphRenderer.cs
+++ b/src/EPPlus.DrawingRenderer/Svg/SvgParagraphRenderer.cs
@@ -19,7 +19,7 @@ public SvgParagraphRenderer(IBasicIShapesRenderer shapeRenderer,
public override void Render(ParagraphRenderItem item)
{
var sb = OutputStream;
- var fontSize = item.ParagraphFont.Size.PointToPixel().ToString(CultureInfo.InvariantCulture);
+ var fontSize = item.DefaultParagraphFont.Size.PointToPixel().ToString(CultureInfo.InvariantCulture);
sb.AppendLine($"");
@@ -100,7 +100,7 @@ public override void Render(ParagraphRenderItem item)
RenderBase(item);
sb.Append(/*$"{GetHorizontalAlignmentAttribute(Bounds.X)} y=\"{Bounds.Y}\" " +*/
- $"font-family=\"{item.ParagraphFont.FontFamily},{item.ParagraphFont.FontFamily}_MSFontService,sans-serif\" " +
+ $"font-family=\"{item.DefaultParagraphFont.Family},{item.DefaultParagraphFont.Family}_MSFontService,sans-serif\" " +
$"font-size=\"{fontSize.ToString(CultureInfo.InvariantCulture)}px\" >");
if (item.Runs != null && item.Runs.Count > 0)
diff --git a/src/EPPlus.DrawingRenderer/Svg/SvgTextRunRenderer.cs b/src/EPPlus.DrawingRenderer/Svg/SvgTextRunRenderer.cs
index 02f810a740..9078ceddc2 100644
--- a/src/EPPlus.DrawingRenderer/Svg/SvgTextRunRenderer.cs
+++ b/src/EPPlus.DrawingRenderer/Svg/SvgTextRunRenderer.cs
@@ -4,6 +4,7 @@
using EPPlus.Fonts.OpenType.Utils;
using EPPlusImageRenderer.RenderItems;
using OfficeOpenXml.Interfaces.Drawing.Text;
+using OfficeOpenXml.Utils;
using System.Globalization;
using System.Text;
@@ -11,6 +12,8 @@ namespace EPPlus.DrawingRenderer.Svg
{
internal class SvgTextRunRenderer : SvgBaseRenderer
{
+ string UnderlineColorString = string.Empty;
+
public SvgTextRunRenderer(StringBuilder outputStream) : base(outputStream)
{
@@ -27,16 +30,18 @@ string GetFontStyleAttributes(TextRunRenderItem textRun)
{
fontStyleAttributes += "font-weight=\"bold\" ";
}
- if (textRun._underLineType != UnderLineType.None | textRun._strikeType != StrikeType.No)
- {
- fontStyleAttributes += "text-decoration=\" ";
- if (textRun._underLineType != UnderLineType.None)
+ string content = "";
+
+ if (textRun._underLineType != eDrawingUnderLineType.None | textRun._strikeType != eDrawingStrikeType.No)
+ {
+ string underlineContent = "";
+ if (textRun._underLineType != eDrawingUnderLineType.None)
{
switch (textRun._underLineType)
{
- case UnderLineType.Single:
- fontStyleAttributes += "underline";
+ case eDrawingUnderLineType.Single:
+ underlineContent += "underline";
break;
//These are all css only apparently
//case eUnderLineType.Double:
@@ -52,30 +57,49 @@ string GetFontStyleAttributes(TextRunRenderItem textRun)
// fontStyleAttributes += "wavy";
// break;
default:
- fontStyleAttributes += "underline";
+ underlineContent += "underline";
break;
//throw new NotImplementedException("Not implemented yet");
}
+ if(textRun._underlineColor != System.Drawing.Color.Empty)
+ {
+ UnderlineColorString = $"{{1}}";
+ }
+ content += underlineContent;
+ //Underline color
+ //We can change the underline color using double tspans
+ // SVG with a colored underlinesection.
}
- if (textRun._strikeType == StrikeType.Single)
+ if (textRun._strikeType == eDrawingStrikeType.Single)
{
//Has to check if Both underline and strike
- if (textRun._underLineType != UnderLineType.None)
+ if (textRun._underLineType != eDrawingUnderLineType.None)
{
- fontStyleAttributes += ",";
+ content += ",";
}
- fontStyleAttributes += "line-through";
+ content += "line-through";
}
- fontStyleAttributes += "\" ";
+ if(string.IsNullOrEmpty(content) == false)
+ {
+ if (string.IsNullOrEmpty(UnderlineColorString))
+ {
+ fontStyleAttributes += $" text-decoration=\"{content}\" ";
+ }
+ else
+ {
+ UnderlineColorString = string.Format(UnderlineColorString, $"text-decoration: {content};", "{0}");
+ }
+ }
}
-
return fontStyleAttributes;
}
public override void Render(TextRunRenderItem textRun)
{
+ var sbStartidx = OutputStream.Length -1;
+
string finalString = "";
var xString = $"x =\"{(textRun.Bounds.Left.PointToPixelString())}\" ";
@@ -84,9 +108,12 @@ public override void Render(TextRunRenderItem textRun)
string visibility = "";
double fontSize = textRun.FontSizeInPixels;
+ //var baseLine = -textRun._baseline / 100D;
if (textRun._baseline != 0)
{
- finalString += $" dy=\"{(fontSize.PointToPixel() * -textRun._baseline / 100D).ToString(CultureInfo.InvariantCulture)}px\" "; //For sub/superscript, move the text up/down by baseline% of font size. Negative value moves up, positive moves down.
+ //For sub/superscript, move the text up/down by baseline% of font size. Negative value moves up, positive moves down.
+ finalString += $" dy=\"{(fontSize.PointToPixel() * -textRun._baseline / 100D).ToString(CultureInfo.InvariantCulture)}px\" ";
+ //fontSize *= (1 - Math.Abs(baseLine));
}
finalString += xString;
var yString = $" y=\"{textRun.YPosition.PointToPixelString()}px\" ";
@@ -101,6 +128,7 @@ public override void Render(TextRunRenderItem textRun)
finalString += visibility;
finalString += $"{GetFontStyleAttributes(textRun)}";
+
if (textRun._measurementFont != null)
{
finalString += $"font-family=\"{textRun._measurementFont.Family},"
@@ -108,19 +136,43 @@ public override void Render(TextRunRenderItem textRun)
+ $"font-size=\"{fontSize.ToString(CultureInfo.InvariantCulture)}px\" ";
}
- var sb = OutputStream;
+ if(string.IsNullOrEmpty(textRun.FillColor) == false)
+ {
+ finalString += $" style=\"fill: {textRun.FillColor};\" ";
+ }
+
+ //Avoid rendering fill color as we do so via style
+ var temp = textRun.FillColor;
+ textRun.FillColor = null;
+
+ var sb = new StringBuilder();
sb.Append(finalString);
+
//Get color etc.
- //Renders up until this point
- RenderBase(textRun);
+ //Renders up until this point (must be done to end the attribute addings so that text content can then be added)
+ RenderBaseToSpecified(textRun, sb);
+
+ textRun.FillColor = temp;
+
//Since final string has been written in base.render erase it.
finalString = "";
finalString += ">";
+ //Add actual text content
finalString += textRun._currentText;
finalString += "";
-
sb.Append(finalString);
+
+ var textRunString = sb.ToString();
+
+ //Wrap in another tspan to apply underline color if neccesary
+ if(string.IsNullOrEmpty(UnderlineColorString) == false)
+ {
+ textRunString = string.Format(UnderlineColorString, textRunString);
+ }
+
+ OutputStream.Append(textRunString);
+ UnderlineColorString = string.Empty;
}
}
}
diff --git a/src/EPPlus.DrawingRenderer/Utils/ColorUtils.cs b/src/EPPlus.DrawingRenderer/Utils/ColorUtils.cs
index 9254048e40..ee432122e7 100644
--- a/src/EPPlus.DrawingRenderer/Utils/ColorUtils.cs
+++ b/src/EPPlus.DrawingRenderer/Utils/ColorUtils.cs
@@ -17,6 +17,11 @@ namespace EPPlusImageRenderer.Utils
{
internal static class ColorUtils
{
+ internal static string To6CharHexStringImage(this Color color)
+ {
+ return (color.ToArgb() & 0xFFFFFF).ToString("x6");
+ }
+
internal static Color GetAdjustedColor(PathFillMode fillColorSource, Color fc)
{
switch (fillColorSource)
diff --git a/src/EPPlus.Export.ImageRenderer.Test/MSTestSettings.cs b/src/EPPlus.Export.ImageRenderer.Test/MSTestSettings.cs
deleted file mode 100644
index aaf278c844..0000000000
--- a/src/EPPlus.Export.ImageRenderer.Test/MSTestSettings.cs
+++ /dev/null
@@ -1 +0,0 @@
-[assembly: Parallelize(Scope = ExecutionScope.MethodLevel)]
diff --git a/src/EPPlus.Export.ImageRenderer/AdjustmentPointType.cs b/src/EPPlus.Export.ImageRenderer/AdjustmentPointType.cs
deleted file mode 100644
index 1a30b41bd8..0000000000
--- a/src/EPPlus.Export.ImageRenderer/AdjustmentPointType.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-/*************************************************************************************************
- Required Notice: Copyright (C) EPPlus Software AB.
- This software is licensed under PolyForm Noncommercial License 1.0.0
- and may only be used for noncommercial purposes
- https://polyformproject.org/licenses/noncommercial/1.0.0/
-
- A commercial license to use this software can be purchased at https://epplussoftware.com
- *************************************************************************************************
- Date Author Change
- *************************************************************************************************
- 27/11/2025 EPPlus Software AB EPPlus 9
- *************************************************************************************************/
-namespace EPPlusImageRenderer
-{
- internal enum AdjustmentPointType
- {
- None = 0,
- Linear = 1,
- Radial = 2,
- Angle = 3
- }
-}
\ No newline at end of file
diff --git a/src/EPPlus.Export.ImageRenderer/AdjustmentType.cs b/src/EPPlus.Export.ImageRenderer/AdjustmentType.cs
deleted file mode 100644
index e79291dde6..0000000000
--- a/src/EPPlus.Export.ImageRenderer/AdjustmentType.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-/*************************************************************************************************
- Required Notice: Copyright (C) EPPlus Software AB.
- This software is licensed under PolyForm Noncommercial License 1.0.0
- and may only be used for noncommercial purposes
- https://polyformproject.org/licenses/noncommercial/1.0.0/
-
- A commercial license to use this software can be purchased at https://epplussoftware.com
- *************************************************************************************************
- Date Author Change
- *************************************************************************************************
- 27/11/2025 EPPlus Software AB EPPlus 9
- *************************************************************************************************/
-
-namespace EPPlusImageRenderer
-{
- internal enum AdjustmentType
- {
- AdjustToWidthHeight = 0,
- LockToAdjustMin = 1,
- LockToAdjustMax = 2,
- Adjust = 255,
- }
-}
\ No newline at end of file
diff --git a/src/EPPlus.Export.ImageRenderer/Adjustments/ActionButtonBackPrevious.xml b/src/EPPlus.Export.ImageRenderer/Adjustments/ActionButtonBackPrevious.xml
deleted file mode 100644
index 2338a37312..0000000000
--- a/src/EPPlus.Export.ImageRenderer/Adjustments/ActionButtonBackPrevious.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
diff --git a/src/EPPlus.Export.ImageRenderer/Adjustments/ActionButtonBeginning.xml b/src/EPPlus.Export.ImageRenderer/Adjustments/ActionButtonBeginning.xml
deleted file mode 100644
index 7c0c5e654d..0000000000
--- a/src/EPPlus.Export.ImageRenderer/Adjustments/ActionButtonBeginning.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
diff --git a/src/EPPlus.Export.ImageRenderer/Adjustments/ActionButtonDocument.xml b/src/EPPlus.Export.ImageRenderer/Adjustments/ActionButtonDocument.xml
deleted file mode 100644
index 95c4900fa9..0000000000
--- a/src/EPPlus.Export.ImageRenderer/Adjustments/ActionButtonDocument.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/src/EPPlus.Export.ImageRenderer/Adjustments/ActionButtonHelp.xml b/src/EPPlus.Export.ImageRenderer/Adjustments/ActionButtonHelp.xml
deleted file mode 100644
index 6151d199f4..0000000000
--- a/src/EPPlus.Export.ImageRenderer/Adjustments/ActionButtonHelp.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
-
-
-
diff --git a/src/EPPlus.Export.ImageRenderer/Adjustments/Donut.xml b/src/EPPlus.Export.ImageRenderer/Adjustments/Donut.xml
deleted file mode 100644
index f732c7cc72..0000000000
--- a/src/EPPlus.Export.ImageRenderer/Adjustments/Donut.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/src/EPPlus.Export.ImageRenderer/Adjustments/DownArrow.xml b/src/EPPlus.Export.ImageRenderer/Adjustments/DownArrow.xml
deleted file mode 100644
index 05947b7a8b..0000000000
--- a/src/EPPlus.Export.ImageRenderer/Adjustments/DownArrow.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/src/EPPlus.Export.ImageRenderer/Adjustments/LeftArrow.xml b/src/EPPlus.Export.ImageRenderer/Adjustments/LeftArrow.xml
deleted file mode 100644
index 931ab260a5..0000000000
--- a/src/EPPlus.Export.ImageRenderer/Adjustments/LeftArrow.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/src/EPPlus.Export.ImageRenderer/Adjustments/RightArrow.xml b/src/EPPlus.Export.ImageRenderer/Adjustments/RightArrow.xml
deleted file mode 100644
index c06e41dcf4..0000000000
--- a/src/EPPlus.Export.ImageRenderer/Adjustments/RightArrow.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/src/EPPlus.Export.ImageRenderer/Adjustments/Trapezoid.xml b/src/EPPlus.Export.ImageRenderer/Adjustments/Trapezoid.xml
deleted file mode 100644
index ae43f26b10..0000000000
--- a/src/EPPlus.Export.ImageRenderer/Adjustments/Trapezoid.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/src/EPPlus.Export.ImageRenderer/Adjustments/Triangle.xml b/src/EPPlus.Export.ImageRenderer/Adjustments/Triangle.xml
deleted file mode 100644
index 3f4eb045ae..0000000000
--- a/src/EPPlus.Export.ImageRenderer/Adjustments/Triangle.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/src/EPPlus.Export.ImageRenderer/Adjustments/UpArrow.xml b/src/EPPlus.Export.ImageRenderer/Adjustments/UpArrow.xml
deleted file mode 100644
index cc7053524a..0000000000
--- a/src/EPPlus.Export.ImageRenderer/Adjustments/UpArrow.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/src/EPPlus.Export.ImageRenderer/Constants/PatternArrays.cs b/src/EPPlus.Export.ImageRenderer/Constants/PatternArrays.cs
deleted file mode 100644
index 673c9a0959..0000000000
--- a/src/EPPlus.Export.ImageRenderer/Constants/PatternArrays.cs
+++ /dev/null
@@ -1,403 +0,0 @@
-/*************************************************************************************************
- Required Notice: Copyright (C) EPPlus Software AB.
- This software is licensed under PolyForm Noncommercial License 1.0.0
- and may only be used for noncommercial purposes
- https://polyformproject.org/licenses/noncommercial/1.0.0/
-
- A commercial license to use this software can be purchased at https://epplussoftware.com
- *************************************************************************************************
- Date Author Change
- *************************************************************************************************
- 27/11/2025 EPPlus Software AB EPPlus 9
- *************************************************************************************************/
-
-namespace EPPlusImageRenderer.Constants
-{
- internal static class PatternArrays
- {
-
- internal static readonly short[][] Pct30 = new short[][]
- {
- new short[] { 0, 0, 0, 1 },
- new short[] { 1, 0, 1, 0 },
- new short[] { 0, 1, 0, 0 },
- new short[] { 1, 0, 1, 0 }
- };
-
- internal static readonly short[][] Pct40 = new short[][]
- {
- new short[] { 0, 0, 0, 1, 0, 1, 0, 1 },
- new short[] { 1, 0, 1, 0, 1, 0, 1, 0 },
- new short[] { 0, 1, 0, 1, 0, 1, 0, 1 },
- new short[] { 1, 0, 1, 0, 1, 0, 1, 0 },
- new short[] { 0, 1, 0, 1, 0, 0, 0, 1 },
- new short[] { 1, 0, 1, 0, 1, 0, 1, 0 },
- new short[] { 0, 1, 0, 1, 0, 1, 0, 1 },
- new short[] { 1, 0, 1, 0, 1, 0, 1, 0 }
- };
-
- internal static readonly short[][] Pct50 = new short[][]
- {
- new short[] { 1, 1, 1, 0 },
- new short[] { 0, 1, 0, 1 },
- new short[] { 1, 0, 1, 1 },
- new short[] { 0, 1, 0, 1 }
- };
-
- internal static readonly short[][] Pct60 = new short[][]
- {
- new short[] { 1, 1, 0, 1 },
- new short[] { 0, 1, 1, 1 }
- };
-
- internal static readonly short[][] Pct70 = new short[][]
- {
- new short[] { 1, 1, 0, 1 },
- new short[] { 1, 1, 1, 1 },
- new short[] { 0, 1, 1, 1 },
- new short[] { 1, 1, 1, 1 }
- };
-
-
- internal static readonly short[][] LtHorz = new short[][] {
- new short[] { 1 },
- new short[] { 0 },
- new short[] { 0 },
- new short[] { 0 }
- };
-
- internal static readonly short[][] LtVert = new short[][] {
- new short[] { 1, 0, 0, 0 }
- };
-
- internal static readonly short[][] LtUpDiag = new short[][] {
- new short[] { 0, 0, 0, 1 },
- new short[] { 0, 0, 1, 0 },
- new short[] { 0, 1, 0, 0 },
- new short[] { 1, 0, 0, 0 }
- };
-
- internal static readonly short[][] LtDnDiag = new short[][] {
- new short[] { 1, 0, 0, 0 },
- new short[] { 0, 1, 0, 0 },
- new short[] { 0, 0, 1, 0 },
- new short[] { 0, 0, 0, 1 }
- };
-
- internal static readonly short[][] DkVert = new short[][] {
- new short[] { 1, 1, 0, 0 }
- };
-
- internal static readonly short[][] DkHorz = new short[][] {
- new short[] { 1 },
- new short[] { 1 },
- new short[] { 0 },
- new short[] { 0 }
- };
-
-
- internal static readonly short[][] DkUpDiag = new short[][] {
- new short[] { 1, 0, 0, 1 },
- new short[] { 0, 0, 1, 1 },
- new short[] { 0, 1, 1, 0 },
- new short[] { 1, 1, 0, 0 }
- };
-
- internal static readonly short[][] DkDnDiag = new short[][] {
- new short[] { 1, 0, 0, 1 },
- new short[] { 1, 1, 0, 0 },
- new short[] { 0, 1, 1, 0 },
- new short[] { 0, 0, 1, 1 }
- };
-
- internal static readonly short[][] WdUpDiag = new short[][] {
- new short[] { 1, 1, 0, 0, 0, 0, 0, 0 },
- new short[] { 1, 0, 0, 0, 0, 0, 0, 1 },
- new short[] { 0, 0, 0, 0, 0, 0, 1, 1 },
- new short[] { 0, 0, 0, 0, 0, 1, 1, 0 },
- new short[] { 0, 0, 0, 0, 1, 1, 0, 0 },
- new short[] { 0, 0, 0, 1, 1, 0, 0, 0 },
- new short[] { 0, 0, 1, 1, 0, 0, 0, 0 },
- new short[] { 0, 1, 1, 0, 0, 0, 0, 0 }
- };
-
- internal static readonly short[][] WdDnDiag = new short[][] {
- new short[] { 1, 0, 0, 0, 0, 0, 0, 1 },
- new short[] { 1, 1, 0, 0, 0, 0, 0, 0 },
- new short[] { 0, 1, 1, 0, 0, 0, 0, 0 },
- new short[] { 0, 0, 1, 1, 0, 0, 0, 0 },
- new short[] { 0, 0, 0, 1, 1, 0, 0, 0 },
- new short[] { 0, 0, 0, 0, 1, 1, 0, 0 },
- new short[] { 0, 0, 0, 0, 0, 1, 1, 0 },
- new short[] { 0, 0, 0, 0, 0, 0, 1, 1 }
- };
-
- internal static readonly short[][] NarVert = new short[][] {
- new short[] { 1, 0 }
- };
-
- internal static readonly short[][] NarHorz = new short[][] {
- new short[] { 1 },
- new short[] { 0 }
- };
-
-
- internal static readonly short[][] Vert = new short[][] {
- new short[] { 1, 0, 0, 0, 0, 0, 0, 0 }
- };
-
- internal static readonly short[][] Horz = new short[][] {
- new short[] { 1 },
- new short[] { 0 },
- new short[] { 0 },
- new short[] { 0 },
- new short[] { 0 },
- new short[] { 0 },
- new short[] { 0 },
- new short[] { 0 }
- };
-
- internal static readonly short[][] DashDnDiag = new short[][] {
- new short[] { 1, 0, 0, 0, 1, 0, 0, 0 },
- new short[] { 0, 1, 0, 0, 0, 1, 0, 0 },
- new short[] { 0, 0, 1, 0, 0, 0, 1, 0 },
- new short[] { 0, 0, 0, 1, 0, 0, 0, 1 },
- new short[] { 0, 0, 0, 0, 0, 0, 0, 0 },
- new short[] { 0, 0, 0, 0, 0, 0, 0, 0 },
- new short[] { 0, 0, 0, 0, 0, 0, 0, 0 },
- new short[] { 0, 0, 0, 0, 0, 0, 0, 0 }
- };
-
- internal static readonly short[][] DashUpDiag = new short[][] {
- new short[] { 0, 1, 0, 0, 0, 1, 0, 0 },
- new short[] { 1, 0, 0, 0, 1, 0, 0, 0 },
- new short[] { 0, 0, 0, 0, 0, 0, 0, 0 },
- new short[] { 0, 0, 0, 0, 0, 0, 0, 0 },
- new short[] { 0, 0, 0, 0, 0, 0, 0, 0 },
- new short[] { 0, 0, 0, 0, 0, 0, 0, 0 },
- new short[] { 0, 0, 0, 1, 0, 0, 0, 1 },
- new short[] { 0, 0, 1, 0, 0, 0, 1, 0 }
- };
-
- internal static readonly short[][] DashHorz = new short[][] {
- new short[] { 0, 0, 0, 0, 1, 1, 1, 1 },
- new short[] { 0, 0, 0, 0, 0, 0, 0, 0 },
- new short[] { 0, 0, 0, 0, 0, 0, 0, 0 },
- new short[] { 0, 0, 0, 0, 0, 0, 0, 0 },
- new short[] { 0, 0, 0, 0, 1, 1, 1, 1 },
- new short[] { 0, 0, 0, 0, 0, 0, 0, 0 },
- new short[] { 0, 0, 0, 0, 0, 0, 0, 0 },
- new short[] { 0, 0, 0, 0, 0, 0, 0, 0 }
- };
-
- internal static readonly short[][] DashVert = new short[][] {
- new short[] { 0, 0, 0, 0, 1, 0, 0, 0 },
- new short[] { 0, 0, 0, 0, 1, 0, 0, 0 },
- new short[] { 0, 0, 0, 0, 1, 0, 0, 0 },
- new short[] { 0, 0, 0, 0, 1, 0, 0, 0 },
- new short[] { 1, 0, 0, 0, 0, 0, 0, 0 },
- new short[] { 1, 0, 0, 0, 0, 0, 0, 0 },
- new short[] { 1, 0, 0, 0, 0, 0, 0, 0 },
- new short[] { 1, 0, 0, 0, 0, 0, 0, 0 }
- };
-
-
- internal static readonly short[][] SmConfetti = new short[][] {
- new short[] { 0, 0, 0, 1, 0, 0, 0, 0 },
- new short[] { 0, 0, 0, 0, 0, 0, 0, 1 },
- new short[] { 0, 0, 1, 0, 0, 0, 0, 0 },
- new short[] { 0, 0, 0, 0, 0, 1, 0, 0 },
- new short[] { 1, 0, 0, 0, 0, 0, 0, 0 },
- new short[] { 0, 0, 0, 0, 1, 0, 0, 0 },
- new short[] { 0, 1, 0, 0, 0, 0, 0, 0 },
- new short[] { 0, 0, 0, 0, 0, 0, 1, 0 }
- };
-
- internal static readonly short[][] LgConfetti = new short[][] {
- new short[] { 0, 0, 0, 0, 0, 0, 1, 1 },
- new short[] { 0, 0, 0, 1, 1, 0, 1, 1 },
- new short[] { 1, 1, 0, 1, 1, 0, 0, 0 },
- new short[] { 1, 1, 0, 0, 0, 0, 0, 0 },
- new short[] { 0, 0, 0, 0, 1, 1, 0, 0 },
- new short[] { 1, 0, 0, 0, 1, 1, 0, 1 },
- new short[] { 1, 0, 1, 1, 0, 0, 0, 1 },
- new short[] { 0, 0, 1, 1, 0, 0, 0, 0 }
- };
-
- internal static readonly short[][] ZigZag = new short[][] {
- new short[] { 1, 0, 0, 0, 0, 0, 0, 1 },
- new short[] { 0, 1, 0, 0, 0, 0, 1, 0 },
- new short[] { 0, 0, 1, 0, 0, 1, 0, 0 },
- new short[] { 0, 0, 0, 1, 1, 0, 0, 0 }
- };
-
- internal static readonly short[][] Wave = new short[][] {
- new short[] { 0, 0, 1, 0, 0, 1, 0, 1 },
- new short[] { 1, 1, 0, 0, 0, 0, 0, 0 },
- new short[] { 0, 0, 0, 0, 0, 0, 0, 0 },
- new short[] { 0, 0, 0, 1, 1, 0, 0, 0 }
- };
-
- internal static readonly short[][] DiagBrick = new short[][] {
- new short[] { 0, 0, 1, 0, 0, 1, 0, 0 },
- new short[] { 0, 1, 0, 0, 0, 0, 1, 0 },
- new short[] { 1, 0, 0, 0, 0, 0, 0, 1 },
- new short[] { 0, 0, 0, 0, 0, 0, 0, 1 },
- new short[] { 0, 0, 0, 0, 0, 0, 1, 0 },
- new short[] { 0, 0, 0, 0, 0, 1, 0, 0 },
- new short[] { 0, 0, 0, 0, 1, 0, 0, 0 },
- new short[] { 0, 0, 0, 1, 1, 0, 0, 0 }
- };
-
- internal static readonly short[][] HorzBrick = new short[][] {
- new short[] { 1, 0, 0, 0, 0, 0, 0, 1 },
- new short[] { 1, 0, 0, 0, 0, 0, 0, 1 },
- new short[] { 1, 0, 0, 0, 0, 0, 0, 1 },
- new short[] { 1, 1, 1, 1, 1, 1, 1, 1 }
- };
-
- internal static readonly short[][] Weave = new short[][] {
- new short[] { 1, 0, 0, 0, 1, 0, 0, 0 },
- new short[] { 0, 1, 0, 1, 0, 1, 0, 0 },
- new short[] { 0, 0, 1, 0, 0, 0, 1, 0 },
- new short[] { 0, 1, 0, 0, 0, 1, 0, 1 },
- new short[] { 1, 0, 0, 0, 1, 0, 0, 0 },
- new short[] { 0, 0, 0, 1, 0, 1, 0, 0 },
- new short[] { 0, 0, 1, 0, 0, 0, 1, 0 },
- new short[] { 0, 1, 0, 1, 0, 0, 0, 1 }
- };
-
- internal static readonly short[][] Plaid = new short[][] {
- new short[] { 1, 0, 1, 0, 1, 0, 1, 0 },
- new short[] { 0, 1, 0, 1, 0, 1, 0, 1 },
- new short[] { 1, 1, 1, 1, 0, 0, 0, 0 },
- new short[] { 1, 1, 1, 1, 0, 0, 0, 0 },
- new short[] { 1, 1, 1, 1, 0, 0, 0, 0 },
- new short[] { 1, 1, 1, 1, 0, 0, 0, 0 },
- new short[] { 1, 0, 1, 0, 1, 0, 1, 0 },
- new short[] { 0, 1, 0, 1, 0, 1, 0, 1 }
- };
-
-
- internal static readonly short[][] Divot = new short[][] {
- new short[] { 0, 0, 0, 0, 0, 0, 0, 1 },
- new short[] { 1, 0, 0, 0, 0, 0, 0, 0 },
- new short[] { 0, 0, 0, 0, 0, 0, 0, 0 },
- new short[] { 0, 0, 0, 1, 0, 0, 0, 0 },
- new short[] { 0, 0, 0, 0, 1, 0, 0, 0 },
- new short[] { 0, 0, 0, 1, 0, 0, 0, 0 },
- new short[] { 0, 0, 0, 0, 0, 0, 0, 0 },
- new short[] { 1, 0, 0, 0, 0, 0, 0, 0 }
- };
-
- internal static readonly short[][] DotGrid = new short[][] {
- new short[] { 1, 0, 1, 0, 1, 0, 1, 0 },
- new short[] { 0, 0, 0, 0, 0, 0, 0, 0 },
- new short[] { 1, 0, 0, 0, 0, 0, 0, 1 },
- new short[] { 0, 0, 0, 0, 0, 0, 0, 0 },
- new short[] { 1, 0, 0, 0, 0, 0, 0, 1 },
- new short[] { 0, 0, 0, 0, 0, 0, 0, 0 },
- new short[] { 1, 0, 0, 0, 0, 0, 0, 1 },
- new short[] { 0, 0, 0, 0, 0, 0, 0, 0 }
- };
-
- internal static readonly short[][] DotDmnd = new short[][] {
- new short[] { 1, 0, 0, 0, 0, 0, 0, 0 },
- new short[] { 0, 0, 0, 0, 0, 0, 0, 0 },
- new short[] { 0, 0, 1, 0, 0, 0, 1, 0 },
- new short[] { 0, 0, 0, 0, 0, 0, 0, 0 },
- new short[] { 0, 0, 0, 0, 1, 0, 0, 0 },
- new short[] { 0, 0, 0, 0, 0, 0, 0, 0 },
- new short[] { 0, 0, 1, 0, 0, 0, 1, 0 },
- new short[] { 0, 0, 0, 0, 0, 0, 0, 0 }
- };
-
- internal static readonly short[][] Shingle = new short[][] {
- new short[] { 0, 0, 1, 1, 0, 0, 0, 0 },
- new short[] { 0, 0, 0, 0, 1, 1, 0, 0 },
- new short[] { 0, 0, 0, 0, 0, 0, 1, 0 },
- new short[] { 0, 0, 0, 0, 0, 0, 0, 1 },
- new short[] { 0, 0, 0, 0, 0, 0, 0, 1 },
- new short[] { 0, 0, 0, 0, 0, 0, 1, 1 },
- new short[] { 1, 0, 0, 0, 0, 1, 0, 0 },
- new short[] { 0, 1, 0, 0, 1, 0, 0, 0 }
- };
-
- internal static readonly short[][] Trellis = new short[][] {
- new short[] { 0, 1, 1, 0 },
- new short[] { 1, 1, 1, 1 },
- new short[] { 1, 0, 0, 1 },
- new short[] { 1, 1, 1, 1 }
- };
-
- internal static readonly short[][] Sphere = new short[][] {
- new short[] { 1, 0, 0, 1, 1, 0, 0, 0 },
- new short[] { 1, 1, 1, 1, 1, 0, 0, 0 },
- new short[] { 1, 1, 1, 1, 1, 0, 0, 0 },
- new short[] { 0, 1, 1, 1, 0, 1, 1, 1 },
- new short[] { 1, 0, 0, 0, 1, 0, 0, 1 },
- new short[] { 1, 0, 0, 0, 1, 1, 1, 1 },
- new short[] { 1, 0, 0, 0, 1, 1, 1, 1 },
- new short[] { 0, 1, 1, 1, 0, 1, 1, 1 }
- };
-
- internal static readonly short[][] SmGrid = new short[][] {
- new short[] { 1, 1, 1, 1 },
- new short[] { 1, 0, 0, 0 },
- new short[] { 1, 0, 0 },
- new short[] { 1, 0, 0, 0 }
- };
-
- internal static readonly short[][] LgGrid = new short[][] {
- new short[] { 1, 1, 1, 1, 1, 1, 1, 1 },
- new short[] { 1, 0, 0, 0, 0, 0, 0, 0 },
- new short[] { 1, 0, 0, 0, 0, 0, 0, 0 },
- new short[] { 1, 0, 0, 0, 0, 0, 0, 0 },
- new short[] { 1, 0, 0, 0, 0, 0, 0, 0 },
- new short[] { 1, 0, 0, 0, 0, 0, 0, 0 },
- new short[] { 1, 0, 0, 0, 0, 0, 0, 0 },
- new short[] { 1, 0, 0, 0, 0, 0, 0, 0 }
- };
-
- internal static readonly short[][] SmCheck = new short[][] {
- new short[] { 1, 0, 0, 1 },
- new short[] { 1, 0, 0, 1 },
- new short[] { 0, 1, 1, 0 },
- new short[] { 0, 1, 1, 0 }
- };
-
- internal static readonly short[][] LgCheck = new short[][] {
- new short[] { 1, 1, 0, 0, 0, 0, 1, 1 },
- new short[] { 1, 1, 0, 0, 0, 0, 1, 1 },
- new short[] { 0, 0, 1, 1, 1, 1, 0, 0 },
- new short[] { 0, 0, 1, 1, 1, 1, 0, 0 },
- new short[] { 0, 0, 1, 1, 1, 1, 0, 0 },
- new short[] { 0, 0, 1, 1, 1, 1, 0, 0 },
- new short[] { 1, 1, 0, 0, 0, 0, 1, 1 },
- new short[] { 1, 1, 0, 0, 0, 0, 1, 1 }
- };
-
- internal static readonly short[][] OpenDmnd = new short[][] {
- new short[] { 0, 1, 0, 0, 0, 1, 0, 0 },
- new short[] { 1, 0, 0, 0, 0, 0, 1, 0 },
- new short[] { 0, 0, 0, 0, 0, 0, 0, 1 },
- new short[] { 1, 0, 0, 0, 0, 0, 1, 0 },
- new short[] { 0, 1, 0, 0, 0, 1, 0, 0 },
- new short[] { 0, 0, 1, 0, 1, 0, 0, 0 },
- new short[] { 0, 0, 0, 1, 0, 0, 0, 0 },
- new short[] { 0, 0, 1, 0, 1, 0, 0, 0 }
- };
-
- internal static readonly short[][] SolidDmnd = new short[][] {
- new short[] { 0, 1, 1, 1, 1, 1, 0, 0 },
- new short[] { 0, 0, 1, 1, 1, 0, 0, 0 },
- new short[] { 0, 0, 0, 1, 0, 0, 0, 0 },
- new short[] { 0, 0, 0, 0, 0, 0, 0, 0 },
- new short[] { 0, 0, 0, 1, 0, 0, 0, 0 },
- new short[] { 0, 0, 1, 1, 1, 0, 0, 0 },
- new short[] { 0, 1, 1, 1, 1, 1, 0, 0 },
- new short[] { 1, 1, 1, 1, 1, 1, 1, 0 }
- };
-
- }
-}
diff --git a/src/EPPlus.Export.ImageRenderer/Coordinate.cs b/src/EPPlus.Export.ImageRenderer/Coordinate.cs
deleted file mode 100644
index 62e366dddf..0000000000
--- a/src/EPPlus.Export.ImageRenderer/Coordinate.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-/*************************************************************************************************
- Required Notice: Copyright (C) EPPlus Software AB.
- This software is licensed under PolyForm Noncommercial License 1.0.0
- and may only be used for noncommercial purposes
- https://polyformproject.org/licenses/noncommercial/1.0.0/
-
- A commercial license to use this software can be purchased at https://epplussoftware.com
- *************************************************************************************************
- Date Author Change
- *************************************************************************************************
- 27/11/2025 EPPlus Software AB EPPlus 9
- *************************************************************************************************/
-
-namespace EPPlusImageRenderer
-{
- internal class Coordinate
- {
- public Coordinate(double x, double y)
- {
- X = x;
- Y = y;
- }
- public double X { get; set; }
- public double Y { get; set; }
- }
-}
\ No newline at end of file
diff --git a/src/EPPlus.Export.ImageRenderer/DrawingBase.cs b/src/EPPlus.Export.ImageRenderer/DrawingBase.cs
deleted file mode 100644
index 9cfdc4ec47..0000000000
--- a/src/EPPlus.Export.ImageRenderer/DrawingBase.cs
+++ /dev/null
@@ -1,62 +0,0 @@
-/*************************************************************************************************
- Required Notice: Copyright (C) EPPlus Software AB.
- This software is licensed under PolyForm Noncommercial License 1.0.0
- and may only be used for noncommercial purposes
- https://polyformproject.org/licenses/noncommercial/1.0.0/
-
- A commercial license to use this software can be purchased at https://epplussoftware.com
- *************************************************************************************************
- Date Author Change
- *************************************************************************************************
- 27/11/2025 EPPlus Software AB EPPlus 9
- *************************************************************************************************/
-
-using EPPlus.Export.ImageRenderer;
-using EPPlus.Export.ImageRenderer.Utils;
-using EPPlus.Fonts.OpenType;
-using EPPlus.Fonts.OpenType.Integration;
-using EPPlus.Graphics;
-using EPPlusImageRenderer.RenderItems;
-using OfficeOpenXml;
-using OfficeOpenXml.Drawing;
-using OfficeOpenXml.Drawing.Theme;
-using OfficeOpenXml.Export.HtmlExport;
-using OfficeOpenXml.Interfaces.Drawing.Text;
-using System.Collections.Generic;
-using System.Text;
-
-namespace EPPlusImageRenderer
-{
- internal abstract class DrawingBase
- {
- internal DrawingBase(ExcelDrawing drawing)
- {
- Drawing = drawing;
- Bounds = drawing.GetBoundingBox();
-
- var wb = drawing._drawings.Worksheet.Workbook;
- Theme = wb.ThemeManager.GetOrCreateTheme();
-
- var shaper = OpenTypeFonts.GetTextShaper(Theme.FontScheme.MajorFont[0].Typeface);
- TextMeasurer = new OpenTypeFontTextMeasurer(shaper);
- }
-
-
- internal DrawingBase()
- {
- //Drawing = drawing;
- //Bounds = drawing.GetBoundingBox();
-
- //var wb = drawing._drawings.Worksheet.Workbook;
- //Theme = wb.ThemeManager.GetOrCreateTheme();
- }
-
- internal readonly StyleCache _styleCache = new StyleCache();
- public ExcelDrawing Drawing { get; }
- public ExcelTheme Theme { get;}
- public ExcelWorkbook Workbook => Drawing._drawings.Worksheet.Workbook;
- internal ITextMeasurer TextMeasurer { get; }
- public List RenderItems { get; } = new List();
- internal BoundingBox Bounds = new BoundingBox();
- }
-}
\ No newline at end of file
diff --git a/src/EPPlus.Export.ImageRenderer/DrawingChart.cs b/src/EPPlus.Export.ImageRenderer/DrawingChart.cs
deleted file mode 100644
index 9908c7db57..0000000000
--- a/src/EPPlus.Export.ImageRenderer/DrawingChart.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-/*************************************************************************************************
- Required Notice: Copyright (C) EPPlus Software AB.
- This software is licensed under PolyForm Noncommercial License 1.0.0
- and may only be used for noncommercial purposes
- https://polyformproject.org/licenses/noncommercial/1.0.0/
-
- A commercial license to use this software can be purchased at https://epplussoftware.com
- *************************************************************************************************
- Date Author Change
- *************************************************************************************************
- 27/11/2025 EPPlus Software AB EPPlus 9
- *************************************************************************************************/
-
-using OfficeOpenXml.Drawing.Chart;
-
-namespace EPPlusImageRenderer
-{
- internal abstract class DrawingChart : DrawingBase
- {
- public DrawingChart(ExcelChart chart) : base(chart)
- {
- }
- public ExcelChart Chart
- {
- get =>(ExcelChart)Drawing;
- }
- }
-}
\ No newline at end of file
diff --git a/src/EPPlus.Export.ImageRenderer/DrawingShape.cs b/src/EPPlus.Export.ImageRenderer/DrawingShape.cs
deleted file mode 100644
index 102b6499cb..0000000000
--- a/src/EPPlus.Export.ImageRenderer/DrawingShape.cs
+++ /dev/null
@@ -1,133 +0,0 @@
-/*************************************************************************************************
- Required Notice: Copyright (C) EPPlus Software AB.
- This software is licensed under PolyForm Noncommercial License 1.0.0
- and may only be used for noncommercial purposes
- https://polyformproject.org/licenses/noncommercial/1.0.0/
-
- A commercial license to use this software can be purchased at https://epplussoftware.com
- *************************************************************************************************
- Date Author Change
- *************************************************************************************************
- 27/11/2025 EPPlus Software AB EPPlus 9
- *************************************************************************************************/
-
-using EPPlus.Export.ImageRenderer.RenderItems.Shared;
-using EPPlus.Export.ImageRenderer.Utils;
-using EPPlusImageRenderer.RenderItems;
-using OfficeOpenXml;
-using OfficeOpenXml.Drawing;
-using OfficeOpenXml.Drawing.Theme;
-using System;
-using System.Collections.Generic;
-
-namespace EPPlusImageRenderer
-{
- internal abstract class DrawingShape : DrawingBase
- {
- protected ExcelShape _shape;
- protected DrawingShape(ExcelShape shape) : base(shape)
- {
- var style = shape.Style;
-
- _shape = shape;
- }
- protected static void AddCmd(SvgRenderPathItem pi, DrawingPath path, List coordinates, ref PathCommands cmd, PathsBase pp, PathsBase p, PathCommandType commandType)
- {
- if (pp == null || pp.Type != p.Type)
- {
- SetCmdCoordinats(cmd, p, coordinates);
- cmd = new PathCommands(commandType, pi);
- pi.Commands.Add(cmd);
- }
- AddToCoordinates(path, coordinates, p);
- }
- protected static void AddArc(SvgRenderPathItem pi, DrawingPath path, List coordinates, PathsBase pCmd, out double startPointX, out double startPointY, PathsBase p)
- {
- //var width = ((double)path.Width.Value / ExcelDrawing.EMU_PER_PIXEL);
- //var height = ((double)path.Height.Value / ExcelDrawing.EMU_PER_PIXEL);
- var arc = (ArcTo)p;
- PathCommands c = null;
- startPointX = pCmd.EndX;
- startPointY = pCmd.EndY;
- if (startPointX != 0) startPointX /= ExcelDrawing.EMU_PER_POINT;
- if (startPointY != 0) startPointY /= ExcelDrawing.EMU_PER_POINT;
- var wR = arc.WidthRadius.Value / ExcelDrawing.EMU_PER_POINT;
- var hR = arc.HeightRadius.Value / ExcelDrawing.EMU_PER_POINT;
- if (wR == 0 && hR == 0)
- {
- return;
- }
- var stA = arc.StartAngle.Value / 60000d;
- var swA = arc.SwingAngle.Value / 60000d;
-
- while (swA != 0)
- {
- var aAdd = swA < 0 ? Math.Max(swA, -180) : Math.Min(swA, 180);
- var endAngle = AngleToRadians(stA + aAdd);
-
- var stA_Adj = stA < 0 ? (stA + 360) % 360 : stA;
- var adjRads = AngleToRadians(stA_Adj);
-
- //Start and End angles are NOT the 't' angle of the equations we use.
- //The angles we are given are DIRECTLY against the ellipse. Or point 'P' in a parametric form
- //Therefore we have to use the angle we have to calculate the angles needed for our formulas.
- var angleT = Math.Atan((wR * Math.Tan(adjRads)) / hR);
- var angleTEnd = Math.Atan((wR * Math.Tan(endAngle)) / hR);
-
- //Atan can only return values on positive x 90° to -90°
- //So we must adjust by adding Pi (180°) if x of the angle is negative
- if (Math.Cos(adjRads) < 0)
- {
- angleT += (Math.Round((double)System.Math.PI, 14));
- }
- if (Math.Cos(endAngle) < 0)
- {
- angleTEnd += (Math.Round((double)System.Math.PI, 14));
- }
-
- var centerX = startPointX - (wR * Math.Cos(angleT));
- var centerY = startPointY - (hR * Math.Sin(angleT));
- var endX = (double)centerX + (wR * Math.Cos(angleTEnd));
- var endY = (double)centerY + (hR * Math.Sin(angleTEnd));
- c = new PathCommands(PathCommandType.Arc, pi, wR, hR , 0, 0, swA < 0 ? 0 : 1, endX, endY);
- pi.Commands.Add(c);
- stA += aAdd;
- swA -= aAdd;
- if (wR != 0)
- {
- startPointX = endX;
- }
- if (hR != 0)
- {
- startPointY = endY;
- }
- ((ArcTo)p).SetEndCoordinates(endX* ExcelDrawing.EMU_PER_POINT, endY* ExcelDrawing.EMU_PER_POINT);
- }
- }
-
- protected static double AngleToRadians(double angle)
- {
- return MConverter.DegreesToRadians(angle);
- }
- protected static void SetCmdCoordinats(PathCommands cmd, PathsBase p, List coordinates)
- {
- if (cmd != null)
- {
- cmd.Coordinates = coordinates.ToArray();
- if (cmd.Coordinates.Length > 0)
- {
- coordinates.Clear();
- }
- }
- }
- private static void AddToCoordinates(DrawingPath path, List coordinates, PathsBase p)
- {
- var mt = (PathWithCoordinates)p;
- foreach (var c in mt.Coordinates)
- {
- coordinates.Add(c.X.Value / ExcelDrawing.EMU_PER_POINT);
- coordinates.Add(c.Y.Value / ExcelDrawing.EMU_PER_POINT);
- }
- }
- }
-}
\ No newline at end of file
diff --git a/src/EPPlus.Export.ImageRenderer/DrawingSize.cs b/src/EPPlus.Export.ImageRenderer/DrawingSize.cs
deleted file mode 100644
index 7d8b1b5797..0000000000
--- a/src/EPPlus.Export.ImageRenderer/DrawingSize.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-/*************************************************************************************************
- Required Notice: Copyright (C) EPPlus Software AB.
- This software is licensed under PolyForm Noncommercial License 1.0.0
- and may only be used for noncommercial purposes
- https://polyformproject.org/licenses/noncommercial/1.0.0/
-
- A commercial license to use this software can be purchased at https://epplussoftware.com
- *************************************************************************************************
- Date Author Change
- *************************************************************************************************
- 27/11/2025 EPPlus Software AB EPPlus 9
- *************************************************************************************************/
-
-namespace EPPlus.Export.ImageRenderer
-{
- internal class DrawingSize
- {
- public DrawingSize(int width, int height)
- {
- Width = width;
- Height = height;
- }
- public int Width { get; private set; }
- public int Height { get; private set; }
- }
-}
diff --git a/src/EPPlus.Export.ImageRenderer/EPPlus.Export.ImageRenderer.csproj b/src/EPPlus.Export.ImageRenderer/EPPlus.Export.ImageRenderer.csproj
deleted file mode 100644
index a0803a19c0..0000000000
--- a/src/EPPlus.Export.ImageRenderer/EPPlus.Export.ImageRenderer.csproj
+++ /dev/null
@@ -1,116 +0,0 @@
-
-
-
- net8.0;net9.0;netstandard2.1;netstandard2.0;net462
- True
- ImageRenderer.snk
-
- latest
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
-
-
diff --git a/src/EPPlus.Export.ImageRenderer/IRender.cs b/src/EPPlus.Export.ImageRenderer/IRender.cs
deleted file mode 100644
index 04a8d51afd..0000000000
--- a/src/EPPlus.Export.ImageRenderer/IRender.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-/*************************************************************************************************
- Required Notice: Copyright (C) EPPlus Software AB.
- This software is licensed under PolyForm Noncommercial License 1.0.0
- and may only be used for noncommercial purposes
- https://polyformproject.org/licenses/noncommercial/1.0.0/
-
- A commercial license to use this software can be purchased at https://epplussoftware.com
- *************************************************************************************************
- Date Author Change
- *************************************************************************************************
- 27/11/2025 EPPlus Software AB EPPlus 9
- *************************************************************************************************/
-using System.Text;
-
-namespace EPPlusImageRenderer
-{
-}
\ No newline at end of file
diff --git a/src/EPPlus.Export.ImageRenderer/ImageRenderer.cs b/src/EPPlus.Export.ImageRenderer/ImageRenderer.cs
deleted file mode 100644
index 3b29db1d42..0000000000
--- a/src/EPPlus.Export.ImageRenderer/ImageRenderer.cs
+++ /dev/null
@@ -1,742 +0,0 @@
-/*************************************************************************************************
- Required Notice: Copyright (C) EPPlus Software AB.
- This software is licensed under PolyForm Noncommercial License 1.0.0
- and may only be used for noncommercial purposes
- https://polyformproject.org/licenses/noncommercial/1.0.0/
-
- A commercial license to use this software can be purchased at https://epplussoftware.com
- *************************************************************************************************
- Date Author Change
- *************************************************************************************************
- 27/11/2025 EPPlus Software AB EPPlus 9
- *************************************************************************************************/
-
-using EPPlus.Export.ImageRenderer.RenderItems;
-using EPPlus.Export.ImageRenderer.RenderItems.Shared;
-using EPPlus.Export.ImageRenderer.RenderItems.SvgItem;
-using EPPlus.Export.ImageRenderer.Svg;
-using EPPlus.Export.ImageRenderer.Svg.DefinitionUtils;
-using EPPlus.Export.ImageRenderer.Svg.DefinitionUtils.UtillNodes;
-using EPPlus.Export.ImageRenderer.Svg.NodeAttributes;
-using EPPlus.Export.ImageRenderer.Svg.Writer;
-using EPPlus.Fonts.OpenType.Utils;
-using EPPlus.Graphics;
-using EPPlus.Graphics.Math;
-using EPPlusImageRenderer.RenderItems;
-using EPPlusImageRenderer.Svg;
-using OfficeOpenXml.Drawing;
-using OfficeOpenXml.Drawing.Chart;
-using OfficeOpenXml.FormulaParsing.Excel.Functions.MathFunctions;
-using OfficeOpenXml.Utils;
-using OfficeOpenXml.Utils.EnumUtils;
-using System;
-using System.Collections.Generic;
-using System.Drawing;
-using System.IO;
-using System.Text;
-
-namespace EPPlusImageRenderer
-{
- public class ImageRenderer
- {
- public string RenderDrawingToSvg(ExcelDrawing drawing)
- {
- var sb = new StringBuilder();
- if (drawing is ExcelShape shape)
- {
- var svg = new SvgShape(shape);
- svg.Render(sb);
- return sb.ToString();
- }
- else if(drawing is ExcelChart chart)
- {
- var svg = new SvgChart(chart);
- svg.Render(sb);
- return sb.ToString();
- }
-
- throw new NotImplementedException("Image rendering for drawing type not implemented.");
- }
-
- public enum RenderItemClasses
- {
- Rect,
- TextBox,
- Shape,
- CircleSegment
- }
-
- public Dictionary GetItemProperties(RenderItemClasses item)
- {
- switch (item)
- {
- case RenderItemClasses.Rect:
- return new Dictionary { { "Top", 10d }, { "Left", 10d }, { "Width", 10d }, { "Height", 10d }, {"Opacity", 0.8 }, {"Fill", Color.Goldenrod } };
- case RenderItemClasses.CircleSegment:
- return new Dictionary { { "angle", 90d }, { "radius", 144d }, { "cx", 144d }, { "cy", 144d } };
- case RenderItemClasses.TextBox:
- default:
- throw new NotImplementedException("This class has not been implemented as an option yet");
-
- }
- }
-
- private string RenderCircleSegment(DrawingBase baseItem, Dictionary itemProperties)
- {
- return RenderCircleSegment((double)itemProperties["angle"], (double)itemProperties["radius"], (double)itemProperties["cx"], (double)itemProperties["cy"]);
- }
-
- string RenderCircleSegment(double degree, double radius, double cx, double cy)
- {
- degree = degree % 360;
-
- if(degree < 0)
- {
- degree = 360 - degree;
- }
-
- //Adjust by -90 so it starts from the top
- var angleRadians = (degree-90d) * (Math.PI / 180.0d);
-
- //radius = radius.PixelToPoint();
- //cx = radius.PixelToPoint();
- //cy = radius.PixelToPoint();
-
- var halfAngle = degree / 2;
-
- var halfAngleRadians = (halfAngle - 90d) * (Math.PI / 180.0d);
-
- var xPoint = cx + (radius * Math.Cos(angleRadians));
- var yPoint = cy + (radius * Math.Sin(angleRadians));
-
- Coordinate endPoint = new Coordinate(xPoint, yPoint);
-
- var xPointHalf = cx + (radius * Math.Cos(halfAngleRadians));
- var yPointHalf = cy + (radius * Math.Sin(halfAngleRadians));
-
- Coordinate halfPoint = new Coordinate(xPointHalf, yPointHalf);
-
- var baseBB = new BoundingBox();
-
- //96x96 px
- baseBB.Width = 72*4;
- baseBB.Height = 72*4;
-
- var baseItem = new DrawingItemForTesting(baseBB);
-
- BoundingBox parent = new BoundingBox();
-
- //Transform rotationPoint = new Transform();
- //rotationPoint.SetLocalPositionWithWorldCoordinates(new Vector2(cx, cy));
- //var item = new SvgGroupItemNew(baseItem, parent, -45d, rotationPoint);
-
- var slice = new SvgRenderPathItem(baseItem, baseItem.Bounds);
-
- //item.AddChildItem(slice);
-
- var startPoint = new Coordinate(cx, cy-radius);
-
- var moveCenter = new PathCommands(PathCommandType.Move, slice, cx / baseItem.Bounds.Width, cy / baseItem.Bounds.Height);
- var lineToStart = new PathCommands(PathCommandType.Line, slice, startPoint.X / baseItem.Bounds.Width, startPoint.Y / baseItem.Bounds.Height);
-
- var lineToMidPoint = new PathCommands(PathCommandType.Line, slice, halfPoint.X / baseItem.Bounds.Width, halfPoint.Y / baseItem.Bounds.Height);
-
-
-
- var w = baseItem.Bounds.Width.PointToPixel();
- var h = baseItem.Bounds.Height.PointToPixel();
-
- var radX = radius.PointToPixel() / w;
- var radY = radius.PointToPixel() / h;
-
- var arcCommand = new PathCommands(PathCommandType.Arc, slice, new double[] { radX, radY, 0, degree > 180 ? 1 : 0, 1, endPoint.X / baseItem.Bounds.Width, endPoint.Y / baseItem.Bounds.Height });
-
- slice.Commands.Add(moveCenter);
- slice.Commands.Add(lineToStart);
- slice.Commands.Add(arcCommand);
- slice.Commands.Add(moveCenter);
- slice.Commands.Add(lineToMidPoint);
-
- slice.FillColor = "red";
- slice.BorderColor = "green";
- slice.BorderWidth = 5;
-
- baseItem.RenderItems.Add(slice);
-
- var sb = new StringBuilder();
-
- baseItem.Render(sb);
-
- return sb.ToString();
-
- //return baseItem;
- }
-
- ///
- /// For Testing the specific renderItem class
- ///
- ///
- ///
- ///
- ///
- public string RenderIndividualClass(RenderItemClasses item, Dictionary itemProperties, double width, double height)
- {
- var svgCanvas = new DrawingItemForTesting(new BoundingBox(width.PixelToPoint(), height.PixelToPoint()));
-
- RenderItem renderItem;
-
- if (item == RenderItemClasses.CircleSegment)
- {
- return GenerateFromCircle(item, svgCanvas, itemProperties);
- }
- else
- {
- renderItem = GenerateFromClasses(item, svgCanvas, itemProperties);
- }
-
- svgCanvas.RenderItems.Add(renderItem);
-
- var sb = new StringBuilder();
-
- svgCanvas.Render(sb);
-
- return sb.ToString();
- }
-
- public enum RenderPresets
- {
- ContainerMargins,
- RotatingContainer,
- PatternFill,
- }
-
- public string RenderTest(RenderPresets preset)
- {
- return GenerateFromPreset(preset);
- }
-
-
- private string rotatingContainer()
- {
- var baseBB = new BoundingBox();
-
- //96x96 px
- baseBB.Width = 72;
- baseBB.Height = 72;
-
- var baseItem = new DrawingItemForTesting(baseBB);
-
- BoundingBox parent = new BoundingBox();
-
- var groupItem = new SvgGroupItemNew(baseItem, parent, 45);
-
- groupItem.TranslationOffset.Left = 10;
- groupItem.TranslationOffset.Top = 10;
-
- SvgRenderRectItem rectItem = new SvgRenderRectItem(baseItem, groupItem.Bounds);
-
- rectItem.FillColor = "red";
- rectItem.FillOpacity = 0.2d;
-
- rectItem.Width = 20;
- rectItem.Height = 20;
-
- groupItem.AddChildItem(rectItem);
-
-
- SvgRenderRectItem siblingItem = new SvgRenderRectItem(baseItem, groupItem.Bounds);
- siblingItem.FillColor = "blue";
- siblingItem.FillOpacity = 0.2d;
-
- siblingItem.Width = 20;
- siblingItem.Height = 20;
-
- siblingItem.Bounds.Left = 20;
- siblingItem.Bounds.Top = 20;
-
- groupItem.AddChildItem(siblingItem);
-
- groupItem.SetRotationPointToCenterOfGroup();
-
- SvgRenderRectItem centerOfGroupMarker = new SvgRenderRectItem(baseItem, baseItem.Bounds);
- centerOfGroupMarker.FillColor = "green";
- centerOfGroupMarker.FillOpacity = 0.8d;
-
- centerOfGroupMarker.Width = 6;
- centerOfGroupMarker.Height = 6;
-
- centerOfGroupMarker.Left = 30 - (centerOfGroupMarker.Width / 2);
- centerOfGroupMarker.Top = 30 - (centerOfGroupMarker.Height / 2);
-
- baseItem.RenderItems.Add(centerOfGroupMarker);
-
- var sb = new StringBuilder();
-
- baseItem.RenderItems.Add(groupItem);
-
- baseItem.Render(sb);
-
- return sb.ToString();
- }
-
- private string containerMargins()
- {
- var baseBB = new BoundingBox();
-
- baseBB.Width = 400;
- baseBB.Height = 400;
-
- var baseItem = new DrawingItemForTesting(baseBB);
-
- SvgRenderRectItem myBgItem = new SvgRenderRectItem(baseItem, baseItem.Bounds);
- myBgItem.FillColor = "purple";
- myBgItem.FillOpacity = 0.2d;
-
- SvgRenderRectItem myInnerItem = new SvgRenderRectItem(baseItem, myBgItem.Bounds);
-
- myInnerItem.FillColor = "green";
- myInnerItem.FillOpacity = 0.8d;
-
- myInnerItem.Width = 50;
- myInnerItem.Height = 50;
-
- var container = new SvgContainerItem(myInnerItem, myBgItem);
-
- container.MarginLeft = 5;
- container.MarginRight = 5;
- container.MarginTop = 5;
- container.MarginBottom = 5;
-
- container.ApplyMargins();
-
- baseItem.RenderItems.Add(container);
-
- var sb = new StringBuilder();
-
- baseItem.Render(sb);
-
- return sb.ToString();
- }
-
- internal string pattern()
- {
- var baseBB = new BoundingBox();
-
- baseBB.Width = 400;
- baseBB.Height = 400;
-
- var baseItem = new DrawingItemForTesting(baseBB);
-
-
- var linePattern = new LinePattern(baseItem, "testLines", LinePatternType.Vertical);
- linePattern.SetNumberOfLines(3);
-
- var defItem = new DefinitionGroup(baseItem);
- defItem.Items.Add(linePattern);
-
- var rectItem = new SvgRenderRectItem(baseItem, baseItem.Bounds);
-
- rectItem.FillColor = $"url(#{"testLines"})";
-
- rectItem.Width = 200;
- rectItem.Height = 200;
-
- baseItem.RenderItems.Add(defItem);
- baseItem.RenderItems.Add(rectItem);
- var useItem = new SvgUseRefItem(baseItem,baseItem.Bounds,"testLines");
-
- baseItem.RenderItems.Add(useItem);
-
- var sb = new StringBuilder();
-
- baseItem.Render(sb);
-
- return sb.ToString();
- }
-
- internal string pattern2()
- {
- var baseBB = new BoundingBox();
-
- baseBB.Width = 400;
- baseBB.Height = 400;
-
- var baseItem = new DrawingItemForTesting(baseBB);
-
- string refId = "grid";
-
- var defItem = new DefinitionGroup(baseItem);
-
- var dynaGrid = new DynamicGridDefGroup(baseItem, refId, 7, 5);
- defItem.Items.Add(dynaGrid);
-
- baseItem.RenderItems.Add(defItem);
-
- var useItem = new SvgUseRefItem(baseItem, baseItem.Bounds, refId);
- useItem.Bounds.Width = 300;
- useItem.Bounds.Height = 200;
-
- baseItem.RenderItems.Add(useItem);
-
- var sb = new StringBuilder();
-
- baseItem.Render(sb);
-
- return sb.ToString();
- }
-
- private string GenerateFromPreset(RenderPresets preset)
- {
- switch (preset)
- {
- case RenderPresets.ContainerMargins:
- return containerMargins();
- case RenderPresets.RotatingContainer:
- return rotatingContainer();
- case RenderPresets.PatternFill:
- return pattern2();
- }
- return "";
- }
-
- private RenderItem GenerateRect(DrawingBase baseItem, Dictionary itemProperties)
- {
- var rectItem = new SvgRenderRectItem(baseItem, baseItem.Bounds);
-
- if (itemProperties.ContainsKey("Top"))
- {
- rectItem.Top = (double)itemProperties["Top"];
- }
- if (itemProperties.ContainsKey("Left"))
- {
- rectItem.Left = (double)itemProperties["Left"];
- }
- if (itemProperties.ContainsKey("Width"))
- {
- rectItem.Width = (double)itemProperties["Width"];
- }
- if (itemProperties.ContainsKey("Height"))
- {
- rectItem.Height = (double)itemProperties["Height"];
- }
- if (itemProperties.ContainsKey("Opacity"))
- {
- rectItem.FillOpacity = (double)itemProperties["Opacity"];
- }
- if (itemProperties.ContainsKey("Fill"))
- {
- rectItem.FillColor = "#" + ((Color)itemProperties["Fill"]).ToColorString();
- }
-
- return rectItem;
- }
-
- private string GenerateFromCircle(RenderItemClasses preset, DrawingBase baseItem, Dictionary itemProperties)
- {
- return RenderCircleSegment(baseItem, itemProperties);
- }
-
- private RenderItem GenerateFromClasses(RenderItemClasses preset, DrawingBase baseItem, Dictionary itemProperties)
- {
- switch (preset)
- {
- case RenderItemClasses.Rect:
- return GenerateRect(baseItem, itemProperties);
- case RenderItemClasses.CircleSegment:
- //return RenderCircleSegment(baseItem, itemProperties);
- case RenderItemClasses.TextBox:
-
-
- default:
- throw new NotImplementedException("This class has not been implemented as an option yet");
- }
- }
-
- //public string RenderTestCanvas(double widthPixel, double heightPixel, Color bgColor)
- //{
-
- //}
-
- //public string RenderBaseItemToSvg(DrawingBase drawing)
- //{
-
- //}
-
- ////Attempt at ensuring features can be created/tested individually by the system
- ////Without relying on having a whole workbook or epplus project.
- ////Simply: Does our positioning, sizing and parent hierarchy logic work as expected or not.
- //public string RenderIndependentCanvas(double widthPixel, double heightPixel, Color bgColor)
- //{
- // var widthPoint = widthPixel.PixelToPoint();
- // var heightPoint = heightPixel.PixelToPoint();
-
- // var CanvasBounds = new BoundingBox(widthPoint, heightPoint);
-
- // var sb = new StringBuilder();
- // var canvas = new SvgIndependentCanvas(CanvasBounds, bgColor);
-
- // var rect = new SvgIndependentRect(canvas.Bounds, widthPoint/2, heightPoint/2);
- // rect.FillColor = "red";
- // rect.Left = 10;
-
- // //BoundingBox boundsTextBox = new BoundingBox(rect.Bounds.Left, rect.Bounds.Top, rect.Bounds.Width, rect.Bounds.Height);
- // //var independentTxtBox = new SvgIndependentTextBox(canvas, boundsTextBox);
-
- // //var textBox = new svgin
-
- // canvas.AddRenderItem(rect);
-
- // canvas.Render(sb);
- // return sb.ToString();
- //}
-
-
- //public string RenderTextBox(ExcelDrawing someDrawing, BoundingBox parent, double maxHeight, double maxWidth)
- //{
- // var sb = new StringBuilder();
- // var svgTextBox = new DrawingTextBox(someDrawing, parent, maxWidth, maxHeight);
- //}
-
-
- //public string RenderRangeToSvg(ExcelRange range)
- //{
- // var ws = range.Worksheet;
-
- // //ws.Workbook.Styles.CellXfs.
-
- // double totalWidth = 0;
- // foreach (var col in range.EntireColumn)
- // {
- // totalWidth += ExcelColumn.ColumnWidthToPixels(col.Width, range.Worksheet.Workbook.MaxFontWidth);
- // }
- // double totalHeight = 0;
- // foreach (var row in range.EntireRow)
- // {
- // totalHeight = row.Height;
- // }
-
- // var sRange = new SvgRange(range, totalWidth, totalHeight);
-
- // var sb = new StringBuilder();
- // sb.Append($"");
- // return sb.ToString();
- //}
-
- //public string RenderBox(string boxText)
- //{
- // string retStr = "";
- // var container = new TextContainerBase(boxText);
- // var element = GenerateSvg(container);
- //public string RenderBox(string boxText)
- //{
- // string retStr = "";
- // var container = new TextContainerBase(boxText);
- // var element = GenerateSvg(container);
-
- // using (var ms = EPPlusMemoryManager.GetStream())
- // {
- // SvgWriter writer = new SvgWriter(ms, Encoding.UTF8);
- // writer.RenderSvgElement(element, true);
- // ms.Position = 0;
- // using (var sr = new StreamReader(ms))
- // {
- // retStr = sr.ReadToEnd();
- // return retStr;
- // }
- // }
- // using (var ms = EPPlusMemoryManager.GetStream())
- // {
- // SvgWriter writer = new SvgWriter(ms, Encoding.UTF8);
- // writer.RenderSvgElement(element, true);
- // ms.Position = 0;
- // using (var sr = new StreamReader(ms))
- // {
- // retStr = sr.ReadToEnd();
- // return retStr;
- // }
- // }
-
- // //writer.RenderSvgElement(element, true);
- // //writer.RenderSvgElement(element, true);
-
- // //StreamReader reader = new StreamReader(ms);
- // //retStr = reader.ReadToEnd();
-
- // ////SvgParagraph para = new SvgParagraph(container.GetContent(),);
- // ////var doc = new SvgEpplusDocument();
- // //return retStr;
- //}
-
- //public string RenderTextBody(ExcelTextBody body, double shapeWidth, double shapeHeight)
- //{
- // var sb = new StringBuilder();
-
- // BoundingBox worldBounds = new BoundingBox();
- // worldBounds.Width = shapeWidth;
- // worldBounds.Height = shapeHeight;
-
- // var doc = new SvgEpplusDocument((int)worldBounds.Width, (int)worldBounds.Height);
- // doc.Render(sb);
-
- // FontMeasurerTrueType measurer = new FontMeasurerTrueType(11, "Aptos Narrow", FontSubFamily.Regular);
-
- // var svgBody = new DrawingTextbody(doc, worldBounds, null);
- // svgBody.ImportTextBody(body);
-
- // svgBody.Render(sb);
- // sb.AppendLine("");
-
- // return sb.ToString();
- //}
-
- internal string RenderSvgElement(SvgElement element)
- {
- string retStr = string.Empty;
-
- using (var ms = EPPlusMemoryManager.GetStream())
- {
- SvgWriter writer = new SvgWriter(ms, Encoding.UTF8);
- writer.RenderSvgElement(element, true);
- ms.Position = 0;
- using (var sr = new StreamReader(ms))
- {
- retStr = sr.ReadToEnd();
- return retStr;
- }
- }
- }
-
-
- internal SvgElement GetDefinitions(BoundingBox boundingBox, out string nameId, bool AllowOverflow = false)
- {
- nameId = "boundingBox";
- var def = new SvgElement("defs");
-
- string defaultName = "defaultRect";
-
- if (AllowOverflow == false)
- {
- var bb = new SvgElement("rect");
- bb.AddAttribute("width", boundingBox.Width);
- bb.AddAttribute("height", boundingBox.Height);
- bb.AddAttribute("id", defaultName);
-
- def.AddChildElement(bb);
-
- var clipPath = new SvgElement("clipPath");
- clipPath.AddAttribute("id", nameId);
-
- def.AddChildElement(clipPath);
-
- var useElement = new SvgElement("use");
- useElement.AddAttribute("href", $"#{defaultName}");
-
- clipPath.AddChildElement(useElement);
- }
-
- return def;
- }
-
- //internal SvgElement GenerateSvg(TextContainerBase container)
- //{
- // var fullString = container.GetContent();
- //internal SvgElement GenerateSvg(TextContainerBase container)
- //{
- // var fullString = container.GetContent();
-
- // var doc = new SvgEpplusDocument(500, 500);
- // var doc = new SvgEpplusDocument(500, 500);
-
- // var bg = new SvgElement("rect");
- // bg.AddAttribute("width", "100%");
- // bg.AddAttribute("height", "100%");
- // bg.AddAttribute("fill", "red");
- // bg.AddAttribute("opacity", "0.1");
- // var bg = new SvgElement("rect");
- // bg.AddAttribute("width", "100%");
- // bg.AddAttribute("height", "100%");
- // bg.AddAttribute("fill", "red");
- // bg.AddAttribute("opacity", "0.1");
-
- // var nameId = "boundingBox";
- // var def = new SvgElement("defs");
- // var clipPath = new SvgElement("clipPath");
- // clipPath.AddAttribute("id", nameId);
- // var nameId = "boundingBox";
- // var def = new SvgElement("defs");
- // var clipPath = new SvgElement("clipPath");
- // clipPath.AddAttribute("id", nameId);
-
- // def.AddChildElement(clipPath);
- // def.AddChildElement(clipPath);
-
- // var bb = new SvgElement("rect");
- // bb.AddAttribute("x", container.Position.X);
- // bb.AddAttribute("y", container.Position.Y);
- // bb.AddAttribute("width", container.Width);
- // bb.AddAttribute("height", container.Height);
- // //bb.AddAttribute("fill", "blue");
- // //bb.AddAttribute("opacity", "0.5");
- // var bb = new SvgElement("rect");
- // bb.AddAttribute("x", container.Position.X);
- // bb.AddAttribute("y", container.Position.Y);
- // bb.AddAttribute("width", container.Width);
- // bb.AddAttribute("height", container.Height);
- // //bb.AddAttribute("fill", "blue");
- // //bb.AddAttribute("opacity", "0.5");
-
- // clipPath.AddChildElement(bb);
- // clipPath.AddChildElement(bb);
-
- // var fontSizePx = 16d;
- // var fontSizePx = 16d;
-
- // var renderElement = new SvgElement("text");
- // renderElement.AddAttribute("x", container.Position.X);
- // renderElement.AddAttribute("y", container.Position.Y + fontSizePx);
- // renderElement.AddAttribute("_measurementFont-size", $"{fontSizePx}px");
- // renderElement.AddAttribute("clip-path", $"url(#{nameId})");
- // var renderElement = new SvgElement("text");
- // renderElement.AddAttribute("x", container.Position.X);
- // renderElement.AddAttribute("y", container.Position.Y + fontSizePx);
- // renderElement.AddAttribute("_measurementFont-size", $"{fontSizePx}px");
- // renderElement.AddAttribute("clip-path", $"url(#{nameId})");
-
- // renderElement.Content = fullString;
- // renderElement.Content = fullString;
-
- // var bbVisual = new SvgElement("rect");
- // bbVisual.AddAttribute("x", container.Position.X);
- // bbVisual.AddAttribute("y", container.Position.Y);
- // bbVisual.AddAttribute("width", container.Width);
- // bbVisual.AddAttribute("height", container.Height);
- // bbVisual.AddAttribute("fill", "blue");
- // bbVisual.AddAttribute("opacity", "0.5");
- // var bbVisual = new SvgElement("rect");
- // bbVisual.AddAttribute("x", container.Position.X);
- // bbVisual.AddAttribute("y", container.Position.Y);
- // bbVisual.AddAttribute("width", container.Width);
- // bbVisual.AddAttribute("height", container.Height);
- // bbVisual.AddAttribute("fill", "blue");
- // bbVisual.AddAttribute("opacity", "0.5");
-
- // doc.AddChildElement(def);
- // doc.AddChildElement(bg);
- // doc.AddChildElement(bbVisual);
- // doc.AddChildElement(renderElement);
- // doc.AddChildElement(def);
- // doc.AddChildElement(bg);
- // doc.AddChildElement(bbVisual);
- // doc.AddChildElement(renderElement);
-
- // doc.AddAttributes();
- // doc.AddAttributes();
-
- // return doc;
- //}
- // return doc;
- //}
- }
-}
diff --git a/src/EPPlus.Export.ImageRenderer/ImageRenderer.snk b/src/EPPlus.Export.ImageRenderer/ImageRenderer.snk
deleted file mode 100644
index 92ed14d1c0..0000000000
Binary files a/src/EPPlus.Export.ImageRenderer/ImageRenderer.snk and /dev/null differ
diff --git a/src/EPPlus.Export.ImageRenderer/PathCommands.cs b/src/EPPlus.Export.ImageRenderer/PathCommands.cs
deleted file mode 100644
index b27c5c30be..0000000000
--- a/src/EPPlus.Export.ImageRenderer/PathCommands.cs
+++ /dev/null
@@ -1,71 +0,0 @@
-/*************************************************************************************************
- Required Notice: Copyright (C) EPPlus Software AB.
- This software is licensed under PolyForm Noncommercial License 1.0.0
- and may only be used for noncommercial purposes
- https://polyformproject.org/licenses/noncommercial/1.0.0/
-
- A commercial license to use this software can be purchased at https://epplussoftware.com
- *************************************************************************************************
- Date Author Change
- *************************************************************************************************
- 27/11/2025 EPPlus Software AB EPPlus 9
- *************************************************************************************************/
-
-using EPPlus.Fonts.OpenType.Utils;
-using EPPlusImageRenderer.RenderItems;
-using OfficeOpenXml;
-using System;
-using System.Globalization;
-using System.Text;
-
-namespace EPPlusImageRenderer
-{
- internal class PathCommands
- {
- public PathCommands(PathCommandType type, SvgRenderItem item, params double[] coordinates)
- {
- Type = type;
- RenderItem = item;
- Coordinates = coordinates;
- }
- public SvgRenderItem RenderItem{ get; set;}
- public PathCommandType Type { get; }
- public double[] Coordinates { get; set; }
- public SvgAdjustmentPoint AdjustmentPoint { get; set; }
- public int CommandIndex { get; set; }
-
- public void Render(/*double width, double height, */StringBuilder sb)
- {
- sb.Append(Type.AsCommandChar());
- for (int i = 0; i < Coordinates.Length; i++)
- {
- string s;
- if (Type==PathCommandType.Arc && ((i & 7)==2 || (i & 7) == 3 || (i & 7) == 4)) // Arc flags are not coordinates, but should be rendered as integers
- {
- s = Coordinates[i].ToString(CultureInfo.InvariantCulture);
- }
- else
- {
- s = Coordinates[i].PointToPixelString();
- }
- sb.AppendFormat("{0} ", s);
- }
- if (Coordinates.Length > 0)
- {
- sb.Remove(sb.Length - 1, 1);
- }
- }
- internal virtual bool InPoints(double x)
- {
- return true;
- }
- internal PathCommands Clone()
- {
- return new PathCommands(Type, RenderItem)
- {
- Coordinates = (double[])Coordinates.Clone(),
- };
- }
- }
-
-}
\ No newline at end of file
diff --git a/src/EPPlus.Export.ImageRenderer/Properties/AssemblyInfo.cs b/src/EPPlus.Export.ImageRenderer/Properties/AssemblyInfo.cs
deleted file mode 100644
index 88652c64cf..0000000000
--- a/src/EPPlus.Export.ImageRenderer/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,51 +0,0 @@
-/*************************************************************************************************
- Required Notice: Copyright (C) EPPlus Software AB.
- This software is licensed under PolyForm Noncommercial License 1.0.0
- and may only be used for noncommercial purposes
- https://polyformproject.org/licenses/noncommercial/1.0.0/
-
- A commercial license to use this software can be purchased at https://epplussoftware.com
- *************************************************************************************************
- Date Author Change
- *************************************************************************************************
- 01/27/2020 EPPlus Software AB Initial release EPPlus 5
- *************************************************************************************************/
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Security;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-//[assembly: InternalsVisibleTo("EPPlusTest, PublicKey=00240000048000009400000006020000002400005253413100040000010001001dd11308ec93a6ebcec727e183a8972dc6f95c23ecc34aa04f40cbfc9c17b08b4a0ea5c00dcd203bace44d15a30ce8796e38176ae88e960ceff9cc439ab938738ba0e603e3d155fc298799b391c004fc0eb4393dd254ce25db341eb43303e4c488c9500e126f1288594f0710ec7d642e9c72e76dd860649f1c48249c00e31fba")]
-[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")]
-//[assembly: InternalsVisibleTo("EPPlusImageRenderer, PublicKey=002400000480000094000000060200000024000052534131000400000100010045e5d8275ad7edb388eb9c60ac6e1dd30161aea53f5334c45751217df06feb6ae799a1866fc0671f9ec0d6dbec23807ad71012617cb8d471979216c63baa607754a5d5f20b45e1ce5c256685552a2a09e19a35b554d554dcbbfecdd331bf15cb2b5c4fbd76f7424f30493635c0234ee1ea782ebfdfdc0dec3dbbc167c4c061cc")]
-[assembly: InternalsVisibleTo("EPPlus.Export.ImageRenderer.Tests, PublicKey=002400000480000094000000060200000024000052534131000400000100010065aa00a9b0dcfa0e8debefb14c3b6c12ef658ce1cfbfafcb6eb7dbdc0c49e4f70ea144ba29d827453f0716ffc8c1d87450ce0cf255bda1def174915caaa78f373f291ce1a7edf91ba6f9dc961d937b19d46dd5d7d70a6e2097c749d43780f0d00b29a6f5aec5c1d191bee69de0c889a6d2566bef3cb235612351eae7015382d0")]
-[assembly: InternalsVisibleTo("SvgRenderer, PublicKey=0024000004800000940000000602000000240000525341310004000001000100e5059c702e8e710d3450fe0c455a46f9ddd46f7f87451ecb5160d3a23fd6d63f6cd723abd60f7536098598d10e18d42accf48ce0856a01b04e0249cdd63dabdbb13a33c007738ebbe1b947e4af346854c58ffdacff04c5ae09c4cd2879a1af3354ca477632b07595fa0bf04b9a552356f8ad08bfe70c39d0d03ce45df7c7e3be")]
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-
-// Version information for an assembly consists of the following four values:
-//
-// MajorInterval Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Revision and Build Numbers
-// by using the '*' as shown below:
-#if (!Core)
-//[assembly: AssemblyTitle("EPPlus")]
-//[assembly: AssemblyDescription("A spreadsheet library for .NET framework and .NET core")]
-//[assembly: AssemblyConfiguration("")]
-//[assembly: AssemblyCompany("EPPlus Software AB")]
-//[assembly: AssemblyProduct("EPPlus")]
-//[assembly: AssemblyCopyright("EPPlus Software AB")]
-//[assembly: AssemblyTrademark("")]
-//[assembly: AssemblyCulture("")]
-//[assembly: ComVisible(false)]
-
-//[assembly: AssemblyVersion("5.5.0.0")]
-//[assembly: AssemblyFileVersion("5.5.0.0")]
-#endif
-[assembly: AllowPartiallyTrustedCallers]
diff --git a/src/EPPlus.Export.ImageRenderer/RenderItems/GradientFill.cs b/src/EPPlus.Export.ImageRenderer/RenderItems/GradientFill.cs
deleted file mode 100644
index b3adc22c44..0000000000
--- a/src/EPPlus.Export.ImageRenderer/RenderItems/GradientFill.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-/*************************************************************************************************
- Required Notice: Copyright (C) EPPlus Software AB.
- This software is licensed under PolyForm Noncommercial License 1.0.0
- and may only be used for noncommercial purposes
- https://polyformproject.org/licenses/noncommercial/1.0.0/
-
- A commercial license to use this software can be purchased at https://epplussoftware.com
- *************************************************************************************************
- Date Author Change
- *************************************************************************************************
- 27/11/2025 EPPlus Software AB EPPlus 9
- *************************************************************************************************/
-using EPPlus.Export.ImageRenderer.RenderItems;
-using OfficeOpenXml.Drawing.Style.Fill;
-using OfficeOpenXml.Drawing.Theme;
-using System.Collections.Generic;
-using System.Drawing;
-using EPPlusColorConverter = OfficeOpenXml.Utils.TypeConversion.ColorConverter;
-using System;
-
-namespace EPPlusImageRenderer.RenderItems
-{
- internal class DrawGradientFill
- {
- public DrawGradientFill(ExcelTheme theme, ExcelDrawingGradientFill gradientFill)
- {
- this.Settings = gradientFill;
- for (int i = 0; i < gradientFill.Colors.Count; i++)
- {
- var c = new GradientFillColor(gradientFill.Colors[i].Position, EPPlusColorConverter.GetThemeColor(theme, gradientFill.Colors[i].Color));
- Colors.Add(c);
- }
-
- }
-
- public DrawGradientFill(List colors, List stops)
- {
- for (int i = 0; i < stops.Count; i++)
- {
- var c = new GradientFillColor(stops[i], colors[i]);
- Colors.Add(c);
- }
- }
-
- public ExcelDrawingGradientFill Settings { get; set; }
- public List Colors { get; set; } = new List();
- }
-}
\ No newline at end of file
diff --git a/src/EPPlus.Export.ImageRenderer/RenderItems/GradientFillColor.cs b/src/EPPlus.Export.ImageRenderer/RenderItems/GradientFillColor.cs
deleted file mode 100644
index affbc8207b..0000000000
--- a/src/EPPlus.Export.ImageRenderer/RenderItems/GradientFillColor.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-/*************************************************************************************************
- Required Notice: Copyright (C) EPPlus Software AB.
- This software is licensed under PolyForm Noncommercial License 1.0.0
- and may only be used for noncommercial purposes
- https://polyformproject.org/licenses/noncommercial/1.0.0/
-
- A commercial license to use this software can be purchased at https://epplussoftware.com
- *************************************************************************************************
- Date Author Change
- *************************************************************************************************
- 27/11/2025 EPPlus Software AB EPPlus 9
- *************************************************************************************************/
-using System.Drawing;
-
-namespace EPPlus.Export.ImageRenderer.RenderItems
-{
- internal class GradientFillColor
- {
- public GradientFillColor(double position, Color color)
- {
- Position = position;
- Color = color;
- }
-
- public double Position { get; private set; }
-
- public Color Color { get; private set; }
- }
-}
diff --git a/src/EPPlus.Export.ImageRenderer/RenderItems/Interfaces/IBorder.cs b/src/EPPlus.Export.ImageRenderer/RenderItems/Interfaces/IBorder.cs
deleted file mode 100644
index 4f70d4441a..0000000000
--- a/src/EPPlus.Export.ImageRenderer/RenderItems/Interfaces/IBorder.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace EPPlus.Export.ImageRenderer.RenderItems.Interfaces
-{
- public interface IBorder : IFill
- {
- double? BorderWidth { get; set; }
- double[] BorderDashArray { get; set; }
- double? BorderDashOffset { get; set; }
- }
-}
diff --git a/src/EPPlus.Export.ImageRenderer/RenderItems/Interfaces/IFill.cs b/src/EPPlus.Export.ImageRenderer/RenderItems/Interfaces/IFill.cs
deleted file mode 100644
index 7bdc1b33a6..0000000000
--- a/src/EPPlus.Export.ImageRenderer/RenderItems/Interfaces/IFill.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using OfficeOpenXml.Drawing;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace EPPlus.Export.ImageRenderer.RenderItems.Interfaces
-{
- public interface IFill
- {
- string Color { get; set; }
- double? Opacity { get; set; }
- PathFillMode FillMode { get; set; }
- }
-}
diff --git a/src/EPPlus.Export.ImageRenderer/RenderItems/Interfaces/IRectItem.cs b/src/EPPlus.Export.ImageRenderer/RenderItems/Interfaces/IRectItem.cs
deleted file mode 100644
index ef091d7641..0000000000
--- a/src/EPPlus.Export.ImageRenderer/RenderItems/Interfaces/IRectItem.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace EPPlus.Export.ImageRenderer.RenderItems.Interfaces
-{
- internal interface IRectItem
- {
- double Top { get; set; }
- double Left { get; set; }
- double Height { get; set; }
- double Width { get; set; }
- }
-}
diff --git a/src/EPPlus.Export.ImageRenderer/RenderItems/Interfaces/IStylingInfo.cs b/src/EPPlus.Export.ImageRenderer/RenderItems/Interfaces/IStylingInfo.cs
deleted file mode 100644
index 940dff2f03..0000000000
--- a/src/EPPlus.Export.ImageRenderer/RenderItems/Interfaces/IStylingInfo.cs
+++ /dev/null
@@ -1,25 +0,0 @@
-using OfficeOpenXml.Drawing;
-using OfficeOpenXml.Drawing.Style.Effect;
-using OfficeOpenXml.Drawing.Style.Fill;
-
-namespace EPPlus.Export.ImageRenderer.RenderItems.Interfaces
-{
- public interface StylingInfo
- {
- IBorder Border { get; set; }
- IFill Fill { get; set; }
- string FilterName { get; set; }
- //public RenderGradientFill GradientFill { get; set; }
- //FillType FillType { get; set; }
- //RenderGradientFill BorderGradientFill { get; set; }
- ExcelDrawingPatternFill PatternFill { get; }
- ExcelDrawingBlipFill BlipFill { get; }
- int StrokeMiterLimit { get; set; }
- eCompoundLineStyle CompoundLineStyle { get; set; }
- eLineCap LineCap { get; set; }
- //eLineJoin LineJoin { get; set; }
- double? GlowRadius { get; }
- string GlowColor { get; }
- ExcelDrawingOuterShadowEffect OuterShadowEffect { get; }
- }
-}
diff --git a/src/EPPlus.Export.ImageRenderer/RenderItems/Interfaces/IStylingInfoBase.cs b/src/EPPlus.Export.ImageRenderer/RenderItems/Interfaces/IStylingInfoBase.cs
deleted file mode 100644
index de110ec790..0000000000
--- a/src/EPPlus.Export.ImageRenderer/RenderItems/Interfaces/IStylingInfoBase.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace EPPlus.Export.ImageRenderer.RenderItems.Interfaces
-{
- internal interface IStylingInfoBase
- {
- string FillColor { get; set; }
- string BorderColor { get; set; }
- }
-}
diff --git a/src/EPPlus.Export.ImageRenderer/RenderItems/PathCommandType.cs b/src/EPPlus.Export.ImageRenderer/RenderItems/PathCommandType.cs
deleted file mode 100644
index bb844e0429..0000000000
--- a/src/EPPlus.Export.ImageRenderer/RenderItems/PathCommandType.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-/*************************************************************************************************
- Required Notice: Copyright (C) EPPlus Software AB.
- This software is licensed under PolyForm Noncommercial License 1.0.0
- and may only be used for noncommercial purposes
- https://polyformproject.org/licenses/noncommercial/1.0.0/
-
- A commercial license to use this software can be purchased at https://epplussoftware.com
- *************************************************************************************************
- Date Author Change
- *************************************************************************************************
- 27/11/2025 EPPlus Software AB EPPlus 9
- *************************************************************************************************/
-namespace EPPlusImageRenderer.RenderItems
-{
- internal enum PathCommandType : byte
- {
- Move = 0,
- Line = 1,
- HorizontalLine = 2,
- VerticalLine = 3,
- CubicBézier = 4,
- QuadraticBézier = 5,
- Arc = 6,
- End = 0xFF
- }
-
-}
\ No newline at end of file
diff --git a/src/EPPlus.Export.ImageRenderer/RenderItems/RenderItem.cs b/src/EPPlus.Export.ImageRenderer/RenderItems/RenderItem.cs
deleted file mode 100644
index 0fc0865737..0000000000
--- a/src/EPPlus.Export.ImageRenderer/RenderItems/RenderItem.cs
+++ /dev/null
@@ -1,346 +0,0 @@
-/*************************************************************************************************
- Required Notice: Copyright (C) EPPlus Software AB.
- This software is licensed under PolyForm Noncommercial License 1.0.0
- and may only be used for noncommercial purposes
- https://polyformproject.org/licenses/noncommercial/1.0.0/
-
- A commercial license to use this software can be purchased at https://epplussoftware.com
- *************************************************************************************************
- Date Author Change
- *************************************************************************************************
- 27/11/2025 EPPlus Software AB EPPlus 9
- *************************************************************************************************/
-using EPPlus.Graphics;
-using EPPlusImageRenderer.Utils;
-using OfficeOpenXml.Drawing;
-using OfficeOpenXml.Drawing.Chart.Style;
-using OfficeOpenXml.Drawing.Style.Coloring;
-using OfficeOpenXml.Drawing.Style.Effect;
-using OfficeOpenXml.Drawing.Style.Fill;
-using OfficeOpenXml.Drawing.Theme;
-using OfficeOpenXml.Style;
-using System;
-using System.Drawing;
-using System.Text;
-using EPPlusColorConverter = OfficeOpenXml.Utils.TypeConversion.ColorConverter;
-namespace EPPlusImageRenderer.RenderItems
-{
- internal abstract class RenderItem : RenderItemBase
- {
- internal protected DrawingBase DrawingRenderer { get; }
- internal RenderItem(DrawingBase renderer)
- {
- DrawingRenderer = renderer;
- }
-
- internal RenderItem(DrawingBase renderer, BoundingBox parent)
- {
- Bounds.Parent = parent;
- DrawingRenderer = renderer;
- }
- //internal abstract void GetBounds(out double il, out double it, out double ir, out double ib);
- internal virtual void GetBounds(out double il, out double it, out double ir, out double ib)
- {
- il = Bounds.Left;
- it = Bounds.Top;
- ir = Bounds.Right;
- ib = Bounds.Bottom;
- }
-
- //internal bool IsEndOfGroup { get; set; } = false;
- public string FillColor { get; set; }
- public string FilterName { get; set; }
- public DrawGradientFill GradientFill { get; set; }
- public SvgFillType FillType { get; set; }
- public double? FillOpacity { get; set; }
- public string BorderColor { get; set; }
- public DrawGradientFill BorderGradientFill { get; set; }
- public ExcelDrawingPatternFill PatternFill { get; private set; }
- public ExcelDrawingBlipFill BlipFill { get; private set; }
- public double? BorderWidth { get; set; }
- public double[] BorderDashArray { get; set; }
- public int StrokeMiterLimit { get; set; } = 4;
- public eCompoundLineStyle CompoundLineStyle { get; set; } = eCompoundLineStyle.Single;
- public double? BorderDashOffset { get; set; }
- public eLineCap LineCap { get; set; } = eLineCap.Flat;
- public SvgLineJoin LineJoin { get; set; } = SvgLineJoin.Miter;
- public double? BorderOpacity { get; set; }
- public PathFillMode FillColorSource { get; set; } = PathFillMode.Norm;
- public PathFillMode BorderColorSource { get; set; } = PathFillMode.Norm;
- public double? GlowRadius { get; private set; }
- public string GlowColor { get; private set; }
- public ExcelDrawingOuterShadowEffect OuterShadowEffect { get; private set; } = null;
-
- ///
- /// The origin point for any transform actions in svg.
- /// Normally/Default 0,0
- ///
- public Coordinate TransformOrigin { get; set; } = null;
-
- protected void CloneBase(RenderItem item)
- {
- item.FillColor = FillColor;
- item.FillOpacity = FillOpacity;
- item.BorderWidth = BorderWidth;
- item.BorderColor = BorderColor;
- item.BorderDashArray = BorderDashArray;
- item.BorderDashOffset = BorderDashOffset;
- item.BorderOpacity = BorderOpacity;
- item.LineJoin = LineJoin;
- item.LineCap = LineCap;
- item.FillColorSource = FillColorSource;
- }
-
- internal void SetPatternFill()
- {
-
- }
-
- internal virtual void SetDrawingPropertiesFill(ExcelDrawingFill fill, ExcelDrawingColorManager color)
- {
- switch (fill.Style)
- {
-
- case eFillStyle.PatternFill:
- PatternFill = fill.PatternFill;
- break;
- case eFillStyle.BlipFill:
- BlipFill = fill.BlipFill;
- break;
- default:
- SetDrawingPropertiesFill((ExcelDrawingFillBasic)fill, color);
- break;
- }
- }
- internal virtual void SetDrawingPropertiesFill(ExcelDrawingFillBasic fill, ExcelDrawingColorManager color)
- {
- double? opacity=null;
- switch (fill.Style)
- {
- case eFillStyle.NoFill:
- if (fill.IsEmpty)
- {
- FillColor = GetFillColor(fill, color, FillColorSource, out opacity);
- }
- else
- {
- FillColor = "none";
- }
- break;
- case eFillStyle.SolidFill:
- FillColor = GetFillColor(fill, color, FillColorSource, out opacity);
- break;
- case eFillStyle.GradientFill:
- GradientFill = new DrawGradientFill(DrawingRenderer.Theme, fill.GradientFill);
- FillColor = null;
- break;
- }
- if (opacity.HasValue)
- {
- FillOpacity = opacity;
- }
- }
- internal virtual void SetDrawingPropertiesBorder(ExcelDrawingBorder border, ExcelChartStyleColorManager color, bool hasBorder, double defaultWidth=1.5)
- {
- double? opacity = null;
- switch (border.Fill.Style)
- {
- case eFillStyle.NoFill:
- if(border.Fill.IsEmpty)
- {
- BorderColor = GetFillColor(border.Fill, color, BorderColorSource, out opacity);
- }
- else
- {
- BorderColor = "none";
- }
- break;
- case eFillStyle.SolidFill:
- BorderColor = GetFillColor(border.Fill, color, BorderColorSource, out opacity);
- BorderGradientFill = null;
- break;
- case eFillStyle.GradientFill:
- BorderGradientFill = new DrawGradientFill(DrawingRenderer.Theme, border.Fill.GradientFill);
- BorderColor = null;
- break;
- }
-
- if (opacity.HasValue)
- {
- BorderOpacity = opacity;
- }
-
- if (hasBorder && BorderColorSource != PathFillMode.None)
- {
- BorderWidth = border.Width == 0 ? defaultWidth : border.Width;
- if(border.LineStyle.HasValue && border.LineStyle!=eLineStyle.Solid)
- {
- BorderDashArray = GetDashArray(border);
- }
- if(border.CompoundLineStyle!=eCompoundLineStyle.Single)
- {
- CompoundLineStyle = border.CompoundLineStyle;
- //TODO:Add support double compound borders.
- }
- }
- }
- internal void SetDrawingPropertiesEffects(ExcelDrawingEffectStyle effect)
- {
- if (effect.HasGlow)
- {
- GlowRadius = effect.Glow.Radius;
- var gc = EPPlusColorConverter.GetThemeColor(DrawingRenderer.Theme, effect.Glow.Color);
- GlowColor = "#" + gc.ToArgb().ToString("x8").Substring(2);
- }
- if(effect.HasOuterShadow)
- {
- OuterShadowEffect = effect.OuterShadow;
- }
- }
-
- private double[] GetDashArray(ExcelDrawingBorder border)
- {
- var lw = (int)Math.Round(border.Width * ExcelDrawing.EMU_PER_POINT / ExcelDrawing.EMU_PER_PIXEL);
- switch (border.LineStyle)
- {
- case eLineStyle.Dot:
- return new double[]{ lw, 4 * lw };
- case eLineStyle.DashDot:
- return new double[] { 4 * lw, 3 * lw, lw, 3 * lw };
- case eLineStyle.Dash:
- return new double[] { 4 * lw, 3 * lw };
- case eLineStyle.LongDash:
- return new double[] { 8 * lw, 3 * lw };
- case eLineStyle.LongDashDot:
- return new double[] { 8 * lw, 3 * lw, lw, 3 * lw };
- case eLineStyle.LongDashDotDot:
- return new double[] { 8 * lw, 3 * lw, lw, 3 * lw, lw, 3 * lw };
- case eLineStyle.SystemDash:
- return new double[] { 3 * lw, lw };
- case eLineStyle.SystemDot:
- return new double[] { lw, lw };
- case eLineStyle.SystemDashDot:
- return new double[] { 3 * lw, lw, lw, lw };
- case eLineStyle.SystemDashDotDot:
- return new double[] { 3 * lw, lw, lw, lw, lw, lw };
- }
- return null;
- }
-
- private string GetFillColor(ExcelDrawingFillBasic fill, ExcelDrawingColorManager styleFillColor, PathFillMode fillColorSource, out double? opacity)
- {
- opacity = null;
- if (fillColorSource == PathFillMode.None)
- {
- return "none";
- }
-
- Color fc;
- if (fill == null || fill.Style == eFillStyle.NoFill)
- {
- if (styleFillColor == null)
- {
- fc = EPPlusColorConverter.GetThemeColor(DrawingRenderer.Theme.ColorScheme.Accent1);
- }
- else
- {
- fc = EPPlusColorConverter.GetThemeColor(DrawingRenderer.Theme, styleFillColor);
- }
- }
- else if (fill.Style == eFillStyle.SolidFill)
- {
- fc = EPPlusColorConverter.GetThemeColor(DrawingRenderer.Theme, fill.SolidFill.Color);
- }
- else
- {
- return string.Empty;
- }
-
- fc = ColorUtils.GetAdjustedColor(fillColorSource, fc);
- if(fc.A<255 && fc!=Color.Empty)
- {
- opacity = fc.A/255D;
- }
- return "#" + fc.ToArgb().ToString("x8").Substring(2);
- }
-
- internal void GetOuterShadowColor(out string shadowColor, out double opacity)
- {
- if (OuterShadowEffect == null)
- {
- shadowColor = null;
- opacity = 0;
-
- }
- else
- {
- var tc=EPPlusColorConverter.GetThemeColor(DrawingRenderer.Theme, OuterShadowEffect.Color);
- if (tc.A < 255 && tc != Color.Empty)
- {
- opacity = tc.A / 255D;
- }
- else
- {
- opacity = 1;
- }
- shadowColor = "#" + tc.ToArgb().ToString("x8").Substring(2);
- }
- }
- }
-
- internal abstract class RenderItemIndependent : RenderItemBase
- {
- public string FillColor { get; set; }
- public string FilterName { get; set; }
- public SvgFillType FillType { get; set; }
- public double? FillOpacity { get; set; }
- public string BorderColor { get; set; }
- public double? BorderWidth { get; set; }
- public double[] BorderDashArray { get; set; }
- public double? BorderDashOffset { get; set; }
- public eLineCap LineCap { get; set; } = eLineCap.Flat;
- public SvgLineJoin LineJoin { get; set; } = SvgLineJoin.Miter;
- public double? BorderOpacity { get; set; }
- public PathFillMode FillColorSource { get; set; } = PathFillMode.Norm;
- public PathFillMode BorderColorSource { get; set; } = PathFillMode.Norm;
- public double? GlowRadius { get; private set; }
- public string GlowColor { get; private set; }
-
- protected void CloneBase(RenderItem item)
- {
- item.FillColor = FillColor;
- item.FillOpacity = FillOpacity;
- item.BorderWidth = BorderWidth;
- item.BorderColor = BorderColor;
- item.BorderDashArray = BorderDashArray;
- item.BorderDashOffset = BorderDashOffset;
- item.BorderOpacity = BorderOpacity;
- item.LineJoin = LineJoin;
- item.LineCap = LineCap;
- item.FillColorSource = FillColorSource;
- }
-
-
- internal string SetFillColor(Color color)
- {
- FillColor = GetAdjustedColor(color);
- return FillColor;
- }
-
- private string GetAdjustedColor(Color color)
- {
- var fc = ColorUtils.GetAdjustedColor(FillColorSource, color);
- return "#" + fc.ToArgb().ToString("x8").Substring(2);
- }
- }
-
- ///
- /// Base class for any item rendered.
- ///
- internal abstract class RenderItemBase
- {
- internal BoundingBox Bounds = new BoundingBox();
- public abstract RenderItemType Type { get; }
- public abstract void Render(StringBuilder sb);
- }
-}
\ No newline at end of file
diff --git a/src/EPPlus.Export.ImageRenderer/RenderItems/RenderItemType.cs b/src/EPPlus.Export.ImageRenderer/RenderItems/RenderItemType.cs
deleted file mode 100644
index aa3412ab30..0000000000
--- a/src/EPPlus.Export.ImageRenderer/RenderItems/RenderItemType.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-/*************************************************************************************************
- Required Notice: Copyright (C) EPPlus Software AB.
- This software is licensed under PolyForm Noncommercial License 1.0.0
- and may only be used for noncommercial purposes
- https://polyformproject.org/licenses/noncommercial/1.0.0/
-
- A commercial license to use this software can be purchased at https://epplussoftware.com
- *************************************************************************************************
- Date Author Change
- *************************************************************************************************
- 27/11/2025 EPPlus Software AB EPPlus 9
- *************************************************************************************************/
-namespace EPPlusImageRenderer.RenderItems
-{
- internal enum RenderItemType
- {
- Path = 0,
- Rect = 1,
- Group = 2,
- Line = 3,
- Ellipse = 4,
- Text = 5,
- TSpan = 6,
- Paragraph = 7,
- CommentTitle = 8,
- Reference = 9,
- }
-}
\ No newline at end of file
diff --git a/src/EPPlus.Export.ImageRenderer/RenderItems/Shared/ContainerItem.cs b/src/EPPlus.Export.ImageRenderer/RenderItems/Shared/ContainerItem.cs
deleted file mode 100644
index 355a0df8bb..0000000000
--- a/src/EPPlus.Export.ImageRenderer/RenderItems/Shared/ContainerItem.cs
+++ /dev/null
@@ -1,141 +0,0 @@
-using EPPlus.Graphics;
-using EPPlusImageRenderer;
-using EPPlusImageRenderer.RenderItems;
-using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace EPPlus.Export.ImageRenderer.RenderItems.Shared
-{
- internal abstract class ContainerItem : RenderItem
- {
- internal RenderItem InnerItem { get; private set; }
- internal RenderItem OuterItem { get; private set; }
-
- double _marginLeft;
- double _marginTop;
-
- internal double MarginLeft
- {
- get
- {
- return _marginLeft;
- }
- set
- {
- VerifyMarginInput(value);
- _marginLeft = value;
- //InnerItem.Bounds.Left = value;
- }
- }
-
- internal double MarginTop
- {
- get
- {
- return _marginTop;
- }
- set
- {
- VerifyMarginInput(value);
- _marginTop = value;
- //InnerItem.Bounds.Top = value;
- }
- }
-
- double _marginRight;
-
- internal double MarginRight
- {
- get
- {
- return _marginRight;
- }
- set
- {
- VerifyMarginInput(value);
- _marginRight = value;
- //InnerItem.Bounds.Width = Bounds.Width - value;
- }
- }
-
- double _marginBottom;
-
- internal double MarginBottom
- {
- get
- {
- return _marginBottom;
- }
- set
- {
- VerifyMarginInput(value);
- _marginBottom = value;
- }
- }
-
- bool SizeToContents = true;
- public ContainerItem(RenderItem innerItem, RenderItem outerItem) : base(innerItem.DrawingRenderer)
- {
- OuterItem = outerItem;
- InnerItem = innerItem;
-
- OuterItem.Bounds.Parent = Bounds;
- InnerItem.Bounds.Parent = Bounds;
- }
-
- internal void ApplyMargins()
- {
- //Origin-Point: Set. Set in stone. All text moves from there
- //Here it is Bounds.Top and Bounds.Left. Nothing in the content can change that
-
- OuterItem.Bounds.Width = InnerItem.Bounds.Width + MarginRight + MarginLeft;
- OuterItem.Bounds.Height = InnerItem.Bounds.Height + MarginBottom + MarginTop;
-
- Bounds.Width = OuterItem.Bounds.Width;
- Bounds.Height = OuterItem.Bounds.Height;
- }
-
- public override RenderItemType Type => RenderItemType.Group;
-
- internal double GetInnerLeft()
- {
- return Bounds.Left + MarginLeft;
- }
-
- internal double GetInnerTop()
- {
- return Bounds.Top + MarginTop;
- }
-
- internal double GetInnerBottom()
- {
- return Bounds.Bottom - MarginBottom;
- }
-
- internal double GetInnerRight()
- {
- return Bounds.Right - MarginRight;
- }
-
- public double GetInnerWidth()
- {
- return GetInnerRight() - GetInnerLeft();
- }
-
- public double GetInnerHeight()
- {
- return GetInnerBottom() - GetInnerTop();
- }
-
- private void VerifyMarginInput(double value)
- {
- if (value < 0)
- {
- throw new ArgumentException("Margins cannot be set to a negative value! If you wish to set starting position, please set Left or Top for the ContainerItem");
- }
- }
- }
-}
diff --git a/src/EPPlus.Export.ImageRenderer/RenderItems/Shared/FlexBaseContainer.cs b/src/EPPlus.Export.ImageRenderer/RenderItems/Shared/FlexBaseContainer.cs
deleted file mode 100644
index 532679f706..0000000000
--- a/src/EPPlus.Export.ImageRenderer/RenderItems/Shared/FlexBaseContainer.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using EPPlusImageRenderer.RenderItems;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace EPPlus.Export.ImageRenderer.RenderItems.Shared
-{
- //internal class FlexBaseContainer : RenderItem
- //{
- // public override RenderItemType Type => throw new NotImplementedException();
-
- // public override void Render(StringBuilder sb)
- // {
- // throw new NotImplementedException();
- // }
- //}
-}
diff --git a/src/EPPlus.Export.ImageRenderer/RenderItems/Shared/GroupItem.cs b/src/EPPlus.Export.ImageRenderer/RenderItems/Shared/GroupItem.cs
deleted file mode 100644
index f725fd22a1..0000000000
--- a/src/EPPlus.Export.ImageRenderer/RenderItems/Shared/GroupItem.cs
+++ /dev/null
@@ -1,102 +0,0 @@
-using EPPlus.Graphics;
-using EPPlusImageRenderer;
-using EPPlusImageRenderer.RenderItems;
-using System.Collections.Generic;
-
-namespace EPPlus.Export.ImageRenderer.RenderItems.Shared
-{
- internal abstract class PieGroupItemBase : RenderItem
- {
- ///
- /// In degrees
- ///
- internal double Rotation = double.NaN;
- ///
- /// The translated position of this item in points
- /// Also the parent position of the group item
- /// (This may seem strange but it ensures the the translation is seen
- /// immediately in the global position of GroupItem without affecting local position)
- ///
- internal Point TranslationOffset = new Point(0,0);
-
- Point _altRotationPoint = null;
-
- internal Point RotationPoint
- {
- get
- {
- if (_altRotationPoint == null)
- {
- return TranslationOffset;
- }
- return _altRotationPoint;
- }
- set
- {
- _altRotationPoint = value;
- }
- }
-
- internal Coordinate Scale = null;
-
-
- //Transform _rotationPoint;
-
- ///
- /// Items contained in this group
- ///
- internal protected List _childItems = new List();
-
- public PieGroupItemBase(DrawingBase renderer) : base(renderer)
- {
- Bounds.Parent = TranslationOffset;
- //_rotationPoint = Bounds;
- }
-
- public PieGroupItemBase(DrawingBase renderer, double localXPos, double localYPos) : this(renderer)
- {
- Bounds.Left = localXPos;
- Bounds.Top = localYPos;
- }
-
-
- public PieGroupItemBase(DrawingBase renderer, BoundingBox parent, double rotation, Transform rotationPoint = null) : this(renderer, 0, 0)
- {
- TranslationOffset.Parent = parent;
- Rotation = rotation;
- if (rotationPoint != null)
- {
- RotationPoint = new Point(rotationPoint.LocalPosition.X, rotationPoint.LocalPosition.Y);
- }
- }
-
- internal void SetRotationPointToCenterOfGroup(double rotation = double.NaN)
- {
- RotationPoint = new Point(Bounds.Width/2, Bounds.Height/2);
-
- if (double.IsNaN(rotation) == false)
- {
- Rotation = rotation;
- }
- }
-
- internal void AddChildItem(RenderItem item)
- {
- if (item is PieGroupItemBase)
- {
- var subGroup = (PieGroupItemBase)item;
- subGroup.TranslationOffset.Parent = Bounds;
- }
- else
- {
- item.Bounds.Parent = Bounds;
- }
- _childItems.Add(item);
-
- Bounds.Width = item.Bounds.Right > Bounds.Width ? item.Bounds.Right : Bounds.Width;
- Bounds.Height = item.Bounds.Bottom > Bounds.Height ? item.Bounds.Bottom : Bounds.Height;
- }
-
- public override RenderItemType Type => RenderItemType.Group;
- }
-}
diff --git a/src/EPPlus.Export.ImageRenderer/RenderItems/Shared/InnerGroup.cs b/src/EPPlus.Export.ImageRenderer/RenderItems/Shared/InnerGroup.cs
deleted file mode 100644
index 0bd1958efd..0000000000
--- a/src/EPPlus.Export.ImageRenderer/RenderItems/Shared/InnerGroup.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-using EPPlus.Graphics;
-using EPPlusImageRenderer;
-using EPPlusImageRenderer.RenderItems;
-using System.Collections.Generic;
-
-namespace EPPlus.Export.ImageRenderer.RenderItems.Shared
-{
- internal abstract class InnerGroup : RenderItem
- {
- ///
- /// Items contained in this group
- ///
- internal protected List _childItems = new List();
-
- public InnerGroup(DrawingBase renderer) : base(renderer)
- {
- }
-
- internal void AddChildItem(RenderItem item)
- {
- item.Bounds.Parent = Bounds;
-
- _childItems.Add(item);
-
- Bounds.Width = item.Bounds.Right > Bounds.Width ? item.Bounds.Right : Bounds.Width;
- Bounds.Height = item.Bounds.Bottom > Bounds.Height ? item.Bounds.Bottom : Bounds.Height;
- }
-
- public override RenderItemType Type => RenderItemType.Group;
- }
-}
diff --git a/src/EPPlus.Export.ImageRenderer/RenderItems/Shared/ParagraphItem.cs b/src/EPPlus.Export.ImageRenderer/RenderItems/Shared/ParagraphItem.cs
deleted file mode 100644
index 6043768391..0000000000
--- a/src/EPPlus.Export.ImageRenderer/RenderItems/Shared/ParagraphItem.cs
+++ /dev/null
@@ -1,537 +0,0 @@
-using EPPlus.Fonts.OpenType;
-using EPPlus.Fonts.OpenType.Integration;
-using EPPlus.Fonts.OpenType.TextShaping;
-using EPPlus.Fonts.OpenType.Utils;
-using EPPlus.Graphics;
-using EPPlusImageRenderer;
-using EPPlusImageRenderer.RenderItems;
-using EPPlusImageRenderer.Utils;
-using OfficeOpenXml.Drawing;
-using OfficeOpenXml.Drawing.Theme;
-using OfficeOpenXml.FormulaParsing.Excel.Functions.Statistical;
-using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
-using OfficeOpenXml.Interfaces.Drawing.Text;
-using OfficeOpenXml.Style;
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Linq;
-using System.Text;
-using System.Text.RegularExpressions;
-using EPPlusColorConverter = OfficeOpenXml.Utils.TypeConversion.ColorConverter;
-
-namespace EPPlus.Export.ImageRenderer.RenderItems.Shared
-{
- internal abstract class ParagraphItem : RenderItem
- {
- TextLayoutEngine _layout;
-
- double _leftMargin;
- double _rightMargin;
-
- eDrawingTextLineSpacing _lsType;
- double _lineSpacingAscendantOnly;
- double? _lsMultiplier = null;
- internal bool IsFirstParagraph { get; private set; }
- List _paragraphLines = new List();
- protected List _textRunDisplayText = new List();
-
- List _newTextFragments;
- int _manualFragmentsStartIndex = -1;
- List _manualFragments;
- internal protected MeasurementFont _paragraphFont;
- internal TextBodyItem ParentTextBody { get; set; }
- internal double ParagraphLineSpacing { get; private set; }
- internal eTextAlignment HorizontalAlignment { get; private set; }
- internal List Runs { get; set; } = new List();
-
- internal bool DisplayBounds { get; set; } = false;
-
- private List _lines;
-
- //Start temp workaround vars
- string _textIfEmpty = null;
- ExcelDrawingParagraph _p = null;
- //end temp workaround vars
-
- private double? _centerAdjustment = null;
-
- internal List SpaceWidthsPerLine = new List();
-
- bool LinespacingIsExact
- {
- get
- {
- return _lsMultiplier.HasValue == false;
- }
- }
-
- public ParagraphItem(TextBodyItem textBody, DrawingBase renderer, BoundingBox parent) : base(renderer, parent)
- {
- ParentTextBody = textBody;
- Bounds.Name = "Paragraph";
- var defaultFont = new MeasurementFont { FontFamily = "Aptos Narrow", Size = 11, Style = MeasurementFontStyles.Regular };
- _paragraphFont = defaultFont;
-
- _layout = OpenTypeFonts.GetTextLayoutEngineForFont(defaultFont);
- ParagraphLineSpacing = GetParagraphLineSpacingInPoints(100, (TextShaper)OpenTypeFonts.GetShaperForFont(defaultFont), defaultFont.Size);
- }
-
- public ParagraphItem(TextBodyItem textBody, DrawingBase renderer, BoundingBox parent, ExcelDrawingParagraph p, string textIfEmpty = null) : base(renderer, parent)
- {
- ParentTextBody = textBody;
- IsFirstParagraph = p == p._paragraphs[0];
-
- if (p.DefaultRunProperties.Fill != null && p.DefaultRunProperties.Fill.IsEmpty == false)
- {
- if (IsFirstParagraph)
- {
- if (p.DefaultRunProperties.Fill != null)
- {
- SetDrawingPropertiesFill(p.DefaultRunProperties.Fill, null);
- }
- }
- else
- {
- //Drawingproperties has fallback to firstDefault but excel does not display it so we should not either.
- if (p.DefaultRunProperties != p._paragraphs.FirstDefaultRunProperties)
- {
- SetDrawingPropertiesFill(p.DefaultRunProperties.Fill, null);
- }
- else
- {
- var fc = EPPlusColorConverter.GetThemeColor(DrawingRenderer.Theme.ColorScheme.Light1);
- fc = ColorUtils.GetAdjustedColor(PathFillMode.Norm, fc);
- FillColor = "#" + fc.ToArgb().ToString("x8").Substring(2);
- //Use shape fill somehow
- //Maybe use a name property for fallback theme accent1 color?
- }
- }
- }
- else
- {
- if (p._paragraphs.FirstDefaultRunProperties != null && p._paragraphs.FirstDefaultRunProperties.Fill != null && p._paragraphs.FirstDefaultRunProperties.Fill.IsEmpty == false)
- {
- var fill = p._paragraphs.FirstDefaultRunProperties.Fill;
- SetDrawingPropertiesFill(fill, null);
- }
- }
-
- //---Initialize Bounds / Margins-- -
- Bounds.Name = "Paragraph";
-
- var indent = 48 * p.IndentLevel;
- _leftMargin = p.LeftMargin + p.Indent + indent;
- _rightMargin = p.RightMargin;
-
- _leftMargin = _leftMargin.PixelToPoint();
- _rightMargin = _rightMargin.PixelToPoint();
-
- HorizontalAlignment = p.HorizontalAlignment;
- _leftMargin = _leftMargin.PixelToPoint();
- _rightMargin = _rightMargin.PixelToPoint();
-
- HorizontalAlignment = p.HorizontalAlignment;
-
- if (ParentTextBody.AutoSize == false)
- {
- Bounds.Left = 0;
- Bounds.Width = ParentTextBody.MaxWidth;
-
- //Left is equal to left Paragraph margin
- //Textbody or Textbox are assumed to handle shape/chart margins
- //Paragraph handles only indentations/margins that is applied ON TOP of those margins
- //Paragraph left is the exact position where the text itself starts on the left
- if (HorizontalAlignment != eTextAlignment.Center)
- {
- Bounds.Left = GetAlignmentHorizontal(HorizontalAlignment);
- }
- else
- {
- //Center is a bit strange the bounds really are the same as left or right aligned
- //It doesn't truly matter as only left min and right max play a role
- Bounds.Left = GetAlignmentHorizontal(eTextAlignment.Left);
- _centerAdjustment = GetAlignmentHorizontal(HorizontalAlignment);
-
- }
- Bounds.Width = parent.Width - _rightMargin - _leftMargin;
- }
-
- //---Initialize / calculate lines and runs---
- //measurer must be set before AddLinesAndRichText
- _paragraphFont = p.DefaultRunProperties.GetMeasureFont();
-
- //---Get measurer---
- _layout = OpenTypeFonts.GetTextLayoutEngineForFont(_paragraphFont);
-
- //---Calculate linespacing---
- int numLines = _paragraphLines.Count;
- _lsType = p.LineSpacing.LineSpacingType;
- ParagraphLineSpacing = GetParagraphLineSpacingInPoints(p.LineSpacing.Value,
- (TextShaper) OpenTypeFonts.GetShaperForFont(_paragraphFont),
- _paragraphFont.Size);
-
-
- ImportLinesAndTextRuns(p, textIfEmpty);
- }
-
- private double GetParagraphLineSpacingInPoints(double spacingValue, TextShaper fmExact, float fontSize)
- {
- if (_lsType == eDrawingTextLineSpacing.Exactly)
- {
- if (IsFirstParagraph)
- {
- _lineSpacingAscendantOnly = spacingValue;
- }
- return spacingValue;
- }
- else
- {
- var multiplier = (spacingValue / 100);
- _lsMultiplier = multiplier;
- if (IsFirstParagraph)
- {
- _lineSpacingAscendantOnly = multiplier * fmExact.GetAscentInPoints(fontSize);
- }
- return multiplier * fmExact.GetLineHeightInPoints(fontSize);
- }
- }
-
- //public void AddOwnText(string text)
- //{
- // var fragment = new TextFragment();
- // fragment.Text = text;
- // fragment.Font = ParagraphFont;
- // _manualFragments.Add(fragment);
-
- // //if(_newTextFragments == null)
- // //{
- // // //This should probably never happen
- // // throw new InvalidOperationException("Must GENERATE textfragments first in the constructor");
- // // //GenerateTextFragments(text);
- // //}
- // //else
- // //{
- // // var fragment = new TextFragment();
- // // fragment.Text = text;
- // // fragment.Font = ParagraphFont;
- // // //_newTextFragments.Add(fragment);
- // // _manualFragments.Add(fragment);
- // //}
-
- // //Redo whole thing for now.
- // //Import and wrapping really should be completely seperated but can't refactor all of it yet
- // //AddTextLinesAndSpacing(_p, _textIfEmpty);
- //}
-
- public void AddOwnText(TextFragment fragment)
- {
- //_manualFragments.Add(fragment);
-
- if (_newTextFragments == null)
- {
- //This should probably never happen
- throw new InvalidOperationException("Must GENERATE textfragments first in the constructor");
- //GenerateTextFragments(text);
- }
- else
- {
- if(_manualFragmentsStartIndex == -1)
- {
- _manualFragmentsStartIndex = _newTextFragments.Count;
- }
- //_newTextFragments.Add(fragment);
- _newTextFragments.Add(fragment);
- }
-
-
- //Redo whole thing for now.
- //Import and wrapping really should be completely seperated but can't refactor all of it yet
- AddTextLinesAndSpacing(_p, _textIfEmpty);
- }
-
-
- internal protected TextRunItem AddRenderItemTextRun(ExcelParagraphTextRunBase origTxtRun, string displayText)
- {
- var targetTxtRun = CreateTextRun(origTxtRun, Bounds, displayText);
-
- Runs.Add(targetTxtRun);
- return targetTxtRun;
- }
-
- private void AddText(string text, MeasurementFont font)
- {
- var container = CreateTextRun(font, Bounds, text);
- Runs.Add(container);
-
- container.Bounds.Name = $"Container{Runs.Count}";
- }
-
- private void AddText(string text, ExcelTextFont font)
- {
- var mf = font.GetMeasureFont();
- var measurer = OpenTypeFonts.GetTextLayoutEngineForFont(mf);
-
- var container = CreateTextRun(text, font, Bounds, text);
- Runs.Add(container);
- //Bounds.Width = container.Bounds.Width + 0.001; //TODO: fix for equal width issue
- container.Bounds.Name = $"Container{Runs.Count}";
- }
-
- void GenerateTextFragments(string text)
- {
- _newTextFragments = new List();
-
- if (string.IsNullOrEmpty(text) == false)
- {
- var currentFrag = new TextFragment() { Text = text, Font = _paragraphFont};
- _newTextFragments.Add(currentFrag);
- }
- }
-
- ///
- /// Log linebreak positions and sizes of the runs
- /// So that we can easily know what textfragment is on what line and what size it has later
- ///
- ///
- void GenerateTextFragments(ExcelDrawingTextRunCollection runs/*, string textIfEmpty*/)
- {
- List runContents = new List();
- List fonts = new List();
-
- for (int i = 0; i < runs.Count(); i++)
- {
- var txtRun = runs[i];
- var runFont = txtRun.GetMeasurementFont();
-
- fonts.Add(runFont);
- runContents.Add(txtRun.Text);
- }
-
- _newTextFragments = new List();
-
- for (int i = 0; i < runContents.Count(); i++)
- {
- if (string.IsNullOrEmpty(runContents[i]) == false)
- {
- var currentFrag = new TextFragment() { Text = runContents[i], Font = fonts[i] };
- _newTextFragments.Add(currentFrag);
- }
- }
- }
-
- internal void ImportLinesAndTextRunsDefault(string textIfEmpty)
- {
- GenerateTextFragments(textIfEmpty);
-
- if (HorizontalAlignment != eTextAlignment.Center)
- {
- Bounds.Left = GetAlignmentHorizontal(HorizontalAlignment);
- }
- else
- {
- Bounds.Left = GetAlignmentHorizontal(eTextAlignment.Left);
- _centerAdjustment = GetAlignmentHorizontal(HorizontalAlignment);
- }
-
- AddTextLinesAndSpacing(null, textIfEmpty);
- }
- private void ImportLinesAndTextRuns(ExcelDrawingParagraph p, string textIfEmpty)
- {
- if (p.TextRuns.Count == 0 && string.IsNullOrEmpty(textIfEmpty) == false)
- {
- ImportLinesAndTextRunsDefault(textIfEmpty);
- }
- else
- {
- //Log line positions and run sizes
- GenerateTextFragments(p.TextRuns);
- AddTextLinesAndSpacing(p, textIfEmpty);
- }
- }
-
- private void AddTextLinesAndSpacing(ExcelDrawingParagraph p, string textIfEmpty)
- {
- //Temp workaround
- if (_p == null)
- {
- _p = p;
- }
- if (_textIfEmpty == null)
- {
- _textIfEmpty = textIfEmpty;
- }
-
- _lines = WrapFragmentsToLines();
-
- //In points
- double lastDescent = 0;
- double lineTop = 0;
- double greatestWidth = 0;
-
- if (_lines != null && _lines.Count != 0)
- {
- //This could be moved into a textLines collection class
- //START
- var idxOfLargestLine = 0;
- double widthOfLargestLine = _lines[0].GetWidthWithoutTrailingSpaces();
-
- for (int i = 1; i < _lines.Count; i++)
- {
- if (_lines[i].Width > widthOfLargestLine)
- {
- var ctrLineWidth = _lines[i].GetWidthWithoutTrailingSpaces();
- SpaceWidthsPerLine.Add(_lines[i].lastFontSpaceWidth);
- widthOfLargestLine = ctrLineWidth;
- idxOfLargestLine = i;
- }
- }
- //END
-
-
- if (HorizontalAlignment == eTextAlignment.Center && ParentTextBody.AutoSize && _centerAdjustment != null && string.IsNullOrEmpty(textIfEmpty))
- {
- //Bounds of the paragraph should be bounds of the text itself.
- //Therefore we must know the starting point to set accurate left and offset from left.
- Bounds.Left = _centerAdjustment.Value - (widthOfLargestLine / 2);
- }
- else
- {
- Bounds.Left = 0;
- }
- //if (ParentTextBody.AutoSize)
- //{
- // //Bounds of the paragraph should be bounds of the text itself.
- // //Therefore we must know the starting point to set accurate left and offset from left.
- // Bounds.Left = 0;
- //}
-
- foreach (var line in _lines)
- {
- double prevWidth = 0;
-
- if (HorizontalAlignment == eTextAlignment.Center)
- {
- var ctrLineWidth = line.GetWidthWithoutTrailingSpaces();
- //Calculate difference in widths and split to get offset between leftmost position and current line
- prevWidth = (widthOfLargestLine - ctrLineWidth) / 2;
- }
- else if (HorizontalAlignment == eTextAlignment.Right)
- {
- //Note that the actual bounds with the space will be outside max bounds.
- //This appears to be how excel does it
- var ctrLineWidth = line.GetWidthWithoutTrailingSpaces();
- prevWidth = widthOfLargestLine - ctrLineWidth;
- }
-
- if (LinespacingIsExact == false)
- {
- lineTop += line.LargestAscent + lastDescent;
- }
- else
- {
- lineTop += ParagraphLineSpacing;
- }
- if (line.GetWidthWithoutTrailingSpaces() > greatestWidth)
- {
- greatestWidth = line.GetWidthWithoutTrailingSpaces();
- }
-
- foreach (var lineFragment in line.LineFragments)
- {
- var displayText = lineFragment.Text;
-
-
- if (p != null && p.TextRuns.Count == 0 && string.IsNullOrEmpty(textIfEmpty) == false)
- {
- //Import fallback text with paragraph settings
- AddText(displayText, p.DefaultRunProperties);
- }
- else if (p != null && p.TextRuns.Count != 0)
- {
- var rtIdx = _newTextFragments.IndexOf(lineFragment.OriginalTextFragment);
- if (rtIdx > p.TextRuns.Count - 1)
- {
- AddText(displayText, _newTextFragments[rtIdx].Font);
- }
- else
- {
- //Import Paragraph text run
- var idx = _newTextFragments.IndexOf(lineFragment.OriginalTextFragment);
- AddRenderItemTextRun(p.TextRuns[idx], displayText);
- }
- }
- else
- {
- //Import fallback with default settings from constructor
- AddText(displayText, _paragraphFont);
- }
- TextRunItem runItem = Runs.Last();
- runItem.Bounds.Left = prevWidth;
- runItem.YPosition = lineTop;
-
- runItem.Bounds.Width = lineFragment.Width;
- prevWidth += lineFragment.Width;
- }
- lastDescent = line.LargestDescent;
- }
- }
- Bounds.Height = lineTop + lastDescent;
- Bounds.Width = greatestWidth;
- }
-
- List WrapFragmentsToLines(List fragments = null)
- {
- if(fragments == null )
- {
- fragments = _newTextFragments;
- }
-
- if (fragments.Count > 0)
- {
- if(_layout == null)
- {
- _layout = OpenTypeFonts.GetTextLayoutEngineForFont((fragments[0].Font));
- }
-
- var maxWidthPoints = Math.Round(ParentTextBody.MaxWidth, 0, MidpointRounding.AwayFromZero);
-
- _lines = _layout.WrapRichTextLines(fragments, maxWidthPoints);
- return _lines;
- }
- return new List();
- }
-
- internal double GetAlignmentHorizontal(eTextAlignment txAlignment)
- {
- var area = Bounds;
- double x = 0;
- switch (txAlignment)
- {
- case eTextAlignment.Left:
- default:
- x = area.Left + _leftMargin;
- break;
- case eTextAlignment.Center:
- x = (area.Right / 2) + _leftMargin - _rightMargin;
- break;
- case eTextAlignment.Right:
- x = area.Right - _rightMargin;
- break;
- }
-
- return x;
- }
-
- ///
- /// Type of textrun defined by child type
- ///
- ///
- ///
- ///
- ///
- internal abstract TextRunItem CreateTextRun(ExcelParagraphTextRunBase run, BoundingBox parent, string displayText);
- internal abstract TextRunItem CreateTextRun(string text, ExcelTextFont font, BoundingBox parent, string displayText);
- internal abstract TextRunItem CreateTextRun(MeasurementFont font, BoundingBox parent, string displayText);
- }
-}
diff --git a/src/EPPlus.Export.ImageRenderer/RenderItems/Shared/TextBodyItem.cs b/src/EPPlus.Export.ImageRenderer/RenderItems/Shared/TextBodyItem.cs
deleted file mode 100644
index 394e21a54b..0000000000
--- a/src/EPPlus.Export.ImageRenderer/RenderItems/Shared/TextBodyItem.cs
+++ /dev/null
@@ -1,274 +0,0 @@
-using EPPlus.Fonts.OpenType;
-using EPPlus.Fonts.OpenType.Utils;
-using EPPlus.Graphics;
-using EPPlusImageRenderer;
-using EPPlusImageRenderer.RenderItems;
-using EPPlusImageRenderer.Svg;
-using OfficeOpenXml.Drawing;
-using OfficeOpenXml.Drawing.Theme;
-using OfficeOpenXml.Interfaces.Drawing.Text;
-using OfficeOpenXml.Interfaces.Fonts;
-using OfficeOpenXml.Style;
-using OfficeOpenXml.Utils;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-
-namespace EPPlus.Export.ImageRenderer.RenderItems.Shared
-{
- ///
- /// Margin left = X
- /// Margin right = Y
- ///
- internal abstract class TextBodyItem : DrawingObject
- {
- public TextBodyItem(DrawingBase renderer, BoundingBox parent, bool autoSize) : base(renderer, parent)
- {
- Bounds.Name = "TxtBody";
- Bounds.Parent = parent;
- AutoSize = autoSize;
- }
- public TextBodyItem(DrawingBase renderer, BoundingBox parent, double maxWidth, double maxHeight) : base(renderer, parent)
- {
- Bounds.Name = "TxtBody";
- Bounds.Parent = parent;
- MaxWidth = maxWidth;
- MaxHeight = maxHeight;
- AutoSize = false;
- }
- internal bool AutoSize { get; set; }
- internal double MaxWidth { get; set; }
- internal double MaxHeight { get; set; }
-
- ///
- /// Shorthand for Bounds.Width
- ///
- internal double Width { get { return Bounds.Width; } set { Bounds.Width = value; } }
-
- ///
- /// Shorthand for Bounds.Height
- ///
- internal double Height { get { return Bounds.Height; } set { Bounds.Height = value; } }
-
- internal string FontColorString { get; set; }
-
- internal eTextAnchoringType VerticalAlignment = eTextAnchoringType.Top;
-
- internal abstract List Paragraphs { get; set; }
-
- public bool AllowOverflow;
-
- internal bool WrapText = true;
-
- internal string _text;
-
- public void ImportParagraph(ExcelDrawingParagraph item, double startingY, string text=null)
- {
- var measureFont = item.DefaultRunProperties.GetMeasureFont();
- bool isFirst = Paragraphs.Count == 0;
-
- var paragraph = CreateParagraph(this, item, Bounds, text);
- paragraph.Bounds.Name = $"Container{Paragraphs.Count}";
- paragraph.Bounds.Top = startingY;
- _text = text;
-
- if(AutoSize)
- {
- if (Paragraphs.Count == 0)
- {
- Bounds.Height = paragraph.Bounds.Height;
- }
- else
- {
- Bounds.Height += paragraph.Bounds.Height;
- }
-
- if (Bounds.Width < paragraph.Bounds.Width || (Bounds.Width == MaxWidth && Paragraphs.Count == 0))
- {
- Bounds.Width = paragraph.Bounds.Width;
- }
- }
- Paragraphs.Add(paragraph);
- }
-
- public void AddParagraph(double startingY, string text = null)
- {
- var paragraph = CreateParagraph(this, Bounds, text);
- paragraph.Bounds.Name = $"Container{Paragraphs.Count}";
- paragraph.Bounds.Top = startingY;
- _text = text;
-
- if (AutoSize)
- {
- if (Paragraphs.Count == 0)
- {
- Bounds.Height = paragraph.Bounds.Height;
- }
- else
- {
- Bounds.Height += paragraph.Bounds.Height;
- }
-
- if (Bounds.Width < paragraph.Bounds.Width || (Bounds.Width == MaxWidth && Paragraphs.Count == 0))
- {
- Bounds.Width = paragraph.Bounds.Width;
- }
- }
- Paragraphs.Add(paragraph);
- }
-
- internal void SetHorizontalAlignmentPosition()
- {
- //if (AutoSize)
- //{
- foreach (var p in Paragraphs)
- {
- switch (p.HorizontalAlignment)
- {
- case eTextAlignment.Left:
- p.Bounds.Left = 0;
- break;
- case eTextAlignment.Center:
- p.Bounds.Left = (Bounds.Width / 2) - (p.Bounds.Width / 2);
- break;
- case eTextAlignment.Right:
- p.Bounds.Left = Bounds.Right - p.Bounds.Width;
- break;
- case eTextAlignment.Distributed:
- case eTextAlignment.Justified:
- case eTextAlignment.JustifiedLow:
- case eTextAlignment.ThaiDistributed:
- p.Bounds.Left = 0; //TODO: Set left for now as we do not support distributed spacing yet
- break;
- }
- }
- //}
- }
-
- internal virtual void ImportTextBody(ExcelTextBody body, ExcelHorizontalAlignment horizontalDefault = ExcelHorizontalAlignment.Left)
- {
- _text = null;
- VerticalAlignment = body.Anchor;
-
- //We already apply bounds top via the parent Transform
- double currentHeight = 0;
- double largestWidth = double.MinValue;
-
- foreach (var paragraph in body.Paragraphs)
- {
- ImportParagraph(paragraph, currentHeight);
- var addedPara = Paragraphs.Last();
- currentHeight = addedPara.Bounds.Bottom;
- largestWidth = Math.Max(largestWidth, addedPara.Bounds.Width);
- }
-
- foreach (var paragraph in body.Paragraphs)
- {
- SetHorizontalAlignmentPosition();
- }
-
- if (Paragraphs != null && Paragraphs.Count() > 0)
- {
- Bounds.Height = currentHeight;
- }
-
- Bounds.Top = GetAlignmentVertical();
- }
-
- private double GetParagraphAscendantSpacingInPixels(eDrawingTextLineSpacing lineSpacingType, double spacingValue, ITextShaper fmExact, float fontSize, out double multiplier)
- {
- if (lineSpacingType == eDrawingTextLineSpacing.Exactly)
- {
- multiplier = -1;
- return spacingValue.PointToPixel();
- }
- else
- {
- multiplier = (spacingValue / 100);
- return multiplier * fmExact.GetAscentInPoints(fontSize).PointToPixel();
- }
- }
-
-
- //public void AddText(string text, FontMeasurerTrueType measurer)
- //{
- // if (Paragraphs.Count == 0)
- // {
- // AddParagraph(text, measurer);
- // }
- // else
- // {
- // Paragraphs.Last().AddText(text, measurer);
- // }
- //}
- //internal void AddText(string text, ExcelTextFont font)
- //{
- // //Document Top position for the paragraph text based on vertical alignment
- // var posY = GetAlignmentVertical();
- // //var vertAlignAttribute = GetVerticalAlignAttribute(posY);
-
- // //var measurer = font.PictureRelationDocument.Package.Settings.TextSettings.GenericTextMeasurerTrueType;
- // //Limit bounding area with the space taken by previous paragraphs
- // //Note that this is ONLY identical to PosY if the vertical alignment is top
-
- // //The first run in the first paragraph must apply different line-spacing
- // //var svgParagraph = new SvgParagraph(text, font, area, vertAlignAttribute, posY);
- // var paragraph = CreateParagraph(Bounds);
- // paragraph.AddText(text, font);
- // paragraph.FillColor = font.Fill.Color.To6CharHexString();
-
- // Paragraphs.Add(paragraph);
- //}
- //public void SetMeasurer(FontMeasurerTrueType fontMeasurer)
- //{
- // _measurer = fontMeasurer;
- //}
-
- double? _alignmentY = null;
-
- ///
- /// Get the start of text space vertically
- ///
- ///
- ///
- private double GetAlignmentVertical()
- {
- double alignmentY = 0;
-
- switch (VerticalAlignment)
- {
- case eTextAnchoringType.Top:
- alignmentY = Bounds.Top;
- break;
- //Center means center of a Shape's ENTIRE bounding box height.
- //Not center of the Inset GetRectangle
- case eTextAnchoringType.Center:
- alignmentY = (MaxHeight - Bounds.Height)/2 + Bounds.Top;
- break;
- case eTextAnchoringType.Bottom:
- alignmentY = MaxHeight - Bounds.Height;
- break;
- }
-
- _alignmentY = alignmentY;
-
- return _alignmentY.Value;
- }
-
-
- ///
- /// Each file format defines its own paragraph
- ///
- ///
- internal abstract ParagraphItem CreateParagraph(TextBodyItem textBody, ExcelDrawingParagraph paragraph, BoundingBox parent, string textIfEmpty="");
-
- internal abstract ParagraphItem CreateParagraph(TextBodyItem textBody, BoundingBox parent, string textIfEmpty = "");
-
- ///
- /// Each file format defines its own paragraph
- ///
- ///
- internal abstract ParagraphItem CreateParagraph(TextBodyItem textBody, BoundingBox parent);
- }
-}
diff --git a/src/EPPlus.Export.ImageRenderer/RenderItems/Shared/TextRunCollection.cs b/src/EPPlus.Export.ImageRenderer/RenderItems/Shared/TextRunCollection.cs
deleted file mode 100644
index 8f631f2633..0000000000
--- a/src/EPPlus.Export.ImageRenderer/RenderItems/Shared/TextRunCollection.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-using OfficeOpenXml.Drawing.Chart;
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace EPPlus.Export.ImageRenderer.RenderItems.Shared
-{
- internal class TextRunCollection : IEnumerable
- {
- private List _textRunItems;
-
- public void Add(TextRunItem item)
- {
- _textRunItems.Add(item);
- }
-
- ///
- /// Number of items in the collection
- ///
- public int Count
- {
- get
- {
- return _textRunItems.Count;
- }
- }
- IEnumerator IEnumerable.GetEnumerator()
- {
- return _textRunItems.GetEnumerator();
- }
- IEnumerator IEnumerable.GetEnumerator()
- {
- return _textRunItems.GetEnumerator();
- }
- ///
- /// Returns a textrun at position
- ///
- /// The position of the chart. 0-base
- ///
- public TextRunItem this[int PositionID]
- {
- get
- {
- return (_textRunItems[PositionID]);
- }
- }
- }
-}
diff --git a/src/EPPlus.Export.ImageRenderer/RenderItems/Shared/TextRunItem.cs b/src/EPPlus.Export.ImageRenderer/RenderItems/Shared/TextRunItem.cs
deleted file mode 100644
index 4b3f1d544d..0000000000
--- a/src/EPPlus.Export.ImageRenderer/RenderItems/Shared/TextRunItem.cs
+++ /dev/null
@@ -1,204 +0,0 @@
-using EPPlus.Fonts.OpenType;
-using EPPlus.Fonts.OpenType.Utils;
-using EPPlus.Graphics;
-using EPPlusImageRenderer;
-using EPPlusImageRenderer.RenderItems;
-using OfficeOpenXml.Drawing;
-using OfficeOpenXml.Interfaces.Drawing.Text;
-using OfficeOpenXml.Style;
-using OfficeOpenXml.Utils;
-using System;
-using System.Collections.Generic;
-using System.Drawing;
-using System.Linq;
-using System.Text.RegularExpressions;
-using static System.Net.Mime.MediaTypeNames;
-
-namespace EPPlus.Export.ImageRenderer.RenderItems.Shared
-{
- internal abstract class TextRunItem : RenderItem
- {
- public override RenderItemType Type => RenderItemType.Text;
-
- internal readonly string _originalText;
- protected string _currentText;
-
- internal protected MeasurementFont _measurementFont;
- internal protected bool _isFirstInParagraph;
-
- internal double FontSizeInPixels { get; private set; }
-
- public List Lines { get; private set; }
-
- protected internal bool _isItalic = false;
- protected internal bool _isBold = false;
- protected internal eUnderLineType _underLineType;
- protected internal eStrikeType _strikeType;
- protected internal Color _underlineColor;
- protected internal double _baseline;
-
- internal double YPosition { get; set; }
- internal double ClippingHeight = double.NaN;
-
- internal TextRunItem(DrawingBase renderer, BoundingBox parent, MeasurementFont font, string displayText) : base(renderer, parent)
- {
- _originalText = displayText;
-
- Bounds.Name = "TextRun";
- _currentText = displayText;
-
- Lines = Regex.Split(_currentText, "\r\n|\r|\n").ToList();
-
- _measurementFont = font;
- _isFirstInParagraph = true;
-
- FontSizeInPixels = ((double)_measurementFont.Size).PointToPixel(true);
- Bounds.Height = _measurementFont.Size;
- if (parent.Height < _measurementFont.Size)
- {
- parent.Height = _measurementFont.Size;
- }
-
- //To get clipping height we need to get the textbody bounds
- if (parent != null && parent.Parent != null && parent.Parent.Parent != null)
- {
- ClippingHeight = parent.Parent.Parent.Position.Y + parent.Parent.Parent.Size.Y;
- }
- if (Lines.Count == 1)
- {
- //Bounds.Width = parent.Width;
- GetBounds(out double il, out double it, out double ir, out double ib); //TODO: remove when calc works
- }
- else
- {
- //Measure text.
- GetBounds(out double il, out double it, out double ir, out double ib); //TODO: remove when calc works
- }
- _underLineType = eUnderLineType.None;
- }
-
- internal TextRunItem(DrawingBase renderer, BoundingBox parent, string text, ExcelTextFont font, string displayText) : base(renderer, parent)
- {
- _originalText = text;
-
- Bounds.Name = "TextRun";
- _currentText = string.IsNullOrEmpty(displayText) ? _originalText : displayText;
-
- Lines = Regex.Split(_currentText, "\r\n|\r|\n").ToList();
-
- //_measurer = new FontMeasurerTrueType();
-
- _measurementFont = font.GetMeasureFont();
- //_measurer.SetFont(_measurementFont);
-
- _isFirstInParagraph = true;
-
- //_fontStyles = _measurementFont.Style;
-
- _baseline = font.Baseline;
- if (_baseline != 0)
- {
- _measurementFont.Size *= (float)(1 - (Math.Abs(_baseline) / 100));
- }
- FontSizeInPixels = ((double)_measurementFont.Size).PointToPixel(true);
-
- Bounds.Height = _measurementFont.Size;
- if (parent.Height < _measurementFont.Size)
- {
- parent.Height = _measurementFont.Size;
- }
- //_horizontalTextAlignment = TextAlignment.Center;
-
- if (font.Fill.Style == eFillStyle.SolidFill)
- {
- FillColor = "#" + font.Fill.Color.To6CharHexString();
- }
-
- //To get clipping height we need to get the textbody bounds
- if (parent != null && parent.Parent != null && parent.Parent.Parent != null)
- {
- ClippingHeight = parent.Parent.Parent.Position.Y + parent.Parent.Parent.Size.Y;
- }
- if(Lines.Count==1)
- {
- //Bounds.Width = parent.Width;
- GetBounds(out double il, out double it, out double ir, out double ib); //TODO: remove when calc works
- }
- else
- {
- //Measure text.
- GetBounds(out double il, out double it, out double ir, out double ib); //TODO: remove when calc works
- }
- _isItalic = font.Italic;
- _isBold = font.Bold;
- _underLineType = font.UnderLine;
- _underlineColor = font.UnderLineColor;
- _strikeType = font.Strike;
- }
-
- ///
- /// If the run has been wrapped more line-breaks may have been added in displayText
- ///
- ///
- ///
- ///
- internal TextRunItem(DrawingBase renderer, BoundingBox parent, ExcelParagraphTextRunBase run, string displayText = "") : base(renderer, parent)
- {
- _originalText = run.Text;
-
- Bounds.Name = "TextRun";
- _currentText = string.IsNullOrEmpty(displayText) ? _originalText : displayText;
-
- Lines = Regex.Split(_currentText, "\r\n|\r|\n").ToList();
-
- _measurementFont = run.GetMeasurementFont();
-
-
- //_fontStyles = _measurementFont.Style;
-
- _baseline = run.Baseline;
- FontSizeInPixels = ((double)_measurementFont.Size).PointToPixel(true);
-
- Bounds.Height = _measurementFont.Size;
-
- //_horizontalTextAlignment = run.Paragraph.HorizontalAlignment;
-
- if (run.Fill.IsEmpty == false && run.Fill.Style == eFillStyle.SolidFill)
- {
- FillColor = "#" + run.Fill.Color.To6CharHexString();
- }
-
- //To get clipping height we need to get the textbody bounds
- if( parent!= null && parent.Parent != null && parent.Parent.Parent != null)
- {
- ClippingHeight = ((BoundingBox)parent.Parent.Parent).Bottom;
- }
-
- if (run.Fill.Style == eFillStyle.SolidFill)
- {
- FillColor = "#" + run.Fill.Color.To6CharHexString();
- }
-
- _isItalic = run.FontItalic;
- _isBold = run.FontBold;
- _underLineType = run.FontUnderLine;
- _underlineColor = run.UnderLineColor;
- _strikeType = run.FontStrike;
- }
-
- ///
- /// Calculates right/bottom
- ///
- ///
- ///
- ///
- ///
- internal override void GetBounds(out double il, out double it, out double ir, out double ib)
- {
- il = Bounds.Left;
- it = Bounds.Top;
- ir = Bounds.Right;
- ib = Bounds.Bottom;
- }
- }
-}
diff --git a/src/EPPlus.Export.ImageRenderer/RenderItems/Shared/TransformGroup.cs b/src/EPPlus.Export.ImageRenderer/RenderItems/Shared/TransformGroup.cs
deleted file mode 100644
index a7f738444a..0000000000
--- a/src/EPPlus.Export.ImageRenderer/RenderItems/Shared/TransformGroup.cs
+++ /dev/null
@@ -1,100 +0,0 @@
-using EPPlus.Graphics;
-using EPPlusImageRenderer;
-using EPPlusImageRenderer.RenderItems;
-using System.Collections.Generic;
-
-namespace EPPlus.Export.ImageRenderer.RenderItems.Shared
-{
- internal abstract class TransformGroup : RenderItem
- {
- protected InnerGroup _innerGroup;
-
- Point PositionAfterTransform;
-
- ///
- /// In degrees
- ///
- internal double Rotation = double.NaN;
-
- BoundingBox _altRotationPoint = null;
-
- internal BoundingBox RotationPoint
- {
- get
- {
- if (_altRotationPoint == null)
- {
- return Bounds;
- }
- return _altRotationPoint;
- }
- set
- {
- _altRotationPoint = value;
- }
- }
- Coordinate _scale = new Coordinate(1,1);
-
- internal Coordinate Scale
- {
- get
- {
- return _scale;
- }
- set
- {
- Bounds.Parent.Scale = new Graphics.Math.Vector2(value.X, value.Y);
- _scale = value;
- }
- }
-
- public TransformGroup(DrawingBase renderer) : base(renderer)
- {
- _innerGroup = CreateInnerGroup();
- _innerGroup.Bounds.Parent = Bounds;
- }
-
- public TransformGroup(DrawingBase renderer, double localXPos, double localYPos) : this(renderer)
- {
- Bounds.Left = localXPos;
- Bounds.Top = localYPos;
- }
-
-
- public TransformGroup(DrawingBase renderer, BoundingBox parent, double rotation, Transform rotationPoint = null) : this(renderer, 0, 0)
- {
- Bounds.Parent = parent;
- Rotation = rotation;
- if (rotationPoint != null)
- {
- RotationPoint = new BoundingBox(rotationPoint.LocalPosition.X, rotationPoint.LocalPosition.Y);
- }
- }
-
- internal void SetRotationPointToCenterOfGroup(double rotation = double.NaN)
- {
- RotationPoint = new BoundingBox(Bounds.Width / 2, Bounds.Height / 2);
-
- if (double.IsNaN(rotation) == false)
- {
- Rotation = rotation;
- }
- }
-
- ///
- /// Adds child item to the group under this group
- ///
- ///
- internal void AddChildItem(RenderItem item)
- {
- _innerGroup.AddChildItem(item);
-
- Bounds.Width = item.Bounds.Right > Bounds.Width ? item.Bounds.Right : Bounds.Width;
- Bounds.Height = item.Bounds.Bottom > Bounds.Height ? item.Bounds.Bottom : Bounds.Height;
- }
-
- internal abstract InnerGroup CreateInnerGroup();
-
- public override RenderItemType Type => RenderItemType.Group;
- }
-}
diff --git a/src/EPPlus.Export.ImageRenderer/RenderItems/Svg/SvgParagraph.cs b/src/EPPlus.Export.ImageRenderer/RenderItems/Svg/SvgParagraph.cs
deleted file mode 100644
index bf9136ae95..0000000000
--- a/src/EPPlus.Export.ImageRenderer/RenderItems/Svg/SvgParagraph.cs
+++ /dev/null
@@ -1,161 +0,0 @@
-using EPPlusImageRenderer.FontData;
-using EPPlusImageRenderer.RenderItems.Shared;
-using EPPlusImageRenderer.Svg;
-using EPPlusImageRenderer.Text;
-using EPPlusImageRenderer.Utils;
-using Microsoft.Extensions.Primitives;
-using OfficeOpenXml.Drawing;
-using OfficeOpenXml.Interfaces.Drawing.Text;
-using OfficeOpenXml.Style;
-using System.Drawing;
-using System.Globalization;
-using System.Text;
-
-
-namespace EPPlusImageRenderer.RenderItems.Svg
-{
- internal class SvgParagraph : SvgRenderItem
- {
- public override void Render(StringBuilder sb)
- {
- sb.Append("");
-
- foreach (var textRun in TextRuns)
- {
- textRun.Render(sb);
- }
-
- sb.Append("");
- }
-
- public override SvgItemType Type => SvgItemType.Text;
-
- internal override RenderItem Clone(SvgShape svgDocument)
- {
- throw new NotImplementedException();
- }
-
- internal override void GetBounds(out double il, out double it, out double ir, out double ib)
- {
- il = ParagraphArea.Left + LeftMargin;
- it = ParagraphArea.Right - RightMargin;
- ir = ParagraphArea.Top;
- ib = ParagraphArea.Bottom;
- }
-
- string vertAlignAttribute = "";
- protected List TextRuns = new List();
-
- //ExcelDrawingParagraph Paragraph;
- double RightMargin;
- double LeftMargin;
-
- eTextAlignment HorizontalAlignment;
-
- RectBase ParagraphArea;
-
- ExcelDrawingParagraph Paragraph;
-
- ///
- /// X position
- ///
- protected double XPos;
-
- string fontName;
-
- ///
- /// Line-Spacing in pixels
- ///
- protected double LineSpacing;
- MeasurementFont defaultMeasureFont;
-
- public SvgParagraph(ExcelDrawingParagraph p, RectBase paragraphArea, FontMeasurerExact fmExact, string VertAlign)
- {
- Paragraph = p;
- defaultMeasureFont = p.DefaultRunProperties.GetMeasureFont();
- vertAlignAttribute = VertAlign;
- //Seperated out in case of some final render item
- //needing to adjust without changing the original values
- RightMargin = p.RightMargin;
- LeftMargin = p.LeftMargin;
-
-
-
- ParagraphArea = paragraphArea;
- HorizontalAlignment = p.HorizontalAlignment;
-
- LineSpacing = GetParagraphLineSpacingInPixels(fmExact);
- XPos = GetAlignmentHorizontal(HorizontalAlignment);
- }
-
- private string GetHorizontalAlignmentAttribute(double indentX)
- {
- string ret = "";
- var xStr = indentX.ToString(CultureInfo.InvariantCulture);
-
- switch (HorizontalAlignment)
- {
- default:
- case eTextAlignment.Left:
- ret = $"text-anchor=\"start\" x=\"{xStr}\" ";
- break;
- case eTextAlignment.Center:
- ret = $"text-anchor=\"middle\" x=\"{xStr}\" ";
- break;
- case eTextAlignment.Right:
-
- ret = $"text-anchor=\"end\" x=\"{xStr}\" ";
- break;
- }
-
- return ret;
- }
-
- private double GetParagraphLineSpacingInPixels(FontMeasurerExact fmExact)
- {
- if (Paragraph.LineSpacing.LineSpacingType == eDrawingTextLineSpacing.Exactly)
- {
- return Paragraph.LineSpacing.Value.PointToPixel();
- }
- else
- {
- var multiplier = (Paragraph.LineSpacing.Value / 100);
- return multiplier * fmExact.GetSingleLineSpacingPX();
- }
- }
-
- internal double GetAlignmentHorizontal(eTextAlignment txAlignment)
- {
- var area = ParagraphArea;
- double x = 0;
- switch (txAlignment)
- {
- case eTextAlignment.Left:
- default:
- x = area.Left;
- break;
- case eTextAlignment.Center:
- x = (area.Right / 2) + LeftMargin - RightMargin;
- break;
- case eTextAlignment.Right:
- x = area.Right - RightMargin;
- break;
- }
-
- return TextUtils.RoundToWhole(x);
- }
-
- internal void AddTextRun(ExcelParagraphTextRunBase txtRun)
- {
- GetBounds(out double l, out double t, out double r, out double b);
- var textMaxWidth = r - l;
- var textRun = new SvgTextRun(txtRun, LineSpacing, textMaxWidth);
- TextRuns.Add(textRun);
- }
- }
-}
diff --git a/src/EPPlus.Export.ImageRenderer/RenderItems/Svg/SvgTextRun.cs b/src/EPPlus.Export.ImageRenderer/RenderItems/Svg/SvgTextRun.cs
deleted file mode 100644
index b0f448b408..0000000000
--- a/src/EPPlus.Export.ImageRenderer/RenderItems/Svg/SvgTextRun.cs
+++ /dev/null
@@ -1,177 +0,0 @@
-using EPPlusImageRenderer.FontData;
-using EPPlusImageRenderer.Svg;
-using EPPlusImageRenderer.Text;
-using EPPlusImageRenderer.Utils;
-using OfficeOpenXml.Drawing;
-using OfficeOpenXml.Interfaces.Drawing.Text;
-using System.Globalization;
-using System.Text;
-
-namespace EPPlusImageRenderer.RenderItems.Svg
-{
- internal class SvgTextRun : SvgRenderItem
- {
- double LineSpacingPerNewLine;
- double yPosition;
- double yClipHeight;
- double fontSizeInPixels;
- eTextAlignment horizontalTextAlignment;
- string textContent;
-
- internal RectBase BoundingBox = new();
- internal Coordinate origin = new Coordinate(0, 0);
- internal ExcelParagraphTextRunBase TextRun;
- List Lines;
-
- MeasurementFont measurementFont;
-
- FontMeasurerExact fmExact;
-
- //Unnecesary??
- double TextLengthInPixels;
-
- string horizontalAttribute;
-
- ///
- /// constructor. enter linespacing in pixels
- ///
- ///
- ///
- internal SvgTextRun(ExcelParagraphTextRunBase textRun, double lineSpacing, double textMaxWidth) : base()
- {
- TextRun = textRun;
- Lines = SplitIntoLines();
-
- measurementFont = TextRun.GetMeasureFont();
-
- fmExact = new FontMeasurerExact(measurementFont);
-
- horizontalTextAlignment = TextRun.Paragraph.HorizontalAlignment;
-
- LineSpacingPerNewLine = lineSpacing;
-
- //No idea how to get this property now since we have no access to textbody
- bool wrapText = true;
- if (wrapText)
- {
- CalculateTextWrapping(textMaxWidth);
- }
- }
- public RectBase textArea;
-
- public override SvgItemType Type => SvgItemType.TSpan;
-
- public override void Render(StringBuilder sb)
- {
- string finalString = "";
-
- foreach (var line in Lines)
- {
- yPosition += TextUtils.RoundToWhole(LineSpacingPerNewLine);
- string visibility = "";
- if (yPosition >= yClipHeight)
- {
- visibility = "display=\"none\"";
- }
-
- finalString += $"";
- finalString += line;
- finalString += "";
- }
-
- sb.Append(finalString);
- //throw new NotImplementedException();
- }
-
- internal override RenderItem Clone(SvgShape svgDocument)
- {
- throw new NotImplementedException();
- }
-
- internal double GetNumberOfLines()
- {
- if (TextRun != null)
- {
- SplitIntoLines();
- return Lines.Count;
- }
- else
- {
- return 0;
- }
- }
-
- internal List SplitIntoLines()
- {
- return TextRun.Text.Split("\r\n").ToList();
- }
-
- internal override void GetBounds(out double il, out double it, out double ir, out double ib)
- {
- il = origin.X;
- it = origin.Y;
-
- ir = CalculateRightPositionInPixels();
- ib = CalculateBottomPositionInPixels();
-
- BoundingBox.Left = il;
- BoundingBox.Top = it;
- BoundingBox.Right = ir;
- BoundingBox.Bottom = ib;
- }
-
- internal double CalculateRightPositionInPixels()
- {
- var numLines = GetNumberOfLines();
- double retPos = origin.X;
-
- if (numLines <= 0 || string.IsNullOrEmpty(TextRun.Text))
- {
- TextLengthInPixels = 0;
- return retPos;
- }
-
- double longestWidth = -1;
-
- for (int i = 0; i < numLines; i++)
- {
- var text = Lines[i];
- var width = CalculateTextWidth(Lines[i]);
-
- if (width > longestWidth)
- {
- longestWidth = width;
- }
- }
-
- TextLengthInPixels = longestWidth;
-
- retPos += longestWidth;
-
- return retPos;
- }
- internal double CalculateBottomPositionInPixels()
- {
- var bottomPosition = (((double)TextRun.FontSize).PointToPixel() + origin.Y) * GetNumberOfLines();
- return bottomPosition;
- }
-
- internal double CalculateTextWidth(string targetString)
- {
- var textMesurer = new FontMeasurerExact(measurementFont);
- textMesurer.MeasureWrappedTextCells = true;
- var width = textMesurer.MeasureTextWidth(targetString);
-
- return width;
- }
-
- internal void CalculateTextWrapping(double maxWidth)
- {
- List NewContentLines = new List();
- var textMesurer = new FontMeasurerExact(measurementFont);
-
- var newLines = textMesurer.MeasureAndWrapText(TextRun.Text, measurementFont, maxWidth);
- Lines = newLines;
- }
- }
-}
diff --git a/src/EPPlus.Export.ImageRenderer/RenderItems/SvgBaseRenderer.cs b/src/EPPlus.Export.ImageRenderer/RenderItems/SvgBaseRenderer.cs
deleted file mode 100644
index 3cf77c09aa..0000000000
--- a/src/EPPlus.Export.ImageRenderer/RenderItems/SvgBaseRenderer.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-using EPPlusImageRenderer.RenderItems;
-using OfficeOpenXml.Drawing;
-using System;
-using System.Collections.Generic;
-using System.Globalization;
-using System.Linq;
-using System.Text;
-
-namespace EPPlus.Export.ImageRenderer.RenderItems
-{
- internal static class SvgBaseRenderer
- {
- public static void BaseRender(StringBuilder sb, RenderItem item)
- {
- if (string.IsNullOrEmpty(item.FillColor) == false)
- {
- sb.Append($"fill=\"{item.FillColor}\" ");
- if (item.FillOpacity != null && item.FillOpacity != 1)
- {
- sb.Append($"opacity=\"{item.FillOpacity.Value.ToString(CultureInfo.InvariantCulture)}\" ");
- }
- }
- if (string.IsNullOrEmpty(item.FilterName) == false)
- {
- sb.Append($"filter=\"{item.FilterName}\" ");
- }
-
- if (item.BorderWidth.HasValue)
- {
- if (string.IsNullOrEmpty(item.BorderColor) == false)
- {
- sb.Append($"stroke=\"{item.BorderColor}\" ");
- }
- var v = item.BorderWidth.Value * ExcelDrawing.EMU_PER_POINT / ExcelDrawing.EMU_PER_PIXEL;
- sb.Append($"stroke-width=\"{v.ToString(CultureInfo.InvariantCulture)}\" ");
-
- if (item.BorderDashArray != null)
- {
- var BorderDashArrayStr = item.BorderDashArray.Select(x =>
- x.ToString(CultureInfo.InvariantCulture)).ToArray();
-
- sb.Append($"stroke-dasharray=\"" + $"{string.Join(",", BorderDashArrayStr)}\" ");
- }
- }
- sb.Append($"stroke-miterlimit =\"8\" ");
- }
- }
-}
diff --git a/src/EPPlus.Export.ImageRenderer/RenderItems/SvgDrawingCommands.cs b/src/EPPlus.Export.ImageRenderer/RenderItems/SvgDrawingCommands.cs
deleted file mode 100644
index b5087795db..0000000000
--- a/src/EPPlus.Export.ImageRenderer/RenderItems/SvgDrawingCommands.cs
+++ /dev/null
@@ -1,181 +0,0 @@
-/*************************************************************************************************
- Required Notice: Copyright (C) EPPlus Software AB.
- This software is licensed under PolyForm Noncommercial License 1.0.0
- and may only be used for noncommercial purposes
- https://polyformproject.org/licenses/noncommercial/1.0.0/
-
- A commercial license to use this software can be purchased at https://epplussoftware.com
- *************************************************************************************************
- Date Author Change
- *************************************************************************************************
- 27/11/2025 EPPlus Software AB EPPlus 9
- *************************************************************************************************/
-//using OfficeOpenXml.Drawing;
-//using OfficeOpenXml.Utils.TypeConversion;
-//using System;
-//using System.Reflection;
-//using System.Textbox.Json;
-//using System.Windows;
-//using System.Xml;
-//namespace EPPlusImageRenderer.RenderItems
-//{
-// public static class SvgDrawingCommands
-// {
-// public static void LoadShapes()
-// {
-// Shapes.Clear();
-// var br = new BinaryReader(new FileStream("c:\\temp\\Shapedrawing.bin", FileMode.Open));
-// while (br.BaseStream.Position < br.BaseStream.Length)
-// {
-// var shapeStyle = (eShapeStyle)br.ReadByte();
-// var list = new List();
-// var adj = ShapeAdjustments.ContainsKey(shapeStyle) ? ShapeAdjustments[shapeStyle] : null;
-// Shapes.Add(shapeStyle, list);
-// var ix = 0;
-// do
-// {
-// var recType = br.ReadByte();
-// if (recType == 0) break;
-// SvgAdjustmentPoint adjPoint = null;
-// if (adj != null && adj.ContainsKey(ix & 0x1FF))
-// {
-// adjPoint = adj[ix];
-// }
-
-// switch (recType)
-// {
-// case 1: //rect
-// list.Add(ReadRect(br));
-// break;
-// case 2: //path
-// list.Add(ReadPath(br));
-// break;
-// }
-// ix++;
-// }
-// while (br.BaseStream.Position < br.BaseStream.Length);
-// }
-// }
-
-// private static SvgRenderPathItem ReadPath(BinaryReader br)
-// {
-// var fill = br.ReadByte();
-// var stroke = br.ReadByte();
-// var commandCount = br.ReadByte();
-// var item = new SvgRenderPathItem();
-// for (var i = 0; i < commandCount; i++)
-// {
-// var ct = (PathCommandType)br.ReadByte();
-// var itemCount = br.ReadInt16();
-// var l = new List();
-// for (int j = 0; j < itemCount; j++)
-// {
-// l.Add(br.ReadSingle());
-// }
-// var cmd = new PathCommands(ct, item, l.ToArray());
-// //if (adj != null && (adj.Commands == null || adj.Commands.Any(x => x.Index == i)))
-// //{
-// // cmd.AdjustmentPoint = adj;
-// // if (adj.Commands != null)
-// // {
-// // cmd.CommandIndex = adj.Commands.FindIndex(x => x.Index == i);
-// // }
-// //}
-// item.Commands.Add(cmd);
-// }
-
-// item.FillColorSource = (PathFillMode)fill;
-// item.BorderColorSource = (PathFillMode)stroke;
-
-// return item;
-// }
-
-// private static SvgRenderRectItem ReadRect(BinaryReader br)
-// {
-// var fill = br.ReadByte();
-// var stroke = br.ReadByte();
-// var x = br.ReadSingle();
-// var y = br.ReadSingle();
-// var width = br.ReadSingle();
-// var height = br.ReadSingle();
-
-// return new SvgRenderRectItem() { Left = x, Top = y, Width = width, Height = height, FillColorSource = (PathFillMode)fill, BorderColorSource = (PathFillMode)stroke };
-// }
-// public static string SerializeShapeAdjustments()
-// {
-// var s = JsonSerializer.Serialize(ShapeAdjustments);
-// return new StringReader(s).ReadToEnd();
-// }
-// public static void DeSerializeShapeAdjustments(string json)
-// {
-// ShapeAdjustments.Clear();
-// LoadShapes();
-// //MessageBox.Show("Json Loaded");
-// }
-
-// public static void LoadAdjustments()
-// {
-// var path = new FileInfo(Assembly.GetExecutingAssembly().FullName).DirectoryName;
-// ShapeAdjustments = new Dictionary>();
-// foreach (var f in Directory.GetFiles(path + "\\Adjustments\\", "*.xml"))
-// {
-// ReadAdjustmentXml(f, ShapeAdjustments);
-// }
-// }
-
-// private static void ReadAdjustmentXml(string f, Dictionary> shapeAdjustments)
-// {
-// var xml = new XmlDocument();
-// xml.Load(f);
-
-// var style = (eShapeStyle)Enum.Parse(typeof(eShapeStyle), xml.SelectSingleNode("adjust/@type").Value);
-// var adjs = new Dictionary();
-// foreach (XmlElement objNode in xml.SelectNodes("adjust/objects/object"))
-// {
-// var adj = new SvgAdjustmentPoint();
-// adj.ItemIndex = int.Parse(objNode.GetAttribute("ix"));
-// adj.AdjustmentType = (AdjustmentType)Enum.Parse(typeof(AdjustmentType), objNode.GetAttribute("adjustmentType"));
-// foreach (XmlElement cmdNode in objNode.SelectNodes("commands/command"))
-// {
-// var ix = int.Parse(cmdNode.GetAttribute("ix"));
-// var cmd = new SvgCommand(ix);
-// if (adj.Commands == null) adj.Commands = new List();
-// adj.Commands.Add(cmd);
-// foreach (XmlElement ptNode in cmdNode.SelectNodes("pt"))
-// {
-// var ptIx = short.Parse(ptNode.GetAttribute("ix"));
-// var coordinate = new SvgCoordinate(ptIx);
-// if (string.IsNullOrEmpty(ptNode.GetAttribute("adjustPointName"))==false)
-// {
-// coordinate.PointName = ptNode.GetAttribute("adjustPointName");
-// }
-// else
-// {
-// coordinate.PointName = "";
-// }
-
-// if (ConvertUtil.TryParseIntString(ptNode.GetAttribute("origin"), out int r))
-// {
-// coordinate.Origin = (short)r;
-// }
-// else
-// {
-// coordinate.Origin = 0;
-// }
-// if (Enum.TryParse(ptNode.GetAttribute("type"), true, out var result))
-// {
-// coordinate.BulletType = result;
-// }
-// cmd.Coordinates.Add(ptIx, coordinate);
-// }
-// }
-// adjs.Add(adj.ItemIndex, adj);
-// }
-// shapeAdjustments.Add(style, adjs);
-// }
-
-// internal static Dictionary> Shapes { get; } = new Dictionary>();
-// internal static Dictionary> ShapeAdjustments { get; set; } = new Dictionary>();
-// }
-
-//}
\ No newline at end of file
diff --git a/src/EPPlus.Export.ImageRenderer/RenderItems/SvgExtensions.cs b/src/EPPlus.Export.ImageRenderer/RenderItems/SvgExtensions.cs
deleted file mode 100644
index 442d8a6ee2..0000000000
--- a/src/EPPlus.Export.ImageRenderer/RenderItems/SvgExtensions.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-/*************************************************************************************************
- Required Notice: Copyright (C) EPPlus Software AB.
- This software is licensed under PolyForm Noncommercial License 1.0.0
- and may only be used for noncommercial purposes
- https://polyformproject.org/licenses/noncommercial/1.0.0/
-
- A commercial license to use this software can be purchased at https://epplussoftware.com
- *************************************************************************************************
- Date Author Change
- *************************************************************************************************
- 27/11/2025 EPPlus Software AB EPPlus 9
- *************************************************************************************************/
-using System;
-
-namespace EPPlusImageRenderer.RenderItems
-{
- internal static class SvgExtensions
- {
- internal static char AsCommandChar(this PathCommandType type)
- {
- switch (type)
- {
- case PathCommandType.Move:
- return 'M';
- case PathCommandType.Line:
- return 'L';
- case PathCommandType.HorizontalLine:
- return 'H';
- case PathCommandType.VerticalLine:
- return 'V';
- case PathCommandType.CubicBézier:
- return 'C';
- case PathCommandType.QuadraticBézier:
- return 'Q';
- case PathCommandType.Arc:
- return 'A';
- case PathCommandType.End:
- return 'Z';
- default:
- throw new NotImplementedException("SVG path type not implemented");
- }
- }
- }
-
-}
\ No newline at end of file
diff --git a/src/EPPlus.Export.ImageRenderer/RenderItems/SvgGroupItem.cs b/src/EPPlus.Export.ImageRenderer/RenderItems/SvgGroupItem.cs
deleted file mode 100644
index 0b6f047f72..0000000000
--- a/src/EPPlus.Export.ImageRenderer/RenderItems/SvgGroupItem.cs
+++ /dev/null
@@ -1,113 +0,0 @@
-/*************************************************************************************************
- Required Notice: Copyright (C) EPPlus Software AB.
- This software is licensed under PolyForm Noncommercial License 1.0.0
- and may only be used for noncommercial purposes
- https://polyformproject.org/licenses/noncommercial/1.0.0/
-
- A commercial license to use this software can be purchased at https://epplussoftware.com
- *************************************************************************************************
- Date Author Change
- *************************************************************************************************
- 27/11/2025 EPPlus Software AB EPPlus 9
- *************************************************************************************************/
-using EPPlus.Fonts.OpenType.Utils;
-using EPPlus.Graphics;
-using EPPlusImageRenderer.Svg;
-using OfficeOpenXml.Drawing.Theme;
-using OfficeOpenXml.FormulaParsing.Excel.Functions.MathFunctions;
-using System.Drawing;
-using System.Globalization;
-using System.Text;
-
-namespace EPPlusImageRenderer.RenderItems
-{
- internal class SvgEndGroupItem : RenderItem
- {
- internal SvgEndGroupItem(DrawingBase renderer, BoundingBox parent) : base(renderer, parent)
- {
-
- }
- public override RenderItemType Type => throw new System.NotImplementedException();
- public override void Render(StringBuilder sb)
- {
- sb.Append("");
- }
- }
- internal class SvgGroupItem : RenderItem
- {
- public override RenderItemType Type => RenderItemType.Group;
-
- public string TextAnchor { get; set; }
-
- public string GroupTransform = "";
-
- //internal SvgGroupItem(DrawingBase renderer, BoundingBox bounds)
-
- internal SvgGroupItem(DrawingBase renderer) : base(renderer)
- {
- }
-
- internal SvgGroupItem(DrawingBase renderer, double xPos, double yPos) : base(renderer)
- {
- GroupTransform = $"transform=\"translate({xPos.PointToPixelString()}, {yPos.PointToPixelString()})\"";
- }
-
- internal SvgGroupItem(DrawingBase renderer, BoundingBox bounds) : base(renderer)
- {
- Bounds = bounds;
- if (Bounds.Left != 0 || Bounds.Top != 0)
- {
- GroupTransform = $"transform=\"translate({Bounds.Left.PointToPixelString()}, {Bounds.Top.PointToPixelString()})\"";
- }
- }
- internal SvgGroupItem(DrawingBase renderer, BoundingBox parent, double rotation) : base(renderer, parent)
- {
- var bounds = "";
- var rot = "";
- Bounds = parent;
- if (Bounds.Left!=0 || Bounds.Top!=0)
- {
- bounds = $"translate({Bounds.Left.PointToPixelString()}, {Bounds.Top.PointToPixelString()})";
- }
- if(rotation!=0)
- {
- rot = $"rotate({rotation.ToString(CultureInfo.InvariantCulture)})";
- }
-
- if(string.IsNullOrEmpty(bounds)==false && string.IsNullOrEmpty(rot)==false)
- {
- GroupTransform = $"transform=\"{bounds} {rot}\"";
- }
- else if(string.IsNullOrEmpty(bounds)==false)
- {
- GroupTransform = $"transform=\"{bounds}\"";
- }
- else if (string.IsNullOrEmpty(rot) == false)
- {
- GroupTransform = $"transform=\"{rot}\"";
- }
- }
-
- public override void Render(StringBuilder sb)
- {
- sb.Append($"");
- }
-
- internal override void GetBounds(out double il, out double it, out double ir, out double ib)
- {
- il = 0;
- it = 0;
- ir = 1;
- ib = 1;
- }
- }
-}
diff --git a/src/EPPlus.Export.ImageRenderer/RenderItems/SvgItem/ConnectionPointsMiddle.cs b/src/EPPlus.Export.ImageRenderer/RenderItems/SvgItem/ConnectionPointsMiddle.cs
deleted file mode 100644
index e8150275f4..0000000000
--- a/src/EPPlus.Export.ImageRenderer/RenderItems/SvgItem/ConnectionPointsMiddle.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-using EPPlusImageRenderer;
-using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
-using System.Collections.Generic;
-
-
-namespace EPPlus.Export.ImageRenderer.RenderItems.SvgItem
-{
- internal class ConnectionPointsMiddle
- {
- internal Coordinate Left;
- internal Coordinate Top;
- internal Coordinate Right;
- internal Coordinate Bottom;
-
- internal Dictionary Points = new Dictionary();
-
- internal ConnectionPointsMiddle(double left, double top, double width, double height)
- {
- var middleWidth = width / 2;
- var middleHeight = height / 2;
-
- var middleX = left + middleWidth;
- var middleY = top + middleHeight;
-
- Left = new Coordinate(left, middleY);
- Top = new Coordinate(middleX, top);
-
- Right = new Coordinate(left + width, middleY);
- Bottom = new Coordinate(left + middleX, top + height);
-
- Points.Add(0, Left);
- Points.Add(1, Top);
- Points.Add(2, Right);
- Points.Add(3, Bottom);
- }
- }
-}
diff --git a/src/EPPlus.Export.ImageRenderer/RenderItems/SvgItem/PointLines.cs b/src/EPPlus.Export.ImageRenderer/RenderItems/SvgItem/PointLines.cs
deleted file mode 100644
index 79bd7dd591..0000000000
--- a/src/EPPlus.Export.ImageRenderer/RenderItems/SvgItem/PointLines.cs
+++ /dev/null
@@ -1,75 +0,0 @@
-using EPPlus.Graphics;
-using EPPlusImageRenderer;
-using EPPlusImageRenderer.RenderItems;
-using EPPlusImageRenderer.Svg;
-using System;
-using System.Collections.Generic;
-using System.Drawing;
-using System.Linq;
-using System.Runtime.InteropServices;
-using System.Text;
-
-namespace EPPlus.Export.ImageRenderer.RenderItems.SvgItem
-{
- internal class PointLines : DrawingObject
- {
- internal List RenderLines = new List();
-
- internal ConnectionPointsMiddle ConnectionPoints;
-
- private List ptColors = new List { "red", "green", "blue", "yellow" };
-
- private BoundingBox parentBounds;
-
- private PointLines(DrawingBase renderer) : base(renderer)
- {
- }
-
- internal PointLines(DrawingBase renderer, BoundingBox parent, ConnectionPointsMiddle connectionPoints) : this(renderer)
- {
- parentBounds = parent;
-
- Bounds = new BoundingBox();
-
- Bounds.Parent = parent;
- //Bounds.Left = parent.Left;
- //Bounds.Top = parent.Top;
- //Bounds.Width = parent.Width;
- //Bounds.Height = parent.Height;
- ConnectionPoints = connectionPoints;
-
- UpdateLines();
- }
-
- internal void UpdateLines()
- {
- RenderLines.Clear();
-
- for (int i = 0; i < ConnectionPoints.Points.Count; i++)
- {
- var cPoint = ConnectionPoints.Points[i];
- var cPointLine = new SvgRenderLineItem(DrawingRenderer, Bounds);
- cPointLine.X1 = 0;
- cPointLine.Y1 = 0;
- cPointLine.X2 = cPoint.X;
- cPointLine.Y2 = cPoint.Y;
-
- cPointLine.BorderWidth = 1;
- cPointLine.BorderColor = ptColors[i];
- RenderLines.Add(cPointLine);
- }
- }
-
- internal override void AppendRenderItems(List renderItems)
- {
- SvgGroupItem gItem = new SvgGroupItem(DrawingRenderer, Bounds);
- renderItems.Add(gItem);
- foreach (var line in RenderLines)
- {
- renderItems.Add(line);
- }
- SvgEndGroupItem endGItem = new SvgEndGroupItem(DrawingRenderer, Bounds);
- renderItems.Add(endGItem);
- }
- }
-}
diff --git a/src/EPPlus.Export.ImageRenderer/RenderItems/SvgItem/SvgChartSerieDataLabel.cs b/src/EPPlus.Export.ImageRenderer/RenderItems/SvgItem/SvgChartSerieDataLabel.cs
deleted file mode 100644
index f4345b3c73..0000000000
--- a/src/EPPlus.Export.ImageRenderer/RenderItems/SvgItem/SvgChartSerieDataLabel.cs
+++ /dev/null
@@ -1,156 +0,0 @@
-using EPPlus.Graphics;
-using EPPlusImageRenderer.RenderItems;
-using EPPlusImageRenderer.Svg;
-using OfficeOpenXml.Drawing;
-using OfficeOpenXml.Drawing.Chart;
-using System.Collections.Generic;
-
-namespace EPPlus.Export.ImageRenderer.RenderItems.SvgItem
-{
- internal class SvgChartSerieDataLabel : DrawingObjectNoBounds
- {
- //positioning is handled by parent item via these
- internal List groupItems = new List();
- private List dataLabels = new List();
-
- private RenderItem seriesIcon = null;
- private int _serieIndex = -1;
- ExcelDrawingParagraph defaultParagraph;
- BoundingBox plotAreaBounds;
- BoundingBox _defaultMargins;
- ExcelChartSerieDataLabel _dlblSerie;
-
- public SvgChartSerieDataLabel(SvgChart chart, ExcelChartSerieDataLabel dlblSerie, BoundingBox maxBounds, ExcelChartStandardSerie serie, List