Html Export with resized images missing width and height
Posted: Tue Jan 21, 2025 8:15 pm
Hi,
I use the TRichView-component to generate the html-body of Outlook messages. With latest update of the component the width and heigth attributes are no longer written. Now the html row looks like
<p class=rvps2><img alt="" style="width : 328px; height : 77px; vertical-align: bottom;" src="Mail127451_1"></p>
with previous version it was
<p class=rvps2><img alt="" width = 328 height = 77 style="width : 328px; height : 77px; vertical-align: bottom;" src="cid:Mail127451_1"></p>
So in Outlook the image is not sized to 328x77, but it is shown with the original dimension.
The html is created by
frmDBRichViewEdit.RichViewEdit1.InnerEditor.SaveHTMLToStreamEx(Stream, IncludeTrailingBackSlash(TempPath), '',
'Mail' + IntToStr(IDDocumento) + '_', '', '', '', [rvsoImageSizes]);
So i tried to set the ImageOptions of the component
frmDBRichViewEdit.RichViewEdit1.InnerEditor.HTMLSaveProperties.ImageOptions := frmDBRichViewEdit.RichViewEdit1.InnerEditor.HTMLSaveProperties.ImageOptions + [rvhtmlsioImageSizeAttributes];
but it seems this is ignored by the SaveHTMLToStreamEx
so i changed in RichView.pas, SaveHTMLToStreamEx, by adding a line
SavingData.ImageOptions := GetHTMLSaveProperties.ImageOptions
and so the width and heigth attributes are added to the hmtl-code.
Is there another way or could you fix this?
Best regards
Toni Santa
I use the TRichView-component to generate the html-body of Outlook messages. With latest update of the component the width and heigth attributes are no longer written. Now the html row looks like
<p class=rvps2><img alt="" style="width : 328px; height : 77px; vertical-align: bottom;" src="Mail127451_1"></p>
with previous version it was
<p class=rvps2><img alt="" width = 328 height = 77 style="width : 328px; height : 77px; vertical-align: bottom;" src="cid:Mail127451_1"></p>
So in Outlook the image is not sized to 328x77, but it is shown with the original dimension.
The html is created by
frmDBRichViewEdit.RichViewEdit1.InnerEditor.SaveHTMLToStreamEx(Stream, IncludeTrailingBackSlash(TempPath), '',
'Mail' + IntToStr(IDDocumento) + '_', '', '', '', [rvsoImageSizes]);
So i tried to set the ImageOptions of the component
frmDBRichViewEdit.RichViewEdit1.InnerEditor.HTMLSaveProperties.ImageOptions := frmDBRichViewEdit.RichViewEdit1.InnerEditor.HTMLSaveProperties.ImageOptions + [rvhtmlsioImageSizeAttributes];
but it seems this is ignored by the SaveHTMLToStreamEx
so i changed in RichView.pas, SaveHTMLToStreamEx, by adding a line
SavingData.ImageOptions := GetHTMLSaveProperties.ImageOptions
and so the width and heigth attributes are added to the hmtl-code.
Is there another way or could you fix this?
Best regards
Toni Santa