عنوان الصف وعنوان العمود المخصصان لورقة العمل GridDesktop
سيناريوهات الاستخدام المحتملة
يمكنك تخصيص عنوان الصف والعمود في ورقة عمل GridDesktop. عادةً، يبدأ الصف من 1 والعمود يبدأ من A. يمكنك تغيير هذه السلوك واستخدام تسميات خاصة بك للصفوف والأعمدة في ورقة عمل GridDesktop. من أجل تغيير تسميات الصفوف والأعمدة، يرجى تنفيذ واجهات ICustomRowCaption و ICustomColumnCaption.
عنوان الصف والعمود المخصصان لورقة العمل GridDesktop
الشيفرة النموذجية التالية تنفذ واجهات ICustomRowCaption و ICustomColumnCaption وتغيير تسميات الصفوف والأعمدة. تظهر لقطة الشاشة النتيجة من تنفيذ هذه الشيفرة النموذجية للإحالة.
الكود المثالي
// 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(); |