Shape/image in table cell


I need to be able to add a shape or a picture of a certain color inside a cell and then set the width of the shape/image (it has to be different than the width of the cell). I managed to add image, but now it fills the entire cell. Please see picture attached to see a mock-up of what I need. Can you please let me know if this can be done?


Hi Ioan,

I have observed your comments. I request to you please follow guidelines on this link to achieve your requirements. Please share feedback with us if there is still an issue so that we may further investigate on our end.

Best Regards,

Hi Adnan,

Thanks for the quick response. I was able to add an image into the table cell. The problem is that i want to be able to change the width of that image according to the value of a parameter - this is what I’m not sure how to do.


Hi Ioan,

I have observed your requirements. I have shared a piece of code in text file with you. This code will help you to achieve your requirements. I also shared generated output with you. Please share feedback with us if their is still an issue.

Best Regards,

Hi Adnan,

Thank you for your help. This is exactly what i needed!


I need the code that u share to loan.


I have observed your comments. Can you please visit this documentation article. This will help you to achieve your requirements. Please share feedback with us if there is still an isssue.

Thank you Ahmad.But this solution will crop my image and i want to resize my image or adjust column padding.


Can you please provide the desired output that you are wanting on your end along with used sample code. I will investigate your requirements and help you further.

IMG_20180411_105254.jpg (1.6 MB)

I Have shared screenshot with you.In this I want to adjust my image in cell according to choice that is either i can change the image height and width or is there any option available to adjust cell pading.

//Adding image to slide
Bitmap image = new Bitmap(“C:\Users\Win-0\Images\Picture1.png”);
IPPImage imgx1 = pres.Images.AddImage(image);
// Add image to first table cell
cell.FillFormat.FillType = FillType.Picture;
cell.FillFormat.PictureFillFormat.PictureFillMode = PictureFillMode.Stretch;
cell.FillFormat.PictureFillFormat.Picture.Image = imgx2;


I have observed your requirements and like to share that Aspose.Slides let you set image inside cell as FillType of cell and it get fixed inside cell. I am afraid, what you are looking for is probably not possible using PowerPoint. If you are able to achieve this in PowerPoint then please share the sample presentation with us and we shall investigate that further on our end.

Thanx mudassir for your help.

Hey is there any possible way to change color of underline property or to apply line over top of text.


I have observed your requirements and like to share that Aspose.Slides does allow to format the underline properties and you may use the following sample code to serve the purpose on your end. However, there is no property to apply line over the top. You have strike-through property though that runs between center of text.

    public static void AddUnderLineText()
        Presentation pres = new Presentation();
        ISlide slide = pres.Slides[0];
        IAutoShape ashp = slide.Shapes.AddAutoShape(ShapeType.Rectangle, 30, 30, 200, 200);
        ashp.FillFormat.FillType = FillType.NoFill;
        ITextFrame text=  ashp.AddTextFrame("");
        IParagraph para = text.Paragraphs[0];
        IPortion portion = para.Portions[0];
        portion.PortionFormat.FillFormat.FillType = FillType.Solid;
        portion.PortionFormat.FillFormat.SolidFillColor.Color =Color.Black;

        // Set Underline property of the Font
        portion.PortionFormat.FontUnderline = TextUnderlineType.Double;

        portion.PortionFormat.IsHardUnderlineLine = NullableBool.True;
        portion.PortionFormat.UnderlineLineFormat.FillFormat.FillType = FillType.Solid;
        portion.PortionFormat.UnderlineLineFormat.FillFormat.SolidFillColor.Color = Color.Red;
        portion.PortionFormat.UnderlineLineFormat.Style = LineStyle.ThickThin;
        portion.PortionFormat.UnderlineLineFormat.Width = 2;

         portion.Text = "Underline text";
        pres.Save(@"C:\Aspose Data\Lineformat.pptx",Aspose.Slides.Export.SaveFormat.Pptx);