示例#1
0
        public void MergeDocumentsFile()
        {
            RtfMerger merger = new RtfMerger("..\\..\\testdocs\\merge-template.rtf");

            merger.AddPlaceHolder("$doc1$", "..\\..\\testdocs\\merge-doc1.rtf");
            merger.AddPlaceHolder("$doc2$", "..\\..\\testdocs\\merge-doc2.rtf");

            Assert.That(merger.Placeholders.Count, Is.EqualTo(2));

            merger.AddPlaceHolder("$doc3$", "..\\..\\testdocs\\merge-doc2.rtf");

            Assert.That(merger.Placeholders.Count, Is.EqualTo(3));

            merger.RemovePlaceHolder("$doc3$");

            Assert.That(merger.Placeholders.Count, Is.EqualTo(2));

            RtfTree tree = merger.Merge();

            tree.SaveRtf("..\\..\\testdocs\\merge-result-1.rtf");

            StreamReader sr = null;

            sr = new StreamReader("..\\..\\testdocs\\merge-result-1.rtf");
            string rtf1 = sr.ReadToEnd();

            sr.Close();

            sr = new StreamReader("..\\..\\testdocs\\rtf3.txt");
            string rtf3 = sr.ReadToEnd();

            sr.Close();

            Assert.That(rtf1, Is.EqualTo(rtf3));
        }
示例#2
0
        public void MergeDocumentsFile()
        {
            RtfMerger merger = new RtfMerger("..\\..\\testdocs\\merge-template.rtf");
            merger.AddPlaceHolder("$doc1$", "..\\..\\testdocs\\merge-doc1.rtf");
            merger.AddPlaceHolder("$doc2$", "..\\..\\testdocs\\merge-doc2.rtf");

            Assert.That(merger.Placeholders.Count, Is.EqualTo(2));

            merger.AddPlaceHolder("$doc3$", "..\\..\\testdocs\\merge-doc2.rtf");

            Assert.That(merger.Placeholders.Count, Is.EqualTo(3));

            merger.RemovePlaceHolder("$doc3$");

            Assert.That(merger.Placeholders.Count, Is.EqualTo(2));

            RtfTree tree = merger.Merge();
            tree.SaveRtf("..\\..\\testdocs\\merge-result-1.rtf");

            StreamReader sr = null;
            sr = new StreamReader("..\\..\\testdocs\\merge-result-1.rtf");
            string rtf1 = sr.ReadToEnd();
            sr.Close();

            sr = new StreamReader("..\\..\\testdocs\\rtf3.txt");
            string rtf3 = sr.ReadToEnd();
            sr.Close();

            Assert.That(rtf1, Is.EqualTo(rtf3));
        }
示例#3
0
        public void MergeDocumentsInMemory()
        {
            RtfMerger merger = new RtfMerger();

            RtfTree tree = new RtfTree();

            tree.LoadRtfFile("..\\..\\testdocs\\merge-template.rtf");

            merger.Template = tree;

            RtfTree ph1 = new RtfTree();

            ph1.LoadRtfFile("..\\..\\testdocs\\merge-doc1.rtf");

            RtfTree ph2 = new RtfTree();

            ph2.LoadRtfFile("..\\..\\testdocs\\merge-doc2.rtf");

            merger.AddPlaceHolder("$doc1$", ph1);
            merger.AddPlaceHolder("$doc2$", ph2);

            Assert.That(merger.Placeholders.Count, Is.EqualTo(2));

            RtfTree ph3 = new RtfTree();

            ph3.LoadRtfFile("..\\..\\testdocs\\merge-doc2.rtf");

            merger.AddPlaceHolder("$doc3$", ph3);

            Assert.That(merger.Placeholders.Count, Is.EqualTo(3));

            merger.RemovePlaceHolder("$doc3$");

            Assert.That(merger.Placeholders.Count, Is.EqualTo(2));

            RtfTree resTree = merger.Merge();

            resTree.SaveRtf("..\\..\\testdocs\\merge-result-2.rtf");

            StreamReader sr = null;

            sr = new StreamReader("..\\..\\testdocs\\merge-result-2.rtf");
            string rtf1 = sr.ReadToEnd();

            sr.Close();

            sr = new StreamReader("..\\..\\testdocs\\rtf3.txt");
            string rtf3 = sr.ReadToEnd();

            sr.Close();

            Assert.That(rtf1, Is.EqualTo(rtf3));
        }
