Beispiel #1
0
        static void Main(string[] args)
        {
            List <Congratulation> congratulationList = new List <Congratulation>();
            //Congratulation c1 = new BusinessLogic.Congratulation("Игорь", "счастья", "здоровья", "успехов");
            //Congratulation c2 = new BusinessLogic.Congratulation("Игорь2", "счастья", "здоровья", "успехов");

            //congratulationList.Add(c1);
            //congratulationList.Add(c2);

            WordWorker ww = new WordWorker();

            ExcelWorker ew        = new ExcelWorker();
            var         adressees = new List <string>();

            adressees = ew.getNamesOfAdressees();
            foreach (var name in adressees)
            {
                Congratulation c1 = new BusinessLogic.Congratulation(name, "счастья", "здоровья", "успехов");
                congratulationList.Add(c1);
            }
            ew.closeApp();

            foreach (var c in congratulationList)
            {
                ww.createCongratulation(c);
            }

            ww.showApp();
            ww.closeApp();

            Console.ReadLine();
        }
        public void createCongratulation(Congratulation cngrtln)
        {
            var bm = app.ActiveDocument.Bookmarks[bookmarks[0]].Range.Text = cngrtln.Name;

            bm = app.ActiveDocument.Bookmarks[bookmarks[1]].Range.Text = cngrtln.Wish1;
            bm = app.ActiveDocument.Bookmarks[bookmarks[2]].Range.Text = cngrtln.Wish2;
            bm = app.ActiveDocument.Bookmarks[bookmarks[3]].Range.Text = cngrtln.Wish3;

            app.Selection.EndKey(WdUnits.wdStory);
            app.Selection.InsertNewPage();
            app.Selection.InsertFile(path, "", true, false, false);
        }