Exemple #1
0
        public void PrintZapr2(string pathname)
        {
            int count = 0;
            OrgSQLEntities2 otherorg = DataModul.org;
            Object wordMissing = System.Reflection.Missing.Value;

            var query = from bd in otherorg.Prizivnik
                        where (bd.Повестка == true)
                        select bd;

            if (query == null) MessageBox.Show("Не выбран ни один призывник");
            else
            {

                foreach (Призывник or in query)
                {
                    W.word Word = new W.word(pathname);

                    Word.ReplaceString("FIO", or.Фамилия +" "+ or.Имя +" " + or.Отчество, "all");
                    Word.ReplaceString("UrAdress", or.Домашний_адрес__телефон, "all");

                    if (count == 0)
                    {
                        Word.SaveAs(name);
                        Word.Close();
                        count++;
                    }
                    else if (count == 1)
                    {
                        W.word Word2 = new W.word(name);
                        Word2.copyToWord(ref Word2, Word);
                        Word2.SaveAs(name);
                        Word.wordApplication.NormalTemplate.Saved = true;
                        Word.Close();
                        Word2.wordApplication.NormalTemplate.Saved = true;
                        Word2.Close();
                    }
                }
                System.Diagnostics.Process.Start(name);
            }
        }
Exemple #2
0
 // фиксированные параметры для передачи приложению Word
 public void copyToWord(ref word MainDoc, word secondDoc)
 {
     Word.Range wordrange = secondDoc.wordApplication.ActiveDocument.Range(
        secondDoc.wordApplication.ActiveDocument.Content.Start,
        secondDoc.wordApplication.ActiveDocument.Content.End);
     wordrange.Copy();
     Word.Range w = MainDoc.wordApplication.ActiveDocument.Range(
     MainDoc.wordApplication.ActiveDocument.Content.End - 1,
     MainDoc.wordApplication.ActiveDocument.Content.End);
     w.Paste();
 }