Aspose.Cells.Examples.CSharp.AdvancedTopics.SmartMarkers.UsingNestedObjects.Run C# (CSharp) Méthode

Run() public static méthode

public static Run ( ) : void
Résultat void
        public static void Run()
        {
            //ExStart:UsingNestedObjects
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

            // ****** Program ******

            // Initialize WorkbookDesigner object
            WorkbookDesigner designer = new WorkbookDesigner();
            // Load the template file
            designer.Workbook = new Workbook(dataDir + "SM_NestedObjects.xlsx");
            // Instantiate the List based on the class
            System.Collections.Generic.ICollection<Individual> list = new System.Collections.Generic.List<Individual>();
            // Create an object for the Individual class
            Individual p1 = new Individual("Damian", 30);
            // Create the relevant Wife class for the Individual
            p1.Wife = new Wife("Dalya", 28);
            // Create another object for the Individual class
            Individual p2 = new Individual("Mack", 31);
            // Create the relevant Wife class for the Individual
            p2.Wife = new Wife("Maaria", 29);
            // Add the objects to the list
            list.Add(p1);
            list.Add(p2);
            // Specify the DataSource
            designer.SetDataSource("Individual", list);
            // Process the markers
            designer.Process(false);
            // Save the Excel file.
            designer.Workbook.Save(dataDir+ "out_SM_NestedObjects.out.xlsx");
            //ExEnd:UsingNestedObjects

        }
UsingNestedObjects