Esempio n. 1
0
        /// <summary>
        /// Sets the row data.
        /// </summary>
        /// <param name="worksheet">The sheet</param>
        /// <param name="rowData">The row data</param>
        /// <param name="sheetRowIndex">Index of the sheet row</param>
        /// <param name="columnIndex">Index of the column</param>
        /// <param name="columnCount">The column count</param>
        /// <param name="area">The area</param>
        /// <param name="opt">The opt</param>
        static void SetRowData(Worksheet worksheet, List <string> rowData, int sheetRowIndex, int columnIndex, int columnCount, SheetArea area, ImportExportOptions opt)
        {
            int num = 0;

            for (int i = columnIndex; num < rowData.Count; i++)
            {
                if ((columnCount > 0) && (i < worksheet.GetColumnCount(area)))
                {
                    SetCellData(worksheet, area, sheetRowIndex, i, rowData[num], opt);
                }
                num++;
            }
        }
Esempio n. 2
0
        /// <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);
        }