Custom Row and Custom Column Caption of GridDesktop Worksheet
Contents
[
Hide
]
Possible Usage Scenarios
You can customize row and column caption of GridDesktop worksheet. Normally, row starts from 1 and column starts from A. You can change this behavior and use your own captions for rows and columns of GridDesktop worksheet. In order to change the captions of rows and columns, please implement ICustomRowCaption and ICustomColumnCaption interfaces.
Custom Row and Custom Column Caption of GridDesktop Worksheet
The following sample code implements ICustomRowCaption and ICustomColumnCaption interfaces and changes the captions of rows and columns. The screenshot shows the result of the execution of this sample code for a reference.
Sample Code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET | |
public class MyICustomColumnCaption : ICustomColumnCaption | |
{ | |
//Returns the Custom Column Caption | |
public string GetCaption(int column) | |
{ | |
return "Mine " + (column + 10); | |
} | |
} | |
public class MyICustomRowCaption : ICustomRowCaption | |
{ | |
//Returns the Custom Row Caption | |
public string GetCaption(int row) | |
{ | |
return "R" + (row + 10).ToString(); | |
} | |
} | |
//------------------------------------------- | |
//------------------------------------------- | |
//Access the First GridDesktop Worksheet | |
Worksheet ws = this.gridDesktop1.Worksheets[0]; | |
//Assign the Worksheet Custom Column and Row Caption Instance | |
ws.CustomColumnCaption = new MyICustomColumnCaption(); | |
ws.CustomRowCaption = new MyICustomRowCaption(); |