封装JXL的小工具(一)

利用XML将Excel的数据表示出来,(类似HTML的Table)然后用JXL解析成Excel,

 

该XML的XSD文件

 

<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
	targetNamespace="http://www.allen.org/jxl"
	xmlns:tns="http://www.allen.org/jxl" elementFormDefault="qualified">
	<complexType name="excel-row">
		<sequence>
			<choice>
				<element name="hcell" type="tns:excel-hcell"
					maxOccurs="unbounded" minOccurs="0">
				</element>
				<element name="cell" type="tns:excel-cell"
					maxOccurs="unbounded" minOccurs="0">
				</element>
			</choice>
		</sequence>
		<attribute name="height" type="int"></attribute>
	</complexType>
	<complexType name="excel-hcell">
		<simpleContent>
			<extension base="string">
				<attribute name="colspan" type="int"></attribute>
				<attribute name="rowspan" type="int"></attribute>
				<attribute name="comment" type="string"></attribute>
				<attribute name="width" type="int"></attribute>
				<attribute name="type" type="string"></attribute>
			</extension>
		</simpleContent>
	</complexType>
	<complexType name="excel-cell">
		<simpleContent>
			<extension base="string">
				<attribute name="colspan" type="int"></attribute>
				<attribute name="rowspan" type="int"></attribute>
				<attribute name="comment" type="string"></attribute>
				<attribute name="cell-format" type="string"></attribute>
			</extension>
		</simpleContent>
	</complexType>
	<complexType name="excel-head">
		<sequence>
			<element name="row" type="tns:excel-row"
				maxOccurs="unbounded" minOccurs="1">
			</element>
		</sequence>
		<attribute name="cell-format" type="string"></attribute>
	</complexType>
	<complexType name="excel-body">
		<sequence>
			<element name="row" type="tns:excel-row"
				maxOccurs="unbounded" minOccurs="1">
			</element>
		</sequence>
		<attribute name="cell-format" type="string"></attribute>
	</complexType>
	<complexType name="excel-foot">
		<sequence>
			<element name="row" type="tns:excel-row"
				maxOccurs="unbounded" minOccurs="1">
			</element>
		</sequence>
		<attribute name="cell-format" type="string"></attribute>
	</complexType>
	<complexType name="excel-title">
		<simpleContent>
			<extension base="string">
				<attribute name="cell-format" type="string"></attribute>
				<attribute name="comment" type="string"></attribute>
				<attribute name="colspan" type="int"></attribute>
				<attribute name="height" type="int"></attribute>
			</extension>
		</simpleContent>
	</complexType>
	<complexType name="cell-format">
		<attribute name="id" type="string"></attribute>

		<attribute name="back-colour" type="string"></attribute>
		<attribute name="fore-colour" type="string"></attribute>
		<attribute name="border-colour" type="string"></attribute>
		<attribute name="border" type="string"></attribute>

		<attribute name="align" type="string"></attribute>
		<attribute name="vertical-align" type="string"></attribute>

		<attribute name="font-name" type="string"></attribute>
		<attribute name="font-size" type="int"></attribute>
		<attribute name="bold" type="boolean"></attribute>
		<attribute name="italic" type="boolean"></attribute>
		<attribute name="under-line" type="string"></attribute>

	</complexType>
	<complexType name="format">
		<sequence>
			<element name="cell-format" type="tns:cell-format"
				maxOccurs="unbounded" minOccurs="1">
			</element>
		</sequence>
	</complexType>
	<complexType name="excel-sheet">
		<sequence>
			<element name="title" type="tns:excel-title" maxOccurs="1"
				minOccurs="0">
			</element>
			<element name="head" type="tns:excel-head" maxOccurs="1"
				minOccurs="1">
			</element>
			<element name="body" type="tns:excel-body" maxOccurs="1"
				minOccurs="0">
			</element>
			<element name="foot" type="tns:excel-foot" maxOccurs="1"
				minOccurs="0">
			</element>
		</sequence>
		<attribute name="name" type="string"></attribute>
		<attribute name="page-width" type="string"></attribute>
	</complexType>
	<complexType name="excel">
		<sequence>
			<element name="format" type="tns:format" maxOccurs="1"
				minOccurs="0">
			</element>
			<element name="sheet" type="tns:excel-sheet"
				maxOccurs="unbounded" minOccurs="1">
			</element>
		</sequence>
	</complexType>
</schema>

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值