I am creating one slide PowerPoint file using open XML. I have tagged the placeholder in the PPT which i need to update programatically. I am able to find the placeholder and can update its value from the database.
Now the problem is I need to display some HTML code which user has input using WYSIWYG editor in a same format as user has entered e.g. like in bullets.
When i try to replace the place holder with the HTML text, the HTML text was pasted as is like all the tags etc.
var presPart = myPres.PresentationPart;
var slideIdList = presPart.Presentation.SlideIdList;
var list = slideIdList.ChildElements
.Cast<SlideId>()
.Select(x => presPart.GetPartById(x.RelationshipId))
.Cast<SlidePart>();
var tableSlidePart = (SlidePart)list.First();
var secondSlidePart = (SlidePart)list.Last();
var current = tableSlidePart;
Below line is working fine when i need to paste simple plane text
List<DocumentFormat.OpenXml.Drawing.Text> textList = tableSlidePart.Slide.Descendants<DocumentFormat.OpenXml.Drawing.Text>().Where(t => t.Text.Equals("IntroText")).ToList();
foreach (DocumentFormat.OpenXml.Drawing.Text text in textList)
{
text.Text = "Some Text";
}
But when i wanted to paste HTML into the placeholder it is treated as normal plain string.
textList = null;
textList = tableSlidePart.Slide.Descendants<DocumentFormat.OpenXml.Drawing.Text>().Where(t => t.Text.Equals("##DESCRIPTION##")).ToList();
foreach (DocumentFormat.OpenXml.Drawing.Text text in textList)
text.Text = "<html><table><tr><td><b>Hello</b></td></tr></table></html>";
Any help or pointer would be appreciated. Thank you in advance