Replacement of Texts in Table fails on PPT


#1

The following code fails to replace texts in table on PPT file, while it is OK when I convert it into PPTX using Microsoft PowerPoint 2016. Why?

test.zip (122.3 KB)

I just want to know the reason why it differs from PPT to PPTX. Thanks in advance.

Aspose.Slides, Version=18.6.0.0
netstandard2.0


//string infile = "test.ppt";
string infile = "test.pptx";

string ext = Path.GetExtension(infile);
string outfile = Path.GetFileNameWithoutExtension(infile) + "_replaced" + ext;

using (Presentation pres = new Presentation(infile))
{
    foreach (ISlide sld in pres.Slides)
    {
        foreach (IShape shp in sld.Shapes)
        {
            string typeName = shp.GetType().Name;
            if (typeName == "AutoShape")
            {
                ((IAutoShape)shp).TextFrame.Text = "ReplacedTextsInAutoShape";
            }
            else if (typeName == "Table")
            {
                foreach (IRow row in ((ITable)shp).Rows)
                {
                    foreach (ICell cell in row)
                    {
                        cell.TextFrame.Text = "REPLACEDTEXTSINTABLE";
                    }
                }

            }
        }
    }
    pres.Save(outfile, ext == ".ppt" ? SaveFormat.Ppt : SaveFormat.Pptx);
}

#2

@KDSSHO,

I have worked with the presentation file shared by you and have been able to observe the issue specified. An issue with ID SLIDESNET-40275 has been created in our issue tracking system to investigate the problem. This thread has been linked with the issue so that you may be notified once the issue will be fixed.


#3

Hi Mudassir Fayyaz,

Thank you for your confirmation.
I’m looking forward to being notified.


#4

@KDSSHO,

We will for sure update you as soon as the issue will be fixed.


#5

FYI it WAS OK as well when I open PPT and “save as” PPTX by altering the code above just as follows.

pres.Save(outfile, SaveFormat.Pptx); // stop judging the file extension

// I’m personally just a bit curious why Aspose.Slides needs SaveFormat flag for saving the file.


#6

@KDSSHO,

There is no issue if you load a PPT and save that as PPTX. We will be investigating the issue on our end and will share feedback with you ASAP.