Form Controls within PPTX corrupting file


#1

I have a PowerPoint PPTX file created with a single TextBox.


I can load this PPTX file using the Presentation class (from Aspose.Slides 13.12.0.0).

I can access the control using the following code:

string controlSlideFileName = “TextBoxTest.pptx”;
Presentation pres = new Presentation(controlSlideFileName);
var ctl = pres.Slides[0].Controls[0];

ctl now contains a property “ClassId” but is unfortunately all 0s (Guid.Empty).

If I attempt to set the “Text” property of the Textbox, and save, the saved file is corrupt:

ctl.Properties[“Text”] = “Some other text”;
pres.Save(“TextBoxTest2.pptx”, Aspose.Slides.Export.SaveFormat.Pptx);

I attach the original PPTX, the saved PPTX, and the error messages. Please also note the difference in filesize between the original and saved PPTX files.




#2

Hi James,

I have observed the requirements shared by you and suggest you to please visit this documentation link for your kind reference. I have worked with the shared sample code and have been able to generate the presentation with changed text on ActiveX Control. For your kind reference, the generated presentation is also attached.

Many Thanks,


#3

Hi Mudassir,


Thanks for your response. I have attempted to open the file you have generated and I receive the same error message as in my screenshot.

We have tried to open the file in both PowerPoint 2013 and PowerPoint 2010.

Can I ask, what version of PowerPoint does it open for you in?

Thanks,


#4

Hi James,

I like to share that I have used the following sample code for generation of presentation on my end. With the sample code, I am able to generate the presentation with changed text for ActiveX control as attached in snapshot given. However, I am getting presentation repair message while opening the presentation and for this an issue with ID SLIDESNET-34966 has been created in our issue tracking system to further investigate and resolve it.


public static void TestActiveX()
{
String path = @“D:\Aspose Data”;
string controlSlideFileName = path+“TextBoxTest.pptx”;
Presentation pres = new Presentation(controlSlideFileName);
var control = pres.Slides[0].Controls[0];

if (control.Name == “TextBox1” && control.Properties != null)
{
string newText = “Changed text”;
control.Properties[“Value”] = newText;

// changing substitute image. Powerpoint will replace this image during activeX activation, so sometime it’s OK to leave image unchanged.

Bitmap image = new Bitmap((int)control.Frame.Width, (int)control.Frame.Height);
Graphics graphics = Graphics.FromImage(image);
Brush brush = new SolidBrush(Color.FromKnownColor(KnownColor.Window));
graphics.FillRectangle(brush, 0, 0, image.Width, image.Height);
brush.Dispose();
System.Drawing.Font font = new System.Drawing.Font(control.Properties[“FontName”], 14);
brush = new SolidBrush(Color.FromKnownColor(KnownColor.WindowText));
graphics.DrawString(newText, font, brush, 10, 4);
brush.Dispose();
Pen pen = new Pen(Color.FromKnownColor(KnownColor.ControlDark), 1);
graphics.DrawLines(
pen, new System.Drawing.Point[] { new System.Drawing.Point(0, image.Height - 1), new System.Drawing.Point(0, 0), new System.Drawing.Point(image.Width - 1, 0) });
pen.Dispose();
pen = new Pen(Color.FromKnownColor(KnownColor.ControlDarkDark), 1);
graphics.DrawLines(
pen, new System.Drawing.Point[] { new System.Drawing.Point(1, image.Height - 2), new System.Drawing.Point(1, 1), new System.Drawing.Point(image.Width - 2, 1) });
pen.Dispose();
pen = new Pen(Color.FromKnownColor(KnownColor.ControlLight), 1);
graphics.DrawLines(
pen,
new System.Drawing.Point[]
{
new System.Drawing.Point(1, image.Height - 1), new System.Drawing.Point(image.Width - 1, image.Height - 1),
new System.Drawing.Point(image.Width - 1, 1)
});
pen.Dispose();
pen = new Pen(Color.FromKnownColor(KnownColor.ControlLightLight), 1);
graphics.DrawLines(
pen,
new System.Drawing.Point[] { new System.Drawing.Point(0, image.Height), new System.Drawing.Point(image.Width, image.Height), new System.Drawing.Point(image.Width, 0) });
pen.Dispose();
graphics.Dispose();
control.SubstitutePictureFormat.Picture.Image = pres.Images.AddImage(image);
}

pres.Save(path+“TextBoxTestNew.pptx”, Aspose.Slides.Export.SaveFormat.Pptx);

}


This thread has been linked with the issue so that you may be automatically notified once the issue will be resolved.

