Hi Anil,
Thanks for your response.
I re-checked it in Microsoft PowerPoint and indeed found that the character "_" was not replaced with the space, but the color was so light that it looked like a space. If I increase the font size to a certain degree or apply a bold style to it, I can see the character "_" in slide show mode, as shown below.
Created_by_MS_PowerPoint&in_slide_show_mode.png
As for the new code I provided, it could work great on my side. Also, I opened the PPT file you provided in several different versions of Microsoft PowerPoint, but did not encounter the problem you described. Which version of Microsoft PowerPoint are you using?
Different_versions_in_slide_show_mode.png
Besides, I tried to apply bold style to the character "_", like the below code, and it also works well on my side. Attached is my output file for your reference. Please try this code and then tell us your testing result. Looking forward to your further feedback.
- Code: Select all
Presentation presentation = new Presentation();
IAutoShape shape = presentation.Slides[0].Shapes.AppendShape(ShapeType.Rectangle, new RectangleF(100, 100, 300, 50));
shape.Slide.Timeline.MainSequence.AddEffect(shape, AnimationEffectType.Zoom);
shape.Fill.FillType = FillFormatType.Solid;
shape.Fill.SolidColor.Color = Color.White;
TextParagraph para1 = new TextParagraph();
Regex regx = new Regex("(_)");
string hyperlinkText = "_All_CEOs > President &_CEO > EVP, Human Resources";
string[] split = regx.Split(hyperlinkText);
foreach (string str in split)
{
TextRange tr = new TextRange(str);
para1.TextRanges.Append(tr);
tr.Format.FontHeight = 12;
tr.TextUnderlineType = TextUnderlineType.Single;
tr.UnderlineFillFormat.FillType = FillFormatType.Solid;
tr.UnderlineFillFormat.SolidColor.Color = Color.White;
tr.IsInheritUnderlineFill = TriState.True;
if (str.Equals("_"))
{
tr.Format.IsBold = TriState.True;
}
tr.ClickAction.Address = "http://www.e-iceblue.com";
}
shape.TextFrame.Paragraphs.Append(para1);
shape.TextFrame.Paragraphs.Append(new TextParagraph());
presentation.SaveToFile("hyperlink.pptx", FileFormat.Pptx2013);
hyperlink.zip
Sincerely,
Rachel
E-iceblue support team
Login to view the files attached to this post.