After cloning a slide, Information about the text formatting is lost.
This also happens with handmade slides from PowerPoint.
I am using Version v18.7.0
Below a Full Sample which reproduces the Error.
using System;
using System.Drawing;
using System.IO;
using Aspose.Slides;
namespace ErrorSample
{
class Program
{
public static void Main()
{
// set your license Pathhere
var licensePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "Aspose.Total.lic");
var license = new License();
using (var file = new FileStream(licensePath, FileMode.Open))
{
license.SetLicense(file);
}
using (var inPres = new Presentation())
using (var outPres = new Presentation())
{
var shape = inPres.Slides[0].Shapes.AddAutoShape(ShapeType.CircularArrow, 1, 1, 1, 1);
var textFrame = shape.TextFrame;
textFrame.Text = "Hello World";
shape.TextFrame.Paragraphs[0].Portions[0].PortionFormat.FillFormat.SolidFillColor.Color = Color.HotPink;
// has one Shape
Console.WriteLine(inPres.Slides.Count);
// should obviously be 'Color [A=255, R=255, G=105, B=180]'
var inColor = shape.TextFrame.Paragraphs[0].Portions[0].PortionFormat.FillFormat.SolidFillColor.Color;
Console.WriteLine(inColor);
outPres.Slides.RemoveAt(0);
var slideClone = outPres.Slides.AddClone(inPres.Slides[0]); // this is where the magic happens, or fails to happen in your case
// has also one Shape
Console.WriteLine(slideClone.Shapes.Count);
var autoShape = slideClone.Shapes[0] as AutoShape;
// is really our 'Hello World' shape
Console.WriteLine(autoShape.TextFrame.Text);
var outColor = autoShape.TextFrame.Paragraphs[0].Portions[0].PortionFormat.FillFormat.SolidFillColor.Color;
// this should also be 'Color [A=255, R=255, G=105, B=180]' but is 'Color [A=255, R=0, G=0, B=0]'
Console.WriteLine(outColor);
// this should be true
Console.WriteLine(outColor == inColor);
}
}
}
}