论坛首页 Java企业应用论坛

封装JXL的小工具(一)

浏览 2059 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2008-09-26  
SOA

利用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>

 

论坛首页 Java企业应用版

跳转论坛:
Global site tag (gtag.js) - Google Analytics