الحصول على ورقة البيانات للشارت
Contents
[
Hide
]
في بعض الأحيان، قد ترغب في الوصول إلى ورقة عمل من مرجع شارت. توفر Aspose.Cells ال Chart.Worksheet المعني الذي يعيد مرجع الورقة التي تحتوي على الشارت.
يوضح المثال التالي كيفية استخدام ال Chart.Worksheet المعني. يطبع الكود أولاً اسم الورقة، ثم يصل إلى الشارت الأول على الورقة. ثم يطبع اسم الورقة مرة أخرى باستخدام ال Chart.Worksheet المعني.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); | |
// Create workbook from sample Excel file | |
Workbook workbook = new Workbook(dataDir + "sample.xlsx"); | |
// Access first worksheet of the workbook | |
Worksheet worksheet = workbook.Worksheets[0]; | |
// Print worksheet name | |
Console.WriteLine("Sheet Name: " + worksheet.Name); | |
// Access the first chart inside this worksheet | |
Chart chart = worksheet.Charts[0]; | |
// Access the chart's sheet and display its name again | |
Console.WriteLine("Chart's Sheet Name: " + chart.Worksheet.Name); |
أدناه نتيجة الإخراج على الشاشة التي يؤدي إليها الكود المثالي. كما يمكنك رؤية، فإنه يطبع اسم الورقة نفسه بكلتا المرتين.
Sheet Name: Portfolio
Chart's Sheet Name: Portfolio