Merge Cells or Split Merged Cells

From Documentation




Purpose

ZK Spreadsheet support merge cells and split merged cells.

ZUML

<zk>
<div height="100%" width="100%" apply="org.zkoss.zssessentials.config.MergeCellComposer">
	<div>
		<button id="mergeCells" label="Merge Cells" mold="trendy"></button>
		<button id="splitMergedCells" label="Split Merged Cells" mold="trendy"></button>
	</div>
	<spreadsheet id="spreadsheet" src="/WEB-INF/excel/config/merge.xlsx"	
				maxrows="200" 
				maxcolumns="40"
				width="100%"
				height="450px"></spreadsheet>
</div>
</zk>

Composer

Merge Cells

Use Range.merge(Boolean)to merge cells.

public void onClick$mergeCells() {
	Ranges.range(spreadsheet.getSelectedSheet(), 
			topRow, 
			leftCol, 
			bottomRow, 
			rightCol).merge(false);
}

Split Merged Cells

public void onClick$splitMergedCells() {
	Ranges.range(spreadsheet.getSelectedSheet(), 
			topRow, 
			leftCol, 
			bottomRow, 
			rightCol).unMerge();
}

Version History

Last Update : 2011/05/23


Version Date Content
     


All source code listed in this book is at Github.


Last Update : 2011/05/23

Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.