/* ==================================================================== Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for Additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ namespace HH.WMS.Utils.NPOI.SS.UserModel { using System; using System.Collections.Generic; using System.Collections; /// /// Used to specify the different possible policies /// if for the case of null and blank cells /// public class MissingCellPolicy { private static int NEXT_ID = 1; public int id; public MissingCellPolicy() { this.id = NEXT_ID++; } /// Missing cells are returned as null, Blank cells are returned as normal public static MissingCellPolicy RETURN_NULL_AND_BLANK = new MissingCellPolicy(); /// Missing cells are returned as null, as are blank cells public static MissingCellPolicy RETURN_BLANK_AS_NULL = new MissingCellPolicy(); /// A new, blank cell is Created for missing cells. Blank cells are returned as normal public static MissingCellPolicy CREATE_NULL_AS_BLANK = new MissingCellPolicy(); } /// /// High level representation of a row of a spreadsheet. /// public interface IRow { /// /// Use this to create new cells within the row and return it. /// /// The cell that is returned is a /. /// The type can be changed either through calling SetCellValue or SetCellType. /// /// the column number this cell represents /// Cell a high level representation of the created cell. /// /// ArgumentException if columnIndex < 0 or greater than the maximum number of supported columns /// (255 for *.xls, 1048576 for *.xlsx) /// ICell CreateCell(int column); /// /// Use this to create new cells within the row and return it. /// /// The cell that is returned is a /. The type can be changed /// either through calling SetCellValue or SetCellType. /// /// the column number this cell represents /// /// Cell a high level representation of the created cell. /// ArgumentException if columnIndex < 0 or greater than the maximum number of supported columns /// (255 for *.xls, 1048576 for *.xlsx) /// ICell CreateCell(int column, HH.WMS.Utils.NPOI.SS.UserModel.CellType type); /// /// Remove the Cell from this row. /// /// the cell to remove void RemoveCell(ICell cell); /// /// Get row number this row represents /// /// the row number (0 based) int RowNum { get; set; } /// /// Get the cell representing a given column (logical cell) 0-based. If you /// ask for a cell that is not defined....you get a null. /// /// 0 based column number /// Cell representing that column or null if undefined. /// ICell GetCell(int cellnum); /// /// Returns the cell at the given (0 based) index, with the specified {@link HH.WMS.Utils.NPOI.SS.usermodel.Row.MissingCellPolicy} /// /// the cell at the given (0 based) index /// ArgumentException if cellnum < 0 or the specified MissingCellPolicy is invalid /// /// /// ICell GetCell(int cellnum, MissingCellPolicy policy); /// /// Get the number of the first cell Contained in this row. /// /// /// short representing the first logical cell in the row, /// or -1 if the row does not contain any cells. /// short FirstCellNum { get; } /// /// Gets the index of the last cell Contained in this row PLUS ONE. The result also /// happens to be the 1-based column number of the last cell. This value can be used as a /// standard upper bound when iterating over cells: ///
        /// short minColIx = row.GetFirstCellNum();
        /// short maxColIx = row.GetLastCellNum();
        /// for(short colIx=minColIx; colIx<maxColIx; colIx++) {
        /// Cell cell = row.GetCell(colIx);
        /// if(cell == null) {
        /// continue;
        /// }
        /// //... do something with cell
        /// }
        /// 
///
/// /// short representing the last logical cell in the row PLUS ONE, /// or -1 if the row does not contain any cells. /// short LastCellNum { get; } /// /// Gets the number of defined cells (NOT number of cells in the actual row!). /// That is to say if only columns 0,4,5 have values then there would be 3. /// /// int representing the number of defined cells in the row. int PhysicalNumberOfCells { get; } /// /// Get whether or not to display this row with 0 height /// /// zHeight height is zero or not. bool ZeroHeight { get; set; } /// /// Get the row's height measured in twips (1/20th of a point). /// If the height is not set, the default worksheet value is returned, /// /// /// row height measured in twips (1/20th of a point) short Height { get; set; } /// /// Returns row height measured in point size. /// If the height is not set, the default worksheet value is returned, /// /// /// row height measured in point size /// /// float HeightInPoints { get; set; } /// /// Is this row formatted? Most aren't, but some rows /// do have whole-row styles. For those that do, you /// can get the formatting from /// bool IsFormatted { get; } /// /// Cell iterator of the physically defined cells. Note element 4 may /// actually be row cell depending on how many are defined! /// IEnumerator GetEnumerator(); /// /// Returns the Sheet this row belongs to /// /// the Sheet that owns this row ISheet Sheet { get; } /// /// Returns the whole-row cell styles. Most rows won't /// have one of these, so will return null. Call IsFormmated to check first /// /// The row style. ICellStyle RowStyle { get; set; } /// /// Moves the supplied cell to a new column, which /// must not already have a cell there! /// /// The cell to move /// The new column number (0 based) void MoveCell(ICell cell, int newColumn); /// /// Get cells in the row /// List Cells { get; } } }