الوصول إلى وتعديل Cell القيم
الوصول إلى قيمة Cell وتعديلها
قيم السلسلة
قبل الوصول إلى قيمة الخلية وتعديلها ، تحتاج إلى معرفة كيفية الوصول إلى الخلايا. للحصول على تفاصيل حول الأساليب المختلفة للوصول إلى الخلايا ، يرجى الرجوع إلىورقة عمل الوصول Cells.
كل خلية لها خاصية تسمى StringValue. بمجرد الوصول إلى الخلية ، يمكن للمطورين استخدام خاصية StringValue للوصول إلى قيمة سلسلة الخلايا. لتعديل قيم الخلية ، يتم توفير طريقة خاصة PutValue ، والتي يمكن استخدامها لتحديث قيمة سلسلة الخلية.
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET | |
// Accessing the worksheet of the Grid that is currently active | |
GridWorksheet sheet = GridWeb1.WorkSheets[GridWeb1.ActiveSheetIndex]; | |
// Accessing "B1" cell of the worksheet | |
GridCell cell = sheet.Cells["B1"]; | |
// Accessing the string value of "B1" cell | |
Label1.Text = cell.StringValue; | |
// Modifying the string value of "B1" cell | |
cell.PutValue("Hello Aspose.Grid"); |
جميع أنواع القيم
تحتوي طريقة PutValue لكائن الخلية على 8 حمولات زائدة متاحة والتي يمكن استخدامها لتعديل أي نوع من القيم (Boolean و int و double و DateTime و string) في الخلية.
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET | |
// Accessing the worksheet of the Grid that is currently active | |
GridWorksheet sheet = GridWeb1.WorkSheets[GridWeb1.ActiveSheetIndex]; | |
// Accessing "B3" cell of the worksheet | |
GridCell cell = sheet.Cells["B3"]; | |
// Putting a value in "B3" cell | |
cell.PutValue(30); |
هناك أيضًا نسخة محملة بشكل زائد من طريقة PutValue يمكن أن تأخذ أي نوع من القيمة في تنسيق سلسلة وتحويلها إلى نوع بيانات مناسب تلقائيًا. لتحقيق ذلك ، قم بتمرير القيمة المنطقية true إلى معلمة أخرى لطريقة PutValue كما هو موضح أدناه في المثال.
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET | |
// Accessing the worksheet of the Grid that is currently active | |
GridWorksheet sheet = GridWeb1.WorkSheets[GridWeb1.ActiveSheetIndex]; | |
// Accessing "B5" cell of the worksheet | |
GridCell cell = sheet.Cells["B5"]; | |
// Putting a numeric value as string in "B5" cell that will be converted to a suitable data type automatically | |
cell.PutValue("19.4", true); |