We are sorry for your inconvenience,

#5

Hi Mudassir,


Is there any update on the progress of this issue?

Thanks,
James

#6

Hi James,

I have verified from our issue tracking system and regret to share that the issue is still unresolved. However, we have scheduled the issue for investigation during Week 8/2014. We will be able to share the feedback with you after mentioned Week once our development team will share its feedback.

Many Thanks,


#7

Hi Mudassir,


It’s now Week 10/2014 - can I ask what the outcome of the review was?

#8

Hi James,





I have verified the issue status from our issue tracking system and regret to share that the issue has not yet been resolved. However, I have requested our development team to share the feedback in this regard. I will update you as soon as the feedback will be shared by our development team.



Many Thanks,


#9

Hi Mudassir,


Has there been any feedback from the development team yet?

Thanks,

#10

Hi James,

Our development team has investigated the root cause of the issue on their end. There was error related with ActiveX ClassId property processing. This issue is likely to get resolved in Aspose.Slides for .NET 14.2.0, which will be released today. However, at present the mechanism for ActiveX property changing is not implemented yet. And when you will try to change any ActiveX property, the presentation is broken. So, if you update the ActiveX property, it will result in broken presentation for the time being. The support for ActiveX modification will be incorporated in Aspose.Slides for .NET during Q3 of 2014 owing to already pending paid Enterprise and Priority support issues.

We will be able to share the further feedback with you as soon as the requested support will get available in Aspose.Slides for .NET.

We are sorry for your inconvenience,


#11

Hi Mudassir,


Thanks for your prompt and detailed response.

Where you say “the mechanism for ActiveX property changing is not implemented yet” does this mean modifying the ActiveX property via the Aspose API?

If I have a user update the property from within in PowerPoint, and then attempt to convert the file to PDF using Aspose from my code, will the value be available in the generated PDF?

Thanks,

#12

Hi James,


I have worked with the presentation TextBoxTest.pptx that has been shared by you in PowerPoint and have updated the ActiveX data. I have then access the presentation using Aspose.Slides for .NET 14.2.0 and then saved the presentation. The presentation generated by Aspose.Slides did not give any presentation repair message. For your kind reference, I have also attached the modified source and generated presentation files as well.

Many Thanks,

#13

I use version 14.10.0.0 and have the same issue as described here. I setup a Active-X text control. I setup a sample text content. I can red the value, but if I change the value and save the document all works fine. After I try open the document and gets the same “corrupted repair file” dialog described here.


#14
				<span id="ctl00_bcr_up___TextboxFirstName">Hi Yves,<br><br>I have observed the comment shared by you and request you to please share the sample presentation, generated presentation and Sample project reproducing the issue. I will add the ticket concerning to the issue in our issue tracking for your issue afterwards once the requested information will be shared.<br><br>Many Thanks,<br></span>

#15

Hello,

I use the following code to set the control value:

public void SetFormFieldValue(string name, string value)
{
if (_path.Length == 0) return;
var presentationSlides = _presentation.Slides;
foreach (ISlide presentationSlide in presentationSlides)
{
var controls = presentationSlide.Controls;
foreach (IControl control in controls)
{
if (control.Name == name && control.Properties != null)
control.Properties[“Value”] = value;
}
}
}

Call:

pp.SetFormFieldValue(“TOPIC”, “beispieltext”);
pp.Save(): // method called to save _presenation

I attach the sample powerpoint. I open it, seems fine. When I use the code on the powerpoint, it gets modified and saved. But after open the file again Powerpoint tells me the file is corrupt.




#16

Hi Yves,


Thank you for sharing the requested information. I have been able to reproduce the issue on my end. A separate ticket with ID SLIDESNET-36103 has been added in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be automatically notified once the issue will be resolved.

We are sorry for your inconvenience,

#17

Ok, thank you for the update.
Do you have any info how long a fix here would take?

Good news: We decided to you aspose in our project.
Side effect: As we need to support this, we rely on this feature, so it would be nice to know how long we will ahve to wait until a fix is available.

Thanks Yves


#18

Hi Yves,


First of all thank you for considering Aspose.Slides in your project. I like to share that the issue has just been added in our issue t tracing and is one of missing support. I have requested our development team to share the feedback in this regard that when the issue can be resolved. We will share the feedback with you as soon as the updates will be shared by our development team.

Many Thanks,

#19

Just purchased Total.Net and came back to this issue. In the current latest version the problem still seems to exists…


#20

FYI: Using version 15.9.0.0. So the latest version and the problem still exists.