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

(-)src/examples/src/org/apache/poi/hssf/usermodel/examples/RepeatingRowsAndColumns.java (-1 / +1 lines)
Lines 37-43 Link Here
37
37
38
        HSSFFont boldFont = wb.createFont();
38
        HSSFFont boldFont = wb.createFont();
39
        boldFont.setFontHeightInPoints((short)22);
39
        boldFont.setFontHeightInPoints((short)22);
40
        boldFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
40
        boldFont.setBold(true);
41
41
42
        HSSFCellStyle boldStyle = wb.createCellStyle();
42
        HSSFCellStyle boldStyle = wb.createCellStyle();
43
        boldStyle.setFont(boldFont);
43
        boldStyle.setFont(boldFont);
(-)src/java/org/apache/poi/hssf/usermodel/EscherGraphics.java (-2 / +2 lines)
Lines 330-336 Link Here
330
            hssfColor = workbook.getCustomPalette().findSimilarColor((byte)foreground.getRed(), (byte)foreground.getGreen(), (byte)foreground.getBlue());
330
            hssfColor = workbook.getCustomPalette().findSimilarColor((byte)foreground.getRed(), (byte)foreground.getGreen(), (byte)foreground.getBlue());
331
        boolean bold = (matchFont.getStyle() & Font.BOLD) != 0;
331
        boolean bold = (matchFont.getStyle() & Font.BOLD) != 0;
332
        boolean italic = (matchFont.getStyle() & Font.ITALIC) != 0;
332
        boolean italic = (matchFont.getStyle() & Font.ITALIC) != 0;
