ResourceViewColumn Class

Project's view class used in ResourceUsage view and ResourceSheet view.
Inheritance Hierarchy
SystemObject
  Aspose.Tasks.VisualizationViewColumn
    Aspose.Tasks.VisualizationResourceViewColumn

Namespace:  Aspose.Tasks.Visualization
Assembly:  Aspose.Tasks (in Aspose.Tasks.dll) Version: 21.10
Syntax
public sealed class ResourceViewColumn : ViewColumn

The ResourceViewColumn type exposes the following members.

Constructors
  NameDescription
Public methodCode exampleResourceViewColumn(Int32, Field)
Initializes a new instance of the ResourceViewColumn class.
Public methodCode exampleResourceViewColumn(String, Int32, ResourceToColumnTextConverter)
Initializes a new instance of the ResourceViewColumn class.
Public methodCode exampleResourceViewColumn(String, Int32, ResourceToColumnTextConverter, Field)
Initializes a new instance of the ResourceViewColumn class.
Properties
  NameDescription
Public propertyCode exampleField
Column field. Field.
(Overrides ViewColumnField.)
Public propertyCode exampleName
Gets the column name.
(Inherited from ViewColumn.)
Public propertyCode exampleStringAlignment
Gets or sets alignment of the text (can be one of the values of the StringAlignment enumeration).
(Inherited from ViewColumn.)
Public propertyCode exampleTextStyleModificationCallback
Gets or sets the callback which can be used to customize the appearance of the column's cells.
(Inherited from ViewColumn.)
Public propertyCode exampleWidth
Gets the column width.
(Inherited from ViewColumn.)
Methods
  NameDescription
Public methodEquals (Inherited from Object.)
Public methodCode exampleGetColumnText
Converts current resource to the column text.
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Public methodToString (Inherited from Object.)
Examples
Shows how to add resource view columns to be exported.
var project = new Project(DataDir + "Project2.mpp");
var resource = project.Resources.GetById(1);

var options = new PdfSaveOptions();
var columns = new List<ViewColumn>
{
    new ResourceViewColumn(100, Field.ResourceName),
    new ResourceViewColumn(100, Field.ResourceActualWork),
    new ResourceViewColumn(100, Field.ResourceCost),
    new ResourceViewColumn(
        "Resource Cost2", 
        80,
        delegate(Resource res)
        {
            return res.Get(Rsc.Cost).ToString(CultureInfo.InvariantCulture);
        }),
    new ResourceViewColumn(
        "Resource Cost2", 
        80,
        delegate(Resource res)
        {
            return res.Get(Rsc.Cost).ToString(CultureInfo.InvariantCulture);
        }, 
        Field.ResourceCost2)
};

// iterate over columns
foreach (var column in columns)
{
    var col = (ResourceViewColumn)column;
    Console.WriteLine("Column Name: " + col.Name);
    Console.WriteLine("Column Field: " + col.Field);
    Console.WriteLine("Column Text: " + col.GetColumnText(resource));
    Console.WriteLine();
}

options.View = new ProjectView(columns);
options.PresentationFormat = PresentationFormat.ResourceUsage;
project.Save(OutDir + "WorkWithAssignmentViewColumn_out.pdf", options);
See Also