public void PopulateData(IBaseTemplate template) { //populate field controls. foreach (PropertyInfo pInfo in template.GetType().GetProperties()) { if (pInfo == null) { break; } string value = String.Empty; if (pInfo.GetValue(template, null) != null) { value = pInfo.GetValue(template, null).ToString(); } Document.PopulateControl(pInfo.Name, value); } Document.UpdateFields(); CloseInformationPanel(); }
public object LoadData(IBaseTemplate template) { //read content controls and set template values. foreach (PropertyInfo pInfo in template.GetType().GetProperties()) { if (pInfo == null) { break; } if (!String.Equals(pInfo.PropertyType.Name, "string", StringComparison.OrdinalIgnoreCase)) { continue; } string value = Document.ReadContentControlValue(pInfo.Name); pInfo.SetValue(template, value, null); } //read cover page and logo property values and set template values template.CoverPageTitle = Document.GetPropertyValue(Constants.WordDocumentProperties.CoverPageTitle); template.LogoTitle = Document.GetPropertyValue(Constants.WordDocumentProperties.LogoTitle); return(template); }
public virtual void PopulateDocument(IBaseTemplate template, string previousCoverPageTitle, string previousLogoTitle) { //populate the content controls BaseWizardPresenter.PopulateData(template); //change the graphics selected // if (Streams == null) return; BaseWizardPresenter.PopulateGraphics(template, previousCoverPageTitle, previousLogoTitle); BaseWizardPresenter.UpdateFields(); var type = template.GetType(); //var propertyName = Constants.WordDocumentProperties.UsedDateOfLogo; //if(key.Equals("Themes",StringComparison.OrdinalIgnoreCase)) // propertyName = Constants.WordDocumentProperties.UsedDateOfTheme; var date = DateTime.Now.ToString("dd/MM/yy"); var logoVal = string.Format("{0};{1}", template.LogoImageUrl, date); var themeVal = string.Format("{0};{1}", template.CoverPageImageUrl, date); BaseWizardPresenter.CreateOrUpdateDocumentProperty(Constants.WordDocumentProperties.UsedDateOfLogo, logoVal); BaseWizardPresenter.CreateOrUpdateDocumentProperty(Constants.WordDocumentProperties.UsedDateOfTheme, themeVal); BaseWizardPresenter.CreateOrUpdateDocumentProperty(Constants.WordDocumentProperties.DocumentGeneratedDate, date); }