Two (unrelated) problems with white boxes appearing on slides

Hi there, as per the title, here are the problems:

Problem 1: After cloning a particular slide from a presentation into a new presentation, when adding a rectangle and textframe to the slide, the formatting is also modified on one of the existing slide objects resulting in a text area becoming white with white text. This does not happen if the slide is not cloned first, but unfortunately that is unavoidable - this is a condensed version of what happens in our app.

// open source pres
Presentation source = new Presentation (“white_box_problem_1.ppt”);

// create new empty pres
Presentation target = new Presentation ();

// clone slide from source into new pres
Slide newSlide = source.CloneSlide (source.GetSlideByPosition (1), 1, target, new System.Collections.SortedList ());

// remove blank slide from the new pres
target.Slides.Remove (target.GetSlideByPosition (target.Slides.LastSlidePosition));

// add text tag to slide
Aspose.Slides.Rectangle r = newSlide.Shapes.AddRectangle (0, 0, 1000, 300);
r.FillFormat.Type = FillType.Solid;
r.FillFormat.BackColor = Color.Black;
r.AddTextFrame (“Unapproved”);
r.TextFrame.FitShapeToText = true;

// save new pres with cloned slide to a new file
target.Write (“white_box_output_1.ppt”);

Problem 2: This is less of an issue for us, but when exporting a thumbnail of a slide at a small size, white boxes are appearing:

Presentation source = new Presentation (“white_box_problem_2.ppt”);
Slide slide = source.GetSlideByPosition (1);
System.Drawing.Image img = slide.GetThumbnail (new Size (150, 113));
img.Save (“white_box_output_2.png”, ImageFormat.Png);

Please see the attached file for the presentations used in these examples. Thanks.

Dear emad,

Thank you for using Aspose.Slides

Please change this line

r.FillFormat.BackColor = Color.Black;

to this line

r.FillFormat.ForeColor = Color.Black;

Second issue seems to be a bug, I will report it for a fix.

Hi, thanks for looking into this.

I’m afraid the code you posted does not fix the problem we’re having though - in fact it highlights the error. When run on the provided slide, altering the FillFormat for the Rectangle I added to the slide also alters the FillFormat for a textbox that exists on the original slide (the textbox containing “Dusan Stefoski, MD…”).

Dear emed,

I have generated two slides namely WithBackColorSetAsBlack.ppt and WithForeColorSetAsBlack.ppt by setting the

r.FillFormat.BackColor and r.FillFormat.ForeColor properties as Color.Black respectively.

I did not see as you said "text area becoming white with white text."

Please see the output presentations.

Further, do you want to add a rectangle with text or just a textbox.

In later case, your code will look like this.

Aspose.Slides.Rectangle r = newSlide.Shapes.AddRectangle(0, 0, 1000, 300);

r.LineFormat.ShowLines = false;

r.AddTextFrame("Unapproved");

r.TextFrame.FitShapeToText = true;

Please see JustTextBox.ppt

All generated presentations are attached with in a zip file.

As you can see, the FillFormat for a textbox that exists on the original slide (the textbox containing "Dusan Stefoski, MD...") is not altered.

I am using Aspose.Slides 2.6.26.0

Hi there,

Did you clone the slide into a new presentation before modifying it, as my example code does? It seems this problem only occurs after that has taken place - as I mentioned before though, this is something we’re not able to avoid, our app extracts slides from a presentation in one place (creating individual .ppt files for each slide), and the text tag is added to a selection of slides at a later time (we do want the white box around the added text too, but thanks for the suggestion).

We are using version 2.6.26.0 already, but I downloaded the dll and ran my code again just in case, with the same problematic results - hence my assumption that your test case did not include the cloning step, as that is the only difference I can think of. I have attached an example of what happens when my example code is run on the slide I provided in the first post.

Thanks.

Dear emed,

I have used the same code given by you. It might be, your condensed version works fine than the original one. Please see the attached project and created presentation in the debug directory.

You can also re-run it and see the output.

Hello again

I tried the project you provided, and much to my surprise, it did indeed work fine… however when I add in the license loading, the white box is back.

Thanks.

Thank you for informing me, I will check it and report it for a fix.

Dear emed,

This problem has been rectified in Aspose.Slides 2.7.8.0, which you can download from this link.

Thank you.