كيفية التحكم في شريط علامات تبويب الورقة باستخدام C++
Contents
[
Hide
]
سيناريوهات الاستخدام المحتملة
عند الحاجة لضبط عرض شريط صفحات Excel، تحتاج إلى معرفة كيفية التحكم في علامة تبويب الورقة، مثل إخفاؤها أو إظهارها، وتغيير عرض الشريط، وتحديد التبويب المرئي الأول، وما إلى ذلك. يدعم Aspose.Cells هذه الميزات. يوفر Aspose.Cells الخصائص والطرق التالية لمساعدتك على تحقيق أهدافك.
- WorkbookSettings.GetShowTabs()
- WorkbookSettings.GetSheetTabBarWidth()
- WorkbookSettings.GetFirstVisibleTab()
كيفية التحكم في شريط علامات تبويب الورقة باستخدام Aspose.Cells for C++
يوضح هذا المثال كيف:
- إنشاء دفتر عمل.
- إضافة بيانات إلى الخلايا في ورقة العمل الأولى.
- عرض علامة الورقة وتعيين عرض شريط التبويب.
#include <iostream>
#include "Aspose.Cells.h"
using namespace Aspose::Cells;
int main()
{
Aspose::Cells::Startup();
// Create a Workbook object
Workbook workbook;
// Obtain the reference to the newly added worksheet
Worksheet ws = workbook.GetWorksheets().Get(0);
Cells cells = ws.GetCells();
// Setting the value to the cells
Cell cell = cells.Get(u"A1");
cell.PutValue(u"Fruit");
cell = cells.Get(u"B1");
cell.PutValue(u"Count");
cell = cells.Get(u"C1");
cell.PutValue(u"Price");
cell = cells.Get(u"A2");
cell.PutValue(u"Apple");
cell = cells.Get(u"A3");
cell.PutValue(u"Mango");
cell = cells.Get(u"A4");
cell.PutValue(u"Blackberry");
cell = cells.Get(u"A5");
cell.PutValue(u"Cherry");
// Display the sheet tab and set the width of the tab bar
workbook.GetSettings().SetShowTabs(true);
workbook.GetSettings().SetSheetTabBarWidth(150);
// Save the workbook
workbook.Save(u"out.xlsx");
std::cout << "Workbook saved successfully!" << std::endl;
Aspose::Cells::Cleanup();
}
معاينة ملف النتائج: