Exemple #1
0
        public void SetRowHiddenState(XmlNodeInformation nodeInfo, MinMaxFilterRowRefs filterRefs)
        {
            string state = nodeInfo.GetAttributeValue("hidden");

            if (state == "1")
            {
                string rowRef = nodeInfo.GetAttributeValue("r");
                int row = Int32.Parse(rowRef);
                if (row >= filterRefs.m_minRow)
                {
                    if (row <= filterRefs.m_maxRow)
                    { //this row is a filter row, so we ignore any hidden state and reset the row to unhidden
                        m_inHiddenRow = false;
                        nodeInfo.ResetAttributeValue("", "hidden", "", "0");
                        return;
                    }
                }
            }
            SetRowHiddenState(state);            
        }
 public void AddToAutofilterCellRefs(string sheetName, MinMaxFilterRowRefs mm)
 {
     m_autoFilterCellRefs.Add(sheetName, mm);
 }
        public static MinMaxFilterRowRefs GetRowRangeFromDefinedNameContent(string content)
        {
            MinMaxFilterRowRefs mmf = new MinMaxFilterRowRefs();
            
            int index = content.IndexOf('!');
            if (index == -1)
            {
                mmf.m_minRow = -1;
                mmf.m_maxRow = -1;
            }
            else
            {
                string rowRef = content.Substring(index);

                mmf.m_minRow = XlsxParsingUtilities.GetFilterCellRefsMin(rowRef);
                mmf.m_maxRow = XlsxParsingUtilities.GetFilterCellRefsMax(rowRef);
            }

            return mmf;
        }
 public bool GetFilterCellRef(string targetName, out MinMaxFilterRowRefs filterRefs)
 {
     if (m_autoFilterCellRefs.TryGetValue(targetName, out filterRefs))
     {
         return true;
     }
     filterRefs = new MinMaxFilterRowRefs();
     return false;
 }
        public void ResetCleanableCellRefs(string sheetId, MinMaxFilterRowRefs mm)
        {
			Dictionary<string, byte> actualCellRefs;
			if (m_cleanableFormulaCellRefs.TryGetValue(sheetId, out actualCellRefs))
			{
				List<string> cellKeys = new List<string>();
				foreach (KeyValuePair<string, byte> kvp in actualCellRefs)
				{
					int row = XlsxParsingUtilities.GetRowIdAsInt(kvp.Key);
					if (row >= mm.m_minRow && row <= mm.m_maxRow)
					{
						cellKeys.Add(kvp.Key);
					}
				}
				
				foreach(string key in cellKeys)
				{ //this row is a filter row, so we are going to ignore any hidden state                                
					actualCellRefs.Remove(key);
                }
			}
            
        }
        private void ResolveCleanableCellRefs(MinMaxFilterRowRefs mm)
        {
			WorkSheet ws;
            if (WorksheetDataLookup.TryGetValue(m_targetName, out ws))
            {
                ProcessingDictionaries.ResetCleanableCellRefs(ws.m_sheetId, mm);
            }
        }
 private void ResolveHiddenCells(MinMaxFilterRowRefs mm)
 {
     foreach (KeyValuePair<string, int> kvp in m_hiddenContentCellRefs)
     {
         int row = XlsxParsingUtilities.GetRowIdAsInt(kvp.Key);
         if (row >= mm.m_minRow)
         {
             if (row <= mm.m_maxRow)
             { //this row is a filter row, so we are going to ignore any hidden state
                 ProcessingDictionaries.ResetHiddenCellStringFlag(kvp.Value);
             }
         }
     }
 }
        private void PostProcessHiddenData()
        {
            if (m_stateTracker.InHiddenSheet)
                return;

            int cellRefMin = XlsxParsingUtilities.GetFilterCellRefsMin(m_filterCellRefs);
            int cellRefMax = XlsxParsingUtilities.GetFilterCellRefsMax(m_filterCellRefs);

            MinMaxFilterRowRefs mm = new MinMaxFilterRowRefs();
            mm.m_minRow = cellRefMin;
            mm.m_maxRow = cellRefMax;

            ProcessingDictionaries.AddToAutofilterCellRefs(m_targetName, mm);

            ResolveHiddenCells(mm);
            ResolveCleanableCellRefs(mm);
        }