View | Details | Raw Unified | Return to bug 45919
Collapse All | Expand All

(-)HSSFCell.java (-44 / +89 lines)
Lines 72-73 Link Here
72
public final class HSSFCell {
72
public class HSSFCell {
73
Line 97 Link Here
97
//    /**
98
//     * Creates new Cell - Should only be called by HSSFRow.  This creates a cell
99
//     * from scratch.
100
//     * <p>
101
//     * When the cell is initially created it is set to CELL_TYPE_BLANK. Cell types
102
//     * can be changed/overwritten by calling setCellValue with the appropriate
103
//     * type as a parameter although conversions from one type to another may be
104
//     * prohibited.
105
//     *
106
//     * @param book - Workbook record of the workbook containing this cell
107
//     * @param sheet - Sheet record of the sheet containing this cell
108
//     * @param row   - the row of this cell
109
//     * @param col   - the column for this cell
110
//     *
111
//     * @see org.apache.poi.hssf.usermodel.HSSFRow#createCell(short)
112
//     */
113
//    protected HSSFCell(HSSFWorkbook book, HSSFSheet sheet, int row, short col)
114
//    {
115
//        this (book, sheet, row, col, CELL_TYPE_BLANK);
116
////        checkBounds(col);
117
////        stringValue  = null;
118
////        this.book    = book;
119
////        this.sheet   = sheet;
120
////
121
////        // Relying on the fact that by default the cellType is set to 0 which
122
////        // is different to CELL_TYPE_BLANK hence the following method call correctly
123
////        // creates a new blank cell.
124
////        short xfindex = sheet.getSheet().getXFIndexForColAt(col);
125
////        setCellType(CELL_TYPE_BLANK, false, row, col,xfindex);
126
//    }
127
    public HSSFSheet getSheet() {
128
        return sheet;
129
    }
130
    public HSSFWorkbook getWorkbook()
131
    {
132
        return this.book;
133
    }
134
135
//    /**
136
//     * Creates new Cell - Should only be called by HSSFRow.  This creates a cell
137
//     * from scratch.
138
//     *
139
//     * @param book - Workbook record of the workbook containing this cell
140
//     * @param sheet - Sheet record of the sheet containing this cell
141
//     * @param row   - the row of this cell
142
//     * @param col   - the column for this cell
143
//     * @param type  - CELL_TYPE_NUMERIC, CELL_TYPE_STRING, CELL_TYPE_FORMULA, CELL_TYPE_BLANK,
144
//     *                CELL_TYPE_BOOLEAN, CELL_TYPE_ERROR
145
//     *                Type of cell
146
//     * @see org.apache.poi.hssf.usermodel.HSSFRow#createCell(short,int)
147
//     */
148
//    protected HSSFCell(HSSFWorkbook book, HSSFSheet sheet, int row, short col,
149
//                       int type)
150
//    {
151
//        checkBounds(col);
152
//        cellType     = -1; // Force 'setCellType' to create a first Record
153
//        stringValue  = null;
154
//        this.book    = book;
155
//        this.sheet   = sheet;
156
//
157
//        short xfindex = sheet.getSheet().getXFIndexForColAt(col);
158
//        setCellType(type,false,row,col,xfindex);
159
//    }
Lines 99-105 Link Here
99
     * Creates new Cell - Should only be called by HSSFRow.  This creates a cell
100
     * from scratch.
101
     * <p>
102
     * When the cell is initially created it is set to CELL_TYPE_BLANK. Cell types
103
     * can be changed/overwritten by calling setCellValue with the appropriate
104
     * type as a parameter although conversions from one type to another may be
105
     * prohibited.
Lines 107-110 Link Here
107
     * @param book - Workbook record of the workbook containing this cell
162
   * You can now also create a new HSSFCell with this public constructor,
108
     * @param sheet - Sheet record of the sheet containing this cell
163
   * not having to use HSSFRow.createCell.
109
     * @param row   - the row of this cell
164
   * This makes it possible to derive classes from HSSFCell
110
     * @param col   - the column for this cell
165
   * (it is no longer final) and to construct objects of the derived
166
   * classes which can be used like the original ones.
Line 112 Link Here
112
     * @see org.apache.poi.hssf.usermodel.HSSFRow#createCell(short)
168
   * @param hrow HSSFRow, in which the cell is to be created
169
   * @param col Column index of the cell
Line 114 Link Here
114
    protected HSSFCell(HSSFWorkbook book, HSSFSheet sheet, int row, short col)
171
    public HSSFCell(HSSFRow hrow, int col)
Lines 116-125 Link Here
116
        checkBounds(col);
173
      this (hrow, col, CELL_TYPE_BLANK);
117
        stringValue  = null;
118
        this.book    = book;
119
        this.sheet   = sheet;
120
121
        // Relying on the fact that by default the cellType is set to 0 which
122
        // is different to CELL_TYPE_BLANK hence the following method call correctly
123
        // creates a new blank cell.
124
        short xfindex = sheet.getSheet().getXFIndexForColAt(col);
125
        setCellType(CELL_TYPE_BLANK, false, row, col,xfindex);
Lines 127-129 Link Here
127
    public HSSFSheet getSheet() {
128
        return sheet;
129
    }
Lines 132-133 Link Here
132
     * Creates new Cell - Should only be called by HSSFRow.  This creates a cell
133
     * from scratch.
Lines 135-139 Link Here
135
     * @param book - Workbook record of the workbook containing this cell
178
   * You can now also create a new HSSFCell with this public constructor,
136
     * @param sheet - Sheet record of the sheet containing this cell
179
   * not having to use HSSFRow.createCell.
137
     * @param row   - the row of this cell
180
   * This makes it possible to derive classes from HSSFCell
138
     * @param col   - the column for this cell
181
   * (it is no longer final) and to construct objects of the derived
139
     * @param type  - CELL_TYPE_NUMERIC, CELL_TYPE_STRING, CELL_TYPE_FORMULA, CELL_TYPE_BLANK,
182
   * classes which can be used like the original ones.
183
   * 
184
   * @param hrow HSSFRow, in which the cell is to be created
185
   * @param col Column index of the cell
186
   * @param type CELL_TYPE_NUMERIC, CELL_TYPE_STRING, CELL_TYPE_FORMULA, CELL_TYPE_BLANK,
Lines 141-142 Link Here
141
     *                Type of cell
142
     * @see org.apache.poi.hssf.usermodel.HSSFRow#createCell(short,int)
Lines 144-145 Link Here
144
    protected HSSFCell(HSSFWorkbook book, HSSFSheet sheet, int row, short col,
189
    public HSSFCell(HSSFRow hrow, int col, int type)
145
                       int type)
Lines 150-151 Link Here
150
        this.book    = book;
194
        HSSFRow.BookNSheet privateParts = hrow.getPrivateParts ();
151
        this.sheet   = sheet;
195
        this.book = privateParts.book;
196
        this.sheet = privateParts.sheet;
Lines 153-154 Link Here
153
        short xfindex = sheet.getSheet().getXFIndexForColAt(col);
198
        short xfindex = sheet.getSheet().getXFIndexForColAt((short)col);
154
        setCellType(type,false,row,col,xfindex);
199
        setCellType(type,false,privateParts.row,(short)col,xfindex);
200
        hrow.initNewCell(this);
Line 189 Link Here
189

Return to bug 45919