Copy text from Preview

renerene Prague, Czech Republic, Europe
edited 12:48PM in FastReport 3.0
Hi to all,
is it possible to copy text from preview to the system clipboard? I mean manual (user) selection of text (eg. like text selection in Adobe Acrobat Reader).
Thanks for some hints,
Rene

Comments

  • edited 12:48PM
    yah,
    ;)

    i have problem like u rene, i want to select some text but i can't copy part of text.
    until now i prepared & export to text, load text to my own preview (like notepad).

    may be anybody could help

    thanks
  • edited 12:48PM
    Don't know of a way to cut a section from your report but you could always filter your data set and re-run your report.

    Wayne
  • edited 12:48PM
    if you try find button to search text,
    you will be find text highlight if found.
    could we get the text to clipboard?
  • renerene Prague, Czech Republic, Europe
    edited 12:48PM
    sange wrote:
    if you try find button to search text,
    you will be find text highlight if found.
    could we get the text to clipboard?
    Even this highlighted text couldn't be copied into clipboard. The only one solution is to enable users to edit whole page and after that designer is fired with current page. But this is to complicated for standard user. BFU is able to press some special button (like in PDF viewers) for text selection. I think such a issue should not be too difficult to solve because FR is using very good hierarchy of objects. But I suppose that at this moment it is not possible.
  • edited 12:48PM
    For small sections there is the Print Screen button on your keyboard. I frequently do this export into Paint to cut only what I want then paste that directly into a Word document. If you own PDF you probably could save the document in a PDF format and then cut the file from there.

    Wayne
  • renerene Prague, Czech Republic, Europe
    edited 12:48PM
    Quietman wrote:
    For small sections there is the Print Screen button on your keyboard.  I frequently do this export into Paint to cut only what I want then paste that directly into a Word document.  If you own PDF you probably could save the document in a PDF format and then cut the file from there.

    Wayne
    Wayne, I think you didn't catch it. I was asking about copying text portions from preview. Yes I can make some screenshot and copy bitmap or I can make TXT / PDF export and copy text out of there (or as I mention yesterday I can enable editing and switch prepared page into design and copy text from there), BUT all mentioned solutions have one in common - THEY ARE TOTALLY USER UNFRIENDLY. And because I think FR engine knows which object contains text (e.g. it could be searched and highlighted by Find method) I hope it is not very difficult feature and it will be included is some wishlist (and maybe in next version FR will surprise me).
    Rene
  • edited 12:48PM
    You can do this in frxReport.OnClickObject.

    This code copy unicode string from report to clipboard when you clicked on Object:
    procedure TForm1.frxReport1ClickObject(Sender: TfrxView;
      Button: TMouseButton; Shift: TShiftState; var Modified: Boolean);
    var
    hMem:Cardinal;
    pMem:Pointer;
    ByteCount:Integer;
    begin
    if Sender is TfrxMemoView then
    begin
     OpenClipboard(Handle);
     ByteCount := sizeof(WCHAR)*(Length(TfrxMemoView(Sender).Text)-1);
     hMem := GlobalAlloc(GMEM_MOVEABLE,ByteCount);
     pMem := GlobalLock(hMem);
     CopyMemory(pMem,Pointer(TfrxMemoView(Sender).Text),ByteCount);
     SetClipboardData(CF_UNICODETEXT,hMem );
     CloseClipboard();
     GlobalUnlock(hMem);
    end;
    end;
    
  • edited 12:48PM
    > Wayne, I think you didn't catch it. I was asking about copying text portions from
    > preview.

    I did understand what you meant however I didn't want to suggest you looking at fixing a bug in Fast Reports.

    It looks like when you do a Preview you are looking at data being painted on a canvas. Not exactly what you are looking for but if you press the Edit Report feature you'll see the data painted on the designer. If you try to copy a set of those controls you'll get a duplicate name exception. If you find a way to stop that exception from being generated you can probably copy that data.

    Problem with that is you have to modify the Fast Reports source which means you need to merge your code unless you create an inherited object and a new makefile. Not something most of us have times to do so I didn't suggest it.

    Wayne
  • edited 12:48PM
    wrote:
    You can do this in frxReport.OnClickObject.

    This code copy unicode string from report to clipboard when you clicked on Object:
    procedure TForm1.frxReport1ClickObject(Sender: TfrxView;
      Button: TMouseButton; Shift: TShiftState; var Modified: Boolean);
    var
    hMem:Cardinal;
    pMem:Pointer;
    ByteCount:Integer;
    begin
    if Sender is TfrxMemoView then
    begin
     OpenClipboard(Handle);
     ByteCount := sizeof(WCHAR)*(Length(TfrxMemoView(Sender).Text)-1);
     hMem := GlobalAlloc(GMEM_MOVEABLE,ByteCount);
     pMem := GlobalLock(hMem);
     CopyMemory(pMem,Pointer(TfrxMemoView(Sender).Text),ByteCount);
     SetClipboardData(CF_UNICODETEXT,hMem );
     CloseClipboard();
     GlobalUnlock(hMem);
    end;
    end;
    
    thanks, this code is work and usefull to me
  • renerene Prague, Czech Republic, Europe
    edited 12:48PM
    Quietman wrote:
    I did understand what you meant however I didn't want to suggest you looking at fixing a bug in Fast Reports. 
    Maybe I was not clear so: I did not think there is a bug in FR. My post were about "feature request" or "is it possible to do something". I change some FR code directly only if I am sure there is a bug or mistake (and I am posting them to FR team as suggestion of bug). I am not going to change the code of designer or preview, I use my own descendant classes - and if will be possible to made some changes at this level I will be satisfied. I will try mentioned code above and said if it helps.

    Anyway thanks for your posts (and sorry for my ),
    Ren?©
  • renerene Prague, Czech Republic, Europe
    edited 12:48PM
    Partial result: Looks like handling OnClickObject works good. At the moment I am able to change preview to SelectMode, let user to select/unselect each memo object and copy whole text from this objects (well I am also able to select/unselect all text objects by one action, but this is not the gist). Unfortunatelly frxPreview even frxReport does not have all mouse events (OnMouseDown, OnMouseUp, OnStartDrag ...) and I am not able to (easily) made some user friendly interface for text selection. I will try to implement it some other way and if I succes I will write it in here...

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.