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

Resize Image

Hello

I am using Syncfusion ver 9.4.I want to add the logo in word header document.The image which i am inserting should be 100*100 size.The image is displaying in original size.I want to resize original image to 100*100 size.Please provide me a sample code to resize image in header using AppendPicture().
regards,
Sudhan

Code is attached below

IWParagraph headerPar = new WParagraph(doc);
// Add a new table to the header
IWTable table = section1.HeadersFooters.Header.AddTable();
RowFormat format = new RowFormat();

// Setting Single table border style.
format.Borders.BorderType = Syncfusion.DocIO.DLS.BorderStyle.Single;
headerPar = new WParagraph(doc);

IWTextBox textlogo = headerPar.AppendTextBox(100, 80);
textlogo.TextBoxFormat.LineColor = System.Drawing.Color.White;
textlogo.TextBoxBody.AddParagraph().AppendPicture(Image.FromFile(txtTemplate2.Text));


1 Reply

PR Poornima R Syncfusion Team February 23, 2012 10:35 AM UTC

Hi Sudhan,

Thank you for your interest in Syncfusion Products.

Regarding your requirement of “Resizing the picture”, you can utilize Height and Width property if the WPicture class as in the below code. We have also prepared the sample illustrating the same. Please find the sample from the below link. Try running the sample and let us know if this meets your requirement.

Code snippet:
IWPicture picture = textlogo.TextBoxBody.AddParagraph().AppendPicture(Image.FromFile(txtTemplate2.Text));
//Set picture height
picture.Height = 100;
//Set picture width
picture.Width = 100;

Sample:
http://www.syncfusion.com/downloads/Support/DirectTrac/90903/Sample-1433274898.zip


For more information about picture formatting, please refer the below online documentation link.
http://help.syncfusion.com/Ug_101/Reporting/DocIO/ASP.NET/default.htm#!documents/44141picture.htm

Please let us know if you have any questions.

Regards,
Poornima





Loader.
Live Chat Icon For mobile
Up arrow icon