Beispiel #1
0
 public static void ExportCurrentForm(DBGrid grid, ReportExportFormat format)
 {
     if (_reporter != null)
     {
         _reporter.ExportCurrentForm(grid, format);
     }
 }
Beispiel #2
0
 public static ReportExportFormat GetExportReportFormat(string fileName, string exportFormatID)
 {
     using (SaveFileDialog dlg = new SaveFileDialog())
     {
         dlg.FileName = fileName;
         string        filesMask = string.Empty;
         List <string> ids       = new List <string>();
         foreach (KeyValuePair <string, ReportExportFormat> kvp in ReportExportFormats.Formats)
         {
             filesMask += kvp.Value.Description + kvp.Value.FileMaskDescription + "|" + kvp.Value.FileMask + "|";
             ids.Add(kvp.Key);
             if (kvp.Value.ID == exportFormatID)
             {
                 dlg.FilterIndex = ids.Count;
             }
         }
         dlg.Filter          = filesMask.Substring(0, filesMask.Length - 1);
         dlg.OverwritePrompt = false;
         dlg.AddExtension    = true;
         if (dlg.ShowDialog() == DialogResult.OK)
         {
             string newFileName = dlg.FileName;
             bool   exists      = System.IO.File.Exists(newFileName);
             if (!exists || (MessageBox.Show("Файл " + newFileName + " уже существует. Перезаписать?", "Экспорт в файл",
                                             MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes))
             {
                 ReportExportFormat format = ReportExportFormats.GetFormat(ids[dlg.FilterIndex - 1]);
                 format.CreateParam.ExportFileName = newFileName;
                 return(format);
             }
         }
     }
     return(null);
 }
Beispiel #3
0
 public static void OutputReport(Control grid, string reportName, System.Data.DataTable dataSource,
                                 ReportExportFormat format, ActionParameters reportParameters)
 {
     if (_reporter != null)
     {
         _reporter.OutputReport(reportName, dataSource, format, reportParameters);
     }
 }