we are a licensed user of Spire Doc and one of the things we do with it is to insert images into Word documents. We have found how to set the "Maintain aspect ratio" on Presentations but we have not found how to do it from Word documents.
Any hint would be helpful.
Here is how we are adding the images right now:
- Code: Select all
private static void AddImage(Section documentSection, byte[] imageBytes, float percent, int index, string imageId)
{
Paragraph paragraph = documentSection.AddParagraph();
DocPicture docPicture = paragraph.AppendPicture(imageBytes);
paragraph.AppendBreak(BreakType.PageBreak);
docPicture.TextWrappingStyle = TextWrappingStyle.InFrontOfText;
docPicture.VerticalOrigin = VerticalOrigin.Page;
docPicture.VerticalAlignment = ShapeVerticalAlignment.Center;
docPicture.HorizontalOrigin = HorizontalOrigin.Page;
docPicture.HorizontalAlignment = ShapeHorizontalAlignment.Center;
docPicture.HeightScale = percent * 100;
docPicture.WidthScale = percent * 100;
docPicture.Title = "AGN" + index;
docPicture.AlternativeText = imageId;
}