Free Support Forum - aspose.com

Fonts- Formating and Replacement values

Attached you will find an example of what we need to do.

At first you would think it is a simple replace logic but apparently it is not.

The problem is if I have a sentence that has multiple format in it to highlight information, it is getting overridden by the format of the first format in the "shape".

I have yet to find a reasonable work around for this. Please let me know what I need to do to accomplish the task in the example.

Thanks!

Hi William,

We are extremely sorry for the delay. We are working on your issue and will get back to you ASAP.

Thanks and Regards,

Hi William,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your patience. I have devised a workaround for you that wil fulfill your requirement. Please utilize the code snippet below to accomplish your task. I have also attached the output PPTX file for your reference.

PresentationEx pres = new PresentationEx("d://ppt//example.pptx");

//License lic = new License();

//lic.SetLicense("Aspose.Slides.Lic");

SlideEx slide = pres.Slides[0];

foreach (ShapeEx shp in slide.Shapes)

{

if (shp is AutoShapeEx)

{

AutoShapeEx ashp = (AutoShapeEx)shp;

if (ashp.TextFrame != null)

{

for (int paracount = 0; paracount < ashp.TextFrame.Paragraphs.Count; paracount++)

{

ParagraphEx para = ashp.TextFrame.Paragraphs[paracount];

foreach (PortionEx port in para.Portions)

{

port.Text = ParseValues(port.Text);

}

}

}

}

}

Response.ContentType = "application/vnd.ms-powerpoint";

Response.AppendHeader("Content-Disposition", "attachment; filename=export_example.pptx");

Response.Flush();

System.IO.Stream st = this.Response.OutputStream;

pres.Write(st);

Response.End();

Thanks are Regards,

Thanks Guys. It’s much appreciated.

Hmmmm.... this is interesting.

Did you know that for some reason that solution is font dependent?

Check out the attached pptx and run that against the exact same code.

I never thought that the font style would be an issue but I put that code with my production template which uses a different font and it would not work.

Thoughts?

-Wayne