Adding custom macro to WORD to convert the entered data

Case

I need to add custom macro to WORD to convert the entered data.

Solution

  1. Create a new [Source code] schema in the configuration.
  2. The schema content should be taken from the DateTimeExpressionConveter schema.
  3. From line 22, change the code for the needed one:
ExpressionConverterAttribute("<MacrosName>")]
public class <MacrosName>ExpressionConveter : IExpressionConverter {
    public string Evaluate(object value, string arguments = "") {
        string dateFormat = "dd.MM.yyyy";
        if (!arguments.IsNullOrEmpty()) {
            dateFormat = arguments;
        }
        DateTime date;
        if (DateTime.TryParse((string)value, out date)) {
            return date.ToString(dateFormat);
        }
        return string.Empty;
    }
}

Addding macro to the displayed value is performed in Word, read more at https://academy.bpmonline.com/documents/technic-sdk/7-7/how-create-own-…

Like 0

Like

Share

0 comments
Show all comments