Exemplo n.º 1
0
 /**
 * For Interface RtfField.
 * @param writer
 * @param outp
 * @throws IOException
 */
 public virtual void Write( RtfWriter writer, Stream outp )
 {
     WriteRtfFieldBegin(outp);
     WriteRtfFieldModifiers(outp);
     WriteRtfFieldInstBegin(outp);
     writer.WriteInitialFontSignature( outp, this );
     WriteRtfFieldInitializationStuff(outp);
     WriteRtfFieldInstEnd(outp);
     WriteRtfFieldResultBegin(outp);
     writer.WriteInitialFontSignature( outp, this );
     WriteRtfFieldResultStuff(outp);
     WriteRtfFieldResultEnd(outp);
     WriteRtfFieldEnd(outp);
 }
Exemplo n.º 2
0
        /**
        * @see com.lowagie.text.rtf.RtfField#write(com.lowagie.text.rtf.RtfWriter, java.io.Stream)
        */
        public void Write( RtfWriter writer, Stream outp )
        {
            writer.WriteInitialFontSignature( outp, this );
            byte[] t = DocWriter.GetISOBytes(RtfWriter.FilterSpecialChar( Content, true ));
            outp.Write(t, 0, t.Length);
            writer.WriteFinishingFontSignature( outp, this );

            if (addTOCAsTOCEntry) {
                RtfTOCEntry entry = new RtfTOCEntry( entryName, entryFont );
                entry.HideText();
                writer.Add( entry );
            }

            // line break after headline
            outp.WriteByte(RtfWriter.escape);
            outp.Write( RtfWriter.paragraph , 0,  RtfWriter.paragraph .Length);
            outp.WriteByte(RtfWriter.delimiter);

            // toc field entry
            outp.WriteByte(RtfWriter.openGroup);
            outp.WriteByte(RtfWriter.escape);
            outp.Write( RtfWriter.field , 0,  RtfWriter.field .Length);
            // field initialization stuff
            outp.WriteByte(RtfWriter.openGroup);
            outp.WriteByte(RtfWriter.escape);
            outp.Write( RtfWriter.fieldContent , 0,  RtfWriter.fieldContent .Length);
            outp.WriteByte(RtfWriter.delimiter);
            t = DocWriter.GetISOBytes("TOC");
            outp.Write(t, 0, t.Length);
            // create the TOC based on the 'toc entries'
            outp.WriteByte(RtfWriter.delimiter);
            outp.WriteByte(RtfWriter.escape);
            outp.WriteByte(RtfWriter.escape);
            outp.WriteByte( (byte)'f' );
            outp.WriteByte(RtfWriter.delimiter);
            // create Hyperlink TOC Entrie
            outp.WriteByte(RtfWriter.escape);
            outp.WriteByte(RtfWriter.escape);
            outp.WriteByte( (byte)'h');
            outp.WriteByte(RtfWriter.delimiter);
            // create the TOC based on the paragraph level
            outp.WriteByte(RtfWriter.delimiter);
            outp.WriteByte(RtfWriter.escape);
            outp.WriteByte(RtfWriter.escape);
            outp.WriteByte( (byte)'u' );
            outp.WriteByte(RtfWriter.delimiter);
            // create the TOC based on the paragraph headlines 1-5
            outp.WriteByte(RtfWriter.delimiter);
            outp.WriteByte(RtfWriter.escape);
            outp.WriteByte(RtfWriter.escape);
            outp.WriteByte( (byte)'o' );
            outp.WriteByte(RtfWriter.delimiter);
            t = DocWriter.GetISOBytes("\"1-5\"");
            outp.Write(t, 0, t.Length);
            outp.WriteByte(RtfWriter.delimiter);
            outp.WriteByte(RtfWriter.closeGroup);

            // field default result stuff
            outp.WriteByte(RtfWriter.openGroup);
            outp.WriteByte(RtfWriter.escape);
            outp.Write( RtfWriter.fieldDisplay , 0,  RtfWriter.fieldDisplay .Length);
            outp.WriteByte(RtfWriter.delimiter);
            t = DocWriter.GetISOBytes(defaultText);
            outp.Write(t, 0, t.Length);
            outp.WriteByte(RtfWriter.delimiter);
            outp.WriteByte(RtfWriter.closeGroup);
            outp.WriteByte(RtfWriter.closeGroup);
        }
Exemplo n.º 3
0
 /**
 * write this RtfField into a stream using the writer given as
 * first argument.
 * @param writer the RtfWriter to use to write this RtfField
 * @param outp the Stream to write this RtfField into.
 * @throws IOException
 */
 public override void Write( RtfWriter writer, Stream outp )
 {
     writer.WriteInitialFontSignature( outp, this );
     byte[] t = DocWriter.GetISOBytes(content);
     outp.Write(t, 0, t.Length);
     writer.WriteFinishingFontSignature( outp, this );
     base.Write(writer, outp);
 }
Exemplo n.º 4
0
        /**
         * @see com.lowagie.text.rtf.RtfField#write(com.lowagie.text.rtf.RtfWriter, java.io.Stream)
         */
        public void Write( RtfWriter writer, Stream outp )
        {
            if (!hideText) {
            writer.WriteInitialFontSignature( outp, new Chunk("", contentFont) );
            byte[] t = DocWriter.GetISOBytes(RtfWriter.FilterSpecialChar( Content, true ));
            outp.Write(t, 0, t.Length);
            writer.WriteFinishingFontSignature( outp, new Chunk("", contentFont) );
            }

            if (!entryFont.Equals( contentFont )) {
            writer.WriteInitialFontSignature(outp, new Chunk("", entryFont) );
            WriteField( outp );
            writer.WriteFinishingFontSignature(outp, new Chunk("", entryFont) );
            } else {
            writer.WriteInitialFontSignature(outp, new Chunk("", contentFont) );
            WriteField( outp );
            writer.WriteFinishingFontSignature(outp, new Chunk("", contentFont) );
            }
        }