OverheadSheetInfo.Columns Property

Gets all the columns in the overhead worksheet.
Public ReadOnly Property Columns() As IEnumerable(Of OverheadSheetColumn)
This language is not supported or no code example is available.
public IEnumerable<OverheadSheetColumn> Columns {get;}
This language is not supported or no code example is available.

Property Value

IEnumerable<OverheadSheetColumn>

The columns.

Remarks
 

This property returns the non-removable native columns and also the columns that were added by the user, and thus, that can be removed.

There are several kinds of overhead columns. They can be of any kind specified in the OverheadSheetColumnKind.

A column of the kind OverheadSheetColumnKind.GeneralColumn can only be present in user sheets, i.e., those of type NativeSheetType.User. All columns in the following sheets are of the type OverheadSheetColumnKind.NativeColumn
NativeSheetType.Summary 
NativeSheetType.CashData 
NativeSheetType.Names 
NativeSheetType.Wbs 
NativeSheetType.Template 
All these columns contain the plain data that is not structured in any areas.

All the other column types (those that can be added and removed by the user) are available only in the following worksheet types:

NativeSheetType.Currencies
NativeSheetType.Material_Set_Of_Field,  
NativeSheetType.Workforce_Set_Of_Field
NativeSheetType.Families,  
NativeSheetType.Manufacturers,  
NativeSheetType.Suppliers
NativeSheetType.Custom_Columns,  
NativeSheetType.User_Defined_Fields,  
NativeSheetType.Planner
NativeSheetType.List_Box,  
NativeSheetType.Material_Time_Frame
NativeSheetType.Workforce_Time_Frame

The columns in this second group contain data that is structured according to the areas (Core, Optional and Overhead minute). When you need to read the data, you can get the first and the last row numbers of the areas from the Areas property. The column index in the sheet is stored in the OverheadSheetColumn.Position property.

Example
 
try
 {
     // Get the overhead workbook. The lock is required.
     es.CurrentVersion.Overhead.GetLockOnWorkbook();
     var wsMgr = es.CurrentVersion.Overhead.WorksheetManager;
     var wbook = es.CurrentVersion.Overhead.GetWorkbook();
 
     foreach (IWorksheet sheet in wbook.Worksheets)
     {
         // Find the sheet for the "LIST1" field, which is of type "List (Name only)".
         // The "LIST1" is the mnemonic, not the name, which may be localized. The OverheadSheetInfo.Name contains the mnemonic,
         // and the OverheadSheetInfo.LocalizedName contains the latter.
         var sheetInfo = wsMgr.GetOverheadSheetInformation(sheet);
         if (sheetInfo.Type == NativeSheetType.List_Box && sheetInfo.Name == "LIST1")
         {
             // Get only the columns that were added by the user. Exclude the non-removable native columns.
             var userColumns = sheetInfo.Columns.Where((col) => col.Kind != OverheadSheetColumnKind.NativeColumn);
 
             // Sort them by the position.
             var sortedUserColumns = userColumns.OrderBy((col) => col.Position);
 
             // Display their headers.
             string s = "";
             foreach (var column in sortedUserColumns)
             {
                 s += column.Header1 + " | " + column.Header2 + " | " + column.Header3 + " | " + "\n";
             }
             MessageBox.Show(s);
         }
     }
 }
 catch (Exception generalError)
 {
     // Catches all errors to get the proper message.
     MessageBox.Show(generalError.Message, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
 }
 finally
 {
     // Release the lock on the overhead workbook in any case.
     es.CurrentVersion.Overhead.ReleaseLockOnWorkbook();
 }					
This language is not supported or no code example is available.

The following example will display all the columns that were added by the user. This means, that all non-removable native columns will be ignored. There is a minute field of type "List (Name only)" whose mnemonic is LIST1. The code will operate on the overhead sheet that belongs to that field. The code requires using System.Linq;.

Version
 
Available since QDV 7.23.1099.

.NET Framework

Supported in: 4.8, 4.7, 4.6, 4.5.2

In this article

Definition