private static NFieldInline CreateMailMergeField(NMailMergeFieldValue value) { NFieldInline fieldInline = new NFieldInline(value); fieldInline.FontStyle = ENFontStyle.Bold; return(fieldInline); }
/// <summary> /// /// </summary> /// <param name="arg"></param> void OnUpdateAllFieldsButtonClick(NEventArgs arg) { m_RichText.Content.VisitRanges(delegate(NRangeTextElement range) { NFieldInline field = range as NFieldInline; if (field != null) { field.Update(); } }); }
protected override void PopulateRichText() { NSection section = new NSection(); m_RichText.Content.Sections.Add(section); section.Blocks.Add(GetDescriptionBlock("Field Inlines", "The example shows how to use field inlines.", 1)); section.Blocks.Add(GetNoteBlock("Not all field values are always available. Please check the documentation for more information.", 1)); // add numeric fields section.Blocks.Add(GetTitleParagraph("Numeric Fields", 2)); ENNumericFieldName[] numericFields = NEnum.GetValues <ENNumericFieldName>(); string[] numericFieldNames = NEnum.GetNames <ENNumericFieldName>(); for (int i = 0; i < numericFieldNames.Length; i++) { NParagraph paragraph = new NParagraph(); paragraph.Inlines.Add(new NTextInline(numericFieldNames[i] + " [")); NFieldInline fieldInline = new NFieldInline(); fieldInline.Value = new NNumericFieldValue(numericFields[i]); fieldInline.Text = "Not Updated"; paragraph.Inlines.Add(fieldInline); paragraph.Inlines.Add(new NTextInline("]")); section.Blocks.Add(paragraph); } // add date time fields section.Blocks.Add(GetTitleParagraph("Date/Time Fields", 2)); ENDateTimeFieldName[] dateTimeFields = NEnum.GetValues <ENDateTimeFieldName>(); string[] dateTimecFieldNames = NEnum.GetNames <ENDateTimeFieldName>(); for (int i = 0; i < dateTimecFieldNames.Length; i++) { NParagraph paragraph = new NParagraph(); paragraph.Inlines.Add(new NTextInline(dateTimecFieldNames[i] + " [")); NFieldInline fieldInline = new NFieldInline(); fieldInline.Value = new NDateTimeFieldValue(dateTimeFields[i]); fieldInline.Text = "Not Updated"; paragraph.Inlines.Add(fieldInline); paragraph.Inlines.Add(new NTextInline("]")); section.Blocks.Add(paragraph); } // add string fields section.Blocks.Add(GetTitleParagraph("String Fields", 2)); ENStringFieldName[] stringFields = NEnum.GetValues <ENStringFieldName>(); string[] stringcFieldNames = NEnum.GetNames <ENStringFieldName>(); for (int i = 0; i < stringcFieldNames.Length; i++) { NParagraph paragraph = new NParagraph(); paragraph.Inlines.Add(new NTextInline(stringcFieldNames[i] + " [")); NFieldInline fieldInline = new NFieldInline(); fieldInline.Value = new NStringFieldValue(stringFields[i]); fieldInline.Text = "Not Updated"; paragraph.Inlines.Add(fieldInline); paragraph.Inlines.Add(new NTextInline("]")); section.Blocks.Add(paragraph); } }