private void insertAARank(wp.Paragraph par)
        {
            List<ReportRow> results;
            //MediasCompetencia medias;
            wp.Paragraph tempPar = new wp.Paragraph(); ;
            wp.TableRow tRow;
            setupAARankTable();
            wp.Table novaTabela = tempTable.Clone() as wp.Table;

            clearParagraphText(par);

            results = repCalcs.getRankingSELF();

            foreach (ReportRow rr in results)
            {
                tRow = tempRowImpar.Clone() as wp.TableRow;
                setText(rr.dados[0], tRow.Elements<wp.TableCell>().ElementAt(0));
                setText(rr.dados[2], tRow.Elements<wp.TableCell>().ElementAt(1));
                setText(rr.dados[1], tRow.Elements<wp.TableCell>().ElementAt(2));
                novaTabela.Append(tRow);
            }
            par.RemoveAllChildren<wp.Text>();
            par.Append(novaTabela);
        }
        private void insertAADerailers(wp.Paragraph par)
        {
            List<ReportRow> results;
            wp.Paragraph tempPar = new wp.Paragraph(); ;
            wp.TableRow tRow;
            setupAADerailersTableTemplate();
            int count;
            wp.Table novaTabela = tempTable.Clone() as wp.Table;
            wp.SymbolChar simbolo;
            float valor;
            clearParagraphText(par);

            // temos de lidar aqui com o bloco dos derailers
            foreach (FamiliaCompetencias fam in _Modelo.Familias.Values)
                foreach (Competencia comp in fam.Competencias.Values.Where(a => a.Type == "D"))
                {
                    results = repCalcs.getAvaliacaoDerailersExtended(comp.CompetenciaID);
                    //medias = repCalcs.getMediasCompetencia(comp.CompetenciaID);

                    tRow = tempRowHeader.Clone() as wp.TableRow;
                    setText(repCalcs.getCompetenciaText(comp.CompetenciaID), tRow.Elements<wp.TableCell>().ElementAt(0));

                    //setText(medias.mS.ToString("0.00"), tRow.Elements<wp.TableCell>().ElementAt(1));
                    novaTabela.Append(tRow);

                    tRow = tempRowSeparador.Clone() as wp.TableRow; //separador
                    novaTabela.Append(tRow);

                    tRow = tempRowHeader2.Clone() as wp.TableRow; //segundo header
                    novaTabela.Append(tRow);

                    count = 1;
                    results.RemoveAt(0); // para retirara as legendas que aqui não são utilizadas

                    foreach (ReportRow rr in results)
                    {
                        if (count % 2 == 0)
                        {
                            //par
                            tRow = tempRowPar.Clone() as wp.TableRow;
                        }
                        else
                        {
                            //impar
                            tRow = tempRowImpar.Clone() as wp.TableRow;
                        }

                        setText(rr.dados[0], tRow.Elements<wp.TableCell>().ElementAt(0));
                        valor = float.Parse(rr.dados[6]);

                        if (valor <= 2)
                        {
                            // on target
                            simbolo = symbTarget.Clone() as wp.SymbolChar;
                        }
                        else if (valor >= 4)
                        {
                            // a desenvolver
                            simbolo = symbDelevop.Clone() as wp.SymbolChar;
                        }
                        else
                        {
                            // neutro
                            simbolo = symbNeutral.Clone() as wp.SymbolChar;
                        }

                        tRow.Elements<wp.TableCell>().ElementAt(1).Elements<wp.Paragraph>().First().Elements<wp.Run>().First().AppendChild<wp.SymbolChar>(simbolo);

                        if (rr.dados[6] == "-1.00")
                            rr.dados[6] = "-";
                        setText(rr.dados[6], tRow.Elements<wp.TableCell>().ElementAt(2));
                        novaTabela.Append(tRow);
                        count++;
                    }

                    // colocar um parágrafo

                    novaTabela.Append(tempParagraph.Clone() as wp.Paragraph);

                }

            par.RemoveAllChildren<wp.Text>();
            par.Append(novaTabela);
        }
