This is a migrated thread and some comments may be shown as answers.

ImageInline Image.LockAspectRatio = true no effects

1 Answer 226 Views
This is a migrated thread and some comments may be shown as answers.
Dario Concilio
Top achievements
Rank 2
Dario Concilio asked on 09 Apr 2018, 02:43 PM

Hi guys,

I'm trying to add an ImageInLine into header (a classical Logo Company).

I would keep aspect ratio of my bitmap, but after export to word, it takes not effects.

I tryed to change PreferRelativeToOriginalResize to true and to false, when I try to open properties of image (into generated word file), I found this propertiy correctly changed.

But if I try to do same approach with LockAspectRatio to true and to false, It's ever false. Why?

This is my code to test.

I attached 4 test bitmap, 2 for PreferRelativeToOriginalResize (correctly results) and 2 for LockAspectRatio (wrong results)

editor.Document.HasDifferentEvenOddPageHeadersFooters = false;
var header = editor.Document.Sections.First().Headers.Add();
var image = header.Blocks.AddParagraph().Inlines.AddImageInline();
using (FileStream fs = File.Open(@"Resources\mylogo.jpg", FileMode.Open))
    image.Image.ImageSource = new Telerik.Windows.Documents.Media.ImageSource(fs, ".jpg");
    //image.Image.PreferRelativeToOriginalResize = false;
    image.Image.LockAspectRatio = true;
    //image.Image.SetWidth(true, 40);

1 Answer, 1 is accepted

Sort by
Telerik team
answered on 12 Apr 2018, 01:14 PM
Hi Dario,

Thank you for the detailed information.

I was able to find the reason for the unchecked checkbox and it is related to a missing declaration of an XML element that instructions the UI to lock the aspect ratio. Although the LockAspectRatio property is applied in the exported document, there is one more property of an additional element which should be defined but it is currently not. I created an item in our backlog regarding this issue and would suggest you to follow it so you can be notified of status changes on it. Your Telerik points are updated in appreciation for bringing this to our attention.

There is also another known issue which might affect you when you set the width of the image but we can propose a workaround for it. Please, check the information in this public feedback item for more details.

Hope this information is helpful.

Progress Telerik

Asked by
Dario Concilio
Top achievements
Rank 2
Answers by
Telerik team
Share this question