//Loads existing Word document.
WordDocument document = new WordDocument("Template.docx");
WParagraph paragraph = document.LastParagraph;
//Get the picture in the Word document.
WPicture picture = paragraph.ChildEntities[1] as WPicture;
//Set width for picture.
picture.Width = 200;
//Set height scale based on the width scale factor.
picture.HeightScale = picture.WidthScale;
//Saves and closes the document instance
document.Save("Result.docx");
document.Close();
|
//Loads existing Word document.
WordDocument document = new WordDocument("Template.docx");
WParagraph paragraph = document.LastParagraph;
//Get the picture in the Word document.
WPicture picture = paragraph.ChildEntities[1] as WPicture;
//Set height for picture.
picture.Height = 300;
//Set width scale based on the height scale factor.
picture.WidthScale = picture.HeightScale;
//Saves and closes the document instance
document.Save("Result.docx");
document.Close(); |