Ejemplo n.º 1
0
        static Texto TestComment(WordDoc wordDoc)
        {
            Comentario comentario = wordDoc.CreateComment();

            comentario.Append(
                "Descrição do comentário",
                new RunProperties()
            {
                Caps = new Caps()
                {
                    Val = OnOffValue.FromBoolean(true)
                }
            }
                );

            Texto texto = new Texto();

            texto.Append("Aqui vai começar um comentário, ");
            texto.StartComment(comentario.Id);
            texto.Append(
                "Texto de comentário, ",
                new RunProperties()
            {
                Bold = new Bold()
                {
                    Val = OnOffValue.FromBoolean(true)
                }
            }
                );
            texto.EndComment(comentario.Id);
            texto.Append("Texto fora do comentário,");

            return(texto);
        }
Ejemplo n.º 2
0
        private Texto ObtenerTextoFormato()
        {
            Texto t = new Texto();

            t.Iniciar();
            t.Append("HOLA");
            t.Append(" PRUEBA DE ");
            t.Append("TEXTO");
            t.AplicarFormato(Formato.CrearTamLetra(new Medicion(5, Unidad.Puntos)), 0, 6);
            t.AplicarFormato(Formato.CrearNegrilla(true), 2, 9);
            t.AplicarFormato(Formato.CrearCursiva(true), 5, 6);
            t.AplicarFormato(Formato.CrearEscalaLetra(1.1f), 8, 10);
            t.AplicarFormato(Formato.CrearEscalaLetra(1.1f), 1, 2);
            t.AplicarFormato(Formato.CrearSubrayado(true), t.Length - 5, 5);
            //Revisar negrilla
            foreach (IndiceBloque i in t.ObtenerIndices())
            {
                for (int o = 0; o < 6; o++)
                {
                    if (i.ContieneCaracter(o))
                    {
                        Debug.Assert(i.Formato.TamLetra.Value.Valor == 5 && i.Formato.TamLetra.Value.Unidad == Unidad.Puntos);
                    }
                }
                for (int o = 2; o < 2 + 9; o++)
                {
                    if (i.ContieneCaracter(o))
                    {
                        Debug.Assert(i.Formato.Negrilla.Value == true);
                    }
                }
                for (int o = 5; o < 5 + 6; o++)
                {
                    if (i.ContieneCaracter(o))
                    {
                        Debug.Assert(i.Formato.Cursiva.Value == true);
                    }
                }
                for (int o = 8; o < 8 + 10; o++)
                {
                    if (i.ContieneCaracter(o))
                    {
                        Debug.Assert(i.Formato.ObtenerEscalaLetra() == 1.1F);
                    }
                }
                for (int o = t.Length - 5; o < t.Length; o++)
                {
                    if (i.ContieneCaracter(o))
                    {
                        Debug.Assert(i.Formato.Subrayado == true);
                    }
                }
            }
            t.SimplificarFormato();
            return(t);
        }
Ejemplo n.º 3
0
        public void ProbarAdicion()
        {
            Texto t = new Texto();

            t.Iniciar();
            t.Append("HOLA");
            t.Append(" PRUEBA DE ");
            t.Append("TEXTO");
            Debug.Assert(t.ToString() == "HOLA PRUEBA DE TEXTO");
        }
Ejemplo n.º 4
0
        Texto ObtenerTextoPrueba()
        {
            Texto t = new Texto();

            t.Iniciar();
            t.Append("HOLA");
            t.Append(" PRUEBA DE ");
            t.Append("TEXTO");
            t.AplicarFormato(Formato.CrearNegrilla(true), 2, 9);
            t.AplicarFormato(Formato.CrearCursiva(true), 5, 6);
            t.AplicarFormato(Formato.CrearEscalaLetra(1.1f), 8, 10);
            t.AplicarFormato(Formato.CrearSubrayado(true), t.Length, t.Length - 5);
            return(t);
        }