How to use password with TfrxReport in Dephi.




object frmMain: TfrmMain
  Left = 0
  Top = 0
  Caption = 'frmMain'
  ClientHeight = 242
  ClientWidth = 527
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'Tahoma'
  Font.Style = []
  OldCreateOrder = False
  PixelsPerInch = 96
  TextHeight = 13
  object Button_SHOW: TButton
    Left = 96
    Top = 56
    Width = 105
    Height = 25
    Caption = 'Show report'
    TabOrder = 0
    OnClick = Button_SHOWClick
  end
  object Button_Design: TButton
    Left = 207
    Top = 56
    Width = 105
    Height = 25
    Caption = 'Design report'
    TabOrder = 1
    OnClick = Button_DesignClick
  end
  object frxReport1: TfrxReport
    Version = '5.5.8'
    DotMatrixReport = False
    IniFile = '\Software\Fast Reports'
    PreviewOptions.Buttons = [pbPrint, pbLoad, pbSave, pbExport, pbZoom, pbFind, pbOutline, pbPageSetup, pbTools, pbEdit, pbNavigator, pbExportQuick]
    PreviewOptions.Zoom = 1.000000000000000000
    PrintOptions.Printer = 'Default'
    PrintOptions.PrintOnSheet = 0
    ReportOptions.CreateDate = 42674.393283773150000000
    ReportOptions.LastChange = 42674.394386006940000000
    ReportOptions.Password = '123456'
    ScriptLanguage = 'PascalScript'
    ScriptText.Strings = (
      'begin'
      ''
      'end.')
    Left = 32
    Top = 16
    Datasets = <>
    Variables = <>
    Style = <>
    object Data: TfrxDataPage
      Height = 1000.000000000000000000
      Width = 1000.000000000000000000
    end
    object Page1: TfrxReportPage
      PaperWidth = 210.000000000000000000
      PaperHeight = 297.000000000000000000
      PaperSize = 9
      LeftMargin = 10.000000000000000000
      RightMargin = 10.000000000000000000
      TopMargin = 10.000000000000000000
      BottomMargin = 10.000000000000000000
      object Memo1: TfrxMemoView
        Left = 3.000000000000000000
        Top = 33.000000000000000000
        Width = 266.000000000000000000
        Height = 16.000000000000000000
        Memo.UTF8W = (
          'Hello world to design report you can user password = 123456')
      end
    end
  end
end



unit fMain;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
  System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, frxClass, Vcl.StdCtrls, frxDesgn;

type
  TfrmMain = class(TForm)
    frxReport1: TfrxReport;
    Button_SHOW: TButton;
    Button_Design: TButton;
    procedure Button_DesignClick(Sender: TObject);
    procedure Button_SHOWClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  frmMain: TfrmMain;

implementation

{$R *.dfm}

procedure TfrmMain.Button_DesignClick(Sender: TObject);
begin
  frxReport1.Clear;
  frxReport1.LoadFromFile('..\..\Demo.fr3');
  frxReport1.DesignReport;
end;

procedure TfrmMain.Button_SHOWClick(Sender: TObject);
begin
  frxReport1.Clear;
  frxReport1.ReportOptions.HiddenPassword := '123456';
  frxReport1.LoadFromFile('..\..\demo.fr3');
  frxReport1.ReportOptions.HiddenPassword := '';
  frxReport1.ShowReport;
end;

end.


Comments