Delphi solves web Cross reporting problems with server components (2)

Source: Internet
Author: User

The Fast report is a classic reporting control, but its export functionality only supports exporting to disk files, and this project requires that the report generated by fast reports be exported to a memory stream for the purpose of bypassing permissions and for server security, so modify the fast reporting source.

The export function of Fast Report2.5 is declared in the Fr_class file, referencing this function to easily write out functions that are exported to the memory stream:

Add support for exporting to a memory stream--conch 2007-09-10--
Procedure Tfrreport.exporttostream (Filter:tfrexportfilter; Stream:tmemorystream);
Var
s:string;
Flag, Needconnect:boolean;
Begin
Docmode: = dmprinting;
Fcurrentfilter: = Filter;
if (Preview <> nil) and (Emfpages.count = 0) Then
Begin
Preview.disconnect;
Needconnect: = True;
End
Else
Needconnect: = False;

Flag: = True;
If assigned (Fcurrentfilter.onbeforeexport) then
Fcurrentfilter.onbeforeexport (Fcurrentfilter.filename, Flag);
Fcurrentfilter.stream: = Stream;

Curreport: = Self;
Masterreport: = Self;
Savedallpages: = Emfpages.count;

Fcurrentfilter.onbegindoc;
Exportbeforemodal (Self);

If assigned (Fcurrentfilter.onafterexport) then
Fcurrentfilter.onafterexport (Fcurrentfilter.filename);

If Needconnect Then
Preview.connect (Self);
Fcurrentfilter: = nil;
End

Similarly, the Tfrhtml2export control modifies the Tfrhtml2export.onenddoc function by keeping the CSS file separate from HTML, so that the HTML content in the memory stream cannot be displayed because of a lack of CSS. Find Savestringtofile (imagefolderfull + ' + cssfile, s) from this function (FR2.5 in line No. 461), instead:

    if FileName <> '' then
      SaveStringToFile(ImageFolderFull + '' + CSSFile, s)
    else begin
      s := '<style type=''text/css''>' + LF + s + LF + '</style>' + LF;
      Stream.Write(s[1], Length(s));
    end;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.