Class ResourceViewColumn
Contents
[
Hide
]ResourceViewColumn class
Project’s view class used in ResourceUsage view and ResourceSheet view.
public sealed class ResourceViewColumn : ViewColumn
Constructors
| Name | Description | 
|---|---|
| ResourceViewColumn(int, Field) | Initializes a new instance of the ResourceViewColumnclass. | 
| ResourceViewColumn(string, int, ResourceToColumnTextConverter) | Initializes a new instance of the ResourceViewColumnclass. | 
| ResourceViewColumn(string, int, ResourceToColumnTextConverter, Field) | Initializes a new instance of the ResourceViewColumnclass. | 
Properties
| Name | Description | 
|---|---|
| override Field { get; set; } | Column field. Field. | 
| Name { get; } | Gets the column name. | 
| StringAlignment { get; set; } | Gets or sets alignment of the text (can be one of the values of the HorizontalStringAlignmentenumeration). | 
| TextStyleModificationCallback { get; set; } | Gets or sets the callback which can be used to customize the appearance of the column’s cells. | 
| Width { get; } | Gets the column width. | 
Methods
| Name | Description | 
|---|---|
| GetColumnText(Resource) | Converts current resource to the column text. | 
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
- class ViewColumn
- namespace Aspose.Tasks.Visualization
- assembly Aspose.Tasks