if(App.ActiveCellar == null) { MessageBox.Show("Aucune cave n'est ouverte"); return; } App.Animate(AnimationType.Work, true); App.SetCursor(true); // Modifiez ici le titre du report string reportName = "Liste des producteurs"; // Creation entete report ReportTable rt = new ReportTable(reportName); // Producteur ReportColumn rcProducer = rt.NewColumn("Producteur"); rcProducer.Size = 200; // Adresse 1 ReportColumn rcAddress1 = rt.NewColumn("Adresse"); rcAddress1.Size = 160; // Zip ReportColumn rcZip = rt.NewColumn("CP"); rcZip.Size = 60; // Ville ReportColumn rcCity = rt.NewColumn("Ville"); rcCity.Size = 120; // Tel ReportColumn rcPhone = rt.NewColumn("Tél"); rcPhone.Size = 90; // Fax ReportColumn rcFax = rt.NewColumn("Fax"); rcFax.Size = 90; // // Alimentation de la source // ObjectCollection owners = App.ActiveCellar.GetCollection((ushort)ObjectType.Owner); for (int i = 0; i < owners.Count; i++) { Owner owner = (Owner)owners[i]; ReportRow row = rt.NewRow(); row[0] = owner.Name.Trim(); row[1] = owner.Address1.Trim() + " " + owner.Address2.Trim(); row[2] = owner.ZipCode.Trim(); row[3] = owner.City.Trim(); row[4] = owner.Phone.Trim(); row[5] = owner.Fax.Trim(); } // // Génération // System.Collections.ArrayList list = new System.Collections.ArrayList(); list.Add(rt); IReport report = App.ReportEngine.GetSystemReport(PredefinedReport.Grid); string destFileName = App.Path + "Cache\\InOut.pdf"; bool success = false; try { report.Create(list, destFileName); success = true; } catch(Exception ex) { MessageBox.Show("Erreur (1)" + ex.ToString()); } // // Affichage du report // if(success) { IShellWindow shellWindow = (IShellWindow)App.GetWindow(WindowType.Shell, null); if(shellWindow != null) { shellWindow.Start(destFileName); } } App.SetCursor(false); App.StopAnimate();