One more bug related to SVG export. When trying to position picture relatively to plot area I get some weird results.
When trying to align just right outside of plot area - picture is shifted a bit right on svg, despite being perfectly placed on pptx (check picture in attachment for better visualization)
When trying to put picture on the left - it works as expected. So it seems some cumulative error or plot area width is off
Check code snippet and presentation attached
- Code: Select all
static void Main(string[] args)
{
string fileName = "D://test2.pptx";
var presentation = new Presentation(fileName, FileFormat.Ppsx2013);
var chart = presentation.Slides[0].Shapes[0] as IChart;
var picture = presentation.Slides[0].Shapes[1] as IShape;
picture.Left = chart.Left + chart.PlotArea.Left + chart.PlotArea.Width;
picture.Top = chart.Top + chart.PlotArea.Top;
var svgBytes = presentation.SaveToSVG();
int len = svgBytes.Count;
for (int i = 0; i < len; i++)
{
FileStream fs = new FileStream($"D://result{i}.svg", FileMode.Create);
byte[] bytes1 = svgBytes.Dequeue();
fs.Write(bytes1, 0, bytes1.Length);
}
presentation.SaveToFile("D://test.pptx", FileFormat.Pptx2013);
Process.Start("D://test.pptx");
Process.Start("D://result0.svg");
}