Hi,
is it possible to paste an image from the internet into the RichViewEdit? I'm using RichViewActions and Indy.
Afaik I need to do something like this:
You use many undocumented methods in your code.
Please use InsertPicture and SetCurrentItemExtraIntProperty instead.
The example is here: http://www.trichview.com/forums/viewtopic.php?t=5247
It assigns string properties to the downloaded pictures (title and alt) using SetCurrentItemExtraStrProperty. You can set integer properties (width and height similarly), using SetCurrentItemExtraIntProperty.
OK, that works now pretty good.
But what if I want to paste html code including images from the clipboard?
Then I need to implement the RvHtmlImporter1ImageRequired2 event.
So, thats the actual problem. I can't insert images by myself in this event, beacuse it will do by itself. All I have to do is to override the "var Img: TGraphic" parameter, otherwise a default image will be added to the RichView content.
You cannot, the importer uses <img width height> from HTML, if they are specified.
They are passed as parameters to OnImageRequired2, so if you want to resize the graphic instead, you can do it.
so if you want to resize the graphic instead, you can do it.
Ehm, ok. How can I now resize the graphic in the OnImageRequired2 event?
Assigning the parameteres will be ignored, manuel inserting isnt possible too. I don't see any other way to resize the image.
You have to modify source code of the importer to make them var parameters.
Sorry, I do not want to make this change, because it's not useful for 99% of users.
I have a similar problem. In my software I have an error-report-system.
Next to simple TDBEdit-Fields for Version, Customer and some more
I use a TDBRichViewEdit for a description. The users insert screenshots
in this description. Also I make use of an "List & Label (c) combit"-Objekt,
for making a print. When I print such screenshots which are to wide,
the right part of the image wasn't printed.
My question is: Is there a possibility to run througt all image-objects
in the text to resize them to a maximum size? ... When I read about
the other questions from this board I'm nearly ashamed about asking
such simple question, but I don't find a solution myself. Maybe there is
already a very simple way.
Thanks for reading an a beautiful day.
Greetings from Germany
Hillebrand
const MAXPICTUREWIDTH=1000;
procedure TForm1.EnumItemsProc(RVData: TCustomRVData; ItemNo: Integer; var UserData1: Integer;
const UserData2: String; var ContinueEnum: Boolean);
var Gr: TGraphic;
VAlign: TRVVAlign;
Tag: TRVTag;
Name: TRVAnsiString;
begin
if (RVData.GetItemStyle(ItemNo)=rvsPicture) or
(RVData.GetItemStyle(ItemNo)=rvsHotPicture) then
begin
RVData.GetPictureInfo(ItemNo, Name, Gr, VAlign, Tag);
if Gr.Width>MAXPICTUREWIDTH then begin
RVData.SetItemExtraIntProperty(ItemNo, rvepImageWidth, MAXPICTUREWIDTH);
RVData.SetItemExtraIntProperty(ItemNo, rvepImageHeight, Round(Gr.Height*MAXPICTUREWIDTH/Gr.Width));
inc(UserData1);
end;
end;
ContinueEnum := True;
end;
// how to use
var Changed: Integer;
Changed := 0;
MyRichView.RVData.EnumItems(EnumItemsProc, Changed, '');
if Changed<>0 then
MyRichView.Format;
If I run this It looks great, but the change was lost
when I do a "Post" on the DataSet.
Is there something I have to do so that the change is registred
by the TDBRichViewEdit? Something like "BeginEdit(); ... EndEdit();"
Maybe to abtract to understand, but you can look at this Delphi-Example: www.hcbs.de/download/RichView.zip
Thanks for reading an a beautiful day.
Greetings from Germany
Hillebrand