This tutorial guides on tracing precedents in Excel using C#. It has the IDE settings, steps depicting the program flow, and a running sample code to identify dependent and precedent in Excel using C#. The sample code will create a new Excel file and demonstrate the complete process of creating and accessing the dependents and precedents.
Steps for Tracking Precedents and Dependents in Excel with C#
- Set the environment to use Aspose.Cells for .NET to track precedents and dependents
- Create an empty Excel file using the Workbook class for analyzing precedents and dependents
- Mark some cells as dependent and precedent and set the formula in the dependent cell accordingly
- Access the collection of precedents from the dependent cell
- Iterate through all the precedents and display basic information
- Get the collection of dependents from any precedent cell and display the information
These steps summarize the process to identify the dependents and precedents in Excel using C#. Create an empty workbook, set a formula in a cell, and access the precedents collection from the cell where you have set the formula. Similarly, get the list of dependents for the cell used in the formula to understand how to retrieve the information of the dependent cells.
Code to Identify Precedents and Dependents in Excel with C#
The sample code demonstrates how to track Excel dependent cells using C# and precedent cells. The precedent collection contains the referred area collection as a formula that encompasses a range or set of cells, while any precedent cell contains a collection of individual cells that depend on it.
This article has taught us the concept of tracing dependents and precedents in Excel. For displaying the document properties, refer to the article on Display document properties in Excel using C#.