Пример #1
0
 private void BtnExportPDF_OnClick(object sender, RoutedEventArgs e)
 {
     try
     {
         var dlg = new Microsoft.Win32.SaveFileDialog()
         {
             FileName   = "工作簿1",
             DefaultExt = ".pdf",
             Filter     = "PDF (*.pdf)|*.pdf",
         };
         if (dlg.ShowDialog() == true)
         {
             var dt = DataContext as DataTable;
             PdfService.ExportDataTable(dt, dlg.FileName);
             ShowSubViewNotification(new NotificationMessage("导出成功"));
         }
     }
     catch (Exception ex)
     {
         Log.Error(ex);
         ShowSubViewNotification(new NotificationMessage("导出失败"));
     }
 }