POI Generate Excel based on multidimensional array


<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core" xmlns:xc="http://www.ibm.com/xsp/custom"
	xmlns:wgpoi="http://www.webgate.biz/xsp/poi">

	<xp:button value="Print cars" id="button1" style="margin-left:50.0px">
		<xp:eventHandler event="onclick" submit="true"
			refreshMode="complete">
			<xp:this.action>
				<wgpoi:generateWorkbook workbookId="listCars"></wgpoi:generateWorkbook>
			</xp:this.action>
		</xp:eventHandler>
	</xp:button>

	<xp:br></xp:br>


	<wgpoi:spreadsheet id="listCars" downloadFileName="listCars.xlsx">

		<wgpoi:this.spreadsheets>
			<wgpoi:table name="Cars">
				<wgpoi:this.exportDefinitions>
					<wgpoi:data2rowExport index="i" startRow="5"
						stepSize="1">
						<wgpoi:this.dataSource>
							<wgpoi:ListObjectDataSource>
								<wgpoi:this.buildValues><![CDATA[#{javascript:var mycars = [["BMW","Z4","2012"],["Mercedes","SLK","2010"],["VW","Passat","2008"]];
return mycars;}]]></wgpoi:this.buildValues>
							</wgpoi:ListObjectDataSource>
						</wgpoi:this.dataSource>
						<wgpoi:this.columns>
							<wgpoi:columnDefinition columnNumber="0"
								rowShift="0">
								<wgpoi:this.computeValue><![CDATA[#{javascript:mycars[i-1][0]}]]></wgpoi:this.computeValue>
							</wgpoi:columnDefinition>
						</wgpoi:this.columns>
						<wgpoi:this.columns>
							<wgpoi:columnDefinition columnNumber="1"
								rowShift="0">
								<wgpoi:this.computeValue><![CDATA[#{javascript:mycars[i-1][1]}]]></wgpoi:this.computeValue>
							</wgpoi:columnDefinition>
						</wgpoi:this.columns>
						<wgpoi:this.columns>
							<wgpoi:columnDefinition columnNumber="2"
								rowShift="0">
								<wgpoi:this.computeValue><![CDATA[#{javascript:mycars[i-1][2]}]]></wgpoi:this.computeValue>
							</wgpoi:columnDefinition>
						</wgpoi:this.columns>
					</wgpoi:data2rowExport>
				</wgpoi:this.exportDefinitions>
			</wgpoi:table>
		</wgpoi:this.spreadsheets>
		<wgpoi:this.templateSource>
			<wgpoi:resourcetemplate fileName="lijst_cars.xlsx"></wgpoi:resourcetemplate>
		</wgpoi:this.templateSource>
	</wgpoi:spreadsheet>

</xp:view>
All code submitted to OpenNTF XSnippets, whether submitted as a "Snippet" or in the body of a Comment, is provided under the Apache License Version 2.0. See Terms of Use for full details.
No comments yetLogin first to comment...