قراءة وتلاعب رسومات Excel 2016
سيناريوهات الاستخدام المحتملة
أصبحت Aspose.Cells الآن تدعم قراءة وتلاعب الرسومات Microsoft Excel 2016 التي لم تكن موجودة في Microsoft Excel 2013 أو الإصدارات السابقة.
قراءة وتلاعب شكل بيانات Excel 2016
يحمل الكود النموذجي التالي ملف Excel المصدر الذي يحتوي على رسومات Excel 2016 في الورقة العمل الأولى. يقوم بقراءة جميع الرسومات وتغيير عنوان كل منها حسب نوع الرسم البياني. يوضح اللقطة الشاشية التالية الملف الأصلي لبرنامج Excel قبل تنفيذ الكود. كما تلاحظ، يكون عنوان الرسم متماثل لكل الرسوم.
تظهر اللقطة الشاشية التالية ملف Excel الناتج بعد تنفيذ الكود. كما تلاحظ، تم تغيير عنوان الرسم حسب نوعه.
الكود المثالي
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | |
// Load source excel file containing excel 2016 charts | |
Workbook book = new Workbook(dataDir + "excel2016Charts.xlsx"); | |
// Access the first worksheet which contains the charts | |
Worksheet sheet = book.Worksheets[0]; | |
// Access all charts one by one and read their types | |
for (int i = 0; i < sheet.Charts.Count; i++) | |
{ | |
// Access the chart | |
Chart ch = sheet.Charts[i]; | |
// Print chart type | |
Console.WriteLine(ch.Type); | |
// Change the title of the charts as per their types | |
ch.Title.Text = "Chart Type is " + ch.Type.ToString(); | |
} | |
// Save the workbook | |
book.Save(dataDir + "out_excel2016Charts.xlsx"); |
مخرجات الوحدة
إليك إخراج وحدة التحكم للشيفرة النموذجية أعلاه عند تنفيذها مع ملف Excel المصدر المقدم.
Waterfall
Treemap
Sunburst
Histogram
BoxWhisker