333
        HSSFFont hssfFont = workbook.findFont(bold ? HSSFFont.BOLDWEIGHT_BOLD : 0,
333
        HSSFFont hssfFont = workbook.findFont(bold,
334
                    hssfColor.getIndex(),
334
                    hssfColor.getIndex(),
335
                    (short)(matchFont.getSize() * 20),
335
                    (short)(matchFont.getSize() * 20),
336
                    matchFont.getName(),
336
                    matchFont.getName(),
Lines 341-347 Link Here
341
        if (hssfFont == null)
341
        if (hssfFont == null)
342
        {
342
        {
343
            hssfFont = workbook.createFont();
343
            hssfFont = workbook.createFont();
344
            hssfFont.setBoldweight(bold ? HSSFFont.BOLDWEIGHT_BOLD : 0);
344
            hssfFont.setBold(bold);
345
            hssfFont.setColor(hssfColor.getIndex());
345
            hssfFont.setColor(hssfColor.getIndex());
346
            hssfFont.setFontHeight((short)(matchFont.getSize() * 20));
346
            hssfFont.setFontHeight((short)(matchFont.getSize() * 20));
347
            hssfFont.setFontName(matchFont.getName());
347
            hssfFont.setFontName(matchFont.getName());
(-)src/java/org/apache/poi/hssf/usermodel/HSSFClientAnchor.java (-11 lines)
Lines 21-27 Link Here
21
import org.apache.poi.ddf.EscherRecord;
21
import org.apache.poi.ddf.EscherRecord;
22
import org.apache.poi.ss.SpreadsheetVersion;
22
import org.apache.poi.ss.SpreadsheetVersion;
23
import org.apache.poi.ss.usermodel.ClientAnchor;
23
import org.apache.poi.ss.usermodel.ClientAnchor;
24
import org.apache.poi.util.Removal;
25
24
26
/**
25
/**
27
 * A client anchor is attached to an excel worksheet.  It anchors against a
26
 * A client anchor is attached to an excel worksheet.  It anchors against a
Lines 268-283 Link Here
268
    public void setAnchorType(AnchorType anchorType) {
267
    public void setAnchorType(AnchorType anchorType) {
269
        _escherClientAnchor.setFlag(anchorType.value);
268
        _escherClientAnchor.setFlag(anchorType.value);
270
    }
269
    }
271
    /**
272
     * Sets the anchor type
273
     * @param anchorType the anchor type to set
274
     * @deprecated POI 3.15. Use {@link #setAnchorType(AnchorType)} instead.
275
     */
276
    @Removal(version="3.17")
277
    @Override
278
    public void setAnchorType(int anchorType) {
279
        _escherClientAnchor.setFlag((short) anchorType);
280
    }
281
270
282
    private void checkRange(int value, int minRange, int maxRange, String varName) {
271
    private void checkRange(int value, int minRange, int maxRange, String varName) {
283
        if (value < minRange || value > maxRange)
272
        if (value < minRange || value > maxRange)
(-)src/java/org/apache/poi/hssf/usermodel/HSSFCreationHelper.java (-11 lines)
Lines 21-27 Link Here
21
import org.apache.poi.hssf.record.common.ExtendedColor;
21
import org.apache.poi.hssf.record.common.ExtendedColor;
22
import org.apache.poi.ss.usermodel.CreationHelper;
22
import org.apache.poi.ss.usermodel.CreationHelper;
23
import org.apache.poi.util.Internal;
23
import org.apache.poi.util.Internal;
24
import org.apache.poi.util.Removal;
25
24
26
public class HSSFCreationHelper implements CreationHelper {
25
public class HSSFCreationHelper implements CreationHelper {
27
    private final HSSFWorkbook workbook;
26
    private final HSSFWorkbook workbook;
Lines 46-62 Link Here
46
        return workbook.createDataFormat();
45
        return workbook.createDataFormat();
47
    }
46
    }
48
47
49
    /**
50
     * {@inheritDoc}
51
     * @deprecated POI 3.15 beta 3. Use {@link #createHyperlink(HyperlinkType)} instead.
52
     */
53
    @Deprecated
54
    @Removal(version="3.17")
55
    @Override
48
    @Override
56
    public HSSFHyperlink createHyperlink(int type) {
57
        return new HSSFHyperlink(type);
58
    }
59
    @Override
60
    public HSSFHyperlink createHyperlink(HyperlinkType type) {
49
    public HSSFHyperlink createHyperlink(HyperlinkType type) {
61
        return new HSSFHyperlink(type);
50
        return new HSSFHyperlink(type);
62
    }
51
    }
(-)src/java/org/apache/poi/hssf/usermodel/HSSFFont.java (-26 / +11 lines)
Lines 31-39 Link Here
31
public final class HSSFFont implements Font {
31
public final class HSSFFont implements Font {
32
32
33
    /**
33
    /**
34
     * Normal boldness (not bold)
35
     */
36
    final static short BOLDWEIGHT_NORMAL = 0x190;
37
38
    /**
39
     * Bold boldness (bold)
40
     */
41
    final static short BOLDWEIGHT_BOLD = 0x2bc;
42
43
    /**
34
     * Arial font
44
     * Arial font
35
     */
45
     */
36
37
    public final static String FONT_ARIAL = "Arial";
46
    public final static String FONT_ARIAL = "Arial";
38
47
39
48
Lines 199-216 Link Here
199
       HSSFPalette pallette = wb.getCustomPalette();
208
       HSSFPalette pallette = wb.getCustomPalette();
200
       return pallette.getColor( getColor() );
209
       return pallette.getColor( getColor() );
201
    }
210
    }
202
203
    /**
204
     * set the boldness to use
205
     * @param boldweight
206
     * @see #BOLDWEIGHT_NORMAL
207
     * @see #BOLDWEIGHT_BOLD
208
     * @deprecated 3.15 beta 2. Scheduled for removal in 3.17. Use {@link #setBold(boolean)} instead.
209
     */
210
    public void setBoldweight(short boldweight)
211
    {
212
        font.setBoldWeight(boldweight);
213
    }
214
    
211
    
215
    /**
212
    /**
216
     * sets the font to be bold or not
213
     * sets the font to be bold or not
Lines 222-239 Link Here
222
        else
219
        else
223
            font.setBoldWeight(BOLDWEIGHT_NORMAL);
220
            font.setBoldWeight(BOLDWEIGHT_NORMAL);
224
    }
221
    }
225
226
    /**
227
     * get the boldness to use
228
     * @return boldweight
229
     * @see #BOLDWEIGHT_NORMAL
230
     * @see #BOLDWEIGHT_BOLD
231
     * @deprecated 3.15 beta 2. Scheduled for removal in 3.17. Use {@link #getBold} instead.
232
     */
233
    public short getBoldweight()
234
    {
235
        return font.getBoldWeight();
236
    }
237
    
222
    
238
    /**
223
    /**
239
     * get if the font is bold or not
224
     * get if the font is bold or not
Lines 240-246 Link Here
240
     */
225
     */
241
    public boolean getBold()
226
    public boolean getBold()
242
    {
227
    {
243
        return getBoldweight() == BOLDWEIGHT_BOLD;
228
        return font.getBoldWeight() == BOLDWEIGHT_BOLD;
244
    }
229
    }
245
230
246
    /**
231
    /**
(-)src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java (-12 lines)
Lines 2172-2190 Link Here
2172
            }
2172
            }
2173
            setColumnWidth(column, (int) (width));
2173
            setColumnWidth(column, (int) (width));
2174
        }
2174
        }
2175
2176
    }
2175
    }
2177
2178
    /**
2179
     * Returns cell comment for the specified row and column
2180
     *
2181
     * @return cell comment or <code>null</code> if not found
2182
     * @deprecated as of 2015-11-23 (circa POI 3.14beta1). Use {@link #getCellComment(CellAddress)} instead.
2183
     */
2184
    @Override
2185
    public HSSFComment getCellComment(int row, int column) {
2186
        return findCellComment(row, column);
2187
    }
2188
    
2176
    
2189
    /**
2177
    /**
2190
     * Returns cell comment for the specified row and column
2178
     * Returns cell comment for the specified row and column
(-)src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java (-33 lines)
Lines 1207-1247 Link Here
1207
1207
1208
    /**
1208
    /**
1209
     * Finds a font that matches the one with the supplied attributes
1209
     * Finds a font that matches the one with the supplied attributes
1210
     * @deprecated 3.15 beta 2. Use {@link #findFont(boolean, short, short, String, boolean, boolean, short, byte)} instead.
1211
     */
1210
     */
1212
    @Deprecated
1213
    @Override
1211
    @Override
1214
    public HSSFFont findFont(short boldWeight, short color, short fontHeight,
1215
                             String name, boolean italic, boolean strikeout,
1216
                             short typeOffset, byte underline)
1217
    {
1218
        short numberOfFonts = getNumberOfFonts();
1219
        for (short i=0; i<=numberOfFonts; i++) {
1220
            // Remember - there is no 4!
1221
            if(i == 4) {
1222
                continue;
1223
            }
1224
1225
            HSSFFont hssfFont = getFontAt(i);
1226
            if (hssfFont.getBoldweight() == boldWeight
1227
                    && hssfFont.getColor() == color
1228
                    && hssfFont.getFontHeight() == fontHeight
1229
                    && hssfFont.getFontName().equals(name)
1230
                    && hssfFont.getItalic() == italic
1231
                    && hssfFont.getStrikeout() == strikeout
1232
                    && hssfFont.getTypeOffset() == typeOffset
1233
                    && hssfFont.getUnderline() == underline)
1234
            {
1235
                return hssfFont;
1236
            }
1237
        }
1238
1239
        return null;
1240
    }
1241
    /**
1242
     * Finds a font that matches the one with the supplied attributes
1243
     */
1244
    @Override
1245
    public HSSFFont findFont(boolean bold, short color, short fontHeight,
1212
    public HSSFFont findFont(boolean bold, short color, short fontHeight,
1246
                             String name, boolean italic, boolean strikeout,
1213
                             String name, boolean italic, boolean strikeout,
1247
                             short typeOffset, byte underline)
1214
                             short typeOffset, byte underline)
(-)src/java/org/apache/poi/ss/usermodel/ClientAnchor.java (-53 lines)
Lines 17-23 Link Here
17
package org.apache.poi.ss.usermodel;
17
package org.apache.poi.ss.usermodel;
18
18
19
import org.apache.poi.util.Internal;
19
import org.apache.poi.util.Internal;
20
import org.apache.poi.util.Removal;
21
20
22
/**
21
/**
23
 * A client anchor is attached to an excel worksheet.  It anchors against 
22
 * A client anchor is attached to an excel worksheet.  It anchors against 
Lines 35-85 Link Here
35
public interface ClientAnchor {
34
public interface ClientAnchor {
36
    
35
    
37
    /**
36
    /**
38
     * Move and Resize With Anchor Cells
39
     * <p>
40
     * Specifies that the current drawing shall move and
41
     * resize to maintain its row and column anchors (i.e. the
42
     * object is anchored to the actual from and to row and column)
43
     * </p>
44
     * @deprecated since POI 3.14beta1 (circa 2015-11-24). Use {@link AnchorType#MOVE_AND_RESIZE} instead.
45
     */
46
    @Removal(version="3.17")
47
    public static final AnchorType MOVE_AND_RESIZE = AnchorType.MOVE_AND_RESIZE;
48
    
49
    /**
50
     * Move With Cells but Do Not Resize
51
     * <p>
52
     * Specifies that the current drawing shall move with its
53
     * row and column (i.e. the object is anchored to the
54
     * actual from row and column), but that the size shall remain absolute.
55
     * </p>
56
     * <p>
57
     * If additional rows/columns are added between the from and to locations of the drawing,
58
     * the drawing shall move its to anchors as needed to maintain this same absolute size.
59
     * </p>
60
     * @deprecated since POI 3.14beta1 (circa 2015-11-24). Use {@link AnchorType#MOVE_DONT_RESIZE} instead.
61
     */
62
    @Removal(version="3.17")
63
    public static final AnchorType MOVE_DONT_RESIZE = AnchorType.MOVE_DONT_RESIZE;
64
65
    /**
66
     * Do Not Move or Resize With Underlying Rows/Columns
67
     * <p>
68
     * Specifies that the current start and end positions shall
69
     * be maintained with respect to the distances from the
70
     * absolute start point of the worksheet.
71
     * </p>
72
     * <p>
73
     * If additional rows/columns are added before the
74
     * drawing, the drawing shall move its anchors as needed
75
     * to maintain this same absolute position.
76
     * </p>
77
     * @deprecated since POI 3.14beta1 (circa 2015-11-24). Use {@link AnchorType#DONT_MOVE_AND_RESIZE} instead.
78
     */
79
    @Removal(version="3.17")
80
    public static final AnchorType DONT_MOVE_AND_RESIZE = AnchorType.DONT_MOVE_AND_RESIZE;
81
    
82
    /**
83
     * @since POI 3.14beta1
37
     * @since POI 3.14beta1
84
     */
38
     */
85
    public static enum AnchorType {
39
    public static enum AnchorType {
Lines 309-321 Link Here
309
     * @since POI 3.14
263
     * @since POI 3.14
310
     */
264
     */
311
    public void setAnchorType( AnchorType anchorType );
265
    public void setAnchorType( AnchorType anchorType );
312
    /**
313
     * Sets the anchor type
314
     * @param anchorType the anchor type to set
315
     * @deprecated POI 3.15. Use {@link #setAnchorType(AnchorType)} instead.
316
     */
317
    @Removal(version="3.17")
318
    public void setAnchorType( int anchorType );
319
266
320
    /**
267
    /**
321
     * Gets the anchor type
268
     * Gets the anchor type
(-)src/java/org/apache/poi/ss/usermodel/CreationHelper.java (-9 lines)
Lines 17-23 Link Here
17
package org.apache.poi.ss.usermodel;
17
package org.apache.poi.ss.usermodel;
18
18
19
import org.apache.poi.common.usermodel.HyperlinkType;
19
import org.apache.poi.common.usermodel.HyperlinkType;
20
import org.apache.poi.util.Removal;
21
20
22
/**
21
/**
23
 * An object that handles instantiating concrete
22
 * An object that handles instantiating concrete
Lines 41-54 Link Here
41
     * Creates a new DataFormat instance
40
     * Creates a new DataFormat instance
42
     */
41
     */
43
    DataFormat createDataFormat();
42
    DataFormat createDataFormat();
44
45
    /**
46
     * Creates a new Hyperlink, of the given type
47
     * @deprecated POI 3.15 beta 3. Use {@link #createHyperlink(HyperlinkType)} instead.
48
     */
49
    @Removal(version="3.17")
50
    @Deprecated
51
    Hyperlink createHyperlink(int type);
52
    
43
    
53
    /**
44
    /**
54
     * Creates a new Hyperlink, of the given type
45
     * Creates a new Hyperlink, of the given type
(-)src/java/org/apache/poi/ss/usermodel/Font.java (-21 lines)
Lines 19-39 Link Here
19
19
20
20
21
public interface Font {
21
public interface Font {
22
    /**
23
     * Normal boldness (not bold)
24
     * @deprecated 3.15 beta 2. Scheduled for removal in 3.17.
25
     * Boldweight constants no longer needed due to {@link #getBold} and {@link #setBold(boolean)}
26
     */
27
    public final static short BOLDWEIGHT_NORMAL = 0x190;
28
22
29
    /**
23
    /**
30
     * Bold boldness (bold)
31
     * @deprecated 3.15 beta 2. Scheduled for removal in 3.17.
32
     * Boldweight constants no longer needed due to {@link #getBold} and {@link #setBold(boolean)}
33
     */
34
    public final static short BOLDWEIGHT_BOLD = 0x2bc;
35
36
    /**
37
     * normal type of black color.
24
     * normal type of black color.
38
     */
25
     */
39
26
Lines 283-297 Link Here
283
     */
270
     */
284
    public short getIndex();
271
    public short getIndex();
285
272
286
    /**
287
     * @deprecated 3.15 beta 2. Scheduled for removal in 3.17. Use {@link #setBold(boolean)}.
288
     */
289
    public void setBoldweight(short boldweight);
290
    public void setBold(boolean bold);
273
    public void setBold(boolean bold);
291
274
292
    /**
293
     * @deprecated 3.15 beta 2. Scheduled for removal in 3.17. Use {@link #getBold()}.
294
     */
295
    public short getBoldweight();
296
    public boolean getBold();
275
    public boolean getBold();
297
}
276
}
(-)src/java/org/apache/poi/ss/usermodel/Sheet.java (-22 lines)
Lines 615-633 Link Here
615
     * @return true =&gt; protection enabled; false =&gt; protection disabled
615
     * @return true =&gt; protection enabled; false =&gt; protection disabled
616
     */
616
     */
617
    boolean getScenarioProtect();
617
    boolean getScenarioProtect();
618
619
    /**
620
     * Sets the zoom magnication for the sheet.  The zoom is expressed as a
621
     * fraction.  For example to express a zoom of 75% use 3 for the numerator
622
     * and 4 for the denominator.
623
     *
624
     * @param numerator     The numerator for the zoom magnification.
625
     * @param denominator   The denominator for the zoom magnification.
626
     * @deprecated 2015-11-23 (circa POI 3.14beta1). Use {@link #setZoom(int)} instead.
627
     */
628
    @Removal(version="3.16")
629
    @Deprecated
630
    void setZoom(int numerator, int denominator);
631
    
618
    
632
    /**
619
    /**
633
     * Window zoom magnification for current view representing percent values.
620
     * Window zoom magnification for current view representing percent values.
Lines 941-955 Link Here
941
     * @param useMergedCells whether to use the contents of merged cells when calculating the width of the column
928
     * @param useMergedCells whether to use the contents of merged cells when calculating the width of the column
942
     */
929
     */
943
    void autoSizeColumn(int column, boolean useMergedCells);
930
    void autoSizeColumn(int column, boolean useMergedCells);
944
945
    /**
946
     * Returns cell comment for the specified row and column
947
     *
948
     * @return cell comment or <code>null</code> if not found
949
     * @deprecated as of 2015-11-23 (circa POI 3.14beta1). Use {@link #getCellComment(CellAddress)} instead.
950
     */
951
    @Deprecated
952
    Comment getCellComment(int row, int column);
953
    
931
    
954
    /**
932
    /**
955
     * Returns cell comment for the specified location
933
     * Returns cell comment for the specified location
(-)src/java/org/apache/poi/ss/usermodel/Workbook.java (-9 lines)
Lines 289-303 Link Here
289
     * @return new font object
289
     * @return new font object
290
     */
290
     */
291
    Font createFont();
291
    Font createFont();
292
293
    /**
294
     * Finds a font that matches the one with the supplied attributes
295
     *
296
     * @return the font with the matched attributes or <code>null</code>
297
     * @deprecated POI 3.15 beta 2. Use {@link #findFont(boolean, short, short, String, boolean, boolean, short, byte)} instead.
298
     */
299
    @Deprecated
300
    Font findFont(short boldWeight, short color, short fontHeight, String name, boolean italic, boolean strikeout, short typeOffset, byte underline);
301
    
292
    
302
    /**
293
    /**
303
     * Finds a font that matches the one with the supplied attributes
294
     * Finds a font that matches the one with the supplied attributes
(-)src/ooxml/java/org/apache/poi/xssf/model/StylesTable.java (-21 lines)
Lines 835-861 Link Here
835
        int indexXf = putCellXf(xf);
835
        int indexXf = putCellXf(xf);
836
        return new XSSFCellStyle(indexXf - 1, xfSize - 1, this, theme);
836
        return new XSSFCellStyle(indexXf - 1, xfSize - 1, this, theme);
837
    }
837
    }
838
839
    /**
840
     * Finds a font that matches the one with the supplied attributes
841
     * @deprecated POI 3.15 beta 2. Use {@link #findFont(boolean, short, short, String, boolean, boolean, short, byte)} instead.
842
     */
843
    public XSSFFont findFont(short boldWeight, short color, short fontHeight, String name, boolean italic, boolean strikeout, short typeOffset, byte underline) {
844
        for (XSSFFont font : fonts) {
845
            if (	(font.getBoldweight() == boldWeight)
846
                    && font.getColor() == color
847
                    && font.getFontHeight() == fontHeight
848
                    && font.getFontName().equals(name)
849
                    && font.getItalic() == italic
850
                    && font.getStrikeout() == strikeout
851
                    && font.getTypeOffset() == typeOffset
852
                    && font.getUnderline() == underline)
853
            {
854
                return font;
855
            }
856
        }
857
        return null;
858
    }
859
    
838
    
860
    /**
839
    /**
861
     * Finds a font that matches the one with the supplied attributes
840
     * Finds a font that matches the one with the supplied attributes
(-)src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFCell.java (-13 lines)
Lines 38-49 Link Here
38
import org.apache.poi.ss.util.CellAddress;
38
import org.apache.poi.ss.util.CellAddress;
39
import org.apache.poi.ss.util.CellRangeAddress;
39
import org.apache.poi.ss.util.CellRangeAddress;
40
import org.apache.poi.ss.util.CellReference;
40
import org.apache.poi.ss.util.CellReference;
41
import org.apache.poi.util.Internal;
42
import org.apache.poi.util.LocaleUtil;
41
import org.apache.poi.util.LocaleUtil;
43
import org.apache.poi.util.NotImplemented;
42
import org.apache.poi.util.NotImplemented;
44
import org.apache.poi.util.POILogFactory;
43
import org.apache.poi.util.POILogFactory;
45
import org.apache.poi.util.POILogger;
44
import org.apache.poi.util.POILogger;
46
import org.apache.poi.util.Removal;
47
import org.apache.poi.xssf.usermodel.XSSFHyperlink;
45
import org.apache.poi.xssf.usermodel.XSSFHyperlink;
48
import org.apache.poi.xssf.usermodel.XSSFRichTextString;
46
import org.apache.poi.xssf.usermodel.XSSFRichTextString;
49
47
Lines 58-74 Link Here
58
    private CellStyle _style;
56
    private CellStyle _style;
59
    private Property _firstProperty;
57
    private Property _firstProperty;
60
    
58
    
61
    /**
62
     * @deprecated POI 3.15 beta 3.
63
     * Will be deleted when we make the CellType enum transition. See bug 59791.
64
     */
65
    @Removal(version="3.17")
66
    @Deprecated
67
    public SXSSFCell(SXSSFRow row, int cellType)
68
    {
69
        this(row, CellType.forInt((cellType)));
70
    }
71
72
    public SXSSFCell(SXSSFRow row,CellType cellType)
59
    public SXSSFCell(SXSSFRow row,CellType cellType)
73
    {
60
    {
74
        _row=row;
61
        _row=row;
(-)src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFCreationHelper.java (-10 lines)
Lines 68-84 Link Here
68
    public DataFormat createDataFormat() {
68
    public DataFormat createDataFormat() {
69
        return helper.createDataFormat();
69
        return helper.createDataFormat();
70
    }
70
    }
71
    /**
72
     * {@inheritDoc}
73
     * @deprecated POI 3.15 beta 3. Use {@link #createHyperlink(HyperlinkType)} instead.
74
     */
75
    @Deprecated
76
    @Removal(version="3.17")
77
    @Override
71
    @Override
78
    public Hyperlink createHyperlink(int type) {
79
        return helper.createHyperlink(type);
80
    }
81
    @Override
82
    public Hyperlink createHyperlink(HyperlinkType type) {
72
    public Hyperlink createHyperlink(HyperlinkType type) {
83
        return helper.createHyperlink(type);
73
        return helper.createHyperlink(type);
84
    }
74
    }
(-)src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFRow.java (-13 / +1 lines)
Lines 47-64 Link Here
47
    // use Boolean to have a tri-state for on/off/undefined 
47
    // use Boolean to have a tri-state for on/off/undefined 
48
    private Boolean _hidden = UNDEFINED;
48
    private Boolean _hidden = UNDEFINED;
49
    private Boolean _collapsed = UNDEFINED;
49
    private Boolean _collapsed = UNDEFINED;
50
51
    /**
52
     *
53
     * @param sheet the parent sheet the row belongs to
54
     * @param initialSize - no longer needed
55
     * @deprecated 2015-11-30 (circa POI 3.14beta1). Use {@link #SXSSFRow(SXSSFSheet)} instead.
56
     */
57
    @Deprecated
58
    public SXSSFRow(SXSSFSheet sheet, @SuppressWarnings("UnusedParameters") int initialSize)
59
    {
60
        this(sheet);
61
    }
62
    
50
    
63
    public SXSSFRow(SXSSFSheet sheet)
51
    public SXSSFRow(SXSSFSheet sheet)
64
    {
52
    {
Lines 273-279 Link Here
273
            case CREATE_NULL_AS_BLANK:
261
            case CREATE_NULL_AS_BLANK:
274
                return (cell == null) ? createCell(cellnum, CellType.BLANK) : cell;
262
                return (cell == null) ? createCell(cellnum, CellType.BLANK) : cell;
275
            default:
263
            default:
276
                throw new IllegalArgumentException("Illegal policy " + policy + " (" + policy.id + ")");
264
                throw new IllegalArgumentException("Illegal policy " + policy);
277
        }
265
        }
278
    }
266
    }
279
267
(-)src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFSheet.java (-32 lines)
Lines 47-53 Link Here
47
import org.apache.poi.ss.util.SheetUtil;
47
import org.apache.poi.ss.util.SheetUtil;
48
import org.apache.poi.util.Internal;
48
import org.apache.poi.util.Internal;
49
import org.apache.poi.util.NotImplemented;
49
import org.apache.poi.util.NotImplemented;
50
import org.apache.poi.util.Removal;
51
import org.apache.poi.xssf.usermodel.XSSFColor;
50
import org.apache.poi.xssf.usermodel.XSSFColor;
52
import org.apache.poi.xssf.usermodel.XSSFComment;
51
import org.apache.poi.xssf.usermodel.XSSFComment;
53
import org.apache.poi.xssf.usermodel.XSSFDataValidation;
52
import org.apache.poi.xssf.usermodel.XSSFDataValidation;
Lines 870-892 Link Here
870
    {
869
    {
871
        return _sh.getScenarioProtect();
870
        return _sh.getScenarioProtect();
872
    }
871
    }
873
874
    /**
875
     * Sets the zoom magnification for the sheet.  The zoom is expressed as a
876
     * fraction.  For example to express a zoom of 75% use 3 for the numerator
877
     * and 4 for the denominator.
878
     *
879
     * @param numerator     The numerator for the zoom magnification.
880
     * @param denominator   The denominator for the zoom magnification.
881
     * @deprecated 2015-11-23 (circa POI 3.14beta1). Use {@link #setZoom(int)} instead.
882
     */
883
    @Deprecated
884
    @Removal(version="3.16")
885
    @Override
886
    public void setZoom(int numerator, int denominator)
887
    {
888
        _sh.setZoom(numerator,denominator);
889
    }
890
    
872
    
891
    /**
873
    /**
892
     * Window zoom magnification for current view representing percent values.
874
     * Window zoom magnification for current view representing percent values.
Lines 1630-1649 Link Here
1630
            setColumnWidth(column, width);
1612
            setColumnWidth(column, width);
1631
        }
1613
        }
1632
    }
1614
    }
1633
1634
    /**
1635
     * Returns cell comment for the specified row and column
1636
     *
1637
     * @return cell comment or <code>null</code> if not found
1638
     * @deprecated as of 2015-11-23 (circa POI 3.14beta1). Use {@link #getCellComment(CellAddress)} instead.
1639
     */
1640
    @Deprecated
1641
    @Removal(version="3.16")
1642
    @Override
1643
    public XSSFComment getCellComment(int row, int column)
1644
    {
1645
        return getCellComment(new CellAddress(row, column));
1646
    }
1647
    
1615
    
1648
    /**
1616
    /**
1649
     * Returns cell comment for the specified row and column
1617
     * Returns cell comment for the specified row and column
(-)src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java (-15 lines)
Lines 811-831 Link Here
811
    {
811
    {
812
        return _wb.createFont();
812
        return _wb.createFont();
813
    }
813
    }
814
815
    /**
816
     * Finds a font that matches the one with the supplied attributes
817
     *
818
     * @return the font with the matched attributes or <code>null</code>
819
     * @deprecated POI 3.15 beta 2. Use {@link #findFont(boolean, short, short, String, boolean, boolean, short, byte)} instead.
820
     */
821
    @Deprecated
822
    @Override
823
    @Removal(version="3.17")
824
    public Font findFont(short boldWeight, short color, short fontHeight, String name, boolean italic, boolean strikeout, short typeOffset, byte underline)
825
    {
826
        //noinspection deprecation
827
        return _wb.findFont(boldWeight, color, fontHeight, name, italic, strikeout, typeOffset, underline);
828
    }
829
    
814
    
830
    /**
815
    /**
831
     * Finds a font that matches the one with the supplied attributes
816
     * Finds a font that matches the one with the supplied attributes
(-)src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFClientAnchor.java (-12 lines)
Lines 18-24 Link Here
18
package org.apache.poi.xssf.usermodel;
18
package org.apache.poi.xssf.usermodel;
19
19
20
import org.apache.poi.ss.usermodel.ClientAnchor;
20
import org.apache.poi.ss.usermodel.ClientAnchor;
21
import org.apache.poi.ss.usermodel.Row;
22
import org.apache.poi.util.Internal;
21
import org.apache.poi.util.Internal;
23
import org.apache.poi.util.Removal;
22
import org.apache.poi.util.Removal;
24
import org.apache.poi.util.Units;
23
import org.apache.poi.util.Units;
Lines 412-428 Link Here
412
    {
411
    {
413
        this.anchorType = anchorType;
412
        this.anchorType = anchorType;
414
    }
413
    }
415
    /**
416
     * Sets the anchor type
417
     * @param anchorType the anchor type to set
418
     * @deprecated POI 3.15. Use {@link #setAnchorType(AnchorType)} instead
419
     */
420
    @Removal(version="3.17")
421
    @Override
422
    public void setAnchorType( int anchorType )
423
    {
424
        this.anchorType = AnchorType.byId(anchorType);
425
    }
426
414
427
    /**
415
    /**
428
     * Gets the anchor type
416
     * Gets the anchor type
(-)src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCreationHelper.java (-13 lines)
Lines 55-73 Link Here
55
    public XSSFColor createExtendedColor() {
55
    public XSSFColor createExtendedColor() {
56
        return new XSSFColor(CTColor.Factory.newInstance(), workbook.getStylesSource().getIndexedColors());
56
        return new XSSFColor(CTColor.Factory.newInstance(), workbook.getStylesSource().getIndexedColors());
57
    }
57
    }
58
59
    /**
60
     * Create a new XSSFHyperlink.
61
     *
62
     * @param type - the type of hyperlink to create, see {@link HyperlinkType}
63
     * @deprecated POI 3.15 beta 3. Use {@link #createHyperlink(HyperlinkType)} instead.
64
     */
65
    @Deprecated
66
    @Removal(version="3.17")
67
    @Override
68
    public XSSFHyperlink createHyperlink(int type) {
69
        return new XSSFHyperlink(type);
70
    }
71
    
58
    
72
    /**
59
    /**
73
     * Create a new XSSFHyperlink.
60
     * Create a new XSSFHyperlink.
(-)src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFFont.java (-20 lines)
Lines 306-331 Link Here
306
    }
306
    }
307
307
308
    /**
308
    /**
309
     * @deprecated 3.15 beta 2. Scheduled for removal in 3.17. Use {@link #setBold(boolean)} instead.
310
     */
311
    public void setBoldweight(short boldweight)
312
    {
313
        setBold(boldweight == BOLDWEIGHT_BOLD);
314
    }
315
316
    /**
317
     * get the boldness to use
318
     * @return boldweight
319
     * @see #BOLDWEIGHT_NORMAL
320
     * @see #BOLDWEIGHT_BOLD
321
     * @deprecated 3.15 beta 2. Scheduled for removal in 3.17. Use {@link #getBold} instead.
322
     */
323
    public short getBoldweight()
324
    {
325
        return getBold() ? BOLDWEIGHT_BOLD : BOLDWEIGHT_NORMAL;
326
    }
327
328
    /**
329
     * set character-set to use.
309
     * set character-set to use.
330
     *
310
     *
331
     * @param charset - charset
311
     * @param charset - charset
(-)src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java (-31 lines)
Lines 761-780 Link Here
761
        getPane().setState(STPaneState.SPLIT);
761
        getPane().setState(STPaneState.SPLIT);
762
        getPane().setActivePane(STPane.Enum.forInt(activePane));
762
        getPane().setActivePane(STPane.Enum.forInt(activePane));
763
    }
763
    }
764
765
    /**
766
     * Return cell comment at row, column, if one exists. Otherwise returns null.
767
     * @param row the row where the comment is located
768
     * @param column the column where the comment is located
769
     * @return the cell comment, if one exists. Otherwise return null.
770
     * @deprecated as of 2015-11-23 (circa POI 3.14beta1). Use {@link #getCellComment(CellAddress)} instead.
771
     */
772
    @Deprecated
773
    @Override
774
    @Removal(version="3.16")
775
    public XSSFComment getCellComment(int row, int column) {
776
        return getCellComment(new CellAddress(row, column));
777
    }
778
    
764
    
779
    /**
765
    /**
780
     * Return cell comment at row, column, if one exists. Otherwise returns null.
766
     * Return cell comment at row, column, if one exists. Otherwise returns null.
Lines 2781-2803 Link Here
2781
    }
2767
    }
2782
2768
2783
    /**
2769
    /**
2784
     * Sets the zoom magnification for the sheet.  The zoom is expressed as a
2785
     * fraction.  For example to express a zoom of 75% use 3 for the numerator
2786
     * and 4 for the denominator.
2787
     *
2788
     * @param numerator     The numerator for the zoom magnification.
2789
     * @param denominator   The denominator for the zoom magnification.
2790
     * @deprecated 2015-11-23 (circa POI 3.14beta1). Use {@link #setZoom(int)} instead.
2791
     */
2792
    @Deprecated
2793
    @Removal(version="3.16")
2794
    @Override
2795
    public void setZoom(int numerator, int denominator) {
2796
        int zoom = 100*numerator/denominator;
2797
        setZoom(zoom);
2798
    }
2799
2800
    /**
2801
     * Window zoom magnification for current view representing percent values.
2770
     * Window zoom magnification for current view representing percent values.
2802
     * Valid values range from 10 to 400. Horizontal & Vertical scale together.
2771
     * Valid values range from 10 to 400. Horizontal & Vertical scale together.
2803
     *
2772
     *
(-)src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java (-10 lines)
Lines 901-916 Link Here
901
        sheet.setName(sheetname);
901
        sheet.setName(sheetname);
902
        return sheet;
902
        return sheet;
903
    }
903
    }
904
905
    /**
906
     * Finds a font that matches the one with the supplied attributes
907
     * @deprecated POI 3.15. Use {@link #findFont(boolean, short, short, String, boolean, boolean, short, byte)} instead.
908
     */
909
    @Deprecated
910
    @Override
911
    public XSSFFont findFont(short boldWeight, short color, short fontHeight, String name, boolean italic, boolean strikeout, short typeOffset, byte underline) {
912
        return stylesSource.findFont(boldWeight, color, fontHeight, name, italic, strikeout, typeOffset, underline);
913
    }
914
    
904
    
915
    /**
905
    /**
916
     * Finds a font that matches the one with the supplied attributes
906
     * Finds a font that matches the one with the supplied attributes
(-)src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFChartSheet.java (-2 lines)
Lines 57-64 Link Here
57
        assertEquals(0, sheet.getNumMergedRegions());
57
        assertEquals(0, sheet.getNumMergedRegions());
58
        assertNull(sheet.getActiveCell());
58
        assertNull(sheet.getActiveCell());
59
        assertTrue(sheet.getAutobreaks());
59
        assertTrue(sheet.getAutobreaks());
60
        //noinspection deprecation
61
        assertNull(sheet.getCellComment(0, 0));
62
        assertNull(sheet.getCellComment(new CellAddress(0, 0)));
60
        assertNull(sheet.getCellComment(new CellAddress(0, 0)));
63
        assertEquals(0, sheet.getColumnBreaks().length);
61
        assertEquals(0, sheet.getColumnBreaks().length);
64
        assertTrue(sheet.getRowSumsBelow());
62
        assertTrue(sheet.getRowSumsBelow());
(-)src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFRichTextString.java (-2 / +1 lines)
Lines 385-392 Link Here
385
    public void testLineBreaks_bug48877() throws IOException{
385
    public void testLineBreaks_bug48877() throws IOException{
386
386
387
        XSSFFont font = new XSSFFont();
387
        XSSFFont font = new XSSFFont();
388
        //noinspection deprecation
388
        font.setBold(true);
389
        font.setBoldweight(XSSFFont.BOLDWEIGHT_BOLD);
390
        font.setFontHeightInPoints((short) 14);
389
        font.setFontHeightInPoints((short) 14);
391
        XSSFRichTextString str;
390
        XSSFRichTextString str;
392
        STXstring t1, t2, t3;
391
        STXstring t1, t2, t3;
(-)src/scratchpad/src/org/apache/poi/hssf/converter/ExcelToFoConverter.java (-16 / +2 lines)
Lines 404-426 Link Here
404
    {
404
    {
405
        Triplet triplet = new Triplet();
405
        Triplet triplet = new Triplet();
406
        triplet.fontName = font.getFontName();
406
        triplet.fontName = font.getFontName();
407
        triplet.bold = font.getBold();
408
        triplet.italic = font.getItalic();
407
409
408
        switch ( font.getBoldweight() )
409
        {
410
        case HSSFFont.BOLDWEIGHT_BOLD:
411
            triplet.bold = true;
412
            break;
413
        case HSSFFont.BOLDWEIGHT_NORMAL:
414
        default:
415
            triplet.bold = false;
416
            break;
417
        }
418
419
        if ( font.getItalic() )
420
        {
421
            triplet.italic = true;
422
        }
423
424
        getFontReplacer().update( triplet );
410
        getFontReplacer().update( triplet );
425
        setBlockProperties( blockTarget, triplet );
411
        setBlockProperties( blockTarget, triplet );
426
412
(-)src/scratchpad/src/org/apache/poi/hssf/converter/ExcelToHtmlConverter.java (-7 / +1 lines)
Lines 251-265 Link Here
251
    void buildStyle_font( HSSFWorkbook workbook, StringBuilder style,
251
    void buildStyle_font( HSSFWorkbook workbook, StringBuilder style,
252
            HSSFFont font )
252
            HSSFFont font )
253
    {
253
    {
254
        switch ( font.getBoldweight() )
254
        if ( font.getBold() )
255
        {
255
        {
256
        case HSSFFont.BOLDWEIGHT_BOLD:
257
            style.append( "font-weight:bold;" );
256
            style.append( "font-weight:bold;" );
258
            break;
259
        case HSSFFont.BOLDWEIGHT_NORMAL:
260
            // by default, not not increase HTML size
261
            // style.append( "font-weight: normal; " );
262
            break;
263
        }
257
        }
264
258
265
        final HSSFColor fontColor = workbook.getCustomPalette().getColor(
259
        final HSSFColor fontColor = workbook.getCustomPalette().getColor(
(-)src/testcases/org/apache/poi/hssf/model/TestDrawingShapes.java (-1 / +1 lines)
Lines 154-160 Link Here
154
        anchor.setAnchorType(AnchorType.MOVE_DONT_RESIZE);
154
        anchor.setAnchorType(AnchorType.MOVE_DONT_RESIZE);
155
        assertEquals(AnchorType.MOVE_DONT_RESIZE, anchor.getAnchorType());
155
        assertEquals(AnchorType.MOVE_DONT_RESIZE, anchor.getAnchorType());
156
        //noinspection deprecation
156
        //noinspection deprecation
157
        anchor.setAnchorType(AnchorType.MOVE_DONT_RESIZE.value);
157
        anchor.setAnchorType(AnchorType.MOVE_DONT_RESIZE);
158
        assertEquals(AnchorType.MOVE_DONT_RESIZE, anchor.getAnchorType());
158
        assertEquals(AnchorType.MOVE_DONT_RESIZE, anchor.getAnchorType());
159
159
160
        HSSFSimpleShape rectangle = drawing.createSimpleShape(anchor);
160
        HSSFSimpleShape rectangle = drawing.createSimpleShape(anchor);
(-)src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java (-8 / +7 lines)
Lines 17-22 Link Here
17
17
18
package org.apache.poi.hssf.usermodel;
18
package org.apache.poi.hssf.usermodel;
19
19
20
import static org.apache.poi.POITestCase.assertContains;
20
import static org.junit.Assert.assertEquals;
21
import static org.junit.Assert.assertEquals;
21
import static org.junit.Assert.assertFalse;
22
import static org.junit.Assert.assertFalse;
22
import static org.junit.Assert.assertNotNull;
23
import static org.junit.Assert.assertNotNull;
Lines 24-30 Link Here
24
import static org.junit.Assert.assertSame;
25
import static org.junit.Assert.assertSame;
25
import static org.junit.Assert.assertTrue;
26
import static org.junit.Assert.assertTrue;
26
import static org.junit.Assert.fail;
27
import static org.junit.Assert.fail;
27
import static org.apache.poi.POITestCase.assertContains;
28
28
29
import java.awt.image.BufferedImage;
29
import java.awt.image.BufferedImage;
30
import java.io.ByteArrayInputStream;
30
import java.io.ByteArrayInputStream;
Lines 98-104 Link Here
98
 * <b>YK: If a bug can be tested in terms of common ss interfaces,
98
 * <b>YK: If a bug can be tested in terms of common ss interfaces,
99
 *  define the test in the base class {@link BaseTestBugzillaIssues}</b>
99
 *  define the test in the base class {@link BaseTestBugzillaIssues}</b>
100
 */
100
 */
101
@SuppressWarnings("deprecation")
102
public final class TestBugs extends BaseTestBugzillaIssues {
101
public final class TestBugs extends BaseTestBugzillaIssues {
103
    // to not affect other tests running in the same JVM
102
    // to not affect other tests running in the same JVM
104
    @After
103
    @After
Lines 996-1002 Link Here
996
        assertEquals(4, wb.getNumberOfFonts());
995
        assertEquals(4, wb.getNumberOfFonts());
997
996
998
        HSSFFont f1 = wb.getFontAt((short)0);
997
        HSSFFont f1 = wb.getFontAt((short)0);
999
        assertEquals(400, f1.getBoldweight());
998
        assertFalse(f1.getBold());
1000
999
1001
        // Check that asking for the same font
1000
        // Check that asking for the same font
1002
        //  multiple times gives you the same thing.
1001
        //  multiple times gives you the same thing.
Lines 1020-1026 Link Here
1020
        //  yet to add
1019
        //  yet to add
1021
        assertNull(
1020
        assertNull(
1022
            wb.findFont(
1021
            wb.findFont(
1023
                (short)11, (short)123, (short)22,
1022
                false, (short)123, (short)22,
1024
                "Thingy", false, true, (short)2, (byte)2
1023
                "Thingy", false, true, (short)2, (byte)2
1025
            )
1024
            )
1026
        );
1025
        );
Lines 1031-1037 Link Here
1031
        assertEquals(5, nf.getIndex());
1030
        assertEquals(5, nf.getIndex());
1032
        assertEquals(nf, wb.getFontAt((short)5));
1031
        assertEquals(nf, wb.getFontAt((short)5));
1033
1032
1034
        nf.setBoldweight((short)11);
1033
        nf.setBold(false);
1035
        nf.setColor((short)123);
1034
        nf.setColor((short)123);
1036
        nf.setFontHeight((short)22);
1035
        nf.setFontHeight((short)22);
1037
        nf.setFontName("Thingy");
1036
        nf.setFontName("Thingy");
Lines 1046-1057 Link Here
1046
        // Find it now
1045
        // Find it now
1047
        assertNotNull(
1046
        assertNotNull(
1048
            wb.findFont(
1047
            wb.findFont(
1049
                (short)11, (short)123, (short)22,
1048
                false, (short)123, (short)22,
1050
                "Thingy", false, true, (short)2, (byte)2
1049
                "Thingy", false, true, (short)2, (byte)2
1051
            )
1050
            )
1052
        );
1051
        );
1053
        HSSFFont font = wb.findFont(
1052
        HSSFFont font = wb.findFont(
1054
                (short) 11, (short) 123, (short) 22,
1053
                false, (short) 123, (short) 22,
1055
                "Thingy", false, true, (short) 2, (byte) 2
1054
                "Thingy", false, true, (short) 2, (byte) 2
1056
        );
1055
        );
1057
        assertNotNull(font);
1056
        assertNotNull(font);
Lines 1061-1067 Link Here
1061
        );
1060
        );
1062
        assertEquals(nf,
1061
        assertEquals(nf,
1063
               wb.findFont(
1062
               wb.findFont(
1064
                   (short)11, (short)123, (short)22,
1063
                   false, (short)123, (short)22,
1065
                   "Thingy", false, true, (short)2, (byte)2
1064
                   "Thingy", false, true, (short)2, (byte)2
1066
               )
1065
               )
1067
        );
1066
        );
(-)src/testcases/org/apache/poi/hssf/usermodel/TestCellStyle.java (-1 / +1 lines)
Lines 70-76 Link Here
70
        HSSFCellStyle    cs   = wb.createCellStyle();
70
        HSSFCellStyle    cs   = wb.createCellStyle();
71
71
72
        fnt.setColor(HSSFFont.COLOR_RED);
72
        fnt.setColor(HSSFFont.COLOR_RED);
73
        fnt.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
73
        fnt.setBold(true);
74
        cs.setFont(fnt);
74
        cs.setFont(fnt);
75
        for (int rownum = 0; rownum < 100; rownum++) {
75
        for (int rownum = 0; rownum < 100; rownum++) {
76
            r = s.createRow(rownum);
76
            r = s.createRow(rownum);
(-)src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java (-4 / +8 lines)
Lines 25-31 Link Here
25
import static org.junit.Assert.assertSame;
25
import static org.junit.Assert.assertSame;
26
import static org.junit.Assert.assertTrue;
26
import static org.junit.Assert.assertTrue;
27
import static org.junit.Assert.fail;
27
import static org.junit.Assert.fail;
28
import static org.apache.poi.POITestCase.assertBetween;
29
28
30
import java.io.IOException;
29
import java.io.IOException;
31
import java.util.List;
30
import java.util.List;
Lines 59-65 Link Here
59
import org.apache.poi.hssf.usermodel.RecordInspector.RecordCollector;
58
import org.apache.poi.hssf.usermodel.RecordInspector.RecordCollector;
60
import org.apache.poi.ss.formula.ptg.Area3DPtg;
59
import org.apache.poi.ss.formula.ptg.Area3DPtg;
61
import org.apache.poi.ss.formula.ptg.Ptg;
60
import org.apache.poi.ss.formula.ptg.Ptg;
62
import org.apache.poi.ss.usermodel.*;
61
import org.apache.poi.ss.usermodel.AutoFilter;
62
import org.apache.poi.ss.usermodel.BaseTestSheet;
63
import org.apache.poi.ss.usermodel.DataValidation;
64
import org.apache.poi.ss.usermodel.DataValidationConstraint;
65
import org.apache.poi.ss.usermodel.DataValidationHelper;
66
import org.apache.poi.ss.usermodel.Sheet;
67
import org.apache.poi.ss.usermodel.Workbook;
63
import org.apache.poi.ss.util.CellRangeAddress;
68
import org.apache.poi.ss.util.CellRangeAddress;
64
import org.apache.poi.ss.util.CellRangeAddressList;
69
import org.apache.poi.ss.util.CellRangeAddressList;
65
import org.junit.Test;
70
import org.junit.Test;
Lines 505-511 Link Here
505
        workbook.close();
510
        workbook.close();
506
    }
511
    }
507
512
508
    @SuppressWarnings("deprecation")
509
    @Test
513
    @Test
510
    public void zoom() throws IOException {
514
    public void zoom() throws IOException {
511
        HSSFWorkbook wb = new HSSFWorkbook();
515
        HSSFWorkbook wb = new HSSFWorkbook();
Lines 945-951 Link Here
945
        assertEquals(11*20, bs.getFont(wbSimple).getFontHeight());
949
        assertEquals(11*20, bs.getFont(wbSimple).getFontHeight());
946
        assertEquals(8, bs.getFont(wbSimple).getColor());
950
        assertEquals(8, bs.getFont(wbSimple).getColor());
947
        assertFalse(bs.getFont(wbSimple).getItalic());
951
        assertFalse(bs.getFont(wbSimple).getItalic());
948
        assertEquals(HSSFFont.BOLDWEIGHT_NORMAL, bs.getFont(wbSimple).getBoldweight());
952
        assertFalse(bs.getFont(wbSimple).getBold());
949
953
950
954
951
        HSSFCellStyle cs = wbComplex.getSheetAt(0).getColumnStyle(1);
955
        HSSFCellStyle cs = wbComplex.getSheetAt(0).getColumnStyle(1);
(-)src/testcases/org/apache/poi/hssf/usermodel/TestRowStyle.java (-13 / +17 lines)
Lines 17-27 Link Here
17
        
17
        
18
package org.apache.poi.hssf.usermodel;
18
package org.apache.poi.hssf.usermodel;
19
19
20
import junit.framework.TestCase;
21
22
import org.apache.poi.hssf.HSSFTestDataSamples;
20
import org.apache.poi.hssf.HSSFTestDataSamples;
23
import org.apache.poi.ss.usermodel.BorderStyle;
21
import org.apache.poi.ss.usermodel.BorderStyle;
22
import org.apache.poi.util.IOUtils;
24
23
24
import junit.framework.TestCase;
25
25
/**
26
/**
26
 * Class to test row styling functionality
27
 * Class to test row styling functionality
27
 *
28
 *
Lines 36-42 Link Here
36
     *             Last row, first row is tested against the correct values (99,0).<P>
37
     *             Last row, first row is tested against the correct values (99,0).<P>
37
     * FAILURE:    HSSF does not create a sheet or excepts.  Filesize does not match the known good.
38
     * FAILURE:    HSSF does not create a sheet or excepts.  Filesize does not match the known good.
38
     *             HSSFSheet last row or first row is incorrect.             <P>
39
     *             HSSFSheet last row or first row is incorrect.             <P>
39
     *
40
     */
40
     */
41
    public void testWriteSheetFont() {
41
    public void testWriteSheetFont() {
42
        HSSFWorkbook     wb   = new HSSFWorkbook();
42
        HSSFWorkbook     wb   = new HSSFWorkbook();
Lines 46-52 Link Here
46
        HSSFCellStyle    cs   = wb.createCellStyle();
46
        HSSFCellStyle    cs   = wb.createCellStyle();
47
47
48
        fnt.setColor(HSSFFont.COLOR_RED);
48
        fnt.setColor(HSSFFont.COLOR_RED);
49
        fnt.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
49
        fnt.setBold(true);
50
        cs.setFont(fnt);
50
        cs.setFont(fnt);
51
        for (int rownum = 0; rownum < 100; rownum++)
51
        for (int rownum = 0; rownum < 100; rownum++)
52
        {
52
        {
Lines 54-65 Link Here
54
            r.setRowStyle(cs);
54
            r.setRowStyle(cs);
55
            r.createCell(0);
55
            r.createCell(0);
56
        }
56
        }
57
        wb = HSSFTestDataSamples.writeOutAndReadBack(wb);
57
        HSSFWorkbook wb2 = HSSFTestDataSamples.writeOutAndReadBack(wb);
58
        IOUtils.closeQuietly(wb);
58
        		
59
        		
59
        SanityChecker sanityChecker = new SanityChecker();
60
        SanityChecker sanityChecker = new SanityChecker();
60
        sanityChecker.checkHSSFWorkbook(wb);
61
        sanityChecker.checkHSSFWorkbook(wb2);
61
        assertEquals("LAST ROW == 99", 99, s.getLastRowNum());
62
        assertEquals("LAST ROW == 99", 99, s.getLastRowNum());
62
        assertEquals("FIRST ROW == 0", 0, s.getFirstRowNum());
63
        assertEquals("FIRST ROW == 0", 0, s.getFirstRowNum());
64
        IOUtils.closeQuietly(wb2);
63
    }
65
    }
64
66
65
    /**
67
    /**
Lines 83-96 Link Here
83
        row.setRowStyle(cs);
85
        row.setRowStyle(cs);
84
        row.createCell(0);
86
        row.createCell(0);
85
87
86
        wb = HSSFTestDataSamples.writeOutAndReadBack(wb);
88
        HSSFWorkbook wb2 = HSSFTestDataSamples.writeOutAndReadBack(wb);
89
        IOUtils.closeQuietly(wb);
87
        
90
        
88
        SanityChecker sanityChecker = new SanityChecker();
91
        SanityChecker sanityChecker = new SanityChecker();
89
        sanityChecker.checkHSSFWorkbook(wb);
92
        sanityChecker.checkHSSFWorkbook(wb2);
90
93
91
        assertEquals("LAST ROW ", 1, s.getLastRowNum());
94
        assertEquals("LAST ROW ", 1, s.getLastRowNum());
92
        assertEquals("FIRST ROW ", 0, s.getFirstRowNum());
95
        assertEquals("FIRST ROW ", 0, s.getFirstRowNum());
93
96
        IOUtils.closeQuietly(wb2);
94
    }
97
    }
95
98
96
    /**
99
    /**
Lines 101-107 Link Here
101
     *             Last row, first row is tested against the correct values (99,0).<P>
104
     *             Last row, first row is tested against the correct values (99,0).<P>
102
     * FAILURE:    HSSF does not create a sheet or excepts.  Filesize does not match the known good.
105
     * FAILURE:    HSSF does not create a sheet or excepts.  Filesize does not match the known good.
103
     *             HSSFSheet last row or first row is incorrect.             <P>
106
     *             HSSFSheet last row or first row is incorrect.             <P>
104
     *
105
     */
107
     */
106
    public void testWriteSheetStyle() {
108
    public void testWriteSheetStyle() {
107
        HSSFWorkbook     wb   = new HSSFWorkbook();
109
        HSSFWorkbook     wb   = new HSSFWorkbook();
Lines 135-148 Link Here
135
            r.setRowStyle(cs2);
137
            r.setRowStyle(cs2);
136
            r.createCell(0);
138
            r.createCell(0);
137
        }
139
        }
138
        wb = HSSFTestDataSamples.writeOutAndReadBack(wb);
140
        HSSFWorkbook wb2 = HSSFTestDataSamples.writeOutAndReadBack(wb);
141
        IOUtils.closeQuietly(wb);
139
        
142
        
140
        SanityChecker sanityChecker = new SanityChecker();
143
        SanityChecker sanityChecker = new SanityChecker();
141
        sanityChecker.checkHSSFWorkbook(wb);
144
        sanityChecker.checkHSSFWorkbook(wb2);
142
        assertEquals("LAST ROW == 99", 99, s.getLastRowNum());
145
        assertEquals("LAST ROW == 99", 99, s.getLastRowNum());
143
        assertEquals("FIRST ROW == 0", 0, s.getFirstRowNum());
146
        assertEquals("FIRST ROW == 0", 0, s.getFirstRowNum());
144
        
147
        
145
        s    = wb.getSheetAt(0);
148
        s    = wb2.getSheetAt(0);
146
        assertNotNull("Sheet is not null", s);
149
        assertNotNull("Sheet is not null", s);
147
        
150
        
148
        for (int rownum = 0; rownum < 100; rownum++)
151
        for (int rownum = 0; rownum < 100; rownum++)
Lines 167-171 Link Here
167
            assertEquals("FillForegroundColor for row: ", cs2.getFillForegroundColor(), (short) 0x0);
170
            assertEquals("FillForegroundColor for row: ", cs2.getFillForegroundColor(), (short) 0x0);
168
            assertEquals("FillPattern for row: ", cs2.getFillPattern(), (short) 0x1);
171
            assertEquals("FillPattern for row: ", cs2.getFillPattern(), (short) 0x1);
169
        }
172
        }
173
        IOUtils.closeQuietly(wb2);
170
    }
174
    }
171
}
175
}
(-)src/testcases/org/apache/poi/ss/usermodel/BaseTestFont.java (-12 / +12 lines)
Lines 38-56 Link Here
38
    protected final void baseTestDefaultFont(String defaultName, short defaultSize, short defaultColor) throws IOException {
38
    protected final void baseTestDefaultFont(String defaultName, short defaultSize, short defaultColor) throws IOException {
39
        //get default font and check against default value
39
        //get default font and check against default value
40
        Workbook workbook = _testDataProvider.createWorkbook();
40
        Workbook workbook = _testDataProvider.createWorkbook();
41
        Font fontFind=workbook.findFont(Font.BOLDWEIGHT_NORMAL, defaultColor, defaultSize, defaultName, false, false, Font.SS_NONE, Font.U_NONE);
41
        Font fontFind=workbook.findFont(false, defaultColor, defaultSize, defaultName, false, false, Font.SS_NONE, Font.U_NONE);
42
        assertNotNull(fontFind);
42
        assertNotNull(fontFind);
43
43
44
        //get default font, then change 2 values and check against different values (height changes)
44
        //get default font, then change 2 values and check against different values (height changes)
45
        Font font=workbook.createFont();
45
        Font font=workbook.createFont();
46
        font.setBoldweight(Font.BOLDWEIGHT_BOLD);
46
        font.setBold(true);
47
        assertEquals(Font.BOLDWEIGHT_BOLD, font.getBoldweight());
47
        assertTrue(font.getBold());
48
        font.setUnderline(Font.U_DOUBLE);
48
        font.setUnderline(Font.U_DOUBLE);
49
        assertEquals(Font.U_DOUBLE, font.getUnderline());
49
        assertEquals(Font.U_DOUBLE, font.getUnderline());
50
        font.setFontHeightInPoints((short)15);
50
        font.setFontHeightInPoints((short)15);
51
        assertEquals(15*20, font.getFontHeight());
51
        assertEquals(15*20, font.getFontHeight());
52
        assertEquals(15, font.getFontHeightInPoints());
52
        assertEquals(15, font.getFontHeightInPoints());
53
        fontFind=workbook.findFont(Font.BOLDWEIGHT_BOLD, defaultColor, (short)(15*20), defaultName, false, false, Font.SS_NONE, Font.U_DOUBLE);
53
        fontFind=workbook.findFont(true, defaultColor, (short)(15*20), defaultName, false, false, Font.SS_NONE, Font.U_DOUBLE);
54
        assertNotNull(fontFind);
54
        assertNotNull(fontFind);
55
        workbook.close();
55
        workbook.close();
56
    }
56
    }
Lines 61-67 Link Here
61
        int num0 = wb.getNumberOfFonts();
61
        int num0 = wb.getNumberOfFonts();
62
62
63
        Font f1=wb.createFont();
63
        Font f1=wb.createFont();
64
        f1.setBoldweight(Font.BOLDWEIGHT_BOLD);
64
        f1.setBold(true);
65
        short idx1 = f1.getIndex();
65
        short idx1 = f1.getIndex();
66
        wb.createCellStyle().setFont(f1);
66
        wb.createCellStyle().setFont(f1);
67
67
Lines 76-82 Link Here
76
        wb.createCellStyle().setFont(f3);
76
        wb.createCellStyle().setFont(f3);
77
77
78
        assertEquals(num0 + 3,wb.getNumberOfFonts());
78
        assertEquals(num0 + 3,wb.getNumberOfFonts());
79
        assertEquals(Font.BOLDWEIGHT_BOLD,wb.getFontAt(idx1).getBoldweight());
79
        assertTrue(wb.getFontAt(idx1).getBold());
80
        assertEquals(Font.U_DOUBLE,wb.getFontAt(idx2).getUnderline());
80
        assertEquals(Font.U_DOUBLE,wb.getFontAt(idx2).getUnderline());
81
        assertEquals(23,wb.getFontAt(idx3).getFontHeightInPoints());
81
        assertEquals(23,wb.getFontAt(idx3).getFontHeightInPoints());
82
        wb.close();
82
        wb.close();
Lines 97-103 Link Here
97
        int num0 = wb1.getNumberOfFonts();
97
        int num0 = wb1.getNumberOfFonts();
98
98
99
        Font font=wb1.createFont();
99
        Font font=wb1.createFont();
100
        font.setBoldweight(Font.BOLDWEIGHT_BOLD);
100
        font.setBold(true);
101
        font.setStrikeout(true);
101
        font.setStrikeout(true);
102
        font.setColor(IndexedColors.YELLOW.getIndex());
102
        font.setColor(IndexedColors.YELLOW.getIndex());
103
        font.setFontName("Courier");
103
        font.setFontName("Courier");
Lines 161-167 Link Here
161
161
162
        //default font
162
        //default font
163
        Font f1 = wb.getFontAt((short)0);
163
        Font f1 = wb.getFontAt((short)0);
164
        assertEquals(Font.BOLDWEIGHT_NORMAL, f1.getBoldweight());
164
        assertFalse(f1.getBold());
165
165
166
        // Check that asking for the same font
166
        // Check that asking for the same font
167
        //  multiple times gives you the same thing.
167
        //  multiple times gives you the same thing.
Lines 172-178 Link Here
172
        //  yet to add
172
        //  yet to add
173
        assertNull(
173
        assertNull(
174
            wb.findFont(
174
            wb.findFont(
175
                Font.BOLDWEIGHT_BOLD, (short)123, (short)(22*20),
175
                true, (short)123, (short)(22*20),
176
                "Thingy", false, true, (short)2, (byte)2
176
                "Thingy", false, true, (short)2, (byte)2
177
            )
177
            )
178
        );
178
        );
Lines 183-189 Link Here
183
183
184
        assertSame(nf, wb.getFontAt(nfIdx));
184
        assertSame(nf, wb.getFontAt(nfIdx));
185
185
186
        nf.setBoldweight(Font.BOLDWEIGHT_BOLD);
186
        nf.setBold(true);
187
        nf.setColor((short)123);
187
        nf.setColor((short)123);
188
        nf.setFontHeightInPoints((short)22);
188
        nf.setFontHeightInPoints((short)22);
189
        nf.setFontName("Thingy");
189
        nf.setFontName("Thingy");
Lines 201-213 Link Here
201
        // Find it now
201
        // Find it now
202
        assertNotNull(
202
        assertNotNull(
203
            wb.findFont(
203
            wb.findFont(
204
                Font.BOLDWEIGHT_BOLD, (short)123, (short)(22*20),
204
                true, (short)123, (short)(22*20),
205
                "Thingy", false, true, (short)2, (byte)2
205
                "Thingy", false, true, (short)2, (byte)2
206
            )
206
            )
207
        );
207
        );
208
        assertSame(nf,
208
        assertSame(nf,
209
               wb.findFont(
209
               wb.findFont(
210
                   Font.BOLDWEIGHT_BOLD, (short)123, (short)(22*20),
210
                   true, (short)123, (short)(22*20),
211
                   "Thingy", false, true, (short)2, (byte)2
211
                   "Thingy", false, true, (short)2, (byte)2
212
               )
212
               )
213
        );
213
        );
(-)src/testcases/org/apache/poi/ss/util/NumberComparingSpreadsheetGenerator.java (-1 / +1 lines)
Lines 78-84 Link Here
78
		HSSFRow row = sheet.createRow(0);
78
		HSSFRow row = sheet.createRow(0);
79
		HSSFCellStyle style = wb.createCellStyle();
79
		HSSFCellStyle style = wb.createCellStyle();
80
		HSSFFont font = wb.createFont();
80
		HSSFFont font = wb.createFont();
81
		font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
81
		font.setBold(true);
82
		style.setFont(font);
82
		style.setFont(font);
83
		writeHeaderCell(row, 0, "Raw Long Bits A", style);
83
		writeHeaderCell(row, 0, "Raw Long Bits A", style);
84
		writeHeaderCell(row, 1, "Raw Long Bits B", style);
84
		writeHeaderCell(row, 1, "Raw Long Bits B", style);
(-)src/testcases/org/apache/poi/ss/util/NumberRenderingSpreadsheetGenerator.java (-1 / +1 lines)
Lines 97-103 Link Here
97
		HSSFRow row = sheet.createRow(0);
97
		HSSFRow row = sheet.createRow(0);
98
		HSSFCellStyle style = wb.createCellStyle();
98
		HSSFCellStyle style = wb.createCellStyle();
99
		HSSFFont font = wb.createFont();
99
		HSSFFont font = wb.createFont();
100
		font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
100
		font.setBold(true);
101
		style.setFont(font);
101
		style.setFont(font);
102
		writeHeaderCell(row, 0, "Value", style);
102
		writeHeaderCell(row, 0, "Value", style);
103
		writeHeaderCell(row, 1, "Raw Long Bits", style);
103
		writeHeaderCell(row, 1, "Raw Long Bits", style);

Return to bug 61226