كيفية التحكم في عرض المصنف باستخدام C++
Contents
[
Hide
]
سيناريوهات الاستخدام المحتملة
عند الحاجة لضبط عرض صفحات Excel، تحتاج إلى معرفة كيفية التحكم في كل وحدة، مثل أشرطة التمرير الأفقية والعمودية، وما إذا كنت تريد إخفاء ملفات Excel المفتوحة، وما إلى ذلك. يوفر ذلك Aspose.Cells. يوفر Aspose.Cells الخصائص والطرق التالية لمساعدتك على تحقيق أهدافك.
- WorkbookSettings.IsHScrollBarVisible
- WorkbookSettings.IsVScrollBarVisible
- WorkbookSettings.IsHidden
- WorkbookSettings.IsMinimized
- WorkbookSettings.GetWindowHeight()
- WorkbookSettings.GetWindowWidth()
- WorkbookSettings.GetWindowLeft()
- WorkbookSettings.GetWindowTop()
كيفية التحكم في عرض المصنف باستخدام Aspose.Cells for C++
يوضح هذا المثال كيف:
- إنشاء دفتر عمل.
- إضافة بيانات إلى الخلايا في ورقة العمل الأولى.
- إخفاء شرائط التمرير الأفقية والعمودية لعرض دفتر العمل.
#include <iostream>
#include "Aspose.Cells.h"
using namespace Aspose::Cells;
int main()
{
Aspose::Cells::Startup();
// Create a new workbook
Workbook workbook;
// Get the first worksheet
Worksheet ws = workbook.GetWorksheets().Get(0);
Cells cells = ws.GetCells();
// Set values to 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");
cell = cells.Get(u"B2");
cell.PutValue(5);
cell = cells.Get(u"B3");
cell.PutValue(3);
cell = cells.Get(u"B4");
cell.PutValue(6);
cell = cells.Get(u"B5");
cell.PutValue(4);
cell = cells.Get(u"C2");
cell.PutValue(5);
cell = cells.Get(u"C3");
cell.PutValue(20);
cell = cells.Get(u"C4");
cell.PutValue(30);
cell = cells.Get(u"C5");
cell.PutValue(60);
// Apply style to cell E10
cell = cells.Get(u"E10");
Style temp = workbook.CreateStyle();
temp.GetFont().SetColor(Color::Red());
cell.SetStyle(temp);
// Hide horizontal and vertical scrollbars
workbook.GetSettings().SetIsHScrollBarVisible(false);
workbook.GetSettings().SetIsVScrollBarVisible(false);
// Save the workbook
workbook.Save(u"out.xlsx");
Aspose::Cells::Cleanup();
}
معاينة ملف النتائج: