أضف Cell الصيغ

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

كيف تضيف وتحسب صيغة؟

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

// 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

ما يجب القيام به: image_بديل_نص

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

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

الرجوع إلى Cells من أوراق العمل الأخرى

باستخدام 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";