Adding Shape to a table cell

Hi Team,

I am using Aspose slides 8.4.0 in my project, we have a requirement of adding shape to a Table cell. Can you assist on same? As i tried adding shape but then each shape needs to be provided with position but i need a way where the shape (up or down arrow) can be added to a table cell without giving position ,the same way as we can set text in a table cell.

Thanks.

Hi Ketan,

I have observed the requirements shared by you and request you to please share a sample presentation that has table cell with shape in it. I have tried adding the shape to table cell even in PowerPoint and have not been able to verify the feature supported there as well. Can you please provide a sample presentation with table cell having shape inside it. I will then add a request in our issue tracking system to verify if we can provide the requested support or not. At the moment this support is unavailable. The table cell has text frame that at present can be filled with color or images.

Many Thanks,

Thanks for prompt revert.

Agreed that within powerpoint you can not add shape to cell, so aspose doesnt support this feature. Can you share the code snippet to add a image to table cell so i can try this approach to get my requirement done.

Hi Ketan,

Please try using the following sample code on your end to serve the purpose. Please share, if I may help you further in this regard.

public static void testPPTXTable()
{

PresentationEx pres = new PresentationEx();

// Block-1, Added Table on first slide.
int sldIndx = 0;
double[] dblCols = { 200,200};
double[] dblRows = { 250,200};

SlideEx slide2 = pres.getSlides().get_Item(sldIndx);
ShapeExCollection shapeCol = slide2.getShapes();

int idx=shapeCol.addTable(33, 125, dblCols, dblRows);

TableEx tbl2 = (TableEx) shapeCol.get_Item(idx);

BufferedImage image=null;

try {
image = ImageIO.read(new File(“C:\Users\Public\Pictures\Sample Pictures\Desert.jpg”));
} catch (Exception e) { }

ImageEx imgx = pres.getImages().addImage(image);


CellEx cell2 = tbl2.get_Item(0, 0);

cell2.getFillFormat().setFillType(FillTypeEx.Picture);
cell2.getFillFormat().getPictureFillFormat().getPicture().setImage(imgx);

cell2.getFillFormat().getPictureFillFormat().setPictureFillMode(PictureFillModeEx.Stretch);
ParagraphEx paragraphEx2 =cell2.getTextFrame().getParagraphs().get_Item(0);

paragraphEx2.getPortions().get_Item(0).setText(“Test Data”);

pres.write(“D:\Aspose Data\testingIssue.pptx”);

}

Many Thanks,