We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to replace text with table


How can I replace text with a table in C#
thanks in advance

Hi Jon,

Thanks for your query.

I'm sorry I could not fully understand what actually you want to ask. As I understand, you are talking about how to replace text within a table?

For replacing text within cells of a table you can use following code snippet.

//Instantiate PresentationEx class that represents PPTX
PresentationEx pres = new PresentationEx(@"D:\ReplaceText.pptx");

//Access the first slide
SlideEx sld = pres.Slides[0];

//Initialize null TableEx
TableEx tbl = null;

//Iterate through the shapes and set a reference to the table found
foreach (ShapeEx shp in sld.Shapes)
if (shp is TableEx)
tbl = (TableEx)shp;

foreach (RowEx row in tbl.Rows)
foreach (CellEx cell in row){
if (cell.TextFrame.Text.Equals("ppt")) {
cell.TextFrame.Text = "pptx";
//Write the PPTX to Disk

Note: Reference Presentation is attached herewith