void document_PrepareSnList(object sender, PrepareSnListEventArgs e) { // Change the style applied to the SnapList depending on its data source. for (int i = 0; i < e.Template.Fields.Count; i++) { Field field = e.Template.Fields[i]; SnapEntity eTemplateParseField = e.Template.ParseField(field); SnapList snList = eTemplateParseField as SnapList; if (snList == null) { continue; } if (snList.DataSourceName.Equals(employeeDataSourceName)) { snList.BeginUpdate(); SetTablesStyle(snList, employeeStyleName); snList.EndUpdate(); } else if (snList.DataSourceName.Equals(customerDataSourceName)) { snList.BeginUpdate(); SetTablesStyle(snList, customerStyleName); snList.EndUpdate(); } } }
void Document_PrepareSnList(object sender, PrepareSnListEventArgs e) { foreach (var field in e.Template.Fields) { SnapList list = e.Template.ParseField(field) as SnapList; if (object.ReferenceEquals(list, null)) { continue; } list.BeginUpdate(); list.ListHeader.Delete(list.ListHeader.Range); SnapDocument template = list.RowTemplate; template.Delete(template.Range); foreach (DataFieldInfo dataField in this.dataFields) { template.AppendText(string.Format("{0} = ", dataField.DisplayName)); template.CreateSnText(template.Range.End, dataField.DataPaths[dataField.DataPaths.Length - 1]); template.Paragraphs.Append(); } template.Paragraphs.Append(); list.EndUpdate(); break; } this.dataFields = null; }