Beispiel #1
0
        public void GerarCorpoDocumento(DocX documento)
        {
            Paragraph  section    = documento.InsertParagraph(Documento.Texto);
            Formatting formatting = new Formatting();
            Font       font       = new Font("Arial");

            //formatting.UnderlineStyle = UnderlineStyle.singleLine;
            formatting.FontFamily = font;
            formatting.Size       = 12;

            section.Font("Arial");
            section.FontSize(12);
            section.IndentationBefore = 2f;
            foreach (DadosAlunoKV dado in Dados)
            {
                if (dado.Requisito == null)
                {
                    continue;
                }
                string Nome  = dado.Requisito.Bookmark;
                string Valor = string.IsNullOrWhiteSpace(dado.Value) ? " ": dado.Value.PadRight(4);
                if (section.Text.Contains(Nome))
                {
                    if (!dado.Requisito.InText)
                    {
                        section.ReplaceText(Nome, Valor, false, System.Text.RegularExpressions.RegexOptions.None, formatting);
                    }
                    else
                    {
                        section.ReplaceText(Nome, Valor);
                    }
                }
            }
            if (section.Text.Contains(NomesRequisitos.EscolhaAreaEstagio_))
            {
                if (Dados.Any(x => x.Name.Contains(NomesRequisitos.AreasEstagio_)))
                {
                    string EscolhaArea = Dados.Where(x => x.Name.Contains(NomesRequisitos.AreasEstagio_)).First().Value;
                    section.ReplaceText(NomesRequisitos.EscolhaAreaEstagio_, EscolhaArea);
                }
                else
                {
                    section.ReplaceText(NomesRequisitos.EscolhaAreaEstagio_, "");
                }
            }
            if (section.Text.Contains(NomesRequisitos.CursoAluno_))
            {
                if (Dados.Any(x => x.Name.Contains(NomesRequisitos.CursoAluno_)))
                {
                    string EscolhaArea = Dados.Where(x => x.Name.Contains(NomesRequisitos.CursoAluno_)).First().Value;
                    section.ReplaceText(NomesRequisitos.CursoAluno_, EscolhaArea);
                }
                else
                {
                    section.ReplaceText(NomesRequisitos.CursoAluno_, "");
                }
            }
            if (Areas != null)
            {
                if (section.Text.Contains(NomesRequisitos.TabelaAreasEstagio_))
                {
                    section.ReplaceText(NomesRequisitos.TabelaAreasEstagio_, "");
                }

                Formatting Format = new Formatting();
                Format.Bold = true;

                documento.InsertParagraph("ÁREAS DE ESTÁGIO OFERECIDAS", false, Format).FontSize(14).Alignment = Alignment.center;
                documento.InsertParagraph("").AppendLine();
                documento.GerarTabelaAreaDeEstagio(Areas, IdArea);
            }
        }