If you set the width of the image when you are inserting it, it will get properly exported in the HTML.
As for why the approach you mention is not applicable: Spans can contain only text , so you cannot add an image to a span. The document is split into spans according to its formatting - adjacent spans with similar formatting are merged and vice versa, when you have some text with uniform formatting and change the font size, fore color or any other property of a part of it, the span gets split into 2 or 3 others. That is why it won't make much sense to set a Height or Width to a span.
In my opinion, the best approach would be to set the width and height of the image at the time of the insertion, like this:
ImageInline img =
(img.Width > maxwidth)
heightWidthRatio = img.Height / img.Width;
img.Width = maxwidth;
img.Height = maxwidth * heightWidthRatio;
The images will be exported with these setting and will be imported back properly.
If you are loading external HTML files that can contain larger images, you can traverse the document, find them and reset their size like this:
maxwidth = 100;
(image.Width > maxwidth)
heightWidthRatio = image.Height / image.Width;
image.Width = maxwidth;
image.Height = maxwidth * heightWidthRatio;
I hope that helps.
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Telerik Public Issue Tracking
system and vote to affect the priority of the items