Beispiel #3
0
 private static void ModifyWordParagraphTextContent(OXW.Paragraph paragraph, string txt)
 {
     if (null != paragraph)
     {
         OXW.Run run = paragraph.Descendants<OXW.Run>().FirstOrDefault();
         if (null != run)
         {
             run = run.CloneNode(true) as OXW.Run;
             paragraph.RemoveAllChildren<OXW.Run>();
         }
         else
         {
             run = new OXW.Run();
         }
             OXW.Text text = run.Descendants<OXW.Text>().FirstOrDefault();
             text = (null == text ? new OXW.Text() : text.CloneNode(true) as OXW.Text);
             run.RemoveAllChildren<OXW.Text>();
             text.Text = txt;
         if (!string.IsNullOrEmpty(txt) && (char.IsWhiteSpace(txt[0]) || char.IsWhiteSpace(txt[txt.Length-1]))) {
             text.Space = SpaceProcessingModeValues.Preserve;
         }
             run.Append(text);
             paragraph.Append(run);
         }
 }
        private void insertAABehaveTables(Boolean auto, wp.Paragraph par)
        {
            List<ReportRow> results;
            MediasCompetencia medias;
            wp.Paragraph tempPar = new wp.Paragraph(); ;
            wp.TableRow tRow;
            setupAABehaveTableTemplate();
            int count;
            wp.Table novaTabela = tempTable.Clone() as wp.Table;

            clearParagraphText(par);

            // temos de lidar aqui com o bloco dos derailers
            foreach (FamiliaCompetencias fam in _Modelo.Familias.Values)
                foreach (Competencia comp in fam.Competencias.Values.Where(a => a.Type != "D"))
                {
                    results = repCalcs.getAvaliacaoComportamentosCriticosExtended(comp.CompetenciaID);
                    medias = repCalcs.getMediasCompetencia(comp.CompetenciaID);

                    tRow = tempRowHeader.Clone() as wp.TableRow;
                    setText(repCalcs.getCompetenciaText(comp.CompetenciaID), tRow.Elements<wp.TableCell>().ElementAt(0));

                    setText(medias.mS.ToString("0.00"), tRow.Elements<wp.TableCell>().ElementAt(1));
                    novaTabela.Append(tRow);

                    tRow = tempRowSeparador.Clone() as wp.TableRow; //separador
                    novaTabela.Append(tRow);

                    tRow = tempRowHeader2.Clone() as wp.TableRow; //segundo header
                    novaTabela.Append(tRow);

                    count = 1;
                    results.RemoveAt(0); // para retirara as legendas que aqui naão são utilizadas

                    foreach (ReportRow rr in results)
                    {
                        if (count % 2 == 0)
                        {
                            //par
                            tRow = tempRowPar.Clone() as wp.TableRow;
                        }
                        else
                        {
                            //impar
                            tRow = tempRowImpar.Clone() as wp.TableRow;
                        }

                        setText(rr.dados[0], tRow.Elements<wp.TableCell>().ElementAt(0));
                        if (rr.dados[1] == "0")
                            rr.dados[1] = "";
                        setText(rr.dados[1], tRow.Elements<wp.TableCell>().ElementAt(1));
                        if (rr.dados[6] == "-1.00")
                            rr.dados[6] = "-";
                        setText(rr.dados[6], tRow.Elements<wp.TableCell>().ElementAt(2));
                        novaTabela.Append(tRow);
                        count++;
                    }

                    // colocar um parágrafo

                    novaTabela.Append(tempParagraph.Clone() as wp.Paragraph);

                }

            par.RemoveAllChildren<wp.Text>();
            par.Append(novaTabela);
        }
Beispiel #5
0
 private static void ModifyWordCellTextContent(OXW.TableCell cell, string txt)
 {
     if (null != cell)
     {
         OXW.Paragraph paragraph = cell.Descendants<OXW.Paragraph>().FirstOrDefault();
         if (null != paragraph)
         {
             paragraph = paragraph.CloneNode(true) as OXW.Paragraph;
             ModifyWordParagraphTextContent(paragraph, txt);
             cell.RemoveAllChildren<OXW.Paragraph>();
             cell.Append(paragraph);
         }
     }
 }