العمل مع GridWeb الصفوف والأعمدة

إدراج صفوف وأعمدة

يشرح هذا الموضوع كيفية إدراج صفوف وأعمدة جديدة في ورقة العمل باستخدام Aspose.Cells.GridWeb API. يمكن إدراج صفوف أو أعمدة في أي موضع بورقة العمل.

إدراج الصفوف

لإدراج صف في أي موضع في ورقة العمل:

  1. قم بإضافة عنصر تحكم Aspose.Cells.GridWeb إلى نموذج أو صفحة ويب.
  2. قم بالوصول إلى ورقة العمل التي تضيف صفوفًا إليها.
  3. أدخل صفًا عن طريق تحديد فهرس الصف حيث سيتم إدراج الصف.
For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java
//Accessing the reference of the worksheet that is currently active
GridWorksheet sheet = gridweb.getWorkSheets().get(gridweb.getActiveSheetIndex());
//Inserting a new row to the worksheet before 2nd row
sheet.getCells().insertRow(1);

إدراج الأعمدة

لإدراج عمود في أي موضع في ورقة العمل:

  1. قم بإضافة عنصر تحكم Aspose.Cells.GridWeb إلى نموذج أو صفحة ويب.
  2. قم بالوصول إلى ورقة العمل التي تضيف أعمدة إليها.
  3. أدخل عمودًا عن طريق تحديد فهرس العمود حيث سيتم إدراج العمود.
For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java
//Accessing the reference of the worksheet that is currently active
GridWorksheet sheet = gridweb.getWorkSheets().get(gridweb.getActiveSheetIndex());
//Inserting a new column to the worksheet before column "B"
sheet.getCells().insertColumn(1);

حذف الصفوف والأعمدة

يوضح هذا الموضوع كيفية حذف الصفوف والأعمدة من ورقة العمل باستخدام Aspose.Cells.GridWeb API. بمساعدة هذه الميزة ، يمكن للمطورين أخذ حذف صفوف أو أعمدة في وقت التشغيل.

حذف الصفوف

لحذف صف من ورقة العمل الخاصة بك:

  1. قم بإضافة عنصر تحكم Aspose.Cells.GridWeb إلى نموذج أو صفحة ويب.
  2. قم بالوصول إلى ورقة العمل التي تريد حذف الصفوف منها.
  3. احذف صفًا من ورقة العمل عن طريق تحديد فهرس الصف الخاص به.
For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java
//Accessing the reference of the worksheet that is currently active
GridWorksheet sheet = gridweb.getWorkSheets().get(gridweb.getActiveSheetIndex());
//Deleting 2nd row from the worksheet
sheet.getCells().deleteRow(1);

حذف الأعمدة

لحذف عمود من ورقة العمل الخاصة بك:

  1. قم بإضافة عنصر تحكم Aspose.Cells.GridWeb إلى نموذج أو صفحة ويب.
  2. قم بالوصول إلى ورقة العمل التي تريد حذف الأعمدة منها.
  3. احذف عمودًا من ورقة العمل عن طريق تحديد فهرس العمود الخاص به.
For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java
//Accessing the reference of the worksheet that is currently active
GridWorksheet sheet = gridweb.getWorkSheets().get(gridweb.getActiveSheetIndex());
//Deleting 2nd column from the worksheet
sheet.getCells().deleteColumn(1);

ضبط ارتفاع الصف وعرض العمود

في بعض الأحيان تكون قيم الخلية أعرض من الخلية الموجودة فيها أو تكون في عدة أسطر. هذه القيم ليست مرئية بالكامل للمستخدمين ما لم يغيروا ارتفاع وعرض الصفوف والأعمدة. Aspose.Cells.GridWeb يدعم بشكل كامل تحديد ارتفاع الصف وعرض العمود. يناقش هذا الموضوع هذه الميزات بالتفصيل بمساعدة الأمثلة.

العمل مع ارتفاع الصفوف وعرض العمود

ضبط ارتفاع الصف

لتعيين ارتفاع الصف:

  1. قم بإضافة عنصر تحكم Aspose.Cells.GridWeb إلى نموذج / صفحة الويب الخاصة بك.
  2. قم بالوصول إلى مجموعة GridCells الخاصة بورقة العمل.
  3. عيّن ارتفاع جميع الخلايا في أي صف محدد.

المخرجات: تم ضبط ارتفاع الصف الأول على 50 نقطة

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

For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java
//Accessing the cells collection of the worksheet that is currently active
GridCells cells = gridweb.getWorkSheets().get(gridweb.getActiveSheetIndex()).getCells();
//Setting the height of 1st row to 50 points
cells.setRowHeight(0, 50);

ضبط عرض العمود

لتعيين عرض العمود:

  1. قم بإضافة عنصر تحكم Aspose.Cells.GridWeb إلى نموذج / صفحة الويب الخاصة بك.
  2. قم بالوصول إلى مجموعة GridCells الخاصة بورقة العمل.
  3. قم بتعيين عرض جميع الخلايا في أي عمود محدد.
For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java
//Accessing the cells collection of the worksheet that is currently active
GridCells cells = gridweb.getWorkSheets().get(gridweb.getActiveSheetIndex()).getCells();
//Setting the width of 1st column to 150 points
cells.setColumnWidth(0, 150);

تخصيص رؤوس الصفوف والأعمدة

مثل Microsoft Excel ، Aspose.Cells. يستخدم موقع GridWeb أيضًا الرؤوس أو التسميات التوضيحية القياسية للصفوف (أرقام مثل 1 و 2 و 3 وما إلى ذلك) والأعمدة (أبجديًا مثل A و B و C وما إلى ذلك). Aspose.Cells.GridWeb يجعل من الممكن أيضًا تخصيص التسميات التوضيحية. يناقش هذا الموضوع تخصيص رؤوس الصفوف والأعمدة في وقت التشغيل باستخدام Aspose.Cells.GridWeb API.

