private static string GetStyleMapKeyName(StyleMapKeyType styleKeyType, StyleMapArgs args) { switch (styleKeyType) { case StyleMapKeyType.Heading: if (args == null) { throw new ArgumentNullException(nameof(args), "Cannot be set null for this parameter."); } var headingArgs = (HeadingStyleMapArgs)args; if (headingArgs.Level < 1) { throw new ArgumentOutOfRangeException(nameof(headingArgs.Level), headingArgs.Level, "The acceptable value is greater than equal to 1."); } return("Heading" + headingArgs.Level.ToString()); case StyleMapKeyType.Paragraph: return("Paragraph"); case StyleMapKeyType.Hyperlink: return("Hyperlink"); case StyleMapKeyType.ListItem: return("List"); case StyleMapKeyType.Quote: return("Quote"); case StyleMapKeyType.Code: return("Code"); case StyleMapKeyType.Table: return("Table"); default: throw new NotImplementedException(string.Format("Unknown style mapping key type: {0}", styleKeyType.ToString())); } }
public string GetStyleId(StyleMapKeyType styleKeyType, StyleMapArgs args) { var key = GetStyleMapKeyName(styleKeyType, args); return(StyleMap.ContainsKey(key) ? StyleMap[key] : ""); }