Example #1
0
        private ExportHeader LoadExportHeader(XmlNode node, Export export)
        {
            ExportHeader header = new ExportHeader(export);

            foreach (XmlNode xn in node.ChildNodes)
            {
                if ("#comment" == xn.Name)
                {
                    continue;
                }
                ExportHeaderColumnMapping excolumn = LoadExportHeaderColumnMapping(xn, export);
                header.Add(excolumn.Location, excolumn);
            }

            return(header);
        }
Example #2
0
        private ExportHeaderColumnMapping LoadExportHeaderColumnMapping(XmlNode node, Export export)
        {
            //ColumnMapType mapType = ColumnMapType.ExcelHeader;
            //XmlNode mapTypeNode = node.Attributes.GetNamedItem("mapType");
            //if (mapTypeNode != null)
            //    mapType = "dataheader".EqualsIgnoreCase(mapTypeNode.Value.Trim()) ? ColumnMapType.DataHeader : ColumnMapType.ExcelHeader;

            ExportHeaderColumnMapping column = new ExportHeaderColumnMapping(export);

            foreach (XmlAttribute xa in node.Attributes)
            {
                switch (xa.Name)
                {
                case "col":
                    column.ColumnName = xa.Value.Trim();
                    break;

                case "row":
                    column.RowIndex = xa.Value.Trim().SafeToInt() - 1;
                    break;

                case "prop":
                    column.PropertyName = xa.Value.Trim();
                    break;

                case "propType":
                    column.PropertyType = "normal".EqualsIgnoreCase(xa.Value.Trim()) ? PropertyType.Normal : PropertyType.Expression;
                    break;

                case "offset":
                    column.Offset = xa.Value.Trim().SafeToBool();
                    break;

                default:
                    break;
                }
            }
            return(column);
        }