Ejemplo n.º 1
0
        private Stream GetFile(string xml)
        {
            MessageList mes_list = new MessageList();
            MessageLog  logs     = new MessageLog(MessageLog.INFO, "GetFile", "Создание потока");

            mes_list.Add_Message(logs);
            XDocument doc = XDocument.Parse(xml);

            FRDataForm       form          = new FRDataForm();
            ConverterClass   convert_class = new ConverterClass();
            List <DataTable> list          = convert_class.Converter(doc, out form);

            using (Report report = new Report())
            {
                //conf.GetValue("FolderFR")  "\\Report\\"

                String       name_file = conf.GetValue("PathService") + "\\" + conf.GetValue("FolderFR") + "\\" + form.product + "\\" + form.form + ".frx";
                MemoryStream mem       = new MemoryStream();

                logs = new MessageLog(MessageLog.INFO, "GetFile", "Отчет " + name_file);
                mes_list.Add_Message(logs);

                ExportBase export = Format(form);

                report.Load(name_file);
                EnvironmentSettings s = new EnvironmentSettings();
                s.ReportSettings.ShowProgress = false;
                foreach (DataTable st in list)
                {
                    report.RegisterData(st, st.TableName);
                }
                //report.Show();
                //report.Design();
                report.Prepare();
                //FileStream fl = new FileStream("555.pdf", FileMode.Create);
                //report.Export(export, fl);
                //fl.Close();
                //report.SavePrepared(fl);
                report.Export(export, mem);

                // }
                // nt.Flush();
                mem.Position = 0;
                //byte[] file = mem.ToArray();
                logs = new MessageLog(MessageLog.INFO, "GetFile", "Отчет сформирован и отправлен");
                mes_list.Add_Message(logs);

                Logger.getInstance().Write(mes_list);

                return(mem);
            }
        }
Ejemplo n.º 2
0
 public ObjectClass(string _file_template, string _file_xml)
 {
     file_template = _file_template;
     file_xml      = _file_xml;
     report        = new Report();
     {
         if (!String.IsNullOrEmpty(file_template))
         {
             report.Load(file_template);
         }
         if (!String.IsNullOrEmpty(file_xml))
         {
             List <DataTable> list = ConverterClass.Converter(file_xml);
             foreach (DataTable st in list)
             {
                 report.RegisterData(st, st.TableName.Trim());
             }
         }
     }
 }