@@ -211,10 +211,14 @@ void font() throws Exception {
211
211
String bold = "Bold" ;
212
212
String italic = "Italic" ;
213
213
String underlined = "Underlined" ;
214
+ String strikethrough = "Strikethrough" ;
214
215
String bold_italic = "Bold_italic" ;
215
216
String bold_underlined = "Bold_underlined" ;
217
+ String bold_strikethrough = "Bold_strikethrough" ;
216
218
String italic_underlinded = "Italic_underlined" ;
217
- String all_three = "All_three" ;
219
+ String italic_strikethrough = "Italic_strikethrough" ;
220
+ String underlined_strikethrough = "Underlined_strikethrough" ;
221
+ String all_four = "All_four" ;
218
222
byte [] data = writeWorkbook (wb -> {
219
223
Worksheet ws = wb .newWorksheet (sheetName );
220
224
ws .value (0 , 0 , bold );
@@ -223,14 +227,22 @@ void font() throws Exception {
223
227
ws .style (0 , 1 ).italic ().set ();
224
228
ws .value (0 , 2 , underlined );
225
229
ws .style (0 , 2 ).underlined ().set ();
226
- ws .value (0 , 3 , bold_italic );
227
- ws .style (0 , 3 ).bold ().italic ().set ();
228
- ws .value (0 , 4 , bold_underlined );
229
- ws .style (0 , 4 ).bold ().underlined ().set ();
230
- ws .value (0 , 5 , italic_underlinded );
231
- ws .style (0 , 5 ).italic ().underlined ().set ();
232
- ws .value (0 , 6 , all_three );
233
- ws .style (0 , 6 ).bold ().italic ().underlined ().set ();
230
+ ws .value (0 , 3 , strikethrough );
231
+ ws .style (0 , 3 ).strikethrough ().set ();
232
+ ws .value (0 , 4 , bold_italic );
233
+ ws .style (0 , 4 ).bold ().italic ().set ();
234
+ ws .value (0 , 5 , bold_underlined );
235
+ ws .style (0 , 5 ).bold ().underlined ().set ();
236
+ ws .value (0 , 6 , bold_strikethrough );
237
+ ws .style (0 , 6 ).bold ().strikethrough ().set ();
238
+ ws .value (0 , 7 , italic_underlinded );
239
+ ws .style (0 , 7 ).italic ().underlined ().set ();
240
+ ws .value (0 , 8 , italic_strikethrough );
241
+ ws .style (0 , 8 ).italic ().strikethrough ().set ();
242
+ ws .value (0 , 9 , underlined_strikethrough );
243
+ ws .style (0 , 9 ).underlined ().strikethrough ().set ();
244
+ ws .value (0 , 10 , all_four );
245
+ ws .style (0 , 10 ).bold ().italic ().underlined ().strikethrough ().set ();
234
246
try {
235
247
ws .close ();
236
248
} catch (IOException ex ) {
@@ -244,15 +256,26 @@ void font() throws Exception {
244
256
assertTrue (xws .getRow (0 ).getCell (0 ).getCellStyle ().getFont ().getBold ());
245
257
assertTrue (xws .getRow (0 ).getCell (1 ).getCellStyle ().getFont ().getItalic ());
246
258
assertEquals (FontUnderline .valueOf (xws .getRow (0 ).getCell (2 ).getCellStyle ().getFont ().getUnderline ()), FontUnderline .SINGLE );
247
- assertTrue (xws .getRow (0 ).getCell (3 ).getCellStyle ().getFont ().getBold ());
248
- assertTrue ( xws . getRow ( 0 ). getCell ( 3 ). getCellStyle (). getFont (). getItalic ());
259
+ assertTrue (xws .getRow (0 ).getCell (3 ).getCellStyle ().getFont ().getStrikeout ());
260
+
249
261
assertTrue (xws .getRow (0 ).getCell (4 ).getCellStyle ().getFont ().getBold ());
250
- assertEquals ( FontUnderline . valueOf ( xws .getRow (0 ).getCell (4 ).getCellStyle ().getFont ().getUnderline ()), FontUnderline . SINGLE );
251
- assertTrue (xws .getRow (0 ).getCell (5 ).getCellStyle ().getFont ().getItalic ());
262
+ assertTrue ( xws .getRow (0 ).getCell (4 ).getCellStyle ().getFont ().getItalic () );
263
+ assertTrue (xws .getRow (0 ).getCell (5 ).getCellStyle ().getFont ().getBold ());
252
264
assertEquals (FontUnderline .valueOf (xws .getRow (0 ).getCell (5 ).getCellStyle ().getFont ().getUnderline ()), FontUnderline .SINGLE );
253
265
assertTrue (xws .getRow (0 ).getCell (6 ).getCellStyle ().getFont ().getBold ());
254
- assertTrue (xws .getRow (0 ).getCell (6 ).getCellStyle ().getFont ().getItalic ());
255
- assertEquals (FontUnderline .valueOf (xws .getRow (0 ).getCell (6 ).getCellStyle ().getFont ().getUnderline ()), FontUnderline .SINGLE );
266
+ assertTrue (xws .getRow (0 ).getCell (6 ).getCellStyle ().getFont ().getStrikeout ());
267
+ assertTrue (xws .getRow (0 ).getCell (7 ).getCellStyle ().getFont ().getItalic ());
268
+ assertEquals (FontUnderline .valueOf (xws .getRow (0 ).getCell (7 ).getCellStyle ().getFont ().getUnderline ()), FontUnderline .SINGLE );
269
+ assertTrue (xws .getRow (0 ).getCell (8 ).getCellStyle ().getFont ().getItalic ());
270
+ assertTrue (xws .getRow (0 ).getCell (8 ).getCellStyle ().getFont ().getStrikeout ());
271
+ assertEquals (FontUnderline .valueOf (xws .getRow (0 ).getCell (9 ).getCellStyle ().getFont ().getUnderline ()), FontUnderline .SINGLE );
272
+ assertTrue (xws .getRow (0 ).getCell (9 ).getCellStyle ().getFont ().getStrikeout ());
273
+
274
+ assertTrue (xws .getRow (0 ).getCell (10 ).getCellStyle ().getFont ().getBold ());
275
+ assertTrue (xws .getRow (0 ).getCell (10 ).getCellStyle ().getFont ().getItalic ());
276
+ assertEquals (FontUnderline .valueOf (xws .getRow (0 ).getCell (10 ).getCellStyle ().getFont ().getUnderline ()), FontUnderline .SINGLE );
277
+ assertTrue (xws .getRow (0 ).getCell (10 ).getCellStyle ().getFont ().getStrikeout ());
278
+
256
279
}
257
280
258
281
@ Test
@@ -664,7 +687,7 @@ void hasValidNamedRange() throws Exception {
664
687
// Fetch the XSSF Name object
665
688
XSSFName name = xwb .getName ("col names" );
666
689
String formula = name .getRefersToFormula ();
667
-
690
+
668
691
assertTrue (name != null );
669
692
assertTrue (name .getNameName ().equals ("col names" ));
670
693
assertTrue (formula .equals ("'Worksheet 1'!$A$1:$D$2" ));
@@ -688,7 +711,7 @@ void hasValidCellConditionalFormatting() throws Exception {
688
711
XSSFConditionalFormattingRule condFmtRule = condFmt .getRule (0 );
689
712
int numRanges = condFmt .getFormattingRanges ().length ;
690
713
CellRangeAddress cellRange = condFmt .getFormattingRanges ()[0 ];
691
-
714
+
692
715
assertTrue (numCondFmts == 1 );
693
716
assertTrue (numRules == 1 );
694
717
assertTrue (numRanges == 1 );
@@ -715,7 +738,7 @@ void hasValidRangeConditionalFormatting() throws Exception {
715
738
XSSFConditionalFormattingRule condFmtRule = condFmt .getRule (0 );
716
739
int numRanges = condFmt .getFormattingRanges ().length ;
717
740
CellRangeAddress cellRange = condFmt .getFormattingRanges ()[0 ];
718
-
741
+
719
742
assertTrue (numCondFmts == 1 );
720
743
assertTrue (numRules == 1 );
721
744
assertTrue (numRanges == 1 );
0 commit comments