文檔半島外圍網上直營>>FastReport中文文檔>>替換 
                替換
FastReport .Net是一款全功能的Windows Forms、ASP.NET和MVC報表分析解決方案,使用FastReport .NET可以創建獨立于應用程序的.NET報表,同時FastReport .Net支持中文、英語等14種語言,可以讓你的產品保證真正的國際性。
如果決定在數據庫中存儲報告,則可能需要更改設計器,使其可以從數據庫打開和保存報告。也就是說,需要將標準的 "打開 "和 "保存 "對話框替換為自己的數據庫對話框。為此,請使用 EnvironmentSettings 組件(請參閱配置 FastReport .NET 環境)。該組件有以下事件:
事件 CustomOpenDialog
當報表設計器即將顯示 "打開 "對話框時發生。在事件處理程序中,必須顯示一個對話窗口,讓用戶選擇報告文件。如果對話框執行成功,則必須返回 e.Cancel = false 并將 e.FileName 設置為選定的文件名。下面的示例演示了如何使用此事件:
private void CustomOpenDialog_Handler(object sender, OpenSaveDialogEventArgs e)
{
  using (OpenFileDialog dialog = new OpenFileDialog())
  {
    dialog.Filter = "Report files (*.frx)|*.frx";
    // set e.Cancel to false if dialog 
    // was succesfully executed
    e.Cancel = dialog.ShowDialog() != DialogResult.OK;
    // set e.FileName to the selected file name
    e.FileName = dialog.FileName;
  }
}
	點擊復制
當報表設計器即將顯示 "保存 "對話框時發生。在事件處理程序中,必須顯示一個對話窗口,讓用戶選擇報告文件。如果對話框執行成功,則必須返回 e.Cancel = false 并將 e.FileName 設置為選定的文件名。下面的示例演示了如何使用此事件:
private void CustomSaveDialog_Handler(object sender, OpenSaveDialogEventArgs e)
{
  using (SaveFileDialog dialog = new SaveFileDialog())
  {
    dialog.Filter = "Report files (*.frx)|*.frx";
    // get default file name from e.FileName
    dialog.FileName = e.FileName;
    // set e.Cancel to false if dialog 
    // was succesfully executed
    e.Cancel = dialog.ShowDialog() != DialogResult.OK;
    // set e.FileName to the selected file name
    e.FileName = dialog.FileName;
  }
}
	點擊復制
當報表設計器即將加載報表時發生。在事件處理程序中,必須從 e.FileName 屬性中指定的位置加載 e.Report 屬性中指定的報表。后者包含 CustomOpenDialog 事件處理程序返回的名稱。它可以是文件名、數據庫鍵值等。下面的示例演示了如何使用該事件:
private void CustomOpenReport_Handler(object sender, OpenSaveReportEventArgs e)
{
  // load the report from the given e.FileName
  e.Report.Load(e.FileName);
}
	點擊復制
當報表設計器即將保存報表時發生。在事件處理程序中,必須將 e.Report 屬性中指定的報表保存到 e.FileName 屬性中指定的位置。后者包含 CustomSaveDialog 事件處理程序返回的名稱。它可以是文件名、數據庫鍵值等。下面的示例演示了如何使用該事件:
private void CustomSaveReport_Handler(object sender, OpenSaveReportEventArgs e)
{
  // save the report to the given e.FileName
  e.Report.Save(e.FileName);
}
	點擊復制

 QQ交談
QQ交談 在線咨詢
在線咨詢 
                 
                
 渝公網安備
            50010702500608號
渝公網安備
            50010702500608號
             
            
 客服熱線
客服熱線