Esempio n. 1
0
        public static List <Worksheet> GetAllWorksheets(SpreadsheetDocument spreadsheet)
        {
            var worksheets     = new List <Worksheet>();
            var worksheetParts = ExcelSpreadsheet.GetAllWorksheetParts(spreadsheet);

            foreach (WorksheetPart itemWorksheetPart in worksheetParts)
            {
                worksheets.Add(itemWorksheetPart.Worksheet);
            }
            return(worksheets);
        }
Esempio n. 2
0
        public static List <WorksheetPart> GetAllWorksheetParts(SpreadsheetDocument spreadsheet)
        {
            var worksheetParts = new List <WorksheetPart>();
            var sheets         = ExcelSpreadsheet.GetSheets(spreadsheet);

            foreach (Sheet itemSheet in sheets)
            {
                String        SheetID = itemSheet.Id;
                WorksheetPart wsPart  = (WorksheetPart)spreadsheet.WorkbookPart.GetPartById(SheetID);
                worksheetParts.Add(wsPart);
            }
            return(worksheetParts);
        }