Skip to content

Commit a9592c8

Browse files
Excel program test
1 parent add384f commit a9592c8

File tree

2 files changed

+22
-5
lines changed

2 files changed

+22
-5
lines changed

output.xls

0 Bytes
Binary file not shown.

src/com/shohagh/java/Misc/JExcelAPIDemo.java

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,22 @@
66
import jxl.Cell;
77
import jxl.Sheet;
88
import jxl.Workbook;
9-
9+
import jxl.biff.FontRecord;
10+
import jxl.biff.drawing.ComboBox;
11+
import jxl.format.Alignment;
12+
import jxl.format.Border;
13+
import jxl.format.BorderLineStyle;
14+
import jxl.format.CellFormat;
15+
import jxl.format.Colour;
16+
import jxl.format.Font;
17+
import jxl.format.Format;
18+
import jxl.format.Orientation;
19+
import jxl.format.Pattern;
20+
import jxl.format.VerticalAlignment;
1021
import jxl.read.biff.BiffException;
11-
1222
import jxl.write.Label;
1323
import jxl.write.Number;
24+
import jxl.write.WritableCellFeatures;
1425
import jxl.write.WritableSheet;
1526
import jxl.write.WritableWorkbook;
1627
import jxl.write.WriteException;
@@ -27,19 +38,25 @@ public static void main(String[] args) throws BiffException, IOException,
2738
WritableWorkbook wworkbook = Workbook.createWorkbook(new File(
2839
"output.xls"));
2940
WritableSheet wsheet = wworkbook.createSheet("First Sheet", 0);
30-
Label label = new Label(0, 2, "A label record");
41+
Label label = new Label(0, 1, "A label record");
42+
label.setCellFeatures(new WritableCellFeatures());
43+
label.getWritableCellFeatures().setComment("Test comment");
44+
label.getWritableCellFeatures().setComboBox(new ComboBox());
3145
wsheet.addCell(label);
46+
wsheet.addCell(new Label(3,1, "PI"));
3247
Number number = new Number(3, 4, 3.1459);
3348
wsheet.addCell(number);
3449
wworkbook.write();
3550
wworkbook.close();
3651

3752
Workbook workbook = Workbook.getWorkbook(new File("output.xls"));
3853
Sheet sheet = workbook.getSheet(0);
39-
Cell cell1 = sheet.getCell(0, 2);
54+
Cell cell1 = sheet.getCell(0, 1);
4055
System.out.println(cell1.getContents());
41-
Cell cell2 = sheet.getCell(3, 4);
56+
Cell cell2 = sheet.getCell(3,1);
57+
Cell cell3 = sheet.getCell(3, 4);
4258
System.out.println(cell2.getContents());
59+
System.out.println(cell3.getContents());
4360
workbook.close();
4461
}
4562
}

0 commit comments

Comments
 (0)