How to make an Image in .rvf Header Section (srvrveHeader)

ScaleRichView support and discussion (TRichView add-on for WYSIWYG editing)
Post Reply
pgkammath
Posts: 36
Joined: Fri Nov 24, 2017 6:16 am

How to make an Image in .rvf Header Section (srvrveHeader)

Post by pgkammath »

I have a .RVF file , which contains an Image in the (srvrveHeader) . This image can be Jpeg. I created this file as a template for a report, since I found adding a header dynamically, a bit complicated. (for me) . In some cases while printing, I want to Hide this image. Can someone show me how to make the image visible / invisible while printing . (please remember its in the header section (srvrveHeader). The version of Scalerichview is v9.3.1. Help would be appreciated, I am using this in a legacy application, which needs to be modified now. Thanks in advance
Sergey Tkachenko
Site Admin
Posts: 17602
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: How to make an Image in .rvf Header Section (srvrveHeader)

Post by Sergey Tkachenko »

You can hide the header completely, by assigning HeaderVisible = False.
You can also use "hidden text" feature, but when hidden content is shown, it is underlined with dotted lines.
pgkammath
Posts: 36
Joined: Fri Nov 24, 2017 6:16 am

Re: How to make an Image in .rvf Header Section (srvrveHeader)

Post by pgkammath »

Hi Sergey,
I am attaching a sample file, which was created using a Scalerichview editor, on which the requirement is based. In the attached file, there is an image. The requirement was turning the image on or off, dynamically. Alternately, is it possible to insert the image, there at runtime on demand. and keep the segment containing the Tags <UHID>, <PatientName> etc. on all pages. I am able to replace the tags , <UHID>, <PatientName> etc. correctly, with the values.

Thanks in advamce
Attachments
ANTI CCP_Trial template-With Header-trial.rvf
(127.93 KiB) Downloaded 1008 times
Sergey Tkachenko
Site Admin
Posts: 17602
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: How to make an Image in .rvf Header Section (srvrveHeader)

Post by Sergey Tkachenko »

I'll check this sample when I return from vacation (after June 27)
pgkammath
Posts: 36
Joined: Fri Nov 24, 2017 6:16 am

Re: How to make an Image in .rvf Header Section (srvrveHeader)

Post by pgkammath »

Thanks
Sergey Tkachenko
Site Admin
Posts: 17602
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: How to make an Image in .rvf Header Section (srvrveHeader)

Post by Sergey Tkachenko »

1. It is not possible to define different visibility of objects for the screen and for printing. And I do not plan to implement it, because it would kill a WYSIWYG idea.

2. There is a way to make this image hidden. In the ScaleRichView ActionTestTabs editor, start editing the header and click on the button "Hide" (with a spyglasses icon).

The code for switching visibility of hidden fragments is:

Code: Select all

  ActiveEditor.StartEditing(srvrveMain);
  if rvoShowHiddenText in ActiveEditor.RVOptions then
    ActiveEditor.RVOptions := ActiveEditor.RVOptions - [rvoShowHiddenText]
  else
    ActiveEditor.RVOptions := ActiveEditor.RVOptions + [rvoShowHiddenText];
  ActiveEditor.Format;
But there is a drawback: when a hidden fragment is shown, it is underlined with a dotted underline.
Although I can implement turning off this underline in future versions, you use an old version of ScaleRichView, so this underline cannot be removed.

3.
There are several ways to add graphic at the beginning of the header. The code shown below do it using non-editing operations (not undoable).

Adding image to the beginning of the header of ActiveEditor: TSRichViewEdit:

Code: Select all

uses
  RVGrHandler, RVInsertItems;

var
  Gr: TGraphic;
begin
  ActiveEditor.StartEditing(srvrveMain);
  Gr := RVGraphicHandler.LoadFromFile('d:\1.bmp');
  RVInsertGraphic(ActiveEditor.SubDocuments[srvhftNormalHeader], 0, Gr, False, 0);
  ActiveEditor.RichViewEdit.ClearUndo;
  ActiveEditor.Format;
end;
Deleting the first item in the header of ActiveEditor, if this item is a picture:

Code: Select all

var
  Header: TCustomRVData;
begin
  ActiveEditor.StartEditing(srvrveMain);
  Header := ActiveEditor.SubDocuments[srvhftNormalHeader];
  if (Header.ItemCount > 0) and (Header.GetItemStyle(0) = rvsPicture) then
    Header.DeleteItems(0, 1);
  if (Header.ItemCount > 0) then
    Header.GetItem(0).SameAsPrev := False;
  ActiveEditor.RichViewEdit.ClearUndo;
  ActiveEditor.Format;
end;
pgkammath
Posts: 36
Joined: Fri Nov 24, 2017 6:16 am

Re: How to make an Image in .rvf Header Section (srvrveHeader)

Post by pgkammath »

Thanks Sergey,
The code to add am image would be of great help to me.

For the Image off and on, I created two .rvf files withLogo.rvf and withoutlog.rvf and inserted / removed these into the headers when needed. This works fine for me now.

One more point I would like to know is , I append a .rvf file which contains a bmp/jpeg signature of a doctor to the main body. This is on validation by an authority. Now after this, one more validation may come, during which I want the earlier signature (bmp/jpeg image to be removed, and I will append a new image from another .rvf file.

Is this possible ?
Sergey Tkachenko
Site Admin
Posts: 17602
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: How to make an Image in .rvf Header Section (srvrveHeader)

Post by Sergey Tkachenko »

Do you want to add an image at the very end to the main document?
The code is almost identical to the code that I posted in my previous reply (assuming that you want to do it not as an edition operation.
The differences are:
- adding/deleting in the main document, not in the header;
- adding to / deleting from the end, not from the beginning.

Adding images:

Code: Select all

var
  Gr: TGraphic;
begin
  ActiveEditor.StartEditing(srvrveMain);
  Gr := RVGraphicHandler.LoadFromFile('signature.png');
  ActiveEditor.RichViewEdit.AddPictureEx('', Gr, 0, rvvaBaseline);
  ActiveEditor.RichViewEdit.ClearUndo;
  ActiveEditor.Format;
end;
(newer version should use AddPicture instead AddPictureEx.

Removing the last item, if it is a picture:

Code: Select all

var
  rve: TCustomRichViewEdit;
begin  
  ActiveEditor.StartEditing(srvrveMain);
  rve := ActiveEditor.RichViewEdit;
  if (rve.ItemCount > 0) and (rve.GetItemStyle(rve.ItemCount-1) = rvsPicture) then
    rve.DeleteItems(rve.ItemCount-1, 1);
  ActiveEditor.RichViewEdit.ClearUndo;
  ActiveEditor.Format;
end;
pgkammath
Posts: 36
Joined: Fri Nov 24, 2017 6:16 am

Re: How to make an Image in .rvf Header Section (srvrveHeader)

Post by pgkammath »

Thanks & Regards, Sergey.
pgkammath
Posts: 36
Joined: Fri Nov 24, 2017 6:16 am

Re: How to make an Image in .rvf Header Section (srvrveHeader)

Post by pgkammath »

Works Fine. Thanks, Sergey
Post Reply