static FormulaHandler() { FormulaHandler.m_RegexGlobalOnly = null; FormulaHandler.m_RegexReportItemNameFormat = null; FormulaHandler.m_RegexFunctionName = null; FormulaHandler.m_RegexIdentifier = null; FormulaHandler.m_RegexNonConstant = null; FormulaHandler.m_RegexFieldDetection = null; FormulaHandler.m_RegexReportItemsDetection = null; FormulaHandler.m_RegexGlobalsDetection = null; FormulaHandler.m_RegexAmpDetection = null; FormulaHandler.m_RegexParametersDetection = null; FormulaHandler.m_RegexUserDetection = null; FormulaHandler.m_RegexAggregatesDetection = null; FormulaHandler.m_RegexStringLiteralOnly = null; FormulaHandler.m_RegexNothingOnly = null; FormulaHandler.m_RegexReportItemName = null; FormulaHandler.m_RegexSpecialFunction = null; FormulaHandler.m_VBModulePropertiesSupported = null; FormulaHandler.m_VBModulePropertiesUnSupported = null; FormulaHandler.InitFormulaMapping(); FormulaHandler.InitRegularExpressions(); }
public static string ProcessHeaderFooterFormula(string formulaExpression) { if (formulaExpression == null) { return(null); } string text = null; StringBuilder stringBuilder = new StringBuilder(); MatchCollection matchCollection = FormulaHandler.m_RegexAmpDetection.Matches(formulaExpression, 0); if (matchCollection == null || matchCollection.Count == 0) { text = formulaExpression; } else { int num = 0; string text2 = null; string text3 = null; for (int i = 0; i <= matchCollection.Count; i++) { text3 = ((i >= matchCollection.Count) ? formulaExpression.Substring(num, formulaExpression.Length - num) : formulaExpression.Substring(num, matchCollection[i].Index - num)); text3 = text3.Trim(); if (text3.Length > 0) { text = ((text != null) ? (text + "&" + text3) : text3); } if (i < matchCollection.Count) { text3 = formulaExpression.Substring(matchCollection[i].Index, matchCollection[i].Length); num = matchCollection[i].Index + matchCollection[i].Length; if (!(text3 == "&")) { text2 = text3.Trim(); int length = text2.Length; if (length > 1 && text2[0] == '"' && text2[length - 1] == '"') { text2 = text2.Substring(1, length - 2); } if (text != null) { text = FormulaHandler.ExcelHeaderFooterFormula(text); if (text != null && !(text == string.Empty)) { stringBuilder.Append(text); text = null; goto IL_0159; } return(null); } goto IL_0159; } } continue; IL_0159: FormulaHandler.EncodeHeaderFooterString(stringBuilder, text2); } } if (text != null) { text = FormulaHandler.ExcelHeaderFooterFormula(text); if (text != null && !(text == string.Empty)) { stringBuilder.Append(text); goto IL_0198; } return(null); } goto IL_0198; IL_0198: return(stringBuilder.ToString()); }