I am trying to add small icons/images to a portion within a paragraph. Below is the code I have but it doesn’t seem to work. To give more context, I am trying to do this inside of a SmartArtNode (OrganizationChart layout). Can you please tell me if this is supported.
var parag = new Paragraph();
var indPortion = new Portion();
indPortion.PortionFormat.FillFormat.FillType = FillType.Picture;
indPortion.PortionFormat.FillFormat.PictureFillFormat.PictureFillMode = PictureFillMode.Tile;
Image img = (Image)new Bitmap(imageFilePath + "exception-icon.jpg");
IPPImage imgx = presentation.Images.AddImage(img);
indPortion.PortionFormat.FillFormat.PictureFillFormat.Picture.Image = imgx;
parag.Portions.Add(indPortion);
node.TextFrame.Paragraphs.Add(parag);
Hi, attached (pptx file in zip format) is the Org Chart layout that I want to create. Basically I am trying to add images to the Org Chart Node (like the exclamation icon and the arrows icon on the top node in the slide). I tried to do this using code I posted previously but it doesn’t seem to work. TestOrgChart.zip (67.7 KB)
I have observed your requirements. You are actually trying to add an image along a text frame. I like to share that you cannot add an image inside a text frame even in PowerPoint. Actually, you need to get the desired paragraph actual position and then add a picture frame on that position to give an impact that image is added inside text frame. The same thing is observable even in presentation file shared by you. I suggest you to please try using following sample code on your end to get the actual paragraph position and then adding a picture frame on that position.
Hi, Thanks for your reply. I tried this approach but I am having trouble finding the correct position to add the image. I want to add the image right next to the last paragraph/portion inside the top node. However the code below places the image in the wrong location (almost in the middle of the slide). See attached presentation.
private RectangleF GetImagePosition(ISmartArtNode node)
{
var shape = node.Shapes.Last();
var lastParag = node.TextFrame.Paragraphs.Last().GetRect();
return new RectangleF(shape.X + lastParag.X + lastParag.Width, shape.Y + lastParag.Y, lastParag.Width, lastParag.Height);
}<a class="attachment" href="/uploads/default/8834">TestOrgChartv2.zip</a> (64.8 KB)
I request you to please provide a working sample project along with source presentation, generate presentation and desired output presentation. I will investigate the issue further on my end on provision of requested information to help you out.
Hi, Attached is the .NET console application. When you run the app, a presentation file is created in the ‘outputs’ folder. I have also attached the generated and desired presentation files. To re-iterate I need to place multiple images within the node and next to (or as close to) the last paragraph of the node.
Thank you for sharing the information with us. I have observed your requirements and have tried different alternates on my end. However, the API does not support getting actual coordinates for SmartArt node at the moment which may be cause of not fulfilling the complete requirement. An issue with ID SLIDESNET-39507 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be automatically notified once the issue will be resolved.
Hi, Thanks for looking into this. Any idea when the issue will be resolved?
We are a paid support customer. Will this help in prioritizing this issue higher and getting a hotfix?
We have just added the issue in our issue tracking system and at the moment it is pending in issues queue. You need to log the issue separately in Paid Support Helpdesk, if you ought to avail Paid support. You may share the issue ID SLIDESNET-39507 in Paid Support Helpdesk ticket.