Anpassad rad och anpassad kolumntext av GridDesktop-arbetsblad
Contents
[
Hide
]
Möjliga användningsscenarier
Du kan anpassa rad- och kolumntexten i GridDesktop-kalkylbladet. Normalt börjar rad från 1 och kolumn börjar från A. Du kan ändra detta beteende och använda dina egna bildtexter för rader och kolumner i GridDesktop-kalkylbladet. För att ändra bildtexterna för rader och kolumner, implementera gränssnitten ICustomRowCaption och ICustomColumnCaption.
Anpassad rad och anpassad kolumntext av GridDesktop-arbetsblad
Följande exempelkod implementerar gränssnitten ICustomRowCaption och ICustomColumnCaption och ändrar bildtexterna för rader och kolumner. Skärmdumpen visar resultatet av exekveringen av denna exempelkod som referens.
Exempelkod
This file contains hidden or 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(); |