I have a PowerPoint PPTX file created with a single TextBox.
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,
Hi Mudassir,
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,
Hi Mudassir,
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,
Hi Mudassir,
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,
Hi Mudassir,
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,
Hi Mudassir,
Hi James,
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.
<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>
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.
Hi Yves,
We are sorry for your inconvenience,
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
Hi Yves,
Just purchased Total.Net and came back to this issue. In the current latest version the problem still seems to exists…
FYI: Using version 15.9.0.0. So the latest version and the problem still exists.