private void LoadTemplateIntoGridView(RadGridView gridView)
        {
            contentPresenter.IsHitTestVisible = false;
            contentPresenter.DataContext = this;
            contentPresenter.ContentTemplate = this.EmptyDataTemplate;
            Grid rootGrid = gridView.ChildrenOfType<Grid>().FirstOrDefault();

            contentPresenter.SetValue(Grid.RowProperty, 2);
            contentPresenter.SetValue(Grid.RowSpanProperty, 2);
            contentPresenter.SetValue(Grid.ColumnSpanProperty, 2);
            contentPresenter.SetValue(Border.MarginProperty, new Thickness(0, 27, 0, 0));
            rootGrid.Children.Add(contentPresenter);
        }
示例#2
0
        public void ExtractGridToPDF(RadGridView grid, String filename)
        {
            String formatDate = "dd-MM-yyyy";
            String dateT1     = DateTime.Parse(SelectedDate2).ToString(formatDate);
            String dateT2     = DateTime.Parse(SelectedDate1).ToString(formatDate);

            String title = "Changements de scores du " + dateT1 + " au " + dateT2;

            String filepath   = @"\\mede1\partage\,FGA Front Office\02_Gestion_Actions\00_BASE\02_EVOLUTION SCORES\";
            String pathToFile = filepath + filename + ".pdf";


            try
            {
                #region Fonts

                Font arial      = new Font(FontFactory.GetFont("Arial", 8, Font.NORMAL));
                Font arialBold  = new Font(FontFactory.GetFont("Arial", 8, Font.BOLD));
                Font arialTitle = new Font(FontFactory.GetFont("Arial", 14, Font.BOLD));

                #endregion

                #region Define document

                Document  newPdfDoc = new Document(iTextSharp.text.PageSize.A4, 0, 0, 10, 10);
                PdfWriter wri       = PdfWriter.GetInstance(newPdfDoc,
                                                            new FileStream(pathToFile, FileMode.OpenOrCreate));
                newPdfDoc.Open();

                float[] scheduleTableColumnWidths = new float[11];

                scheduleTableColumnWidths[0]  = 130; //Label_Secteur
                scheduleTableColumnWidths[1]  = 130; //Industries
                scheduleTableColumnWidths[2]  = 80;  //TICKER
                scheduleTableColumnWidths[3]  = 150; //Comapny_Name
                scheduleTableColumnWidths[4]  = 100; //Date1
                scheduleTableColumnWidths[5]  = 60;  //Rang1
                scheduleTableColumnWidths[6]  = 60;  //Quint1
                scheduleTableColumnWidths[7]  = 100; //Date2
                scheduleTableColumnWidths[8]  = 60;  //Rang2
                scheduleTableColumnWidths[9]  = 60;  //Quint2
                scheduleTableColumnWidths[10] = 60;  //SUIVI

                PdfPTable table = new PdfPTable(scheduleTableColumnWidths);
                table.DefaultCell.Border = Rectangle.NO_BORDER;
                table.HeaderRows         = 2;

                #endregion

                #region Title

                PdfPCell cell = new PdfPCell(new Phrase(title, arialTitle));
                cell.Border              = Rectangle.NO_BORDER;
                cell.BackgroundColor     = BaseColor.LIGHT_GRAY;
                cell.Colspan             = 11;
                cell.HorizontalAlignment = 1; //0=Left, 1=center, 2=right
                table.AddCell(cell);

                #endregion

                #region Headers

                table.AddCell(new PdfPCell(new Phrase("Secteur", arialBold))
                {
                    Border = Rectangle.NO_BORDER, BackgroundColor = BaseColor.LIGHT_GRAY, HorizontalAlignment = 1, VerticalAlignment = 1
                });                                                                                                                                                                                     //Label_Secteur
                table.AddCell(new PdfPCell(new Phrase("Industrie", arialBold))
                {
                    Border = Rectangle.NO_BORDER, BackgroundColor = BaseColor.LIGHT_GRAY, HorizontalAlignment = 1, VerticalAlignment = 1
                });                                                                                                                                                                                       //Label_Industry
                table.AddCell(new PdfPCell(new Phrase("Ticker", arialBold))
                {
                    Border = Rectangle.NO_BORDER, BackgroundColor = BaseColor.LIGHT_GRAY, HorizontalAlignment = 1, VerticalAlignment = 1
                });                                                                                                                                                                                    //TICKER
                table.AddCell(new PdfPCell(new Phrase("Compagnie", arialBold))
                {
                    Border = Rectangle.NO_BORDER, BackgroundColor = BaseColor.LIGHT_GRAY, HorizontalAlignment = 1, VerticalAlignment = 1
                });                                                                                                                                                                                        //Company_Name
                table.AddCell(new PdfPCell(new Phrase("Date1", arialBold))
                {
                    Border = Rectangle.NO_BORDER, BackgroundColor = BaseColor.LIGHT_GRAY, HorizontalAlignment = 1, VerticalAlignment = 1
                });;                                                                                                                                                                                    //date1
                table.AddCell(new PdfPCell(new Phrase("Rang1", arialBold))
                {
                    Border = Rectangle.NO_BORDER, BackgroundColor = BaseColor.LIGHT_GRAY, HorizontalAlignment = 1, VerticalAlignment = 1
                });;                                                                                                                                                                                    //rang1
                table.AddCell(new PdfPCell(new Phrase("Quint1", arialBold))
                {
                    Border = Rectangle.NO_BORDER, BackgroundColor = BaseColor.LIGHT_GRAY, HorizontalAlignment = 1, VerticalAlignment = 1
                });                                                                                                                                                                                    //quint1
                table.AddCell(new PdfPCell(new Phrase("Date2", arialBold))
                {
                    Border = Rectangle.NO_BORDER, BackgroundColor = BaseColor.LIGHT_GRAY, HorizontalAlignment = 1, VerticalAlignment = 1
                });;                                                                                                                                                                                    //date2
                table.AddCell(new PdfPCell(new Phrase("Rang2", arialBold))
                {
                    Border = Rectangle.NO_BORDER, BackgroundColor = BaseColor.LIGHT_GRAY, HorizontalAlignment = 1, VerticalAlignment = 1
                });;                                                                                                                                                                                    //rang2
                table.AddCell(new PdfPCell(new Phrase("Quint2", arialBold))
                {
                    Border = Rectangle.NO_BORDER, BackgroundColor = BaseColor.LIGHT_GRAY, HorizontalAlignment = 1, VerticalAlignment = 1
                });                                                                                                                                                                                    //quint2
                table.AddCell(new PdfPCell(new Phrase("Suivi", arialBold))
                {
                    Border = Rectangle.NO_BORDER, BackgroundColor = BaseColor.LIGHT_GRAY, HorizontalAlignment = 1, VerticalAlignment = 1
                });                                                                                                                                                                                   //suivi

                #endregion

                var  rows = grid.ChildrenOfType <GridViewRow>();
                bool pos  = true;
                foreach (GridViewRow row in rows)
                {
                    #region Fields

                    String secteur  = ((TextBlock)row.Cells[0].Content).Text;  //Label_Secteur
                    String industry = ((TextBlock)row.Cells[1].Content).Text;  //Label_Industry
                    String ticker   = ((TextBlock)row.Cells[3].Content).Text;  //TICKER
                    String name     = ((TextBlock)row.Cells[4].Content).Text;  //Company_Name
                    String date1    = ((TextBlock)row.Cells[5].Content).Text;  //date1
                    String rang1    = ((TextBlock)row.Cells[6].Content).Text;  //rang1
                    String quint1   = ((TextBlock)row.Cells[7].Content).Text;  //quint1
                    String date2    = ((TextBlock)row.Cells[8].Content).Text;  //date2
                    String rang2    = ((TextBlock)row.Cells[9].Content).Text;  //rang2
                    String quint2   = ((TextBlock)row.Cells[10].Content).Text; //quint2
                    String suivi    = ((TextBlock)row.Cells[2].Content).Text;  //suivi

                    BaseColor colorAltern = pos ? new BaseColor(255, 255, 255) : new BaseColor(230, 230, 230);

                    Font arialRed = new Font(FontFactory.GetFont("Arial", 8, Font.NORMAL, BaseColor.RED));

                    Font usedFont = arial;
                    if (int.Parse(quint1) < int.Parse(quint2))
                    {
                        usedFont = arialRed;
                    }

                    #endregion

                    table.AddCell(new PdfPCell(new Phrase(secteur, arial))
                    {
                        Border = Rectangle.NO_BORDER, HorizontalAlignment = 1, VerticalAlignment = 1, BackgroundColor = colorAltern
                    });                                                                                                                                                                      //Label_Secteur
                    table.AddCell(new PdfPCell(new Phrase(industry, arial))
                    {
                        Border = Rectangle.NO_BORDER, HorizontalAlignment = 1, VerticalAlignment = 1, BackgroundColor = colorAltern
                    });                                                                                                                                                                       //Label_Industry
                    table.AddCell(new PdfPCell(new Phrase(ticker, arial))
                    {
                        Border = Rectangle.NO_BORDER, HorizontalAlignment = 1, VerticalAlignment = 1, BackgroundColor = colorAltern
                    });                                                                                                                                                                     //TICKER
                    table.AddCell(new PdfPCell(new Phrase(name, arial))
                    {
                        Border = Rectangle.NO_BORDER, HorizontalAlignment = 1, VerticalAlignment = 1, BackgroundColor = colorAltern
                    });                                                                                                                                                                   //Company_Name
                    table.AddCell(new PdfPCell(new Phrase(date1, arial))
                    {
                        Border = Rectangle.NO_BORDER, HorizontalAlignment = 1, VerticalAlignment = 1, BackgroundColor = colorAltern
                    });                                                                                                                                                                    //date1
                    table.AddCell(new PdfPCell(new Phrase(rang1, arial))
                    {
                        Border = Rectangle.NO_BORDER, HorizontalAlignment = 1, VerticalAlignment = 1, BackgroundColor = colorAltern
                    });                                                                                                                                                                    //rang1
                    table.AddCell(new PdfPCell(new Phrase(quint1, usedFont))
                    {
                        Border = Rectangle.NO_BORDER, HorizontalAlignment = 1, VerticalAlignment = 1, BackgroundColor = colorAltern
                    });                                                                                                                                                                        //quint1
                    table.AddCell(new PdfPCell(new Phrase(date2, arial))
                    {
                        Border = Rectangle.NO_BORDER, HorizontalAlignment = 1, VerticalAlignment = 1, BackgroundColor = colorAltern
                    });                                                                                                                                                                    //date2
                    table.AddCell(new PdfPCell(new Phrase(rang2, arial))
                    {
                        Border = Rectangle.NO_BORDER, HorizontalAlignment = 1, VerticalAlignment = 1, BackgroundColor = colorAltern
                    });                                                                                                                                                                    //rang2
                    table.AddCell(new PdfPCell(new Phrase(quint2, arial))
                    {
                        Border = Rectangle.NO_BORDER, HorizontalAlignment = 1, VerticalAlignment = 1, BackgroundColor = colorAltern
                    });                                                                                                                                                                    //quint2
                    table.AddCell(new PdfPCell(new Phrase(suivi, arial))
                    {
                        Border = Rectangle.NO_BORDER, HorizontalAlignment = 1, VerticalAlignment = 1, BackgroundColor = colorAltern
                    });                                                                                                                                                                   //quint2

                    pos = !pos;
                }
                newPdfDoc.Add(table);
                newPdfDoc.Close();

                System.Diagnostics.Process.Start(pathToFile);
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
            }
        }
        public void ExtractForPrintRecoMethod(RadGridView grid)
        {
            String format   = "yyyy-MM-dd";
            String dateFile = DateTime.Now.ToString(format);

            String formatTitre = "dd-MM-yyyy";
            String dateTitre   = DateTime.Now.ToString(formatTitre);

            String filepath = @"\\vill1\partage\,FGA Front Office\02_Gestion_Actions\00_BASE\03_LISTES RECOMMANDATIONS\";

            String country = "EUROPE_";

            if (!GlobalInfos.isEurope)
            {
                country = "USA_";
            }

            String filename = "RECO_" + country + dateFile;

            if (GlobalInfos.areEnsemble)
            {
                filename += "_ENSEMBLE";
            }
            if (GlobalInfos.areIndustries)
            {
                filename += "_INDUSTRIES";
            }
            if (GlobalInfos.areValues)
            {
                filename += "_VALEURS";
            }

            String pathToFile = filepath + filename + ".pdf";

            try
            {
                #region Fonts

                Font arial      = new Font(FontFactory.GetFont("Arial", 8, Font.NORMAL));
                Font arialBold  = new Font(FontFactory.GetFont("Arial", 8, Font.BOLD));
                Font arialTitle = new Font(FontFactory.GetFont("Arial", 14, Font.BOLD));

                #endregion

                #region Define document

                Document  newPdfDoc = new Document(iTextSharp.text.PageSize.A4, -50, -50, 10, 10);
                PdfWriter wri       = PdfWriter.GetInstance(newPdfDoc,
                                                            new FileStream(pathToFile, FileMode.OpenOrCreate));
                newPdfDoc.Open();
                int     size = GlobalInfos.isEurope ? 14 : 10;
                float[] scheduleTableColumnWidths = new float[size];

                scheduleTableColumnWidths[0] = 130; //Label_Secteur
                scheduleTableColumnWidths[1] = 40;  //Initiales
                scheduleTableColumnWidths[2] = 130; //Label_Industry
                scheduleTableColumnWidths[3] = 100; //TICKER
                scheduleTableColumnWidths[4] = 150; //Company_Name
                scheduleTableColumnWidths[5] = 60;  //Currency
                scheduleTableColumnWidths[6] = 25;  //Q
                scheduleTableColumnWidths[7] = 110; //Date
                scheduleTableColumnWidths[8] = 70;  //RecoMXEM
                scheduleTableColumnWidths[9] = 70;  //PoidsMXEM
                if (GlobalInfos.isEurope)
                {
                    scheduleTableColumnWidths[10] = 70; //RecoMXEU
                    scheduleTableColumnWidths[11] = 70; //PoidsMXEU
                    scheduleTableColumnWidths[12] = 70; //RecoMXEUM
                    scheduleTableColumnWidths[13] = 70; //PoidsMXEUM
                }

                PdfPTable table = new PdfPTable(scheduleTableColumnWidths);
                table.DefaultCell.Border = Rectangle.NO_BORDER;
                table.HeaderRows         = 3;

                #endregion

                var rows = grid.ChildrenOfType <GridViewRow>();

                //Alignement --- 0=Left, 1=center, 2=right
                String titre = "Recommandations Europe ";
                if (!GlobalInfos.isEurope)
                {
                    titre = "Recommandations USA ";
                }
                PdfPCell cell = new PdfPCell(new Phrase(titre + dateTitre, arialTitle))
                {
                    Border = Rectangle.NO_BORDER, BackgroundColor = BaseColor.LIGHT_GRAY, Colspan = 14, HorizontalAlignment = 1
                };
                table.AddCell(cell);

                table.AddCell(new PdfPCell(new Phrase("Secteur", arialBold))
                {
                    Border = Rectangle.NO_BORDER, BackgroundColor = BaseColor.LIGHT_GRAY, Rowspan = 2, HorizontalAlignment = 1, VerticalAlignment = 1
                });                                                                                                                                                                                                  //Label_Secteur
                table.AddCell(new PdfPCell(new Phrase("##", arialBold))
                {
                    Border = Rectangle.NO_BORDER, BackgroundColor = BaseColor.LIGHT_GRAY, Rowspan = 2, HorizontalAlignment = 1, VerticalAlignment = 1
                });                                                                                                                                                                                             //Initiales
                table.AddCell(new PdfPCell(new Phrase("Industrie", arialBold))
                {
                    Border = Rectangle.NO_BORDER, BackgroundColor = BaseColor.LIGHT_GRAY, Rowspan = 2, HorizontalAlignment = 1, VerticalAlignment = 1
                });                                                                                                                                                                                                    //Label_Industry
                table.AddCell(new PdfPCell(new Phrase("Ticker", arialBold))
                {
                    Border = Rectangle.NO_BORDER, BackgroundColor = BaseColor.LIGHT_GRAY, Rowspan = 2, HorizontalAlignment = 1, VerticalAlignment = 1
                });                                                                                                                                                                                                 //TICKER
                table.AddCell(new PdfPCell(new Phrase("Compagnie", arialBold))
                {
                    Border = Rectangle.NO_BORDER, BackgroundColor = BaseColor.LIGHT_GRAY, Rowspan = 2, HorizontalAlignment = 1, VerticalAlignment = 1
                });                                                                                                                                                                                                    //Company_Name
                table.AddCell(new PdfPCell(new Phrase("Dev", arialBold))
                {
                    Border = Rectangle.NO_BORDER, BackgroundColor = BaseColor.LIGHT_GRAY, Rowspan = 2, HorizontalAlignment = 1, VerticalAlignment = 1
                });                                                                                                                                                                                              //Currency
                table.AddCell(new PdfPCell(new Phrase("Q", arialBold))
                {
                    Border = Rectangle.NO_BORDER, BackgroundColor = BaseColor.LIGHT_GRAY, Rowspan = 2, HorizontalAlignment = 1, VerticalAlignment = 1
                });                                                                                                                                                                                            //Q
                table.AddCell(new PdfPCell(new Phrase("Date", arialBold))
                {
                    Border = Rectangle.NO_BORDER, BackgroundColor = BaseColor.LIGHT_GRAY, Rowspan = 2, HorizontalAlignment = 1, VerticalAlignment = 1
                });                                                                                                                                                                                               //Date

                if (GlobalInfos.isEurope)
                {
                    table.AddCell(new PdfPCell(new Phrase("EMU", arialBold))
                    {
                        Border = Rectangle.NO_BORDER, BackgroundColor = BaseColor.LIGHT_GRAY, Colspan = 2, Rowspan = 1, HorizontalAlignment = 1, VerticalAlignment = 1
                    });
                    table.AddCell(new PdfPCell(new Phrase("EUROPE", arialBold))
                    {
                        Border = Rectangle.NO_BORDER, BackgroundColor = BaseColor.LIGHT_GRAY, Colspan = 2, Rowspan = 1, HorizontalAlignment = 1, VerticalAlignment = 1
                    });
                    table.AddCell(new PdfPCell(new Phrase("EX EMU", arialBold))
                    {
                        Border = Rectangle.NO_BORDER, BackgroundColor = BaseColor.LIGHT_GRAY, Colspan = 2, Rowspan = 1, HorizontalAlignment = 1, VerticalAlignment = 1
                    });
                }
                else
                {
                    table.AddCell(new PdfPCell(new Phrase("USA", arialBold))
                    {
                        Border = Rectangle.NO_BORDER, BackgroundColor = BaseColor.LIGHT_GRAY, Colspan = 2, Rowspan = 1, HorizontalAlignment = 1, VerticalAlignment = 1
                    });
                }

                table.AddCell(new PdfPCell(new Phrase("Reco", arialBold))
                {
                    Border = Rectangle.NO_BORDER, BackgroundColor = BaseColor.LIGHT_GRAY, Rowspan = 1, HorizontalAlignment = 1, VerticalAlignment = 1
                });                                                                                                                                                                                               //RecoMXEM
                table.AddCell(new PdfPCell(new Phrase("Pds", arialBold))
                {
                    Border = Rectangle.NO_BORDER, BackgroundColor = BaseColor.LIGHT_GRAY, Rowspan = 1, HorizontalAlignment = 1, VerticalAlignment = 1
                });                                                                                                                                                                                              //PoidsMXEM
                if (GlobalInfos.isEurope)
                {
                    table.AddCell(new PdfPCell(new Phrase("Reco", arialBold))
                    {
                        Border = Rectangle.NO_BORDER, BackgroundColor = BaseColor.LIGHT_GRAY, Rowspan = 1, HorizontalAlignment = 1, VerticalAlignment = 1
                    });                                                                                                                                                                                               //RecoMXEU
                    table.AddCell(new PdfPCell(new Phrase("Pds", arialBold))
                    {
                        Border = Rectangle.NO_BORDER, BackgroundColor = BaseColor.LIGHT_GRAY, Rowspan = 1, HorizontalAlignment = 1, VerticalAlignment = 1
                    });                                                                                                                                                                                              //PoidsMXEU
                    table.AddCell(new PdfPCell(new Phrase("Reco", arialBold))
                    {
                        Border = Rectangle.NO_BORDER, BackgroundColor = BaseColor.LIGHT_GRAY, Rowspan = 1, HorizontalAlignment = 1, VerticalAlignment = 1
                    });                                                                                                                                                                                               //RecoMXEUM
                    table.AddCell(new PdfPCell(new Phrase("Pds", arialBold))
                    {
                        Border = Rectangle.NO_BORDER, BackgroundColor = BaseColor.LIGHT_GRAY, Rowspan = 1, HorizontalAlignment = 1, VerticalAlignment = 1
                    });;                                                                                                                                                                                               //PoidsMXEUM
                }
                bool pos = true;
                foreach (GridViewRow row in rows)
                {
                    #region Fields

                    String secteur    = ((TextBlock)row.Cells[1].Content).Text.Replace("Telecommunication", "Telecom"); //Label_Secteur
                    String initiales  = ((TextBlock)row.Cells[2].Content).Text;;                                        //Initiales
                    String industry   = ((TextBlock)row.Cells[3].Content).Text.Replace("Telecommunication", "Telecom"); //Label_Industry
                    String ticker     = ((TextBlock)row.Cells[4].Content).Text;                                         //TICKER
                    String name       = ((TextBlock)row.Cells[5].Content).Text;                                         //Company_Name
                    String crncy      = ((TextBlock)row.Cells[6].Content).Text;;                                        //Currency
                    String classement = ((TextBlock)row.Cells[7].Content).Text;                                         //Q
                    String date       = ((TextBlock)row.Cells[8].Content).Text;                                         //Date

                    String recoMXEM   = "";                                                                             //RecoMXEM
                    String recoMXEU   = "";                                                                             //RecoMXEU
                    String recoMXEUM  = "";                                                                             //RecoMXEUM
                    String recoMXUSLC = "";                                                                             //RecoMXEUM

                    String poidsMXEM   = "";                                                                            //PoidsMXEM
                    String poidsMXEU   = "";                                                                            //PoidsMXEU
                    String poidsMXEUM  = "";                                                                            //PoidsMXEUM
                    String poidsMXUSLC = "";                                                                            //RecoMXEUM


                    if (GlobalInfos.isEurope)
                    {
                        recoMXEM  = ((TextBlock)row.Cells[9].Content).Text;   //RecoMXEM
                        recoMXEU  = ((TextBlock)row.Cells[11].Content).Text;  //RecoMXEU
                        recoMXEUM = ((TextBlock)row.Cells[13].Content).Text;  //RecoMXEUM

                        poidsMXEM  = ((TextBlock)row.Cells[10].Content).Text; //PoidsMXEM
                        poidsMXEU  = ((TextBlock)row.Cells[12].Content).Text; //PoidsMXEU
                        poidsMXEUM = ((TextBlock)row.Cells[14].Content).Text; //PoidsMXEUM
                    }
                    else
                    {
                        recoMXUSLC  = ((TextBlock)row.Cells[9].Content).Text;
                        poidsMXUSLC = ((TextBlock)row.Cells[10].Content).Text;
                    }


                    BaseColor colorAltern   = (GlobalInfos.areValues) ? (pos ? new BaseColor(255, 255, 255) : new BaseColor(230, 230, 230)) : BaseColor.WHITE;
                    BaseColor colorSector   = new BaseColor(210, 180, 140);
                    BaseColor colorIndustry = new BaseColor(238, 232, 170);

                    BaseColor fontColorMXEM   = (recoMXEM == "+" || recoMXEM == "++") ? new BaseColor(50, 155, 61) : ((recoMXEM == "-" || recoMXEM == "--") ? new BaseColor(236, 5, 0) : BaseColor.BLACK);
                    BaseColor fontColorMXEU   = (recoMXEU == "+" || recoMXEU == "++") ? new BaseColor(50, 155, 61) : ((recoMXEU == "-" || recoMXEU == "--") ? new BaseColor(236, 5, 0) : BaseColor.BLACK);
                    BaseColor fontColorMXEUM  = (recoMXEUM == "+" || recoMXEUM == "++") ? new BaseColor(50, 155, 61) : ((recoMXEUM == "-" || recoMXEUM == "--") ? new BaseColor(236, 5, 0) : BaseColor.BLACK);;
                    BaseColor fontColorMXUSLC = (recoMXUSLC == "+" || recoMXUSLC == "++") ? new BaseColor(50, 155, 61) : ((recoMXUSLC == "-" || recoMXUSLC == "--") ? new BaseColor(236, 5, 0) : BaseColor.BLACK);;

                    Font arialRecoMXEM   = new Font(FontFactory.GetFont("Arial", 8, Font.NORMAL, fontColorMXEM));
                    Font arialRecoMXEU   = new Font(FontFactory.GetFont("Arial", 8, Font.NORMAL, fontColorMXEU));
                    Font arialRecoMXEUM  = new Font(FontFactory.GetFont("Arial", 8, Font.NORMAL, fontColorMXEUM));
                    Font arialRecoMXUSLC = new Font(FontFactory.GetFont("Arial", 8, Font.NORMAL, fontColorMXUSLC));

                    #endregion

                    table.AddCell(new PdfPCell(new Phrase(secteur, arial))
                    {
                        Border = Rectangle.NO_BORDER, HorizontalAlignment = 1, VerticalAlignment = 1, BackgroundColor = (industry == "" ? colorSector : (name == "" ? colorIndustry : colorAltern))
                    });                                                                                                                                                                                                                                      //Label_Secteur
                    table.AddCell(new PdfPCell(new Phrase(initiales, arial))
                    {
                        Border = Rectangle.NO_BORDER, HorizontalAlignment = 1, VerticalAlignment = 1, BackgroundColor = (industry == "" ? colorSector : (name == "" ? colorIndustry : colorAltern))
                    });                                                                                                                                                                                                                                        //Initiales
                    table.AddCell(new PdfPCell(new Phrase(industry, arial))
                    {
                        Border = Rectangle.NO_BORDER, HorizontalAlignment = 1, VerticalAlignment = 1, BackgroundColor = (industry == "" ? colorSector : (name == "" ? colorIndustry : colorAltern))
                    });                                                                                                                                                                                                                                       //Label_Industry
                    table.AddCell(new PdfPCell(new Phrase(ticker, arial))
                    {
                        Border = Rectangle.NO_BORDER, HorizontalAlignment = 1, VerticalAlignment = 1, BackgroundColor = (industry == "" ? colorSector : (name == "" ? colorIndustry : colorAltern))
                    });                                                                                                                                                                                                                                     //TICKER
                    table.AddCell(new PdfPCell(new Phrase(name, arial))
                    {
                        Border = Rectangle.NO_BORDER, HorizontalAlignment = 1, VerticalAlignment = 1, BackgroundColor = (industry == "" ? colorSector : (name == "" ? colorIndustry : colorAltern))
                    });                                                                                                                                                                                                                                   //Company_Name
                    table.AddCell(new PdfPCell(new Phrase(crncy, arial))
                    {
                        Border = Rectangle.NO_BORDER, HorizontalAlignment = 1, VerticalAlignment = 1, BackgroundColor = (industry == "" ? colorSector : (name == "" ? colorIndustry : colorAltern))
                    });                                                                                                                                                                                                                                    //Currency
                    table.AddCell(new PdfPCell(new Phrase(classement, arial))
                    {
                        Border = Rectangle.NO_BORDER, HorizontalAlignment = 1, VerticalAlignment = 1, BackgroundColor = (industry == "" ? colorSector : (name == "" ? colorIndustry : colorAltern))
                    });                                                                                                                                                                                                                                         //Q
                    table.AddCell(new PdfPCell(new Phrase(date, arial))
                    {
                        Border = Rectangle.NO_BORDER, HorizontalAlignment = 1, VerticalAlignment = 1, BackgroundColor = (industry == "" ? colorSector : (name == "" ? colorIndustry : colorAltern))
                    });                                                                                                                                                                                                                                   //Date

                    if (GlobalInfos.isEurope)
                    {
                        table.AddCell(new PdfPCell(new Phrase(recoMXEM, arialRecoMXEM))
                        {
                            Border = Rectangle.NO_BORDER, HorizontalAlignment = 1, VerticalAlignment = 1, BackgroundColor = (industry == "" ? colorSector : (name == "" ? colorIndustry : colorAltern))
                        });                                                                                                                                                                                                                                               //RecoMXEM
                        table.AddCell(new PdfPCell(new Phrase(poidsMXEM, arialRecoMXEM))
                        {
                            Border = Rectangle.NO_BORDER, HorizontalAlignment = 1, VerticalAlignment = 1, BackgroundColor = (industry == "" ? colorSector : (name == "" ? colorIndustry : colorAltern))
                        });                                                                                                                                                                                                                                                //PoidsMXEM
                        table.AddCell(new PdfPCell(new Phrase(recoMXEU, arialRecoMXEU))
                        {
                            Border = Rectangle.NO_BORDER, HorizontalAlignment = 1, VerticalAlignment = 1, BackgroundColor = (industry == "" ? colorSector : (name == "" ? colorIndustry : colorAltern))
                        });                                                                                                                                                                                                                                               //RecoMXEU
                        table.AddCell(new PdfPCell(new Phrase(poidsMXEU, arialRecoMXEU))
                        {
                            Border = Rectangle.NO_BORDER, HorizontalAlignment = 1, VerticalAlignment = 1, BackgroundColor = (industry == "" ? colorSector : (name == "" ? colorIndustry : colorAltern))
                        });                                                                                                                                                                                                                                                //PoidsMXEU
                        table.AddCell(new PdfPCell(new Phrase(recoMXEUM, arialRecoMXEUM))
                        {
                            Border = Rectangle.NO_BORDER, HorizontalAlignment = 1, VerticalAlignment = 1, BackgroundColor = (industry == "" ? colorSector : (name == "" ? colorIndustry : colorAltern))
                        });                                                                                                                                                                                                                                                 //RecoMXEUM
                        table.AddCell(new PdfPCell(new Phrase(poidsMXEUM, arialRecoMXEUM))
                        {
                            Border = Rectangle.NO_BORDER, HorizontalAlignment = 1, VerticalAlignment = 1, BackgroundColor = (industry == "" ? colorSector : (name == "" ? colorIndustry : colorAltern))
                        });                                                                                                                                                                                                                                                  //PoidsMXEUM
                    }
                    else
                    {
                        table.AddCell(new PdfPCell(new Phrase(recoMXUSLC, arialRecoMXUSLC))
                        {
                            Border = Rectangle.NO_BORDER, HorizontalAlignment = 1, VerticalAlignment = 1, BackgroundColor = (industry == "" ? colorSector : (name == "" ? colorIndustry : colorAltern))
                        });
                        table.AddCell(new PdfPCell(new Phrase(poidsMXUSLC, arialRecoMXUSLC))
                        {
                            Border = Rectangle.NO_BORDER, HorizontalAlignment = 1, VerticalAlignment = 1, BackgroundColor = (industry == "" ? colorSector : (name == "" ? colorIndustry : colorAltern))
                        });
                    }

                    pos = !pos;
                }
                newPdfDoc.Add(table);
                newPdfDoc.Close();

                System.Diagnostics.Process.Start(pathToFile);
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
            }
        }
        public void ExtractRecoMethod(RadGridView grid)
        {
            String format   = "yyyy-MM-dd";
            String dateFile = DateTime.Now.ToString(format);

            String formatTitre = "dd-MM-yyyy";
            String dateTitre   = DateTime.Now.ToString(formatTitre);

            String filepath = @"\\vill1\partage\,FGA Front Office\02_Gestion_Actions\00_BASE\03_LISTES ARGUMENTAIRES\";

            String country = "EUROPE_";

            if (!GlobalInfos.isEurope)
            {
                country = "USA_";
            }

            String filename = "ARG_" + country + dateFile;

            if (GlobalInfos.areEnsemble)
            {
                filename += "_ENSEMBLE";
            }
            if (GlobalInfos.areIndustries)
            {
                filename += "_INDUSTRIES";
            }
            if (GlobalInfos.areValues)
            {
                filename += "_VALEURS";
            }

            String pathToFile = filepath + filename + ".pdf";


            try
            {
                #region Fonts

                Font arial      = new Font(FontFactory.GetFont("Arial", 8, Font.NORMAL));
                Font arialBold  = new Font(FontFactory.GetFont("Arial", 8, Font.BOLD));
                Font arialTitle = new Font(FontFactory.GetFont("Arial", 14, Font.BOLD));

                #endregion

                #region Define document

                Document  newPdfDoc = new Document(iTextSharp.text.PageSize.A4, 0, 0, 10, 10);
                PdfWriter wri       = PdfWriter.GetInstance(newPdfDoc,
                                                            new FileStream(pathToFile, FileMode.OpenOrCreate));
                newPdfDoc.Open();
                PdfPTable table = new PdfPTable(1);

                #endregion

                #region Title
                String titre = "Argumentaires Europe ";
                if (!GlobalInfos.isEurope)
                {
                    titre = "Argumentaires USA ";
                }
                PdfPCell cell = new PdfPCell(new Phrase(titre + dateTitre, arialTitle));
                cell.BackgroundColor     = BaseColor.LIGHT_GRAY;
                cell.Colspan             = 14;
                cell.HorizontalAlignment = 1; //0=Left, 1=center, 2=right
                table.AddCell(cell);

                #endregion

                var rows = grid.ChildrenOfType <GridViewRow>();
                foreach (GridViewRow row in rows)
                {
                    #region Fields

                    String secteur    = ((TextBlock)row.Cells[1].Content).Text;  //Label_Secteur
                    String initiales  = ((TextBlock)row.Cells[2].Content).Text;; //Initiales
                    String industry   = ((TextBlock)row.Cells[3].Content).Text;  //Label_Industry
                    String ticker     = ((TextBlock)row.Cells[4].Content).Text;  //TICKER
                    String name       = ((TextBlock)row.Cells[5].Content).Text;  //Company_Name
                    String crncy      = ((TextBlock)row.Cells[6].Content).Text;; //Currency
                    String classement = ((TextBlock)row.Cells[7].Content).Text;  //Q
                    String date       = ((TextBlock)row.Cells[8].Content).Text;  //Date
                    String recoMXEM   = "";
                    String recoMXEU   = "";
                    String recoMXEUM  = "";
                    String recoMXUSLC = "";
                    if (GlobalInfos.isEurope)
                    {
                        recoMXEM  = ((TextBlock)row.Cells[9].Content).Text;  //RecoMXEM
                        recoMXEU  = ((TextBlock)row.Cells[11].Content).Text; //RecoMXEU
                        recoMXEUM = ((TextBlock)row.Cells[13].Content).Text; //RecoMXEUM
                    }
                    else
                    {
                        recoMXUSLC = ((TextBlock)row.Cells[9].Content).Text; //RecoMXEUM
                    }
                    #endregion

                    if (name == "" && industry == "")
                    {
                        name = "Secteur";
                    }
                    if (name == "")
                    {
                        name = "Industrie";
                    }

                    PdfPCell nameCell = new PdfPCell(new Phrase(name, arialBold));
                    nameCell.Colspan             = 1;
                    nameCell.HorizontalAlignment = 0; //0=Left, 1=center, 2=right
                    nameCell.BackgroundColor     = BaseColor.LIGHT_GRAY;
                    table.AddCell(nameCell);

                    String   infos    = secteur + " | " + industry + " | " + ticker + " | " + crncy + " | " + initiales;
                    PdfPCell infoCell = new PdfPCell(new Phrase(infos, arial));
                    infoCell.Colspan             = 1;
                    infoCell.HorizontalAlignment = 0; //0=Left, 1=center, 2=right
                    infoCell.BackgroundColor     = BaseColor.LIGHT_GRAY;
                    table.AddCell(infoCell);

                    String recoInfo;
                    if (GlobalInfos.isEurope)
                    {
                        recoInfo = "Classement: " + classement + " | Date: " + date
                                   + " | MXEM: " + recoMXEM + " | MXEU: " + recoMXEU + " | MXEUM: " + recoMXEUM;
                    }
                    else
                    {
                        recoInfo = "Classement: " + classement + " | Date: " + date
                                   + " | MXUSLC: " + recoMXUSLC;
                    }

                    PdfPCell recosCell = new PdfPCell(new Phrase(recoInfo, arial));
                    recosCell.Colspan             = 1;
                    recosCell.HorizontalAlignment = 0; //0=Left, 1=center, 2=right
                    recosCell.BackgroundColor     = BaseColor.LIGHT_GRAY;
                    table.AddCell(recosCell);

                    if (date != "")
                    {
                        System.Windows.Forms.RichTextBox rtBox = new System.Windows.Forms.RichTextBox();

                        if (ticker != "")
                        {
                            String recoText = _model.GetRecoTextVal(ticker, date);
                            rtBox.Rtf = recoText;
                            string plainText = rtBox.Text;
                            if (plainText == "")
                            {
                                plainText = "Pas de commentaire";
                            }
                            PdfPCell reco = new PdfPCell(new Phrase(plainText, arial));
                            reco.Colspan             = 14;
                            reco.HorizontalAlignment = 0; //0=Left, 1=center, 2=right
                            table.AddCell(reco);
                        }
                        else
                        {
                            bool   isGICS = industry == "" ? true : false;
                            String label  = isGICS ? secteur : industry;

                            String recoText = _model.GetRecoTextSec(label, date, isGICS);
                            rtBox.Rtf = recoText;
                            string plainText = rtBox.Text;
                            if (plainText == "")
                            {
                                plainText = "Pas de commentaire";
                            }
                            PdfPCell reco = new PdfPCell(new Phrase(plainText, arial));
                            reco.Colspan             = 14;
                            reco.HorizontalAlignment = 0; //0=Left, 1=center, 2=right
                            table.AddCell(reco);
                        }
                    }
                    else
                    {
                        PdfPCell reco = new PdfPCell(new Phrase("Aucun texte disponible", arial));
                        reco.Colspan             = 14;
                        reco.HorizontalAlignment = 0; //0=Left, 1=center, 2=right
                        table.AddCell(reco);
                    }
                }
                newPdfDoc.Add(table);

                newPdfDoc.Close();

                System.Diagnostics.Process.Start(pathToFile);
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
            }
        }