我在excel中有多行,其中內容很小,除了最上面一行。 只是爲了在頂行中插入一個大標題,我不希望後續行的寬度受到影響。 有沒有一種方法可以跨越多列的頂行中的內容並且不影響後續行的寬度。JXL Column Span
2
A
回答
2
是的,通過使用WritableSheet.mergeCells方法。
例如:
WritableWorkbook w = Workbook.createWorkbook(outputStream);
WritableSheet s = w.createSheet("MySheet", 0);
int row = 0;
WritableCell titleCell = new Label(0, row, "Hello World");
s.addCell(titleCell);
s.mergeCells(0, row, 13, row);
這具有使第一行是13個單元寬的效果,並且不會影響後續的行的單元寬度。請注意,這將允許您合併行,但這不起作用。正確的方法來改變行高是:
/* Row heights are in 20ths of a point */
int fontPointSize = 16;
int rowHeight = (int) ((1.5d * fontPointSize) * 20);
s.setRowView(row, rowHeight, false);
1
這是可能的,玩弄這個。希望它能幫助你。
int col1 = 0;
int col2 = 2;
int row1 = 0;
int row2 = 0;
WritableWorkbook workbook = Workbook.createWorkbook(outputStream);
WritableSheet sheet = workbook.createSheet("MySheet", 0);
sheet.mergeCells(col1,row1,col2,row2);
//This makes the cell at row1 and col1 span the next two cells
//Write content at the marge cell
sheet.addCell(new Label(col1,row1,"Content here"));
相關問題
- 1. Pentaho中沒有Column Span屬性5.4
- 2. span-x類和blueprint-css中的'column'類有什麼區別?
- 3. JXL中的java.lang.OutOfMemoryError
- 4. Jxl maven error
- 5. 使用JXL庫
- 6. JXL解決#VALUE問題
- 7. jxl API中的疑問?
- 8. 如何使用JXL API
- 9. JXL和時區寫入Excel
- 10. JXL - setRowView什麼都不做
- 11. Excel使用JXL格式化
- 12. 我米不能執行使用JXL
- 13. Breeze謂詞:column = null vs column IS NULL
- 14. Mysql:if else else from one column to another column
- 15. 如何在Mongo中「(WHERE)column = column」?
- 16. mysql SELECT * FROM table WHERE column + space + column LIKE'%query%'
- 17. <span></span>表
- 18. Railscast 274:self [column]?
- 19. TableLayout onClickListener:get Row/Column
- 20. PyTable Column Order
- 21. Bash rows to column
- 22. android table column sizing
- 23. Terik Grid Dropdown Column
- 24. DatabaseError「no such column」
- 25. XHTML Column Padding Bug
- 26. com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException UNKNOWN COLUMN
- 27. jqGrid Column Group
- 28. Equal Column Heights
- 29. CSS table column autowidth
- 30. column not null deferredrable