Esempio n. 1
0
        /// <summary>
        /// Get a specific cell from a row. If the cell doesn't exist,
        /// </summary>
        /// <param name="row">The row that the cell is part of</param>
        /// <param name="column">The column index that the cell is in.</param>
        /// <returns>The cell indicated by the column.</returns>
        public static Fruit.Utils.NPOI.SS.UserModel.ICell GetCell(Fruit.Utils.NPOI.SS.UserModel.IRow row, int column)
        {
            Fruit.Utils.NPOI.SS.UserModel.ICell cell = row.GetCell(column);

            if (cell == null)
            {
                cell = row.CreateCell(column);
            }
            return(cell);
        }
Esempio n. 2
0
        /// <summary>
        /// Get a row from the spreadsheet, and Create it if it doesn't exist.
        /// </summary>
        /// <param name="rowCounter">The 0 based row number</param>
        /// <param name="sheet">The sheet that the row is part of.</param>
        /// <returns>The row indicated by the rowCounter</returns>
        public static Fruit.Utils.NPOI.SS.UserModel.IRow GetRow(int rowCounter, HSSFSheet sheet)
        {
            Fruit.Utils.NPOI.SS.UserModel.IRow row = sheet.GetRow(rowCounter);
            if (row == null)
            {
                row = sheet.CreateRow(rowCounter);
            }

            return(row);
        }
Esempio n. 3
0
        /// <summary>
        /// Creates a cell, gives it a value, and applies a style if provided
        /// </summary>
        /// <param name="row">the row to Create the cell in</param>
        /// <param name="column">the column index to Create the cell in</param>
        /// <param name="value">The value of the cell</param>
        /// <param name="style">If the style is not null, then Set</param>
        /// <returns>A new HSSFCell</returns>
        public static Fruit.Utils.NPOI.SS.UserModel.ICell CreateCell(Fruit.Utils.NPOI.SS.UserModel.IRow row, int column, String value, HSSFCellStyle style)
        {
            Fruit.Utils.NPOI.SS.UserModel.ICell cell = GetCell(row, column);

            cell.SetCellValue(new HSSFRichTextString(value));
            if (style != null)
            {
                cell.CellStyle = (style);
            }

            return(cell);
        }
Esempio n. 4
0
 /// <summary>
 /// Create a cell, and give it a value.
 /// </summary>
 /// <param name="row">the row to Create the cell in</param>
 /// <param name="column">the column index to Create the cell in</param>
 /// <param name="value">The value of the cell</param>
 /// <returns>A new HSSFCell.</returns>
 public static Fruit.Utils.NPOI.SS.UserModel.ICell CreateCell(Fruit.Utils.NPOI.SS.UserModel.IRow row, int column, String value)
 {
     return(CreateCell(row, column, value, null));
 }