/// <summary> /// Gets the part data. /// </summary> /// <param name="worksheet">The sheet</param> /// <param name="rowStartIndex">Start index of the row</param> /// <param name="rowEndIndex">End index of the row</param> /// <param name="columnStartIndex">Start index of the column</param> /// <param name="columnEndIndex">End index of the column</param> /// <param name="area">The area</param> /// <param name="opt">The opt</param> /// <returns></returns> static List <List <object> > GetPartData(Worksheet worksheet, int rowStartIndex, int rowEndIndex, int columnStartIndex, int columnEndIndex, SheetArea area, ImportExportOptions opt) { if (!opt.IncludeSheetArea(area)) { return(null); } List <List <object> > list = new List <List <object> >(); bool actualVisible = true; for (int i = rowStartIndex; i <= rowEndIndex; i++) { if (area == SheetArea.ColumnHeader) { actualVisible = worksheet.ColumnHeader.Rows[i].ActualVisible; } else { actualVisible = worksheet.Rows[i].ActualVisible; } if (actualVisible || !opt.AsViewed) { List <object> list2 = new List <object>(); if (opt.RowHeader && (area == SheetArea.Cells)) { for (int k = 0; k < worksheet.GetColumnCount(SheetArea.CornerHeader | SheetArea.RowHeader); k++) { if (worksheet.GetActualColumnVisible(k, SheetArea.CornerHeader | SheetArea.RowHeader) || !opt.AsViewed) { list2.Add(GetCellData(worksheet, SheetArea.CornerHeader | SheetArea.RowHeader, i, k, opt)); } } } for (int j = columnStartIndex; j <= columnEndIndex; j++) { if (worksheet.GetActualColumnVisible(j, SheetArea.Cells) || !opt.AsViewed) { list2.Add(GetCellData(worksheet, area, i, j, opt)); } } list.Add(list2); } } return(list); }
/// <summary> /// Gets the column widths. /// </summary> /// <param name="worksheet">The worksheet.</param> /// <param name="area">The area.</param> /// <param name="startIndex">The start index.</param> /// <param name="count">The count.</param> /// <returns></returns> public static List <double> GetColumnWidths(Worksheet worksheet, SheetArea area, int startIndex, int count) { List <double> list = new List <double>(); for (int i = startIndex; i < (startIndex + count); i++) { if (!worksheet.GetActualColumnVisible(i, area)) { list.Add(0.0); } else { list.Add(worksheet.GetColumnWidth(i, area)); } } return(list); }