/** * Shifts all the page breaks in the range "count" number of rows/columns * @param breaks The page record to be shifted * @param start Starting "main" value to shift breaks * @param stop Ending "main" value to shift breaks * @param count number of units (rows/columns) to shift by */ private static void ShiftBreaks(PageBreakRecord breaks, int start, int stop, int count) { IEnumerator iterator = breaks.GetBreaksEnumerator(); IList shiftedBreak = new ArrayList(); while(iterator.MoveNext()) { PageBreakRecord.Break breakItem = (PageBreakRecord.Break)iterator.Current; int breakLocation = breakItem.main; bool inStart = (breakLocation >= start); bool inEnd = (breakLocation <= stop); if(inStart && inEnd) shiftedBreak.Add(breakItem); } iterator = shiftedBreak.GetEnumerator(); while (iterator.MoveNext()) { PageBreakRecord.Break breakItem = (PageBreakRecord.Break)iterator.Current; breaks.RemoveBreak(breakItem.main); breaks.AddBreak((short)(breakItem.main+count), breakItem.subFrom, breakItem.subTo); } }
/** * Shifts all the page breaks in the range "count" number of rows/columns * @param breaks The page record to be Shifted * @param start Starting "main" value to Shift breaks * @param stop Ending "main" value to Shift breaks * @param count number of Units (rows/columns) to Shift by */ public void ShiftBreaks(PageBreakRecord breaks, short start, short stop, int count) { if (rowBreaks == null) return; IEnumerator iterator = breaks.GetBreaksEnumerator(); IList ShiftedBreak = new ArrayList(); while (iterator.MoveNext()) { PageBreakRecord.Break breakItem = (PageBreakRecord.Break)iterator.Current; int breakLocation = breakItem.main; bool inStart = (breakLocation >= start); bool inEnd = (breakLocation <= stop); if (inStart && inEnd) ShiftedBreak.Add(breakItem); } iterator = ShiftedBreak.GetEnumerator(); while (iterator.MoveNext()) { PageBreakRecord.Break breakItem = (PageBreakRecord.Break)iterator.Current; breaks.RemoveBreak(breakItem.main); breaks.AddBreak(breakItem.main + count, breakItem.subFrom, breakItem.subTo); } }