Ejemplo n.º 1
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);
            }
        }