Beispiel #1
0
        //  [UnitTestFunction]
        public static void TestFields()
        {
            Document doc = new Document();

            doc.Info.Author = "K.P.";
            Section   sec = doc.Sections.AddSection();
            Paragraph par = sec.AddParagraph();

            par.AddBookmark("myBookmark1");

            PageRefField prf = par.AddPageRefField("myBookmark1");

            prf.Format = "ALPHABETIC";

            PageField pf = par.AddPageField();

            pf.Format = "ROMAN";

            SectionField sf = par.AddSectionField();

            sf.Format = "roman";

            SectionPagesField spf = par.AddSectionPagesField();

            spf.Format = "roman";

            NumPagesField npf = par.AddNumPagesField();

            npf.Format = "alphabetic";

            InfoField inf = par.AddInfoField(InfoFieldType.Author);
            DateField df  = par.AddDateField("D");

            df = par.AddDateField("d");
            df = par.AddDateField("s");
            df = par.AddDateField("r");
            df = par.AddDateField("G");
            df = par.AddDateField("dddd dd.MM.yyyy");

            DocumentRenderer docRndrr = new DocumentRenderer();

            docRndrr.Render(doc, "RtfFields.txt", null);

            File.Copy("RtfFields.txt", "RtfFields.rtf", true);
            System.Diagnostics.Process.Start("RtfFields.txt");
        }