云题海 - 专业文章范例文档资料分享平台

当前位置:首页 > Rave Report PDF and Intraweb

Rave Report PDF and Intraweb

  • 62 次阅读
  • 3 次下载
  • 2025/6/25 3:45:52

in the Project Manager, select the ServerController, and in

the Object Inspector, toggleIwServerController.AllowSubFolder to True declare a global tCriticalSection variable, initialize it and free it in the Initialization and Finalization section of the Unit: unit u_irp_safe_page; interface // -- ...ooo... implementation uses SyncObjs; {$R *.dfm} var // -- critical section to serialize the .PDF generation g_c_rave_critical_section: TCriticalSection= Nil; // -- ...ooo... initialization TIWForm1.SetAsMainForm; g_c_rave_critical_section:= TCriticalSection.Create; finalization g_c_rave_critical_section.Free; end

drop a tIwButton and create the OnClick event which will generate and display the .PDF report procedure TIWForm1.GenerateAndDisplayClick(Sender: TObject); var l_pdf_file_name: string; l_session_id_segment: String; procedure generate_pdf; var l_c_rave_dataset_connection: TRvDataSetConnection; begin ClientDataSet1.Close; ClientDataSet1.IndexFieldNames:= g_sort_column; ClientDataSet1.Open; RVProject1.ProjectFile:= WebApplication.ApplicationPath+ '..\\_data\\r_employee.rav'; with RvSystem1 do begin DoNativeOutput:= false; RenderObject:= RvRenderPDF1;

OutputFileName:= IWServerController.FilesDir

+ l_session_id_segment+ '\\'+ l_pdf_file_name; end; // with RvSystem1

// -- create the user specific path

ForceDirectories(ExtractFileDir(RvSystem1.OutputFileName)); // -- enter into the critical section g_c_rave_critical_section.Enter;

// -- create a new RvDataSetConnectoin

l_c_rave_dataset_connection:= TRvDataSetConnection.Create(self); try

l_c_rave_dataset_connection.Name:= 'my_rave_dataset_connection';

l_c_rave_dataset_connection.DataSet:= ClientDataset1; l_c_rave_dataset_connection.Name:= 'dataset_connection_'+ l_session_id_segment;

l_c_rave_dataset_connection.DataSet:= ClientDataset1;

RvProject1.ExecuteReport('Report1'); finally

l_c_rave_dataset_connection.Free; g_c_rave_critical_section.leave;

RvSystem1.OutputFileName:= ''; end; // try/finally end; // generate_pdf procedure display_pdf;

var l_pdf_url: String;

l_popup_page_name: string; l_popup_page_options: string; l_popup_parameter: String; begin

l_pdf_url:= WebApplication.AppURLBase+ '/files/'

+ l_session_id_segment+ '/'+ l_pdf_file_name; IwLabel2.Caption:= l_pdf_url;

l_popup_page_name:= 'the_report';

l_popup_page_options:= 'scrollbars=yes,width=500,height=300';

l_popup_parameter:= 'NewWindow(\ + l_pdf_url + '\\+ l_popup_page_name + '\+ l_popup_page_options + '\; AddToInitProc(l_popup_parameter); end; // display_pdf begin // GenerateAndDisplayClick l_session_id_segment:= WebApplication.AppID; l_pdf_file_name:= 'safe_report_' + g_sort_column+ '_'+ l_session_id_segment+ '.pdf'; generate_pdf; display_pdf; end; // GenerateAndDisplayClick

in the Project Manager, create the OnCloseSession event, and erase all PDF's of this session: procedure TIWServerController.IWServerControllerBaseCloseSession( ASession: TIWApplication); const k_path_delimiter= '\\'; var l_output_file_dir: string; l_search_record: TSearchRec; begin l_output_file_dir:= GServerController.FilesDir+ ASession.AppID; // -- CleanUp session's files directory if FindFirst(l_output_file_dir+ k_path_delimiter+ '*.*', faAnyFile, l_search_record)= 0 then begin repeat DeleteFile( l_output_file_dir+ k_path_delimiter+ l_search_record.Name); until FindNext(l_search_record)<> 0; FindClose(l_search_record); end; RemoveDir(l_output_file_dir); end; // IWServerControllerBaseCloseSession compile, run, type F9, click \

the PDF is displayed in a separate page, and, if you look at the FILES/ subfolder, you will see the session folder with the .PDF in it close the Intraweb Server the session folder is removed

We also tried to generate several kinds of reports, by changing some parameters of the tDataSet: the order, filtering rows etc (but NOT the column structure, which is hard coded in the .RAV)

drop a tIwListbox, with the list of some columns, and create the event which will

sort the ClientDataSet1: var g_sort_column: String= ''; procedure TIWForm1.IWListbox1Click(Sender: TObject); begin with IwListBox1 do case ItemIndex of 0 : g_sort_column:= 'EmpNo'; 1 : g_sort_column:= 'LastName'; 2 : g_sort_column:= 'PhoneExt'; else g_sort_column:= ''; end; // case ClientDataSet1.IndexFieldNames:= g_sort_column; end; // IWListbox1Click

run, select a PhoneExt sort, click \

the PDF is displayed sorted in PhoneExt order

you may repeat the operation with an other sort order

Please note that:

IwServerController.AllowSubFolder only exists for Intraweb versions after 5.1 ? the code within the critical section should be kept as short as possible

? there are many possible options for the pop-up page. We could use code like:

?

const k_options= 'toolbar=no,status=no,menubar=yes,scrollbars=yes'

搜索更多关于: Rave Report PDF and Intraweb 的文档
  • 收藏
  • 违规举报
  • 版权认领
下载文档10.00 元 加入VIP免费下载
推荐下载
本文作者:...

共分享92篇相关文档

文档简介:

in the Project Manager, select the ServerController, and in the Object Inspector, toggleIwServerController.AllowSubFolder to True declare a global tCriticalSection variable, initialize it and free it in the Initialization and Finalization section of the Unit: unit u_irp_safe_page; interface // -- ...ooo... implementation uses SyncObjs; {$R *.dfm} var // -

× 游客快捷下载通道(下载后可以自由复制和排版)
单篇付费下载
限时特价:10 元/份 原价:20元
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:fanwen365 QQ:370150219
Copyright © 云题海 All Rights Reserved. 苏ICP备16052595号-3 网站地图 客服QQ:370150219 邮箱:370150219@qq.com