Java Slides - set table text without losing existing text format

Hi,

I would like to set text in an existing table which I find in a slide but i don’t want to lose the text/cell format, which is what happens with this code:

public void table(ISlide slide) {
	ITable table = (ITable)slide.findShapeByAltText("MY_TABLE");
	for (int i=1;i<=7;i++) {		
		
		table.getRows().get_Item(i).get_Item(0).getTextFrame().getParagraphs().get_Item(0).setText("My Text");	
		table.getRows().get_Item(i).get_Item(1).getTextFrame().getParagraphs().get_Item(0).setText("My Text");		
		table.getRows().get_Item(i).get_Item(2).getTextFrame().getParagraphs().get_Item(0).setText("My Text");
		table.getRows().get_Item(i).get_Item(3).getTextFrame().getParagraphs().get_Item(0).setText("My Text");
		table.getRows().get_Item(i).get_Item(4).getTextFrame().getParagraphs().get_Item(0).setText("My Text");
		
	}	
}

Thanks,
Andy

@andysteady,

I have observed your requirements and like to share that the fonts related properties are set on portion level of paragraph. You need to set the text on portion levels in order to maintain the text formatting related properties. Please try using following alternate on your end.

table.getRows().get_Item(i).get_Item(0).getTextFrame().getParagraphs().get_Item(0).getPortionss().get_Item(0).setText("My Text");

One thing that you have to ensure that if your paragraph contains a text of different formatting like fonts, colors and sizes then there will be a separate portion for each of that entity in paragraph.

perfect thanks