OfficeOpenXml.ExcelHeaderFooterText.ExcelHeaderFooterText C# (CSharp) Method

ExcelHeaderFooterText() private method

private ExcelHeaderFooterText ( XmlNode TextNode, OfficeOpenXml.ExcelWorksheet ws, string hf ) : System
TextNode System.Xml.XmlNode
ws OfficeOpenXml.ExcelWorksheet
hf string
return System
        internal ExcelHeaderFooterText(XmlNode TextNode, ExcelWorksheet ws, string hf)
        {
            _ws = ws;
            _hf = hf;
            if (TextNode == null || string.IsNullOrEmpty(TextNode.InnerText)) return;
            string text = TextNode.InnerText;
            string code = text.Substring(0, 2);
            int startPos=2;
            for (int pos=startPos;pos<text.Length-2;pos++)
            {
                string newCode = text.Substring(pos, 2);
                if (newCode == "&C" || newCode == "&R")
                {
                    SetText(code, text.Substring(startPos, pos-startPos));
                    startPos = pos+2;
                    pos = startPos;
                    code = newCode;
                }
            }
            SetText(code, text.Substring(startPos, text.Length - startPos));
        }