Ejemplo n.º 1
0
        /// <summary>
        /// Moves the selected columns to a new position <code>nPosition</code>.
        /// </summary>
        /// <param name="ctrl">The worksheet controller.</param>
        /// <param name="nPosition">The new position for the selected columns.</param>
        public static void SetSelectedColumnPosition(WorksheetController ctrl, int nPosition)
        {
            if (ctrl.SelectedDataColumns.Count > 0)
            {
                if (ctrl.SelectedDataColumns.Count + nPosition > ctrl.DataTable.DataColumnCount)
                {
                    nPosition = Math.Max(0, ctrl.DataTable.DataColumnCount - ctrl.SelectedDataColumns.Count);
                }

                ctrl.DataTable.ChangeColumnPosition(ctrl.SelectedDataColumns, nPosition);
            }

            if (ctrl.SelectedPropertyColumns.Count > 0)
            {
                if (ctrl.SelectedPropertyColumns.Count + nPosition > ctrl.DataTable.PropertyColumnCount)
                {
                    nPosition = Math.Max(0, ctrl.DataTable.PropertyColumnCount - ctrl.SelectedDataColumns.Count);
                }

                ctrl.DataTable.PropertyColumns.ChangeColumnPosition(ctrl.SelectedPropertyColumns, nPosition);
            }

            ctrl.ClearAllSelections();

            ctrl.UpdateTableView();
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Extracts the property values of the selected property columns.
 /// </summary>
 /// <param name="ctrl">The controller that controls the table.</param>
 public static void ExtractPropertyValues(WorksheetController ctrl)
 {
     for (int i = 0; i < ctrl.SelectedPropertyColumns.Count; i++)
     {
         Altaxo.Data.DataColumn col = ctrl.DataTable.PropCols[ctrl.SelectedPropertyColumns[i]];
         ExtractPropertiesFromColumn(col, ctrl.DataTable.PropCols);
     }
     ctrl.ClearAllSelections();
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Insert a number of data rows into the controlled table.
        /// </summary>
        /// <param name="ctrl">The worksheet controller.</param>
        /// <param name="rowBeforeToInsert">Number of the row before which to insert the additional rows.</param>
        /// <param name="numberOfRows">Number of rows to insert.</param>
        public static void InsertDataRows(WorksheetController ctrl, int rowBeforeToInsert, int numberOfRows)
        {
            if (numberOfRows <= 0 || rowBeforeToInsert < 0)
            {
                return;
            }

            ctrl.Doc.DataColumns.InsertRows(rowBeforeToInsert, numberOfRows);
            ctrl.ClearAllSelections();
            ctrl.UpdateTableView();
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Moves the selected rows to a new position <code>nPosition</code>.
        /// </summary>
        /// <param name="ctrl">The worksheet controller.</param>
        /// <param name="nPosition">The new position for the selected rows.</param>
        public static void SetSelectedRowPosition(WorksheetController ctrl, int nPosition)
        {
            if (ctrl.SelectedDataRows.Count > 0)
            {
                ctrl.DataTable.DataColumns.ChangeRowPosition(ctrl.SelectedDataRows, nPosition);
            }

            ctrl.ClearAllSelections();

            ctrl.UpdateTableView();
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Sets the group number of the currently selected columns to <code>nGroup</code>.
        /// </summary>
        /// <param name="ctrl">The worksheet controller.</param>
        /// <param name="nGroup">The group number to set for the selected columns.</param>
        public static void SetSelectedColumnGroupNumber(WorksheetController ctrl, int nGroup)
        {
            for (int i = 0; i < ctrl.SelectedDataColumns.Count; i++)
            {
                ctrl.DataTable.DataColumns.SetColumnGroup(ctrl.SelectedDataColumns[i], nGroup);
            }

            for (int i = 0; i < ctrl.SelectedPropertyColumns.Count; i++)
            {
                ctrl.DataTable.PropertyColumns.SetColumnGroup(ctrl.SelectedPropertyColumns[i], nGroup);
            }

            ctrl.ClearAllSelections();

            ctrl.UpdateTableView();
        }