تخصيص رأس الصف

لتخصيص العنوان أو التسمية التوضيحية لصف:

  1. قم بإضافة عنصر تحكم Aspose.Cells.GridWeb إلى نموذج / صفحة ويب.
  2. قم بالوصول إلى ورقة العمل في GridWorksheetCollection.
  3. قم بتعيين التسمية التوضيحية لأي صف محدد.

تم تخصيص رؤوس الصف 1 و 2

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

For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java
//Accessing the worksheet that is currently active
GridWorksheet worksheet = gridweb.getWorkSheets().get(gridweb.getActiveSheetIndex());
//Setting the header of 1st row to "ID"
worksheet.setRowCaption(1, "ID");
//Setting the header of 2nd row to "Name"
worksheet.setRowCaption(2, "Name");

تخصيص رأس العمود

لتخصيص رأس العمود أو التسمية التوضيحية له:

  1. قم بإضافة عنصر تحكم Aspose.Cells.GridWeb إلى نموذج / صفحة ويب.
  2. قم بالوصول إلى ورقة العمل في GridWorksheetCollection.
  3. قم بتعيين التسمية التوضيحية لأي عمود محدد.

تم تخصيص رؤوس العمود 1 و 2

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

For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java
//Accessing the worksheet that is currently active
GridWorksheet worksheet = gridweb.getWorkSheets().get(gridweb.getActiveSheetIndex());
//Setting the header of 1st column to "ID"
worksheet.SetColumnCaption(0, "ID");
//Setting the header of 2nd column to "Name"
worksheet.SetColumnCaption(1, "Name");

تجميد وإلغاء تجميد الصفوف والأعمدة

يشرح هذا الموضوع كيفية تجميد وإلغاء تجميد الصفوف والأعمدة. يتيح تجميد الأعمدة أو الصفوف للمستخدمين الاحتفاظ بعناوين الأعمدة أو عناوين الصفوف مرئية أثناء قيامهم بالتمرير إلى أجزاء أخرى من ورقة العمل. هذه الميزة مفيدة للغاية عند التعامل مع أوراق العمل التي تحتوي على كميات كبيرة من البيانات. عندما يقوم المستخدمون بالتمرير يتم تمرير البيانات فقط لأسفل وتظل العناوين في مكانها ، مما يسهل قراءة التاريخ. ميزة تجميد الأجزاء مدعومة فقط في Internet Explorer 6.0 أو إصدار أحدث.

تجميد الصفوف والأعمدة

لتجميد عدد معين من الصفوف والأعمدة:

  1. قم بإضافة عنصر تحكم Aspose.Cells.GridWeb إلى نموذج / صفحة ويب.
  2. قم بالوصول إلى ورقة العمل.
  3. قم بتجميد عدد من الصفوف والأعمدة.

الصفوف والأعمدة في حالة التجميد

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

For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java
//Accessing the reference of the worksheet that is currently active
GridWorksheet sheet = gridweb.getWorkSheets().get(gridweb.getActiveSheetIndex());
//Freezing 4th row and 3rd column
sheet.freezePanes(3, 2, 3, 2);

إلغاء تجميد الصفوف والأعمدة

لإلغاء تجميد الصفوف والأعمدة:

  1. قم بإضافة عنصر تحكم Aspose.Cells.GridWeb إلى نموذج / صفحة ويب.
  2. قم بالوصول إلى ورقة العمل.
  3. إلغاء تجميد الصفوف والأعمدة.

ورقة عمل بعد فك التجميد

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

For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java
//Accessing the reference of the worksheet that is currently active
GridWorksheet sheet = gridweb.getWorkSheets().get(gridweb.getActiveSheetIndex());
//Unfreezing rows and columns
sheet.unFreezePanes();

حماية الصفوف والأعمدة

يناقش هذا الموضوع بعض الأساليب لحماية الخلايا في الصفوف والأعمدة من أي نوع من الإجراءات التي يقوم بها المستخدمون النهائيون. يمكن للمطورين تنفيذ هذه الحماية باستخدام تقنيتين: عن طريق جعل الخلايا في الصفوف والأعمدة للقراءة فقط ، أو عن طريق تقييد خيارات قائمة سياق GridWeb.

تقييد خيارات قائمة السياق

يوفر GridWeb قائمة سياق يمكن للمستخدمين النهائيين استخدامها لأداء العمليات على عنصر التحكم. توفر القائمة العديد من الخيارات لمعالجة الخلايا والصفوف والأعمدة.

خيارات سياقية كاملة

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

من الممكن تقييد أي نوع من العمليات من جانب العميل في الصفوف والأعمدة من خلال تقييد الخيارات المتاحة في قائمة السياق. يمكن القيام بذلك عن طريق تعيين خصائص EnableClientColumnOperations و EnableClientRowOperations لعنصر التحكم GridWeb إلى false. من الممكن أيضًا تقييد المستخدمين من تجميد الصفوف والأعمدة عن طريق تعيين سمة EnableClientFreeze للتحكم في GridWeb إلى false.

قائمة السياق بعد تقييد خيارات الصفوف والعمود

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

For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java
//Accessing the first worksheet that is currently active
GridWorksheet sheet = gridweb.getWorkSheets().get(gridweb.getActiveSheetIndex());
//Restricting column related operations in context menu
gridweb.setEnableClientColumnOperations(false);
//Restricting row related operations in context menu
gridweb.setEnableClientRowOperations(false);
//Restricting freeze option of context menu
gridweb.setEnableClientFreeze(false);