예제 #1
0
        private static DocumentRow ExtractHeaderInformation(XmlNode childNode, Document document)
        {
            var docRow = new DocumentRow(document);

            foreach (XmlNode xmlNode in childNode.ChildNodes)
            {
                if (xmlNode.Attributes != null && xmlNode.Attributes.Count > 0)
                {
                    var nameAttrib = xmlNode.Attributes.GetNamedItem("NAME");
                    if (nameAttrib.IsNull())
                    {
                        nameAttrib = xmlNode.Attributes.GetNamedItem("name");
                    }
                    if (nameAttrib.IsNull())
                    {
                        nameAttrib = xmlNode.Attributes.GetNamedItem("Name");
                    }
                    if (nameAttrib != null)
                    {
                        docRow.Add(nameAttrib.InnerText);
                    }
                    else
                    {
                        docRow.Add(GetNameFromNode(xmlNode));
                    }
                }
                else
                {
                    docRow.Add(GetNameFromNode(xmlNode));
                }
            }
            return(docRow);
        }
예제 #2
0
        private static DocumentRow GetRow(XmlNode childNode, Document document)
        {
            var docRow = new DocumentRow(document);

            foreach (XmlNode xmlNode in childNode.ChildNodes)
            {
                docRow.Add(xmlNode.InnerText);
            }
            return(docRow);
        }
예제 #3
0
        private static DocumentRow ParseRow(IExcelDataReader reader, Document parent)
        {
            var docRow = new DocumentRow(parent);

            for (var i = 0; i < reader.FieldCount; i++)
            {
                docRow.Add(reader.GetString(i));
            }
            return(docRow);
        }
예제 #4
0
        protected DocumentRow ParseRow(string row, Document document)
        {
            var documentRow = new DocumentRow(document);

            string[] rowContent;
            if (ConfigurationManagerHelper.GetValueOnKey("stardust.useRegexParsing") == "true")
            {
                var regex   = @",(?=(?:[^\""]*\""[^\""]*\"")*(?![^\""]*\""))";
                var myRegex = new Regex(regex, RegexOptions.IgnoreCase | RegexOptions.Singleline | RegexOptions.IgnorePatternWhitespace);
                rowContent = myRegex.Split(row);
            }
            else
            {
                rowContent = row.Replace("\r", "").Split(Delimiter.ToCharArray());
            }
            foreach (var collumn in GetCells(rowContent))
            {
                AddColumn(documentRow, collumn);
            }
            return(documentRow);
        }
예제 #5
0
 protected static void AddColumn(DocumentRow documentRow, string collumn)
 {
     documentRow.Add(collumn);
 }
예제 #6
0
 protected void SetHeader(Document doc, DocumentRow row)
 {
     doc.SetHeaders(row);
 }
예제 #7
0
 protected void AddRow(Document doc, DocumentRow row)
 {
     doc.Add(row);
 }