GridDesktop ワークシートのカスタム行とカスタム列のキャプション

考えられる使用シナリオ

GridDesktop ワークシートの行と列のキャプションをカスタマイズできます。通常、行は 1 から始まり、列は A から始まります。この動作を変更して、GridDesktop ワークシートの行と列に独自のキャプションを使用できます。行と列のキャプションを変更するには、ICustomRowCaption および ICustomColumnCaption インターフェイスを実装してください。

GridDesktop ワークシートのカスタム行とカスタム列のキャプション

次のサンプル コードは、ICustomRowCaption および ICustomColumnCaption インターフェイスを実装し、行と列のキャプションを変更します。スクリーンショットは、参考のためにこのサンプル コードの実行結果を示しています。

todo:画像_代替_文章

サンプルコード

// 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();