إضافة صيغ الخلية

إضافة الصيغ إلى الخلايا

كيفية إضافة وحساب صيغة

من الممكن إضافة والوصول وتعديل الصيغ في الخلايا عن طريق استخدام خاصية الصيغة الخلوية. تدعم Aspose.Cells.GridWeb الصيغ المحددة من قبل المستخدمين تتراوح من البسيطة إلى العقد. ومع ذلك، يتم تزويد Aspose.Cells.GridWeb بعدد كبير من الوظائف أو الصيغ المدمجة (مشابهة لـ Microsoft Excel). لرؤية القائمة الكاملة للوظائف المدمجة، يرجى الرجوع إلى هذه القائمة بالوظائف المدعومة.

// 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];
// Putting some values to cells
sheet.Cells["A1"].PutValue("1st Value");
sheet.Cells["A2"].PutValue("2nd Value");
sheet.Cells["A3"].PutValue("Sum");
sheet.Cells["B1"].PutValue(125.56);
sheet.Cells["B2"].PutValue(23.93);
// Adding a simple formula to "B3" cell
sheet.Cells["B3"].Formula = "=SUM(B1:B2)";

تمت إضافة الصيغة إلى الخلية B3 ولكن لم يتم حسابها بواسطة GridWeb

todo:image_alt_text

في لقطة الشاشة أعلاه، يمكنك رؤية أن تمت إضافة صيغة إلى خلية B3 ولكن لم يتم حسابها بعد. لحساب جميع الصيغ، قم بالاستدعاء GridWeb control’s GridWorksheetCollection’s CalculateFormula method بعد إضافة الصيغ إلى أوراق العمل كما هو موضح أدناه.

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// Calculating all formulas added in worksheets
GridWeb1.WorkSheets.CalculateFormula();

الإشارة إلى الخلايا من أوراق عمل أخرى

من خلال Aspose.Cells.GridWeb، يمكن الإشارة إلى القيم المخزنة في أوراق عمل مختلفة في صيغهم، مما يخلق صيغ معقدة.

الصيغة للإشارة إلى قيمة الخلية من ورقة عمل مختلفة هي اسم الورقة! اسم الخلية.

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// Adding a bit complex formula to "A1" cell
sheet1.Cells["B6"].Formula = "=(SUM(A1:A5)/AVERAGE(B1:B5))-Sheet2!B1";