示例#4
0
            private static void MergeDocuments()
            {
                RtfMerger merger = new RtfMerger("..\\..\\testdocs\\test-doc3.rtf");

                merger.AddPlaceHolder("[TagTextRTF1]", "..\\..\\testdocs\\merge1.rtf");
                merger.AddPlaceHolder("[TagTextRTF2]", "..\\..\\testdocs\\merge2.rtf");

                Console.WriteLine("Processing...");

                RtfTree tree = merger.Merge();

                tree.SaveRtf("..\\..\\testdocs\\merge-result.rtf");

                Console.WriteLine("File 'merge-result.txt' created.");

                Console.WriteLine("");
            }
示例#5
0
        public void MergeDocuments()
        {
            RtfMerger merger = new RtfMerger("..\\..\\testdocs\\merge-template.rtf", "..\\..\\testdocs\\merge-result.rtf", true);
            merger.AddPlaceHolder("$doc1$", "..\\..\\testdocs\\merge-doc1.rtf");
            merger.AddPlaceHolder("$doc2$", "..\\..\\testdocs\\merge-doc2.rtf");

            merger.AddPlaceHolder("$doc3$", "..\\..\\testdocs\\merge-doc2.rtf");
            merger.RemovePlaceHolder("$doc3$");

            merger.MergeRtfDoc();

            StreamReader sr = null;
            sr = new StreamReader("..\\..\\testdocs\\merge-result.rtf");
            string rtf1 = sr.ReadToEnd();
            sr.Close();

            sr = new StreamReader("..\\..\\testdocs\\rtf3.txt");
            string rtf3 = sr.ReadToEnd();
            sr.Close();

            Assert.That(rtf1, Is.EqualTo(rtf3));
        }
示例#6
0
            private static void MergeDocuments()
            {
                RtfMerger merger = new RtfMerger("..\\..\\testdocs\\test-doc3.rtf", "..\\..\\testdocs\\merge-result.rtf", true);

                merger.AddPlaceHolder("[TagTextRTF1]", "..\\..\\testdocs\\merge1.rtf");
                merger.AddPlaceHolder("[TagTextRTF2]", "..\\..\\testdocs\\merge2.rtf");

                Console.WriteLine("Processing...");

                merger.MergeRtfDoc();

                Console.WriteLine("File 'merge-result.txt' created.");

                Console.WriteLine("");
            }
示例#7
0
        public void MergeDocumentsInMemory()
        {
            RtfMerger merger = new RtfMerger();

            RtfTree tree = new RtfTree();
            tree.LoadRtfFile("..\\..\\testdocs\\merge-template.rtf");

            merger.Template = tree;

            RtfTree ph1 = new RtfTree();
            ph1.LoadRtfFile("..\\..\\testdocs\\merge-doc1.rtf");

            RtfTree ph2 = new RtfTree();
            ph2.LoadRtfFile("..\\..\\testdocs\\merge-doc2.rtf");

            merger.AddPlaceHolder("$doc1$", ph1);
            merger.AddPlaceHolder("$doc2$", ph2);

            Assert.That(merger.Placeholders.Count, Is.EqualTo(2));

            RtfTree ph3 = new RtfTree();
            ph3.LoadRtfFile("..\\..\\testdocs\\merge-doc2.rtf");

            merger.AddPlaceHolder("$doc3$", ph3);

            Assert.That(merger.Placeholders.Count, Is.EqualTo(3));

            merger.RemovePlaceHolder("$doc3$");

            Assert.That(merger.Placeholders.Count, Is.EqualTo(2));

            RtfTree resTree = merger.Merge();
            resTree.SaveRtf("..\\..\\testdocs\\merge-result-2.rtf");

            StreamReader sr = null;
            sr = new StreamReader("..\\..\\testdocs\\merge-result-2.rtf");
            string rtf1 = sr.ReadToEnd();
            sr.Close();

            sr = new StreamReader("..\\..\\testdocs\\rtf3.txt");
            string rtf3 = sr.ReadToEnd();
            sr.Close();

            Assert.That(rtf1, Is.EqualTo(rtf3));
        }