Ejemplo n.º 1
0
 private void AddValueOfBookmark(string bookmarkName, string value, Word.Document wordDocument)
 {
     if (wordDocument.Bookmarks.Exists(bookmarkName))
     {
         wordDocument.Bookmarks[bookmarkName].Range.Text = value;
     }
 }
Ejemplo n.º 2
0
        void FillingAllWordStub(Word.Document wordDocument, int id, DateTime date, List <Document> docs, string orgName,
                                string clientName, string identityClientName, string cost, string memo, string paymentStatus, string employee, Sign sign, string entryType = "")
        {
            try
            {
                AddValueOfBookmark("id", id.ToString(), wordDocument);
                AddValueOfBookmark("date", date.ToShortDateString(), wordDocument);
                AddValueOfBookmark("numRazresh", (GenerateRequisites(docs)), wordDocument);
                AddValueOfBookmark("memo", memo, wordDocument);
                AddValueOfBookmark("orgName", orgName, wordDocument);
                AddValueOfBookmark("clientName", identityClientName, wordDocument);
                AddValueOfBookmark("clientName2", clientName, wordDocument);
                AddValueOfBookmark("typeDoc", docs.Count > 0 ? docs.GetDocsType().ToStringName() : entryType, wordDocument);
                if (cost == "0" || cost == "бесплатно")
                {
                    AddValueOfBookmark("cost", "бесплатно", wordDocument);
                }
                else
                {
                    AddValueOfBookmark("cost", cost + " руб.", wordDocument);
                }
                AddValueOfBookmark("paymentStatus", paymentStatus, wordDocument);
                AddValueOfBookmark("employee", employee, wordDocument);

                AddValueOfBookmark("directorPost", sign.Owner.Post, wordDocument);
                AddValueOfBookmark("directorName", sign.Owner.ShortName, wordDocument);

                AddImageOfBookmark("directorSign", sign.GetBitmapSign(), wordDocument);
            }
            catch (Exception ex)
            {
                throw new Exception("Не удалось заполнить шаблоны подстановки в документе Word." + ex.Message);
            }
        }
Ejemplo n.º 3
0
        private void AddImageOfBookmark(string v, Bitmap bitmap, Word.Document wordDocument)
        {
            var r = wordDocument.Bookmarks[v].Range;

            Clipboard.SetDataObject(bitmap);
            r.Paste();
            Clipboard.Clear();
            //wordDocument.InlineShapes.AddPicture("D:\\Гончарова_sign.jpg", ref missing, ref saveWithDocument, ref r);
        }