Exemple #1
0
        //YK: GetXYZArray() array accessors are deprecated in xmlbeans with JDK 1.5 support
        public static void SortColumns(CT_Cols newCols)
        {
            List <CT_Col> colArray = newCols.GetColList();

            colArray.Sort(new CTColComparator());
            newCols.SetColArray(colArray);
        }
Exemple #2
0
        public void CleanColumns()
        {
            TreeSet <CT_Col> trackedCols = new TreeSet <CT_Col>(CTColComparator.BY_MIN_MAX);
            CT_Cols          newCols     = new CT_Cols();

            CT_Cols[] colsArray = worksheet.GetColsList().ToArray();
            int       i         = 0;

            for (i = 0; i < colsArray.Length; i++)
            {
                CT_Cols  cols     = colsArray[i];
                CT_Col[] colArray = cols.GetColList().ToArray();
                foreach (CT_Col col in colArray)
                {
                    addCleanColIntoCols(newCols, col, trackedCols);
                }
            }
            for (int y = i - 1; y >= 0; y--)
            {
                worksheet.RemoveCols(y);
            }

            newCols.SetColArray(trackedCols.ToArray(new CT_Col[trackedCols.Count]));
            worksheet.AddNewCols();
            worksheet.SetColsArray(0, newCols);
            //this.newCols = new CT_Cols();

            //CT_Cols aggregateCols = new CT_Cols();
            //List<CT_Cols> colsList = worksheet.GetColsList();
            //if (colsList == null)
            //{
            //    return;
            //}

            //foreach (CT_Cols cols in colsList)
            //{
            //    foreach (CT_Col col in cols.GetColList())
            //    {
            //        CloneCol(aggregateCols, col);
            //    }
            //}

            //SortColumns(aggregateCols);

            //CT_Col[] colArray = aggregateCols.GetColList().ToArray();
            //SweepCleanColumns(newCols, colArray, null);

            //int i = colsList.Count;
            //for (int y = i - 1; y >= 0; y--)
            //{
            //    worksheet.RemoveCols(y);
            //}
            //worksheet.AddNewCols();
            //worksheet.SetColsArray(0, newCols);
        }
Exemple #3
0
        public CT_Cols addCleanColIntoCols(CT_Cols cols, CT_Col newCol)
        {
            // Performance issue. If we encapsulated management of min/max in this
            // class then we could keep trackedCols as state,
            // making this log(N) rather than Nlog(N). We do this for the initial
            // read above.
            TreeSet <CT_Col> trackedCols = new TreeSet <CT_Col>(CTColComparator.BY_MIN_MAX);

            trackedCols.AddAll(cols.GetColList());
            addCleanColIntoCols(cols, newCol, trackedCols);
            cols.SetColArray(trackedCols.ToArray(new CT_Col[0]));
            return(cols);
        }
Exemple #4
0
 public CT_Cols AddCleanColIntoCols(CT_Cols cols, CT_Col col)
 {
     CT_Cols newCols = new CT_Cols();
     foreach (CT_Col c in cols.GetColList())
     {
         CloneCol(newCols, c);
     }
     CloneCol(newCols, col);
     SortColumns(newCols);
     CT_Col[] colArray = newCols.GetColList().ToArray();
     CT_Cols returnCols = new CT_Cols();
     SweepCleanColumns(returnCols, colArray, col);
     colArray = returnCols.GetColList().ToArray();
     cols.SetColArray(colArray);
     return returnCols;
 }