Exemple #1
0
        // sheet grid data
        public static IList <IList <string> > GetDataAsStringsGrid(this Sheet sheet, int columnsRequired, int rowsRequired)
        {
            // Create empty sheet strings grid placeholder with required
            // number of the empty spaces for each row.
            IList <IList <string> > sheetStringsGrid = new IList <string> [rowsRequired];

            // Foreach row
            for (int rIndex = 0; rIndex < rowsRequired; rIndex++)
            {
                // Obtain row data if any available.
                RowData row = sheet.Data?.ElementAtOrDefault(0)?.RowData?.ElementAtOrDefault(rIndex);

                // If row data is available for this specific row.
                if (!(row is null) && !(row.Values is null))
                {
                    // Allocate appropriate size list filled with the data
                    // obtained from the row data on the sheet strings grid.
                    sheetStringsGrid[rIndex] = row.GetDataAsStrings(columnsRequired);
                }