예제 #1
0
        public void PopulateGraphics(IBaseTemplate template, string previousCoverPageTitle, string previousLogoTitle)
        {
            var names  = new string[2];
            var values = new string[2];

            //do not populate array with images if their values have not changed.
            if (!String.Equals(template.CoverPageTitle, previousCoverPageTitle, StringComparison.OrdinalIgnoreCase))
            {
                if (template.CoverPageImageUrl != null)
                {
                    names[0]  = Constants.ImageProperties.Theme;
                    values[0] = template.CoverPageImageUrl;
                }
            }

            if (!String.Equals(template.LogoTitle, previousLogoTitle, StringComparison.OrdinalIgnoreCase))
            {
                if (template.LogoImageUrl != null)
                {
                    names[1]  = Constants.ImageProperties.CompanyLogo;
                    values[1] = template.LogoImageUrl;
                }
            }

            Document.ChangeDocumentImages(names, values);
            Document.UpdateOrCreatePropertyValue(Constants.WordDocumentProperties.CoverPageTitle, template.CoverPageTitle);
            Document.UpdateOrCreatePropertyValue(Constants.WordDocumentProperties.LogoTitle, template.LogoTitle);
        }