/// <summary>Register decorators from xml definitions</summary> /// <param name="xml">The xml that contains the decorators definitions </param> public void RegisterDecoratorsFromXml(string xml) { try { XmlExcelDecorators xmlDecorators = XmlExcelDecorators.CreateInstance(xml); if (xmlDecorators == null) { return; } if (xmlDecorators.RangeDecorators != null) { foreach (XmlExcelRangeDecorator xmlDecorator in xmlDecorators.RangeDecorators) { ExcelRangeDecorator rangeDecorator = ExcelRangeDecorator.CreateInstance(xmlDecorator); RegisterDecorator(rangeDecorator); } } } catch (Exception ex) { string message = xml.Length > 350 ? xml.Substring(0, 350) + "..." : xml; throw new EtkException($"Cannot create decorators from xml '{message}':{ex.Message}"); } }
/// <summary> Register a decorator for future use</summary> /// <param name="decorator">The decorator to register</param> public void RegisterDecorator(ExcelRangeDecorator decorator) { if (decorator == null) { return; } try { RegisterDecorator((Decorator)decorator); } catch (Exception ex) { throw new EtkException($"Cannot register decorator '{decorator.Ident ?? string.Empty}':{ex.Message}"); } }
public ExcelElementDecorator(ExcelInterop.Range range, ExcelRangeDecorator decorator, IBindingContextElement contextElement) { this.range = range; this.decorator = decorator; this.contextElement = contextElement; }
/// <summary> Implements <see cref="IExcelTemplateManager.RegisterDecorator"/> </summary> public void RegisterDecorator(ExcelRangeDecorator rangeDecorator) { excelDecoratorsManager.RegisterDecorator(rangeDecorator); }