We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Add margin/ space for images in paragraph

Hi,

I am adding multiple images to a single paragraph as I need the pictures to be on the same line, but I couldn't find a way of adding margin/ space between each image.

IWParagraph firstParagraph = table[1, 0].AddParagraph();

            foreach (var pic in item.Pictures)
            {              
                IWPicture picture = firstParagraph.AppendPicture(pic);

                picture.Width = 125;
                picture.Height = 125;    
            }

Attachment: Sample_(2)_e3dd7517.zip

1 Reply

DB Dilli Babu Nandha Gopal Syncfusion Team March 28, 2019 04:28 PM UTC

Hi Hershi, 
 
Thank you for contacting Syncfusion support. 
 
To meet your requirement, we suggest you append space between pictures and set character spacing using CharacterSpacing API to preserve pictures with defined space in same line. Please refer the below modified code example:  
 
foreach (var pic in item.Pictures)  
{  
    IWPicture picture = firstParagraph.AppendPicture(pic);  
  
    picture.Width = 125;  
    picture.Height = 125;  
  
    //Append text in paragraph.  
    IWTextRange textRange = paragraph.AppendText(" ");  
    //Set character spacing.  
    textRange.CharacterFormat.CharacterSpacing = 2;  
}  
 
Regards, 
Dilli babu. 


Loader.
Live Chat Icon For mobile
Up arrow icon