استخدام الشرائط وإعدادات تنسيق ثلاثي الأبعاد
استخدام الشرائط
يمكن لبرنامج Microsoft Excel 2010 تحليل المعلومات بطرق أكثر من أي وقت مضى. يسمح للمستخدمين بتتبع وتسليط الضوء على اتجاهات البيانات المهمة باستخدام أدوات تحليل البيانات والرؤية الجديدة. الشرائط هي رسومات مصغرة يمكنك وضعها داخل الخلايا بحيث يمكنك عرض البيانات والرسم البياني على الجدول نفسه. عند استخدام الشرائط بشكل صحيح، يكون تحليل البيانات أسرع وأكثر دقة. كما أنها توفر رؤية بسيطة للمعلومات، مما يجنب ورقات العمل المزدحمة بالرسوم البيانية الكثيرة.
توفر Aspose.Cells واجهة برمجة التطبيقات للتلاعب في الشرائط في جداول البيانات.
الشرائط في Microsoft Excel
لإدراج الشرائط في Microsoft Excel 2010:
- حدد الخلايا التي ترغب في ظهور الشرائط فيها. لجعلها سهلة الرؤية، حدد الخلايا على جانب البيانات.
- انقر على Insert في الشريط واختر column في Sparklines.
- حدد أو أدخل نطاق الخلايا في ورقة العمل التي تحتوي على البيانات. ستظهر الرسوم البيانية.
تساعد الشرائط في رؤية الاتجاهات، على سبيل المثال، سجل الفوز أو الخسارة لدوري الكرة اللينة. يمكن للشرائط حتى الإشارة إلى مجموع الموسم بأكمله لكل فريق في الدوري.
شرائط البيانات باستخدام Aspose.Cells
يمكن للمطورين إنشاء، حذف أو قراءة سباركلاين (في ملف القالب) باستخدام واجهة برمجة التطبيقات المقدمة من Aspose.Cells. تحتوي الفئات التي تدير السباركلاين في Aspose.Cells.Charts على اسم الفئة. لذا، يجب استيراد هذا النطاق قبل استخدام هذه الميزات.
من خلال إضافة رسومات مخصصة لنطاق البيانات المعطى، يحصل المطورون على حرية إضافة أنواع مختلفة من الرسوم الصغيرة إلى مناطق الخلايا المحددة.
يوضح المثال أدناه ميزة شرائط البيانات. يوضح المثال كيفية:
- فتح ملف قالب بسيط.
- قراءة معلومات شرائط البيانات لورقة عمل.
- إضافة شرائط بيانات جديدة لنطاق بيانات معطى إلى منطقة خلية.
- حفظ ملف Excel على القرص.
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java | |
// Instantiate a Workbook | |
// Open a template file | |
Workbook book = new Workbook("Source.xlsx"); | |
// Get the first worksheet | |
Worksheet sheet = book.getWorksheets().get(0); | |
// Use the following lines if you need to read the Sparklines | |
// Read the Sparklines from the template file (if it has) | |
for(SparklineGroup g : (Iterable<SparklineGroup>)sheet.getSparklineGroupCollection()) | |
{ | |
// Display the Sparklines group information e.g type, number of sparklines items | |
System.out.println("sparkline group: type:" + g.getType() + ", sparkline items count:" + g.getSparklineCollection().getCount()); | |
for (Sparkline s: (Iterable<Sparkline>)g.getSparklineCollection()) | |
{ | |
// Display the individual Sparkines and the data ranges | |
System.out.println("sparkline: row:" + s.getRow() + ", col:" + s.getColumn() + ", dataRange:" + s.getDataRange()); | |
} | |
} | |
// Add Sparklines | |
// Define the CellArea D2:D10 | |
CellArea ca = new CellArea(); | |
ca.StartColumn = 4; | |
ca.EndColumn = 4; | |
ca.StartRow = 1; | |
ca.EndRow = 7; | |
// Add new Sparklines for a data range to a cell area | |
int idx = sheet.getSparklineGroupCollection().add(SparklineType.COLUMN, "Sheet1!B2:D8", false, ca); | |
SparklineGroup group = sheet.getSparklineGroupCollection().get(idx); | |
// Create CellsColor | |
CellsColor clr = book.createCellsColor(); | |
clr.setColor(Color.getOrange()); | |
group.setSeriesColor (clr); | |
// Save the workbook | |
book.save("output.xlsx"); |
ضبط تنسيق ثلاثي الأبعاد
قد تحتاج أحيانًا إلى أنماط الرسوم البيانية ثلاثية الأبعاد حتى تتمكن من الحصول على النتائج المناسبة لسيناريو العمل الخاص بك. يوفر Aspose.Cells واجهة برمجة التطبيقات ذات الصلة لتطبيق تنسيقات Microsoft Excel 2007 ثلاثية الأبعاد.
يتم تقديم مثال كامل أدناه لتوضيح كيفية إنشاء رسم بياني وتطبيق تنسيق Microsoft Excel 2007 ثلاثي الأبعاد. بعد تنفيذ كود المثال، سيتم إضافة رسم بياني للأعمدة (مع تأثيرات ثلاثية الأبعاد) إلى ورقة العمل.
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java | |
// Instantiate a new Workbook | |
Workbook book = new Workbook(); | |
// Add a Data Worksheet | |
Worksheet dataSheet = book.getWorksheets().add("DataSheet"); | |
// Add Chart Worksheet | |
Worksheet sheet = book.getWorksheets().add("MyChart"); | |
// Put some values into the cells in the data worksheet | |
dataSheet.getCells().get("B1").putValue(1); | |
dataSheet.getCells().get("B2").putValue(2); | |
dataSheet.getCells().get("B3").putValue(3); | |
dataSheet.getCells().get("A1").putValue("A"); | |
dataSheet.getCells().get("A2").putValue("B"); | |
dataSheet.getCells().get("A3").putValue("C"); | |
// Define the Chart Collection | |
ChartCollection charts = sheet.getCharts(); | |
// Add a Column chart to the Chart Worksheet | |
int chartSheetIdx = charts.add(ChartType.COLUMN, 5, 0, 25, 15); | |
// Get the newly added Chart | |
Chart chart = book.getWorksheets().get(2).getCharts().get(0); | |
// Set the background/foreground color for PlotArea/ChartArea | |
chart.getPlotArea().getArea().setBackgroundColor(Color.getWhite()); | |
chart.getChartArea().getArea().setBackgroundColor(Color.getWhite()); | |
chart.getPlotArea().getArea().setForegroundColor(Color.getWhite()); | |
chart.getChartArea().getArea().setForegroundColor(Color.getWhite()); | |
// Hide the Legend | |
chart.setShowLegend (false); | |
// Add Data Series for the Chart | |
chart.getNSeries().add("DataSheet!B1:B3", true); | |
// Specify the Category Data | |
chart.getNSeries().setCategoryData("DataSheet!A1:A3"); | |
// Get the Data Series | |
Series ser = chart.getNSeries().get(0); | |
// Apply the 3-D formatting | |
ShapePropertyCollection spPr = ser.getShapeProperties(); | |
Format3D fmt3d = spPr.getFormat3D(); | |
// Specify Bevel with its height/width | |
Bevel bevel = fmt3d.getTopBevel(); | |
bevel.setType(BevelPresetType.CIRCLE); | |
bevel.setHeight(2); | |
bevel.setWidth(5); | |
// Specify Surface material type | |
fmt3d.setSurfaceMaterialType (PresetMaterialType.WARM_MATTE); | |
// Specify surface lighting type | |
fmt3d.setSurfaceLightingType(LightRigType.THREE_POINT); | |
// Specify lighting angle | |
fmt3d.setLightingAngle(0); | |
// Specify Series background/foreground and line color | |
ser.getArea().setBackgroundColor(Color.getMaroon()); | |
ser.getArea().setForegroundColor(Color.getMaroon()); | |
ser.getBorder().setColor(Color.getMaroon()); | |
// Save the Excel file | |
book.save("3d_format.out.xlsx"); |