Compare commits
138 Commits
master
...
REL_2_BRAN
Author | SHA1 | Date | |
---|---|---|---|
![]() |
4a5e8af681 | ||
![]() |
887cd07539 | ||
![]() |
8543b622bf | ||
![]() |
53dd0cd17f | ||
![]() |
2d14d89545 | ||
![]() |
95f5211037 | ||
![]() |
2943c5a8e5 | ||
![]() |
6a753e13ea | ||
![]() |
54082fe268 | ||
![]() |
6ab34bac0b | ||
![]() |
8a2f845479 | ||
![]() |
2090d7dcab | ||
![]() |
b147d06b0d | ||
![]() |
4718592e15 | ||
![]() |
5654132e26 | ||
![]() |
067b28832e | ||
![]() |
6a505d09ad | ||
![]() |
486f0a474b | ||
![]() |
e46cc85c16 | ||
![]() |
a5853ca9c7 | ||
![]() |
374943eb93 | ||
![]() |
c96db64e3c | ||
![]() |
ddfb52a7f5 | ||
![]() |
c637706e40 | ||
![]() |
edbcecf4f5 | ||
![]() |
e2e370f744 | ||
![]() |
ac84378cca | ||
![]() |
c1b68ffffb | ||
![]() |
72e833700e | ||
![]() |
4401c16af6 | ||
![]() |
f524f28579 | ||
![]() |
4b20a61ad7 | ||
![]() |
ed9f2b0bac | ||
![]() |
8e27ed87eb | ||
![]() |
9ef45e5f61 | ||
![]() |
3df231642a | ||
![]() |
104093d45e | ||
![]() |
bad7b56f31 | ||
![]() |
bf326c25a0 | ||
![]() |
34e230f63e | ||
![]() |
8b828464ad | ||
![]() |
9afbac9087 | ||
![]() |
cee500a14b | ||
![]() |
c966975782 | ||
![]() |
d7c485af78 | ||
![]() |
040db04a7b | ||
![]() |
8d576a6466 | ||
![]() |
a297ae284c | ||
![]() |
b676e6b839 | ||
![]() |
8f2873784c | ||
![]() |
3a93a6d467 | ||
![]() |
6502a1a361 | ||
![]() |
b08a252916 | ||
![]() |
23a825f060 | ||
![]() |
8fcb89ec40 | ||
![]() |
e34df401fc | ||
![]() |
086c2187ec | ||
![]() |
ca17fa88b8 | ||
![]() |
3769595bfb | ||
![]() |
f23535d9f5 | ||
![]() |
d6fac7a361 | ||
![]() |
d988eb7bd2 | ||
![]() |
2de64d96e5 | ||
![]() |
a26c21dbcc | ||
![]() |
d193c7c1a4 | ||
![]() |
fcd6ef1334 | ||
![]() |
1787340889 | ||
![]() |
fe417c02ba | ||
![]() |
ea54575258 | ||
![]() |
242817389a | ||
![]() |
1736810bb7 | ||
![]() |
351a6859f5 | ||
![]() |
2ef26b5ff5 | ||
![]() |
269a7434d0 | ||
![]() |
aec407bceb | ||
![]() |
926262df8d | ||
![]() |
db23532059 | ||
![]() |
fd2cc4b7d1 | ||
![]() |
153364c993 | ||
![]() |
8d5e50f113 | ||
![]() |
f6c184fcff | ||
![]() |
4093d1a2c3 | ||
![]() |
62a5ad3c80 | ||
![]() |
4aee13442d | ||
![]() |
1afc8c1cb4 | ||
![]() |
70a2698295 | ||
![]() |
f120f93536 | ||
![]() |
2b241e6823 | ||
![]() |
4cd31ff316 | ||
![]() |
e533ca4d75 | ||
![]() |
e57ffd3bf5 | ||
![]() |
3e26a5403a | ||
![]() |
a1b3efa614 | ||
![]() |
2ad62ccff7 | ||
![]() |
e1c8093b7a | ||
![]() |
9f0fb6e148 | ||
![]() |
68b2ea323f | ||
![]() |
e035d3ecfd | ||
![]() |
02eaa94535 | ||
![]() |
250442a0a2 | ||
![]() |
f4d8913964 | ||
![]() |
b14f2927bf | ||
![]() |
4d6ffc7b93 | ||
![]() |
4d9102eee3 | ||
![]() |
71060cc5c7 | ||
![]() |
6e37d3327e | ||
![]() |
abe41db286 | ||
![]() |
b6967b691a | ||
![]() |
466f9aa1d3 | ||
![]() |
1214a0004c | ||
![]() |
abd6068a14 | ||
![]() |
c3e8016fcf | ||
![]() |
fd7e42b9d3 | ||
![]() |
f719da9ca8 | ||
![]() |
4a12af1b72 | ||
![]() |
7be98ee10c | ||
![]() |
181ff7fb54 | ||
![]() |
c472df8fd1 | ||
![]() |
a67d868825 | ||
![]() |
ff5c232ffb | ||
![]() |
230c71eae7 | ||
![]() |
9dcb5587ea | ||
![]() |
a6e14b5490 | ||
![]() |
c7f251cdca | ||
![]() |
1b39aeae22 | ||
![]() |
97cdd24242 | ||
![]() |
9c9b3a6094 | ||
![]() |
f66a003844 | ||
![]() |
b0e436a71e | ||
![]() |
07bc7cde0f | ||
![]() |
063c2cc756 | ||
![]() |
17e488c73b | ||
![]() |
c8b99afcae | ||
![]() |
b2bd33c3bf | ||
![]() |
0e21588438 | ||
![]() |
4c6dedf2fb | ||
![]() |
1439f944e8 | ||
![]() |
406efda1ed |
42
.ci/Jenkinsfile
vendored
42
.ci/Jenkinsfile
vendored
@ -1,42 +0,0 @@
|
||||
properties(
|
||||
[
|
||||
disableConcurrentBuilds()
|
||||
]
|
||||
)
|
||||
|
||||
node('linux && docker') {
|
||||
try {
|
||||
stage('Checkout') {
|
||||
//branch name from Jenkins environment variables
|
||||
echo "My branch is: ${env.BRANCH_NAME}"
|
||||
|
||||
// this doesn't grab tags pointing to this branch
|
||||
//checkout scm
|
||||
// this hack does... https://issues.jenkins.io/browse/JENKINS-45164
|
||||
checkout([
|
||||
$class: 'GitSCM',
|
||||
branches: [[name: 'refs/heads/'+env.BRANCH_NAME]],
|
||||
extensions: [[$class: 'CloneOption', noTags: false, shallow: false, depth: 0, reference: '']],
|
||||
userRemoteConfigs: scm.userRemoteConfigs,
|
||||
])
|
||||
sh '''
|
||||
set -euxo pipefail
|
||||
git checkout "$BRANCH_NAME" --
|
||||
git reset --hard "origin/$BRANCH_NAME"
|
||||
'''
|
||||
}
|
||||
|
||||
stage('Build + Deploy') {
|
||||
sh 'curl --compressed -sL https://code.moparisthebest.com/moparisthebest/self-ci/raw/branch/master/build-ci.sh | bash'
|
||||
}
|
||||
|
||||
currentBuild.result = 'SUCCESS'
|
||||
} catch (Exception err) {
|
||||
currentBuild.result = 'FAILURE'
|
||||
} finally {
|
||||
stage('Email') {
|
||||
step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: 'admin.jenkins@moparisthebest.com', sendToIndividuals: true])
|
||||
}
|
||||
deleteDir()
|
||||
}
|
||||
}
|
36
.ci/build.sh
36
.ci/build.sh
@ -1,36 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -euxo pipefail
|
||||
|
||||
# Java 14+ java.lang.Record is ambiguous with hssf.Record :'(
|
||||
[ $JAVA_VERSION -lt 7 -o $JAVA_VERSION -gt 13 ] && echo "build does not support JAVA_VERSION: $JAVA_VERSION" && exit 0
|
||||
|
||||
echo "starting build for JAVA_VERSION: $JAVA_VERSION"
|
||||
|
||||
# grab all deps with java 8
|
||||
[ $JAVA_VERSION -eq 7 ] && run-java 8 mvn dependency:go-offline
|
||||
|
||||
# install deps
|
||||
mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V
|
||||
|
||||
if [ $JAVA_VERSION -lt 12 ]
|
||||
then
|
||||
# clean and test
|
||||
mvn clean test -B
|
||||
else
|
||||
# clean and test
|
||||
mvn clean test -B -Djava.version=7 # java12+ minimum target is 7, not 6
|
||||
fi
|
||||
|
||||
# publish only from java 6 and master branch
|
||||
if [ "$BRANCH_NAME" == "master" -a $JAVA_VERSION -eq 7 ]
|
||||
then
|
||||
echo 'deploying to maven'
|
||||
# java 7 cannot do modern SSL, use java 8 to deploy
|
||||
run-java 8 mvn deploy -Dmaven.test.skip=true -B
|
||||
|
||||
mkdir -p release
|
||||
find -type f -name '*.jar' -print0 | xargs -0n1 -I {} mv '{}' 'release/'
|
||||
fi
|
||||
|
||||
echo 'build success!'
|
||||
exit 0
|
13
.cvsignore
Normal file
13
.cvsignore
Normal file
@ -0,0 +1,13 @@
|
||||
dist
|
||||
build
|
||||
scripts
|
||||
*.el
|
||||
*.ipr
|
||||
*.iws
|
||||
*.iml
|
||||
build.number
|
||||
log*.*
|
||||
*.log
|
||||
.clover
|
||||
.classpath
|
||||
.project
|
22
.gitignore
vendored
22
.gitignore
vendored
@ -1,22 +0,0 @@
|
||||
classes
|
||||
workbook.xls
|
||||
bak
|
||||
*.iws
|
||||
build.number
|
||||
*.el
|
||||
TEST-org.apache.poi*.xml
|
||||
build
|
||||
.settings
|
||||
scripts
|
||||
*.ipr
|
||||
untitled1.jpx
|
||||
*.iml
|
||||
log*.*
|
||||
dist
|
||||
*.log
|
||||
bin
|
||||
.ant-targets-build.xml
|
||||
out
|
||||
.idea
|
||||
.gradle
|
||||
target
|
29
KEYS
Normal file
29
KEYS
Normal file
@ -0,0 +1,29 @@
|
||||
pub 1024D/12DAE9BE 2004-01-25 Glen Stampoultzis <glens@apache.org>
|
||||
sig 3 12DAE9BE 2004-01-25 Glen Stampoultzis <glens@apache.org>
|
||||
sub 1024g/2BBB28EA 2004-01-25
|
||||
sig 12DAE9BE 2004-01-25 Glen Stampoultzis <glens@apache.org>
|
||||
|
||||
-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||
Version: GnuPG v1.2.2 (Cygwin)
|
||||
|
||||
mQGiBEATU6gRBACo3iUkfku4/G2q8ldWFiiCekHK5oqx0U1N6fyO+Xgs+6V6btEZ
|
||||
drF2DUCyto6ig4FJT81L34HUQ6l9bPnpa4nNsl2EMBknY42LjmC55x7Q5rsQbiRj
|
||||
+2JkoQJk2Jc3hneuh4Wsv49stOCDQMOV5BtjZs31t7rr+wuKPMkIw/Nf1wCgngI9
|
||||
ZWFyLxspoi9bL1/xBID18jsD/RxGBep4F8HwXEdHTeHnmjEuJSlYhmAKQ6Fd7bdb
|
||||
ex16a54Gsg7fVD0rIIsytzVUACQMi7V6tmE4Wf/XaY7+ma5w4gCsxUCIeujU4Y7i
|
||||
WUDwtlTkr2IudmoxSIDDpS12NPZqCP7PbU2RK+KwnnITjs80a+QlHYaO9te7HVcL
|
||||
F6YIA/9YZkYp5TpoMO1ISnlv0gXMcIaznbNMoRgeXZHvYyEvy014jArHmG41LVBj
|
||||
6TnBHFLQi4xA7Ql98oIgfszaRr/9GshvoL6Iu1x1SoV7dMrqFBC6e2JD9N/IgBtZ
|
||||
EGg7US3nIJnlCjJSIkXKfPJL4FyYWwt6IEZcF6Mi/USsyLA6wrQkR2xlbiBTdGFt
|
||||
cG91bHR6aXMgPGdsZW5zQGFwYWNoZS5vcmc+iFsEExECABsFAkATU6gGCwkIBwMC
|
||||
AxUCAwMWAgECHgECF4AACgkQONrI4hLa6b48RgCaAqQg0wtiOQ8jqX6S7tZi1OMg
|
||||
CQAAn2Ty1d/UdGLqlGkCPMkaB6otTMhZuQENBEATU6kQBADUbn5pT2D8vi64RU5E
|
||||
SeTn/rNzLglJ4nzoOfeIcHm7p3hppjT0Q1YbHvdOSaigYApzxoiSf+0Mt8NSCfDf
|
||||
B/wjfndHlrcdPkiJi4fBkQHihcuJtEgOkAwXfSJ+MUXG+fEgEuGdYm7tNV3n/eOY
|
||||
gn9Vzs/LofrQ7nY3+WkNOUia/wADBwQAnqZ4wPm0VY/fjCWJ34wvSfPk6Qg8m502
|
||||
MfHIGY/UZ+BY5DK3iQR8hrIu6FU0tn0qoF7PCNehOtd2cR9kA7I2gyfaVR8JY2Ek
|
||||
F18jungrNRrNuNx3rJeUD6ViQjC44K4vf6y8CkxmkHTmB9ZC2+uGdMeOdDvbck/u
|
||||
JA+XB2tykJWIRgQYEQIABgUCQBNTqQAKCRA42sjiEtrpvpy3AJ4trdVLGCzJwB2R
|
||||
Z/zxD3xBnTdY5QCeNUdw2VcsrzAF541sawFRxOmL3eY=
|
||||
=la1N
|
||||
-----END PGP PUBLIC KEY BLOCK-----
|
201
LICENSE
Normal file
201
LICENSE
Normal file
@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
3
NOTICE
Normal file
3
NOTICE
Normal file
@ -0,0 +1,3 @@
|
||||
This product includes software developed by
|
||||
The Apache Software Foundation (http://www.apache.org/).
|
||||
|
24
README.md
24
README.md
@ -1,24 +0,0 @@
|
||||
POI Fast Calc
|
||||
======================
|
||||
|
||||
[](https://ci.moparisthe.best/job/moparisthebest/job/poi/job/master/)
|
||||
|
||||
A Java library to calculate Excel formulas quickly.
|
||||
|
||||
This is a fork of [Apache POI](https://poi.apache.org/) version [3.16](https://github.com/apache/poi/tree/REL_3_16_FINAL)
|
||||
that serves simply to calculate formulas quickly, it supports XLSX (Excel 2007) row/column limits in the HSSF engine for
|
||||
much faster evaluation than XML-backed XSSF is capable of, with the drawback that it can't read or write XLS/XLSX files
|
||||
from or to disk. Read the [email thread](https://lists.apache.org/thread.html/0bc90a3ed386edddfcb9b93ce6c262ad145a6b0433d0fcfe70ef10a2@%3Cdev.poi.apache.org%3E)
|
||||
with my original proposed patch to upstream poi for background.
|
||||
|
||||
To use, add this to your maven pom.xml:
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>com.moparisthebest.poi</groupId>
|
||||
<artifactId>poi-fast-calc</artifactId>
|
||||
<version>3.16-SNAPSHOT</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
The `org.apache.poi` package has been renamed `com.moparisthebest.poi` and all dependencies removed,
|
||||
so this can cleanly live aside modern/newer upstream poi forever, and shouldn't ever need to change.
|
653
build.xml
Normal file
653
build.xml
Normal file
@ -0,0 +1,653 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- Copyright (C) 2004 The Apache Software Foundation. All rights reserved. -->
|
||||
|
||||
<!--
|
||||
POI Build System. Written by:
|
||||
|
||||
Glen Stampoultzis glens at apache.org
|
||||
|
||||
|
||||
This build was tested with ant 1.5.3 although it will probably work with
|
||||
other versions. The following jar files should be installed
|
||||
into the ant lib directory:
|
||||
|
||||
LIBRARY LOCATION
|
||||
======= ========
|
||||
junit(3.8+) http://www.ibiblio.org/maven/junit/jars/
|
||||
xerces http://www.ibiblio.org/maven/xerces/jars/
|
||||
jdepend http://www.ibiblio.org/maven/jdepend/jars/
|
||||
xalan http://www.ibiblio.org/maven/xalan/jars/
|
||||
|
||||
The ant jar "optional.jar" should also be available otherwise the
|
||||
build will fail.
|
||||
|
||||
To build the documentation you will need to install forrest and set
|
||||
the FORREST_HOME environment variable.
|
||||
|
||||
|
||||
TO BE COMPLETED:
|
||||
|
||||
Convert book.xml files to a sitemap.
|
||||
|
||||
-->
|
||||
<project name="POI Build" default="compile" basedir=".">
|
||||
|
||||
<description>
|
||||
The POI project Ant build.
|
||||
</description>
|
||||
|
||||
<property environment="env"/>
|
||||
|
||||
<property name="repository" value="http://www.ibiblio.org/maven"/>
|
||||
<property name="forrest.home" value="${env.FORREST_HOME}"/>
|
||||
|
||||
<property name="main.src" value="src/java"/>
|
||||
<property name="main.src.test" value="src/testcases"/>
|
||||
<property name="main.documentation" value="src/documentation"/>
|
||||
<property name="main.output.dir" value="build/classes"/>
|
||||
<property name="main.output.test.dir" value="build/test-classes"/>
|
||||
<property name="main.lib" value="lib"/>
|
||||
<property name="main.reports.test" value="build/test-results"/>
|
||||
<property name="main.jar1.dir" value="${main.lib}/commons-logging-1.0.1.jar"/>
|
||||
<property name="main.jar1.url" value="${repository}/commons-logging/jars/commons-logging-1.0.1.jar"/>
|
||||
<property name="main.jar2.dir" value="${main.lib}/log4j-1.2.8.jar"/>
|
||||
<property name="main.jar2.url" value="${repository}/log4j/jars/log4j-1.2.8.jar"/>
|
||||
<property name="main.testokfile" value="build/main-testokfile.txt"/>
|
||||
<property name="scratchpad.src" value="src/scratchpad/src"/>
|
||||
<property name="scratchpad.src.test" value="src/scratchpad/testcases"/>
|
||||
<property name="scratchpad.lib" value="src/scratchpad/lib"/>
|
||||
<property name="scratchpad.reports.test" value="build/scratchpad-test-results"/>
|
||||
<property name="scratchpad.output.dir" value="build/scratchpad-classes"/>
|
||||
<property name="scratchpad.output.test.dir" value="build/scratchpad-test-classes"/>
|
||||
<property name="scratchpad.testokfile" value="build/scratchpad-testokfile.txt"/>
|
||||
<property name="contrib.src" value="src/contrib/src"/>
|
||||
<property name="contrib.src.test" value="src/contrib/testcases"/>
|
||||
<property name="contrib.lib" value="src/contrib/lib"/>
|
||||
<property name="contrib.reports.test" value="build/contrib-test-results"/>
|
||||
<property name="contrib.output.dir" value="build/contrib-classes"/>
|
||||
<property name="contrib.output.test.dir" value="build/contrib-test-classes"/>
|
||||
<property name="contrib.jar1.dir" value="${contrib.lib}/commons-beanutils-1.6.jar"/>
|
||||
<property name="contrib.jar1.url" value="${repository}/commons-beanutils/jars/commons-beanutils-1.6.jar"/>
|
||||
<property name="contrib.jar2.dir" value="${contrib.lib}/commons-collections-2.1.jar"/>
|
||||
<property name="contrib.jar2.url" value="${repository}/commons-collections/jars/commons-collections-2.1.jar"/>
|
||||
<property name="contrib.jar3.dir" value="${contrib.lib}/commons-lang-1.0-b1.jar"/>
|
||||
<property name="contrib.jar3.url" value="${repository}/commons-lang/jars/commons-lang-1.0-b1.jar"/>
|
||||
<property name="contrib.jar4.dir" value="${contrib.lib}/xmlParserAPIs-2.2.1.jar"/>
|
||||
<property name="contrib.jar4.url" value="${repository}/xerces/jars/xmlParserAPIs-2.2.1.jar"/>
|
||||
<property name="contrib.jar5.dir" value="${contrib.lib}/xercesImpl-2.4.0.jar"/>
|
||||
<property name="contrib.jar5.url" value="${repository}/xerces/jars/xercesImpl-2.4.0.jar"/>
|
||||
<property name="contrib.testokfile" value="build/contrib-testokfile.txt"/>
|
||||
<property name="main.resource1.dir" value="src/resources/fontmetrics"/>
|
||||
<property name="junit.jar1.dir" value="${main.lib}/junit-3.8.1.jar"/>
|
||||
<property name="junit.jar1.url" value="${repository}/junit/jars/junit-3.8.1.jar"/>
|
||||
<property name="build.site" value="build/tmp/site/build/site"/>
|
||||
<property name="build.site.src" value="build/tmp/site"/>
|
||||
<property name="junit.report.dir" value="${build.site}/junit"/>
|
||||
<property name="jdepend.report.dir" value="${build.site}/jdepend"/>
|
||||
<property name="jdepend.report.out.dir" value="${build.site.src}/src/documentation/content/jdepend"/>
|
||||
<property name="apidocs.report.dir" value="${build.site}/apidocs"/>
|
||||
<property name="changelog.file" value="${build.site}/changelog.html"/>
|
||||
<property name="dist.dir" value="build/dist"/>
|
||||
<property name="jar.name" value="poi"/>
|
||||
<property name="version.id" value="2.5.1-final"/>
|
||||
<property name="halt.on.test.failure" value="true"/>
|
||||
|
||||
<path id="main.classpath">
|
||||
<pathelement location="${main.jar1.dir}"/>
|
||||
<pathelement location="${main.jar2.dir}"/>
|
||||
<pathelement location="${main.resource1.dir}"/>
|
||||
</path>
|
||||
|
||||
<path id="scratchpad.classpath">
|
||||
<path refid="main.classpath"/>
|
||||
<pathelement location="${main.output.dir}"/>
|
||||
</path>
|
||||
|
||||
<path id="contrib.classpath">
|
||||
<path refid="main.classpath"/>
|
||||
<pathelement location="${contrib.jar1.dir}"/>
|
||||
<pathelement location="${contrib.jar2.dir}"/>
|
||||
<pathelement location="${contrib.jar3.dir}"/>
|
||||
<pathelement location="${contrib.jar4.dir}"/>
|
||||
<pathelement location="${contrib.jar5.dir}"/>
|
||||
<pathelement location="${main.output.dir}"/>
|
||||
<pathelement location="${main.output.test.dir}"/>
|
||||
<pathelement location="${scratchpad.output.dir}"/>
|
||||
<pathelement location="${scratchpad.output.test.dir}"/>
|
||||
<pathelement location="${contrib.output.dir}"/>
|
||||
<pathelement location="${contrib.output.test.dir}"/>
|
||||
</path>
|
||||
|
||||
<target name="init" depends="check-jars,fetch-jars">
|
||||
|
||||
<tstamp/>
|
||||
|
||||
<mkdir dir="build"/>
|
||||
<mkdir dir="${main.output.dir}"/>
|
||||
<mkdir dir="${contrib.output.dir}"/>
|
||||
<mkdir dir="${scratchpad.output.dir}"/>
|
||||
<mkdir dir="${main.output.test.dir}"/>
|
||||
<mkdir dir="${contrib.output.test.dir}"/>
|
||||
<mkdir dir="${scratchpad.output.test.dir}"/>
|
||||
<mkdir dir="${main.reports.test}"/>
|
||||
<mkdir dir="${scratchpad.reports.test}"/>
|
||||
<mkdir dir="${contrib.reports.test}"/>
|
||||
<mkdir dir="${junit.report.dir}"/>
|
||||
<mkdir dir="${jdepend.report.dir}"/>
|
||||
<mkdir dir="${jdepend.report.out.dir}"/>
|
||||
<mkdir dir="${apidocs.report.dir}"/>
|
||||
<mkdir dir="${dist.dir}"/>
|
||||
<mkdir dir="${build.site.src}/${main.documentation}"/>
|
||||
|
||||
<copy todir="${build.site.src}/${main.documentation}">
|
||||
<fileset dir="${main.documentation}"/>
|
||||
</copy>
|
||||
<copy file="forrest.properties" tofile="${build.site.src}/forrest.properties"/>
|
||||
</target>
|
||||
|
||||
<target name="clean">
|
||||
<delete dir="build"/>
|
||||
</target>
|
||||
|
||||
<target name="check-jars">
|
||||
<condition property="jars.present">
|
||||
<or>
|
||||
<and>
|
||||
<available file="${main.jar1.dir}"/>
|
||||
<available file="${main.jar2.dir}"/>
|
||||
<available file="${contrib.jar1.dir}"/>
|
||||
<available file="${contrib.jar2.dir}"/>
|
||||
<available file="${contrib.jar3.dir}"/>
|
||||
<available file="${contrib.jar4.dir}"/>
|
||||
<available file="${contrib.jar5.dir}"/>
|
||||
<available file="${junit.jar1.dir}"/>
|
||||
</and>
|
||||
<isset property="disconnected"/>
|
||||
</or>
|
||||
</condition>
|
||||
</target>
|
||||
|
||||
<target name="fetch-jars" unless="jars.present">
|
||||
<get src="${main.jar1.url}" dest="${main.jar1.dir}"/>
|
||||
<get src="${main.jar2.url}" dest="${main.jar2.dir}"/>
|
||||
<get src="${contrib.jar1.url}" dest="${contrib.jar1.dir}"/>
|
||||
<get src="${contrib.jar2.url}" dest="${contrib.jar2.dir}"/>
|
||||
<get src="${contrib.jar3.url}" dest="${contrib.jar3.dir}"/>
|
||||
<get src="${contrib.jar4.url}" dest="${contrib.jar4.dir}"/>
|
||||
<get src="${contrib.jar5.url}" dest="${contrib.jar5.dir}"/>
|
||||
<get src="${junit.jar1.url}" dest="${junit.jar1.dir}"/>
|
||||
</target>
|
||||
|
||||
<target name="compile" depends="init,compile-main,compile-scratchpad,compile-contrib">
|
||||
|
||||
</target>
|
||||
|
||||
<target name="compile-main" depends="init">
|
||||
<copy todir="${main.output.dir}">
|
||||
<fileset dir="${main.resource1.dir}"/>
|
||||
</copy>
|
||||
<javac srcdir="${main.src}" destdir="${main.output.dir}" debug="on">
|
||||
<classpath refid="main.classpath"/>
|
||||
</javac>
|
||||
<javac srcdir="${main.src.test}" destdir="${main.output.test.dir}" debug="on">
|
||||
<classpath>
|
||||
<path refid="main.classpath"/>
|
||||
<pathelement location="${main.output.dir}"/>
|
||||
<pathelement location="${junit.jar1.dir}"/>
|
||||
</classpath>
|
||||
</javac>
|
||||
</target>
|
||||
|
||||
<target name="compile-scratchpad" depends="init">
|
||||
<javac srcdir="${scratchpad.src}" destdir="${scratchpad.output.dir}" debug="on">
|
||||
<classpath refid="scratchpad.classpath"/>
|
||||
</javac>
|
||||
<javac srcdir="${scratchpad.src.test}" destdir="${scratchpad.output.test.dir}" debug="on">
|
||||
<classpath>
|
||||
<path refid="scratchpad.classpath"/>
|
||||
<pathelement location="${scratchpad.output.dir}"/>
|
||||
<pathelement location="${junit.jar1.dir}"/>
|
||||
</classpath>
|
||||
</javac>
|
||||
</target>
|
||||
|
||||
<target name="compile-contrib" depends="init">
|
||||
<javac srcdir="${contrib.src}" destdir="${contrib.output.dir}" debug="on">
|
||||
<classpath refid="contrib.classpath"/>
|
||||
</javac>
|
||||
<javac srcdir="${contrib.src.test}" destdir="${contrib.output.test.dir}" debug="on">
|
||||
<classpath>
|
||||
<path refid="contrib.classpath"/>
|
||||
<pathelement location="${contrib.output.dir}"/>
|
||||
<pathelement location="${junit.jar1.dir}"/>
|
||||
</classpath>
|
||||
</javac>
|
||||
</target>
|
||||
|
||||
<target name="test" depends="test-main,test-scratchpad,test-contrib"
|
||||
description="Test main, contrib and scratchpad"/>
|
||||
|
||||
<target name="-test-main-check">
|
||||
<uptodate property="main.test.notRequired" targetfile="${main.testokfile}">
|
||||
<srcfiles dir="${main.src}"/>
|
||||
<srcfiles dir="${main.src.test}"/>
|
||||
</uptodate>
|
||||
</target>
|
||||
|
||||
<path id="test.classpath">
|
||||
<path refid="main.classpath"/>
|
||||
<pathelement location="${main.output.dir}"/>
|
||||
<pathelement location="${main.output.test.dir}"/>
|
||||
<pathelement location="${junit.jar1.dir}"/>
|
||||
</path>
|
||||
<target name="test-main" depends="compile-main,-test-main-check" unless="main.test.notRequired">
|
||||
<junit printsummary="yes" showoutput="true" filtertrace="no" fork="no"
|
||||
haltonfailure="${halt.on.test.failure}" failureproperty="main.test.failed">
|
||||
<classpath refid="test.classpath"/>
|
||||
<sysproperty key="HSSF.testdata.path" value="${main.src.test}/org/apache/poi/hssf/data"/>
|
||||
<sysproperty key="HPSF.testdata.path" value="${main.src.test}/org/apache/poi/hpsf/data"/>
|
||||
<sysproperty key="java.awt.headless" value="true"/>
|
||||
<formatter type="plain"/>
|
||||
<formatter type="xml"/>
|
||||
<batchtest todir="${main.reports.test}">
|
||||
<fileset dir="${main.src.test}">
|
||||
<include name="**/Test*.java"/>
|
||||
<exclude name="**/AllTests.java"/>
|
||||
</fileset>
|
||||
</batchtest>
|
||||
</junit>
|
||||
<delete file="${main.testokfile}"/>
|
||||
<antcall target="-test-main-write-testfile"/>
|
||||
</target>
|
||||
|
||||
<target name="single-test" depends="-test-property-check,compile-main">
|
||||
<junit printsummary="no" showoutput="true" filtertrace="no" haltonfailure="${halt.on.test.failure}" failureproperty="main.test.failed" >
|
||||
<classpath refid="test.classpath"/>
|
||||
<sysproperty key="HSSF.testdata.path" value="${main.src.test}/org/apache/poi/hssf/data"/>
|
||||
<sysproperty key="HPSF.testdata.path" value="${main.src.test}/org/apache/poi/hpsf/data"/>
|
||||
<sysproperty key="java.awt.headless" value="true"/>
|
||||
<formatter type="plain" usefile="no"/>
|
||||
<formatter type="xml"/>
|
||||
<test name="${testcase}" />
|
||||
</junit>
|
||||
</target>
|
||||
|
||||
<target name="debug-test" depends="-test-property-check,compile-main">
|
||||
<junit printsummary="no" showoutput="true" filtertrace="no" fork="yes" haltonfailure="${halt.on.test.failure}" failureproperty="main.test.failed" >
|
||||
<jvmarg value="-Xdebug"/>
|
||||
<jvmarg value="-Xrunjdwp:transport=dt_socket,address=5001,server=y,suspend=y"/>
|
||||
<sysproperty key="java.compiler" value="NONE"/>
|
||||
<sysproperty key="java.awt.headless" value="true"/>
|
||||
<classpath refid="test.classpath"/>
|
||||
<sysproperty key="HSSF.testdata.path" value="${main.src.test}/org/apache/poi/hssf/data"/>
|
||||
<sysproperty key="HPSF.testdata.path" value="${main.src.test}/org/apache/poi/hpsf/data"/>
|
||||
<formatter type="plain" usefile="no"/>
|
||||
<test name="${testcase}" />
|
||||
</junit>
|
||||
</target>
|
||||
|
||||
<target name="-test-property-check" unless="testcase">
|
||||
<echo message="Please use -Dtestcase=org.your.testcase to run a single test"/>
|
||||
<fail/>
|
||||
</target>
|
||||
|
||||
<target name="-test-main-write-testfile" unless="main.test.failed">
|
||||
<echo file="${main.testokfile}" append="false" message="testok"/>
|
||||
</target>
|
||||
|
||||
<target name="-test-scratchpad-check">
|
||||
<uptodate property="scratchpad.test.notRequired" targetfile="${scratchpad.testokfile}">
|
||||
<srcfiles dir="${scratchpad.src}"/>
|
||||
<srcfiles dir="${scratchpad.src.test}"/>
|
||||
</uptodate>
|
||||
</target>
|
||||
|
||||
<target name="test-scratchpad" depends="compile-scratchpad,-test-scratchpad-check" unless="scratchpad.test.notRequired">
|
||||
<junit printsummary="yes" fork="no" haltonfailure="${halt.on.test.failure}">
|
||||
<classpath>
|
||||
<path refid="scratchpad.classpath"/>
|
||||
<pathelement location="${main.output.dir}"/>
|
||||
<pathelement location="${scratchpad.output.dir}"/>
|
||||
<pathelement location="${scratchpad.output.test.dir}"/>
|
||||
<pathelement location="${junit.jar1.dir}"/>
|
||||
</classpath>
|
||||
<sysproperty key="HSSF.testdata.path" value="${scratchpad.src.test}/org/apache/poi/hssf/data"/>
|
||||
<sysproperty key="HPSF.testdata.path" value="${scratchpad.src.test}/org/apache/poi/hpsf/data"/>
|
||||
<sysproperty key="HDF.testdata.path" value="${scratchpad.src.test}/org/apache/poi/hdf/data"/>
|
||||
<sysproperty key="java.awt.headless" value="true"/>
|
||||
<formatter type="xml"/>
|
||||
<batchtest todir="${scratchpad.reports.test}">
|
||||
<fileset dir="${scratchpad.src.test}">
|
||||
<include name="**/Test*.java"/>
|
||||
<exclude name="**/AllTests.java"/>
|
||||
</fileset>
|
||||
</batchtest>
|
||||
</junit>
|
||||
<delete file="${scratchpad.testokfile}"/>
|
||||
<antcall target="-test-scratchpad-write-testfile"/>
|
||||
</target>
|
||||
|
||||
<target name="-test-scratchpad-write-testfile" unless="scratchpad.test.failed">
|
||||
<echo file="${scratchpad.testokfile}" append="false" message="testok"/>
|
||||
</target>
|
||||
|
||||
<target name="-test-contrib-check">
|
||||
<uptodate property="contrib.test.notRequired" targetfile="${contrib.testokfile}">
|
||||
<srcfiles dir="${contrib.src}"/>
|
||||
<srcfiles dir="${contrib.src.test}"/>
|
||||
</uptodate>
|
||||
</target>
|
||||
|
||||
<target name="test-contrib" depends="compile-contrib,-test-contrib-check" unless="contrib.test.notRequired">
|
||||
<junit printsummary="yes" fork="no" haltonfailure="${halt.on.test.failure}">
|
||||
<classpath>
|
||||
<path refid="contrib.classpath"/>
|
||||
<pathelement location="${main.output.dir}"/>
|
||||
<pathelement location="${contrib.output.dir}"/>
|
||||
<pathelement location="${contrib.output.test.dir}"/>
|
||||
<pathelement location="${junit.jar1.dir}"/>
|
||||
</classpath>
|
||||
<sysproperty key="HSSF.testdata.path" value="${contrib.src.test}/org/apache/poi/hssf/data"/>
|
||||
<sysproperty key="HPSF.testdata.path" value="${contrib.src.test}/org/apache/poi/hpsf/data"/>
|
||||
<sysproperty key="java.awt.headless" value="true"/>
|
||||
<formatter type="xml"/>
|
||||
<batchtest todir="${contrib.reports.test}">
|
||||
<fileset dir="${contrib.src.test}">
|
||||
<include name="**/Test*.java"/>
|
||||
<exclude name="**/AllTests.java"/>
|
||||
</fileset>
|
||||
</batchtest>
|
||||
</junit>
|
||||
<delete file="${contrib.testokfile}"/>
|
||||
<antcall target="-test-contrib-write-testfile"/>
|
||||
</target>
|
||||
|
||||
<target name="-test-contrib-write-testfile" unless="contrib.test.failed">
|
||||
<echo file="${contrib.testokfile}" append="false" message="testok"/>
|
||||
</target>
|
||||
|
||||
<target name="-check-docs">
|
||||
<uptodate property="main.docs.notRequired" targetfile="${build.site}/index.html">
|
||||
<srcfiles dir="${build.site.src}"/>
|
||||
</uptodate>
|
||||
</target>
|
||||
|
||||
<target name="-check-forrest-installed" unless="env.FORREST_HOME">
|
||||
<echo>Please install Apache Forrest (see
|
||||
<http://xml.apache.org/forrest/index.html>) and set the
|
||||
FORREST_HOME environment variable!</echo>
|
||||
<fail message="Apache Forrest is not installed."/>
|
||||
</target>
|
||||
|
||||
<!-- <target name="check-docs">-->
|
||||
<!-- <uptodate property="main.docs.notRequired" targetfile="${build.site}/index.html" >-->
|
||||
<!-- <srcfiles dir= "${build.site.src}"/>-->
|
||||
<!-- </uptodate>-->
|
||||
<!-- </target>-->
|
||||
|
||||
<target name="docs" depends="init,-check-forrest-installed,-check-docs" unless="main.docs.notRequired"
|
||||
description="Builds the POI website">
|
||||
|
||||
<mkdir dir="${build.site.src}/src/documentation/content/apidocs"/>
|
||||
<copy todir="${build.site.src}/src/documentation/content/apidocs">
|
||||
<fileset dir="${apidocs.report.dir}"/>
|
||||
</copy>
|
||||
<copy tofile="${build.site.src}/src/documentation/content/jdepend.ehtml" file="${jdepend.report.dir}/index.html" failonerror="false"/>
|
||||
<mkdir dir="${build.site.src}/src/documentation/content/junit"/>
|
||||
<copy todir="${build.site.src}/src/documentation/content/junit">
|
||||
<fileset dir="${junit.report.dir}"/>
|
||||
</copy>
|
||||
|
||||
<move file="${build.site.src}/src/documentation/content/xdocs/status.xml" tofile="${build.site.src}/status.xml"/>
|
||||
|
||||
|
||||
<ant antfile="${forrest.home}/forrest.antproxy.xml" target="site">
|
||||
<property name="project.home" value="${build.site.src}"/>
|
||||
</ant>
|
||||
|
||||
<echo>Broken links:</echo>
|
||||
<echo file="${build.site}/../tmp/brokenlinks.txt"/>
|
||||
|
||||
<touch>
|
||||
<fileset dir="${build.site}"/>
|
||||
</touch>
|
||||
</target>
|
||||
|
||||
<!-- Checks whether reports are required to be run. If nothing has changed then they dont. -->
|
||||
<target name="-check-reports">
|
||||
<condition property="reports.notRequired">
|
||||
<and>
|
||||
<equals arg1="${main.test.notRequired}" arg2="true"/>
|
||||
<equals arg1="${scratchpad.test.notRequired}" arg2="true"/>
|
||||
<equals arg1="${contrib.test.notRequired}" arg2="true"/>
|
||||
</and>
|
||||
</condition>
|
||||
</target>
|
||||
|
||||
<target name="-cvschangelog" unless="disconnected">
|
||||
<cvschangelog destfile="${changelog.file}" daysinpast="30"/>
|
||||
|
||||
<style in="${changelog.file}"
|
||||
out="${build.site.src}/src/documentation/content/changelog.html"
|
||||
style="changelog.xsl">
|
||||
<param name="title" expression="POI Change Log"/>
|
||||
<param name="module" expression="jakarta-poi"/>
|
||||
<param name="cvsweb" expression="http://cvs.apache.org/viewcvs/"/>
|
||||
</style>
|
||||
</target>
|
||||
|
||||
<target name="reports" depends="-check-reports" unless="reports.notRequired"
|
||||
description="Creates junit,jdepend and javadoc reports">
|
||||
<antcall target="test">
|
||||
<param name="${halt.on.test.failure}" value="false"/>
|
||||
</antcall>
|
||||
<junitreport todir="${junit.report.dir}">
|
||||
<fileset dir="${main.reports.test}">
|
||||
<include name="TEST-*.xml"/>
|
||||
</fileset>
|
||||
<fileset dir="${scratchpad.reports.test}">
|
||||
<include name="TEST-*.xml"/>
|
||||
</fileset>
|
||||
<fileset dir="${contrib.reports.test}">
|
||||
<include name="TEST-*.xml"/>
|
||||
</fileset>
|
||||
<report format="frames" todir="${junit.report.dir}"/>
|
||||
</junitreport>
|
||||
|
||||
<jdepend outputfile="${jdepend.report.dir}/jdepend.xml" format="xml">
|
||||
<sourcespath>
|
||||
<pathelement location="${main.src}"/>
|
||||
<pathelement location="${contrib.src}"/>
|
||||
<pathelement location="${scratchpad.src}"/>
|
||||
</sourcespath>
|
||||
<classpath>
|
||||
<path refid="main.classpath"/>
|
||||
<path refid="contrib.classpath"/>
|
||||
<path refid="scratchpad.classpath"/>
|
||||
<pathelement location="${main.output.dir}"/>
|
||||
<pathelement location="${contrib.output.dir}"/>
|
||||
<pathelement location="${scratchpad.output.dir}"/>
|
||||
</classpath>
|
||||
</jdepend>
|
||||
|
||||
<style basedir="${jdepend.report.dir}"
|
||||
in="${jdepend.report.dir}/jdepend.xml"
|
||||
out="${jdepend.report.out.dir}/index.html"
|
||||
style="jdepend.xsl"/>
|
||||
|
||||
<antcall target="-cvschangelog"/>
|
||||
|
||||
<javadoc
|
||||
destdir="${apidocs.report.dir}"
|
||||
author="true"
|
||||
version="true"
|
||||
use="true"
|
||||
verbose="false"
|
||||
windowtitle="POI API">
|
||||
|
||||
<packageset dir="${main.src}" defaultexcludes="yes">
|
||||
<include name="org/apache/poi/**"/>
|
||||
</packageset>
|
||||
<packageset dir="${scratchpad.src}" defaultexcludes="yes">
|
||||
<include name="org/apache/poi/**"/>
|
||||
</packageset>
|
||||
<packageset dir="${contrib.src}" defaultexcludes="yes">
|
||||
<include name="org/apache/poi/**"/>
|
||||
</packageset>
|
||||
|
||||
<classpath>
|
||||
<path refid="main.classpath"/>
|
||||
<path refid="scratchpad.classpath"/>
|
||||
<path refid="contrib.classpath"/>
|
||||
</classpath>
|
||||
|
||||
<doctitle><![CDATA[<h1>POI Documentation</h1>]]></doctitle>
|
||||
<bottom><![CDATA[<i>Copyright © 2003 Apache Software Foundation.</i>]]></bottom>
|
||||
<group title="HSSF" packages="org.apache.poi.hssf*"/>
|
||||
<group title="HPSF" packages="org.apache.poi.hpsf*"/>
|
||||
<group title="POIFS" packages="org.apache.poi.poifs*"/>
|
||||
<group title="HDF" packages="org.apache.poi.hdf*"/>
|
||||
<group title="Record Generator" packages="org.apache.poi.record*"/>
|
||||
<group title="Utils" packages="org.apache.poi.util*"/>
|
||||
</javadoc>
|
||||
|
||||
|
||||
</target>
|
||||
|
||||
<!-- ================================== -->
|
||||
<!-- Generate records -->
|
||||
<!-- ================================== -->
|
||||
|
||||
<target name="generate-records" depends="init"
|
||||
description="generate-records">
|
||||
<java classname="org.apache.poi.dev.RecordGenerator" fork="yes">
|
||||
<arg value="src/records/definitions"/>
|
||||
<arg value="src/records/styles"/>
|
||||
<arg value="src/java"/>
|
||||
<arg value="src/testcases"/>
|
||||
<classpath>
|
||||
<path refid="scratchpad.classpath">
|
||||
</path>
|
||||
<pathelement location="${main.output.dir}"/>
|
||||
<pathelement location="${scratchpad.output.dir}"/>
|
||||
</classpath>
|
||||
</java>
|
||||
|
||||
</target>
|
||||
|
||||
<!-- ================================== -->
|
||||
<!-- Generate types -->
|
||||
<!-- ================================== -->
|
||||
|
||||
<target name="generate-types" depends="init"
|
||||
description="generate-types">
|
||||
|
||||
<java classname="org.apache.poi.dev.RecordGenerator" fork="yes">
|
||||
<arg value="src/types/definitions"/>
|
||||
<arg value="src/types/styles"/>
|
||||
<arg value="src/scratchpad/src"/>
|
||||
<arg value="src/scratchpad/testcases"/>
|
||||
<classpath>
|
||||
<path refid="scratchpad.classpath">
|
||||
</path>
|
||||
<pathelement location="${main.output.dir}"/>
|
||||
<pathelement location="${scratchpad.output.dir}"/>
|
||||
</classpath>
|
||||
</java>
|
||||
|
||||
</target>
|
||||
|
||||
<target name="site" depends="reports,docs"
|
||||
description="generate the documentation and reports"/>
|
||||
|
||||
<target name="jar" depends="compile" description="Creates jar files for distribution">
|
||||
<jar basedir="${main.output.dir}" destfile="${dist.dir}/${jar.name}-${version.id}-${DSTAMP}.jar">
|
||||
<manifest>
|
||||
<attribute name="Built-By" value="${user.name}"/>
|
||||
<section name="common">
|
||||
<attribute name="Specification-Title" value="Jakarta POI"/>
|
||||
<attribute name="Specification-Version" value="${version.id}-${DSTAMP}"/>
|
||||
<attribute name="Specification-Vendor" value="Apache"/>
|
||||
<attribute name="Implementation-Title" value="Jakarta POI"/>
|
||||
<attribute name="Implementation-Version" value="${version.id}-${DSTAMP}"/>
|
||||
<attribute name="Implementation-Vendor" value="Apache"/>
|
||||
</section>
|
||||
</manifest>
|
||||
</jar>
|
||||
<jar basedir="${contrib.output.dir}" destfile="${dist.dir}/${jar.name}-contrib-${version.id}-${DSTAMP}.jar">
|
||||
<manifest>
|
||||
<attribute name="Built-By" value="${user.name}"/>
|
||||
<section name="common">
|
||||
<attribute name="Specification-Title" value="Jakarta POI"/>
|
||||
<attribute name="Specification-Version" value="${version.id}-${DSTAMP}"/>
|
||||
<attribute name="Specification-Vendor" value="Apache"/>
|
||||
<attribute name="Implementation-Title" value="Jakarta POI"/>
|
||||
<attribute name="Implementation-Version" value="${version.id}-${DSTAMP}"/>
|
||||
<attribute name="Implementation-Vendor" value="Apache"/>
|
||||
</section>
|
||||
</manifest>
|
||||
</jar>
|
||||
<jar basedir="${scratchpad.output.dir}" destfile="${dist.dir}/${jar.name}-scratchpad-${version.id}-${DSTAMP}.jar">
|
||||
<manifest>
|
||||
<attribute name="Built-By" value="${user.name}"/>
|
||||
<section name="common">
|
||||
<attribute name="Specification-Title" value="Jakarta POI"/>
|
||||
<attribute name="Specification-Version" value="${version.id}-${DSTAMP}"/>
|
||||
<attribute name="Specification-Vendor" value="Apache"/>
|
||||
<attribute name="Implementation-Title" value="Jakarta POI"/>
|
||||
<attribute name="Implementation-Version" value="${version.id}-${DSTAMP}"/>
|
||||
<attribute name="Implementation-Vendor" value="Apache"/>
|
||||
</section>
|
||||
</manifest>
|
||||
</jar>
|
||||
</target>
|
||||
|
||||
<target name="dist" depends="compile,site,jar" description="Creates the entire distribution into build/dist">
|
||||
|
||||
<zip destfile="${dist.dir}/${jar.name}-bin-${version.id}-${DSTAMP}.zip">
|
||||
<zipfileset dir="${build.site}" prefix="docs"/>
|
||||
<zipfileset file="${dist.dir}/${jar.name}-${version.id}-${DSTAMP}.jar"/>
|
||||
<zipfileset file="${dist.dir}/${jar.name}-contrib-${version.id}-${DSTAMP}.jar"/>
|
||||
<zipfileset file="${dist.dir}/${jar.name}-scratchpad-${version.id}-${DSTAMP}.jar"/>
|
||||
<zipfileset dir="legal" prefix="legal"/>
|
||||
</zip>
|
||||
|
||||
<zip destfile="${dist.dir}/${jar.name}-src-${version.id}-${DSTAMP}.zip">
|
||||
<zipfileset dir="${build.site}" prefix="docs"/>
|
||||
<zipfileset dir=".">
|
||||
<exclude name="build/**"/>
|
||||
<exclude name="scripts/**"/>
|
||||
<exclude name="*.ipr"/>
|
||||
<exclude name="*.iml"/>
|
||||
<exclude name="*.iws"/>
|
||||
</zipfileset>
|
||||
</zip>
|
||||
|
||||
<tar destfile="${dist.dir}/${jar.name}-bin-${version.id}-${DSTAMP}.tar.gz" compression="gzip">
|
||||
<tarfileset dir="${build.site}" prefix="docs"/>
|
||||
<tarfileset file="${dist.dir}/${jar.name}-${version.id}-${DSTAMP}.jar"/>
|
||||
<tarfileset file="${dist.dir}/${jar.name}-contrib-${version.id}-${DSTAMP}.jar"/>
|
||||
<tarfileset file="${dist.dir}/${jar.name}-scratchpad-${version.id}-${DSTAMP}.jar"/>
|
||||
<tarfileset dir="legal" prefix="legal"/>
|
||||
</tar>
|
||||
|
||||
<tar destfile="${dist.dir}/${jar.name}-src-${version.id}-${DSTAMP}.tar.gz" compression="gzip">
|
||||
<tarfileset dir="${build.site}" prefix="docs"/>
|
||||
<tarfileset dir=".">
|
||||
<exclude name="build/**"/>
|
||||
<exclude name="scripts/**"/>
|
||||
<exclude name="*.ipr"/>
|
||||
<exclude name="*.iml"/>
|
||||
<exclude name="*.iws"/>
|
||||
</tarfileset>
|
||||
</tar>
|
||||
|
||||
<echo>Distribution located in build/dist</echo>
|
||||
|
||||
</target>
|
||||
|
||||
<target name="clean-dist" depends="clean,dist" description="Cleans the build directory then creates a distribution"/>
|
||||
|
||||
<target name="gump" depends="jar,test"/>
|
||||
|
||||
</project>
|
142
changelog.xsl
Normal file
142
changelog.xsl
Normal file
@ -0,0 +1,142 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!-- Copyright (C) 2004 The Apache Software Foundation. All rights reserved. -->
|
||||
|
||||
<xsl:stylesheet
|
||||
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
|
||||
version='1.0'>
|
||||
|
||||
<!--
|
||||
Copyright 2002-2004 Apache Software Foundation
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<xsl:param name="title"/>
|
||||
<xsl:param name="module"/>
|
||||
<xsl:param name="cvsweb"/>
|
||||
|
||||
<xsl:output method="html" indent="yes" encoding="US-ASCII"/>
|
||||
|
||||
<!-- Copy standard document elements. Elements that
|
||||
should be ignored must be filtered by apply-templates
|
||||
tags. -->
|
||||
<xsl:template match="*">
|
||||
<xsl:copy>
|
||||
<xsl:copy-of select="attribute::*[. != '']"/>
|
||||
<xsl:apply-templates/>
|
||||
</xsl:copy>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="changelog">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE><xsl:value-of select="$title"/></TITLE>
|
||||
</HEAD>
|
||||
<BODY link="#000000" alink="#000000" vlink="#000000" text="#000000">
|
||||
<style type="text/css">
|
||||
body, p {
|
||||
font-family: verdana,arial,helvetica;
|
||||
font-size: 100%;
|
||||
color:#000000;
|
||||
}
|
||||
.dateAndAuthor {
|
||||
font-family: verdana,arial,helvetica;
|
||||
font-size: 100%;
|
||||
font-weight: bold;
|
||||
text-align:left;
|
||||
background:#a6caf0;
|
||||
}
|
||||
tr, td{
|
||||
font-family: verdana,arial,helvetica;
|
||||
font-size: 120%;
|
||||
background:#eeeee0;
|
||||
}
|
||||
</style>
|
||||
<h1>
|
||||
<a name="top"><xsl:value-of select="$title"/></a>
|
||||
</h1>
|
||||
|
||||
<hr size="2"/>
|
||||
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="3" CELLSPACING="1">
|
||||
|
||||
<xsl:apply-templates select=".//entry">
|
||||
<xsl:sort select="date" data-type="text" order="descending"/>
|
||||
<xsl:sort select="time" data-type="text" order="descending"/>
|
||||
</xsl:apply-templates>
|
||||
|
||||
</TABLE>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="entry">
|
||||
<TR>
|
||||
<TD colspan="2" class="dateAndAuthor">
|
||||
<xsl:value-of select="date"/><xsl:text> </xsl:text><xsl:value-of select="time"/><xsl:text> </xsl:text><xsl:value-of select="author"/>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD width="20">
|
||||
<xsl:text> </xsl:text>
|
||||
</TD>
|
||||
<TD>
|
||||
<pre>
|
||||
<xsl:apply-templates select="msg"/></pre>
|
||||
<ul>
|
||||
<xsl:apply-templates select="file"/>
|
||||
</ul>
|
||||
</TD>
|
||||
</TR>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="date">
|
||||
<i><xsl:value-of select="."/></i>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="time">
|
||||
<i><xsl:value-of select="."/></i>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="author">
|
||||
<i>
|
||||
<a>
|
||||
<xsl:attribute name="href">mailto:<xsl:value-of select="."/></xsl:attribute>
|
||||
<xsl:value-of select="."/>
|
||||
</a>
|
||||
</i>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="file">
|
||||
<li>
|
||||
<a>
|
||||
<xsl:choose>
|
||||
<xsl:when test="string-length(prevrevision) = 0 ">
|
||||
<xsl:attribute name="href"><xsl:value-of select="$cvsweb"/><xsl:value-of select="$module" />/<xsl:value-of select="name" />?rev=<xsl:value-of select="revision" />&content-type=text/x-cvsweb-markup</xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:attribute name="href"><xsl:value-of select="$cvsweb"/><xsl:value-of select="$module" />/<xsl:value-of select="name" />?r1=<xsl:value-of select="revision" />&r2=<xsl:value-of select="prevrevision"/></xsl:attribute>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:value-of select="name" /> (<xsl:value-of select="revision"/>)
|
||||
</a>
|
||||
</li>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Any elements within a msg are processed,
|
||||
so that we can preserve HTML tags. -->
|
||||
<xsl:template match="msg">
|
||||
<b><xsl:apply-templates/></b>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
96
forrest.properties
Normal file
96
forrest.properties
Normal file
@ -0,0 +1,96 @@
|
||||
##############
|
||||
# Properties used by forrest.build.xml for building the website
|
||||
##############
|
||||
|
||||
# Prints out a summary of Forrest settings for this project
|
||||
#forrest.echo=true
|
||||
|
||||
# Project name (used to name .war file)
|
||||
#project.name=my-project
|
||||
|
||||
# Specifies name of Forrest skin to use
|
||||
#project.skin=forrest-site
|
||||
#project.skin=avalon-tigris
|
||||
#project.skin=krysalis-site
|
||||
|
||||
|
||||
##############
|
||||
# layout properties
|
||||
|
||||
# Properties that must be set to override the default locations
|
||||
#
|
||||
# Parent properties must be set. This usually means uncommenting
|
||||
# project.content-dir if any other property using it is uncommented
|
||||
|
||||
#project.status=status.xml
|
||||
#project.content-dir=src/documentation
|
||||
#project.conf-dir=${project.content-dir}/conf
|
||||
#project.sitemap=${project.content-dir}/sitemap.xmap
|
||||
#project.xdocs-dir=${project.content-dir}/content/xdocs
|
||||
#project.stylesheets-dir=${project.content-dir}/resources/stylesheets
|
||||
#project.images-dir=${project.content-dir}/resources/images
|
||||
#project.schema-dir=${project.content-dir}/resources/schema
|
||||
#project.skins-dir=${project.content-dir}/skins
|
||||
#project.skinconf=${project.content-dir}/skinconf.xml
|
||||
#project.lib-dir=${project.content-dir}/lib
|
||||
#project.classes-dir=${project.content-dir}/classes
|
||||
|
||||
|
||||
##############
|
||||
# Cocoon catalog entity resolver properties
|
||||
|
||||
# A local catalog to supplement the default Forrest catalog
|
||||
#project.catalog=${project.schema-dir}/catalog
|
||||
|
||||
# The verbosity level for the entity resolver (1..10)
|
||||
#forrest.catalog.verbosity=1
|
||||
|
||||
|
||||
##############
|
||||
# validation properties
|
||||
|
||||
# These props determine if validation is performed at all
|
||||
# Values are inherited unless overridden.
|
||||
# Eg, if forrest.validate=false, then all others are false unless set to true.
|
||||
#forrest.validate=true
|
||||
#forrest.validate.xdocs=${forrest.validate}
|
||||
#forrest.validate.skinconf=${forrest.validate}
|
||||
#forrest.validate.sitemap=${forrest.validate}
|
||||
#forrest.validate.stylesheets=${forrest.validate}
|
||||
#forrest.validate.skins=${forrest.validate}
|
||||
#forrest.validate.skins.stylesheets=${forrest.validate.skins}
|
||||
|
||||
|
||||
# Key:
|
||||
# *.failonerror=(true|false) stop when an XML file is invalid
|
||||
# *.includes=(pattern) Comma-separated list of path patterns to validate
|
||||
# *.excludes=(pattern) Comma-separated list of path patterns to not validate
|
||||
|
||||
#forrest.validate.failonerror=true
|
||||
#forrest.validate.includes=**/*
|
||||
#forrest.validate.excludes=
|
||||
#
|
||||
#forrest.validate.xdocs.failonerror=${forrest.validate.failonerror}
|
||||
#
|
||||
#forrest.validate.xdocs.includes=**/*.x*
|
||||
#forrest.validate.xdocs.excludes=site.xml
|
||||
#
|
||||
#forrest.validate.skinconf.includes=${skinconf-file}
|
||||
#forrest.validate.skinconf.excludes=
|
||||
#forrest.validate.skinconf.failonerror=${forrest.validate.failonerror}
|
||||
#
|
||||
#forrest.validate.sitemap.includes=${sitemap-file}
|
||||
#forrest.validate.sitemap.excludes=
|
||||
#forrest.validate.sitemap.failonerror=${forrest.validate.failonerror}
|
||||
#
|
||||
#forrest.validate.stylesheets.includes=**/*.xsl
|
||||
#forrest.validate.stylesheets.excludes=
|
||||
#forrest.validate.stylesheets.failonerror=${forrest.validate.failonerror}
|
||||
#
|
||||
#forrest.validate.skins.includes=**/*
|
||||
#forrest.validate.skins.excludes=**/*.xsl
|
||||
#forrest.validate.skins.failonerror=${forrest.validate.failonerror}
|
||||
#
|
||||
#forrest.validate.skins.stylesheets.includes=**/*.xsl
|
||||
#forrest.validate.skins.stylesheets.excludes=
|
||||
#forrest.validate.skins.stylesheets.failonerror=${forrest.validate.skins.failonerror}
|
276
jdepend.xsl
Normal file
276
jdepend.xsl
Normal file
@ -0,0 +1,276 @@
|
||||
<!-- Copyright (C) 2004 The Apache Software Foundation. All rights reserved. -->
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
|
||||
|
||||
<!--
|
||||
Copyright 2002-2004 Apache Software Foundation
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
-->
|
||||
|
||||
<xsl:output method="html" indent="yes"/>
|
||||
|
||||
<xsl:template match="JDepend">
|
||||
<html>
|
||||
<head>
|
||||
<title>JDepend Analysis</title>
|
||||
|
||||
<style type="text/css">
|
||||
body {
|
||||
font:normal 68% verdana,arial,helvetica;
|
||||
color:#000000;
|
||||
}
|
||||
table tr td, tr th {
|
||||
font-size: 68%;
|
||||
}
|
||||
table.details tr th{
|
||||
font-weight: bold;
|
||||
text-align:left;
|
||||
background:#a6caf0;
|
||||
}
|
||||
table.details tr td{
|
||||
background:#eeeee0;
|
||||
}
|
||||
|
||||
p {
|
||||
line-height:1.5em;
|
||||
margin-top:0.5em; margin-bottom:1.0em;
|
||||
margin-left:2em;
|
||||
margin-right:2em;
|
||||
}
|
||||
h1 {
|
||||
margin: 0px 0px 5px; font: 165% verdana,arial,helvetica
|
||||
}
|
||||
h2 {
|
||||
margin-top: 1em; margin-bottom: 0.5em; font: bold 125% verdana,arial,helvetica
|
||||
}
|
||||
h3 {
|
||||
margin-bottom: 0.5em; font: bold 115% verdana,arial,helvetica
|
||||
}
|
||||
h4 {
|
||||
margin-bottom: 0.5em; font: bold 100% verdana,arial,helvetica
|
||||
}
|
||||
h5 {
|
||||
margin-bottom: 0.5em; font: bold 100% verdana,arial,helvetica
|
||||
}
|
||||
h6 {
|
||||
margin-bottom: 0.5em; font: bold 100% verdana,arial,helvetica
|
||||
}
|
||||
.Error {
|
||||
font-weight:bold; color:red;
|
||||
}
|
||||
.Failure {
|
||||
font-weight:bold; color:purple;
|
||||
}
|
||||
.Properties {
|
||||
text-align:right;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<!--h1>JDepend Report</h1>
|
||||
<ul>
|
||||
<xsl:for-each select="./Packages/Package">
|
||||
<xsl:sort select="@name"/>
|
||||
<li><xsl:value-of select="@name"/></li>
|
||||
</xsl:for-each>
|
||||
</ul-->
|
||||
|
||||
<h1><a name="top">JDepend Analysis</a></h1>
|
||||
<p align="right">Designed for use with <a href="http://www.clarkware.com/software/JDepend.html">JDepend</a> and <a href="http://jakarta.apache.org">Ant</a>.</p>
|
||||
<hr size="2" />
|
||||
|
||||
<table width="100%"><tr><td>
|
||||
<a name="NVsummary"><h2>Summary</h2></a>
|
||||
</td><td align="right">
|
||||
[<a href="#NVsummary">summary</a>]
|
||||
[<a href="#NVpackages">packages</a>]
|
||||
[<a href="#NVcycles">cycles</a>]
|
||||
[<a href="#NVexplanations">explanations</a>]
|
||||
</td></tr></table>
|
||||
|
||||
<table width="100%" class="details">
|
||||
<tr>
|
||||
<th>Package</th>
|
||||
<th>Total Classes</th>
|
||||
<th><a href="#EXnumber">Abstract Classes</a></th>
|
||||
<th><a href="#EXnumber">Concrete Classes</a></th>
|
||||
<th><a href="#EXafferent">Afferent Couplings</a></th>
|
||||
<th><a href="#EXefferent">Efferent Couplings</a></th>
|
||||
<th><a href="#EXabstractness">Abstractness</a></th>
|
||||
<th><a href="#EXinstability">Instability</a></th>
|
||||
<th><a href="#EXdistance">Distance</a></th>
|
||||
|
||||
</tr>
|
||||
<xsl:for-each select="./Packages/Package">
|
||||
<xsl:if test="count(error) = 0">
|
||||
<tr>
|
||||
<td align="left">
|
||||
<a>
|
||||
<xsl:attribute name="href">#PK<xsl:value-of select="@name"/>
|
||||
</xsl:attribute>
|
||||
<xsl:value-of select="@name"/>
|
||||
</a>
|
||||
</td>
|
||||
<td align="right"><xsl:value-of select="Stats/TotalClasses"/></td>
|
||||
<td align="right"><xsl:value-of select="Stats/AbstractClasses"/></td>
|
||||
<td align="right"><xsl:value-of select="Stats/ConcreteClasses"/></td>
|
||||
<td align="right"><xsl:value-of select="Stats/Ca"/></td>
|
||||
<td align="right"><xsl:value-of select="Stats/Ce"/></td>
|
||||
<td align="right"><xsl:value-of select="Stats/A"/></td>
|
||||
<td align="right"><xsl:value-of select="Stats/I"/></td>
|
||||
<td align="right"><xsl:value-of select="Stats/D"/></td>
|
||||
|
||||
|
||||
</tr>
|
||||
</xsl:if>
|
||||
</xsl:for-each>
|
||||
<xsl:for-each select="./Packages/Package">
|
||||
<xsl:if test="count(error) > 0">
|
||||
<tr>
|
||||
<td align="left">
|
||||
<xsl:value-of select="@name"/>
|
||||
</td>
|
||||
<td align="left" colspan="8"><xsl:value-of select="error"/></td>
|
||||
</tr>
|
||||
</xsl:if>
|
||||
</xsl:for-each>
|
||||
</table>
|
||||
|
||||
<table width="100%"><tr><td>
|
||||
<a name="NVpackages"><h2>Packages</h2></a>
|
||||
</td><td align="right">
|
||||
[<a href="#NVsummary">summary</a>]
|
||||
[<a href="#NVpackages">packages</a>]
|
||||
[<a href="#NVcycles">cycles</a>]
|
||||
[<a href="#NVexplanations">explanations</a>]
|
||||
</td></tr></table>
|
||||
|
||||
<xsl:for-each select="./Packages/Package">
|
||||
<xsl:if test="count(error) = 0">
|
||||
<h3><a><xsl:attribute name="name">PK<xsl:value-of select="@name"/></xsl:attribute>
|
||||
<xsl:value-of select="@name"/></a></h3>
|
||||
|
||||
<table width="100%"><tr>
|
||||
<td><a href="#EXafferent">Afferent Couplings</a>: <xsl:value-of select="Stats/Ca"/></td>
|
||||
<td><a href="#EXefferent">Efferent Couplings</a>: <xsl:value-of select="Stats/Ce"/></td>
|
||||
<td><a href="#EXabstractness">Abstractness</a>: <xsl:value-of select="Stats/A"/></td>
|
||||
<td><a href="#EXinstability">Instability</a>: <xsl:value-of select="Stats/I"/></td>
|
||||
<td><a href="#EXdistance">Distance</a>: <xsl:value-of select="Stats/D"/></td>
|
||||
</tr></table>
|
||||
|
||||
<table width="100%" class="details">
|
||||
<tr>
|
||||
<th>Abstract Classes</th>
|
||||
<th>Concrete Classes</th>
|
||||
<th>Used by Packages</th>
|
||||
<th>Uses Packages</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="25%">
|
||||
<xsl:if test="count(AbstractClasses/Class)=0">
|
||||
<i>None</i>
|
||||
</xsl:if>
|
||||
<xsl:for-each select="AbstractClasses/Class">
|
||||
<xsl:value-of select="node()"/><br/>
|
||||
</xsl:for-each>
|
||||
</td>
|
||||
<td valign="top" width="25%">
|
||||
<xsl:if test="count(ConcreteClasses/Class)=0">
|
||||
<i>None</i>
|
||||
</xsl:if>
|
||||
<xsl:for-each select="ConcreteClasses/Class">
|
||||
<xsl:value-of select="node()"/><br/>
|
||||
</xsl:for-each>
|
||||
</td>
|
||||
<td valign="top" width="25%">
|
||||
<xsl:if test="count(UsedBy/Package)=0">
|
||||
<i>None</i>
|
||||
</xsl:if>
|
||||
<xsl:for-each select="UsedBy/Package">
|
||||
<a>
|
||||
<xsl:attribute name="href">#PK<xsl:value-of select="node()"/></xsl:attribute>
|
||||
<xsl:value-of select="node()"/>
|
||||
</a><br/>
|
||||
</xsl:for-each>
|
||||
</td>
|
||||
<td valign="top" width="25%">
|
||||
<xsl:if test="count(DependsUpon/Package)=0">
|
||||
<i>None</i>
|
||||
</xsl:if>
|
||||
<xsl:for-each select="DependsUpon/Package">
|
||||
<a>
|
||||
<xsl:attribute name="href">#PK<xsl:value-of select="node()"/></xsl:attribute>
|
||||
<xsl:value-of select="node()"/>
|
||||
</a><br/>
|
||||
</xsl:for-each>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</xsl:if>
|
||||
</xsl:for-each>
|
||||
|
||||
<table width="100%"><tr><td>
|
||||
<a name="NVcycles"><h2>Cycles</h2></a>
|
||||
</td><td align="right">
|
||||
[<a href="#NVsummary">summary</a>]
|
||||
[<a href="#NVpackages">packages</a>]
|
||||
[<a href="#NVcycles">cycles</a>]
|
||||
[<a href="#NVexplanations">explanations</a>]
|
||||
</td></tr></table>
|
||||
|
||||
<xsl:if test="count(Cycles/Package) = 0">
|
||||
<p>There are no cyclic dependancies.</p>
|
||||
</xsl:if>
|
||||
<xsl:for-each select="Cycles/Package">
|
||||
<h3><xsl:value-of select="@Name"/></h3><p>
|
||||
<xsl:for-each select="Package">
|
||||
<xsl:value-of select="."/><br/>
|
||||
</xsl:for-each></p>
|
||||
</xsl:for-each>
|
||||
|
||||
<table width="100%"><tr><td>
|
||||
<a name="NVexplanations"><h2>Explanations</h2></a>
|
||||
</td><td align="right">
|
||||
[<a href="#NVsummary">summary</a>]
|
||||
[<a href="#NVpackages">packages</a>]
|
||||
[<a href="#NVcycles">cycles</a>]
|
||||
[<a href="#NVexplanations">explanations</a>]
|
||||
</td></tr></table>
|
||||
|
||||
<p>The following explanations are for quick reference and are lifted directly from the original <a href="http://www.clarkware.com/software/JDepend.html">JDepend documentation</a>.</p>
|
||||
|
||||
<h3><a name="EXnumber">Number of Classes</a></h3>
|
||||
<p>The number of concrete and abstract classes (and interfaces) in the package is an indicator of the extensibility of the package.</p>
|
||||
<h3><a name="EXafferent">Afferent Couplings</a></h3>
|
||||
<p>The number of other packages that depend upon classes within the package is an indicator of the package's responsibility. </p>
|
||||
<h3><a name="EXefferent">Efferent Couplings</a></h3>
|
||||
<p>The number of other packages that the classes in the package depend upon is an indicator of the package's independence. </p>
|
||||
<h3><a name="EXabstractness">Abstractness</a></h3>
|
||||
<p>The ratio of the number of abstract classes (and interfaces) in the analyzed package to the total number of classes in the analyzed package. </p>
|
||||
<p>The range for this metric is 0 to 1, with A=0 indicating a completely concrete package and A=1 indicating a completely abstract package. </p>
|
||||
<h3><a name="EXinstability">Instability</a></h3>
|
||||
<p>The ratio of efferent coupling (Ce) to total coupling (Ce / (Ce + Ca)). This metric is an indicator of the package's resilience to change. </p>
|
||||
<p>The range for this metric is 0 to 1, with I=0 indicating a completely stable package and I=1 indicating a completely instable package. </p>
|
||||
<h3><a name="EXdistance">Distance</a></h3>
|
||||
<p>The perpendicular distance of a package from the idealized line A + I = 1. This metric is an indicator of the package's balance between abstractness and stability. </p>
|
||||
<p>A package squarely on the main sequence is optimally balanced with respect to its abstractness and stability. Ideal packages are either completely abstract and stable (x=0, y=1) or completely concrete and instable (x=1, y=0). </p>
|
||||
<p>The range for this metric is 0 to 1, with D=0 indicating a package that is coincident with the main sequence and D=1 indicating a package that is as far from the main sequence as possible. </p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
537
legal/LICENSE
537
legal/LICENSE
@ -1,537 +0,0 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
|
||||
APACHE POI SUBCOMPONENTS:
|
||||
|
||||
Apache POI includes subcomponents with separate copyright notices and
|
||||
license terms. Your use of these subcomponents is subject to the terms
|
||||
and conditions of the following licenses:
|
||||
|
||||
|
||||
Office Open XML schemas (ooxml-schemas-1.*.jar)
|
||||
|
||||
The Office Open XML schema definitions used by Apache POI are
|
||||
a part of the Office Open XML ECMA Specification (ECMA-376, [1]).
|
||||
As defined in section 9.4 of the ECMA bylaws [2], this specification
|
||||
is available to all interested parties without restriction:
|
||||
|
||||
9.4 All documents when approved shall be made available to
|
||||
all interested parties without restriction.
|
||||
|
||||
Furthermore, both Microsoft and Adobe have granted patent licenses
|
||||
to this work [3,4,5].
|
||||
|
||||
[1] http://www.ecma-international.org/publications/standards/Ecma-376.htm
|
||||
[2] http://www.ecma-international.org/memento/Ecmabylaws.htm
|
||||
[3] http://www.microsoft.com/openspecifications/en/us/programs/osp/default.aspx
|
||||
[4] http://www.ecma-international.org/publications/files/ECMA-ST/Ecma%20PATENT/
|
||||
Patent%20statements%20ok/ECMA-376%20Edition%202%20Microsoft%20Patent%20Declaration.pdf
|
||||
[5] http://www.ecma-international.org/publications/files/ECMA-ST/Ecma%20PATENT/
|
||||
Patent%20statements%20ok/ECMA-376%20Adobe%20Patent%20Declaration.pdf
|
||||
|
||||
|
||||
Bouncy Castle library (bcprov-*.jar, bcpg-*.jar, bcpkix-*.jar)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to
|
||||
deal in the Software without restriction, including without limitation the
|
||||
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
sell copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
IN THE SOFTWARE.
|
||||
|
||||
JUnit test library (junit-4.*.jar) & JaCoCo (*jacoco*)
|
||||
|
||||
Eclipse Public License - v 1.0
|
||||
|
||||
THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC
|
||||
LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM
|
||||
CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
|
||||
|
||||
1. DEFINITIONS
|
||||
|
||||
"Contribution" means:
|
||||
|
||||
a) in the case of the initial Contributor, the initial code and documentation
|
||||
distributed under this Agreement, and
|
||||
b) in the case of each subsequent Contributor:
|
||||
i) changes to the Program, and
|
||||
ii) additions to the Program;
|
||||
where such changes and/or additions to the Program originate from and are
|
||||
distributed by that particular Contributor. A Contribution 'originates' from
|
||||
a Contributor if it was added to the Program by such Contributor itself or
|
||||
anyone acting on such Contributor's behalf. Contributions do not include
|
||||
additions to the Program which: (i) are separate modules of software
|
||||
distributed in conjunction with the Program under their own license agreement,
|
||||
and (ii) are not derivative works of the Program.
|
||||
|
||||
"Contributor" means any person or entity that distributes the Program.
|
||||
|
||||
"Licensed Patents" mean patent claims licensable by a Contributor which are
|
||||
necessarily infringed by the use or sale of its Contribution alone or when
|
||||
combined with the Program.
|
||||
|
||||
"Program" means the Contributions distributed in accordance with this Agreement.
|
||||
|
||||
"Recipient" means anyone who receives the Program under this Agreement,
|
||||
including all Contributors.
|
||||
|
||||
2. GRANT OF RIGHTS
|
||||
|
||||
a) Subject to the terms of this Agreement, each Contributor hereby grants
|
||||
Recipient a non-exclusive, worldwide, royalty-free copyright license to
|
||||
reproduce, prepare derivative works of, publicly display, publicly
|
||||
perform, distribute and sublicense the Contribution of such Contributor,
|
||||
if any, and such derivative works, in source code and object code form.
|
||||
b) Subject to the terms of this Agreement, each Contributor hereby grants
|
||||
Recipient a non-exclusive, worldwide, royalty-free patent license under
|
||||
Licensed Patents to make, use, sell, offer to sell, import and otherwise
|
||||
transfer the Contribution of such Contributor, if any, in source code
|
||||
and object code form. This patent license shall apply to the combination
|
||||
of the Contribution and the Program if, at the time the Contribution is
|
||||
added by the Contributor, such addition of the Contribution causes such
|
||||
combination to be covered by the Licensed Patents. The patent license
|
||||
shall not apply to any other combinations which include the Contribution.
|
||||
No hardware per se is licensed hereunder.
|
||||
c) Recipient understands that although each Contributor grants the licenses
|
||||
to its Contributions set forth herein, no assurances are provided by any
|
||||
Contributor that the Program does not infringe the patent or other
|
||||
intellectual property rights of any other entity. Each Contributor
|
||||
disclaims any liability to Recipient for claims brought by any other
|
||||
entity based on infringement of intellectual property rights or
|
||||
otherwise. As a condition to exercising the rights and licenses granted
|
||||
hereunder, each Recipient hereby assumes sole responsibility to secure
|
||||
any other intellectual property rights needed, if any. For example, if
|
||||
a third party patent license is required to allow Recipient to distribute
|
||||
the Program, it is Recipient's responsibility to acquire that license
|
||||
before distributing the Program.
|
||||
d) Each Contributor represents that to its knowledge it has sufficient
|
||||
copyright rights in its Contribution, if any, to grant the copyright
|
||||
license set forth in this Agreement.
|
||||
|
||||
3. REQUIREMENTS
|
||||
|
||||
A Contributor may choose to distribute the Program in object code form under
|
||||
its own license agreement, provided that:
|
||||
|
||||
a) it complies with the terms and conditions of this Agreement; and
|
||||
b) its license agreement:
|
||||
i) effectively disclaims on behalf of all Contributors all warranties and
|
||||
conditions, express and implied, including warranties or conditions of
|
||||
title and non-infringement, and implied warranties or conditions of
|
||||
merchantability and fitness for a particular purpose;
|
||||
ii) effectively excludes on behalf of all Contributors all liability for
|
||||
damages, including direct, indirect, special, incidental and
|
||||
consequential damages, such as lost profits;
|
||||
iii) states that any provisions which differ from this Agreement are
|
||||
offered by that Contributor alone and not by any other party; and
|
||||
iv) states that source code for the Program is available from such
|
||||
Contributor, and informs licensees how to obtain it in a reasonable
|
||||
manner on or through a medium customarily used for software exchange.
|
||||
|
||||
When the Program is made available in source code form:
|
||||
|
||||
a) it must be made available under this Agreement; and
|
||||
b) a copy of this Agreement must be included with each copy of the Program.
|
||||
Contributors may not remove or alter any copyright notices contained
|
||||
within the Program.
|
||||
|
||||
Each Contributor must identify itself as the originator of its Contribution,
|
||||
if any, in a manner that reasonably allows subsequent Recipients to identify
|
||||
the originator of the Contribution.
|
||||
|
||||
4. COMMERCIAL DISTRIBUTION
|
||||
|
||||
Commercial distributors of software may accept certain responsibilities with
|
||||
respect to end users, business partners and the like. While this license is
|
||||
intended to facilitate the commercial use of the Program, the Contributor
|
||||
who includes the Program in a commercial product offering should do so in a
|
||||
manner which does not create potential liability for other Contributors.
|
||||
Therefore, if a Contributor includes the Program in a commercial product
|
||||
offering, such Contributor ("Commercial Contributor") hereby agrees to
|
||||
defend and indemnify every other Contributor ("Indemnified Contributor")
|
||||
against any losses, damages and costs (collectively "Losses") arising from
|
||||
claims, lawsuits and other legal actions brought by a third party against
|
||||
the Indemnified Contributor to the extent caused by the acts or omissions
|
||||
of such Commercial Contributor in connection with its distribution of the
|
||||
Program in a commercial product offering. The obligations in this section
|
||||
do not apply to any claims or Losses relating to any actual or alleged
|
||||
intellectual property infringement. In order to qualify, an Indemnified
|
||||
Contributor must: a) promptly notify the Commercial Contributor in writing
|
||||
of such claim, and b) allow the Commercial Contributor to control, and
|
||||
cooperate with the Commercial Contributor in, the defense and any related
|
||||
settlement negotiations. The Indemnified Contributor may participate in any
|
||||
such claim at its own expense.
|
||||
|
||||
For example, a Contributor might include the Program in a commercial product
|
||||
offering, Product X. That Contributor is then a Commercial Contributor. If
|
||||
that Commercial Contributor then makes performance claims, or offers
|
||||
warranties related to Product X, those performance claims and warranties are
|
||||
such Commercial Contributor's responsibility alone. Under this section, the
|
||||
Commercial Contributor would have to defend claims against the other
|
||||
Contributors related to those performance claims and warranties, and if a
|
||||
court requires any other Contributor to pay any damages as a result, the
|
||||
Commercial Contributor must pay those damages.
|
||||
|
||||
5. NO WARRANTY
|
||||
|
||||
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON
|
||||
AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER
|
||||
EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR
|
||||
CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
|
||||
PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the
|
||||
appropriateness of using and distributing the Program and assumes all risks
|
||||
associated with its exercise of rights under this Agreement , including but
|
||||
not limited to the risks and costs of program errors, compliance with
|
||||
applicable laws, damage to or loss of data, programs or equipment, and
|
||||
unavailability or interruption of operations.
|
||||
|
||||
6. DISCLAIMER OF LIABILITY
|
||||
|
||||
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY
|
||||
CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION
|
||||
LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE
|
||||
EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
OF SUCH DAMAGES.
|
||||
|
||||
7. GENERAL
|
||||
|
||||
If any provision of this Agreement is invalid or unenforceable under
|
||||
applicable law, it shall not affect the validity or enforceability of the
|
||||
remainder of the terms of this Agreement, and without further action by the
|
||||
parties hereto, such provision shall be reformed to the minimum extent
|
||||
necessary to make such provision valid and enforceable.
|
||||
|
||||
If Recipient institutes patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Program itself
|
||||
(excluding combinations of the Program with other software or hardware)
|
||||
infringes such Recipient's patent(s), then such Recipient's rights granted
|
||||
under Section 2(b) shall terminate as of the date such litigation is filed.
|
||||
|
||||
All Recipient's rights under this Agreement shall terminate if it fails to
|
||||
comply with any of the material terms or conditions of this Agreement and
|
||||
does not cure such failure in a reasonable period of time after becoming
|
||||
aware of such noncompliance. If all Recipient's rights under this Agreement
|
||||
terminate, Recipient agrees to cease use and distribution of the Program as
|
||||
soon as reasonably practicable. However, Recipient's obligations under this
|
||||
Agreement and any licenses granted by Recipient relating to the Program
|
||||
shall continue and survive.
|
||||
|
||||
Everyone is permitted to copy and distribute copies of this Agreement, but
|
||||
in order to avoid inconsistency the Agreement is copyrighted and may only
|
||||
be modified in the following manner. The Agreement Steward reserves the
|
||||
right to publish new versions (including revisions) of this Agreement from
|
||||
time to time. No one other than the Agreement Steward has the right to
|
||||
modify this Agreement. The Eclipse Foundation is the initial Agreement
|
||||
Steward. The Eclipse Foundation may assign the responsibility to serve as
|
||||
the Agreement Steward to a suitable separate entity. Each new version of
|
||||
the Agreement will be given a distinguishing version number. The Program
|
||||
(including Contributions) may always be distributed subject to the version
|
||||
of the Agreement under which it was received. In addition, after a new
|
||||
version of the Agreement is published, Contributor may elect to distribute
|
||||
the Program (including its Contributions) under the new version. Except as
|
||||
expressly stated in Sections 2(a) and 2(b) above, Recipient receives no
|
||||
rights or licenses to the intellectual property of any Contributor under
|
||||
this Agreement, whether expressly, by implication, estoppel or otherwise.
|
||||
All rights in the Program not expressly granted under this Agreement are
|
||||
reserved.
|
||||
|
||||
This Agreement is governed by the laws of the State of New York and the
|
||||
intellectual property laws of the United States of America. No party to this
|
||||
Agreement will bring a legal action under this Agreement more than one year
|
||||
after the cause of action arose. Each party waives its rights to a jury
|
||||
trial in any resulting litigation.
|
||||
|
||||
Hamcrest library (hamcrest-*.jar) & CuvesAPI / Curve API
|
||||
|
||||
BSD License
|
||||
|
||||
Copyright (c) 2000-2006, www.hamcrest.org
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer. Redistributions in binary
|
||||
form must reproduce the above copyright notice, this list of conditions and
|
||||
the following disclaimer in the documentation and/or other materials
|
||||
provided with the distribution.
|
||||
|
||||
Neither the name of Hamcrest nor the names of its contributors may be used
|
||||
to endorse or promote products derived from this software without specific
|
||||
prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
SLF4J library (slf4j-api-*.jar)
|
||||
|
||||
Copyright (c) 2004-2013 QOS.ch
|
||||
All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
inbot-utils (https://github.com/Inbot/inbot-utils)
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Inbot
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
48
legal/LICENSE.ant
Normal file
48
legal/LICENSE.ant
Normal file
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* ============================================================================
|
||||
* The Apache Software License, Version 1.1
|
||||
* ============================================================================
|
||||
*
|
||||
* Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modifica-
|
||||
* tion, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. The end-user documentation included with the redistribution, if any, must
|
||||
* include the following acknowledgment: "This product includes software
|
||||
* developed by the Apache Software Foundation (http://www.apache.org/)."
|
||||
* Alternately, this acknowledgment may appear in the software itself, if
|
||||
* and wherever such third-party acknowledgments normally appear.
|
||||
*
|
||||
* 4. The names "Ant" and "Apache Software Foundation" must not be used to
|
||||
* endorse or promote products derived from this software without prior
|
||||
* written permission. For written permission, please contact
|
||||
* apache@apache.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "Apache", nor may
|
||||
* "Apache" appear in their name, without prior written permission of the
|
||||
* Apache Software Foundation.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
|
||||
* DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* on behalf of the Apache Software Foundation. For more information on the
|
||||
* Apache Software Foundation, please see <http://www.apache.org/>.
|
||||
*
|
||||
*/
|
65
legal/LICENSE.commons-logging
Normal file
65
legal/LICENSE.commons-logging
Normal file
@ -0,0 +1,65 @@
|
||||
/*
|
||||
* $Header$
|
||||
* $Revision$
|
||||
* $Date$
|
||||
*
|
||||
* ====================================================================
|
||||
*
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
* Copyright (c) 1999-2001 The Apache Software Foundation. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. The end-user documentation included with the redistribution, if
|
||||
* any, must include the following acknowlegement:
|
||||
* "This product includes software developed by the
|
||||
* Apache Software Foundation (http://www.apache.org/)."
|
||||
* Alternately, this acknowlegement may appear in the software itself,
|
||||
* if and wherever such third-party acknowlegements normally appear.
|
||||
*
|
||||
* 4. The names "The Jakarta Project", "Commons", and "Apache Software
|
||||
* Foundation" must not be used to endorse or promote products derived
|
||||
* from this software without prior written permission. For written
|
||||
* permission, please contact apache@apache.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "Apache"
|
||||
* nor may "Apache" appear in their names without prior written
|
||||
* permission of the Apache Group.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Software Foundation. For more
|
||||
* information on the Apache Software Foundation, please see
|
||||
* <http://www.apache.org/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
55
legal/LICENSE.xalan
Normal file
55
legal/LICENSE.xalan
Normal file
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
* Copyright (c) 1999 The Apache Software Foundation. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. The end-user documentation included with the redistribution,
|
||||
* if any, must include the following acknowledgment:
|
||||
* "This product includes software developed by the
|
||||
* Apache Software Foundation (http://www.apache.org/)."
|
||||
* Alternately, this acknowledgment may appear in the software itself,
|
||||
* if and wherever such third-party acknowledgments normally appear.
|
||||
*
|
||||
* 4. The names "Xalan" and "Apache Software Foundation" must
|
||||
* not be used to endorse or promote products derived from this
|
||||
* software without prior written permission. For written
|
||||
* permission, please contact apache@apache.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "Apache",
|
||||
* nor may "Apache" appear in their name, without prior written
|
||||
* permission of the Apache Software Foundation.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Software Foundation and was
|
||||
* originally based on software copyright (c) 1999, Lotus
|
||||
* Development Corporation., http://www.lotus.com. For more
|
||||
* information on the Apache Software Foundation, please see
|
||||
* <http://www.apache.org/>.
|
||||
*/
|
56
legal/LICENSE.xerces
Normal file
56
legal/LICENSE.xerces
Normal file
@ -0,0 +1,56 @@
|
||||
/*
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
*
|
||||
* Copyright (c) 1999 The Apache Software Foundation. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. The end-user documentation included with the redistribution,
|
||||
* if any, must include the following acknowledgment:
|
||||
* "This product includes software developed by the
|
||||
* Apache Software Foundation (http://www.apache.org/)."
|
||||
* Alternately, this acknowledgment may appear in the software itself,
|
||||
* if and wherever such third-party acknowledgments normally appear.
|
||||
*
|
||||
* 4. The names "Xerces" and "Apache Software Foundation" must
|
||||
* not be used to endorse or promote products derived from this
|
||||
* software without prior written permission. For written
|
||||
* permission, please contact apache@apache.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "Apache",
|
||||
* nor may "Apache" appear in their name, without prior written
|
||||
* permission of the Apache Software Foundation.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Software Foundation and was
|
||||
* originally based on software copyright (c) 1999, International
|
||||
* Business Machines, Inc., http://www.ibm.com. For more
|
||||
* information on the Apache Software Foundation, please see
|
||||
* <http://www.apache.org/>.
|
||||
*/
|
10
legal/LICENSE.xml-apis
Normal file
10
legal/LICENSE.xml-apis
Normal file
@ -0,0 +1,10 @@
|
||||
|
||||
|
||||
xml-apis is covered by The Apache Software License, Version 1.1
|
||||
|
||||
|
||||
|
||||
FIXME: Put license text in here once it is available at
|
||||
|
||||
http://cvs.apache.org/viewcvs.cgi/xml-commons/
|
||||
|
27
legal/NOTICE
27
legal/NOTICE
@ -1,27 +0,0 @@
|
||||
Apache POI
|
||||
Copyright 2003-2017 The Apache Software Foundation
|
||||
|
||||
This product includes software developed by
|
||||
The Apache Software Foundation (https://www.apache.org/).
|
||||
|
||||
This product contains parts that were originally based on software from BEA.
|
||||
Copyright (c) 2000-2003, BEA Systems, <http://www.bea.com/> (dead link),
|
||||
which was acquired by Oracle Corporation in 2008.
|
||||
<http://www.oracle.com/us/corporate/Acquisitions/bea/index.html>
|
||||
<https://en.wikipedia.org/wiki/BEA_Systems>
|
||||
|
||||
This product contains W3C XML Schema documents. Copyright 2001-2003 (c)
|
||||
World Wide Web Consortium (Massachusetts Institute of Technology, European
|
||||
Research Consortium for Informatics and Mathematics, Keio University)
|
||||
|
||||
This product contains the Piccolo XML Parser for Java
|
||||
(http://piccolo.sourceforge.net/). Copyright 2002 Yuval Oren.
|
||||
|
||||
This product contains the chunks_parse_cmds.tbl file from the vsdump program.
|
||||
Copyright (C) 2006-2007 Valek Filippov (frob@df.ru)
|
||||
|
||||
This product contains parts of the eID Applet project
|
||||
<http://eid-applet.googlecode.com> and <https://github.com/e-Contract/eid-applet>.
|
||||
Copyright (c) 2009-2014
|
||||
FedICT (federal ICT department of Belgium), e-Contract.be BVBA (https://www.e-contract.be),
|
||||
Bart Hanssens from FedICT
|
1
lib/.cvsignore
Normal file
1
lib/.cvsignore
Normal file
@ -0,0 +1 @@
|
||||
*.jar
|
101
pom.xml
101
pom.xml
@ -1,101 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
-->
|
||||
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<parent>
|
||||
<groupId>org.sonatype.oss</groupId>
|
||||
<artifactId>oss-parent</artifactId>
|
||||
<version>9</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.moparisthebest.poi</groupId>
|
||||
<artifactId>poi-fast-calc</artifactId>
|
||||
<version>3.17-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
<name>POI Fast Calc</name>
|
||||
<url>https://code.moparisthebest.com/moparisthebest/poi</url>
|
||||
<description>POI Fast Calc - Java API To Calculate Excel formulas quickly</description>
|
||||
|
||||
<licenses>
|
||||
<license>
|
||||
<name>The Apache Software License, Version 2.0</name>
|
||||
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
|
||||
</license>
|
||||
</licenses>
|
||||
|
||||
<organization>
|
||||
<name>moparisthebest.com</name>
|
||||
<url>https://www.moparisthebest.com</url>
|
||||
</organization>
|
||||
|
||||
<scm>
|
||||
<connection>scm:git:https://code.moparisthebest.com/moparisthebest/poi.git</connection>
|
||||
<developerConnection>scm:git:https://code.moparisthebest.com/moparisthebest/poi.git</developerConnection>
|
||||
<url>https://code.moparisthebest.com/moparisthebest/poi</url>
|
||||
</scm>
|
||||
|
||||
<properties>
|
||||
<java.version>1.6</java.version>
|
||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<pushChanges>false</pushChanges>
|
||||
<localCheckout>true</localCheckout>
|
||||
|
||||
<!-- default argline for junit tests, java 9+ requires much less memory than 6/7/8, but more runs faster -->
|
||||
<test.argLine>-Xmx4096m</test.argLine>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<scope>test</scope>
|
||||
<version>4.12</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.22.1</version>
|
||||
<configuration>
|
||||
<verbose>true</verbose>
|
||||
<fork>true</fork>
|
||||
<argLine>${test.argLine}</argLine>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.sonatype.plugins</groupId>
|
||||
<artifactId>nexus-staging-maven-plugin</artifactId>
|
||||
<version>1.6.5</version>
|
||||
<extensions>true</extensions>
|
||||
<configuration>
|
||||
<serverId>ossrh</serverId>
|
||||
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
|
||||
<autoReleaseAfterClose>true</autoReleaseAfterClose>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
1
src/contrib/lib/.cvsignore
Normal file
1
src/contrib/lib/.cvsignore
Normal file
@ -0,0 +1 @@
|
||||
*.jar
|
@ -0,0 +1,81 @@
|
||||
/* ====================================================================
|
||||
Copyright 2003-2004 Apache Software Foundation
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
==================================================================== */
|
||||
|
||||
package org.apache.poi.contrib.metrics;
|
||||
|
||||
import java.awt.*;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Properties;
|
||||
|
||||
public class FontMetricsDumper
|
||||
{
|
||||
public static void main( String[] args ) throws IOException
|
||||
{
|
||||
|
||||
Properties props = new Properties();
|
||||
|
||||
Font[] allFonts = GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts();
|
||||
for ( int i = 0; i < allFonts.length; i++ )
|
||||
{
|
||||
String fontName = allFonts[i].getFontName();
|
||||
|
||||
Font font = new Font(fontName, Font.BOLD, 10);
|
||||
FontMetrics fontMetrics = Toolkit.getDefaultToolkit().getFontMetrics(font);
|
||||
int fontHeight = fontMetrics.getHeight();
|
||||
|
||||
props.setProperty("font." + fontName + ".height", fontHeight+"");
|
||||
StringBuffer characters = new StringBuffer();
|
||||
for (char c = 'a'; c <= 'z'; c++)
|
||||
{
|
||||
characters.append( c + ", " );
|
||||
}
|
||||
for (char c = 'A'; c <= 'Z'; c++)
|
||||
{
|
||||
characters.append( c + ", " );
|
||||
}
|
||||
for (char c = '0'; c <= '9'; c++)
|
||||
{
|
||||
characters.append( c + ", " );
|
||||
}
|
||||
StringBuffer widths = new StringBuffer();
|
||||
for (char c = 'a'; c <= 'z'; c++)
|
||||
{
|
||||
widths.append( fontMetrics.getWidths()[c] + ", " );
|
||||
}
|
||||
for (char c = 'A'; c <= 'Z'; c++)
|
||||
{
|
||||
widths.append( fontMetrics.getWidths()[c] + ", " );
|
||||
}
|
||||
for (char c = '0'; c <= '9'; c++)
|
||||
{
|
||||
widths.append( fontMetrics.getWidths()[c] + ", " );
|
||||
}
|
||||
props.setProperty("font." + fontName + ".characters", characters.toString());
|
||||
props.setProperty("font." + fontName + ".widths", widths.toString());
|
||||
}
|
||||
|
||||
FileOutputStream fileOut = new FileOutputStream("font_metrics.properties");
|
||||
try
|
||||
{
|
||||
props.store(fileOut, "Font Metrics");
|
||||
}
|
||||
finally
|
||||
{
|
||||
fileOut.close();
|
||||
}
|
||||
}
|
||||
}
|
246
src/contrib/src/org/apache/poi/contrib/poibrowser/Codec.java
Normal file
246
src/contrib/src/org/apache/poi/contrib/poibrowser/Codec.java
Normal file
@ -0,0 +1,246 @@
|
||||
|
||||
/* ====================================================================
|
||||
Copyright 2002-2004 Apache Software Foundation
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
==================================================================== */
|
||||
|
||||
|
||||
package org.apache.poi.contrib.poibrowser;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
import org.apache.poi.hpsf.ClassID;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* <p>Provides utility methods for encoding and decoding hexadecimal
|
||||
* data.</p>
|
||||
*
|
||||
* @author Rainer Klute (klute@rainer-klute.de) - with portions from Tomcat
|
||||
* @version $Id$
|
||||
* @since 2002-01-24
|
||||
*/
|
||||
public class Codec
|
||||
{
|
||||
|
||||
/**
|
||||
* <p>The nibbles' hexadecimal values. A nibble is a half byte.</p>
|
||||
*/
|
||||
protected static final byte hexval[] =
|
||||
{(byte) '0', (byte) '1', (byte) '2', (byte) '3',
|
||||
(byte) '4', (byte) '5', (byte) '6', (byte) '7',
|
||||
(byte) '8', (byte) '9', (byte) 'A', (byte) 'B',
|
||||
(byte) 'C', (byte) 'D', (byte) 'E', (byte) 'F'};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* <p>Converts a string into its hexadecimal notation.</p>
|
||||
*
|
||||
* <p><strong>FIXME:</strong> If this method is called frequently,
|
||||
* it should directly implement the algorithm in the called method
|
||||
* in order to avoid creating a string instance.</p>
|
||||
*/
|
||||
public static String hexEncode(final String s)
|
||||
{
|
||||
return hexEncode(s.getBytes());
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* <p>Converts a byte array into its hexadecimal notation.</p>
|
||||
*/
|
||||
public static String hexEncode(final byte[] s)
|
||||
{
|
||||
return hexEncode(s, 0, s.length);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* <p>Converts a part of a byte array into its hexadecimal
|
||||
* notation.</p>
|
||||
*/
|
||||
public static String hexEncode(final byte[] s, final int offset,
|
||||
final int length)
|
||||
{
|
||||
StringBuffer b = new StringBuffer(length * 2);
|
||||
for (int i = offset; i < offset + length; i++)
|
||||
{
|
||||
int c = s[i];
|
||||
b.append((char) hexval[(c & 0xF0) >> 4]);
|
||||
b.append((char) hexval[(c & 0x0F) >> 0]);
|
||||
}
|
||||
return b.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* <p>Converts a single byte into its hexadecimal notation.</p>
|
||||
*/
|
||||
public static String hexEncode(final byte b)
|
||||
{
|
||||
StringBuffer sb = new StringBuffer(2);
|
||||
sb.append((char) hexval[(b & 0xF0) >> 4]);
|
||||
sb.append((char) hexval[(b & 0x0F) >> 0]);
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* <p>Converts a short value (16-bit) into its hexadecimal
|
||||
* notation.</p>
|
||||
*/
|
||||
public static String hexEncode(final short s)
|
||||
{
|
||||
StringBuffer sb = new StringBuffer(4);
|
||||
sb.append((char) hexval[(s & 0xF000) >> 12]);
|
||||
sb.append((char) hexval[(s & 0x0F00) >> 8]);
|
||||
sb.append((char) hexval[(s & 0x00F0) >> 4]);
|
||||
sb.append((char) hexval[(s & 0x000F) >> 0]);
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* <p>Converts an int value (32-bit) into its hexadecimal
|
||||
* notation.</p>
|
||||
*/
|
||||
public static String hexEncode(final int i)
|
||||
{
|
||||
StringBuffer sb = new StringBuffer(8);
|
||||
sb.append((char) hexval[(i & 0xF0000000) >> 28]);
|
||||
sb.append((char) hexval[(i & 0x0F000000) >> 24]);
|
||||
sb.append((char) hexval[(i & 0x00F00000) >> 20]);
|
||||
sb.append((char) hexval[(i & 0x000F0000) >> 16]);
|
||||
sb.append((char) hexval[(i & 0x0000F000) >> 12]);
|
||||
sb.append((char) hexval[(i & 0x00000F00) >> 8]);
|
||||
sb.append((char) hexval[(i & 0x000000F0) >> 4]);
|
||||
sb.append((char) hexval[(i & 0x0000000F) >> 0]);
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* <p>Converts a long value (64-bit) into its hexadecimal
|
||||
* notation.</p>
|
||||
*/
|
||||
public static String hexEncode(final long l)
|
||||
{
|
||||
StringBuffer sb = new StringBuffer(16);
|
||||
sb.append(hexEncode((int) (l & 0xFFFFFFFF00000000L) >> 32));
|
||||
sb.append(hexEncode((int) (l & 0x00000000FFFFFFFFL) >> 0));
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* <p>Converts a class ID into its hexadecimal notation.</p>
|
||||
*/
|
||||
public static String hexEncode(final ClassID classID)
|
||||
{
|
||||
return hexEncode(classID.getBytes());
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* <p>Decodes the hexadecimal representation of a sequence of
|
||||
* bytes into a byte array. Each character in the string
|
||||
* represents a nibble (half byte) and must be one of the
|
||||
* characters '0'-'9', 'A'-'F' or 'a'-'f'.</p>
|
||||
*
|
||||
* @param s The string to be decoded
|
||||
*
|
||||
* @return The bytes
|
||||
*
|
||||
* @throw IllegalArgumentException if the string does not contain
|
||||
* a valid representation of a byte sequence.
|
||||
*/
|
||||
public static byte[] hexDecode(final String s)
|
||||
{
|
||||
final int length = s.length();
|
||||
|
||||
/* The string to be converted must have an even number of
|
||||
characters. */
|
||||
if (length % 2 == 1)
|
||||
throw new IllegalArgumentException
|
||||
("String has odd length " + length);
|
||||
byte[] b = new byte[length / 2];
|
||||
char[] c = new char[length];
|
||||
s.toUpperCase().getChars(0, length, c, 0);
|
||||
for (int i = 0; i < length; i += 2)
|
||||
b[i/2] = (byte) (decodeNibble(c[i]) << 4 & 0xF0 |
|
||||
decodeNibble(c[i+1]) & 0x0F);
|
||||
return b;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* <p>Decodes a nibble.</p>
|
||||
*
|
||||
* @param c A character in the range '0'-'9' or 'A'-'F'. Lower
|
||||
* case is not supported here.
|
||||
*
|
||||
* @return The decoded nibble in the range 0-15
|
||||
*
|
||||
* @throws IllegalArgumentException if <em>c</em> is not a
|
||||
* permitted character
|
||||
*/
|
||||
protected static byte decodeNibble(final char c)
|
||||
{
|
||||
for (byte i = 0; i < hexval.length; i++)
|
||||
if ((byte) c == hexval[i])
|
||||
return i;
|
||||
throw new IllegalArgumentException("\"" + c + "\"" +
|
||||
" does not represent a nibble.");
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* <p>For testing.</p>
|
||||
*/
|
||||
public static void main(final String args[])
|
||||
throws IOException
|
||||
{
|
||||
final BufferedReader in =
|
||||
new BufferedReader(new InputStreamReader(System.in));
|
||||
String s;
|
||||
do
|
||||
{
|
||||
s = in.readLine();
|
||||
if (s != null)
|
||||
{
|
||||
String bytes = hexEncode(s);
|
||||
System.out.print("Hex encoded (String): ");
|
||||
System.out.println(bytes);
|
||||
System.out.print("Hex encoded (byte[]): ");
|
||||
System.out.println(hexEncode(s.getBytes()));
|
||||
System.out.print("Re-decoded (byte[]): ");
|
||||
System.out.println(new String(hexDecode(bytes)));
|
||||
}
|
||||
}
|
||||
while (s != null);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,81 @@
|
||||
|
||||
/* ====================================================================
|
||||
Copyright 2002-2004 Apache Software Foundation
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
==================================================================== */
|
||||
|
||||
|
||||
package org.apache.poi.contrib.poibrowser;
|
||||
|
||||
import java.io.*;
|
||||
import org.apache.poi.poifs.filesystem.*;
|
||||
|
||||
/**
|
||||
* <p>Describes the most important (whatever that is) features of a
|
||||
* {@link POIFSDocument}.</p>
|
||||
*
|
||||
* @author Rainer Klute (klute@rainer-klute.de)
|
||||
* @version $Id$
|
||||
* @since 2002-02-05
|
||||
*/
|
||||
public class DocumentDescriptor
|
||||
{
|
||||
String name;
|
||||
POIFSDocumentPath path;
|
||||
DocumentInputStream stream;
|
||||
|
||||
int size;
|
||||
byte[] bytes;
|
||||
|
||||
|
||||
/**
|
||||
* <p>Creates a {@link DocumentDescriptor}.</p>
|
||||
*
|
||||
* @param name The stream's name.
|
||||
*
|
||||
* @param path The stream's path in the POI filesystem hierarchy.
|
||||
*
|
||||
* @param stream The stream.
|
||||
*
|
||||
* @param nrOfBytes The maximum number of bytes to display in a
|
||||
* dump starting at the beginning of the stream.
|
||||
*/
|
||||
public DocumentDescriptor(final String name,
|
||||
final POIFSDocumentPath path,
|
||||
final DocumentInputStream stream,
|
||||
final int nrOfBytes)
|
||||
{
|
||||
this.name = name;
|
||||
this.path = path;
|
||||
this.stream = stream;
|
||||
try
|
||||
{
|
||||
size = stream.available();
|
||||
if (stream.markSupported())
|
||||
{
|
||||
stream.mark(nrOfBytes);
|
||||
final byte[] b = new byte[nrOfBytes];
|
||||
final int read = stream.read(b, 0, Math.min(size, b.length));
|
||||
bytes = new byte[read];
|
||||
System.arraycopy(b, 0, bytes, 0, read);
|
||||
stream.reset();
|
||||
}
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
System.out.println(ex);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,80 @@
|
||||
|
||||
/* ====================================================================
|
||||
Copyright 2002-2004 Apache Software Foundation
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
==================================================================== */
|
||||
|
||||
|
||||
package org.apache.poi.contrib.poibrowser;
|
||||
|
||||
import java.awt.*;
|
||||
import javax.swing.*;
|
||||
import javax.swing.tree.*;
|
||||
|
||||
/**
|
||||
* <p>{@link TreeCellRenderer} for a {@link DocumentDescriptor}. The
|
||||
* renderer is extremly rudimentary since displays only the document's
|
||||
* name, its size and its fist few bytes.</p>
|
||||
*
|
||||
* @author Rainer Klute (klute@rainer-klute.de)
|
||||
* @version $Id$
|
||||
* @since 2002-02-05
|
||||
*/
|
||||
public class DocumentDescriptorRenderer extends DefaultTreeCellRenderer
|
||||
{
|
||||
|
||||
public Component getTreeCellRendererComponent(final JTree tree,
|
||||
final Object value,
|
||||
final boolean selected,
|
||||
final boolean expanded,
|
||||
final boolean leaf,
|
||||
final int row,
|
||||
final boolean hasFocus)
|
||||
{
|
||||
final DocumentDescriptor d = (DocumentDescriptor)
|
||||
((DefaultMutableTreeNode) value).getUserObject();
|
||||
final JPanel p = new JPanel();
|
||||
final JTextArea text = new JTextArea();
|
||||
text.append(renderAsString(d));
|
||||
text.setFont(new Font("Monospaced", Font.PLAIN, 10));
|
||||
p.add(text);
|
||||
if (selected)
|
||||
Util.invert(text);
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* <p>Renders {@link DocumentDescriptor} as a string.</p>
|
||||
*/
|
||||
protected String renderAsString(final DocumentDescriptor d)
|
||||
{
|
||||
final StringBuffer b = new StringBuffer();
|
||||
b.append("Name: ");
|
||||
b.append(d.name);
|
||||
b.append(" (");
|
||||
b.append(Codec.hexEncode(d.name));
|
||||
b.append(") \n");
|
||||
|
||||
b.append("Size: ");
|
||||
b.append(d.size);
|
||||
b.append(" bytes\n");
|
||||
|
||||
b.append("First bytes: ");
|
||||
b.append(Codec.hexEncode(d.bytes));
|
||||
|
||||
return b.toString();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,147 @@
|
||||
|
||||
/* ====================================================================
|
||||
Copyright 2002-2004 Apache Software Foundation
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
==================================================================== */
|
||||
|
||||
|
||||
package org.apache.poi.contrib.poibrowser;
|
||||
|
||||
import java.awt.*;
|
||||
import javax.swing.*;
|
||||
import javax.swing.tree.*;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* <p>This is a {@link TreeCellRenderer} implementation which is able
|
||||
* to render arbitrary objects. The {@link ExtendableTreeCellRenderer}
|
||||
* does not do the rendering itself but instead dispatches to
|
||||
* class-specific renderers. A class/renderer pair must be registered
|
||||
* using the {@link #register} method. If a class has no registered
|
||||
* renderer, the renderer of its closest superclass is used. Since the
|
||||
* {@link ExtendableTreeCellRenderer} always has a default renderer
|
||||
* for the {@link Object} class, rendering is always possible. The
|
||||
* default {@link Object} renderer can be replaced by another renderer
|
||||
* but it cannot be unregistered.</p>
|
||||
*
|
||||
* @author Rainer Klute (klute@rainer-klute.de)
|
||||
* @version $Id$
|
||||
* @since 2002-01-22
|
||||
*/
|
||||
public class ExtendableTreeCellRenderer implements TreeCellRenderer
|
||||
{
|
||||
|
||||
/**
|
||||
* <p>Maps classes to renderers.</p>
|
||||
*/
|
||||
protected Map renderers;
|
||||
|
||||
|
||||
|
||||
public ExtendableTreeCellRenderer()
|
||||
{
|
||||
renderers = new HashMap();
|
||||
register(Object.class, new DefaultTreeCellRenderer()
|
||||
{
|
||||
public Component getTreeCellRendererComponent
|
||||
(JTree tree, Object value, boolean selected,
|
||||
boolean expanded, boolean leaf, int row, boolean hasFocus)
|
||||
{
|
||||
final String s = value.toString();
|
||||
final JLabel l = new JLabel(s + " ");
|
||||
if (selected)
|
||||
{
|
||||
Util.invert(l);
|
||||
l.setOpaque(true);
|
||||
}
|
||||
return l;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* <p>Registers a renderer for a class.</p>
|
||||
**/
|
||||
public void register(final Class c, final TreeCellRenderer renderer)
|
||||
{
|
||||
renderers.put(c, renderer);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* <p>Unregisters a renderer for a class. The renderer for the
|
||||
* {@link Object} class cannot be unregistered.</p>
|
||||
*/
|
||||
public void unregister(final Class c)
|
||||
{
|
||||
if (c == Object.class)
|
||||
throw new IllegalArgumentException
|
||||
("Renderer for Object cannot be unregistered.");
|
||||
renderers.put(c, null);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* <p>Renders an object in a tree cell depending of the object's
|
||||
* class.</p>
|
||||
*
|
||||
* @see TreeCellRenderer#getTreeCellRendererComponent
|
||||
*/
|
||||
public Component getTreeCellRendererComponent
|
||||
(final JTree tree, final Object value, final boolean selected,
|
||||
final boolean expanded, final boolean leaf, final int row,
|
||||
final boolean hasFocus)
|
||||
{
|
||||
final String NULL = "null";
|
||||
TreeCellRenderer r;
|
||||
Object userObject;
|
||||
if (value == null)
|
||||
userObject = NULL;
|
||||
else
|
||||
{
|
||||
userObject = ((DefaultMutableTreeNode) value).getUserObject();
|
||||
if (userObject == null)
|
||||
userObject = NULL;
|
||||
}
|
||||
r = findRenderer(userObject.getClass());
|
||||
return r.getTreeCellRendererComponent
|
||||
(tree, value, selected, expanded, leaf, row,
|
||||
hasFocus);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* <p>Find the renderer for the specified class.</p>
|
||||
*/
|
||||
protected TreeCellRenderer findRenderer(final Class c)
|
||||
{
|
||||
final TreeCellRenderer r = (TreeCellRenderer) renderers.get(c);
|
||||
if (r != null)
|
||||
/* The class has a renderer. */
|
||||
return r;
|
||||
|
||||
/* The class has no renderer, try the superclass, if any. */
|
||||
final Class superclass = c.getSuperclass();
|
||||
if (superclass != null)
|
||||
return findRenderer(superclass);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,126 @@
|
||||
|
||||
/* ====================================================================
|
||||
Copyright 2002-2004 Apache Software Foundation
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
==================================================================== */
|
||||
|
||||
|
||||
package org.apache.poi.contrib.poibrowser;
|
||||
|
||||
import java.awt.event.*;
|
||||
import java.io.*;
|
||||
import javax.swing.*;
|
||||
import javax.swing.tree.*;
|
||||
import org.apache.poi.poifs.eventfilesystem.*;
|
||||
|
||||
/**
|
||||
* <p>The main class of the POI Browser. It shows the structure of POI
|
||||
* filesystems (Microsoft Office documents) in a {@link
|
||||
* JTree}. Specify their filenames on the command line!</p>
|
||||
*
|
||||
* @see POIFSReader
|
||||
*
|
||||
* @author Rainer Klute (klute@rainer-klute.de)
|
||||
* @version $Id$
|
||||
* @since 2002-01-19
|
||||
*/
|
||||
public class POIBrowser extends JFrame
|
||||
{
|
||||
|
||||
/**
|
||||
* <p>The tree's root node must be visible to all methods.</p>
|
||||
*/
|
||||
protected MutableTreeNode rootNode;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* <p>Takes a bunch of file names as command line parameters,
|
||||
* opens each of them as a POI filesystem and displays their
|
||||
* internal structures in a {@link JTree}.</p>
|
||||
*/
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new POIBrowser().run(args);
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected void run(String[] args)
|
||||
{
|
||||
addWindowListener(new WindowAdapter()
|
||||
{
|
||||
public void windowClosing(WindowEvent e)
|
||||
{
|
||||
System.exit(0);
|
||||
}
|
||||
});
|
||||
|
||||
/* Create the tree model with a root node. The latter is
|
||||
* invisible but it must be present because a tree model
|
||||
* always needs a root. */
|
||||
rootNode = new DefaultMutableTreeNode("POI Filesystems");
|
||||
DefaultTreeModel treeModel = new DefaultTreeModel(rootNode);
|
||||
|
||||
/* Create the tree UI element. */
|
||||
final JTree treeUI = new JTree(treeModel);
|
||||
getContentPane().add(new JScrollPane(treeUI));
|
||||
|
||||
/* Add the POI filesystems to the tree. */
|
||||
int displayedFiles = 0;
|
||||
for (int i = 0; i < args.length; i++)
|
||||
{
|
||||
final String filename = args[i];
|
||||
try
|
||||
{
|
||||
POIFSReader r = new POIFSReader();
|
||||
r.registerListener(new TreeReaderListener(filename, rootNode));
|
||||
r.read(new FileInputStream(filename));
|
||||
displayedFiles++;
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
System.err.println(filename + ": " + ex);
|
||||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
System.err.println("Unexpected exception while reading \"" +
|
||||
filename + "\":");
|
||||
t.printStackTrace(System.err);
|
||||
}
|
||||
}
|
||||
|
||||
/* Exit if there is no file to display (none specified or only
|
||||
* files with problems). */
|
||||
if (displayedFiles == 0)
|
||||
{
|
||||
System.out.println("No POI filesystem(s) to display.");
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
/* Make the tree UI element visible. */
|
||||
treeUI.setRootVisible(true);
|
||||
treeUI.setShowsRootHandles(true);
|
||||
ExtendableTreeCellRenderer etcr = new ExtendableTreeCellRenderer();
|
||||
etcr.register(DocumentDescriptor.class,
|
||||
new DocumentDescriptorRenderer());
|
||||
etcr.register(PropertySetDescriptor.class,
|
||||
new PropertySetDescriptorRenderer());
|
||||
treeUI.setCellRenderer(etcr);
|
||||
setSize(600, 450);
|
||||
setTitle("POI Browser 0.08");
|
||||
setVisible(true);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
|
||||
/* ====================================================================
|
||||
Copyright 2002-2004 Apache Software Foundation
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
==================================================================== */
|
||||
|
||||
|
||||
package org.apache.poi.contrib.poibrowser;
|
||||
|
||||
import java.io.*;
|
||||
import org.apache.poi.hpsf.*;
|
||||
import org.apache.poi.poifs.filesystem.*;
|
||||
|
||||
/**
|
||||
* <p>Describes the most important (whatever that is) features of a
|
||||
* stream containing a {@link PropertySet}.</p>
|
||||
*
|
||||
* @author Rainer Klute (klute@rainer-klute.de)
|
||||
* @version $Id$
|
||||
* @since 2002-02-05
|
||||
*/
|
||||
public class PropertySetDescriptor extends DocumentDescriptor
|
||||
{
|
||||
|
||||
protected PropertySet propertySet;
|
||||
|
||||
/**
|
||||
* <p>Returns this {@link PropertySetDescriptor}'s {@link
|
||||
* PropertySet}.</p>
|
||||
*/
|
||||
public PropertySet getPropertySet()
|
||||
{
|
||||
return propertySet;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* <p>Creates a {@link PropertySetDescriptor} by reading a {@link
|
||||
* PropertySet} from a {@link DocumentInputStream}.</p>
|
||||
*
|
||||
* @param name The stream's name.
|
||||
*
|
||||
* @param path The stream's path in the POI filesystem hierarchy.
|
||||
*
|
||||
* @param stream The stream.
|
||||
*
|
||||
* @param nrOfBytes The maximum number of bytes to display in a
|
||||
* dump starting at the beginning of the stream.
|
||||
*/
|
||||
public PropertySetDescriptor(final String name,
|
||||
final POIFSDocumentPath path,
|
||||
final DocumentInputStream stream,
|
||||
final int nrOfBytesToDump)
|
||||
throws NoPropertySetStreamException, MarkUnsupportedException,
|
||||
UnexpectedPropertySetTypeException, IOException
|
||||
{
|
||||
super(name, path, stream, nrOfBytesToDump);
|
||||
propertySet = PropertySetFactory.create(stream);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,153 @@
|
||||
|
||||
/* ====================================================================
|
||||
Copyright 2002-2004 Apache Software Foundation
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
==================================================================== */
|
||||
|
||||
|
||||
package org.apache.poi.contrib.poibrowser;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import javax.swing.*;
|
||||
import javax.swing.tree.*;
|
||||
import org.apache.poi.hpsf.*;
|
||||
import org.apache.poi.hpsf.wellknown.*;
|
||||
|
||||
/**
|
||||
* <p>Renders a {@link PropertySetDescriptor} by more or less dumping
|
||||
* the stuff into a {@link JTextArea}.</p>
|
||||
*
|
||||
* @author Rainer Klute (klute@rainer-klute.de)
|
||||
* @version $Id$
|
||||
* @since 2002-02-05
|
||||
*/
|
||||
public class PropertySetDescriptorRenderer extends DocumentDescriptorRenderer
|
||||
{
|
||||
|
||||
public Component getTreeCellRendererComponent(final JTree tree,
|
||||
final Object value,
|
||||
final boolean selected,
|
||||
final boolean expanded,
|
||||
final boolean leaf,
|
||||
final int row,
|
||||
final boolean hasFocus)
|
||||
{
|
||||
final PropertySetDescriptor d = (PropertySetDescriptor)
|
||||
((DefaultMutableTreeNode) value).getUserObject();
|
||||
final PropertySet ps = d.getPropertySet();
|
||||
final JPanel p = new JPanel();
|
||||
final JTextArea text = new JTextArea();
|
||||
text.setBackground(new Color(200, 255, 200));
|
||||
text.setFont(new Font("Monospaced", Font.PLAIN, 10));
|
||||
text.append(renderAsString(d));
|
||||
text.append("\nByte order: " +
|
||||
Codec.hexEncode((short) ps.getByteOrder()));
|
||||
text.append("\nFormat: " +
|
||||
Codec.hexEncode((short) ps.getFormat()));
|
||||
text.append("\nOS version: " +
|
||||
Codec.hexEncode(ps.getOSVersion()));
|
||||
text.append("\nClass ID: " +
|
||||
Codec.hexEncode(ps.getClassID()));
|
||||
text.append("\nSection count: " + ps.getSectionCount());
|
||||
text.append(sectionsToString(ps.getSections()));
|
||||
p.add(text);
|
||||
|
||||
if (ps instanceof SummaryInformation)
|
||||
{
|
||||
/* Use the convenience methods. */
|
||||
final SummaryInformation si = (SummaryInformation) ps;
|
||||
text.append("\n");
|
||||
text.append("\nTitle: " + si.getTitle());
|
||||
text.append("\nSubject: " + si.getSubject());
|
||||
text.append("\nAuthor: " + si.getAuthor());
|
||||
text.append("\nKeywords: " + si.getKeywords());
|
||||
text.append("\nComments: " + si.getComments());
|
||||
text.append("\nTemplate: " + si.getTemplate());
|
||||
text.append("\nLast Author: " + si.getLastAuthor());
|
||||
text.append("\nRev. Number: " + si.getRevNumber());
|
||||
text.append("\nEdit Time: " + si.getEditTime());
|
||||
text.append("\nLast Printed: " + si.getLastPrinted());
|
||||
text.append("\nCreate Date/Time: " + si.getCreateDateTime());
|
||||
text.append("\nLast Save Date/Time: " + si.getLastSaveDateTime());
|
||||
text.append("\nPage Count: " + si.getPageCount());
|
||||
text.append("\nWord Count: " + si.getWordCount());
|
||||
text.append("\nChar Count: " + si.getCharCount());
|
||||
// text.append("\nThumbnail: " + si.getThumbnail());
|
||||
text.append("\nApplication Name: " + si.getApplicationName());
|
||||
text.append("\nSecurity: " + si.getSecurity());
|
||||
}
|
||||
|
||||
if (selected)
|
||||
Util.invert(text);
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* <p>Returns a string representation of a list of {@link
|
||||
* Section}s.</p>
|
||||
*/
|
||||
protected String sectionsToString(final List sections)
|
||||
{
|
||||
final StringBuffer b = new StringBuffer();
|
||||
int count = 1;
|
||||
for (Iterator i = sections.iterator(); i.hasNext();)
|
||||
{
|
||||
Section s = (Section) i.next();
|
||||
b.append(toString(s, "Section " + count++));
|
||||
}
|
||||
return b.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* <p>Returns a string representation of a {@link Section}.</p>
|
||||
*/
|
||||
protected String toString(final Section s, final String name)
|
||||
{
|
||||
final StringBuffer b = new StringBuffer();
|
||||
b.append("\n" + name + " Format ID: ");
|
||||
b.append(Codec.hexEncode(s.getFormatID()));
|
||||
b.append("\n" + name + " Offset: " + s.getOffset());
|
||||
b.append("\n" + name + " Section size: " + s.getSize());
|
||||
b.append("\n" + name + " Property count: " + s.getPropertyCount());
|
||||
|
||||
final Property[] properties = s.getProperties();
|
||||
for (int i = 0; i < properties.length; i++)
|
||||
{
|
||||
final Property p = properties[i];
|
||||
final Object value = p.getValue();
|
||||
b.append("\n" + name + " ");
|
||||
b.append("PID_");
|
||||
b.append(p.getID());
|
||||
b.append(' ');
|
||||
b.append(s.getPIDString(p.getID()) + ": ");
|
||||
if (value instanceof byte[])
|
||||
{
|
||||
byte[] b2 = (byte[]) value;
|
||||
b.append("0x" + Codec.hexEncode(b2, 0, 4));
|
||||
b.append(' ');
|
||||
b.append("0x" + Codec.hexEncode(b2, 4, b2.length - 4));
|
||||
}
|
||||
else
|
||||
b.append(value.toString());
|
||||
}
|
||||
return b.toString();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,237 @@
|
||||
|
||||
/* ====================================================================
|
||||
Copyright 2002-2004 Apache Software Foundation
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
==================================================================== */
|
||||
|
||||
|
||||
package org.apache.poi.contrib.poibrowser;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
import javax.swing.tree.*;
|
||||
import org.apache.poi.hpsf.*;
|
||||
import org.apache.poi.poifs.eventfilesystem.*;
|
||||
import org.apache.poi.poifs.filesystem.*;
|
||||
|
||||
/**
|
||||
* <p>Organizes document information in a tree model in order to be
|
||||
* e.g. displayed in a Swing {@link JTree}. An instance of this class
|
||||
* is created with a root tree node ({@link MutableTreeNode}) and
|
||||
* registered as a {@link POIFSReaderListener} with a {@link
|
||||
* POIFSReader}. While the latter processes a POI filesystem it calls
|
||||
* this class' {@link #processPOIFSReaderEvent} for each document it
|
||||
* has been registered for. This method appends the document it
|
||||
* processes at the appropriate position into the tree rooted at the
|
||||
* above mentioned root tree node.</p>
|
||||
*
|
||||
* <p>The root tree node should be the root tree node of a {@link
|
||||
* TreeModel}.</p>
|
||||
*
|
||||
* <p>A top-level element in the tree model, i.e. an immediate child
|
||||
* node of the root node, describes a POI filesystem as such. It is
|
||||
* suggested to use the file's name (as seen by the operating system)
|
||||
* but it could be any other string.</p>
|
||||
*
|
||||
* <p>The value of a tree node is a {@link DocumentDescriptor}. Unlike
|
||||
* a {@link POIFSDocument} which may be as heavy as many megabytes, an
|
||||
* instance of {@link DocumentDescriptor} is a light-weight object and
|
||||
* contains only some meta-information about a document.</p>
|
||||
*
|
||||
* @author Rainer Klute (klute@rainer-klute.de)
|
||||
* @version $Id$
|
||||
* @since 2002-01-24
|
||||
*/
|
||||
public class TreeReaderListener implements POIFSReaderListener
|
||||
{
|
||||
|
||||
/**
|
||||
* <p>The tree's root node. POI filesystems get attached to this
|
||||
* node as children.</p>
|
||||
*/
|
||||
protected MutableTreeNode rootNode;
|
||||
|
||||
/**
|
||||
* <p>Maps filenames and POI document paths to their associated
|
||||
* tree nodes.</p>
|
||||
*/
|
||||
protected Map pathToNode;
|
||||
|
||||
/**
|
||||
* <p>The name of the file this {@link TreeReaderListener}
|
||||
* processes. It is used to identify a top-level element in the
|
||||
* tree. Alternatively any other string can be used. It is just a
|
||||
* label which should identify a POI filesystem.</p>
|
||||
*/
|
||||
protected String filename;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* <p>Creates a {@link TreeReaderListener} which should then be
|
||||
* registered with a {@link POIFSReader}.</p>
|
||||
*
|
||||
* @param filename The name of the POI filesystem, i.e. the name
|
||||
* of the file the POI filesystem resides in. Alternatively any
|
||||
* other string can be used.
|
||||
*
|
||||
* @param rootNode All document information will be attached as
|
||||
* descendands to this tree node.
|
||||
*/
|
||||
public TreeReaderListener(final String filename,
|
||||
final MutableTreeNode rootNode)
|
||||
{
|
||||
this.filename = filename;
|
||||
this.rootNode = rootNode;
|
||||
pathToNode = new HashMap(15); // Should be a reasonable guess.
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** <p>The number of bytes to dump.</p> */
|
||||
private int nrOfBytes = 50;
|
||||
|
||||
public void setNrOfBytes(final int nrOfBytes)
|
||||
{
|
||||
this.nrOfBytes = nrOfBytes;
|
||||
}
|
||||
|
||||
public int getNrOfBytes()
|
||||
{
|
||||
return nrOfBytes;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* <p>A document in the POI filesystem has been opened for
|
||||
* reading. This method retrieves properties of the document and
|
||||
* adds them to a tree model.</p>
|
||||
*/
|
||||
public void processPOIFSReaderEvent(final POIFSReaderEvent event)
|
||||
{
|
||||
DocumentDescriptor d;
|
||||
final DocumentInputStream is = event.getStream();
|
||||
if (!is.markSupported())
|
||||
throw new UnsupportedOperationException(is.getClass().getName() +
|
||||
" does not support mark().");
|
||||
|
||||
/* Try do handle this document as a property set. We receive
|
||||
* an exception if is no property set and handle it as a
|
||||
* document of some other format. We are not concerned about
|
||||
* that document's details. */
|
||||
try
|
||||
{
|
||||
d = new PropertySetDescriptor(event.getName(), event.getPath(),
|
||||
is, nrOfBytes);
|
||||
}
|
||||
catch (HPSFException ex)
|
||||
{
|
||||
d = new DocumentDescriptor(event.getName(), event.getPath(),
|
||||
is, nrOfBytes);
|
||||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
System.err.println
|
||||
("Unexpected exception while processing " +
|
||||
event.getName() + " in " + event.getPath().toString());
|
||||
t.printStackTrace(System.err);
|
||||
throw new RuntimeException(t.getMessage());
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
is.close();
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
System.err.println
|
||||
("Unexpected exception while closing " +
|
||||
event.getName() + " in " + event.getPath().toString());
|
||||
ex.printStackTrace(System.err);
|
||||
}
|
||||
|
||||
final MutableTreeNode parentNode = getNode(d.path, filename, rootNode);
|
||||
final MutableTreeNode nameNode = new DefaultMutableTreeNode(d.name);
|
||||
parentNode.insert(nameNode, 0);
|
||||
final MutableTreeNode dNode = new DefaultMutableTreeNode(d);
|
||||
nameNode.insert(dNode, 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* <p>Locates the parent node for a document entry in the tree
|
||||
* model. If the parent node does not yet exist it will be
|
||||
* created, too. This is done recursively, if needed.</p>
|
||||
*
|
||||
* @param path The tree node for this path is located.
|
||||
*
|
||||
* @param fsName The name of the POI filesystem. This is just a
|
||||
* string which is displayed in the tree at the top lovel.
|
||||
*
|
||||
* @param root The root node.
|
||||
*/
|
||||
private MutableTreeNode getNode(final POIFSDocumentPath path,
|
||||
final String fsName,
|
||||
final MutableTreeNode root)
|
||||
{
|
||||
MutableTreeNode n = (MutableTreeNode) pathToNode.get(path);
|
||||
if (n != null)
|
||||
/* Node found in map, just return it. */
|
||||
return n;
|
||||
if (path.length() == 0)
|
||||
{
|
||||
/* This is the root path of the POI filesystem. Its tree
|
||||
* node is resp. must be located below the tree node of
|
||||
* the POI filesystem itself. This is a tree node with the
|
||||
* POI filesystem's name (this the operating system file's
|
||||
* name) as its key it the path-to-node map. */
|
||||
n = (MutableTreeNode) pathToNode.get(fsName);
|
||||
if (n == null)
|
||||
{
|
||||
/* A tree node for the POI filesystem does not yet
|
||||
* exist. */
|
||||
n = new DefaultMutableTreeNode(fsName);
|
||||
pathToNode.put(fsName, n);
|
||||
root.insert(n, 0);
|
||||
}
|
||||
return n;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* The path is somewhere down in the POI filesystem's
|
||||
* hierarchy. We need the tree node of this path's parent
|
||||
* and attach our new node to it. */
|
||||
final String name = path.getComponent(path.length() - 1);
|
||||
final POIFSDocumentPath parentPath = path.getParent();
|
||||
final MutableTreeNode parentNode =
|
||||
getNode(parentPath, fsName, root);
|
||||
n = new DefaultMutableTreeNode(name);
|
||||
pathToNode.put(path, n);
|
||||
parentNode.insert(n, 0);
|
||||
return n;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private String s(final Object o)
|
||||
{
|
||||
if (o == null)
|
||||
return "null";
|
||||
else
|
||||
return o.getClass().getName() + '@' + o.hashCode();
|
||||
}
|
||||
|
||||
}
|
49
src/contrib/src/org/apache/poi/contrib/poibrowser/Util.java
Normal file
49
src/contrib/src/org/apache/poi/contrib/poibrowser/Util.java
Normal file
@ -0,0 +1,49 @@
|
||||
|
||||
/* ====================================================================
|
||||
Copyright 2002-2004 Apache Software Foundation
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
==================================================================== */
|
||||
|
||||
|
||||
package org.apache.poi.contrib.poibrowser;
|
||||
|
||||
import java.awt.*;
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
* <p>Contains various (well, just one at the moment) static utility
|
||||
* methods.</p>
|
||||
*
|
||||
* @author Rainer Klute (klute@rainer-klute.de)
|
||||
* @version $Id$
|
||||
* @since 2002-01-25
|
||||
*/
|
||||
public class Util
|
||||
{
|
||||
|
||||
/**
|
||||
* <p>Makes a Swing component inverted by swapping its foreground
|
||||
* and background colors. Hint: Depending on your needs it might
|
||||
* also be a good idea to call <tt>c.setOpaque(true)</tt>.</p>
|
||||
*/
|
||||
public static void invert(final JComponent c)
|
||||
{
|
||||
final Color invBackground = c.getForeground();
|
||||
final Color invForeground = c.getBackground();
|
||||
c.setBackground(invBackground);
|
||||
c.setForeground(invForeground);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,63 @@
|
||||
<!doctype html public "-//W3C//DTD HTML 4.0//EN//">
|
||||
<!-- Copyright (C) 2004 The Apache Software Foundation. All rights reserved. -->
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div>
|
||||
<p>The <strong>POI Browser</strong> is a very simple Swing GUI tool that
|
||||
displays the internal structure of a Microsoft Office file. It concentrates
|
||||
on streams in the <em>Horrible Property Set Format (HPSF)</em>. In order to
|
||||
access these streams the POI Browser uses the package
|
||||
<tt>org.apache.poi.hpsf</tt>.</p>
|
||||
|
||||
<p>A file in Microsoft's Office format can be seen as a filesystem within a
|
||||
file. For example, a Word document like <var>sample.doc</var> is just a
|
||||
simple file from the operation system's point of view. However, internally
|
||||
it is organized into various directories and files. For example,
|
||||
<var>sample.doc</var> might consist of the three internal files (or
|
||||
"streams", as Microsoft calls them) <tt>\001CompObj</tt>,
|
||||
<tt>\005SummaryInformation</tt>, and <tt>WordDocument</tt>. (In these names
|
||||
\001 and \005 denote the unprintable characters with the character codes 1
|
||||
and 5, respectively.) A more complicated Word file typically contains a
|
||||
directory named <tt>ObjectPool</tt> with more directories and files nested
|
||||
within it.</p>
|
||||
|
||||
<p>The POI Browser makes these internal structures visible. It takes one or
|
||||
more Microsoft files as input on the command line and shows directories and
|
||||
files in a tree-like structure. On the top-level POI Browser displays the
|
||||
(operating system) filenames. An internal file (i.e. a "stream" or a
|
||||
"document") is shown with its name, its size and a hexadecimal dump of its
|
||||
first bytes.</p>
|
||||
|
||||
<p>The POI Browser pays special attention to property set streams. For
|
||||
example, the <tt>\005SummaryInformation</tt> stream contains information
|
||||
like title and author of the document. The POI Browser opens every stream
|
||||
in a POI filesystem. If it encounters a property set stream, it displays
|
||||
not just its first bytes but analyses the whole stream and displays its
|
||||
contents in a more or less readable manner.</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
sgml-default-dtd-file:"HTML_4.0_Strict.ced"
|
||||
mode: html
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:nil
|
||||
sgml-namecase-general:t
|
||||
sgml-general-insert-case:lower
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
sgml-parent-document:nil
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
-->
|
561
src/contrib/src/org/apache/poi/hssf/contrib/view/SVBorder.java
Normal file
561
src/contrib/src/org/apache/poi/hssf/contrib/view/SVBorder.java
Normal file
@ -0,0 +1,561 @@
|
||||
/* ====================================================================
|
||||
Copyright 2003-2004 Apache Software Foundation
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
==================================================================== */
|
||||
package org.apache.poi.hssf.contrib.view;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
import javax.swing.border.AbstractBorder;
|
||||
|
||||
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
|
||||
|
||||
/**
|
||||
* This is an attempt to implement Excel style borders for the SheetViewer.
|
||||
* Mostly just overrides stuff so the javadoc won't appear here but will
|
||||
* appear in the generated stuff.
|
||||
*
|
||||
* @author Andrew C. Oliver (acoliver at apache dot org)
|
||||
* @author Jason Height
|
||||
*/
|
||||
public class SVBorder extends AbstractBorder {
|
||||
private Color northColor = null;
|
||||
private Color eastColor = null;
|
||||
private Color southColor = null;
|
||||
private Color westColor = null;
|
||||
private int northBorderType = HSSFCellStyle.BORDER_NONE;
|
||||
private int eastBorderType =HSSFCellStyle.BORDER_NONE;
|
||||
private int southBorderType = HSSFCellStyle.BORDER_NONE;
|
||||
private int westBorderType = HSSFCellStyle.BORDER_NONE;
|
||||
private boolean northBorder=false;
|
||||
private boolean eastBorder=false;
|
||||
private boolean southBorder=false;
|
||||
private boolean westBorder=false;
|
||||
private boolean selected = false;
|
||||
|
||||
public void setBorder(Color northColor, Color eastColor,
|
||||
Color southColor, Color westColor,
|
||||
int northBorderType, int eastBorderType,
|
||||
int southBorderType, int westBorderType,
|
||||
boolean selected) {
|
||||
this.eastColor = eastColor;
|
||||
this.southColor = southColor;
|
||||
this.westColor = westColor;
|
||||
this.northBorderType = northBorderType;
|
||||
this.eastBorderType = eastBorderType;
|
||||
this.southBorderType = southBorderType;
|
||||
this.westBorderType = westBorderType;
|
||||
this.northBorder=northBorderType != HSSFCellStyle.BORDER_NONE;
|
||||
this.eastBorder=eastBorderType != HSSFCellStyle.BORDER_NONE;
|
||||
this.southBorder=southBorderType != HSSFCellStyle.BORDER_NONE;
|
||||
this.westBorder=westBorderType != HSSFCellStyle.BORDER_NONE;
|
||||
this.selected = selected;
|
||||
}
|
||||
|
||||
public void paintBorder(Component c, Graphics g, int x, int y, int width,
|
||||
int height) {
|
||||
Color oldColor = g.getColor();
|
||||
|
||||
|
||||
paintSelectedBorder(g, x, y, width, height);
|
||||
paintNormalBorders(g, x, y, width, height);
|
||||
paintDottedBorders(g, x, y, width, height);
|
||||
paintDashedBorders(g, x, y, width, height);
|
||||
paintDoubleBorders(g, x, y, width, height);
|
||||
paintDashDotDotBorders(g, x, y, width, height);
|
||||
|
||||
|
||||
g.setColor(oldColor);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by paintBorder to paint the border of a selected cell.
|
||||
* The paramaters are the Graphics object, location and dimensions of the
|
||||
* cell.
|
||||
*/
|
||||
private void paintSelectedBorder(Graphics g, int x, int y, int width,
|
||||
int height) {
|
||||
if (selected) {
|
||||
//Need to setup thickness of 2
|
||||
g.setColor(Color.black);
|
||||
//paint the border
|
||||
g.drawRect(x,y,width-1,height-1);
|
||||
|
||||
//paint the filled rectangle at the bottom left hand position
|
||||
g.fillRect(x+width-5, y+height-5, 5, 5);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Called by paintBorder to paint the various versions of normal line
|
||||
* borders for a cell.
|
||||
*/
|
||||
private void paintNormalBorders(Graphics g, int x, int y, int width,
|
||||
int height) {
|
||||
|
||||
if (northBorder &&
|
||||
((northBorderType == HSSFCellStyle.BORDER_THIN) ||
|
||||
(northBorderType == HSSFCellStyle.BORDER_MEDIUM) ||
|
||||
(northBorderType == HSSFCellStyle.BORDER_THICK)
|
||||
)
|
||||
) {
|
||||
|
||||
int thickness = getThickness(northBorderType);
|
||||
|
||||
g.setColor(northColor);
|
||||
|
||||
for (int k=0; k < thickness; k++) {
|
||||
g.drawLine(x,y+k,width,y+k);
|
||||
}
|
||||
}
|
||||
|
||||
if (eastBorder &&
|
||||
((eastBorderType == HSSFCellStyle.BORDER_THIN) ||
|
||||
(eastBorderType == HSSFCellStyle.BORDER_MEDIUM) ||
|
||||
(eastBorderType == HSSFCellStyle.BORDER_THICK)
|
||||
)
|
||||
) {
|
||||
|
||||
int thickness = getThickness(eastBorderType);
|
||||
|
||||
g.setColor(eastColor);
|
||||
|
||||
for (int k=0; k < thickness; k++) {
|
||||
g.drawLine(width-k,y,width-k,height);
|
||||
}
|
||||
}
|
||||
|
||||
if (southBorder &&
|
||||
((southBorderType == HSSFCellStyle.BORDER_THIN) ||
|
||||
(southBorderType == HSSFCellStyle.BORDER_MEDIUM) ||
|
||||
(southBorderType == HSSFCellStyle.BORDER_THICK)
|
||||
)
|
||||
) {
|
||||
|
||||
int thickness = getThickness(southBorderType);
|
||||
|
||||
g.setColor(southColor);
|
||||
for (int k=0; k < thickness; k++) {
|
||||
g.drawLine(x,height - k,width,height - k);
|
||||
}
|
||||
}
|
||||
|
||||
if (westBorder &&
|
||||
((westBorderType == HSSFCellStyle.BORDER_THIN) ||
|
||||
(westBorderType == HSSFCellStyle.BORDER_MEDIUM) ||
|
||||
(westBorderType == HSSFCellStyle.BORDER_THICK)
|
||||
)
|
||||
) {
|
||||
|
||||
int thickness = getThickness(westBorderType);
|
||||
|
||||
g.setColor(westColor);
|
||||
|
||||
for (int k=0; k < thickness; k++) {
|
||||
g.drawLine(x+k,y,x+k,height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by paintBorder to paint the dotted line
|
||||
* borders for a cell.
|
||||
*/
|
||||
private void paintDottedBorders(Graphics g, int x, int y, int width,
|
||||
int height) {
|
||||
if (northBorder &&
|
||||
northBorderType == HSSFCellStyle.BORDER_DOTTED) {
|
||||
int thickness = getThickness(northBorderType);
|
||||
|
||||
g.setColor(northColor);
|
||||
|
||||
for (int k=0; k < thickness; k++) {
|
||||
for (int xc = x; xc < width; xc=xc+2) {
|
||||
g.drawLine(xc,y+k,xc,y+k);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (eastBorder &&
|
||||
eastBorderType == HSSFCellStyle.BORDER_DOTTED
|
||||
) {
|
||||
|
||||
int thickness = getThickness(eastBorderType);
|
||||
thickness++; //need for dotted borders to show up east
|
||||
|
||||
g.setColor(eastColor);
|
||||
|
||||
for (int k=0; k < thickness; k++) {
|
||||
for (int yc=y;yc < height; yc=yc+2) {
|
||||
g.drawLine(width-k,yc,width-k,yc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (southBorder &&
|
||||
southBorderType == HSSFCellStyle.BORDER_DOTTED
|
||||
) {
|
||||
|
||||
int thickness = getThickness(southBorderType);
|
||||
thickness++;
|
||||
g.setColor(southColor);
|
||||
for (int k=0; k < thickness; k++) {
|
||||
for (int xc = x; xc < width; xc=xc+2) {
|
||||
g.drawLine(xc,height-k,xc,height-k);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (westBorder &&
|
||||
westBorderType == HSSFCellStyle.BORDER_DOTTED
|
||||
) {
|
||||
|
||||
int thickness = getThickness(westBorderType);
|
||||
// thickness++;
|
||||
|
||||
g.setColor(westColor);
|
||||
|
||||
for (int k=0; k < thickness; k++) {
|
||||
for (int yc=y;yc < height; yc=yc+2) {
|
||||
g.drawLine(x+k,yc,x+k,yc);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by paintBorder to paint the various versions of dotted line
|
||||
* borders for a cell.
|
||||
*/
|
||||
private void paintDashedBorders(Graphics g, int x, int y, int width,
|
||||
int height) {
|
||||
if (northBorder &&
|
||||
((northBorderType == HSSFCellStyle.BORDER_DASHED) ||
|
||||
(northBorderType == HSSFCellStyle.BORDER_HAIR))
|
||||
) {
|
||||
int thickness = getThickness(northBorderType);
|
||||
|
||||
int dashlength = 1;
|
||||
|
||||
if (northBorderType == HSSFCellStyle.BORDER_DASHED)
|
||||
dashlength = 2;
|
||||
|
||||
g.setColor(northColor);
|
||||
|
||||
for (int k=0; k < thickness; k++) {
|
||||
for (int xc = x; xc < width; xc=xc+5) {
|
||||
g.drawLine(xc,y+k,xc+dashlength,y+k);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (eastBorder &&
|
||||
((eastBorderType == HSSFCellStyle.BORDER_DASHED) ||
|
||||
(eastBorderType == HSSFCellStyle.BORDER_HAIR))
|
||||
) {
|
||||
|
||||
int thickness = getThickness(eastBorderType);
|
||||
thickness++; //need for dotted borders to show up east
|
||||
|
||||
|
||||
int dashlength = 1;
|
||||
|
||||
if (eastBorderType == HSSFCellStyle.BORDER_DASHED)
|
||||
dashlength = 2;
|
||||
|
||||
g.setColor(eastColor);
|
||||
|
||||
for (int k=0; k < thickness; k++) {
|
||||
for (int yc=y;yc < height; yc=yc+5) {
|
||||
g.drawLine(width-k,yc,width-k,yc+dashlength);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (southBorder &&
|
||||
((southBorderType == HSSFCellStyle.BORDER_DASHED) ||
|
||||
(southBorderType == HSSFCellStyle.BORDER_HAIR))
|
||||
) {
|
||||
|
||||
int thickness = getThickness(southBorderType);
|
||||
thickness++;
|
||||
|
||||
int dashlength = 1;
|
||||
|
||||
if (southBorderType == HSSFCellStyle.BORDER_DASHED)
|
||||
dashlength = 2;
|
||||
|
||||
g.setColor(southColor);
|
||||
for (int k=0; k < thickness; k++) {
|
||||
for (int xc = x; xc < width; xc=xc+5) {
|
||||
g.drawLine(xc,height-k,xc+dashlength,height-k);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (westBorder &&
|
||||
((westBorderType == HSSFCellStyle.BORDER_DASHED) ||
|
||||
(westBorderType == HSSFCellStyle.BORDER_HAIR))
|
||||
) {
|
||||
|
||||
int thickness = getThickness(westBorderType);
|
||||
// thickness++;
|
||||
|
||||
int dashlength = 1;
|
||||
|
||||
if (westBorderType == HSSFCellStyle.BORDER_DASHED)
|
||||
dashlength = 2;
|
||||
|
||||
g.setColor(westColor);
|
||||
|
||||
for (int k=0; k < thickness; k++) {
|
||||
for (int yc=y;yc < height; yc=yc+5) {
|
||||
g.drawLine(x+k,yc,x+k,yc+dashlength);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by paintBorder to paint the double line
|
||||
* borders for a cell.
|
||||
*/
|
||||
private void paintDoubleBorders(Graphics g, int x, int y, int width,
|
||||
int height) {
|
||||
if (northBorder &&
|
||||
northBorderType == HSSFCellStyle.BORDER_DOUBLE) {
|
||||
|
||||
g.setColor(northColor);
|
||||
|
||||
int leftx=x;
|
||||
int rightx=width;
|
||||
|
||||
// if there are borders on the west or east then
|
||||
// the second line shouldn't cross them
|
||||
if (westBorder)
|
||||
leftx = x+3;
|
||||
|
||||
if (eastBorder)
|
||||
rightx = width-3;
|
||||
|
||||
g.drawLine(x,y,width,y);
|
||||
g.drawLine(leftx,y+2,rightx,y+2);
|
||||
}
|
||||
|
||||
if (eastBorder &&
|
||||
eastBorderType == HSSFCellStyle.BORDER_DOUBLE
|
||||
) {
|
||||
|
||||
int thickness = getThickness(eastBorderType);
|
||||
thickness++; //need for dotted borders to show up east
|
||||
|
||||
g.setColor(eastColor);
|
||||
|
||||
int topy=y;
|
||||
int bottomy=height;
|
||||
|
||||
if (northBorder)
|
||||
topy=y+3;
|
||||
|
||||
if (southBorder)
|
||||
bottomy=height-3;
|
||||
|
||||
g.drawLine(width-1,y,width-1,height);
|
||||
g.drawLine(width-3,topy,width-3,bottomy);
|
||||
}
|
||||
|
||||
if (southBorder &&
|
||||
southBorderType == HSSFCellStyle.BORDER_DOUBLE
|
||||
) {
|
||||
|
||||
g.setColor(southColor);
|
||||
|
||||
int leftx=y;
|
||||
int rightx=width;
|
||||
|
||||
if (westBorder)
|
||||
leftx=x+3;
|
||||
|
||||
if (eastBorder)
|
||||
rightx=width-3;
|
||||
|
||||
|
||||
g.drawLine(x,height - 1,width,height - 1);
|
||||
g.drawLine(leftx,height - 3,rightx,height - 3);
|
||||
}
|
||||
|
||||
if (westBorder &&
|
||||
westBorderType == HSSFCellStyle.BORDER_DOUBLE
|
||||
) {
|
||||
|
||||
int thickness = getThickness(westBorderType);
|
||||
// thickness++;
|
||||
|
||||
g.setColor(westColor);
|
||||
|
||||
int topy=y;
|
||||
int bottomy=height-3;
|
||||
|
||||
if (northBorder)
|
||||
topy=y+2;
|
||||
|
||||
if (southBorder)
|
||||
bottomy=height-3;
|
||||
|
||||
g.drawLine(x,y,x,height);
|
||||
g.drawLine(x+2,topy,x+2,bottomy);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by paintBorder to paint the various versions of dash dot dot line
|
||||
* borders for a cell.
|
||||
*/
|
||||
private void paintDashDotDotBorders(Graphics g, int x, int y, int width,
|
||||
int height) {
|
||||
if (northBorder &&
|
||||
((northBorderType == HSSFCellStyle.BORDER_DASH_DOT_DOT) ||
|
||||
(northBorderType == HSSFCellStyle.BORDER_MEDIUM_DASH_DOT_DOT))
|
||||
) {
|
||||
int thickness = getThickness(northBorderType);
|
||||
|
||||
g.setColor(northColor);
|
||||
for (int l=x; l < width;) {
|
||||
l=l+drawDashDotDot(g, l, y, thickness, true, true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (eastBorder &&
|
||||
((eastBorderType == HSSFCellStyle.BORDER_DASH_DOT_DOT) ||
|
||||
(eastBorderType == HSSFCellStyle.BORDER_MEDIUM_DASH_DOT_DOT))
|
||||
) {
|
||||
|
||||
int thickness = getThickness(eastBorderType);
|
||||
|
||||
g.setColor(eastColor);
|
||||
|
||||
for (int l=y;l < height;) {
|
||||
//System.err.println("drawing east");
|
||||
l=l+drawDashDotDot(g,width-1,l,thickness,false,false);
|
||||
}
|
||||
}
|
||||
|
||||
if (southBorder &&
|
||||
((southBorderType == HSSFCellStyle.BORDER_DASH_DOT_DOT) ||
|
||||
(southBorderType == HSSFCellStyle.BORDER_MEDIUM_DASH_DOT_DOT))
|
||||
) {
|
||||
|
||||
int thickness = getThickness(southBorderType);
|
||||
|
||||
g.setColor(southColor);
|
||||
|
||||
for (int l=x; l < width;) {
|
||||
//System.err.println("drawing south");
|
||||
l=l+drawDashDotDot(g, l, height-1, thickness, true, false);
|
||||
}
|
||||
}
|
||||
|
||||
if (westBorder &&
|
||||
((westBorderType == HSSFCellStyle.BORDER_DASH_DOT_DOT) ||
|
||||
(westBorderType == HSSFCellStyle.BORDER_MEDIUM_DASH_DOT_DOT))
|
||||
) {
|
||||
|
||||
int thickness = getThickness(westBorderType);
|
||||
|
||||
g.setColor(westColor);
|
||||
|
||||
for (int l=y;l < height;) {
|
||||
//System.err.println("drawing west");
|
||||
l=l+drawDashDotDot(g,x,l,thickness,false,true);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws one dash dot dot horizontally or vertically with thickness drawn
|
||||
* incrementally to either the right or left.
|
||||
*
|
||||
* @param g graphics object for drawing with
|
||||
* @param x the x origin of the line
|
||||
* @param y the y origin of the line
|
||||
* @param thickness the thickness of the line
|
||||
* @param horizontal or vertical (true for horizontal)
|
||||
* @param right/bottom or left/top thickness (true for right or top),
|
||||
* if true then the x or y origin will be incremented to provide
|
||||
* thickness, if false, they'll be decremented. For vertical
|
||||
* borders, x is incremented or decremented, for horizontal its y.
|
||||
* Just set to true for north and west, and false for east and
|
||||
* south.
|
||||
* @returns length - returns the length of the line.
|
||||
*/
|
||||
private int drawDashDotDot(Graphics g,int x, int y, int thickness,
|
||||
boolean horizontal,
|
||||
boolean rightBottom) {
|
||||
|
||||
for (int t=0; t < thickness; t++) {
|
||||
if (!rightBottom) {
|
||||
t = 0 - t; //add negative thickness so we go the other way
|
||||
//then we'll decrement instead of increment.
|
||||
}
|
||||
if (horizontal) {
|
||||
g.drawLine(x,y+t,x+5,y+t);
|
||||
g.drawLine(x+8,y+t,x+10,y+t);
|
||||
g.drawLine(x+13,y+t,x+15,y+t);
|
||||
} else {
|
||||
g.drawLine(x+t,y,x+t,y+5);
|
||||
g.drawLine(x+t,y+8,x+t,y+10);
|
||||
g.drawLine(x+t,y+13,x+t,y+15);
|
||||
}
|
||||
}
|
||||
return 18;
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns the line thickness for a border based on border type
|
||||
*/
|
||||
private int getThickness(int thickness) {
|
||||
int retval=1;
|
||||
switch (thickness) {
|
||||
case HSSFCellStyle.BORDER_THIN:
|
||||
retval=2;
|
||||
break;
|
||||
case HSSFCellStyle.BORDER_MEDIUM:
|
||||
retval=3;
|
||||
break;
|
||||
case HSSFCellStyle.BORDER_THICK:
|
||||
retval=4;
|
||||
break;
|
||||
case HSSFCellStyle.BORDER_DASHED:
|
||||
retval=1;
|
||||
break;
|
||||
case HSSFCellStyle.BORDER_DASH_DOT_DOT:
|
||||
retval=1;
|
||||
break;
|
||||
case HSSFCellStyle.BORDER_MEDIUM_DASH_DOT_DOT:
|
||||
retval=3;
|
||||
break;
|
||||
case HSSFCellStyle.BORDER_HAIR:
|
||||
retval=1;
|
||||
break;
|
||||
default:
|
||||
retval=1;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,217 @@
|
||||
/* ====================================================================
|
||||
Copyright 2003-2004 Apache Software Foundation
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
==================================================================== */
|
||||
|
||||
package org.apache.poi.hssf.contrib.view;
|
||||
|
||||
import java.text.*;
|
||||
|
||||
/**
|
||||
* This class is used to format cells into their fractional format.
|
||||
*
|
||||
* I cant be 100% sure that the same fractional value will be displayed as in
|
||||
* excel but then again it is a lossy formating mode anyway
|
||||
*
|
||||
* @author Jason Height
|
||||
* @created 15 July 2002
|
||||
*/
|
||||
public class SVFractionalFormat extends Format {
|
||||
private short ONE_DIGIT = 1;
|
||||
private short TWO_DIGIT = 2;
|
||||
private short THREE_DIGIT = 3;
|
||||
private short UNITS = 4;
|
||||
private int units = 1;
|
||||
private short mode = -1;
|
||||
|
||||
/** Constructs a new FractionalFormatter
|
||||
*
|
||||
* The formatStr defines how the number will be formatted
|
||||
* # ?/? Up to one digit
|
||||
* # ??/?? Up to two digits
|
||||
* # ???/??? Up to three digits
|
||||
* # ?/2 In halves
|
||||
* # ?/4 In quarters
|
||||
* # ?/8 In eighths
|
||||
* # ?/16 In sixteenths
|
||||
* # ?/10 In tenths
|
||||
* # ?/100 In hundredths
|
||||
*/
|
||||
public SVFractionalFormat(String formatStr) {
|
||||
if ("# ?/?".equals(formatStr))
|
||||
mode = ONE_DIGIT;
|
||||
else if ("# ??/??".equals(formatStr))
|
||||
mode = TWO_DIGIT;
|
||||
else if ("# ???/???".equals(formatStr))
|
||||
mode = THREE_DIGIT;
|
||||
else if ("# ?/2".equals(formatStr)) {
|
||||
mode = UNITS;
|
||||
units = 2;
|
||||
} else if ("# ?/4".equals(formatStr)) {
|
||||
mode = UNITS;
|
||||
units = 4;
|
||||
} else if ("# ?/8".equals(formatStr)) {
|
||||
mode = UNITS;
|
||||
units = 8;
|
||||
} else if ("# ?/16".equals(formatStr)) {
|
||||
mode = UNITS;
|
||||
units = 16;
|
||||
} else if ("# ?/10".equals(formatStr)) {
|
||||
mode = UNITS;
|
||||
units = 10;
|
||||
} else if ("# ?/100".equals(formatStr)) {
|
||||
mode = UNITS;
|
||||
units = 100;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a fractional string representation of a double to a maximum denominator size
|
||||
*
|
||||
* This code has been translated to java from the following web page.
|
||||
* http://www.codeproject.com/cpp/fraction.asp
|
||||
* Originally coded in c++ By Dean Wyant dwyant@mindspring.com
|
||||
* The code on the web page is freely available.
|
||||
*
|
||||
* @param f Description of the Parameter
|
||||
* @param MaxDen Description of the Parameter
|
||||
* @return Description of the Return Value
|
||||
*/
|
||||
private String format(final double f, final int MaxDen) {
|
||||
long Whole = (long)f;
|
||||
int sign = 1;
|
||||
if (f < 0) {
|
||||
sign = -1;
|
||||
}
|
||||
double Precision = 0.00001;
|
||||
double AllowedError = Precision;
|
||||
double d = Math.abs(f);
|
||||
d -= Whole;
|
||||
double Frac = d;
|
||||
double Diff = Frac;
|
||||
long Num = 1;
|
||||
long Den = 0;
|
||||
long A = 0;
|
||||
long B = 0;
|
||||
long i = 0;
|
||||
if (Frac > Precision) {
|
||||
while (true) {
|
||||
d = 1.0 / d;
|
||||
i = (long) (d + Precision);
|
||||
d -= i;
|
||||
if (A > 0) {
|
||||
Num = i * Num + B;
|
||||
}
|
||||
Den = (long) (Num / Frac + 0.5);
|
||||
Diff = Math.abs((double) Num / Den - Frac);
|
||||
if (Den > MaxDen) {
|
||||
if (A > 0) {
|
||||
Num = A;
|
||||
Den = (long) (Num / Frac + 0.5);
|
||||
Diff = Math.abs((double) Num / Den - Frac);
|
||||
} else {
|
||||
Den = MaxDen;
|
||||
Num = 1;
|
||||
Diff = Math.abs((double) Num / Den - Frac);
|
||||
if (Diff > Frac) {
|
||||
Num = 0;
|
||||
Den = 1;
|
||||
// Keeps final check below from adding 1 and keeps Den from being 0
|
||||
Diff = Frac;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
if ((Diff <= AllowedError) || (d < Precision)) {
|
||||
break;
|
||||
}
|
||||
Precision = AllowedError / Diff;
|
||||
// This calcualtion of Precision does not always provide results within
|
||||
// Allowed Error. It compensates for loss of significant digits that occurs.
|
||||
// It helps to round the inprecise reciprocal values to i.
|
||||
B = A;
|
||||
A = Num;
|
||||
}
|
||||
}
|
||||
if (Num == Den) {
|
||||
Whole++;
|
||||
Num = 0;
|
||||
Den = 0;
|
||||
} else if (Den == 0) {
|
||||
Num = 0;
|
||||
}
|
||||
if (sign < 0) {
|
||||
if (Whole == 0) {
|
||||
Num = -Num;
|
||||
} else {
|
||||
Whole = -Whole;
|
||||
}
|
||||
}
|
||||
return new StringBuffer().append(Whole).append(" ").append(Num).append("/").append(Den).toString();
|
||||
}
|
||||
|
||||
/** This method formats the double in the units specified.
|
||||
* The usints could be any number but in this current implementation it is
|
||||
* halves (2), quaters (4), eigths (8) etc
|
||||
*/
|
||||
private String formatUnit(double f, int units) {
|
||||
long Whole = (long)f;
|
||||
f -= Whole;
|
||||
long Num = Math.round(f * units);
|
||||
|
||||
return new StringBuffer().append(Whole).append(" ").append(Num).append("/").append(units).toString();
|
||||
}
|
||||
|
||||
public final String format(double val) {
|
||||
if (mode == ONE_DIGIT) {
|
||||
return format(val, 9);
|
||||
} else if (mode == TWO_DIGIT) {
|
||||
return format(val, 99);
|
||||
} else if (mode == THREE_DIGIT) {
|
||||
return format(val, 999);
|
||||
} else if (mode == UNITS) {
|
||||
return formatUnit(val , units);
|
||||
}
|
||||
throw new RuntimeException("Unexpected Case");
|
||||
}
|
||||
|
||||
public StringBuffer format(Object obj,
|
||||
StringBuffer toAppendTo,
|
||||
FieldPosition pos) {
|
||||
if (obj instanceof Number) {
|
||||
toAppendTo.append(format(((Number)obj).doubleValue()));
|
||||
return toAppendTo;
|
||||
}
|
||||
else throw new IllegalArgumentException("Can only handle Numbers");
|
||||
}
|
||||
|
||||
public Object parseObject(String source,
|
||||
ParsePosition status) {
|
||||
//JMH TBD
|
||||
return null;
|
||||
}
|
||||
|
||||
public Object parseObject(String source)
|
||||
throws ParseException {
|
||||
//JMH TBD
|
||||
return null;
|
||||
}
|
||||
|
||||
public Object clone() {
|
||||
//JMH TBD
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,90 @@
|
||||
|
||||
/* ====================================================================
|
||||
Copyright 2002-2004 Apache Software Foundation
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
==================================================================== */
|
||||
|
||||
|
||||
|
||||
package org.apache.poi.hssf.contrib.view;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.io.*;
|
||||
import javax.swing.*;
|
||||
import javax.swing.table.*;
|
||||
import javax.swing.event.*;
|
||||
|
||||
import org.apache.poi.hssf.usermodel.*;
|
||||
|
||||
/**
|
||||
* This class presents the row header to the table.
|
||||
*
|
||||
*
|
||||
* @author Jason Height
|
||||
*/
|
||||
public class SVRowHeader extends JList {
|
||||
/** This model simply returns an integer number up to the number of rows
|
||||
* that are present in the sheet.
|
||||
*
|
||||
*/
|
||||
private class SVRowHeaderModel extends AbstractListModel {
|
||||
private HSSFSheet sheet;
|
||||
|
||||
public SVRowHeaderModel(HSSFSheet sheet) {
|
||||
this.sheet = sheet;
|
||||
}
|
||||
|
||||
public int getSize() { return sheet.getPhysicalNumberOfRows(); }
|
||||
public Object getElementAt(int index) {
|
||||
return Integer.toString(index+1);
|
||||
}
|
||||
}
|
||||
|
||||
/** Renderes the row number*/
|
||||
private class RowHeaderRenderer extends JLabel implements ListCellRenderer {
|
||||
private HSSFSheet sheet;
|
||||
private int extraHeight;
|
||||
|
||||
RowHeaderRenderer(HSSFSheet sheet, JTable table, int extraHeight) {
|
||||
this.sheet = sheet;
|
||||
this.extraHeight = extraHeight;
|
||||
JTableHeader header = table.getTableHeader();
|
||||
setOpaque(true);
|
||||
setBorder(UIManager.getBorder("TableHeader.cellBorder"));
|
||||
setHorizontalAlignment(CENTER);
|
||||
setForeground(header.getForeground());
|
||||
setBackground(header.getBackground());
|
||||
setFont(header.getFont());
|
||||
}
|
||||
|
||||
public Component getListCellRendererComponent( JList list,
|
||||
Object value, int index, boolean isSelected, boolean cellHasFocus) {
|
||||
Dimension d = getPreferredSize();
|
||||
int rowHeight = (int)sheet.getRow(index).getHeightInPoints();
|
||||
d.height = rowHeight+extraHeight;
|
||||
setPreferredSize(d);
|
||||
setText((value == null) ? "" : value.toString());
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
public SVRowHeader(HSSFSheet sheet, JTable table, int extraHeight) {
|
||||
ListModel lm = new SVRowHeaderModel(sheet);
|
||||
this.setModel(lm);
|
||||
|
||||
setFixedCellWidth(50);
|
||||
setCellRenderer(new RowHeaderRenderer(sheet, table, extraHeight));
|
||||
}
|
||||
}
|
@ -0,0 +1,205 @@
|
||||
/* ====================================================================
|
||||
Copyright 2003-2004 Apache Software Foundation
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
==================================================================== */
|
||||
|
||||
package org.apache.poi.hssf.contrib.view;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.text.*;
|
||||
import java.util.*;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.*;
|
||||
import javax.swing.table.*;
|
||||
|
||||
import org.apache.poi.hssf.usermodel.*;
|
||||
import org.apache.poi.hssf.util.HSSFColor;
|
||||
|
||||
/**
|
||||
* Sheet Viewer Table Cell Editor -- not commented via javadoc as it
|
||||
* nearly completely consists of overridden methods.
|
||||
*
|
||||
* @author Jason Height
|
||||
* @created 16 July 2002
|
||||
*/
|
||||
public class SVTableCellEditor extends AbstractCellEditor implements TableCellEditor, ActionListener {
|
||||
private static final Color black = getAWTColor(new HSSFColor.BLACK());
|
||||
private static final Color white = getAWTColor(new HSSFColor.WHITE());
|
||||
private Hashtable colors = HSSFColor.getIndexHash();
|
||||
|
||||
|
||||
private HSSFWorkbook wb;
|
||||
private JTextField editor;
|
||||
|
||||
private HSSFCell editorValue;
|
||||
|
||||
|
||||
public SVTableCellEditor(HSSFWorkbook wb) {
|
||||
this.wb = wb;
|
||||
this.editor = new JTextField();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the cellEditable attribute of the SVTableCellEditor object
|
||||
*
|
||||
* @return The cellEditable value
|
||||
*/
|
||||
public boolean isCellEditable(java.util.EventObject e) {
|
||||
if (e instanceof MouseEvent) {
|
||||
return ((MouseEvent) e).getClickCount() >= 2;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public boolean shouldSelectCell(EventObject anEvent) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public boolean startCellEditing(EventObject anEvent) {
|
||||
System.out.println("Start Cell Editing");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public boolean stopCellEditing() {
|
||||
System.out.println("Stop Cell Editing");
|
||||
fireEditingStopped();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public void cancelCellEditing() {
|
||||
System.out.println("Cancel Cell Editing");
|
||||
fireEditingCanceled();
|
||||
}
|
||||
|
||||
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
System.out.println("Action performed");
|
||||
stopCellEditing();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the cellEditorValue attribute of the SVTableCellEditor object
|
||||
*
|
||||
* @return The cellEditorValue value
|
||||
*/
|
||||
public Object getCellEditorValue() {
|
||||
System.out.println("GetCellEditorValue");
|
||||
//JMH Look at when this method is called. Should it return a HSSFCell?
|
||||
return editor.getText();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the tableCellEditorComponent attribute of the SVTableCellEditor object
|
||||
*
|
||||
* @return The tableCellEditorComponent value
|
||||
*/
|
||||
public Component getTableCellEditorComponent(JTable table, Object value,
|
||||
boolean isSelected,
|
||||
int row,
|
||||
int column) {
|
||||
System.out.println("GetTableCellEditorComponent");
|
||||
HSSFCell cell = (HSSFCell) value;
|
||||
if (cell != null) {
|
||||
HSSFCellStyle style = cell.getCellStyle();
|
||||
HSSFFont f = wb.getFontAt(style.getFontIndex());
|
||||
boolean isbold = f.getBoldweight() > HSSFFont.BOLDWEIGHT_NORMAL;
|
||||
boolean isitalics = f.getItalic();
|
||||
|
||||
int fontstyle = Font.PLAIN;
|
||||
|
||||
if (isbold) fontstyle = Font.BOLD;
|
||||
if (isitalics) fontstyle = fontstyle | Font.ITALIC;
|
||||
|
||||
int fontheight = f.getFontHeightInPoints();
|
||||
if (fontheight == 9) fontheight = 10; //fix for stupid ol Windows
|
||||
|
||||
Font font = new Font(f.getFontName(),fontstyle,fontheight);
|
||||
editor.setFont(font);
|
||||
|
||||
if (style.getFillPattern() == HSSFCellStyle.SOLID_FOREGROUND) {
|
||||
editor.setBackground(getAWTColor(style.getFillForegroundColor(), white));
|
||||
} else editor.setBackground(white);
|
||||
|
||||
editor.setForeground(getAWTColor(f.getColor(), black));
|
||||
|
||||
|
||||
//Set the value that is rendered for the cell
|
||||
switch (cell.getCellType()) {
|
||||
case HSSFCell.CELL_TYPE_BLANK:
|
||||
editor.setText("");
|
||||
break;
|
||||
case HSSFCell.CELL_TYPE_BOOLEAN:
|
||||
if (cell.getBooleanCellValue()) {
|
||||
editor.setText("true");
|
||||
} else {
|
||||
editor.setText("false");
|
||||
}
|
||||
break;
|
||||
case HSSFCell.CELL_TYPE_NUMERIC:
|
||||
editor.setText(Double.toString(cell.getNumericCellValue()));
|
||||
break;
|
||||
case HSSFCell.CELL_TYPE_STRING:
|
||||
editor.setText(cell.getStringCellValue());
|
||||
break;
|
||||
case HSSFCell.CELL_TYPE_FORMULA:
|
||||
default:
|
||||
editor.setText("?");
|
||||
}
|
||||
switch (style.getAlignment()) {
|
||||
case HSSFCellStyle.ALIGN_LEFT:
|
||||
case HSSFCellStyle.ALIGN_JUSTIFY:
|
||||
case HSSFCellStyle.ALIGN_FILL:
|
||||
editor.setHorizontalAlignment(SwingConstants.LEFT);
|
||||
break;
|
||||
case HSSFCellStyle.ALIGN_CENTER:
|
||||
case HSSFCellStyle.ALIGN_CENTER_SELECTION:
|
||||
editor.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
break;
|
||||
case HSSFCellStyle.ALIGN_GENERAL:
|
||||
case HSSFCellStyle.ALIGN_RIGHT:
|
||||
editor.setHorizontalAlignment(SwingConstants.RIGHT);
|
||||
break;
|
||||
default:
|
||||
editor.setHorizontalAlignment(SwingConstants.LEFT);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
return editor;
|
||||
}
|
||||
|
||||
/** This method retrieves the AWT Color representation from the colour hash table
|
||||
*
|
||||
*/
|
||||
private final Color getAWTColor(int index, Color deflt) {
|
||||
HSSFColor clr = (HSSFColor)colors.get(new Integer(index));
|
||||
if (clr == null) return deflt;
|
||||
return getAWTColor(clr);
|
||||
}
|
||||
|
||||
private static final Color getAWTColor(HSSFColor clr) {
|
||||
short[] rgb = clr.getTriplet();
|
||||
return new Color(rgb[0],rgb[1],rgb[2]);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,278 @@
|
||||
|
||||
/* ====================================================================
|
||||
Copyright 2002-2004 Apache Software Foundation
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
==================================================================== */
|
||||
|
||||
|
||||
package org.apache.poi.hssf.contrib.view;
|
||||
|
||||
import java.util.Hashtable;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.table.TableCellRenderer;
|
||||
import javax.swing.border.*;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.Color;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.Font;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.text.*;
|
||||
|
||||
import org.apache.poi.hssf.usermodel.*;
|
||||
import org.apache.poi.hssf.util.HSSFColor;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Sheet Viewer Table Cell Render -- not commented via javadoc as it
|
||||
* nearly completely consists of overridden methods.
|
||||
*
|
||||
* @author Andrew C. Oliver
|
||||
*/
|
||||
public class SVTableCellRenderer extends JLabel
|
||||
implements TableCellRenderer, Serializable
|
||||
{
|
||||
protected static Border noFocusBorder = new EmptyBorder(1, 1, 1, 1);
|
||||
protected SVBorder cellBorder = new SVBorder();
|
||||
|
||||
|
||||
private HSSFWorkbook wb = null;
|
||||
|
||||
/** This class holds the references to the predefined cell formats.
|
||||
*/
|
||||
private class CellFormatter {
|
||||
private Format[] textFormatter;
|
||||
|
||||
private DecimalFormat generalNumberFormat = new DecimalFormat("0");
|
||||
|
||||
public CellFormatter() {
|
||||
textFormatter = new Format[0x31];
|
||||
|
||||
textFormatter[0x01] = new DecimalFormat("0");
|
||||
textFormatter[0x02] = new DecimalFormat("0.00");
|
||||
textFormatter[0x03] = new DecimalFormat("#,##0");
|
||||
textFormatter[0x04] = new DecimalFormat("#,##0.00");
|
||||
textFormatter[0x05] = new DecimalFormat("$#,##0;$#,##0");
|
||||
textFormatter[0x06] = new DecimalFormat("$#,##0;$#,##0");
|
||||
textFormatter[0x07] = new DecimalFormat("$#,##0.00;$#,##0.00");
|
||||
textFormatter[0x08] = new DecimalFormat("$#,##0.00;$#,##0.00");
|
||||
textFormatter[0x09] = new DecimalFormat("0%");
|
||||
textFormatter[0x0A] = new DecimalFormat("0.00%");
|
||||
textFormatter[0x0B] = new DecimalFormat("0.00E0");
|
||||
textFormatter[0x0C] = new SVFractionalFormat("# ?/?");
|
||||
textFormatter[0x0D] = new SVFractionalFormat("# ??/??");
|
||||
textFormatter[0x0E] = new SimpleDateFormat("M/d/yy");
|
||||
textFormatter[0x0F] = new SimpleDateFormat("d-MMM-yy");
|
||||
textFormatter[0x10] = new SimpleDateFormat("d-MMM");
|
||||
textFormatter[0x11] = new SimpleDateFormat("MMM-yy");
|
||||
textFormatter[0x12] = new SimpleDateFormat("h:mm a");
|
||||
textFormatter[0x13] = new SimpleDateFormat("h:mm:ss a");
|
||||
textFormatter[0x14] = new SimpleDateFormat("h:mm");
|
||||
textFormatter[0x15] = new SimpleDateFormat("h:mm:ss");
|
||||
textFormatter[0x16] = new SimpleDateFormat("M/d/yy h:mm");
|
||||
// 0x17 - 0x24 reserved for international and undocumented 0x25, "(#,##0_);(#,##0)"
|
||||
//start at 0x26
|
||||
//jmh need to do colour
|
||||
//"(#,##0_);[Red](#,##0)"
|
||||
textFormatter[0x26] = new DecimalFormat("#,##0;#,##0");
|
||||
//jmh need to do colour
|
||||
//(#,##0.00_);(#,##0.00)
|
||||
textFormatter[0x27] = new DecimalFormat("#,##0.00;#,##0.00");
|
||||
textFormatter[0x28] = new DecimalFormat("#,##0.00;#,##0.00");
|
||||
//?? textFormatter[0x29] = new DecimalFormat("_(*#,##0_);_(*(#,##0);_(* \"-\"_);_(@_)");
|
||||
//?? textFormatter[0x2A] = new DecimalFormat("_($*#,##0_);_($*(#,##0);_($* \"-\"_);_(@_)");
|
||||
//?? textFormatter[0x2B] = new DecimalFormat("_(*#,##0.00_);_(*(#,##0.00);_(*\"-\"??_);_(@_)");
|
||||
//?? textFormatter[0x2C] = new DecimalFormat("_($*#,##0.00_);_($*(#,##0.00);_($*\"-\"??_);_(@_)");
|
||||
textFormatter[0x2D] = new SimpleDateFormat("mm:ss");
|
||||
//?? textFormatter[0x2E] = new SimpleDateFormat("[h]:mm:ss");
|
||||
textFormatter[0x2F] = new SimpleDateFormat("mm:ss.0");
|
||||
textFormatter[0x30] = new DecimalFormat("##0.0E0");
|
||||
}
|
||||
|
||||
public String format(short index, Object value) {
|
||||
if (index == 0)
|
||||
return value.toString();
|
||||
if (textFormatter[index] == null)
|
||||
throw new RuntimeException("Sorry. I cant handle the format code :"+Integer.toHexString(index));
|
||||
return textFormatter[index].format(value);
|
||||
}
|
||||
|
||||
public String format(short index, double value) {
|
||||
if (index == 0)
|
||||
return generalNumberFormat.format(value);
|
||||
if (textFormatter[index] == null)
|
||||
throw new RuntimeException("Sorry. I cant handle the format code :"+Integer.toHexString(index));
|
||||
if (textFormatter[index] instanceof DecimalFormat) {
|
||||
return ((DecimalFormat)textFormatter[index]).format(value);
|
||||
}
|
||||
if (textFormatter[index] instanceof SVFractionalFormat) {
|
||||
return ((SVFractionalFormat)textFormatter[index]).format(value);
|
||||
}
|
||||
throw new RuntimeException("Sorry. I cant handle a non decimal formatter for a decimal value :"+Integer.toHexString(index));
|
||||
}
|
||||
|
||||
public boolean useRedColor(short index, double value) {
|
||||
return (((index == 0x06)||(index == 0x08)||(index == 0x26) || (index == 0x27)) && (value < 0));
|
||||
}
|
||||
}
|
||||
|
||||
private final CellFormatter cellFormatter = new CellFormatter();
|
||||
|
||||
public SVTableCellRenderer(HSSFWorkbook wb) {
|
||||
super();
|
||||
setOpaque(true);
|
||||
setBorder(noFocusBorder);
|
||||
this.wb = wb;
|
||||
}
|
||||
|
||||
public Component getTableCellRendererComponent(JTable table, Object value,
|
||||
boolean isSelected, boolean hasFocus, int row, int column) {
|
||||
boolean isBorderSet = false;
|
||||
|
||||
//If the JTables default cell renderer has been setup correctly the
|
||||
//value will be the HSSFCell that we are trying to render
|
||||
HSSFCell c = (HSSFCell)value;
|
||||
|
||||
if (c != null) {
|
||||
HSSFCellStyle s = c.getCellStyle();
|
||||
HSSFFont f = wb.getFontAt(s.getFontIndex());
|
||||
setFont(SVTableUtils.makeFont(f));
|
||||
|
||||
if (s.getFillPattern() == HSSFCellStyle.SOLID_FOREGROUND) {
|
||||
setBackground(SVTableUtils.getAWTColor(s.getFillForegroundColor(), SVTableUtils.white));
|
||||
} else setBackground(SVTableUtils.white);
|
||||
|
||||
setForeground(SVTableUtils.getAWTColor(f.getColor(), SVTableUtils.black));
|
||||
|
||||
cellBorder.setBorder(SVTableUtils.getAWTColor(s.getTopBorderColor(), SVTableUtils.black),
|
||||
SVTableUtils.getAWTColor(s.getRightBorderColor(), SVTableUtils.black),
|
||||
SVTableUtils.getAWTColor(s.getBottomBorderColor(), SVTableUtils.black),
|
||||
SVTableUtils.getAWTColor(s.getLeftBorderColor(), SVTableUtils.black),
|
||||
s.getBorderTop(), s.getBorderRight(),
|
||||
s.getBorderBottom(), s.getBorderLeft(),
|
||||
hasFocus);
|
||||
setBorder(cellBorder);
|
||||
isBorderSet=true;
|
||||
|
||||
//Set the value that is rendered for the cell
|
||||
switch (c.getCellType()) {
|
||||
case HSSFCell.CELL_TYPE_BLANK:
|
||||
setValue("");
|
||||
break;
|
||||
case HSSFCell.CELL_TYPE_BOOLEAN:
|
||||
if (c.getBooleanCellValue()) {
|
||||
setValue("true");
|
||||
} else {
|
||||
setValue("false");
|
||||
}
|
||||
break;
|
||||
case HSSFCell.CELL_TYPE_NUMERIC:
|
||||
short format = s.getDataFormat();
|
||||
double numericValue = c.getNumericCellValue();
|
||||
if (cellFormatter.useRedColor(format, numericValue))
|
||||
setForeground(Color.red);
|
||||
else setForeground(null);
|
||||
setValue(cellFormatter.format(format, c.getNumericCellValue()));
|
||||
break;
|
||||
case HSSFCell.CELL_TYPE_STRING:
|
||||
setValue(c.getStringCellValue());
|
||||
break;
|
||||
case HSSFCell.CELL_TYPE_FORMULA:
|
||||
default:
|
||||
setValue("?");
|
||||
}
|
||||
//Set the text alignment of the cell
|
||||
switch (s.getAlignment()) {
|
||||
case HSSFCellStyle.ALIGN_LEFT:
|
||||
case HSSFCellStyle.ALIGN_JUSTIFY:
|
||||
case HSSFCellStyle.ALIGN_FILL:
|
||||
setHorizontalAlignment(SwingConstants.LEFT);
|
||||
break;
|
||||
case HSSFCellStyle.ALIGN_CENTER:
|
||||
case HSSFCellStyle.ALIGN_CENTER_SELECTION:
|
||||
setHorizontalAlignment(SwingConstants.CENTER);
|
||||
break;
|
||||
case HSSFCellStyle.ALIGN_GENERAL:
|
||||
case HSSFCellStyle.ALIGN_RIGHT:
|
||||
setHorizontalAlignment(SwingConstants.RIGHT);
|
||||
break;
|
||||
default:
|
||||
setHorizontalAlignment(SwingConstants.LEFT);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
setValue("");
|
||||
setBackground(SVTableUtils.white);
|
||||
}
|
||||
|
||||
|
||||
if (hasFocus) {
|
||||
if (!isBorderSet) {
|
||||
//This is the border to paint when there is no border
|
||||
//and the cell has focus
|
||||
cellBorder.setBorder(SVTableUtils.black,
|
||||
SVTableUtils.black,
|
||||
SVTableUtils.black,
|
||||
SVTableUtils.black,
|
||||
HSSFCellStyle.BORDER_NONE,
|
||||
HSSFCellStyle.BORDER_NONE,
|
||||
HSSFCellStyle.BORDER_NONE,
|
||||
HSSFCellStyle.BORDER_NONE,
|
||||
isSelected);
|
||||
setBorder(cellBorder);
|
||||
}
|
||||
if (table.isCellEditable(row, column)) {
|
||||
setForeground( UIManager.getColor("Table.focusCellForeground") );
|
||||
setBackground( UIManager.getColor("Table.focusCellBackground") );
|
||||
}
|
||||
} else if (!isBorderSet) {
|
||||
setBorder(noFocusBorder);
|
||||
}
|
||||
|
||||
// ---- begin optimization to avoid painting background ----
|
||||
Color back = getBackground();
|
||||
boolean colorMatch = (back != null) && ( back.equals(table.getBackground()) ) && table.isOpaque();
|
||||
setOpaque(!colorMatch);
|
||||
// ---- end optimization to aviod painting background ----
|
||||
return this;
|
||||
}
|
||||
|
||||
public void validate() {}
|
||||
|
||||
public void revalidate() {}
|
||||
|
||||
public void repaint(long tm, int x, int y, int width, int height) {}
|
||||
|
||||
public void repaint(Rectangle r) { }
|
||||
|
||||
protected void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
|
||||
// Strings get interned...
|
||||
if (propertyName=="text") {
|
||||
super.firePropertyChange(propertyName, oldValue, newValue);
|
||||
}
|
||||
}
|
||||
|
||||
public void firePropertyChange(String propertyName, boolean oldValue, boolean newValue) { }
|
||||
|
||||
/**
|
||||
* Sets the string to either the value or "" if the value is null.
|
||||
*
|
||||
*/
|
||||
protected void setValue(Object value) {
|
||||
setText((value == null) ? "" : value.toString());
|
||||
}
|
||||
}
|
@ -0,0 +1,86 @@
|
||||
|
||||
/* ====================================================================
|
||||
Copyright 2002-2004 Apache Software Foundation
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
==================================================================== */
|
||||
|
||||
|
||||
|
||||
package org.apache.poi.hssf.contrib.view;
|
||||
|
||||
import java.util.Iterator;
|
||||
import javax.swing.table.*;
|
||||
|
||||
import org.apache.poi.hssf.usermodel.HSSFRow;
|
||||
import org.apache.poi.hssf.usermodel.HSSFSheet;
|
||||
import org.apache.poi.hssf.usermodel.HSSFCell;
|
||||
|
||||
/**
|
||||
* Sheet Viewer Table Model - The model for the Sheet Viewer just overrides things.
|
||||
* @author Andrew C. Oliver
|
||||
*/
|
||||
|
||||
public class SVTableModel extends AbstractTableModel {
|
||||
private HSSFSheet st = null;
|
||||
int maxcol = 0;
|
||||
|
||||
public SVTableModel(HSSFSheet st, int maxcol) {
|
||||
this.st = st;
|
||||
this.maxcol=maxcol;
|
||||
}
|
||||
|
||||
public SVTableModel(HSSFSheet st) {
|
||||
this.st = st;
|
||||
Iterator i = st.rowIterator();
|
||||
|
||||
while (i.hasNext()) {
|
||||
HSSFRow row = (HSSFRow)i.next();
|
||||
if (maxcol < (row.getLastCellNum()+1)) {
|
||||
this.maxcol = row.getLastCellNum();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public int getColumnCount() {
|
||||
return this.maxcol+1;
|
||||
}
|
||||
public Object getValueAt(int row, int col) {
|
||||
HSSFRow r = st.getRow(row);
|
||||
HSSFCell c = null;
|
||||
if (r != null) {
|
||||
c = r.getCell((short)col);
|
||||
}
|
||||
return c;
|
||||
}
|
||||
public int getRowCount() {
|
||||
return st.getLastRowNum() + 1;
|
||||
}
|
||||
|
||||
public Class getColumnClass(int c) {
|
||||
return HSSFCell.class;
|
||||
}
|
||||
|
||||
public boolean isCellEditable(int rowIndex, int columnIndex) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
|
||||
if (aValue != null)
|
||||
System.out.println("SVTableModel.setValueAt. value type = "+aValue.getClass().getName());
|
||||
else System.out.println("SVTableModel.setValueAt. value type = null");
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,97 @@
|
||||
/* ====================================================================
|
||||
Copyright 2003-2004 Apache Software Foundation
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
==================================================================== */
|
||||
|
||||
package org.apache.poi.hssf.contrib.view;
|
||||
|
||||
import java.util.*;
|
||||
import java.awt.*;
|
||||
import javax.swing.border.*;
|
||||
|
||||
import org.apache.poi.hssf.usermodel.*;
|
||||
import org.apache.poi.hssf.util.*;
|
||||
|
||||
/**
|
||||
* SVTableCell Editor and Renderer helper functions.
|
||||
*
|
||||
* @author Jason Height
|
||||
* @created 16 July 2002
|
||||
*/
|
||||
public class SVTableUtils {
|
||||
private final static Hashtable colors = HSSFColor.getIndexHash();
|
||||
/** Description of the Field */
|
||||
public final static Color black = getAWTColor(new HSSFColor.BLACK());
|
||||
/** Description of the Field */
|
||||
public final static Color white = getAWTColor(new HSSFColor.WHITE());
|
||||
/** Description of the Field */
|
||||
public static Border noFocusBorder = new EmptyBorder(1, 1, 1, 1);
|
||||
|
||||
|
||||
/**
|
||||
* Creates a new font for a specific cell style
|
||||
*
|
||||
* @param wb Description of the Parameter
|
||||
* @param style Description of the Parameter
|
||||
* @return Description of the Return Value
|
||||
*/
|
||||
public static Font makeFont(HSSFFont font) {
|
||||
boolean isbold = font.getBoldweight() > HSSFFont.BOLDWEIGHT_NORMAL;
|
||||
boolean isitalics = font.getItalic();
|
||||
int fontstyle = Font.PLAIN;
|
||||
if (isbold) {
|
||||
fontstyle = Font.BOLD;
|
||||
}
|
||||
if (isitalics) {
|
||||
fontstyle = fontstyle | Font.ITALIC;
|
||||
}
|
||||
|
||||
int fontheight = font.getFontHeightInPoints();
|
||||
if (fontheight == 9) {
|
||||
//fix for stupid ol Windows
|
||||
fontheight = 10;
|
||||
}
|
||||
|
||||
return new Font(font.getFontName(), fontstyle, fontheight);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method retrieves the AWT Color representation from the colour hash table
|
||||
*
|
||||
* @param index Description of the Parameter
|
||||
* @param deflt Description of the Parameter
|
||||
* @return The aWTColor value
|
||||
*/
|
||||
public final static Color getAWTColor(int index, Color deflt) {
|
||||
HSSFColor clr = (HSSFColor) colors.get(new Integer(index));
|
||||
if (clr == null) {
|
||||
return deflt;
|
||||
}
|
||||
return getAWTColor(clr);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the aWTColor attribute of the SVTableUtils class
|
||||
*
|
||||
* @param clr Description of the Parameter
|
||||
* @return The aWTColor value
|
||||
*/
|
||||
public final static Color getAWTColor(HSSFColor clr) {
|
||||
short[] rgb = clr.getTriplet();
|
||||
return new Color(rgb[0], rgb[1], rgb[2]);
|
||||
}
|
||||
|
||||
}
|
170
src/contrib/src/org/apache/poi/hssf/contrib/view/SViewer.java
Normal file
170
src/contrib/src/org/apache/poi/hssf/contrib/view/SViewer.java
Normal file
@ -0,0 +1,170 @@
|
||||
|
||||
/* ====================================================================
|
||||
Copyright 2002-2004 Apache Software Foundation
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
==================================================================== */
|
||||
|
||||
|
||||
|
||||
package org.apache.poi.hssf.contrib.view;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.net.*;
|
||||
import java.applet.*;
|
||||
import java.io.*;
|
||||
import javax.swing.*;
|
||||
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.hssf.usermodel.HSSFSheet;
|
||||
import org.apache.poi.hssf.usermodel.HSSFCell;
|
||||
|
||||
/**
|
||||
* Sheet Viewer - Views XLS files via HSSF. Can be used as an applet with
|
||||
* filename="" or as a applications (pass the filename as the first parameter).
|
||||
* Or you can pass it a URL in a "url" parameter when run as an applet or just
|
||||
* that first parameter must start with http:// and it will guess its a url. I
|
||||
* only tested it as an applet though, so it probably won't work...you fix it.
|
||||
*
|
||||
* @author Andrew C. Oliver
|
||||
* @author Jason Height
|
||||
*/
|
||||
public class SViewer extends JApplet {
|
||||
private SViewerPanel panel;
|
||||
boolean isStandalone = false;
|
||||
String filename = null;
|
||||
|
||||
/**Get a parameter value*/
|
||||
public String getParameter(String key, String def) {
|
||||
return isStandalone ? System.getProperty(key, def) :
|
||||
(getParameter(key) != null ? getParameter(key) : def);
|
||||
}
|
||||
|
||||
/**Construct the applet*/
|
||||
public SViewer() {
|
||||
}
|
||||
|
||||
/**Initialize the applet*/
|
||||
public void init() {
|
||||
try {
|
||||
jbInit();
|
||||
}
|
||||
catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
/**Component initialization*/
|
||||
private void jbInit() throws Exception {
|
||||
InputStream i = null;
|
||||
boolean isurl = false;
|
||||
if (filename == null) filename = getParameter("filename");
|
||||
|
||||
if (filename == null || filename.substring(0,7).equals("http://")) {
|
||||
isurl = true;
|
||||
if (filename == null) filename = getParameter("url");
|
||||
i = getXLSFromURL(filename);
|
||||
}
|
||||
|
||||
HSSFWorkbook wb = null;
|
||||
if (isurl) {
|
||||
wb = constructWorkbook(i);
|
||||
} else {
|
||||
wb = constructWorkbook(filename);
|
||||
}
|
||||
panel = new SViewerPanel(wb, false);
|
||||
getContentPane().setLayout(new BorderLayout());
|
||||
getContentPane().add(panel, BorderLayout.CENTER);
|
||||
}
|
||||
|
||||
private HSSFWorkbook constructWorkbook(String filename) throws FileNotFoundException, IOException {
|
||||
HSSFWorkbook wb = null;
|
||||
FileInputStream in = new FileInputStream(filename);
|
||||
wb = new HSSFWorkbook(in);
|
||||
in.close();
|
||||
return wb;
|
||||
}
|
||||
|
||||
private HSSFWorkbook constructWorkbook(InputStream in) throws IOException {
|
||||
HSSFWorkbook wb = null;
|
||||
|
||||
wb = new HSSFWorkbook(in);
|
||||
in.close();
|
||||
return wb;
|
||||
}
|
||||
|
||||
/**Start the applet*/
|
||||
public void start() {
|
||||
}
|
||||
/**Stop the applet*/
|
||||
public void stop() {
|
||||
}
|
||||
/**Destroy the applet*/
|
||||
public void destroy() {
|
||||
}
|
||||
/**Get Applet information*/
|
||||
public String getAppletInfo() {
|
||||
return "Applet Information";
|
||||
}
|
||||
/**Get parameter info*/
|
||||
public String[][] getParameterInfo() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* opens a url and returns an inputstream
|
||||
*
|
||||
*/
|
||||
private InputStream getXLSFromURL(String urlstring) throws MalformedURLException, IOException {
|
||||
URL url = new URL(urlstring);
|
||||
URLConnection uc = url.openConnection();
|
||||
String field = uc.getHeaderField(0);
|
||||
for (int i=0;field != null; i++) {
|
||||
System.out.println(field);
|
||||
field = uc.getHeaderField(i);
|
||||
}
|
||||
BufferedInputStream is = new BufferedInputStream(uc.getInputStream());
|
||||
return is;
|
||||
}
|
||||
|
||||
|
||||
/**Main method*/
|
||||
public static void main(String[] args) {
|
||||
SViewer applet = new SViewer();
|
||||
applet.isStandalone = true;
|
||||
applet.filename = args[0];
|
||||
Frame frame;
|
||||
frame = new Frame() {
|
||||
protected void processWindowEvent(WindowEvent e) {
|
||||
super.processWindowEvent(e);
|
||||
if (e.getID() == WindowEvent.WINDOW_CLOSING) {
|
||||
System.exit(0);
|
||||
}
|
||||
}
|
||||
public synchronized void setTitle(String title) {
|
||||
super.setTitle(title);
|
||||
enableEvents(AWTEvent.WINDOW_EVENT_MASK);
|
||||
}
|
||||
};
|
||||
frame.setTitle("Applet Frame");
|
||||
frame.add(applet, BorderLayout.CENTER);
|
||||
applet.init();
|
||||
applet.start();
|
||||
frame.setSize(400,320);
|
||||
Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
frame.setLocation((d.width - frame.getSize().width) / 2, (d.height - frame.getSize().height) / 2);
|
||||
frame.setVisible(true);
|
||||
}
|
||||
}
|
@ -0,0 +1,292 @@
|
||||
|
||||
/* ====================================================================
|
||||
Copyright 2002-2004 Apache Software Foundation
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
==================================================================== */
|
||||
|
||||
|
||||
|
||||
package org.apache.poi.hssf.contrib.view;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.io.*;
|
||||
import javax.swing.*;
|
||||
import javax.swing.table.*;
|
||||
import javax.swing.event.*;
|
||||
|
||||
import org.apache.poi.hssf.usermodel.*;
|
||||
|
||||
/**
|
||||
* This class presents the sheets to the user.
|
||||
*
|
||||
*
|
||||
* @author Andrew C. Oliver
|
||||
* @author Jason Height
|
||||
*/
|
||||
public class SViewerPanel extends JPanel {
|
||||
/** This field is the magic number to convert from a Character width to a
|
||||
* java pixel width.
|
||||
*
|
||||
* When the "normal" font size in a workbook changes, this effects all
|
||||
* of the heights and widths. Unfortunately there is no way to retrieve this
|
||||
* information, hence the MAGIC number.
|
||||
*
|
||||
* This number may only work for the normal style font size of Arial size 10.
|
||||
*
|
||||
*/
|
||||
private static final int magicCharFactor = 7;
|
||||
/** Reference to the woorkbook that is being displayed*/
|
||||
private HSSFWorkbook wb;
|
||||
/** Reference to the tabs component*/
|
||||
private JTabbedPane sheetPane;
|
||||
/** Reference to the cell renderer that is used to render all cells*/
|
||||
private SVTableCellRenderer cellRenderer;
|
||||
/** Reference to the cell editor that is used to edit all cells.
|
||||
* Only constructed if editing is allowed
|
||||
*/
|
||||
private SVTableCellEditor cellEditor;
|
||||
/** Flag indicating if editing is allowed. Otherwise the viewer is in
|
||||
* view only mode.
|
||||
*/
|
||||
private boolean allowEdits;
|
||||
|
||||
/**Construct the representation of the workbook*/
|
||||
public SViewerPanel(HSSFWorkbook wb, boolean allowEdits) {
|
||||
this.wb = wb;
|
||||
this.allowEdits = allowEdits;
|
||||
|
||||
initialiseGui();
|
||||
}
|
||||
|
||||
private void initialiseGui() {
|
||||
cellRenderer = new SVTableCellRenderer(this.wb);
|
||||
if (allowEdits)
|
||||
cellEditor = new SVTableCellEditor(this.wb);
|
||||
|
||||
//Initialise the Panel
|
||||
sheetPane = new JTabbedPane(JTabbedPane.BOTTOM);
|
||||
|
||||
if (allowEdits)
|
||||
sheetPane.addMouseListener(createTabListener());
|
||||
int sheetCount = wb.getNumberOfSheets();
|
||||
for (int i=0; i<sheetCount;i++) {
|
||||
String sheetName = wb.getSheetName(i);
|
||||
//Add the new sheet to the tabbed pane
|
||||
sheetPane.addTab(sheetName, makeSheetView(wb.getSheetAt(i)));
|
||||
}
|
||||
setLayout(new BorderLayout());
|
||||
add(sheetPane, BorderLayout.CENTER);
|
||||
}
|
||||
|
||||
protected JComponent makeSheetView(HSSFSheet sheet) {
|
||||
JTable sheetView = new JTable(new SVTableModel(sheet));
|
||||
sheetView.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
|
||||
sheetView.setDefaultRenderer(HSSFCell.class, cellRenderer);
|
||||
if (allowEdits)
|
||||
sheetView.setDefaultEditor(HSSFCell.class, cellEditor);
|
||||
JTableHeader header = sheetView.getTableHeader();
|
||||
//Dont allow column reordering
|
||||
header.setReorderingAllowed(false);
|
||||
//Only allow column resizing if editing is allowed
|
||||
header.setResizingAllowed(allowEdits);
|
||||
|
||||
//Set the columns the correct size
|
||||
TableColumnModel columns = sheetView.getColumnModel();
|
||||
for (int i=0; i< columns.getColumnCount(); i++) {
|
||||
TableColumn column = columns.getColumn(i);
|
||||
short width = sheet.getColumnWidth((short)i);
|
||||
//256 is because the width is in 256ths of a character
|
||||
column.setPreferredWidth(width/256*magicCharFactor);
|
||||
}
|
||||
|
||||
//Set the rows to the correct size
|
||||
int rows = sheet.getPhysicalNumberOfRows();
|
||||
Insets insets = cellRenderer.getInsets();
|
||||
//Need to include the insets in the calculation of the row height to use.
|
||||
int extraHeight = insets.bottom+insets.top;
|
||||
for (int i=0; i< rows; i++) {
|
||||
HSSFRow row = sheet.getRow(i);
|
||||
if (row == null) {
|
||||
sheetView.setRowHeight(i, (int)sheet.getDefaultRowHeightInPoints()+extraHeight);
|
||||
} else {
|
||||
sheetView.setRowHeight(i, (int)row.getHeightInPoints()+extraHeight);
|
||||
}
|
||||
}
|
||||
|
||||
//Add the row header to the sheet
|
||||
SVRowHeader rowHeader = new SVRowHeader(sheet, sheetView, extraHeight);
|
||||
JScrollPane scroll = new JScrollPane( sheetView );
|
||||
scroll.setRowHeaderView(rowHeader);
|
||||
return scroll;
|
||||
}
|
||||
|
||||
public void paint(Graphics g) {
|
||||
//JMH I am only overriding this to get a picture of the time taken to paint
|
||||
long start = System.currentTimeMillis();
|
||||
super.paint(g);
|
||||
long elapsed = System.currentTimeMillis()-start;
|
||||
System.out.println("Paint time = "+elapsed);
|
||||
}
|
||||
|
||||
protected MouseListener createTabListener() {
|
||||
return new TabListener();
|
||||
}
|
||||
|
||||
/** This class defines the default MouseListener that listens to
|
||||
* mouse events in the tabbed pane
|
||||
*
|
||||
* The default is to popup a menu when the event occurs over a tab
|
||||
*/
|
||||
private class TabListener implements MouseListener {
|
||||
public JPopupMenu popup;
|
||||
public TabListener() {
|
||||
popup = new JPopupMenu("Sheet");
|
||||
popup.add(createInsertSheetAction());
|
||||
popup.add(createDeleteSheetAction());
|
||||
popup.add(createRenameSheetAction());
|
||||
}
|
||||
|
||||
protected Action createInsertSheetAction() {
|
||||
return new InsertSheetAction();
|
||||
}
|
||||
|
||||
protected Action createDeleteSheetAction() {
|
||||
return new DeleteSheetAction();
|
||||
}
|
||||
|
||||
protected Action createRenameSheetAction() {
|
||||
return new RenameSheetAction();
|
||||
}
|
||||
|
||||
|
||||
/** This method will display the popup if the mouseevent is a popup event
|
||||
* and the event occurred over a tab
|
||||
*/
|
||||
protected void checkPopup(MouseEvent e) {
|
||||
if (e.isPopupTrigger()) {
|
||||
int tab = sheetPane.getUI().tabForCoordinate(sheetPane, e.getX(), e.getY());
|
||||
if (tab != -1) {
|
||||
popup.show(sheetPane, e.getX(), e.getY());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
checkPopup(e);
|
||||
}
|
||||
|
||||
public void mousePressed(MouseEvent e) {
|
||||
checkPopup(e);
|
||||
}
|
||||
|
||||
public void mouseReleased(MouseEvent e) {
|
||||
checkPopup(e);
|
||||
}
|
||||
|
||||
public void mouseEntered(MouseEvent e) {}
|
||||
public void mouseExited(MouseEvent e) {}
|
||||
}
|
||||
|
||||
/** This class defines the action that is performed when the sheet is renamed*/
|
||||
private class RenameSheetAction extends AbstractAction {
|
||||
public RenameSheetAction() {
|
||||
super("Rename");
|
||||
}
|
||||
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
int tabIndex = sheetPane.getSelectedIndex();
|
||||
if (tabIndex != -1) {
|
||||
String newSheetName = (String)JOptionPane.showInputDialog(sheetPane, "Enter a new Sheetname", "Rename Sheet", JOptionPane.QUESTION_MESSAGE);
|
||||
if (newSheetName != null) {
|
||||
wb.setSheetName(tabIndex, newSheetName);
|
||||
sheetPane.setTitleAt(tabIndex, newSheetName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** This class defines the action that is performed when a sheet is inserted*/
|
||||
private class InsertSheetAction extends AbstractAction {
|
||||
public InsertSheetAction() {
|
||||
super("Insert");
|
||||
}
|
||||
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
//Create a new sheet then search for the sheet and make sure that the
|
||||
//sheetPane shows it.
|
||||
HSSFSheet newSheet = wb.createSheet();
|
||||
for (int i=0; i<wb.getNumberOfSheets();i++) {
|
||||
HSSFSheet sheet = wb.getSheetAt(i);
|
||||
if (newSheet == sheet) {
|
||||
sheetPane.insertTab(wb.getSheetName(i), null, makeSheetView(sheet), null, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** This class defines the action that is performed when the sheet is deleted*/
|
||||
private class DeleteSheetAction extends AbstractAction {
|
||||
public DeleteSheetAction() {
|
||||
super("Delete");
|
||||
}
|
||||
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
int tabIndex = sheetPane.getSelectedIndex();
|
||||
if (tabIndex != -1) {
|
||||
if (JOptionPane.showConfirmDialog(sheetPane, "Are you sure that you want to delete the selected sheet", "Delete Sheet?", JOptionPane.OK_CANCEL_OPTION) == JOptionPane.OK_OPTION) {
|
||||
wb.removeSheetAt(tabIndex);
|
||||
sheetPane.remove(tabIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isEditable() {
|
||||
return allowEdits;
|
||||
}
|
||||
|
||||
/**Main method*/
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
FileInputStream in = new FileInputStream(args[0]);
|
||||
HSSFWorkbook wb = new HSSFWorkbook(in);
|
||||
in.close();
|
||||
|
||||
SViewerPanel p = new SViewerPanel(wb, true);
|
||||
JFrame frame;
|
||||
frame = new JFrame() {
|
||||
protected void processWindowEvent(WindowEvent e) {
|
||||
super.processWindowEvent(e);
|
||||
if (e.getID() == WindowEvent.WINDOW_CLOSING) {
|
||||
System.exit(0);
|
||||
}
|
||||
}
|
||||
public synchronized void setTitle(String title) {
|
||||
super.setTitle(title);
|
||||
enableEvents(AWTEvent.WINDOW_EVENT_MASK);
|
||||
}
|
||||
};
|
||||
frame.setTitle("Viewer Frame");
|
||||
frame.getContentPane().add(p, BorderLayout.CENTER);
|
||||
frame.setSize(800,640);
|
||||
Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
frame.setLocation((d.width - frame.getSize().width) / 2, (d.height - frame.getSize().height) / 2);
|
||||
frame.setVisible(true);
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,264 @@
|
||||
|
||||
/* ====================================================================
|
||||
Copyright 2002-2004 Apache Software Foundation
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
==================================================================== */
|
||||
|
||||
|
||||
package org.apache.poi.hssf.usermodel.contrib;
|
||||
|
||||
|
||||
import org.apache.commons.beanutils.PropertyUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang.exception.NestableException;
|
||||
import org.apache.poi.hssf.usermodel.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Various utility functions that make working with a cells and rows easier. The various
|
||||
* methods that deal with style's allow you to create your HSSFCellStyles as you need them.
|
||||
* When you apply a style change to a cell, the code will attempt to see if a style already
|
||||
* exists that meets your needs. If not, then it will create a new style. This is to prevent
|
||||
* creating too many styles. there is an upper limit in Excel on the number of styles that
|
||||
* can be supported.
|
||||
*
|
||||
*@author Eric Pugh epugh@upstate.com
|
||||
*/
|
||||
|
||||
public class HSSFCellUtil
|
||||
{
|
||||
|
||||
private static HashMap unicodeMappings = new HashMap();
|
||||
|
||||
|
||||
/**
|
||||
* Get a row from the spreadsheet, and create it if it doesn't exist.
|
||||
*
|
||||
*@param rowCounter The 0 based row number
|
||||
*@param sheet The sheet that the row is part of.
|
||||
*@return The row indicated by the rowCounter
|
||||
*/
|
||||
public static HSSFRow getRow( int rowCounter, HSSFSheet sheet )
|
||||
{
|
||||
HSSFRow row = sheet.getRow( (short) rowCounter );
|
||||
if ( row == null )
|
||||
{
|
||||
row = sheet.createRow( (short) rowCounter );
|
||||
}
|
||||
|
||||
return row;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get a specific cell from a row. If the cell doesn't exist, then create it.
|
||||
*
|
||||
*@param row The row that the cell is part of
|
||||
*@param column The column index that the cell is in.
|
||||
*@return The cell indicated by the column.
|
||||
*/
|
||||
public static HSSFCell getCell( HSSFRow row, int column )
|
||||
{
|
||||
HSSFCell cell = row.getCell( (short) column );
|
||||
|
||||
if ( cell == null )
|
||||
{
|
||||
cell = row.createCell( (short) column );
|
||||
}
|
||||
return cell;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates a cell, gives it a value, and applies a style if provided
|
||||
*
|
||||
* @param row the row to create the cell in
|
||||
* @param column the column index to create the cell in
|
||||
* @param value The value of the cell
|
||||
* @param style If the style is not null, then set
|
||||
* @return A new HSSFCell
|
||||
*/
|
||||
|
||||
public static HSSFCell createCell( HSSFRow row, int column, String value, HSSFCellStyle style )
|
||||
{
|
||||
HSSFCell cell = getCell( row, column );
|
||||
|
||||
cell.setCellValue( value );
|
||||
if ( style != null )
|
||||
{
|
||||
cell.setCellStyle( style );
|
||||
}
|
||||
|
||||
return cell;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a cell, and give it a value.
|
||||
*
|
||||
*@param row the row to create the cell in
|
||||
*@param column the column index to create the cell in
|
||||
*@param value The value of the cell
|
||||
*@return A new HSSFCell.
|
||||
*/
|
||||
public static HSSFCell createCell( HSSFRow row, int column, String value )
|
||||
{
|
||||
return createCell( row, column, value, null );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Take a cell, and align it.
|
||||
*
|
||||
*@param cell the cell to set the alignment for
|
||||
*@param workbook The workbook that is being worked with.
|
||||
*@param align the column alignment to use.
|
||||
*@exception NestableException Thrown if an error happens.
|
||||
*
|
||||
* @see HSSFCellStyle for alignment options
|
||||
*/
|
||||
public static void setAlignment( HSSFCell cell, HSSFWorkbook workbook, short align ) throws NestableException
|
||||
{
|
||||
setCellStyleProperty( cell, workbook, "alignment", new Short( align ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Take a cell, and apply a font to it
|
||||
*
|
||||
*@param cell the cell to set the alignment for
|
||||
*@param workbook The workbook that is being worked with.
|
||||
*@param font The HSSFFont that you want to set...
|
||||
*@exception NestableException Thrown if an error happens.
|
||||
*/
|
||||
public static void setFont( HSSFCell cell, HSSFWorkbook workbook, HSSFFont font ) throws NestableException
|
||||
{
|
||||
setCellStyleProperty( cell, workbook, "font", font );
|
||||
}
|
||||
|
||||
/**
|
||||
* This method attempt to find an already existing HSSFCellStyle that matches
|
||||
* what you want the style to be. If it does not find the style, then it
|
||||
* creates a new one. If it does create a new one, then it applyies the
|
||||
* propertyName and propertyValue to the style. This is nessasary because
|
||||
* Excel has an upper limit on the number of Styles that it supports.
|
||||
*
|
||||
*@param workbook The workbook that is being worked with.
|
||||
*@param propertyName The name of the property that is to be
|
||||
* changed.
|
||||
*@param propertyValue The value of the property that is to be
|
||||
* changed.
|
||||
*@param cell The cell that needs it's style changes
|
||||
*@exception NestableException Thrown if an error happens.
|
||||
*/
|
||||
public static void setCellStyleProperty( HSSFCell cell, HSSFWorkbook workbook, String propertyName, Object propertyValue )
|
||||
throws NestableException
|
||||
{
|
||||
try
|
||||
{
|
||||
HSSFCellStyle originalStyle = cell.getCellStyle();
|
||||
HSSFCellStyle newStyle = null;
|
||||
Map values = PropertyUtils.describe( originalStyle );
|
||||
values.put( propertyName, propertyValue );
|
||||
values.remove( "index" );
|
||||
|
||||
// index seems like what index the cellstyle is in the list of styles for a workbook.
|
||||
// not good to compare on!
|
||||
short numberCellStyles = workbook.getNumCellStyles();
|
||||
|
||||
for ( short i = 0; i < numberCellStyles; i++ )
|
||||
{
|
||||
HSSFCellStyle wbStyle = workbook.getCellStyleAt( i );
|
||||
Map wbStyleMap = PropertyUtils.describe( wbStyle );
|
||||
wbStyleMap.remove( "index" );
|
||||
|
||||
if ( wbStyleMap.equals( values ) )
|
||||
{
|
||||
newStyle = wbStyle;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( newStyle == null )
|
||||
{
|
||||
newStyle = workbook.createCellStyle();
|
||||
newStyle.setFont( workbook.getFontAt( originalStyle.getFontIndex() ) );
|
||||
PropertyUtils.copyProperties( newStyle, originalStyle );
|
||||
PropertyUtils.setProperty( newStyle, propertyName, propertyValue );
|
||||
}
|
||||
|
||||
cell.setCellStyle( newStyle );
|
||||
}
|
||||
catch ( Exception e )
|
||||
{
|
||||
e.printStackTrace();
|
||||
|
||||
throw new NestableException( "Couldn't setCellStyleProperty.", e );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Looks for text in the cell that should be unicode, like α and provides the
|
||||
* unicode version of it.
|
||||
*
|
||||
*@param cell The cell to check for unicode values
|
||||
*@return transalted to unicode
|
||||
*/
|
||||
public static HSSFCell translateUnicodeValues( HSSFCell cell )
|
||||
{
|
||||
|
||||
String s = cell.getStringCellValue();
|
||||
boolean foundUnicode = false;
|
||||
|
||||
for ( Iterator i = unicodeMappings.entrySet().iterator(); i.hasNext(); )
|
||||
{
|
||||
Map.Entry entry = (Map.Entry) i.next();
|
||||
String key = (String) entry.getKey();
|
||||
if ( s.toLowerCase().indexOf( key ) != -1 )
|
||||
{
|
||||
s = StringUtils.replace( s, key, "" + entry.getValue().toString() + "" );
|
||||
foundUnicode = true;
|
||||
}
|
||||
}
|
||||
if ( foundUnicode )
|
||||
{
|
||||
cell.setEncoding( HSSFCell.ENCODING_UTF_16 );
|
||||
cell.setCellValue( s );
|
||||
}
|
||||
return cell;
|
||||
}
|
||||
|
||||
|
||||
static {
|
||||
unicodeMappings.put( "α", "\u03B1" );
|
||||
unicodeMappings.put( "β", "\u03B2" );
|
||||
unicodeMappings.put( "γ", "\u03B3" );
|
||||
unicodeMappings.put( "δ", "\u03B4" );
|
||||
unicodeMappings.put( "ε", "\u03B5" );
|
||||
unicodeMappings.put( "ζ", "\u03B6" );
|
||||
unicodeMappings.put( "η", "\u03B7" );
|
||||
unicodeMappings.put( "θ", "\u03B8" );
|
||||
unicodeMappings.put( "ι", "\u03B9" );
|
||||
unicodeMappings.put( "κ", "\u03BA" );
|
||||
unicodeMappings.put( "λ", "\u03BB" );
|
||||
unicodeMappings.put( "μ", "\u03BC" );
|
||||
unicodeMappings.put( "ν", "\u03BD" );
|
||||
unicodeMappings.put( "ξ", "\u03BE" );
|
||||
unicodeMappings.put( "ο", "\u03BF" );
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,226 @@
|
||||
/* ====================================================================
|
||||
Copyright 2003-2004 Apache Software Foundation
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
==================================================================== */
|
||||
|
||||
package org.apache.poi.hssf.usermodel.contrib;
|
||||
|
||||
import org.apache.log4j.Category;
|
||||
|
||||
import org.apache.poi.hssf.usermodel.HSSFCell;
|
||||
import org.apache.poi.hssf.usermodel.HSSFRow;
|
||||
import org.apache.poi.hssf.usermodel.HSSFSheet;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
|
||||
import org.apache.poi.hssf.util.Region;
|
||||
|
||||
import org.apache.commons.lang.exception.NestableException;
|
||||
|
||||
/**
|
||||
* Various utility functions that make working with a region of cells easier.
|
||||
*
|
||||
*@author Eric Pugh epugh@upstate.com
|
||||
*@created July 29, 2002
|
||||
*/
|
||||
|
||||
public class HSSFRegionUtil {
|
||||
private static Category log = Category.getInstance( HSSFRegionUtil.class.getName() );
|
||||
|
||||
/** Constructor for the HSSFRegionUtil object */
|
||||
public HSSFRegionUtil() { }
|
||||
|
||||
/**
|
||||
* Sets the left border for a region of cells by manipulating the cell style
|
||||
* of the indidual cells on the left
|
||||
*
|
||||
*@param border The new border
|
||||
*@param region The region that should have the border
|
||||
*@param workbook The workbook that the region is on.
|
||||
*@param sheet The sheet that the region is on.
|
||||
*@exception NestableException Thrown if the CellStyle can't be changed
|
||||
*/
|
||||
public static void setBorderLeft( short border, Region region, HSSFSheet sheet, HSSFWorkbook workbook )
|
||||
throws NestableException {
|
||||
int rowStart = region.getRowFrom();
|
||||
int rowEnd = region.getRowTo();
|
||||
int column = region.getColumnFrom();
|
||||
|
||||
for ( int i = rowStart; i <= rowEnd; i++ ) {
|
||||
HSSFRow row = HSSFCellUtil.getRow( i, sheet );
|
||||
HSSFCell cell = HSSFCellUtil.getCell( row, column );
|
||||
HSSFCellUtil.setCellStyleProperty( cell, workbook, "borderLeft", new Short( border ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the leftBorderColor attribute of the HSSFRegionUtil object
|
||||
*
|
||||
*@param color The color of the border
|
||||
*@param region The region that should have the border
|
||||
*@param workbook The workbook that the region is on.
|
||||
*@param sheet The sheet that the region is on.
|
||||
*@exception NestableException Thrown if the CellStyle can't be changed
|
||||
* properly.
|
||||
*/
|
||||
public static void setLeftBorderColor( short color, Region region, HSSFSheet sheet, HSSFWorkbook workbook )
|
||||
throws NestableException {
|
||||
int rowStart = region.getRowFrom();
|
||||
int rowEnd = region.getRowTo();
|
||||
int column = region.getColumnFrom();
|
||||
|
||||
for ( int i = rowStart; i <= rowEnd; i++ ) {
|
||||
HSSFRow row = HSSFCellUtil.getRow( i, sheet );
|
||||
HSSFCell cell = HSSFCellUtil.getCell( row, column );
|
||||
HSSFCellUtil.setCellStyleProperty( cell, workbook, "leftBorderColor", new Short( color ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the borderRight attribute of the HSSFRegionUtil object
|
||||
*
|
||||
*@param border The new border
|
||||
*@param region The region that should have the border
|
||||
*@param workbook The workbook that the region is on.
|
||||
*@param sheet The sheet that the region is on.
|
||||
*@exception NestableException Thrown if the CellStyle can't be changed
|
||||
*/
|
||||
public static void setBorderRight( short border, Region region, HSSFSheet sheet, HSSFWorkbook workbook )
|
||||
throws NestableException {
|
||||
int rowStart = region.getRowFrom();
|
||||
int rowEnd = region.getRowTo();
|
||||
int column = region.getColumnTo();
|
||||
|
||||
for ( int i = rowStart; i <= rowEnd; i++ ) {
|
||||
HSSFRow row = HSSFCellUtil.getRow( i, sheet );
|
||||
HSSFCell cell = HSSFCellUtil.getCell( row, column );
|
||||
|
||||
HSSFCellUtil.setCellStyleProperty( cell, workbook, "borderRight", new Short( border ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the rightBorderColor attribute of the HSSFRegionUtil object
|
||||
*
|
||||
*@param color The color of the border
|
||||
*@param region The region that should have the border
|
||||
*@param workbook The workbook that the region is on.
|
||||
*@param sheet The sheet that the region is on.
|
||||
*@exception NestableException Thrown if the CellStyle can't be changed
|
||||
* properly.
|
||||
*/
|
||||
public static void setRightBorderColor( short color, Region region, HSSFSheet sheet, HSSFWorkbook workbook )
|
||||
throws NestableException {
|
||||
int rowStart = region.getRowFrom();
|
||||
int rowEnd = region.getRowTo();
|
||||
int column = region.getColumnTo();
|
||||
|
||||
for ( int i = rowStart; i <= rowEnd; i++ ) {
|
||||
HSSFRow row = HSSFCellUtil.getRow( i, sheet );
|
||||
HSSFCell cell = HSSFCellUtil.getCell( row, column );
|
||||
HSSFCellUtil.setCellStyleProperty( cell, workbook, "rightBorderColor", new Short( color ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the borderBottom attribute of the HSSFRegionUtil object
|
||||
*
|
||||
*@param border The new border
|
||||
*@param region The region that should have the border
|
||||
*@param workbook The workbook that the region is on.
|
||||
*@param sheet The sheet that the region is on.
|
||||
*@exception NestableException Thrown if the CellStyle can't be changed
|
||||
*/
|
||||
public static void setBorderBottom( short border, Region region, HSSFSheet sheet, HSSFWorkbook workbook )
|
||||
throws NestableException {
|
||||
int colStart = region.getColumnFrom();
|
||||
int colEnd = region.getColumnTo();
|
||||
int rowIndex = region.getRowTo();
|
||||
HSSFRow row = HSSFCellUtil.getRow( rowIndex, sheet );
|
||||
for ( int i = colStart; i <= colEnd; i++ ) {
|
||||
|
||||
HSSFCell cell = HSSFCellUtil.getCell( row, i );
|
||||
HSSFCellUtil.setCellStyleProperty( cell, workbook, "borderBottom", new Short( border ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the bottomBorderColor attribute of the HSSFRegionUtil object
|
||||
*
|
||||
*@param color The color of the border
|
||||
*@param region The region that should have the border
|
||||
*@param workbook The workbook that the region is on.
|
||||
*@param sheet The sheet that the region is on.
|
||||
*@exception NestableException Thrown if the CellStyle can't be changed
|
||||
* properly.
|
||||
*/
|
||||
public static void setBottomBorderColor( short color, Region region, HSSFSheet sheet, HSSFWorkbook workbook )
|
||||
throws NestableException {
|
||||
int colStart = region.getColumnFrom();
|
||||
int colEnd = region.getColumnTo();
|
||||
int rowIndex = region.getRowTo();
|
||||
HSSFRow row = HSSFCellUtil.getRow( rowIndex, sheet );
|
||||
for ( int i = colStart; i <= colEnd; i++ ) {
|
||||
HSSFCell cell = HSSFCellUtil.getCell( row, i );
|
||||
HSSFCellUtil.setCellStyleProperty( cell, workbook, "bottomBorderColor", new Short( color ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the borderBottom attribute of the HSSFRegionUtil object
|
||||
*
|
||||
*@param border The new border
|
||||
*@param region The region that should have the border
|
||||
*@param workbook The workbook that the region is on.
|
||||
*@param sheet The sheet that the region is on.
|
||||
*@exception NestableException Thrown if the CellStyle can't be changed
|
||||
*/
|
||||
public static void setBorderTop( short border, Region region, HSSFSheet sheet, HSSFWorkbook workbook )
|
||||
throws NestableException {
|
||||
int colStart = region.getColumnFrom();
|
||||
int colEnd = region.getColumnTo();
|
||||
int rowIndex = region.getRowFrom();
|
||||
HSSFRow row = HSSFCellUtil.getRow( rowIndex, sheet );
|
||||
for ( int i = colStart; i <= colEnd; i++ ) {
|
||||
|
||||
HSSFCell cell = HSSFCellUtil.getCell( row, i );
|
||||
HSSFCellUtil.setCellStyleProperty( cell, workbook, "borderTop", new Short( border ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the topBorderColor attribute of the HSSFRegionUtil object
|
||||
*
|
||||
*@param color The color of the border
|
||||
*@param region The region that should have the border
|
||||
*@param workbook The workbook that the region is on.
|
||||
*@param sheet The sheet that the region is on.
|
||||
*@exception NestableException Thrown if the CellStyle can't be changed
|
||||
* properly.
|
||||
*/
|
||||
public static void setTopBorderColor( short color, Region region, HSSFSheet sheet, HSSFWorkbook workbook )
|
||||
throws NestableException {
|
||||
int colStart = region.getColumnFrom();
|
||||
int colEnd = region.getColumnTo();
|
||||
int rowIndex = region.getRowFrom();
|
||||
HSSFRow row = HSSFCellUtil.getRow( rowIndex, sheet );
|
||||
for ( int i = colStart; i <= colEnd; i++ ) {
|
||||
HSSFCell cell = HSSFCellUtil.getCell( row, i );
|
||||
HSSFCellUtil.setCellStyleProperty( cell, workbook, "topBorderColor", new Short( color ) );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
0
src/contrib/testcases/dummy.txt
Normal file
0
src/contrib/testcases/dummy.txt
Normal file
10
src/documentation/README.txt
Normal file
10
src/documentation/README.txt
Normal file
@ -0,0 +1,10 @@
|
||||
This is the base documentation directory. It usually contains two files:
|
||||
|
||||
skinconf.xml # This file customizes Forrest for your project. In it, you
|
||||
# tell forrest the project name, logo, copyright info, etc
|
||||
|
||||
sitemap.xmap # Optional. This sitemap overrides the default one bundled
|
||||
# with Forrest. Typically, one would copy a sitemap from
|
||||
# xml-forrest/src/resources/conf/sitemap.xmap, and customize
|
||||
# it.
|
||||
|
21
src/documentation/Release-Checklist.txt
Normal file
21
src/documentation/Release-Checklist.txt
Normal file
@ -0,0 +1,21 @@
|
||||
Release Checklist
|
||||
-----------------
|
||||
|
||||
- build distributions
|
||||
- sign distributions
|
||||
- Generate announcements and HEADER.html
|
||||
- upload distributions to correct dir
|
||||
- tag CVS
|
||||
- generate www pages and upload
|
||||
- bump release ID
|
||||
- send announcements to announcement@apache.org, announcements@xml.apache.org, announcements@jakarta.apache.org
|
||||
- news to newsgroups: comp.lang.java.softwaretools
|
||||
- post stories on
|
||||
*) jakarta news page
|
||||
*) theserverside.com
|
||||
*) freshmeat.net
|
||||
*) www.javaworld.com
|
||||
*) www.javalobby.com
|
||||
*) www.jguru.com
|
||||
*) www.slashdot.org
|
||||
(and follow them up)
|
69
src/documentation/content/xdocs/3rdparty.xml
Normal file
69
src/documentation/content/xdocs/3rdparty.xml
Normal file
@ -0,0 +1,69 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Copyright (C) 2004 The Apache Software Foundation. All rights reserved. -->
|
||||
<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.1//EN" "document-v11.dtd">
|
||||
|
||||
<document>
|
||||
<header>
|
||||
<title>Third Party Contributions</title>
|
||||
<authors>
|
||||
<person name="Nicola Ken Barozzi" email="barozzi@nicolaken.com"/>
|
||||
</authors>
|
||||
</header>
|
||||
|
||||
<body>
|
||||
|
||||
<section><title>How to Contribute</title>
|
||||
<p>
|
||||
See <link href="contrib.xml">How to contribute to Poi</link>.
|
||||
</p>
|
||||
|
||||
</section>
|
||||
|
||||
<section><title>Contributed Components</title>
|
||||
<p>
|
||||
These are not necessarily deemed to be high enough quality to be included in the
|
||||
core distribution, but they have been tested under <link href="contrib.xml">
|
||||
several key environments</link>, they are provided under the same license
|
||||
as Poi, and they are included in the POI distribution under the
|
||||
<code>contrib/</code> directory.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>None as yet!</strong> - although you can expect that some of the links
|
||||
listed below will eventually migrate to the "contributed components" level, and
|
||||
then maybe even into the main distribution.
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<section><title>Patch Queue</title>
|
||||
<p><link href="patches.html">Submissions of modifications</link>
|
||||
to Poi which are awaiting review. Anyone can
|
||||
comment on them on the dev mailing list - code reviewers are needed!
|
||||
<strong>Use these at your own risk</strong> - although Poi has no guarantee
|
||||
either, these patches have not been reviewed, let alone accepted.
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<section><title>Other Extensions</title>
|
||||
<p>The other extensions listed here are <strong>not endorsed</strong> by the Poi
|
||||
project either - they are provided as a convenience only. They may or may not work,
|
||||
they may or may not be open source, etc.
|
||||
</p>
|
||||
|
||||
<p>To have a link added to this table, see <link href="contrib.xml">How to contribute
|
||||
to POI</link>.</p>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th>Name and Link</th>
|
||||
<th>Type</th>
|
||||
<th>Description</th>
|
||||
<th>Status</th>
|
||||
<th>Licensing</th>
|
||||
<th>Contact</th>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</section>
|
||||
</body>
|
||||
</document>
|
65
src/documentation/content/xdocs/book.xml
Normal file
65
src/documentation/content/xdocs/book.xml
Normal file
@ -0,0 +1,65 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Copyright (C) 2004 The Apache Software Foundation. All rights reserved. -->
|
||||
<!DOCTYPE book PUBLIC "-//APACHE//DTD Cocoon Documentation Book V1.0//EN" "./dtd/book-cocoon-v10.dtd">
|
||||
|
||||
<book software="Poi"
|
||||
title="Poi Project Documentation"
|
||||
copyright="@year@ Poi Project"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
|
||||
<menu label="Community">
|
||||
<menu-item label="News" href="news.html"/>
|
||||
<menu-item label="Mirrors" href="mirrors.html"/>
|
||||
<menu-item label="Changes" href="site:changes"/>
|
||||
<menu-item label="To Do" href="todo.html"/>
|
||||
<menu-item label="Get Involved" href="getinvolved/index.html"/>
|
||||
<menu-item label="Mailing Lists" href="http://jakarta.apache.org/site/mail.html"/>
|
||||
<menu-item label="Vision" href="plan/POI20Vision.html"/>
|
||||
<menu-item label="History and Future" href="historyandfuture.html"/>
|
||||
<menu-item label="Who We Are" href="who.html"/>
|
||||
<menu-item label="Resolutions" href="resolutions/index.html"/>
|
||||
</menu>
|
||||
|
||||
<menu label="Marketing">
|
||||
<menu-item label="Case Studies" href="casestudies.html"/>
|
||||
</menu>
|
||||
|
||||
<menu label="Project">
|
||||
<menu-item label="Overview" href="overview.html"/>
|
||||
<menu-item label="POIFS" href="poifs/index.html"/>
|
||||
<menu-item label="HSSF" href="hssf/index.html"/>
|
||||
<menu-item label="HWPF" href="http://jakarta.apache.org/poi/hwpf/index.html"/>
|
||||
<menu-item label="HPSF" href="hpsf/index.html"/>
|
||||
<menu-item label="POI-Utils" href="utils/index.html"/>
|
||||
<menu-item label="Download" href="ext:download"/>
|
||||
</menu>
|
||||
|
||||
<menu label="Docs">
|
||||
<menu-item label="Javadocs" href="ext:javadoc"/>
|
||||
<menu-item label="FAQ" href="faq.html"/>
|
||||
<menu-item label="References" href="references/index.html"/>
|
||||
<menu-item label="How to Build" href="howtobuild.html"/>
|
||||
</menu>
|
||||
|
||||
<menu label="Translations">
|
||||
<menu-item label="Index" href="trans/index.html"/>
|
||||
<menu-item label="Guidelines" href="trans/guidelines.html"/>
|
||||
<menu-item label="German" href="trans/de/index.html"/>
|
||||
<menu-item label="Spanish" href="trans/es/index.html"/>
|
||||
<menu-item label="Japanese" href="http://www.terra-intl.com/jakarta/poi/"/>
|
||||
</menu>
|
||||
|
||||
<menu label="Code">
|
||||
<!-- <menu-item label="Source Code" href="http://jakarta.apache.org/poi/javadocs/javasrc/"/> -->
|
||||
<menu-item label="CVS" href="http://jakarta.apache.org/site/cvsindex.html"/>
|
||||
<menu-item label="CVS Changelog" href="changelog.html"/>
|
||||
<menu-item label="Top Voted Bugs" href="http://nagoya.apache.org/bugzilla/buglist.cgi?votes=1&product=POI&order=bugs.votes"/>
|
||||
<menu-item label="Bug Database" href="http://nagoya.apache.org/bugzilla/buglist.cgi?product=POI"/>
|
||||
<menu-item label="Patches" href="http://nagoya.apache.org/bugzilla/buglist.cgi?product=POI&short_desc=%5BPATCH%5D&short_desc_type=allwordssubstr"/>
|
||||
|
||||
<menu-item label="Junit Test Results" href="ext:junit"/>
|
||||
<menu-item label="Dependency Metrics" href="ext:jdepend"/>
|
||||
<!-- <menu-item label="Checkstyle Metrics" href="http://jakarta.apache.org/poi/metrics/checkstyle/"/> -->
|
||||
</menu>
|
||||
|
||||
</book>
|
100
src/documentation/content/xdocs/casestudies.xml
Normal file
100
src/documentation/content/xdocs/casestudies.xml
Normal file
@ -0,0 +1,100 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!-- Copyright (C) 2004 The Apache Software Foundation. All rights reserved. -->
|
||||
<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.1//EN" "./dtd/document-v11.dtd">
|
||||
|
||||
<document>
|
||||
<header>
|
||||
<title>Jakarta POI - Case Studies</title>
|
||||
<authors>
|
||||
<person id="AO" name="Andrew C. Oliver" email="acoliver@apache.org"/>
|
||||
<person id="CR" name="Cameron Riley" email="crileyNO@SPAMekmail.com"/>
|
||||
</authors>
|
||||
</header>
|
||||
|
||||
<body>
|
||||
<section><title>Introduction</title>
|
||||
<p>
|
||||
A number of people are using POI for a variety of purposes. As with
|
||||
any new API or technology, the first question people generally ask
|
||||
is not "how can I" but rather "Who else is doing what I'm about to
|
||||
do?" This is understandable with the abysmal success rate in the
|
||||
software business. These case statements are meant to help create
|
||||
confidence and understanding.
|
||||
</p>
|
||||
</section>
|
||||
<section><title>Submitting a Case Study</title>
|
||||
<p>
|
||||
We are actively seeking case studies for this page (after all it
|
||||
just started). Andy Oliver (acoliver at apache dot org) has
|
||||
agreed to have a few T-Shirts printed with the POI logo (once its
|
||||
chosen) for the first
|
||||
few best submissions. To submit a case study, either
|
||||
<link href="http://jakarta.apache.org/poi/getinvolved/index.html">
|
||||
submit a patch for this page</link> (preferred) or email it to the
|
||||
<link href="http://jakarta.apache.org/site/mail.html">mailing list
|
||||
</link>.
|
||||
</p>
|
||||
</section>
|
||||
<section><title>Case Studies</title>
|
||||
<section><title>Bank of Lithuania</title>
|
||||
<p>
|
||||
The <link href="http://www.lbank.lt">Bank of Lithuania</link>
|
||||
reports financial statistical data to Excel format using the
|
||||
<link href="http://jakarta.apache.org/poi">Jakarta POI</link>
|
||||
project's <link href="http://jakarta.apache.org/poi/hssf">
|
||||
HSSF</link> API. The system is based on Oracle JServer and
|
||||
utilizes a Java stored procedure that outputs to XLS format
|
||||
using the HSSF API. - Arian Lashkov (alaskov at lbank.lt)
|
||||
</p>
|
||||
</section>
|
||||
<section><title>Bit Tracker by Tracker Inc., and ThinkVirtual</title>
|
||||
<p>
|
||||
Bit Tracker (http://www.bittracker.com) is the world's first and only web-based drill bit tracking system to manage your company's critical bit information and use that data to its full potential. It manages all bit related data, including their usage, locations, how they were used, and results such as rate of penetration and dull grade after use. This data needs to be available in Excel format for backwards compatibility and other uses in the industry. After using CSV and HTML formats, we needed something better for creating the spreadsheets and POI is the answer. It works great and was easy to implement. Kudos to the POI team.
|
||||
</p>
|
||||
<p>
|
||||
Travis Reeder (travis at thinkvirtual dot com)
|
||||
</p>
|
||||
</section>
|
||||
<section><title>Edwards And Kelcey Technology</title>
|
||||
<p>
|
||||
Edwards and Kelcey Technology (http://www.ekcorp.com/) developed a
|
||||
Facility
|
||||
Managament and Maintenance System for the Telecommunications industry
|
||||
based
|
||||
on Turbine and Velocity. Originally the invoicing was done with a simple
|
||||
CVS
|
||||
sheet which was then marked up by accounts and customized for each client.
|
||||
As growth has been consistent with the application, the requirement for
|
||||
invoices that need not be touched by hand increased. POI provided the
|
||||
solution to this issue, integrating easily and transparently into the
|
||||
system. POI HSSF was used to create the invoices directly from the server
|
||||
in
|
||||
Excel 97 format and now services over 150 unique invoices per month.
|
||||
</p>
|
||||
<p>
|
||||
Cameron Riley (crileyNO@ SPAMekmail.com)
|
||||
</p>
|
||||
</section>
|
||||
<section><title>ClickFind</title>
|
||||
<p>
|
||||
<link href="http://www.clickfind.com">ClickFind Inc.</link> used the POI
|
||||
projects HSSF API to provide their medical
|
||||
research clients with an Excel export from their electronic data
|
||||
collection web service Data Collector 3.0. The POI team's assistance
|
||||
allowed ClickFind to give their clients a data format that requires less
|
||||
technical expertise than the XML format used by the Data Collector
|
||||
application. This was important to ClickFind as many of their current
|
||||
and potential clients are already using Excel in their day-to-day
|
||||
operations and in established procedures for handling their generated
|
||||
clinical data. - Jared Walker (jared.walker at clickfind.com)
|
||||
</p>
|
||||
</section>
|
||||
</section>
|
||||
</body>
|
||||
<footer>
|
||||
<legal>
|
||||
Copyright (c) @year@ The Apache Software Foundation All rights reserved.
|
||||
$Revision$ $Date$
|
||||
</legal>
|
||||
</footer>
|
||||
</document>
|
70
src/documentation/content/xdocs/dtd/book-cocoon-v10.dtd
Normal file
70
src/documentation/content/xdocs/dtd/book-cocoon-v10.dtd
Normal file
@ -0,0 +1,70 @@
|
||||
<!-- ===================================================================
|
||||
|
||||
Apache Cocoon Documentation Book DTD (Version 1.0)
|
||||
|
||||
PURPOSE:
|
||||
This DTD defines the */book.xml documentation configuration files.
|
||||
|
||||
TYPICAL INVOCATION:
|
||||
|
||||
<!DOCTYPE book PUBLIC
|
||||
"-//APACHE//DTD Cocoon Documentation Book Vx.yz//EN"
|
||||
"book-cocoon-vxyz.dtd">
|
||||
|
||||
where
|
||||
|
||||
x := major version
|
||||
y := minor version
|
||||
z := status identifier (optional)
|
||||
|
||||
NOTES:
|
||||
We need to replace this DTD with the proper one.
|
||||
We are only using this DTD to enable validation during "build docs"
|
||||
because every XML instance must declare its ruleset.
|
||||
|
||||
This initial minimal DTD has been reverse-engineered from the structure
|
||||
of the current documents, e.g.
|
||||
documentation/xdocs/book.xml
|
||||
|
||||
AUTHORS:
|
||||
David Crossley <crossley@apache.org>
|
||||
|
||||
FIXME:
|
||||
- find the proper DTD for book.xml
|
||||
|
||||
CHANGE HISTORY:
|
||||
20011031 Initial version. (DC)
|
||||
|
||||
COPYRIGHT:
|
||||
Copyright (c) @year@ The Apache Software Foundation.
|
||||
|
||||
Permission to copy in any form is granted provided this notice is
|
||||
included in all copies. Permission to redistribute is granted
|
||||
provided this file is distributed untouched in all its parts and
|
||||
included files.
|
||||
|
||||
==================================================================== -->
|
||||
|
||||
<!ELEMENT book (menu+)>
|
||||
<!ELEMENT menu (menu-item|external)*>
|
||||
<!ELEMENT menu-item EMPTY>
|
||||
<!ELEMENT external EMPTY>
|
||||
<!ATTLIST book software CDATA #REQUIRED
|
||||
title CDATA #REQUIRED
|
||||
copyright CDATA #REQUIRED
|
||||
xmlns:xlink CDATA #IMPLIED
|
||||
>
|
||||
<!ATTLIST menu label CDATA #REQUIRED
|
||||
>
|
||||
<!ATTLIST menu-item label CDATA #REQUIRED
|
||||
href CDATA #REQUIRED
|
||||
type (visible|hidden) "visible"
|
||||
>
|
||||
<!ATTLIST external label CDATA #REQUIRED
|
||||
href CDATA #REQUIRED
|
||||
type (visible|hidden) "visible"
|
||||
>
|
||||
|
||||
<!-- =============================================================== -->
|
||||
<!-- End of DTD -->
|
||||
<!-- =============================================================== -->
|
93
src/documentation/content/xdocs/dtd/changes-v11.dtd
Normal file
93
src/documentation/content/xdocs/dtd/changes-v11.dtd
Normal file
@ -0,0 +1,93 @@
|
||||
<!-- ===================================================================
|
||||
|
||||
Apache Changes DTD (Version 1.1)
|
||||
|
||||
PURPOSE:
|
||||
This DTD was developed to create a simple yet powerful document
|
||||
type for software development changes for use with the Apache projects.
|
||||
It is an XML-compliant DTD and it's maintained by the Apache XML
|
||||
project.
|
||||
|
||||
TYPICAL INVOCATION:
|
||||
|
||||
<!DOCTYPE document PUBLIC
|
||||
"-//APACHE//DTD Changes Vx.y//EN"
|
||||
"changes-vxy.dtd">
|
||||
|
||||
where
|
||||
|
||||
x := major version
|
||||
y := minor version
|
||||
|
||||
NOTES:
|
||||
It is important, expecially in open developped software projects, to keep
|
||||
track of software changes both to give users indications of bugs that might
|
||||
have been resolved, as well, and not less important, to provide credits
|
||||
for the support given to the project. It is considered vital to provide
|
||||
adequate payback using recognition and credits to let users and developers
|
||||
feel part of the community, thus increasing development power.
|
||||
|
||||
AUTHORS:
|
||||
Stefano Mazzocchi <stefano@apache.org>
|
||||
|
||||
FIXME:
|
||||
|
||||
CHANGE HISTORY:
|
||||
[Version 1.0]
|
||||
19991129 Initial version. (SM)
|
||||
20000316 Added bugfixing attribute. (SM)
|
||||
[Version 1.1]
|
||||
20011212 Used public identifiers for external entities (SM)
|
||||
|
||||
COPYRIGHT:
|
||||
Copyright (c) @year@ The Apache Software Foundation.
|
||||
|
||||
Permission to copy in any form is granted provided this notice is
|
||||
included in all copies. Permission to redistribute is granted
|
||||
provided this file is distributed untouched in all its parts and
|
||||
included files.
|
||||
|
||||
==================================================================== -->
|
||||
|
||||
<!-- =============================================================== -->
|
||||
<!-- Include the Documentation DTD -->
|
||||
<!-- =============================================================== -->
|
||||
|
||||
<!ENTITY % document PUBLIC
|
||||
"-//APACHE//DTD Documentation V1.1//EN"
|
||||
"document-v11.dtd">
|
||||
%document;
|
||||
|
||||
<!-- =============================================================== -->
|
||||
<!-- Common entities -->
|
||||
<!-- =============================================================== -->
|
||||
|
||||
<!ENTITY % types "add|remove|update|fix">
|
||||
|
||||
<!-- =============================================================== -->
|
||||
<!-- Document Type Definition -->
|
||||
<!-- =============================================================== -->
|
||||
|
||||
<!ELEMENT changes (devs, release*)>
|
||||
<!ATTLIST changes %common.att;
|
||||
%title.att;>
|
||||
|
||||
<!ELEMENT devs (person+)>
|
||||
<!ATTLIST devs %common.att;>
|
||||
|
||||
<!ELEMENT release (action+)>
|
||||
<!ATTLIST release %common.att;
|
||||
version CDATA #REQUIRED
|
||||
date CDATA #REQUIRED>
|
||||
|
||||
<!ELEMENT action (%content.mix;)*>
|
||||
<!ATTLIST action %common.att;
|
||||
dev IDREF #REQUIRED
|
||||
type (%types;) #IMPLIED
|
||||
due-to CDATA #IMPLIED
|
||||
due-to-email CDATA #IMPLIED
|
||||
fixes-bug CDATA #IMPLIED>
|
||||
|
||||
<!-- =============================================================== -->
|
||||
<!-- End of DTD -->
|
||||
<!-- =============================================================== -->
|
541
src/documentation/content/xdocs/dtd/document-v11.dtd
Normal file
541
src/documentation/content/xdocs/dtd/document-v11.dtd
Normal file
@ -0,0 +1,541 @@
|
||||
<!-- ===================================================================
|
||||
|
||||
Apache Documentation DTD (Version 1.1)
|
||||
|
||||
PURPOSE:
|
||||
This DTD was developed to create a simple yet powerful document
|
||||
type for software documentation for use with the Apache projects.
|
||||
It is an XML-compliant DTD and it's maintained by the Apache XML
|
||||
project.
|
||||
|
||||
TYPICAL INVOCATION:
|
||||
|
||||
<!DOCTYPE document PUBLIC
|
||||
"-//APACHE//DTD Documentation Vx.y//EN"
|
||||
"document-vxy.dtd">
|
||||
|
||||
where
|
||||
|
||||
x := major version
|
||||
y := minor version
|
||||
|
||||
NOTES:
|
||||
Many of the design patterns used in this DTD were take from the
|
||||
W3C XML Specification DTD edited by Eve Maler <elm@arbortext.com>.
|
||||
|
||||
Where possible, great care has been used to reuse HTML tag
|
||||
names to reduce learning efforts and to allow HTML editors to be
|
||||
used for complex authorings like tables and lists.
|
||||
|
||||
EXTENSIBILITY:
|
||||
This DTD includes several empty placeholders that can be used to
|
||||
extend it. These placeholders are implemented with empty entities. Here
|
||||
is the list of those empty entities and what they are used for:
|
||||
|
||||
- local.inline: this entity should contain extended definitions of
|
||||
elements that can be used 'inline', or directly inside
|
||||
the content. An example for this entity could be
|
||||
|
||||
<!ENTITY % local.inline "|citation">
|
||||
|
||||
- local.blocks: this entity should contain extended definitions of
|
||||
elements that behave as 'blocks', thus can be visually
|
||||
rendered as areas on the canvas. An example for this
|
||||
entity could be:
|
||||
|
||||
<!ENTITY % local.blocks "|poem">
|
||||
|
||||
- local.sections: this entity should contain extended definitions of
|
||||
elements that behave as 'sections', thus can be considered
|
||||
containers of block-level elements. An example for
|
||||
this entity could be:
|
||||
|
||||
<!ENTITY % local.sections "|chapter">
|
||||
|
||||
- local.headers: this entity should contain extended definitions of
|
||||
elements that behave as parts of the document header.
|
||||
An example for this header could be:
|
||||
|
||||
<!ENTITY % local.headers ", notes?">
|
||||
|
||||
- local.footers: this entity should contain extended definitions of
|
||||
elements that behave as parts of the document footer.
|
||||
An example for this header could be:
|
||||
|
||||
<!ENTITY % local.footers ", annotations*">
|
||||
|
||||
|
||||
AUTHORS:
|
||||
Stefano Mazzocchi <stefano@apache.org>
|
||||
Steven Noels <stevenn@outerthought.org>
|
||||
|
||||
FIXME:
|
||||
- should "form" tags be included?
|
||||
|
||||
CHANGE HISTORY:
|
||||
[Version 1.0]
|
||||
19991121 Initial version. (SM)
|
||||
19991123 Replaced "res" with more standard "strong" for emphasis. (SM)
|
||||
19991124 Added "fork" element for window forking behavior. (SM)
|
||||
19991124 Added "img-inline" element to separate from "img". (SM)
|
||||
19991129 Removed "affiliation" from "author". (SM)
|
||||
19991129 Made "author" empty and moved "name|email" as attributes. (SM)
|
||||
19991215 Simplified table section. (SM)
|
||||
19991215 Changed "img-block" in more friendly "figure". (SM)
|
||||
20000125 Added the "icon" image. (SM)
|
||||
20000126 Allowed "anchor" in all levels. (SM)
|
||||
20000404 Removed the "role" attribute from common-xxx.att. (SM)
|
||||
20000815 Allowed "code" inside "strong" and "em". (SM)
|
||||
[Version 1.1]
|
||||
20011212 Used public identifiers for external entities. (SM)
|
||||
20011212 Removed xlink attributes since not used. (SM)
|
||||
20011212 Removed "connect" since not required at this level. (SM)
|
||||
20011218 Added "warning" as a block level object. (SM)
|
||||
20011218 Removed explicitly numbered sections ("s1|s2|s3|s4"). (SM)
|
||||
20011218 Added "section" element. (SM)
|
||||
20011218 Allowed "body" to have blocks without a section. (SM)
|
||||
20011218 Removed "sl" since not really different from "ul". (SM)
|
||||
20020214 Moved empty placeholder entity declarations up front (SNS)
|
||||
20020214 Corrected content model of content.mix parameter entity (SNS)
|
||||
|
||||
COPYRIGHT:
|
||||
Copyright (c) @year@ The Apache Software Foundation.
|
||||
|
||||
Permission to copy in any form is granted provided this notice is
|
||||
included in all copies. Permission to redistribute is granted
|
||||
provided this file is distributed untouched in all its parts and
|
||||
included files.
|
||||
|
||||
==================================================================== -->
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- =============================================================== -->
|
||||
<!-- Common character entities (included from external file) -->
|
||||
<!-- =============================================================== -->
|
||||
|
||||
<!ENTITY % ISOlat1 PUBLIC
|
||||
"ISO 8879:1986//ENTITIES Added Latin 1//EN//XML"
|
||||
"ISOlat1.pen">
|
||||
%ISOlat1;
|
||||
|
||||
<!ENTITY % ISOpub PUBLIC
|
||||
"ISO 8879:1986//ENTITIES Publishing//EN//XML"
|
||||
"ISOpub.pen">
|
||||
%ISOpub;
|
||||
|
||||
<!ENTITY % ISOtech PUBLIC
|
||||
"ISO 8879:1986//ENTITIES General Technical//EN//XML"
|
||||
"ISOtech.pen">
|
||||
%ISOtech;
|
||||
|
||||
<!ENTITY % ISOnum PUBLIC
|
||||
"ISO 8879:1986//ENTITIES Numeric and Special Graphic//EN//XML"
|
||||
"ISOnum.pen">
|
||||
%ISOnum;
|
||||
|
||||
<!ENTITY % ISOdia PUBLIC
|
||||
"ISO 8879:1986//ENTITIES Diacritical Marks//EN//XML"
|
||||
"ISOdia.pen">
|
||||
%ISOdia;
|
||||
|
||||
<!-- =============================================================== -->
|
||||
<!-- Useful entities for increased DTD readability -->
|
||||
<!-- =============================================================== -->
|
||||
|
||||
<!ENTITY % text "#PCDATA">
|
||||
|
||||
<!-- Entities referred to later on are defined up front -->
|
||||
|
||||
<!ENTITY % markup "strong|em|code|sub|sup">
|
||||
<!ENTITY % special-inline "br|img|icon">
|
||||
<!ENTITY % links "link|jump|fork">
|
||||
<!ENTITY % paragraphs "p|source|note|warning|fixme">
|
||||
<!ENTITY % tables "table">
|
||||
<!ENTITY % lists "ol|ul|dl">
|
||||
<!ENTITY % special-blocks "figure|anchor">
|
||||
|
||||
|
||||
<!-- =============================================================== -->
|
||||
<!-- Entities for general XML compliance -->
|
||||
<!-- =============================================================== -->
|
||||
|
||||
<!-- Common attributes
|
||||
Every element has an ID attribute (sometimes required,
|
||||
but usually optional) for links. %common.att;
|
||||
is for common attributes where the ID is optional, and
|
||||
%common-idreq.att; is for common attributes where the
|
||||
ID is required.
|
||||
-->
|
||||
<!ENTITY % common.att
|
||||
'id ID #IMPLIED
|
||||
xml:lang NMTOKEN #IMPLIED'>
|
||||
<!ENTITY % common-idreq.att
|
||||
'id ID #REQUIRED
|
||||
xml:lang NMTOKEN #IMPLIED'>
|
||||
|
||||
|
||||
<!-- xml:space attribute ===============================================
|
||||
Indicates that the element contains white space
|
||||
that the formatter or other application should retain,
|
||||
as appropriate to its function.
|
||||
==================================================================== -->
|
||||
<!ENTITY % xmlspace.att
|
||||
'xml:space (default|preserve) #FIXED "preserve"'>
|
||||
|
||||
|
||||
<!-- def attribute =====================================================
|
||||
Points to the element where the relevant definition can be
|
||||
found, using the IDREF mechanism. %def.att; is for optional
|
||||
def attributes, and %def-req.att; is for required def
|
||||
attributes.
|
||||
==================================================================== -->
|
||||
<!ENTITY % def.att
|
||||
'def IDREF #IMPLIED'>
|
||||
<!ENTITY % def-req.att
|
||||
'def IDREF #REQUIRED'>
|
||||
|
||||
|
||||
<!-- ref attribute =====================================================
|
||||
Points to the element where more information can be found,
|
||||
using the IDREF mechanism. %ref.att; is for optional
|
||||
ref attributes, and %ref-req.att; is for required ref
|
||||
attributes.
|
||||
================================================================== -->
|
||||
<!ENTITY % ref.att
|
||||
'ref IDREF #IMPLIED'>
|
||||
<!ENTITY % ref-req.att
|
||||
'ref IDREF #REQUIRED'>
|
||||
|
||||
|
||||
<!-- =============================================================== -->
|
||||
<!-- Entities for general usage -->
|
||||
<!-- =============================================================== -->
|
||||
|
||||
|
||||
<!-- Key attribute =====================================================
|
||||
Optionally provides a sorting or indexing key, for cases when
|
||||
the element content is inappropriate for this purpose.
|
||||
==================================================================== -->
|
||||
<!ENTITY % key.att
|
||||
'key CDATA #IMPLIED'>
|
||||
|
||||
|
||||
|
||||
<!-- Title attributes ==================================================
|
||||
Indicates that the element requires to have a title attribute.
|
||||
==================================================================== -->
|
||||
<!ENTITY % title.att
|
||||
'title CDATA #REQUIRED'>
|
||||
|
||||
|
||||
|
||||
<!-- Name attributes ==================================================
|
||||
Indicates that the element requires to have a name attribute.
|
||||
==================================================================== -->
|
||||
<!ENTITY % name.att
|
||||
'name CDATA #REQUIRED'>
|
||||
|
||||
|
||||
|
||||
<!-- Email attributes ==================================================
|
||||
Indicates that the element requires to have an email attribute.
|
||||
==================================================================== -->
|
||||
<!ENTITY % email.att
|
||||
'email CDATA #REQUIRED'>
|
||||
|
||||
|
||||
<!-- Link attributes ===================================================
|
||||
Indicates that the element requires to have hyperlink attributes.
|
||||
==================================================================== -->
|
||||
|
||||
<!ENTITY % link.att
|
||||
'href CDATA #IMPLIED
|
||||
role CDATA #IMPLIED
|
||||
title CDATA #IMPLIED '>
|
||||
|
||||
|
||||
|
||||
<!-- =============================================================== -->
|
||||
<!-- General definitions -->
|
||||
<!-- =============================================================== -->
|
||||
|
||||
<!-- A person is a general human entity -->
|
||||
<!ELEMENT person EMPTY>
|
||||
<!ATTLIST person %common.att;
|
||||
%name.att;
|
||||
%email.att;>
|
||||
|
||||
|
||||
|
||||
<!-- =============================================================== -->
|
||||
<!-- Content definitions -->
|
||||
<!-- =============================================================== -->
|
||||
|
||||
<!ENTITY % local.inline "">
|
||||
|
||||
<!ENTITY % link-content.mix "%text;|%markup;|%special-inline; %local.inline;">
|
||||
|
||||
<!ENTITY % content.mix "%link-content.mix;|%links;">
|
||||
|
||||
<!-- ==================================================== -->
|
||||
<!-- Phrase Markup -->
|
||||
<!-- ==================================================== -->
|
||||
|
||||
<!-- Strong (typically bold) -->
|
||||
<!ELEMENT strong (%text;|code)*>
|
||||
<!ATTLIST strong %common.att;>
|
||||
|
||||
<!-- Emphasis (typically italic) -->
|
||||
<!ELEMENT em (%text;|code)*>
|
||||
<!ATTLIST em %common.att;>
|
||||
|
||||
<!-- Code (typically monospaced) -->
|
||||
<!ELEMENT code (%text;)>
|
||||
<!ATTLIST code %common.att;>
|
||||
|
||||
<!-- Superscript (typically smaller and higher) -->
|
||||
<!ELEMENT sup (%text;)>
|
||||
<!ATTLIST sup %common.att;>
|
||||
|
||||
<!-- Subscript (typically smaller and lower) -->
|
||||
<!ELEMENT sub (%text;)>
|
||||
<!ATTLIST sub %common.att;>
|
||||
|
||||
<!-- ==================================================== -->
|
||||
<!-- Hypertextual Links -->
|
||||
<!-- ==================================================== -->
|
||||
|
||||
<!-- hyperlink (equivalent of <a ...>) -->
|
||||
<!ELEMENT link (%link-content.mix;)*>
|
||||
<!ATTLIST link %common.att;
|
||||
%link.att;>
|
||||
|
||||
<!-- windows-replacing link (equivalent of <a ... target="_top">) -->
|
||||
<!ELEMENT jump (%link-content.mix;)*>
|
||||
<!ATTLIST jump %common.att;
|
||||
%link.att;>
|
||||
|
||||
<!-- window-forking link (equivalent of <a ... target="_new">) -->
|
||||
<!ELEMENT fork (%link-content.mix;)*>
|
||||
<!ATTLIST fork %common.att;
|
||||
%link.att;>
|
||||
|
||||
<!-- ==================================================== -->
|
||||
<!-- Specials -->
|
||||
<!-- ==================================================== -->
|
||||
|
||||
<!-- Breakline Object (typically forces line break) -->
|
||||
<!ELEMENT br EMPTY>
|
||||
<!ATTLIST br %common.att;>
|
||||
|
||||
<!-- Image Object (typically an inlined image) -->
|
||||
<!ELEMENT img EMPTY>
|
||||
<!ATTLIST img src CDATA #REQUIRED
|
||||
alt CDATA #REQUIRED
|
||||
height CDATA #IMPLIED
|
||||
width CDATA #IMPLIED
|
||||
usemap CDATA #IMPLIED
|
||||
ismap (ismap) #IMPLIED
|
||||
%common.att;>
|
||||
|
||||
<!-- Image Icon (typically an inlined image placed as graphical item) -->
|
||||
<!ELEMENT icon EMPTY>
|
||||
<!ATTLIST icon src CDATA #REQUIRED
|
||||
alt CDATA #REQUIRED
|
||||
height CDATA #IMPLIED
|
||||
width CDATA #IMPLIED
|
||||
%common.att;>
|
||||
|
||||
|
||||
<!-- =============================================================== -->
|
||||
<!-- Blocks definitions -->
|
||||
<!-- =============================================================== -->
|
||||
|
||||
<!ENTITY % local.blocks "">
|
||||
|
||||
<!ENTITY % blocks "%paragraphs;|%tables;|%lists;|%special-blocks; %local.blocks;">
|
||||
|
||||
<!-- ==================================================== -->
|
||||
<!-- Paragraphs -->
|
||||
<!-- ==================================================== -->
|
||||
|
||||
<!-- Text Paragraph (normally vertically space delimited) -->
|
||||
<!ELEMENT p (%content.mix;)*>
|
||||
<!ATTLIST p %common.att;>
|
||||
|
||||
<!-- Source Paragraph (normally space is preserved) -->
|
||||
<!ELEMENT source (%content.mix;)*>
|
||||
<!ATTLIST source %common.att;
|
||||
%xmlspace.att;>
|
||||
|
||||
<!-- Note Paragraph (normally shown encapsulated) -->
|
||||
<!ELEMENT note (%content.mix;)*>
|
||||
<!ATTLIST note %common.att;>
|
||||
|
||||
<!-- Warning Paragraph (normally shown with eye-catching colors) -->
|
||||
<!ELEMENT warning (%content.mix;)*>
|
||||
<!ATTLIST warning %common.att;>
|
||||
|
||||
<!-- Fixme Paragraph (normally not shown) -->
|
||||
<!ELEMENT fixme (%content.mix;)*>
|
||||
<!ATTLIST fixme author CDATA #REQUIRED
|
||||
%common.att;>
|
||||
|
||||
<!-- ==================================================== -->
|
||||
<!-- Tables -->
|
||||
<!-- ==================================================== -->
|
||||
|
||||
<!-- Attributes that indicate the spanning of the table cell -->
|
||||
<!ENTITY % cell.span
|
||||
'colspan CDATA "1"
|
||||
rowspan CDATA "1"'>
|
||||
|
||||
<!-- Table element -->
|
||||
<!ELEMENT table (caption?, tr+)>
|
||||
<!ATTLIST table %common.att;>
|
||||
|
||||
<!-- The table title -->
|
||||
<!ELEMENT caption (%content.mix;)*>
|
||||
<!ATTLIST caption %common.att;>
|
||||
|
||||
<!-- The table row element -->
|
||||
<!ELEMENT tr (th|td)+>
|
||||
<!ATTLIST tr %common.att;>
|
||||
|
||||
<!-- The table row header element -->
|
||||
<!ELEMENT th (%content.mix;)*>
|
||||
<!ATTLIST th %common.att;
|
||||
%cell.span;>
|
||||
|
||||
<!-- The table row description element -->
|
||||
<!ELEMENT td (%content.mix;)*>
|
||||
<!ATTLIST td %common.att;
|
||||
%cell.span;>
|
||||
|
||||
<!-- ==================================================== -->
|
||||
<!-- Lists -->
|
||||
<!-- ==================================================== -->
|
||||
|
||||
<!-- List item -->
|
||||
<!ELEMENT li (%content.mix;|%lists;)*>
|
||||
<!ATTLIST li %common.att;>
|
||||
|
||||
<!-- Unordered list (typically bulleted) -->
|
||||
<!ELEMENT ul (li|%lists;)+>
|
||||
<!-- spacing attribute:
|
||||
Use "normal" to get normal vertical spacing for items;
|
||||
use "compact" to get less spacing. The default is dependent
|
||||
on the stylesheet. -->
|
||||
<!ATTLIST ul
|
||||
%common.att;
|
||||
spacing (normal|compact) #IMPLIED>
|
||||
|
||||
<!-- Ordered list (typically numbered) -->
|
||||
<!ELEMENT ol (li|%lists;)+>
|
||||
<!-- spacing attribute:
|
||||
Use "normal" to get normal vertical spacing for items;
|
||||
use "compact" to get less spacing. The default is dependent
|
||||
on the stylesheet. -->
|
||||
<!ATTLIST ol
|
||||
%common.att;
|
||||
spacing (normal|compact) #IMPLIED>
|
||||
|
||||
<!-- Definition list (typically two-column) -->
|
||||
<!ELEMENT dl (dt,dd)+>
|
||||
<!ATTLIST dl %common.att;>
|
||||
|
||||
<!-- Definition term -->
|
||||
<!ELEMENT dt (%content.mix;)*>
|
||||
<!ATTLIST dt %common.att;>
|
||||
|
||||
<!-- Definition description -->
|
||||
<!ELEMENT dd (%content.mix;)*>
|
||||
<!ATTLIST dd %common.att;>
|
||||
|
||||
<!-- ==================================================== -->
|
||||
<!-- Special Blocks -->
|
||||
<!-- ==================================================== -->
|
||||
|
||||
<!-- Image Block (typically a separated and centered image) -->
|
||||
<!ELEMENT figure EMPTY>
|
||||
<!ATTLIST figure src CDATA #REQUIRED
|
||||
alt CDATA #REQUIRED
|
||||
height CDATA #IMPLIED
|
||||
width CDATA #IMPLIED
|
||||
usemap CDATA #IMPLIED
|
||||
ismap (ismap) #IMPLIED
|
||||
%common.att;>
|
||||
|
||||
<!-- anchor point (equivalent of <a name="...">, typically not rendered) -->
|
||||
<!ELEMENT anchor EMPTY>
|
||||
<!ATTLIST anchor %common-idreq.att;>
|
||||
|
||||
|
||||
<!-- =============================================================== -->
|
||||
<!-- Document -->
|
||||
<!-- =============================================================== -->
|
||||
|
||||
<!ELEMENT document (header?, body, footer?)>
|
||||
<!ATTLIST document %common.att;>
|
||||
|
||||
<!-- ==================================================== -->
|
||||
<!-- Header -->
|
||||
<!-- ==================================================== -->
|
||||
|
||||
<!ENTITY % local.headers "">
|
||||
|
||||
<!ELEMENT header (title, subtitle?, version?, type?, authors,
|
||||
notice*, abstract? %local.headers;)>
|
||||
<!ATTLIST header %common.att;>
|
||||
|
||||
<!ELEMENT title (%text;)>
|
||||
<!ATTLIST title %common.att;>
|
||||
|
||||
<!ELEMENT subtitle (%text;)>
|
||||
<!ATTLIST subtitle %common.att;>
|
||||
|
||||
<!ELEMENT version (%text;)>
|
||||
<!ATTLIST version %common.att;>
|
||||
|
||||
<!ELEMENT type (%text;)>
|
||||
<!ATTLIST type %common.att;>
|
||||
|
||||
<!ELEMENT authors (person+)>
|
||||
<!ATTLIST authors %common.att;>
|
||||
|
||||
<!ELEMENT notice (%content.mix;)*>
|
||||
<!ATTLIST notice %common.att;>
|
||||
|
||||
<!ELEMENT abstract (%content.mix;)*>
|
||||
<!ATTLIST abstract %common.att;>
|
||||
|
||||
<!-- ==================================================== -->
|
||||
<!-- Body -->
|
||||
<!-- ==================================================== -->
|
||||
|
||||
<!ENTITY % local.sections "">
|
||||
|
||||
<!ENTITY % sections "section %local.sections;">
|
||||
|
||||
<!ELEMENT body (%sections;|%blocks;)+>
|
||||
<!ATTLIST body %common.att;>
|
||||
|
||||
<!ELEMENT section (%sections;|%blocks;)*>
|
||||
<!ATTLIST section %title.att; %common.att;>
|
||||
|
||||
<!-- ==================================================== -->
|
||||
<!-- Footer -->
|
||||
<!-- ==================================================== -->
|
||||
|
||||
<!ENTITY % local.footers "">
|
||||
|
||||
<!ELEMENT footer (legal %local.footers;)>
|
||||
|
||||
<!ELEMENT legal (%content.mix;)*>
|
||||
<!ATTLIST legal %common.att;>
|
||||
|
||||
<!-- =============================================================== -->
|
||||
<!-- End of DTD -->
|
||||
<!-- =============================================================== -->
|
76
src/documentation/content/xdocs/dtd/faq-v11.dtd
Normal file
76
src/documentation/content/xdocs/dtd/faq-v11.dtd
Normal file
@ -0,0 +1,76 @@
|
||||
<!-- ===================================================================
|
||||
|
||||
Apache FAQ DTD (Version 1.1)
|
||||
|
||||
PURPOSE:
|
||||
This DTD was developed to create a simple yet powerful document
|
||||
type for software FAQ's for use with the Apache projects.
|
||||
It is an XML-compliant DTD and it's maintained by the Apache XML
|
||||
project.
|
||||
|
||||
TYPICAL INVOCATION:
|
||||
|
||||
<!DOCTYPE document PUBLIC
|
||||
"-//APACHE//DTD FAQ Vx.y//EN"
|
||||
"faq-vxy.dtd">
|
||||
|
||||
where
|
||||
|
||||
x := major version
|
||||
y := minor version
|
||||
|
||||
NOTES:
|
||||
FAQs represent a powerful knowledge base and a very good way of solving
|
||||
common user problems reducing messages on mail lists and reducing the effort
|
||||
required for software installation and usage. Thid DTD want to be a common
|
||||
format for FAQ interchange to allow FAQ-O-Matic-type workgroup services to
|
||||
be published in other formats as well as enhancing data interchange.
|
||||
|
||||
AUTHORS:
|
||||
Stefano Mazzocchi <stefano@apache.org>
|
||||
|
||||
FIXME:
|
||||
|
||||
CHANGE HISTORY:
|
||||
19991129 Initial version. (SM)
|
||||
20011212 Used public identifiers for external entities (SM)
|
||||
|
||||
COPYRIGHT:
|
||||
Copyright (c) @year@ The Apache Software Foundation.
|
||||
|
||||
Permission to copy in any form is granted provided this notice is
|
||||
included in all copies. Permission to redistribute is granted
|
||||
provided this file is distributed untouched in all its parts and
|
||||
included files.
|
||||
|
||||
==================================================================== -->
|
||||
|
||||
<!-- =============================================================== -->
|
||||
<!-- Include the Documentation DTD -->
|
||||
<!-- =============================================================== -->
|
||||
|
||||
<!ENTITY % document PUBLIC
|
||||
"-//APACHE//DTD Documentation V1.1//EN"
|
||||
"document-v11.dtd">
|
||||
%document;
|
||||
|
||||
<!-- =============================================================== -->
|
||||
<!-- Document Type Definition -->
|
||||
<!-- =============================================================== -->
|
||||
|
||||
<!ELEMENT faqs (authors?, faq)+>
|
||||
<!ATTLIST faqs %common.att;
|
||||
%title.att;>
|
||||
|
||||
<!ELEMENT faq (question, answer)>
|
||||
<!ATTLIST faq %common.att;>
|
||||
|
||||
<!ELEMENT question (%content.mix;)*>
|
||||
<!ATTLIST question %common.att;>
|
||||
|
||||
<!ELEMENT answer (%blocks;)*>
|
||||
<!ATTLIST answer author IDREF #IMPLIED>
|
||||
|
||||
<!-- =============================================================== -->
|
||||
<!-- End of DTD -->
|
||||
<!-- =============================================================== -->
|
254
src/documentation/content/xdocs/dtd/javadoc-v04draft.dtd
Normal file
254
src/documentation/content/xdocs/dtd/javadoc-v04draft.dtd
Normal file
@ -0,0 +1,254 @@
|
||||
<!-- ===================================================================
|
||||
|
||||
Apache JavaDoc DTD (version 0.4-draft)
|
||||
|
||||
PURPOSE:
|
||||
This DTD is designed to capture the output of JavaDoc as an XML document
|
||||
through the use of the JavaDocXML Doclet. The hope is that by having the
|
||||
JavaDoc documentation in an XML format, it will be easier for application
|
||||
developers working with XML to treat their java source documentation in the
|
||||
same way they treat any other XML document within their publication framework.
|
||||
|
||||
This DTD should reflect the information contained within the RootDoc object
|
||||
passed to the JavaDocXML Doclet by JavaDoc. The RootDoc object and the rest
|
||||
of the javaDoc Doclet API is specified at
|
||||
|
||||
http://java.sun.com/products/jdk/1.2/docs/tooldocs/javadoc/doclet/index.html
|
||||
|
||||
The only information that appears to be difficult to derive from this DTD
|
||||
that is easy to obtain from the RootDoc object is the information about
|
||||
serialization. However, this information should be derivable by manually
|
||||
looking for the correct serialization methods and other related structures.
|
||||
|
||||
TYPICAL INVOCATION:
|
||||
|
||||
<!DOCTYPE document PUBLIC
|
||||
"-//APACHE//DTD JavaDoc Vx.yz//EN"
|
||||
"javadoc-vxyz.dtd">
|
||||
|
||||
where
|
||||
|
||||
x := major version
|
||||
y := minor version
|
||||
z := status identifier (optional)
|
||||
|
||||
NOTES:
|
||||
The authors would like to thank the Cocoon's mail list subscribers for
|
||||
providing such great support and feedback for this DTD.
|
||||
|
||||
AUTHORS:
|
||||
Kenneth Murphy <murphyk@umsystem.edu>
|
||||
|
||||
FIXME:
|
||||
|
||||
CHANGE HISTORY:
|
||||
199909?? Original idea of XML doclet. (KM)
|
||||
199910?? Initial version of this DTD. (KM)
|
||||
19991129 Cleaned up DTD. (SM)
|
||||
|
||||
COPYRIGHT:
|
||||
Copyright (c) @year@ The Apache Software Foundation.
|
||||
|
||||
Permission to copy in any form is granted provided this notice is
|
||||
included in all copies. Permission to redistribute is granted
|
||||
provided this file is distributed untouched in all its parts and
|
||||
included files.
|
||||
|
||||
==================================================================== -->
|
||||
|
||||
<!-- =============================================================== -->
|
||||
<!-- Common Attribute Entities -->
|
||||
<!-- =============================================================== -->
|
||||
|
||||
<!ENTITY % name 'name CDATA #REQUIRED'>
|
||||
<!ENTITY % dimension 'dimension CDATA #REQUIRED'>
|
||||
|
||||
<!ENTITY % abstract 'abstract (true | false) "false"'>
|
||||
<!ENTITY % anonymous 'anonymous (true | false) "false"'>
|
||||
<!ENTITY % synthetic 'synthetic (true | false) "false"'>
|
||||
<!ENTITY % static 'static (true | false) "false"'>
|
||||
<!ENTITY % final 'final (true | false) "false"'>
|
||||
<!ENTITY % transient 'transient (true | false) "false"'>
|
||||
<!ENTITY % volatile 'volatile (true | false) "false"'>
|
||||
<!ENTITY % native 'native (true | false) "false"'>
|
||||
<!ENTITY % synchronized 'synchronized (true | false) "false"'>
|
||||
|
||||
<!ENTITY % access 'access (private | package | protected | public) "package"'>
|
||||
<!ENTITY % class.access 'access (package | public) "package"'>
|
||||
|
||||
<!ENTITY % extensibility 'extensibility (abstract | final | default) "default"'>
|
||||
|
||||
|
||||
<!-- =============================================================== -->
|
||||
<!-- Javadoc -->
|
||||
<!-- =============================================================== -->
|
||||
|
||||
<!ELEMENT javadoc (package*, class*, interface*)>
|
||||
|
||||
<!-- =============================================================== -->
|
||||
<!-- Package -->
|
||||
<!-- =============================================================== -->
|
||||
|
||||
<!ELEMENT package (doc?, package*, class*, interface*)>
|
||||
<!ATTLIST package %name;>
|
||||
|
||||
<!-- =============================================================== -->
|
||||
<!-- Class -->
|
||||
<!-- =============================================================== -->
|
||||
|
||||
<!ELEMENT class (doc?,
|
||||
extends_class?,
|
||||
implements?,
|
||||
field*,
|
||||
constructor*,
|
||||
method*,
|
||||
innerclass*)>
|
||||
<!ATTLIST class
|
||||
%name;
|
||||
%extensibility;
|
||||
%class.access;>
|
||||
|
||||
<!ELEMENT extends_class (classref+)>
|
||||
|
||||
<!ELEMENT innerclass (doc?,
|
||||
extends?,
|
||||
implements?,
|
||||
field*,
|
||||
constructor*,
|
||||
method*)>
|
||||
<!ATTLIST innerclass
|
||||
%name;
|
||||
%access;
|
||||
%abstract;
|
||||
%anonymous;
|
||||
%final;
|
||||
%static;>
|
||||
|
||||
<!-- =============================================================== -->
|
||||
<!-- Interface -->
|
||||
<!-- =============================================================== -->
|
||||
|
||||
<!ELEMENT interface (doc?,
|
||||
extends_interface?,
|
||||
field*,
|
||||
method*)>
|
||||
<!ATTLIST interface
|
||||
%name;
|
||||
%access;>
|
||||
|
||||
<!ELEMENT extends_interface (interfaceref+)>
|
||||
|
||||
<!-- =============================================================== -->
|
||||
<!-- Elements -->
|
||||
<!-- =============================================================== -->
|
||||
|
||||
<!ELEMENT implements (interfaceref+)>
|
||||
|
||||
<!ELEMENT throws (classref)+>
|
||||
|
||||
<!ELEMENT classref EMPTY>
|
||||
<!ATTLIST classref %name;>
|
||||
|
||||
<!ELEMENT interfaceref EMPTY>
|
||||
<!ATTLIST interfaceref %name;>
|
||||
|
||||
<!ELEMENT methodref EMPTY>
|
||||
<!ATTLIST methodref %name;>
|
||||
|
||||
<!ELEMENT packageref EMPTY>
|
||||
<!ATTLIST packageref %name;>
|
||||
|
||||
<!ELEMENT primitive EMPTY>
|
||||
<!ATTLIST primitive
|
||||
type (void | boolean | int | long | byte | short | double | float | char) #REQUIRED>
|
||||
|
||||
<!ELEMENT field (doc?, (classref | interfaceref | primitive))>
|
||||
<!ATTLIST field
|
||||
%name;
|
||||
%access;
|
||||
%dimension;
|
||||
%synthetic;
|
||||
%static;
|
||||
%final;
|
||||
%transient;
|
||||
%volatile;>
|
||||
|
||||
<!ELEMENT constructor (doc?, parameter*, throws*)>
|
||||
<!ATTLIST constructor
|
||||
%name;
|
||||
%access;
|
||||
%synthetic;>
|
||||
|
||||
<!ELEMENT method (doc?, returns, parameter*, throws*)>
|
||||
<!ATTLIST method
|
||||
%name;
|
||||
%access;
|
||||
%extensibility;
|
||||
%native;
|
||||
%synthetic;
|
||||
%static;
|
||||
%synchronized;>
|
||||
|
||||
<!ELEMENT returns (classref | interfaceref | primitive)>
|
||||
<!ATTLIST returns %dimension;>
|
||||
|
||||
<!ELEMENT parameter (classref | interfaceref | primitive)>
|
||||
<!ATTLIST parameter
|
||||
%name;
|
||||
%final;
|
||||
%dimension;>
|
||||
|
||||
<!ELEMENT dimension (#PCDATA)>
|
||||
|
||||
<!ELEMENT doc (#PCDATA |
|
||||
linktag |
|
||||
authortag |
|
||||
versiontag |
|
||||
paramtag |
|
||||
returntag |
|
||||
exceptiontag |
|
||||
throwstag |
|
||||
seetag |
|
||||
sincetag |
|
||||
deprecatedtag |
|
||||
serialtag |
|
||||
serialfieldtag |
|
||||
serialdatatag)*>
|
||||
|
||||
<!ELEMENT linktag (#PCDATA)>
|
||||
<!ATTLIST linktag
|
||||
src CDATA #REQUIRED>
|
||||
|
||||
<!ELEMENT authortag (#PCDATA | linktag)*>
|
||||
|
||||
<!ELEMENT versiontag (#PCDATA | linktag)*>
|
||||
|
||||
<!ELEMENT paramtag (#PCDATA | linktag)*>
|
||||
<!ATTLIST paramtag %name;>
|
||||
|
||||
<!ELEMENT returntag (#PCDATA | linktag)*>
|
||||
|
||||
<!ELEMENT exceptiontag (#PCDATA | classref | linktag)*>
|
||||
|
||||
<!ELEMENT throwstag (#PCDATA | classref | linktag)*>
|
||||
|
||||
<!ELEMENT seetag (#PCDATA | linktag)*>
|
||||
<!ATTLIST seetag
|
||||
src CDATA #REQUIRED>
|
||||
|
||||
<!ELEMENT sincetag (#PCDATA | linktag)*>
|
||||
|
||||
<!ELEMENT deprecatedtag (#PCDATA | linktag)*>
|
||||
|
||||
<!ELEMENT serialtag (#PCDATA | linktag)*>
|
||||
|
||||
<!ELEMENT serialfieldtag (#PCDATA | linktag)*>
|
||||
<!ATTLIST serialfieldtag
|
||||
fieldname CDATA #REQUIRED
|
||||
fieldtype CDATA #REQUIRED>
|
||||
|
||||
<!ELEMENT serialdatatag (#PCDATA | linktag)*>
|
||||
|
||||
<!-- =============================================================== -->
|
||||
<!-- End of DTD -->
|
||||
<!-- =============================================================== -->
|
92
src/documentation/content/xdocs/dtd/specification-v11.dtd
Normal file
92
src/documentation/content/xdocs/dtd/specification-v11.dtd
Normal file
@ -0,0 +1,92 @@
|
||||
<!-- ===================================================================
|
||||
|
||||
Apache Specification DTD (Version 1.1)
|
||||
|
||||
PURPOSE:
|
||||
This DTD was developed to create a simple yet powerful document
|
||||
type for software specifications for use with the Apache projects.
|
||||
It is an XML-compliant DTD and it's maintained by the Apache XML
|
||||
project.
|
||||
|
||||
TYPICAL INVOCATION:
|
||||
|
||||
<!DOCTYPE document PUBLIC
|
||||
"-//APACHE//DTD Specification Vx.y//EN"
|
||||
"specification-vxy.dtd">
|
||||
|
||||
where
|
||||
|
||||
x := major version
|
||||
y := minor version
|
||||
|
||||
NOTES:
|
||||
|
||||
AUTHORS:
|
||||
Stefano Mazzocchi <stefano@apache.org>
|
||||
|
||||
FIXME:
|
||||
|
||||
CHANGE HISTORY:
|
||||
[Version 1.0]
|
||||
19991129 Initial version. (SM)
|
||||
[Version 1.1]
|
||||
20011212 Used public identifiers for external entities (SM)
|
||||
|
||||
COPYRIGHT:
|
||||
Copyright (c) @year@ The Apache Software Foundation.
|
||||
|
||||
Permission to copy in any form is granted provided this notice is
|
||||
included in all copies. Permission to redistribute is granted
|
||||
provided this file is distributed untouched in all its parts and
|
||||
included files.
|
||||
|
||||
==================================================================== -->
|
||||
|
||||
<!-- =============================================================== -->
|
||||
<!-- Include the Documentation DTD -->
|
||||
<!-- =============================================================== -->
|
||||
|
||||
<!ENTITY % document PUBLIC
|
||||
"-//APACHE//DTD Documentation V1.1//EN"
|
||||
"document-v11.dtd">
|
||||
%document;
|
||||
|
||||
|
||||
<!-- =============================================================== -->
|
||||
<!-- Extend the Documentation DTD -->
|
||||
<!-- =============================================================== -->
|
||||
|
||||
<!-- extend the local.xxx entities -->
|
||||
<!ENTITY % local.blocks "|bl">
|
||||
|
||||
|
||||
<!-- =============================================================== -->
|
||||
<!-- Document Type Definition -->
|
||||
<!-- =============================================================== -->
|
||||
|
||||
<!ELEMENT specification (header?, body, appendices?, footer?)>
|
||||
<!ATTLIST specification %common.att;>
|
||||
|
||||
<!ELEMENT appendices (%sections;)+>
|
||||
<!ATTLIST appendices %common.att;>
|
||||
|
||||
<!-- =============================================================== -->
|
||||
<!-- Bibliography List -->
|
||||
<!-- =============================================================== -->
|
||||
|
||||
<!-- Bibliography list -->
|
||||
<!ELEMENT bl (bi)+>
|
||||
<!ATTLIST bl %common.att;>
|
||||
|
||||
<!-- Book item -->
|
||||
<!ELEMENT bi EMPTY>
|
||||
<!ATTLIST bi %common.att;
|
||||
%name.att;
|
||||
%title.att;
|
||||
%link.att;
|
||||
authors CDATA #REQUIRED
|
||||
date CDATA #IMPLIED>
|
||||
|
||||
<!-- =============================================================== -->
|
||||
<!-- End of DTD -->
|
||||
<!-- =============================================================== -->
|
93
src/documentation/content/xdocs/dtd/todo-v11.dtd
Normal file
93
src/documentation/content/xdocs/dtd/todo-v11.dtd
Normal file
@ -0,0 +1,93 @@
|
||||
<!-- ===================================================================
|
||||
|
||||
Apache Todos DTD (Version 1.1)
|
||||
|
||||
PURPOSE:
|
||||
This DTD was developed to create a simple yet powerful document
|
||||
type for software development todo lists for use with the Apache projects.
|
||||
It is an XML-compliant DTD and it's maintained by the Apache XML
|
||||
project.
|
||||
|
||||
TYPICAL INVOCATION:
|
||||
|
||||
<!DOCTYPE document PUBLIC
|
||||
"-//APACHE//DTD Todo Vx.y//EN"
|
||||
"todo-vxy.dtd">
|
||||
|
||||
where
|
||||
|
||||
x := major version
|
||||
y := minor version
|
||||
|
||||
NOTES:
|
||||
It is important, expecially in open developped software projects, to keep
|
||||
track of software changes that need to be done, planned features, development
|
||||
assignment, etc. in order to allow better work parallelization and create
|
||||
an entry point for people that want to help. This DTD wants to provide
|
||||
a solid foundation to provide such information and to allow it to be
|
||||
published as well as distributed in a common format.
|
||||
|
||||
AUTHORS:
|
||||
Stefano Mazzocchi <stefano@apache.org>
|
||||
|
||||
FIXME:
|
||||
- do we need anymore working contexts? (SM)
|
||||
|
||||
CHANGE HISTORY:
|
||||
[Version 1.0]
|
||||
19991129 Initial version. (SM)
|
||||
19991225 Added actions element for better structure (SM)
|
||||
[Version 1.1]
|
||||
20011212 Used public identifiers for external entities (SM)
|
||||
|
||||
COPYRIGHT:
|
||||
Copyright (c) @year@ The Apache Software Foundation.
|
||||
|
||||
Permission to copy in any form is granted provided this notice is
|
||||
included in all copies. Permission to redistribute is granted
|
||||
provided this file is distributed untouched in all its parts and
|
||||
included files.
|
||||
|
||||
==================================================================== -->
|
||||
|
||||
<!-- =============================================================== -->
|
||||
<!-- Include the Documentation DTD -->
|
||||
<!-- =============================================================== -->
|
||||
|
||||
<!ENTITY % document PUBLIC
|
||||
"-//APACHE//DTD Documentation V1.1//EN"
|
||||
"document-v11.dtd">
|
||||
%document;
|
||||
|
||||
|
||||
<!-- =============================================================== -->
|
||||
<!-- Common entities -->
|
||||
<!-- =============================================================== -->
|
||||
|
||||
<!ENTITY % priorities "showstopper|high|medium|low|wish|dream">
|
||||
|
||||
<!ENTITY % contexts "build|docs|code|admin|design">
|
||||
|
||||
<!-- =============================================================== -->
|
||||
<!-- Document Type Definition -->
|
||||
<!-- =============================================================== -->
|
||||
|
||||
<!ELEMENT todo (devs, actions*)>
|
||||
<!ATTLIST todo %common.att;
|
||||
%title.att;>
|
||||
|
||||
<!ELEMENT devs (person+)>
|
||||
<!ATTLIST devs %common.att;>
|
||||
|
||||
<!ELEMENT actions (action+)>
|
||||
<!ATTLIST actions %common.att;
|
||||
priority (%priorities;) #IMPLIED>
|
||||
|
||||
<!ELEMENT action (%content.mix;)*>
|
||||
<!ATTLIST action %common.att;
|
||||
assigned-to IDREF #IMPLIED
|
||||
context (%contexts;) #REQUIRED>
|
||||
|
||||
<!-- =============================================================== -->
|
||||
<!-- End of DTD -->
|
||||
<!-- =============================================================== -->
|
287
src/documentation/content/xdocs/faq.xml
Normal file
287
src/documentation/content/xdocs/faq.xml
Normal file
@ -0,0 +1,287 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Copyright (C) 2004 The Apache Software Foundation. All rights reserved. -->
|
||||
<!DOCTYPE faqs PUBLIC "-//APACHE//DTD FAQ V1.1//EN" "./dtd/faq-v11.dtd">
|
||||
|
||||
<faqs title="Frequently Asked Questions">
|
||||
<faq>
|
||||
<question>
|
||||
Why is reading a simple sheet taking so long?
|
||||
</question>
|
||||
<answer>
|
||||
<p>You've probably enabled logging. Logging is intended only for
|
||||
autopsie style debugging. Having it enabled will reduce performance
|
||||
by a factor of at least 100. Logging is helpful for understanding
|
||||
why POI can't read some file or developing POI itself. Important
|
||||
errors are thrown as exceptions, which means you probably don't need
|
||||
logging.</p>
|
||||
</answer>
|
||||
</faq>
|
||||
<faq>
|
||||
<question>
|
||||
What is the HSSF "eventmodel"?
|
||||
</question>
|
||||
<answer>
|
||||
<p>The HSSF eventmodel package is a new API for reading XLS files more efficiently. It does
|
||||
require more knowledge on the part of the user, but reduces memory consumption by more than
|
||||
tenfold. It is based on the AWT event model in combination with SAX. If you need read-only
|
||||
access to a given XLS file, this is the best way to do it.</p>
|
||||
</answer>
|
||||
|
||||
</faq>
|
||||
<faq>
|
||||
<question>
|
||||
Why can't read the document I created using Star Office 5.1?
|
||||
</question>
|
||||
<answer>
|
||||
<p>Star Office 5.1 writes some records using the older BIFF standard. This causes some problems
|
||||
with POI which supports only BIFF8.</p>
|
||||
</answer>
|
||||
</faq>
|
||||
<faq>
|
||||
<question>
|
||||
Why am I getting an exception each time I attempt to read my spreadsheet?
|
||||
</question>
|
||||
<answer>
|
||||
<p>It's possible your spreadsheet contains a feature that is not currently supported by HSSF.
|
||||
For example - spreadsheets containing cells with rich text are not currently supported.</p>
|
||||
</answer>
|
||||
</faq>
|
||||
<faq>
|
||||
<question>
|
||||
Does HSSF support protected spreadsheets?
|
||||
</question>
|
||||
<answer>
|
||||
<p>Protecting a spreadsheet encrypts it. We wont touch encryption because we're not legally educated
|
||||
and don't understand the full implications of trying to implement this. If you wish to have a go
|
||||
at this feel free to add it as a plugin module. We wont be hosting it here however.</p>
|
||||
</answer>
|
||||
</faq>
|
||||
<faq>
|
||||
<question>
|
||||
How do you tell if a field contains a date with HSSF?
|
||||
</question>
|
||||
<answer>
|
||||
<p>Excel stores dates as numbers therefore the only way to determine if a cell is
|
||||
actually stored as a date is to look at the formatting. There is a helper method
|
||||
in HSSFDateUtil (since the 1.7.0-dev release) that checks for this.
|
||||
Thanks to Jason Hoffman for providing the solution.</p>
|
||||
<source>
|
||||
case HSSFCell.CELL_TYPE_NUMERIC:
|
||||
double d = cell.getNumericCellValue();
|
||||
// test if a date!
|
||||
if (HSSFDateUtil.isCellDateFormatted(cell)) {
|
||||
// format in form of M/D/YY
|
||||
cal.setTime(HSSFDateUtil.getJavaDate(d));
|
||||
cellText =
|
||||
(String.valueOf(cal.get(Calendar.YEAR))).substring(2);
|
||||
cellText = cal.get(Calendar.MONTH)+1 + "/" +
|
||||
cal.get(Calendar.DAY_OF_MONTH) + "/" +
|
||||
cellText;
|
||||
} </source>
|
||||
</answer>
|
||||
</faq>
|
||||
<faq>
|
||||
<question>
|
||||
I'm trying to stream an XLS file from a servlet and I'm having some trouble. What's the problem?
|
||||
</question>
|
||||
<answer>
|
||||
<p>
|
||||
The problem usually manifests itself as the junk characters being shown on
|
||||
screen. The problem persists even though you have set the correct mime type.
|
||||
</p>
|
||||
<p>
|
||||
The short answer is, don't depend on IE to display a binary file type properly if you stream it via a
|
||||
servlet. Every minor version of IE has different bugs on this issue.
|
||||
</p>
|
||||
<p>
|
||||
The problem in most versions of IE is that it does not use the mime type on
|
||||
the HTTP response to determine the file type; rather it uses the file extension
|
||||
on the request. Thus you might want to add a
|
||||
<strong>.xls</strong> to your request
|
||||
string. For example
|
||||
<em>http://yourserver.com/myServelet.xls?param1=xx</em>. This is
|
||||
easily accomplished through URL mapping in any servlet container. Sometimes
|
||||
a request like
|
||||
<em>http://yourserver.com/myServelet?param1=xx&dummy=file.xls</em> is also
|
||||
known to work.
|
||||
|
||||
</p>
|
||||
<p>
|
||||
To guarantee opening the file properly in Excel from IE, write out your file to a
|
||||
temporary file under your web root from your servelet. Then send an http response
|
||||
to the browser to do a client side redirection to your temp file. (Note that using a
|
||||
server side redirect using RequestDispatcher will not be effective in this case)
|
||||
</p>
|
||||
<p>
|
||||
Note also that when you request a document that is opened with an
|
||||
external handler, IE sometimes makes two requests to the webserver. So if your
|
||||
generating process is heavy, it makes sense to write out to a temporary file, so that multiple
|
||||
requests happen for a static file.
|
||||
</p>
|
||||
<p>
|
||||
None of this is particular to Excel. The same problem arises when you try to
|
||||
generate any binary file dynamically to an IE client. For example, if you generate
|
||||
pdf files using
|
||||
<link href="http://xml.apache.org/fop">FOP</link>, you will come across many of the same issues.
|
||||
|
||||
</p>
|
||||
<!-- Thanks to Avik for the answer -->
|
||||
</answer>
|
||||
</faq>
|
||||
<faq>
|
||||
<question>
|
||||
I want to set a cell format (Data format of a cell) of a excel sheet as ###,###,###.#### or ###,###,###.0000. Is it possible using POI ?
|
||||
</question>
|
||||
<answer>
|
||||
<p>
|
||||
Yes. You first need to get a HSSFDataFormat object from the workbook and call getFormat with the desired format. Some examples are <link href="hssf/quick-guide.html#DataFormats">here</link>.
|
||||
</p>
|
||||
</answer>
|
||||
</faq>
|
||||
<faq>
|
||||
<question>
|
||||
I want to set a cell format (Data format of a cell) of a excel sheet as text. Is it possible using POI ?
|
||||
</question>
|
||||
<answer>
|
||||
<p>
|
||||
Yes. This is a built-in format for excel that you can get from HSSFDataFormat object using the format string "@". Also, the string "text" will alias this format.
|
||||
</p>
|
||||
</answer>
|
||||
</faq>
|
||||
<faq>
|
||||
<question>
|
||||
How do I add a border around a merged cell?
|
||||
</question>
|
||||
<answer>
|
||||
<p>Add blank cells around where the cells normally would have been and set the borders individually for each cell.
|
||||
We will probably enhance HSSF in the future to make this process easier.</p>
|
||||
</answer>
|
||||
</faq>
|
||||
<faq>
|
||||
<question>
|
||||
I tried to set cell values and Excel sheet name on my native language,
|
||||
but I failed to do it. :(
|
||||
</question>
|
||||
<answer>
|
||||
<p>By default HSSF uses cell values and sheet names as compressed unicode,
|
||||
so to support localization you should use Unicode.
|
||||
To do it you should set it manually:</p>
|
||||
<source>
|
||||
// for sheet name
|
||||
HSSFWorkbook wb = new HSSFWorkbook();
|
||||
HSSFSheet s = wb.createSheet();
|
||||
wb.setSheetName( 0, "SomeUnicodeName", HSSFWorkbook.ENCODING_UTF_16 );
|
||||
|
||||
// for cell value
|
||||
HSSFRow r = s.createRow( 0 );
|
||||
HSSFCell c = r.createCell( (short)0 );
|
||||
c.setCellType( HSSFCell.CELL_TYPE_STRING );
|
||||
c.setEncoding( HSSFCell.ENCODING_UTF_16 );
|
||||
c.setCellValue( "\u0422\u0435\u0441\u0442\u043E\u0432\u0430\u044F" ); </source>
|
||||
<p>
|
||||
Make sure you make the call to setEncoding() before calling setCellValue(), otherwise what you pass in won't be interpreted properly.
|
||||
</p>
|
||||
</answer>
|
||||
</faq>
|
||||
<faq>
|
||||
<question>
|
||||
I'm having trouble creating a spreadsheet using POI using
|
||||
websphere 3.5.
|
||||
</question>
|
||||
<answer>
|
||||
<p>Make sure you have fix pack 4 installed.</p>
|
||||
</answer>
|
||||
</faq>
|
||||
<faq>
|
||||
<question>
|
||||
I am using styles when creating a workbook in POI, but Excel refuses to open the file, complaining about "Too Many Styles".
|
||||
</question>
|
||||
<answer>
|
||||
<p>You just create the styles OUTSIDE of the loop in which you create cells.</p>
|
||||
<p>GOOD:</p>
|
||||
<source>
|
||||
HSSFWorkbook wb = new HSSFWorkbook();
|
||||
HSSFSheet sheet = wb.createSheet("new sheet");
|
||||
HSSFRow row = null;
|
||||
|
||||
// Aqua background
|
||||
HSSFCellStyle style = wb.createCellStyle();
|
||||
style.setFillBackgroundColor(HSSFColor.AQUA.index);
|
||||
style.setFillPattern(HSSFCellStyle.BIG_SPOTS);
|
||||
HSSFCell cell = row.createCell((short) 1);
|
||||
cell.setCellValue("X");
|
||||
cell.setCellStyle(style);
|
||||
|
||||
// Orange "foreground", foreground being the fill foreground not the font color.
|
||||
style = wb.createCellStyle();
|
||||
style.setFillForegroundColor(HSSFColor.ORANGE.index);
|
||||
style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
|
||||
|
||||
for (int x = 0; x < 1000; x++) {
|
||||
|
||||
// Create a row and put some cells in it. Rows are 0 based.
|
||||
row = sheet.createRow((short) k);
|
||||
|
||||
for (int y = 0; y < 100; y++) {
|
||||
cell = row.createCell((short) k);
|
||||
cell.setCellValue("X");
|
||||
cell.setCellStyle(style);
|
||||
}
|
||||
}
|
||||
|
||||
// Write the output to a file
|
||||
FileOutputStream fileOut = new FileOutputStream("workbook.xls");
|
||||
wb.write(fileOut);
|
||||
fileOut.close(); </source>
|
||||
|
||||
<p>BAD:</p>
|
||||
<source>
|
||||
HSSFWorkbook wb = new HSSFWorkbook();
|
||||
HSSFSheet sheet = wb.createSheet("new sheet");
|
||||
HSSFRow row = null;
|
||||
|
||||
for (int x = 0; x < 1000; x++) {
|
||||
// Aqua background
|
||||
HSSFCellStyle style = wb.createCellStyle();
|
||||
style.setFillBackgroundColor(HSSFColor.AQUA.index);
|
||||
style.setFillPattern(HSSFCellStyle.BIG_SPOTS);
|
||||
HSSFCell cell = row.createCell((short) 1);
|
||||
cell.setCellValue("X");
|
||||
cell.setCellStyle(style);
|
||||
|
||||
// Orange "foreground", foreground being the fill foreground not the font color.
|
||||
style = wb.createCellStyle();
|
||||
style.setFillForegroundColor(HSSFColor.ORANGE.index);
|
||||
style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
|
||||
|
||||
// Create a row and put some cells in it. Rows are 0 based.
|
||||
row = sheet.createRow((short) k);
|
||||
|
||||
for (int y = 0; y < 100; y++) {
|
||||
cell = row.createCell((short) k);
|
||||
cell.setCellValue("X");
|
||||
cell.setCellStyle(style);
|
||||
}
|
||||
}
|
||||
|
||||
// Write the output to a file
|
||||
FileOutputStream fileOut = new FileOutputStream("workbook.xls");
|
||||
wb.write(fileOut);
|
||||
fileOut.close(); </source>
|
||||
</answer>
|
||||
</faq>
|
||||
<faq>
|
||||
<question>
|
||||
Will Poi read any spreadsheet and rewrite it with modifications.
|
||||
</question>
|
||||
<answer>
|
||||
<p>Poi is not guanteed to read the contents of any spreadsheet.
|
||||
Certain features may cause spreadsheets to fail to read. More
|
||||
problematic is rewriting spreadsheets. Poi tried hard to
|
||||
preserve the records of the original spreadsheet but some
|
||||
features may cause problems. We advise that you limit the
|
||||
formatting of spreadsheets you process so as to not be
|
||||
unpleasantly suprised at a later stage.</p>
|
||||
</answer>
|
||||
</faq>
|
||||
</faqs>
|
16
src/documentation/content/xdocs/getinvolved/book.xml
Normal file
16
src/documentation/content/xdocs/getinvolved/book.xml
Normal file
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Copyright (C) 2004 The Apache Software Foundation. All rights reserved. -->
|
||||
<!DOCTYPE book PUBLIC "-//APACHE//DTD Cocoon Documentation Book V1.0//EN" "./dtd/book-cocoon-v10.dtd">
|
||||
|
||||
<book software="Poi"
|
||||
title="Poi Project Documentation"
|
||||
copyright="@year@ Poi Project"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
|
||||
<menu label="Get Involved">
|
||||
<menu-item label="Contributing" href="index.html"/>
|
||||
<menu-item label="Branching" href="branching.html"/>
|
||||
<menu-item label="Mail Lists" href="http://jakarta.apache.org/site/mail.html"/>
|
||||
</menu>
|
||||
|
||||
</book>
|
98
src/documentation/content/xdocs/getinvolved/branching.xml
Normal file
98
src/documentation/content/xdocs/getinvolved/branching.xml
Normal file
@ -0,0 +1,98 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Copyright (C) 2004 The Apache Software Foundation. All rights reserved. -->
|
||||
<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.1//EN" "./dtd/document-v11.dtd">
|
||||
|
||||
<document>
|
||||
|
||||
<header>
|
||||
<title>Branching</title>
|
||||
<authors>
|
||||
<person id="GJS" name="Glen Stampoultzis" email="glens@apache.org"/>
|
||||
</authors>
|
||||
</header>
|
||||
|
||||
<body>
|
||||
<section><title>Branching Conventions</title>
|
||||
<p>
|
||||
Branches are tagged in the following way:
|
||||
</p>
|
||||
<ul>
|
||||
<li>REL_1_5_BRANCH</li>
|
||||
<li>REL_2_0_BRANCH</li>
|
||||
</ul>
|
||||
<p>
|
||||
Merge points should be tagged as follows:
|
||||
</p>
|
||||
<ul>
|
||||
<li>REL_1_5_BRANCH_MERGE1</li>
|
||||
<li>REL_1_5_BRANCH_MERGE2</li>
|
||||
<li>etc...</li>
|
||||
</ul>
|
||||
<p>
|
||||
Releases should be tagged as:
|
||||
</p>
|
||||
<ul>
|
||||
<li>REL_1_5</li>
|
||||
<li>REL_1_5_1</li>
|
||||
<li>REL_1_5_2</li>
|
||||
<li>etc...</li>
|
||||
</ul>
|
||||
|
||||
</section>
|
||||
<section><title>Branching Advise</title>
|
||||
<p>
|
||||
Don't forget which branch you are currently on. This is critically
|
||||
important. Committing stuff to the wrong branch causes all sorts of
|
||||
headaches. Best to name your checkout after the branch you are on.
|
||||
</p>
|
||||
</section>
|
||||
<section><title>Who Manages Branching?</title>
|
||||
<p>
|
||||
All branching is currently managed by Glen Stampoultzis. If you wish
|
||||
to create your own branch please let him know. Merging is also
|
||||
handled by Glen. Just pop him a mail if you feel it's necessary to
|
||||
create a branch or perform a merge.
|
||||
</p>
|
||||
<p>
|
||||
The reason to go through a single point for branching is that it can be
|
||||
an easy thing to get wrong. Having a single person managing branches
|
||||
means there is less chance of getting getting our wires crossed with this
|
||||
difficult area of CVS.
|
||||
</p>
|
||||
</section>
|
||||
<section><title>Currently Active Branches</title>
|
||||
<p>
|
||||
The following branches are currently active:
|
||||
</p>
|
||||
<table>
|
||||
<tr>
|
||||
<th>
|
||||
Branch
|
||||
</th>
|
||||
<th>
|
||||
Description
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
HEAD
|
||||
</td>
|
||||
<td>
|
||||
This is the trunk and is always active. Currently it is being used to continue development
|
||||
of the 2.0 release.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
REL_1_5_BRANCH
|
||||
</td>
|
||||
<td>
|
||||
All bug fixes not specifically relevant to the 2.0 work should be placed in this branch.
|
||||
From here they will merged back to the trunk and the merge point marked.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</section>
|
||||
</body>
|
||||
|
||||
</document>
|
112
src/documentation/content/xdocs/getinvolved/index.xml
Normal file
112
src/documentation/content/xdocs/getinvolved/index.xml
Normal file
@ -0,0 +1,112 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Copyright (C) 2004 The Apache Software Foundation. All rights reserved. -->
|
||||
<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.1//EN" "./dtd/document-v11.dtd">
|
||||
|
||||
<document>
|
||||
<header>
|
||||
<title>Contribution to POI</title>
|
||||
<authors>
|
||||
<person name="Nicola Ken Barozzi" email="barozzi@nicolaken.com"/>
|
||||
<person name="Marc Johnson" email="mjohnson@apache.org"/>
|
||||
<person name="Andrew C. Oliver" email="acoliver@apache.org"/>
|
||||
<person name="Tetsuya Kitahata" email="tetsuya.kitahata@nifty.com"/>
|
||||
</authors>
|
||||
</header>
|
||||
|
||||
<body>
|
||||
|
||||
<section><title>Introduction</title>
|
||||
<section><title>Disclaimer</title>
|
||||
<p>
|
||||
Any information in here that might be perceived as legal information is
|
||||
informational only. We're not lawyers, so consult a legal professional
|
||||
if needed.
|
||||
</p>
|
||||
</section>
|
||||
<section><title>The Licensing</title>
|
||||
<p>
|
||||
The POI project is <link href="http://www.opensource.org">OpenSource</link>
|
||||
and developed/distributed under the <link
|
||||
href="http://www.apache.org/foundation/licence-FAQ.html">
|
||||
Apache Software License</link>. Unlike other licenses this license allows
|
||||
free open source development; however, it does not require you to release
|
||||
your source or use any particular license for your source. If you wish
|
||||
to contribute to POI (which you're very welcome and encouraged to do so)
|
||||
then you must agree to release the rights of your source to us under this
|
||||
license.
|
||||
</p>
|
||||
</section>
|
||||
<section><title>I just signed an NDA to get a spec from Microsoft and I'd like to contribute</title>
|
||||
<p>
|
||||
In short, stay away, stay far far away. Implementing these file formats
|
||||
in POI is done strictly by using public information. Public information
|
||||
includes sources from other open source projects, books that state the
|
||||
purpose intended is for allowing implementation of the file format and
|
||||
do not require any non-disclosure agreement and just hard work.
|
||||
We are intent on keeping it
|
||||
legal, by contributing patches you agree to do the same.
|
||||
</p>
|
||||
<p>
|
||||
If you've ever received information regarding the OLE 2 Compound Document
|
||||
Format under any type of exclusionary agreement from Microsoft, or
|
||||
(probably illegally) received such information from a person bound by
|
||||
such an agreement, you cannot participate in this project. (Sorry)
|
||||
</p>
|
||||
<p>
|
||||
Those submitting patches that show insight into the file format may be
|
||||
asked to state explicitly that they are eligible or possibly sign an
|
||||
agreement.
|
||||
</p>
|
||||
</section>
|
||||
</section>
|
||||
<section><title>I just want to get involved but don't know where to start</title>
|
||||
<ul>
|
||||
<li>Read the rest of the website, understand what POI is and what it does,
|
||||
the project vision, etc.</li>
|
||||
<li>Use POI a bit, look for gaps in the documentation and examples.</li>
|
||||
<li>Join the mail lists and share your knowledge with others.</li>
|
||||
<li>Get <link href="http://jakarta.apache.org/site/cvsindex.html">CVS</link> and check out the POI source tree</li>
|
||||
<li>Documentation is always the best place to start contributing, maybe you found that if the documentation just told you how to do X then it would make more sense, modify the documentation.</li>
|
||||
<li>Get used to building POI, you'll be doing it a lot, be one with the build, know its targets, etc.</li>
|
||||
<li>Write Unit Tests. Great way to understand POI. Look for classes that aren't tested, or aren't tested on a public/protected method level, start there.</li>
|
||||
<li>(HSSF)Get the Excel 97 Developer's Kit - its out of print but its dirt cheap (seen copies for under $15 (US)) used on <link href="http://www.amazon.com">amazon</link>. It explains the Excel file format.</li>
|
||||
<li>Submit patches (see below) of your contributions, modifications.</li>
|
||||
<li>Fill out new features, see <link href="http://jakarta.apache.org/site/bugs.html">Bug database</link> for suggestions.</li>
|
||||
</ul>
|
||||
</section>
|
||||
<section><title>Submitting Patches</title>
|
||||
<p>
|
||||
Create patches by getting the latest sources from CVS (the HEAD).
|
||||
Alter or add files as appropriate. Then, from the jakarta-poi directiory,
|
||||
type cvs diff -u > mypatch.patch. This will capture all of your changes
|
||||
in a patch file of the appropriate format. Next, if you've added any
|
||||
files, create an archive (tar.bz2 preferred as its the smallest) in a
|
||||
path-preserving archive format, relative to your jakarta-poi directory.
|
||||
(Note: If you use <link href="http://www.wincvs.org/">WinCVS</link>, move to
|
||||
[Admin] -> [Command Line] Menu and type "cvs diff -u" at
|
||||
[Enter a cvs line command] input field ([Commandline Settings] Tab),
|
||||
while selecting the target directories or files, in order to create
|
||||
unified diffs.
|
||||
In other words, [Alt+A]+[Alt+C]+[Alt+C] and type "cvs diff -u".)
|
||||
You'll attach both files in the next step.
|
||||
</p>
|
||||
<p>
|
||||
Patches are submitted via the <link href="http://jakarta.apache.org/site/bugs.html">Bug Database</link>.
|
||||
Create a new bug, set the subject to [PATCH] followed by a brief description. Explain you patch and any special instructions and submit/save it.
|
||||
Next, go back to the bug, and create attachements for the patch files you
|
||||
created. Be sure to describe not only the files purpose, but its format.
|
||||
(Is that ZIP or a tgz or a bz2 or what?).
|
||||
</p>
|
||||
<p>
|
||||
Make sure your patches include the @author tag on any files you've altered
|
||||
or created. Make sure you've documented your changes and altered the
|
||||
examples/etc to reflect them. Any new additions should have unit tests.
|
||||
Lastly, ensure that you've provided approriate javadoc. (see
|
||||
<link href="http://jakarta.apache.org/poi/resolutions/res001.html">Coding
|
||||
Standards</link>). Patches that are of low quality may be rejected or
|
||||
the contributer may be asked to bring them up to spec.
|
||||
</p>
|
||||
</section>
|
||||
|
||||
</body>
|
||||
</document>
|
16
src/documentation/content/xdocs/hdf/book.xml
Normal file
16
src/documentation/content/xdocs/hdf/book.xml
Normal file
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- Copyright (C) 2004 The Apache Software Foundation. All rights reserved. -->
|
||||
<!DOCTYPE book PUBLIC "-//APACHE//DTD Cocoon Documentation Book V1.0//EN" "../dtd/book-cocoon-v10.dtd">
|
||||
|
||||
<book software="Poi Project"
|
||||
title="HDF"
|
||||
copyright="@year@ Poi Project">
|
||||
|
||||
<menu label="Navigation">
|
||||
<menu-item label="Main" href="../index.html"/>
|
||||
<menu-item label="HDF Format" href="docoverview.html"/>
|
||||
</menu>
|
||||
|
||||
</book>
|
||||
|
||||
|
95
src/documentation/content/xdocs/hdf/docoverview.xml
Normal file
95
src/documentation/content/xdocs/hdf/docoverview.xml
Normal file
@ -0,0 +1,95 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Copyright (C) 2004 The Apache Software Foundation. All rights reserved. -->
|
||||
<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.1//EN" "../dtd/document-v11.dtd">
|
||||
|
||||
<document>
|
||||
<header>
|
||||
<title>HDF</title>
|
||||
<subtitle>Word file format</subtitle>
|
||||
<authors>
|
||||
<person name="S. Ryan Ackley" email="sackley@cfl.rr.com"/>
|
||||
</authors>
|
||||
</header>
|
||||
|
||||
<body>
|
||||
<section><title>The Word 97 File Format in semi-plain English</title>
|
||||
|
||||
<p>The purpose of this document is to give a brief high level overview of the
|
||||
HDF document format. This document does not go into in-depth technical
|
||||
detail and is only meant as a supplement to the Microsoft Word 97 Binary
|
||||
File Format freely available at <link href="http://wotsit.org">Wotsit.org</link>.</p>
|
||||
<p>The OLE file format is not discussed in this document. It is assumed that
|
||||
the reader has a working knowledge of the POIFS API. </p>
|
||||
|
||||
<section><title>Word file structure</title>
|
||||
<p>A Word file is made up of the document text and data structures
|
||||
containing formatting information about the text. Of course, this is a
|
||||
very simplified illustration. There are fields and macros and other
|
||||
things that have not been considered. At this stage, HDF is mainly
|
||||
concerned with formatted text.</p>
|
||||
</section>
|
||||
<section><title>Reading Word files</title>
|
||||
<p>The entry point for HDF's reading of a Word file is the File Information
|
||||
Block (FIB). This structure is the entry point for the locations and size
|
||||
of a document's text and data structures. The FIB is located at the
|
||||
beginning of the main stream.</p>
|
||||
<section><title>Text</title>
|
||||
<p>The document's text is also located in the main stream. Its starting
|
||||
location is given as FIB.fcMin and its length is given in bytes by
|
||||
FIB.ccpText. These two values are not very useful in getting the text
|
||||
because of unicode. There may be unicode text intermingled with ASCII
|
||||
text. That brings us to the piece table.</p>
|
||||
<p>The piece table is used to divide the text into non-unicode and unicode
|
||||
pieces. The size and offset are given in FIB.fcClx and FIB.lcbClx
|
||||
respectively. The piece table may contain Property Modifiers (prm).
|
||||
These are for complex(fast-saved) files and are skipped. Each text piece
|
||||
contains offsets in the main stream that contain text for that piece.
|
||||
If the piece uses unicode, the file offset is masked with a certain bit.
|
||||
Then you have to unmask the bit and divide by 2 to get the real file
|
||||
offset. </p>
|
||||
</section>
|
||||
<section><title>Text Formatting</title>
|
||||
<section><title>Stylesheet</title>
|
||||
<p>All text formatting is based on styles contained in the StyleSheet.
|
||||
The StyleSheet is a data structure containing among other things, style
|
||||
descriptions. Each style description can contain a paragraph style and
|
||||
a character style or simply a character style. Each style description
|
||||
is stored in a compressed version on file. Basically these are deltas
|
||||
from another style.</p>
|
||||
<p>Eventually, you have to chain back to the nil style which is an
|
||||
imaginary style with certain implied values.</p>
|
||||
</section>
|
||||
<section><title>Paragraph and Character styles</title>
|
||||
<p>Paragraph and Character formatting properties for a document's text are
|
||||
stored on file as deltas from some base style in the Stylesheet. The
|
||||
deltas are used to create a complete uncompressed style in memory.</p>
|
||||
<p>Uncompressed paragraph styles are represented by the Pargraph
|
||||
Properties(PAP) data structure. Uncompressed character styles are
|
||||
represented by the Character Properties(CHP) data structure. The styles
|
||||
for the document text are stored in compressed format in the
|
||||
corresponding Formatted Disk Pages (FKP). A compressed PAP is referred
|
||||
to as a PAPX and a compressed CHP is a CHPX. The FKP locations are
|
||||
stored in the bin table. There are seperate bin tables for CHPXs and
|
||||
PAPXs. The bin tables' locations and sizes are stored in the FIB.</p>
|
||||
<p>A FKP is a 512 byte OLE page. It contains the offsets of the beginning
|
||||
and end of each paragraph/character run in the main stream and the
|
||||
compressed properties for that interval. The compessed PAPX is based on
|
||||
its base style in the StyleSheet. The compressed CHPX is based on the
|
||||
enclosing paragraph's base style in the Stylesheet.</p>
|
||||
</section>
|
||||
<section><title>Uncompressing styles and other data structures</title>
|
||||
<p>All compressed properties(CHPX, PAPX, SEPX) contain a grpprl. A grpprl
|
||||
is an array of sprms. A sprm defines a delta from some base property.
|
||||
There is a table of possible sprms in the Word 97 spec. Each sprm is a
|
||||
two byte operand followed by a parameter. The parameter size depends on
|
||||
the sprm. Each sprm describes an operation that should be performed on
|
||||
the base style. After every sprm in the grpprl is performed on the base
|
||||
style you will have the style for the paragraph, character run,
|
||||
section, etc.</p>
|
||||
</section>
|
||||
</section>
|
||||
</section>
|
||||
</section>
|
||||
</body>
|
||||
</document>
|
||||
|
35
src/documentation/content/xdocs/hdf/index.xml
Normal file
35
src/documentation/content/xdocs/hdf/index.xml
Normal file
@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Copyright (C) 2004 The Apache Software Foundation. All rights reserved. -->
|
||||
<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.1//EN" "../dtd/document-v11.dtd">
|
||||
|
||||
<document>
|
||||
<header>
|
||||
<title>HDF</title>
|
||||
<subtitle>Overview</subtitle>
|
||||
<authors>
|
||||
<person name="Nicola Ken Barozzi" email="barozzi@nicolaken.com"/>
|
||||
<person name="Andrew C. Oliver" email="acoliver@apache.org"/>
|
||||
<person name="Ryan Ackley" email="sackley@apache.org"/>
|
||||
</authors>
|
||||
</header>
|
||||
|
||||
<body>
|
||||
<section><title>Overview</title>
|
||||
|
||||
<p>HDF is the name of OUR port of the Microsoft Word 97(-2002) file format to
|
||||
pure Java.</p>
|
||||
<p>HDF is still in early development. It is in the
|
||||
<link href="http://cvs.apache.org/viewcvs/jakarta-poi/src/scratchpad/">scratchpad section of the
|
||||
CVS.</link> Source code in the <em>org.apache.poi.hdf.extractor</em> tree is
|
||||
legacy code. Source in the <em>org.apache.poi.hdf.model</em>
|
||||
tree is the old legacy code refactored into an object model. Check the How-To
|
||||
page for detailed examples on using HDF.
|
||||
</p>
|
||||
<p>
|
||||
We are looking for developers!!! If you are interested in helping with HDF
|
||||
familiarize yourself with the source code and just start coding. Make sure
|
||||
you read the guidelines for <link href="http://jakarta.apache.org/poi/getinvolved/index.html">
|
||||
getting involved</link></p>
|
||||
</section>
|
||||
</body>
|
||||
</document>
|
135
src/documentation/content/xdocs/historyandfuture.xml
Normal file
135
src/documentation/content/xdocs/historyandfuture.xml
Normal file
@ -0,0 +1,135 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Copyright (C) 2004 The Apache Software Foundation. All rights reserved. -->
|
||||
<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.1//EN" "./dtd/document-v11.dtd">
|
||||
|
||||
<document>
|
||||
<header>
|
||||
<title>Project History</title>
|
||||
<authors>
|
||||
<person id="AO" name="Andrew C. Oliver" email="acoliver@apache.org"/>
|
||||
</authors>
|
||||
</header>
|
||||
|
||||
<body>
|
||||
|
||||
|
||||
<section><title>Brief Project History</title>
|
||||
|
||||
<p>The POI project was dreamed up back around April 2001, when
|
||||
Andy Oliver landed a short term contract to do Java-based
|
||||
reporting to Excel. He'd done this project a few times before
|
||||
and knew right where to look for the tools he needed.
|
||||
Ironically, the API he used to use had skyrocketed from around
|
||||
$300 ($US) to around $10K ($US). He figured it would take two
|
||||
people around six months to write an Excel port so he
|
||||
recommended the client fork out the $10K.
|
||||
</p>
|
||||
|
||||
<p>Around June 2001, Andy started thinking how great it would
|
||||
be to have an open source Java tool to do this and, while he
|
||||
had some spare time, he started on the project and learned
|
||||
about OLE 2 Compound Document Format. After hitting some real
|
||||
stumpers he realized he'd need help. He posted a message to
|
||||
his local Java User's Group (JUG) and asked if anyone else
|
||||
would be interested. He lucked out and the most talented Java
|
||||
programmer he'd ever met, Marc Johnson, joined the project. He
|
||||
ran rings around Andy at porting OLE 2 CDF and rewrote his
|
||||
skeletal code into a more sophisticated library. It took Marc
|
||||
a few iterations to get something they were happy with.
|
||||
</p>
|
||||
|
||||
<p>While Marc worked on that, Andy ported XLS to Java, based
|
||||
on Marc's library. Several users wrote in asking to read XLS
|
||||
(not just write as had originally been planned) and one user
|
||||
had special requests for a different use for POIFS. Before
|
||||
long, the project scope had tripled. POI 1.0 was released a
|
||||
month later than planned, but with far more features. Marc
|
||||
quickly wrote the serializer framework and HSSF Serializer in
|
||||
record time and Andy banged out more documentation and worked
|
||||
on making people aware of the project
|
||||
</p>
|
||||
|
||||
<p> Shortly before the release, POI was fortunate to come into
|
||||
contact with Nicola -Ken- Barrozzi who gave them samples for
|
||||
the HSSF Serializer and help uncover its unfortunate bugs
|
||||
(which were promptly fixed). More recently, Ken ported most
|
||||
of the POI project documentation to XML from Andy's crappy
|
||||
HTML docs he wrote with Star Office.
|
||||
</p>
|
||||
|
||||
<p> Around the same time as the release, Glen Stampoultzis
|
||||
joined the project. Glen was ticked off at Andy's flippant attitude
|
||||
towards adding graphing to HSSF. Glen got so ticked off he decided to
|
||||
grab a hammer and do it himself. Glen has already become an integral
|
||||
part of the POI development community; his contributions to HSSF have
|
||||
already started making waves.
|
||||
</p>
|
||||
|
||||
<p>Somewhere in there we decided to finally submit the project
|
||||
to <link href="http://xml.apache.org/cocoon">The Apache
|
||||
Cocoon Project</link>, only to discover the project had
|
||||
outgrown fitting nicely into just Cocoon long ago.
|
||||
Furthermore, Andy started eyeing other projects he'd like to
|
||||
see POI functionality added to. So it was decided to donate
|
||||
the Serializers and Generators to Cocoon, other POI
|
||||
integration components to other projects, and the POI APIs
|
||||
would become part of Jakarta. It was a bumpy road but it
|
||||
looks like everything turned out since you're reading this!
|
||||
</p>
|
||||
|
||||
</section>
|
||||
|
||||
<section><title>What's next for POI</title>
|
||||
<p>First we'll tackle this from a project standpoint: Well, we
|
||||
made an offer to Microsoft and Actuate (tongue in cheek
|
||||
... well mostly) that we'd quit the project and retire if
|
||||
they'd simply write us each a really large check. I've yet to
|
||||
get a phone call or email so I'm assuming they're not going to
|
||||
pay us to go away.
|
||||
</p>
|
||||
<p>Next, we've got some work to do here at Jakarta to finish
|
||||
integrating POI into the community. Furthermore, we're
|
||||
still transitioning the Serializer to Cocoon.
|
||||
</p>
|
||||
<p>HSSF, during the 2.0 cycle, will undergo a few
|
||||
optimizations. We'll also be adding new features like a full
|
||||
implementation of Formulas and custom text formats. We're
|
||||
hoping to be able to generate smaller files by adding
|
||||
write-support for RK, MulRK and MulBlank records. I'm also
|
||||
going to work on a Cocoon 2 Generator. Currently, reading is
|
||||
not very efficient in HSSF. This is mainly because in order to
|
||||
write or modify, one needs to be able to update upstream
|
||||
pointers to downstream data. To do this you have to have
|
||||
everything between in memory. A Generator would allow SAX
|
||||
events to be processed instead. (This will be based on the low
|
||||
level structures). One of the great things about this is that,
|
||||
you'll not only have a more efficient way to read the file,
|
||||
you'll have a great way to use spreadsheets as XML data
|
||||
sources.
|
||||
</p>
|
||||
<p>The HSSF Serializer, will further separate into a general
|
||||
framework for creating serializers for other formats and the
|
||||
HSSF Serializer specific implementation. (This is largely
|
||||
already true). We'll also be adding support for features
|
||||
already supported by HSSF (styles, fonts, text formats). We're
|
||||
hoping to add support for formulas during this cycle.
|
||||
</p>
|
||||
<p>We're beginning to expand our scope yet again. If we could
|
||||
do all of this for XLS files, what about Doc files or PPT
|
||||
files? We're thinking that our next component (HDF - Horrible
|
||||
Document Format) should follow the same pattern. We're hoping
|
||||
that new blood will join the team and allow us to tackle this
|
||||
even faster (in part because POIFS is already finished). But
|
||||
maybe what we need most is you! </p>
|
||||
</section>
|
||||
|
||||
</body>
|
||||
<footer>
|
||||
<legal>
|
||||
Copyright (c) @year@ The Apache Software Foundation All rights reserved.
|
||||
$Revision$ $Date$
|
||||
</legal>
|
||||
</footer>
|
||||
|
||||
|
||||
</document>
|
150
src/documentation/content/xdocs/howtobuild.xml
Normal file
150
src/documentation/content/xdocs/howtobuild.xml
Normal file
@ -0,0 +1,150 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Copyright (C) 2004 The Apache Software Foundation. All rights reserved. -->
|
||||
<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.1//EN" "../dtd/document-v11.dtd">
|
||||
|
||||
<document>
|
||||
<header>
|
||||
<title>How To Build POI</title>
|
||||
<authors>
|
||||
<person email="glens@apache.org" name="Glen Stampoultzis" id="GS"/>
|
||||
</authors>
|
||||
</header>
|
||||
<body>
|
||||
<section>
|
||||
<title>Installing Ant</title>
|
||||
<p>
|
||||
The POI build system requires two components to perform a
|
||||
build.
|
||||
<link href="ext:jakarta.apache.org/ant">Ant</link> and
|
||||
<link href="ext:xml.apache.org/forrest">forrest</link>.
|
||||
</p>
|
||||
<p>
|
||||
Specifically the build has been tested to work with Ant version
|
||||
1.5.3 and Forrest 0.4. To install these products download
|
||||
the distributions and follow the instructions in their
|
||||
documentation. Make sure you don't forget to set the
|
||||
environment variables FORREST_HOME and ANT_HOME. The
|
||||
ANT_HOME/bin directory should be in the path.
|
||||
</p>
|
||||
<p>
|
||||
One these products are installed you will also need to
|
||||
download some extra jar files required by the build.
|
||||
</p>
|
||||
<table>
|
||||
<tr>
|
||||
<th>Library</th>
|
||||
<th>Location</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>junit</td>
|
||||
<td>http://www.ibiblio.org/maven/junit/jars/</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>xerces</td>
|
||||
<td>http://www.ibiblio.org/maven/xerces/jars/</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>jdepend</td>
|
||||
<td>http://www.ibiblio.org/maven/jdepend/jars/</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>xalan</td>
|
||||
<td>http://www.ibiblio.org/maven/xalan/jars/</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>
|
||||
Just pick the latest versions of these jars and place
|
||||
them in ANT_HOME/lib
|
||||
</p>
|
||||
</section>
|
||||
<section>
|
||||
<title>Running the Build</title>
|
||||
<p>
|
||||
On the first run the ant build system will download all
|
||||
the jars required by the project to build ant. If you're
|
||||
behind a firewall this may cause some problems. Should you
|
||||
need to it's possible to manually put the jars in the
|
||||
correct directories. These can be obtained from here:
|
||||
</p>
|
||||
<table>
|
||||
<tr>
|
||||
<th>JAR</th>
|
||||
<th>Location</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>/commons-logging/jars/commons-logging-1.0.1.jar</td>
|
||||
<td>lib</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>/log4j/jars/log4j-1.2.8.jar</td>
|
||||
<td>lib</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>/commons-beanutils/jars/commons-beanutils-1.6.jar</td>
|
||||
<td>src/contrib/lib</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>/commons-collections/jars/commons-collections-2.1.jar</td>
|
||||
<td>src/contrib/lib</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>/commons-lang/jars/commons-lang-1.0-b1.jar</td>
|
||||
<td>src/contrib/lib</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>/junit/jars/junit-3.8.1.jar</td>
|
||||
<td>lib</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>
|
||||
The main targets of interest to our users are:
|
||||
</p>
|
||||
<table>
|
||||
<tr>
|
||||
<th>Target</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>clean</td>
|
||||
<td>Erase all build work products (ie, everything in the
|
||||
build directory</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>compile</td>
|
||||
<td>Compiles all files from main, contrib and scratchpad</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>test</td>
|
||||
<td>Run all unit tests from main, contrib and scratchpad</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>docs</td>
|
||||
<td>Generate all documentation for the system</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>generate-records</td>
|
||||
<td>Generate records from the XML record defintitions</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>generate-types</td>
|
||||
<td>Generate types from the XML type definitions (this is
|
||||
for HDF).</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>jar</td>
|
||||
<td>Produce jar files</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>dist</td>
|
||||
<td>Create a distribution.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>clean-dist</td>
|
||||
<td>Runs clean before creating the distribution.</td>
|
||||
</tr>
|
||||
</table>
|
||||
</section>
|
||||
</body>
|
||||
</document>
|
||||
|
||||
|
22
src/documentation/content/xdocs/hpsf/book.xml
Normal file
22
src/documentation/content/xdocs/hpsf/book.xml
Normal file
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- Copyright (C) 2004 The Apache Software Foundation. All rights reserved. -->
|
||||
<!DOCTYPE book PUBLIC "-//APACHE//DTD Cocoon Documentation Book V1.0//EN" "../dtd/book-cocoon-v10.dtd">
|
||||
<!-- $Id$ -->
|
||||
<book software="POI Project"
|
||||
title="HPSF"
|
||||
copyright="@year@ POI Project">
|
||||
|
||||
<menu label="Navigation">
|
||||
<menu-item label="Main" href="../index.html"/>
|
||||
</menu>
|
||||
<menu label="HPSF">
|
||||
<menu-item label="Overview" href="index.html"/>
|
||||
<menu-item label="How To" href="how-to.html"/>
|
||||
<menu-item label="Thumbnails" href="thumbnails.html"/>
|
||||
<menu-item label="Internals" href="internals.html"/>
|
||||
<menu-item label="To Do" href="todo.html"/>
|
||||
</menu>
|
||||
|
||||
</book>
|
||||
|
||||
|
869
src/documentation/content/xdocs/hpsf/how-to.xml
Normal file
869
src/documentation/content/xdocs/hpsf/how-to.xml
Normal file
@ -0,0 +1,869 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- Copyright (C) 2004 The Apache Software Foundation. All rights reserved. -->
|
||||
<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.1//EN"
|
||||
"../dtd/document-v11.dtd">
|
||||
<!-- $Id$ -->
|
||||
|
||||
<document>
|
||||
<header>
|
||||
<title>HPSF HOW-TO</title>
|
||||
<authors>
|
||||
<person name="Rainer Klute" email="klute@apache.org"/>
|
||||
</authors>
|
||||
</header>
|
||||
<body>
|
||||
<section><title>How To Use the HPSF APIs</title>
|
||||
|
||||
<p>This HOW-TO is organized in three sections. You should read them
|
||||
sequentially because the later sections build upon the earlier ones.</p>
|
||||
|
||||
<ol>
|
||||
<li>
|
||||
The <link href="#sec1">first section</link> explains how to read
|
||||
the most important standard properties of a Microsoft Office
|
||||
document. Standard properties are things like title, author, creation
|
||||
date etc. It is quite likely that you will find here what you need and
|
||||
don't have to read the other sections.
|
||||
</li>
|
||||
|
||||
<li>
|
||||
The <link href="#sec2">second section</link> goes a small step
|
||||
further and focusses on reading additional standard properties. It also
|
||||
talks about exceptions that may be thrown when dealing with HPSF and
|
||||
shows how you can read properties of embedded objects.
|
||||
</li>
|
||||
|
||||
<li>
|
||||
The <link href="#sec3">third section</link> tells how to read
|
||||
non-standard properties. Non-standard properties are application-specific
|
||||
triples consisting of an ID, a type, and a value.
|
||||
</li>
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<anchor id="sec1"/>
|
||||
<section><title>Reading Standard Properties</title>
|
||||
|
||||
<note>This section explains how to read
|
||||
the most important standard properties of a Microsoft Office
|
||||
document. Standard properties are things like title, author, creation
|
||||
date etc. Chances are that you will find here what you need and
|
||||
don't have to read the other sections.</note>
|
||||
|
||||
<p>The first thing you should understand is that properties are stored in
|
||||
separate documents inside the POI filesystem. (If you don't know what a
|
||||
POI filesystem is, read the <link href="../poifs/index.html">POIFS
|
||||
documentation</link>.) A document in a POI filesystem is also called a
|
||||
<strong>stream</strong>.</p>
|
||||
|
||||
<p>The following example shows how to read a POI filesystem's
|
||||
"title" property. Reading other properties is similar. Consider the API
|
||||
documentation of <code>org.apache.poi.hpsf.SummaryInformation</code> to
|
||||
learn which methods are available!</p>
|
||||
|
||||
<p>The standard properties this section focusses on can be found in a
|
||||
document called <em>\005SummaryInformation</em> located in the root of the
|
||||
POI filesystem. The notation <em>\005</em> in the document's name means
|
||||
the character with the decimal value of 5. In order to read the title, an
|
||||
application has to perform the following steps:</p>
|
||||
|
||||
<ol>
|
||||
<li>
|
||||
Open the document <em>\005SummaryInformation</em> located in the root
|
||||
of the POI filesystem.
|
||||
</li>
|
||||
<li>
|
||||
Create an instance of the class <code>SummaryInformation</code> from
|
||||
that document.
|
||||
</li>
|
||||
<li>
|
||||
Call the <code>SummaryInformation</code> instance's
|
||||
<code>getTitle()</code> method.
|
||||
</li>
|
||||
</ol>
|
||||
|
||||
<p>Sounds easy, doesn't it? Here are the steps in detail.</p>
|
||||
|
||||
|
||||
<section><title>Open the document \005SummaryInformation in the root of the
|
||||
POI filesystem</title>
|
||||
|
||||
<p>An application that wants to open a document in a POI filesystem
|
||||
(POIFS) proceeds as shown by the following code fragment. (The full
|
||||
source code of the sample application is available in the
|
||||
<em>examples</em> section of the POI source tree as
|
||||
<em>ReadTitle.java</em>.</p>
|
||||
|
||||
<source>
|
||||
import java.io.*;
|
||||
import org.apache.poi.hpsf.*;
|
||||
import org.apache.poi.poifs.eventfilesystem.*;
|
||||
|
||||
// ...
|
||||
|
||||
public static void main(String[] args)
|
||||
throws IOException
|
||||
{
|
||||
final String filename = args[0];
|
||||
POIFSReader r = new POIFSReader();
|
||||
r.registerListener(new MyPOIFSReaderListener(),
|
||||
"\005SummaryInformation");
|
||||
r.read(new FileInputStream(filename));
|
||||
}</source>
|
||||
|
||||
<p>The first interesting statement is</p>
|
||||
|
||||
<source>POIFSReader r = new POIFSReader();</source>
|
||||
|
||||
<p>It creates a
|
||||
<code>org.apache.poi.poifs.eventfilesystem.POIFSReader</code> instance
|
||||
which we shall need to read the POI filesystem. Before the application
|
||||
actually opens the POI filesystem we have to tell the
|
||||
<code>POIFSReader</code> which documents we are interested in. In this
|
||||
case the application should do something with the document
|
||||
<em>\005SummaryInformation</em>.</p>
|
||||
|
||||
<source>
|
||||
r.registerListener(new MyPOIFSReaderListener(),
|
||||
"\005SummaryInformation");</source>
|
||||
|
||||
<p>This method call registers a
|
||||
<code>org.apache.poi.poifs.eventfilesystem.POIFSReaderListener</code>
|
||||
with the <code>POIFSReader</code>. The <code>POIFSReaderListener</code>
|
||||
interface specifies the method <code>processPOIFSReaderEvent</code>
|
||||
which processes a document. The class
|
||||
<code>MyPOIFSReaderListener</code> implements the
|
||||
<code>POIFSReaderListener</code> and thus the
|
||||
<code>processPOIFSReaderEvent</code> method. The eventing POI filesystem
|
||||
calls this method when it finds the <em>\005SummaryInformation</em>
|
||||
document. In the sample application <code>MyPOIFSReaderListener</code> is
|
||||
a static class in the <em>ReadTitle.java</em> source file.</p>
|
||||
|
||||
<p>Now everything is prepared and reading the POI filesystem can
|
||||
start:</p>
|
||||
|
||||
<source>r.read(new FileInputStream(filename));</source>
|
||||
|
||||
<p>The following source code fragment shows the
|
||||
<code>MyPOIFSReaderListener</code> class and how it retrieves the
|
||||
title.</p>
|
||||
|
||||
<source>
|
||||
static class MyPOIFSReaderListener implements POIFSReaderListener
|
||||
{
|
||||
public void processPOIFSReaderEvent(POIFSReaderEvent event)
|
||||
{
|
||||
SummaryInformation si = null;
|
||||
try
|
||||
{
|
||||
si = (SummaryInformation)
|
||||
PropertySetFactory.create(event.getStream());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new RuntimeException
|
||||
("Property set stream \"" +
|
||||
event.getPath() + event.getName() + "\": " + ex);
|
||||
}
|
||||
final String title = si.getTitle();
|
||||
if (title != null)
|
||||
System.out.println("Title: \"" + title + "\"");
|
||||
else
|
||||
System.out.println("Document has no title.");
|
||||
}
|
||||
}
|
||||
</source>
|
||||
|
||||
<p>The line</p>
|
||||
|
||||
<source>SummaryInformation si = null;</source>
|
||||
|
||||
<p>declares a <code>SummaryInformation</code> variable and initializes it
|
||||
with <code>null</code>. We need an instance of this class to access the
|
||||
title. The instance is created in a <code>try</code> block:</p>
|
||||
|
||||
<source>si = (SummaryInformation)
|
||||
PropertySetFactory.create(event.getStream());</source>
|
||||
|
||||
<p>The expression <code>event.getStream()</code> returns the input stream
|
||||
containing the bytes of the property set stream named
|
||||
<em>\005SummaryInformation</em>. This stream is passed into the
|
||||
<code>create</code> method of the factory class
|
||||
<code>org.apache.poi.hpsf.PropertySetFactory</code> which returns
|
||||
a <code>org.apache.poi.hpsf.PropertySet</code> instance. It is more or
|
||||
less safe to cast this result to <code>SummaryInformation</code>, a
|
||||
convenience class with methods like <code>getTitle()</code>,
|
||||
<code>getAuthor()</code> etc.</p>
|
||||
|
||||
<p>The <code>PropertySetFactory.create</code> method may throw all sorts
|
||||
of exceptions. We'll deal with them in the next sections. For now we just
|
||||
catch all exceptions and throw a <code>RuntimeException</code>
|
||||
containing the message text of the origin exception.</p>
|
||||
|
||||
<p>If all goes well, the sample application retrieves the title and prints
|
||||
it to the standard output. As you can see you must be prepared for the
|
||||
case that the POI filesystem does not have a title.</p>
|
||||
|
||||
<source>final String title = si.getTitle();
|
||||
if (title != null)
|
||||
System.out.println("Title: \"" + title + "\"");
|
||||
else
|
||||
System.out.println("Document has no title.");</source>
|
||||
|
||||
<p>Please note that a Microsoft Office document does not necessarily
|
||||
contain the <em>\005SummaryInformation</em> stream. The documents created
|
||||
by the Microsoft Office suite have one, as far as I know. However, an
|
||||
Excel spreadsheet exported from StarOffice 5.2 won't have a
|
||||
<em>\005SummaryInformation</em> stream. In this case the applications
|
||||
won't throw an exception but simply does not call the
|
||||
<code>processPOIFSReaderEvent</code> method. You have been warned!</p>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
<anchor id="sec2"/>
|
||||
<section><title>Additional Standard Properties, Exceptions And Embedded Objects</title>
|
||||
|
||||
<note>This section focusses on reading additional standard properties. It
|
||||
also talks about exceptions that may be thrown when dealing with HPSF and
|
||||
shows how you can read properties of embedded objects.</note>
|
||||
|
||||
<p>A couple of <strong>additional standard properties</strong> are not
|
||||
contained in the <em>\005SummaryInformation</em> stream explained above,
|
||||
for example a document's category or the number of multimedia clips in a
|
||||
PowerPoint presentation. Microsoft has invented an additional stream named
|
||||
<em>\005DocumentSummaryInformation</em> to hold these properties. With two
|
||||
minor exceptions you can proceed exactly as described above to read the
|
||||
properties stored in <em>\005DocumentSummaryInformation</em>:</p>
|
||||
|
||||
<ul>
|
||||
<li>Instead of <em>\005SummaryInformation</em> use
|
||||
<em>\005DocumentSummaryInformation</em> as the stream's name.</li>
|
||||
<li>Replace all occurrences of the class
|
||||
<code>SummaryInformation</code> by
|
||||
<code>DocumentSummaryInformation</code>.</li>
|
||||
</ul>
|
||||
|
||||
<p>And of course you cannot call <code>getTitle()</code> because
|
||||
<code>DocumentSummaryInformation</code> has different query methods. See
|
||||
the Javadoc API documentation for the details!</p>
|
||||
|
||||
<p>In the previous section the application simply caught all
|
||||
<strong>exceptions</strong> and was in no way interested in any
|
||||
details. However, a real application will likely want to know what went
|
||||
wrong and act appropriately. Besides any IO exceptions there are three
|
||||
HPSF resp. POI specific exceptions you should know about:</p>
|
||||
|
||||
<dl>
|
||||
<dt><code>NoPropertySetStreamException</code>:</dt>
|
||||
<dd>
|
||||
This exception is thrown if the application tries to create a
|
||||
<code>PropertySet</code> instance from a stream that is not a
|
||||
property set stream. (<code>SummaryInformation</code> and
|
||||
<code>DocumentSummaryInformation</code> are subclasses of
|
||||
<code>PropertySet</code>.) A faulty property set stream counts as not
|
||||
being a property set stream at all. An application should be prepared to
|
||||
deal with this case even if it opens streams named
|
||||
<em>\005SummaryInformation</em> or
|
||||
<em>\005DocumentSummaryInformation</em> only. These are just names. A
|
||||
stream's name by itself does not ensure that the stream contains the
|
||||
expected contents and that this contents is correct.
|
||||
</dd>
|
||||
|
||||
<dt><code>UnexpectedPropertySetTypeException</code></dt>
|
||||
<dd>This exception is thrown if a certain type of property set is
|
||||
expected somewhere (e.g. a <code>SummaryInformation</code> or
|
||||
<code>DocumentSummaryInformation</code>) but the provided property
|
||||
set is not of that type.</dd>
|
||||
|
||||
<dt><code>MarkUnsupportedException</code></dt>
|
||||
<dd>This exception is thrown if an input stream that is to be parsed
|
||||
into a property set does not support the
|
||||
<code>InputStream.mark(int)</code> operation. The POI filesystem uses
|
||||
the <code>DocumentInputStream</code> class which does support this
|
||||
operation, so you are safe here. However, if you read a property set
|
||||
stream from another kind of input stream things may be
|
||||
different.</dd>
|
||||
</dl>
|
||||
|
||||
<p>Many Microsoft Office documents contain <strong>embedded
|
||||
objects</strong>, for example an Excel sheet on a page in a Word
|
||||
document. Embedded objects may have property sets of their own. An
|
||||
application can open these property set streams as described above. The
|
||||
only difference is that they are not located in the POI filesystem's root
|
||||
but in a <strong>nested directory</strong> instead. Just register a
|
||||
<code>POIFSReaderListener</code> for the property set streams you are
|
||||
interested in. For example, the <em>POIBrowser</em> application in the
|
||||
contrib section tries to open each and every document in a POI filesystem
|
||||
as a property set stream. If this operation was successful it displays the
|
||||
properties.</p>
|
||||
</section>
|
||||
|
||||
<anchor id="sec3"/>
|
||||
<section><title>Reading Non-Standard Properties</title>
|
||||
|
||||
<note>This section tells how to read non-standard properties. Non-standard
|
||||
properties are application-specific ID/type/value triples.</note>
|
||||
|
||||
<section><title>Overview</title>
|
||||
<p>Now comes the real hardcode stuff. As mentioned above,
|
||||
<code>SummaryInformation</code> and
|
||||
<code>DocumentSummaryInformation</code> are just special cases of the
|
||||
general concept of a property set. This concept says that a
|
||||
<strong>property set</strong> consists of properties and that each
|
||||
<strong>property</strong> is an entity with an <strong>ID</strong>, a
|
||||
<strong>type</strong>, and a <strong>value</strong>.</p>
|
||||
|
||||
<p>Okay, that was still rather easy. However, to make things more
|
||||
complicated, Microsoft in its infinite wisdom decided that a property set
|
||||
shalt be broken into one or more <strong>sections</strong>. Each section
|
||||
holds a bunch of properties. But since that's still not complicated
|
||||
enough, a section may have an optional <strong>dictionary</strong> that
|
||||
maps property IDs to <strong>property names</strong> - we'll explain
|
||||
later what that means.</p>
|
||||
|
||||
<p>The procedure to get to the properties is the following:</p>
|
||||
|
||||
<ol>
|
||||
<li>Use the <strong><code>PropertySetFactory</code></strong> class to
|
||||
create a <code>PropertySet</code> object from a property set stream. If
|
||||
you don't know whether an input stream is a property set stream, just
|
||||
try to call <code>PropertySetFactory.create(java.io.InputStream)</code>:
|
||||
You'll either get a <code>PropertySet</code> instance returned or an
|
||||
exception is thrown.</li>
|
||||
|
||||
<li>Call the <code>PropertySet</code>'s method <code>getSections()</code>
|
||||
to get the sections contained in the property set. Each section is
|
||||
an instance of the <code>Section</code> class.</li>
|
||||
|
||||
<li>Each section has a format ID. The format ID of the first section in a
|
||||
property set determines the property set's type. For example, the first
|
||||
(and only) section of the SummaryInformation property set has a format
|
||||
ID of <code>F29F85E0-4FF9-1068-AB-91-08-00-2B-27-B3-D9</code>. You can
|
||||
get the format ID with <code>Section.getFormatID()</code>.</li>
|
||||
|
||||
<li>The properties contained in a <code>Section</code> can be retrieved
|
||||
with <code>Section.getProperties()</code>. The result is an array of
|
||||
<code>Property</code> instances.</li>
|
||||
|
||||
<li>A property has a name, a type, and a value. The <code>Property</code>
|
||||
class has methods to retrieve them.</li>
|
||||
</ol>
|
||||
</section>
|
||||
|
||||
<section><title>A Sample Application</title>
|
||||
<p>Let's have a look at a sample Java application that dumps all property
|
||||
set streams contained in a POI file system. The full source code of this
|
||||
program can be found as <em>ReadCustomPropertySets.java</em> in the
|
||||
<em>examples</em> area of the POI source code tree. Here are the key
|
||||
sections:</p>
|
||||
|
||||
<source>import java.io.*;
|
||||
import java.util.*;
|
||||
import org.apache.poi.hpsf.*;
|
||||
import org.apache.poi.poifs.eventfilesystem.*;
|
||||
import org.apache.poi.util.HexDump;</source>
|
||||
|
||||
<p>The most important package the application needs is
|
||||
<code>org.apache.poi.hpsf.*</code>. This package contains the HPSF
|
||||
classes. Most classes named below are from the HPSF package. Of course we
|
||||
also need the POIFS event file system's classes and <code>java.io.*</code>
|
||||
since we are dealing with POI I/O. From the <code>java.util</code> package
|
||||
we use the <code>List</code> and <code>Iterator</code> class. The class
|
||||
<code>org.apache.poi.util.HexDump</code> provides a methods to dump byte
|
||||
arrays as nicely formatted strings.</p>
|
||||
|
||||
<source>public static void main(String[] args)
|
||||
throws IOException
|
||||
{
|
||||
final String filename = args[0];
|
||||
POIFSReader r = new POIFSReader();
|
||||
|
||||
/* Register a listener for *all* documents. */
|
||||
r.registerListener(new MyPOIFSReaderListener());
|
||||
r.read(new FileInputStream(filename));
|
||||
}</source>
|
||||
|
||||
<p>The <code>POIFSReader</code> is set up in a way that the listener
|
||||
<code>MyPOIFSReaderListener</code> is called on every file in the POI file
|
||||
system.</p>
|
||||
</section>
|
||||
|
||||
<section><title>The Property Set</title>
|
||||
<p>The listener class tries to create a <code>PropertySet</code> from each
|
||||
stream using the <code>PropertySetFactory.create()</code> method:</p>
|
||||
|
||||
<source>static class MyPOIFSReaderListener implements POIFSReaderListener
|
||||
{
|
||||
public void processPOIFSReaderEvent(POIFSReaderEvent event)
|
||||
{
|
||||
PropertySet ps = null;
|
||||
try
|
||||
{
|
||||
ps = PropertySetFactory.create(event.getStream());
|
||||
}
|
||||
catch (NoPropertySetStreamException ex)
|
||||
{
|
||||
out("No property set stream: \"" + event.getPath() +
|
||||
event.getName() + "\"");
|
||||
return;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new RuntimeException
|
||||
("Property set stream \"" +
|
||||
event.getPath() + event.getName() + "\": " + ex);
|
||||
}
|
||||
|
||||
/* Print the name of the property set stream: */
|
||||
out("Property set stream \"" + event.getPath() +
|
||||
event.getName() + "\":");</source>
|
||||
|
||||
<p>Creating the <code>PropertySet</code> is done in a <code>try</code>
|
||||
block, because not each stream in the POI file system contains a property
|
||||
set. If it is some other file, the
|
||||
<code>PropertySetFactory.create()</code> throws a
|
||||
<code>NoPropertySetStreamException</code>, which is caught and
|
||||
logged. Then the program continues with the next stream. However, all
|
||||
other types of exceptions cause the program to terminate by throwing a
|
||||
runtime exception. If all went well, we can print the name of the property
|
||||
set stream.</p>
|
||||
</section>
|
||||
|
||||
<section><title>The Sections</title>
|
||||
<p>The next step is to print the number of sections followed by the
|
||||
sections themselves:</p>
|
||||
|
||||
<source>/* Print the number of sections: */
|
||||
final long sectionCount = ps.getSectionCount();
|
||||
out(" No. of sections: " + sectionCount);
|
||||
|
||||
/* Print the list of sections: */
|
||||
List sections = ps.getSections();
|
||||
int nr = 0;
|
||||
for (Iterator i = sections.iterator(); i.hasNext();)
|
||||
{
|
||||
/* Print a single section: */
|
||||
Section sec = (Section) i.next();
|
||||
|
||||
// See below for the complete loop body.
|
||||
}</source>
|
||||
|
||||
<p>The <code>PropertySet</code>'s method <code>getSectionCount()</code>
|
||||
returns the number of sections.</p>
|
||||
|
||||
<p>To retrieve the sections, use the <code>getSections()</code>
|
||||
method. This method returns a <code>java.util.List</code> containing
|
||||
instances of the <code>Section</code> class in their proper order.</p>
|
||||
|
||||
<p>The sample code shows a loop that retrieves the <code>Section</code>
|
||||
objects one by one and prints some information about each one. Here is
|
||||
the complete body of the loop:</p>
|
||||
|
||||
<source>/* Print a single section: */
|
||||
Section sec = (Section) i.next();
|
||||
out(" Section " + nr++ + ":");
|
||||
String s = hex(sec.getFormatID().getBytes());
|
||||
s = s.substring(0, s.length() - 1);
|
||||
out(" Format ID: " + s);
|
||||
|
||||
/* Print the number of properties in this section. */
|
||||
int propertyCount = sec.getPropertyCount();
|
||||
out(" No. of properties: " + propertyCount);
|
||||
|
||||
/* Print the properties: */
|
||||
Property[] properties = sec.getProperties();
|
||||
for (int i2 = 0; i2 < properties.length; i2++)
|
||||
{
|
||||
/* Print a single property: */
|
||||
Property p = properties[i2];
|
||||
int id = p.getID();
|
||||
long type = p.getType();
|
||||
Object value = p.getValue();
|
||||
out(" Property ID: " + id + ", type: " + type +
|
||||
", value: " + value);
|
||||
}</source>
|
||||
</section>
|
||||
|
||||
<section><title>The Section's Format ID</title>
|
||||
<p>The first method called on the <code>Section</code> instance is
|
||||
<code>getFormatID()</code>. As explained above, the format ID of the
|
||||
first section in a property set determines the type of the property
|
||||
set. Its type is <code>ClassID</code> which is essentially a sequence of
|
||||
16 bytes. A real application using its own type of a custom property set
|
||||
should have defined a unique format ID and, when reading a property set
|
||||
stream, should check the format ID is equal to that unique format ID. The
|
||||
sample program just prints the format ID it finds in a section:</p>
|
||||
|
||||
<source>String s = hex(sec.getFormatID().getBytes());
|
||||
s = s.substring(0, s.length() - 1);
|
||||
out(" Format ID: " + s);</source>
|
||||
|
||||
<p>As you can see, the <code>getFormatID()</code> method returns a
|
||||
<code>ClassID</code> object. An array containing the bytes can be
|
||||
retrieved with <code>ClassID.getBytes()</code>. In order to get a nicely
|
||||
formatted printout, the sample program uses the <code>hex()</code> helper
|
||||
method which in turn uses the POI utility class <code>HexDump</code> in
|
||||
the <code>org.apache.poi.util</code> package. Another helper method is
|
||||
<code>out()</code> which just saves typing
|
||||
<code>System.out.println()</code>.</p>
|
||||
</section>
|
||||
|
||||
<section><title>The Properties</title>
|
||||
<p>Before getting the properties, it is possible to find out how many
|
||||
properties are available in the section via the
|
||||
<code>Section.getPropertyCount()</code>. The sample application uses this
|
||||
method to print the number of properties to the standard output:</p>
|
||||
|
||||
<source>int propertyCount = sec.getPropertyCount();
|
||||
out(" No. of properties: " + propertyCount);</source>
|
||||
|
||||
<p>Now its time to get to the properties themselves. You can retrieve a
|
||||
section's properties with the method
|
||||
<code>Section.getProperties()</code>:</p>
|
||||
|
||||
<source>Property[] properties = sec.getProperties();</source>
|
||||
|
||||
<p>As you can see the result is an array of <code>Property</code>
|
||||
objects. This class has three methods to retrieve a property's ID, its
|
||||
type, and its value. The following code snippet shows how to call
|
||||
them:</p>
|
||||
|
||||
<source>for (int i2 = 0; i2 < properties.length; i2++)
|
||||
{
|
||||
/* Print a single property: */
|
||||
Property p = properties[i2];
|
||||
int id = p.getID();
|
||||
long type = p.getType();
|
||||
Object value = p.getValue();
|
||||
out(" Property ID: " + id + ", type: " + type +
|
||||
", value: " + value);
|
||||
}</source>
|
||||
</section>
|
||||
|
||||
<section><title>Sample Output</title>
|
||||
<p>The output of the sample program might look like the following. It
|
||||
shows the summary information and the document summary information
|
||||
property sets of a Microsoft Word document. However, unlike the first and
|
||||
second section of this HOW-TO the application does not have any code
|
||||
which is specific to the <code>SummaryInformation</code> and
|
||||
<code>DocumentSummaryInformation</code> classes.</p>
|
||||
|
||||
<source>Property set stream "/SummaryInformation":
|
||||
No. of sections: 1
|
||||
Section 0:
|
||||
Format ID: 00000000 F2 9F 85 E0 4F F9 10 68 AB 91 08 00 2B 27 B3 D9 ....O..h....+'..
|
||||
No. of properties: 17
|
||||
Property ID: 1, type: 2, value: 1252
|
||||
Property ID: 2, type: 30, value: Titel
|
||||
Property ID: 3, type: 30, value: Thema
|
||||
Property ID: 4, type: 30, value: Rainer Klute (Autor)
|
||||
Property ID: 5, type: 30, value: Test (Stichwörter)
|
||||
Property ID: 6, type: 30, value: This is a document for testing HPSF
|
||||
Property ID: 7, type: 30, value: Normal.dot
|
||||
Property ID: 8, type: 30, value: Unknown User
|
||||
Property ID: 9, type: 30, value: 3
|
||||
Property ID: 18, type: 30, value: Microsoft Word 9.0
|
||||
Property ID: 12, type: 64, value: Mon Jan 01 00:59:25 CET 1601
|
||||
Property ID: 13, type: 64, value: Thu Jul 18 16:22:00 CEST 2002
|
||||
Property ID: 14, type: 3, value: 1
|
||||
Property ID: 15, type: 3, value: 20
|
||||
Property ID: 16, type: 3, value: 93
|
||||
Property ID: 19, type: 3, value: 0
|
||||
Property ID: 17, type: 71, value: [B@13582d
|
||||
Property set stream "/DocumentSummaryInformation":
|
||||
No. of sections: 2
|
||||
Section 0:
|
||||
Format ID: 00000000 D5 CD D5 02 2E 9C 10 1B 93 97 08 00 2B 2C F9 AE ............+,..
|
||||
No. of properties: 14
|
||||
Property ID: 1, type: 2, value: 1252
|
||||
Property ID: 2, type: 30, value: Test
|
||||
Property ID: 14, type: 30, value: Rainer Klute (Manager)
|
||||
Property ID: 15, type: 30, value: Rainer Klute IT-Consulting GmbH
|
||||
Property ID: 5, type: 3, value: 3
|
||||
Property ID: 6, type: 3, value: 2
|
||||
Property ID: 17, type: 3, value: 111
|
||||
Property ID: 23, type: 3, value: 592636
|
||||
Property ID: 11, type: 11, value: false
|
||||
Property ID: 16, type: 11, value: false
|
||||
Property ID: 19, type: 11, value: false
|
||||
Property ID: 22, type: 11, value: false
|
||||
Property ID: 13, type: 4126, value: [B@56a499
|
||||
Property ID: 12, type: 4108, value: [B@506411
|
||||
Section 1:
|
||||
Format ID: 00000000 D5 CD D5 05 2E 9C 10 1B 93 97 08 00 2B 2C F9 AE ............+,..
|
||||
No. of properties: 7
|
||||
Property ID: 0, type: 0, value: {6=Test-JaNein, 5=Test-Zahl, 4=Test-Datum, 3=Test-Text, 2=_PID_LINKBASE}
|
||||
Property ID: 1, type: 2, value: 1252
|
||||
Property ID: 2, type: 65, value: [B@c9ba38
|
||||
Property ID: 3, type: 30, value: This is some text.
|
||||
Property ID: 4, type: 64, value: Wed Jul 17 00:00:00 CEST 2002
|
||||
Property ID: 5, type: 3, value: 27
|
||||
Property ID: 6, type: 11, value: true
|
||||
No property set stream: "/WordDocument"
|
||||
No property set stream: "/CompObj"
|
||||
No property set stream: "/1Table"</source>
|
||||
|
||||
<p>There are some interesting items to note:</p>
|
||||
|
||||
<ul>
|
||||
<li>The first property set (summary information) consists of a single
|
||||
section, the second property set (document summary information) consists
|
||||
of two sections.</li>
|
||||
|
||||
<li>Each section type (identified by its format ID) has its own domain of
|
||||
property ID. For example, in the second property set the properties with
|
||||
ID 2 have different meanings in the two section. By the way, the format
|
||||
IDs of these sections are <strong>not</strong> equal, but you have to
|
||||
look hard to find the difference.</li>
|
||||
|
||||
<li>The properties are not in any particular order in the section,
|
||||
although they slightly tend to be sorted by their IDs.</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<section><title>Property IDs</title>
|
||||
<p>Properties in the same section are distinguished by their IDs. This is
|
||||
similar to variables in a programming language like Java, which are
|
||||
distinguished by their names. But unlike variable names, property IDs are
|
||||
simple integral numbers. There is another similarity, however. Just like
|
||||
a Java variable has a certain scope (e.g. a member variables in a class),
|
||||
a property ID also has its scope of validity: the section.</p>
|
||||
|
||||
<p>Two property IDs in sections with different section format IDs
|
||||
don't have the same meaning even though their IDs might be equal. For
|
||||
example, ID 4 in the first (and only) section of a summary
|
||||
information property set denotes the document's author, while ID 4 in the
|
||||
first section of the document summary information property set means the
|
||||
document's byte count. The sample output above does not show a property
|
||||
with an ID of 4 in the first section of the document summary information
|
||||
property set. That means that the document does not have a byte
|
||||
count. However, there is a property with an ID of 4 in the
|
||||
<em>second</em> section: This is a user-defined property ID - we'll get
|
||||
to that topic in a minute.</p>
|
||||
|
||||
<p>So, how can you find out what the meaning of a certain property ID in
|
||||
the summary information and the document summary information property set
|
||||
is? The standard property sets as such don't have any hints about the
|
||||
<strong>meanings of their property IDs</strong>. For example, the summary
|
||||
information property set does not tell you that the property ID 4 stands
|
||||
for the document's author. This is external knowledge. Microsoft defined
|
||||
standard meanings for some of the property IDs in the summary information
|
||||
and the document summary information property sets. As a help to the Java
|
||||
and POI programmer, the class <code>PropertyIDMap</code> in the
|
||||
<code>org.apache.poi.hpsf.wellknown</code> package defines constants
|
||||
for the "well-known" property IDs. For example, there is the
|
||||
definition</p>
|
||||
|
||||
<source>public final static int PID_AUTHOR = 4;</source>
|
||||
|
||||
<p>These definitions allow you to use symbolic names instead of
|
||||
numbers.</p>
|
||||
|
||||
<p>In order to provide support for the other way, too, - i.e. to map
|
||||
property IDs to property names - the class <code>PropertyIDMap</code>
|
||||
defines two static methods:
|
||||
<code>getSummaryInformationProperties()</code> and
|
||||
<code>getDocumentSummaryInformationProperties()</code>. Both return
|
||||
<code>java.util.Map</code> objects which map property IDs to
|
||||
strings. Such a string gives a hint about the property's meaning. For
|
||||
example,
|
||||
<code>PropertyIDMap.getSummaryInformationProperties().get(4)</code>
|
||||
returns the string "PID_AUTHOR". An application could use this string as
|
||||
a key to a localized string which is displayed to the user, e.g. "Author"
|
||||
in English or "Verfasser" in German. HPSF might provide such
|
||||
language-dependend ("localized") mappings in a later release.</p>
|
||||
|
||||
<p>Usually you won't have to deal with those two maps. Instead you should
|
||||
call the <code>Section.getPIDString(int)</code> method. It returns the
|
||||
string associated with the specified property ID in the context of the
|
||||
<code>Section</code> object.</p>
|
||||
|
||||
<p>Above you learned that property IDs have a meaning in the scope of a
|
||||
section only. However, there are two exceptions to the rule: The property
|
||||
IDs 0 and 1 have a fixed meaning in <strong>all</strong> sections:</p>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th>Property ID</th>
|
||||
<th>Meaning</th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>0</td>
|
||||
<td>The property's value is a <strong>dictionary</strong>, i.e. a
|
||||
mapping from property IDs to strings.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>1</td>
|
||||
<td>The property's value is the number of a <strong>codepage</strong>,
|
||||
i.e. a mapping from character codes to characters. All strings in the
|
||||
section containing this property must be interpreted using this
|
||||
codepage. Typical property values are 1252 (8-bit "western" characters)
|
||||
or 1200 (16-bit Unicode characters).</td>
|
||||
</tr>
|
||||
</table>
|
||||
</section>
|
||||
|
||||
<section><title>Property types</title>
|
||||
<p>A property is nothing without its value. It is stored in a property set
|
||||
stream as a sequence of bytes. You must know the property's
|
||||
<strong>type</strong> in order to properly interpret those bytes and
|
||||
reasonably handle the value. A property's type is one of the so-called
|
||||
Microsoft-defined <strong>"variant types"</strong>. When you call
|
||||
<code>Property.getType()</code> you'll get a <code>long</code> value
|
||||
which denoting the property's variant type. The class
|
||||
<code>Variant</code> in the <code>org.apache.poi.hpsf</code> package
|
||||
holds most of those <code>long</code> values as named constants. For
|
||||
example, the constant <code>VT_I4 = 3</code> means a signed integer value
|
||||
of four bytes. Examples of other types are <code>VT_LPSTR = 30</code>
|
||||
meaning a null-terminated string of 8-bit characters, <code>VT_LPWSTR =
|
||||
31</code> which means a null-terminated Unicode string, or <code>VT_BOOL
|
||||
= 11</code> denoting a boolean value.</p>
|
||||
|
||||
<p>In most cases you won't need a property's type because HPSF does all
|
||||
the work for you.</p>
|
||||
</section>
|
||||
|
||||
<section><title>Property values</title>
|
||||
<p>When an application wants to retrieve a property's value and calls
|
||||
<code>Property.getValue()</code>, HPSF has to interpret the bytes making
|
||||
out the value according to the property's type. The type determines how
|
||||
many bytes the value consists of and what
|
||||
to do with them. For example, if the type is <code>VT_I4</code>, HPSF
|
||||
knows that the value is four bytes long and that these bytes
|
||||
comprise a signed integer value in the little-endian format. This is
|
||||
quite different from e.g. a type of <code>VT_LPWSTR</code>. In this case
|
||||
HPSF has to scan the value bytes for a Unicode null character and collect
|
||||
everything from the beginning to that null character as a Unicode
|
||||
string.</p>
|
||||
|
||||
<p>The good new is that HPSF does another job for you, too: It maps the
|
||||
variant type to an adequate Java type.</p>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th>Variant type:</th>
|
||||
<th>Java type:</th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>VT_I2</td>
|
||||
<td>java.lang.Integer</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>VT_I4</td>
|
||||
<td>java.lang.Long</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>VT_FILETIME</td>
|
||||
<td>java.util.Date</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>VT_LPSTR</td>
|
||||
<td>java.lang.String</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>VT_LPWSTR</td>
|
||||
<td>java.lang.String</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>VT_CF</td>
|
||||
<td>byte[]</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>VT_BOOL</td>
|
||||
<td>java.lang.Boolean</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
<p>The bad news is that there are still a couple of variant types HPSF
|
||||
does not yet support. If it encounters one of these types it
|
||||
returns the property's value as a byte array and leaves it to be
|
||||
interpreted by the application.</p>
|
||||
|
||||
<p>An application retrieves a property's value by calling the
|
||||
<code>Property.getValue()</code> method. This method's return type is the
|
||||
abstract <code>Object</code> class. The <code>getValue()</code> method
|
||||
looks up the property's variant type, reads the property's value bytes,
|
||||
creates an instance of an adequate Java type, assigns it the property's
|
||||
value and returns it. Primitive types like <code>int</code> or
|
||||
<code>long</code> will be returned as the corresponding class,
|
||||
e.g. <code>Integer</code> or <code>Long</code>.</p>
|
||||
</section>
|
||||
|
||||
|
||||
<section><title>Dictionaries</title>
|
||||
<p>The property with ID 0 has a very special meaning: It is a
|
||||
<strong>dictionary</strong> mapping property IDs to property names. We
|
||||
have seen already that the meanings of standard properties in the
|
||||
summary information and the document summary information property sets
|
||||
have been defined by Microsoft. The advantage is that the labels of
|
||||
properties like "Author" or "Title" don't have to be stored in the
|
||||
property set. However, a user can define custom fields in, say, Microsoft
|
||||
Word. For each field the user has to specify a name, a type, and a
|
||||
value.</p>
|
||||
|
||||
<p>The names of the custom-defined fields (i.e. the property names) are
|
||||
stored in the document summary information second section's
|
||||
<strong>dictionary</strong>. The dictionary is a map which associates
|
||||
property IDs with property names.</p>
|
||||
|
||||
<p>The method <code>Section.getPIDString(int)</code> not only returns with
|
||||
the well-known property names of the summary information and document
|
||||
summary information property sets, but with self-defined properties,
|
||||
too. It should also work with self-defined properties in self-defined
|
||||
sections.</p>
|
||||
</section>
|
||||
|
||||
<section><title>Codepage support</title>
|
||||
<fixme author="Rainer Klute">Improve codepage support!</fixme>
|
||||
|
||||
<p>The property with ID 1 holds the number of the codepage which was used
|
||||
to encode the strings in this section. The present HPSF codepage support
|
||||
is still very limited: When reading property value strings, HPSF
|
||||
distinguishes between 16-bit characters and 8-bit characters. 16-bit
|
||||
characters should be Unicode characters and thus be okay. 8-bit
|
||||
characters are interpreted according to the platform's default character
|
||||
set. This is fine as long as the document being read has been written on
|
||||
a platform with the same default character set. However, if you receive a
|
||||
document from another region of the world and want to process it with
|
||||
HPSF you are in trouble - unless the creator used Unicode, of course.</p>
|
||||
</section>
|
||||
|
||||
<section><title>Further Reading</title>
|
||||
<p>There are still some aspects of HSPF left which are not covered by this
|
||||
HOW-TO. You should dig into the Javadoc API documentation to learn
|
||||
further details. Since you've struggled through this document up to this
|
||||
point, you are well prepared.</p>
|
||||
</section>
|
||||
</section>
|
||||
</section>
|
||||
</body>
|
||||
</document>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: xml
|
||||
sgml-omittag:nil
|
||||
sgml-shorttag:nil
|
||||
sgml-namecase-general:nil
|
||||
sgml-general-insert-case:lower
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
sgml-parent-document:nil
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
-->
|
55
src/documentation/content/xdocs/hpsf/index.xml
Normal file
55
src/documentation/content/xdocs/hpsf/index.xml
Normal file
@ -0,0 +1,55 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Copyright (C) 2004 The Apache Software Foundation. All rights reserved. -->
|
||||
<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.1//EN" "../dtd/document-v11.dtd">
|
||||
<!-- $Id$ -->
|
||||
|
||||
<document>
|
||||
<header>
|
||||
<title>HPSF (Horrible Property Set Format)</title>
|
||||
<subtitle>Overview</subtitle>
|
||||
<authors>
|
||||
<person name="Rainer Klute" email="klute@apache.org"/>
|
||||
</authors>
|
||||
</header>
|
||||
<body>
|
||||
<section><title>Overview</title>
|
||||
<p>Microsoft applications like "Word", "Excel" or "Powerpoint" let the user
|
||||
describe his document by properties like "title", "category" and so on. The
|
||||
application itself adds further information: last author, creation date
|
||||
etc. These document properties are stored in so-called <strong>property set
|
||||
streams</strong>. A property set stream is a separate document within a
|
||||
<link href="../poifs/index.html">POI filesystem</link>. We'll call property
|
||||
set streams mostly just "property sets". HPSF is POI's pure-Java
|
||||
implementation to read (and in future to write) property sets.</p>
|
||||
|
||||
<p>The <link href="how-to.html">HPSF HOWTO</link> describes what a Java
|
||||
application should do to read a property set using HPSF and to retrieve the
|
||||
information it needs.</p>
|
||||
|
||||
<p>HPSF supports OLE2 property set streams in general, and is not limited to
|
||||
the special case of document properties in the Microsoft Office files
|
||||
mentioned above. The <link href="internals.html">HPSF description</link>
|
||||
describes the internal structure of property set streams. A separate
|
||||
document explains the internal of <link href="thumbnails.html">thumbnail
|
||||
images</link>.</p>
|
||||
</section>
|
||||
</body>
|
||||
</document>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: xml
|
||||
sgml-omittag:nil
|
||||
sgml-shorttag:nil
|
||||
sgml-namecase-general:nil
|
||||
sgml-general-insert-case:lower
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
sgml-parent-document:nil
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
-->
|
1011
src/documentation/content/xdocs/hpsf/internals.xml
Normal file
1011
src/documentation/content/xdocs/hpsf/internals.xml
Normal file
File diff suppressed because it is too large
Load Diff
183
src/documentation/content/xdocs/hpsf/thumbnails.xml
Normal file
183
src/documentation/content/xdocs/hpsf/thumbnails.xml
Normal file
@ -0,0 +1,183 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Copyright (C) 2004 The Apache Software Foundation. All rights reserved. -->
|
||||
<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.1//EN"
|
||||
"../dtd/document-v11.dtd">
|
||||
<!-- $Id$ -->
|
||||
|
||||
<document>
|
||||
<header>
|
||||
<title>HPSF THUMBNAIL HOW-TO</title>
|
||||
<authors>
|
||||
<person name="Drew Varner" email="Drew.Varner@-deleteThis-sc.edu" />
|
||||
</authors>
|
||||
</header>
|
||||
<body>
|
||||
<section><title>The VT_CF Format</title>
|
||||
|
||||
<p>Thumbnail information is stored as a VT_CF, or Thumbnail Variant. The
|
||||
Thumbnail Variant is used to store various types of information in a
|
||||
clipboard. The VT_CF can store information in formats for the Macintosh or
|
||||
Windows clipboard.</p>
|
||||
|
||||
<p>There are many types of data that can be copied to the clipboard, but the
|
||||
only types of information needed for thumbnail manipulation are the image
|
||||
formats.</p>
|
||||
|
||||
<p>The <code>VT_CF</code> structure looks like this:</p>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th>Element:</th>
|
||||
<td>Clipboard Size</td>
|
||||
<td>Clipboard Format Tag</td>
|
||||
<td>Clipboard Data</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Size:</th>
|
||||
<td>32 bit unsigned integer (DWord)</td>
|
||||
<td>32 bit signed integer (DWord)</td>
|
||||
<td>variable length (byte array)</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p>The Clipboard Size refers to the size (in bytes) of Clipboard Data
|
||||
(variable size) plus the Clipboard Format (four bytes).</p>
|
||||
|
||||
<p>Clipboard Format Tag has four possible values:</p>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th>Value</th>
|
||||
<th>Identifier</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>-1L</code></td>
|
||||
<td><code>CFTAG_WINDOWS</code></td>
|
||||
<td>a built-in Windows© clipboard format value</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>-2L</code></td>
|
||||
<td><code>CFTAG_MACINTOSH</code></td>
|
||||
<td>a Macintosh clipboard format value</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>-3L</code></td>
|
||||
<td><code>CFTAG_FMTID</code></td>
|
||||
<td>a format identifier (FMTID) This is rarely used.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>0L</code></td>
|
||||
<td><code>CFTAG_NODATA</code></td>
|
||||
<td>No data This is rarely used.</td>
|
||||
</tr>
|
||||
</table>
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
<section><title>Windows Clipboard Data</title>
|
||||
|
||||
<p>Windows clipboard data has four image formats for thumbnails:</p>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th>Value</th>
|
||||
<th>Identifier</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>3</td>
|
||||
<td><code>CF_METAFILEPICT</code></td>
|
||||
<td>Windows metafile format - recommended</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>8</td>
|
||||
<td><code>CF_DIB</code></td>
|
||||
<td>Device Independent Bitmap</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>14</td>
|
||||
<td><code>CF_ENHMETAFILE</code></td>
|
||||
<td>Enhanced Windows metafile format</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>2</td>
|
||||
<td><code>CF_BITMAP</code></td>
|
||||
<td>Bitmap - Obsolete - Use <code>CF_DIB</code> instead</td>
|
||||
</tr>
|
||||
</table>
|
||||
</section>
|
||||
|
||||
<section><title>Windows Metafile Format</title>
|
||||
|
||||
<p>The most common format for thumbnails on the Windows platform is the
|
||||
Windows metafile format. The Clipboard places and extra header in front of
|
||||
a the standard Windows Metafile Format data.</p>
|
||||
|
||||
<p>The Clipboard Data byte array looks like this when an image is stored in
|
||||
Windows' Clipboard WMF format.</p>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th>Identifier</th>
|
||||
<td>CF_METAFILEPICT</td>
|
||||
<td>mm</td>
|
||||
<td>width</td>
|
||||
<td>height</td>
|
||||
<td>handle</td>
|
||||
<td>WMF data</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Size</th>
|
||||
<td>32 bit unsigned int</td>
|
||||
<td>16 bit unsigned(?) int</td>
|
||||
<td>16 bit unsigned(?) int</td>
|
||||
<td>16 bit unsigned(?) int</td>
|
||||
<td>16 bit unsigned(?) int</td>
|
||||
<td>byte array - variable length</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Description</th>
|
||||
<td>Clipboard WMF</td>
|
||||
<td>Mapping Mode</td>
|
||||
<td>Image Width</td>
|
||||
<td>Image Height</td>
|
||||
<td>handle to the WMF data array in memory, or 0</td>
|
||||
<td>standard WMF byte stream</td>
|
||||
</tr>
|
||||
</table>
|
||||
</section>
|
||||
|
||||
|
||||
<section><title>Device Independent Bitmap</title>
|
||||
<p><strong>FIXME:</strong> Describe the Device Independent Bitmap
|
||||
format!</p>
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
<section><title>Macintosh Clipboard Data</title>
|
||||
<p><strong>FIXME:</strong> Describe the Macintosh clipboard formats!</p>
|
||||
</section>
|
||||
|
||||
</body>
|
||||
</document>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: xml
|
||||
sgml-omittag:nil
|
||||
sgml-shorttag:nil
|
||||
sgml-namecase-general:nil
|
||||
sgml-general-insert-case:lower
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
sgml-parent-document:nil
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
-->
|
66
src/documentation/content/xdocs/hpsf/todo.xml
Normal file
66
src/documentation/content/xdocs/hpsf/todo.xml
Normal file
@ -0,0 +1,66 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Copyright (C) 2004 The Apache Software Foundation. All rights reserved. -->
|
||||
<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.1//EN" "../dtd/document-v11.dtd">
|
||||
<!-- $Id$ -->
|
||||
|
||||
<document>
|
||||
<header>
|
||||
<title>To Do</title>
|
||||
<authors>
|
||||
<person name="Rainer Klute" email="klute@rainer-klute.de"/>
|
||||
</authors>
|
||||
</header>
|
||||
<body>
|
||||
<section><title>To Do</title>
|
||||
|
||||
<p>The following functionalities should be added to HPFS:</p>
|
||||
|
||||
<ol>
|
||||
<li>
|
||||
Add writing capability for property sets. Presently property sets can
|
||||
be read only.
|
||||
</li>
|
||||
<li>
|
||||
Add codepage support: Presently the bytes making out the string in a
|
||||
property's value are interpreted using the platform's default character
|
||||
set.
|
||||
</li>
|
||||
<li>
|
||||
Add resource bundles to
|
||||
<code>org.apache.poi.hpsf.wellknown</code> to ease
|
||||
localizations. This would be useful for mapping standard property IDs to
|
||||
localized strings. Example: The property ID 4 could be mapped to "Author"
|
||||
in English or "Verfasser" in German.
|
||||
</li>
|
||||
<li>
|
||||
Implement reading functionality for those property types that are not
|
||||
yet supported. HPSF should return proper Java types instead of just byte
|
||||
arrays.
|
||||
</li>
|
||||
<li>
|
||||
Add WMF to <code>java.awt.Image</code> example code in <link
|
||||
href="thumbnails.html">Thumbnail
|
||||
HOW TO</link>.
|
||||
</li>
|
||||
</ol>
|
||||
</section>
|
||||
</body>
|
||||
</document>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: xml
|
||||
sgml-omittag:nil
|
||||
sgml-shorttag:nil
|
||||
sgml-namecase-general:nil
|
||||
sgml-general-insert-case:lower
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
sgml-parent-document:nil
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
-->
|
116
src/documentation/content/xdocs/hssf/alternatives.xml
Normal file
116
src/documentation/content/xdocs/hssf/alternatives.xml
Normal file
@ -0,0 +1,116 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Copyright (C) 2004 The Apache Software Foundation. All rights reserved. -->
|
||||
<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.1//EN" "../dtd/document-v11.dtd">
|
||||
|
||||
<document>
|
||||
<header>
|
||||
<title>HSSF</title>
|
||||
<subtitle>Alternatives to HSSF</subtitle>
|
||||
<authors>
|
||||
<person name="Andrew Oliver" email="acoliver at apache.org"/>
|
||||
<person name="Glen Stampoultzis" email="glens at apache.org"/>
|
||||
</authors>
|
||||
</header>
|
||||
|
||||
<body>
|
||||
<section><title>Alternatives</title>
|
||||
<p>
|
||||
Maybe it's unwise to advertise your competitors but we believe
|
||||
competition is good and we have the best support reading and
|
||||
write Excel workbooks currently available. This however does not
|
||||
purport to be a complete list.
|
||||
</p>
|
||||
<table>
|
||||
<tr>
|
||||
<th>Product</th>
|
||||
<th>URL</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>JSC</td>
|
||||
<td>
|
||||
<link href="http://jsc.tomschuetz.com">jsc.tomschuetz.com</link>
|
||||
</td>
|
||||
<td>Reading, calculating standard and VBA functions with
|
||||
Java at runtime.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Formula One</td>
|
||||
<td>
|
||||
<link href="http://www.tidestone.com/">ReportingEngines (division of Actuate Corporation)</link>
|
||||
</td>
|
||||
<td>An alternative to this project is to
|
||||
buy the $5000 per server installation.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Visual Basic</td>
|
||||
<td>
|
||||
<link href="http://www.microsoft.com/">www.microsoft.com</link>
|
||||
</td>
|
||||
<td>Give up XML and write Visual Basic code on a Microsoft Windows based
|
||||
Environment or output in Microsoft's beta and primarily undocumented
|
||||
XML for office format.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>JExcel</td>
|
||||
<td>http://stareyes.homeip.net:8888</td>
|
||||
<td>Frequently unavailable. Little currently known about it's capabilities.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>JWorkbook</td>
|
||||
<td>http://www.object-refinery.com/jworkbook/index.html</td>
|
||||
<td>This effort supports Gnumeric and Excel, however the Excel part is done using POI anyway.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>xlReader</td>
|
||||
<td><link href="http://www.sourceforge.net/projects/xlrd">http://www.sourceforge.net/projects/xlrd</link></td>
|
||||
<td>Provides decent support for reading Excel.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Excel ODBC Driver</td>
|
||||
<td><link href="http://www.nwlink.com/~leewal/content/exceljavasample.htm">http://www.nwlink.com/~leewal/content/exceljavasample.htm</link></td>
|
||||
<td>ODBC offers a somewhat wierd method for using Excel.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>ExtenXLS</td>
|
||||
<td><link href="http://www.extentech.com/products/ExtenXLS/docs/intro3.jsp">http://www.extentech.com/products/ExtenXLS/docs/intro3.jsp</link></td>
|
||||
<td>Commercial library for reading, modifying and writing Excel spreadsheets. Not cheap but
|
||||
certainly a lot more affordable than Formula 1. No idea as to it's quality.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>J-Integra Java-Excel Bridge</td>
|
||||
<td><link href="http://www.intrinsyc.com/products/bridging/jintegra.asp">http://www.intrinsyc.com/products/bridging/jintegra.asp</link></td>
|
||||
<td>Uses DCOM to an Excel instance on a windows machine.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Perl & C</td>
|
||||
<td>-</td>
|
||||
<td>There are a number of perl and C libraries, however none of them are consistent.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>VistaJDBC</td>
|
||||
<td><link href="http://www.vistaportal.com/products/vistajdbc.htm">http://www.vistaportal.com/products/vistajdbc.htm</link></td>
|
||||
<td>VistaJDBC driver works with both StarOffice and Excel spreadsheets and
|
||||
can access data using standard SQL statements without any API programming.
|
||||
VistaJDBC also implemented ability to choose by not just rows and columns but by
|
||||
specific cells, ranges of cells, etc.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Coldtags Excel Tag Library</td>
|
||||
<td><link href="http://www.servletsuite.com/servlets/exceltag.htm">http://www.servletsuite.com/servlets/exceltag.htm</link></td>
|
||||
<td>
|
||||
This library outputs a simple CSV file, in which cells can
|
||||
contain numbers or text. You could output a CSV file without its
|
||||
help, but it gives a little more readability/structure to the code, and
|
||||
could be extended to handle more complexity. When
|
||||
you invoke one of these JSP pages from your browser, you open up an Excel
|
||||
spreadsheet. There's no formatting, worksheets, or anything fancy like that.
|
||||
So it's not strictly a competitor but it does the job.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</section>
|
||||
</body>
|
||||
</document>
|
30
src/documentation/content/xdocs/hssf/book.xml
Normal file
30
src/documentation/content/xdocs/hssf/book.xml
Normal file
@ -0,0 +1,30 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- Copyright (C) 2004 The Apache Software Foundation. All rights reserved. -->
|
||||
<!DOCTYPE book PUBLIC "-//APACHE//DTD Cocoon Documentation Book V1.0//EN" "../dtd/book-cocoon-v10.dtd">
|
||||
|
||||
<book software="Poi Project"
|
||||
title="HSSF"
|
||||
copyright="@year@ Poi Project">
|
||||
|
||||
<menu label="Navigation">
|
||||
<menu-item label="Main" href="../index.html"/>
|
||||
</menu>
|
||||
|
||||
<menu label="HSSF">
|
||||
<menu-item label="Quick Guide" href="quick-guide.html"/>
|
||||
<menu-item label="HOWTO" href="how-to.html"/>
|
||||
<menu-item label="Formula Support" href="formula.html" />
|
||||
<menu-item label="Use Case" href="use-case.html"/>
|
||||
<menu-item label="Pictorial Docs" href="diagrams.html"/>
|
||||
<menu-item label="Alternatives" href="alternatives.html"/>
|
||||
<menu-item label="Limitations" href="limitations.html"/>
|
||||
</menu>
|
||||
|
||||
<menu label="Contributer's Guide">
|
||||
<menu-item label="Hacking HSSF" href="hacking-hssf.html"/>
|
||||
<menu-item label="Record Generator" href="record-generator.html"/>
|
||||
<menu-item label="Charts" href="chart.html"/>
|
||||
</menu>
|
||||
|
||||
|
||||
</book>
|
1510
src/documentation/content/xdocs/hssf/chart.xml
Normal file
1510
src/documentation/content/xdocs/hssf/chart.xml
Normal file
File diff suppressed because it is too large
Load Diff
23
src/documentation/content/xdocs/hssf/diagram1.xml
Normal file
23
src/documentation/content/xdocs/hssf/diagram1.xml
Normal file
@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Copyright (C) 2004 The Apache Software Foundation. All rights reserved. -->
|
||||
<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.1//EN" "../dtd/document-v11.dtd">
|
||||
|
||||
<document>
|
||||
<header>
|
||||
<title>HSSF</title>
|
||||
<subtitle>Overview</subtitle>
|
||||
<authors>
|
||||
<person name="Andrew C. Oliver" email="acoliver@apache.org"/>
|
||||
<person name="Nicola Ken Barozzi" email="barozzi@nicolaken.com"/>
|
||||
</authors>
|
||||
</header>
|
||||
|
||||
<body>
|
||||
<section>
|
||||
<title>Usermodel Class Diagram by Matthew Young</title>
|
||||
<p>
|
||||
<img src="images/usermodel.gif" alt="Usermodel"/>
|
||||
</p>
|
||||
</section>
|
||||
</body>
|
||||
</document>
|
39
src/documentation/content/xdocs/hssf/diagrams.xml
Normal file
39
src/documentation/content/xdocs/hssf/diagrams.xml
Normal file
@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Copyright (C) 2004 The Apache Software Foundation. All rights reserved. -->
|
||||
<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.1//EN" "../dtd/document-v11.dtd">
|
||||
|
||||
<document>
|
||||
<header>
|
||||
<title>HSSF</title>
|
||||
<subtitle>Overview</subtitle>
|
||||
<authors>
|
||||
<person name="Andrew C. Oliver" email="acoliver@apache.org"/>
|
||||
<person name="Nicola Ken Barozzi" email="barozzi@nicolaken.com"/>
|
||||
</authors>
|
||||
</header>
|
||||
|
||||
<body>
|
||||
<section><title>Overview</title>
|
||||
<p>
|
||||
This section is intended for diagrams (UML/etc) that help
|
||||
explain HSSF.
|
||||
</p>
|
||||
<ul>
|
||||
<li>
|
||||
<link href="diagram1.html">HSSF usermodel class diagram</link> -
|
||||
by Matthew Young (myoung at westernasset dot com)
|
||||
</li>
|
||||
</ul>
|
||||
<p>
|
||||
Have more? Add a new "bug" to the bug database with [DOCUMENTATION]
|
||||
prefacing the description and a link to the file on an http server
|
||||
somewhere. If you don't have your own webserver, then you can email it
|
||||
to (acoliver at apache dot org) provided its < 5MB. Diagrams should be
|
||||
in some format that can be read at least on Linux and Windows. Diagrams
|
||||
that can be edited are preferrable, but lets face it, there aren't too
|
||||
many good affordable UML tools yet! And no they don't HAVE to be UML...
|
||||
just useful.
|
||||
</p>
|
||||
</section>
|
||||
</body>
|
||||
</document>
|
90
src/documentation/content/xdocs/hssf/formula.xml
Normal file
90
src/documentation/content/xdocs/hssf/formula.xml
Normal file
@ -0,0 +1,90 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Copyright (C) 2004 The Apache Software Foundation. All rights reserved. -->
|
||||
<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.1//EN" "../dtd/document-v11.dtd">
|
||||
|
||||
<document>
|
||||
<header>
|
||||
<title>Formula Support</title>
|
||||
<authors>
|
||||
<person email="avik@apache.org" name="Avik Sengupta" id="AS"/>
|
||||
</authors>
|
||||
</header>
|
||||
<body>
|
||||
<section><title>Introduction</title>
|
||||
<p>
|
||||
This document describes the current state of formula support in POI.
|
||||
The information in this document currently applies to the 2.0 version of POI.
|
||||
Since this area is a work in progress, this document will be updated with new features as and
|
||||
when they are added.
|
||||
</p>
|
||||
|
||||
</section>
|
||||
<section><title>The basics</title>
|
||||
<p>
|
||||
In org.apache.poi.hssf.usermodel.HSSFCell
|
||||
<strong> setCellFormula("formulaString") </strong> is used to add a formula to sheet and
|
||||
<strong> getCellFormula() </strong> is used to retrieve the string representation of a formula.
|
||||
</p>
|
||||
<p>
|
||||
We aim to support the complete excel grammer for formulas. Thus, the string that you pass in
|
||||
to the <em> setCellFormula </em> call should be what you expect to type into excel. Also, note
|
||||
that you should NOT add a "=" to the front of the string.
|
||||
</p>
|
||||
</section>
|
||||
<section><title>Supported Features</title>
|
||||
<ul>
|
||||
<li>Cell References</li>
|
||||
<li>String, integer and floating point literals</li>
|
||||
<li>Area references</li>
|
||||
<li>Relative or absolute references</li>
|
||||
<li>Arithmetic and logical operators</li>
|
||||
<li>Sheet or Macro Functions (inlcuding logical functions)</li>
|
||||
<li>Sheet References</li>
|
||||
<li>Formual return values (number or string)</li>
|
||||
</ul>
|
||||
</section>
|
||||
<section><title>Partially supported</title>
|
||||
<ul>
|
||||
<li>Formula tokens in Excel are stored in one of three possible <em> classes </em>:
|
||||
Reference, Value and Array. Based on the location of a token, its class can change
|
||||
in complicated and undocumented ways. While we have support for most cases, we
|
||||
are not sure if we have covered all bases (since there is no documentation for this area.)
|
||||
We would therefore like you to report any
|
||||
occurence of #VALUE! in a cell upon opening a POI generated workbook in excel. (Check that
|
||||
typing the formula into Excel directly gives a valid result.)
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</section>
|
||||
<section><title>Not yet supported</title>
|
||||
<ul>
|
||||
<li>Array formulas</li>
|
||||
<li>Unary Operators</li>
|
||||
<li>3D References</li>
|
||||
<li>Error Values (cells containing #REF's or #VALUE's)</li>
|
||||
<li>Everything else :) </li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<section><title>Internals</title>
|
||||
<p>
|
||||
Formulas in Excel are stored as sequences of tokens in Reverse Polish Notation order. The
|
||||
<link href="http://sc.openoffice.org/excelfileformat.pdf">open office XLS spec</link> is the best
|
||||
documentation you will find for the format.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The tokens used by excel are modelled as individual *Ptg classes in the <strong>
|
||||
org.apache.poi.hssf.record.formula</strong> package.
|
||||
</p>
|
||||
<p>
|
||||
The task of parsing a formula string into an array of RPN ordered tokens is done by the <strong>
|
||||
org.apache.poi.hssf.record.formula.FormulaParser</strong> class. This class implements a hand
|
||||
written recursive descent parser.
|
||||
</p>
|
||||
<p>Check out the <link href="http://jakarta.apache.org/poi/javadocs/">javadocs </link> for details.
|
||||
</p>
|
||||
</section>
|
||||
|
||||
</body>
|
||||
</document>
|
73
src/documentation/content/xdocs/hssf/hacking-hssf.xml
Normal file
73
src/documentation/content/xdocs/hssf/hacking-hssf.xml
Normal file
@ -0,0 +1,73 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Copyright (C) 2004 The Apache Software Foundation. All rights reserved. -->
|
||||
<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.1//EN" "../dtd/document-v11.dtd">
|
||||
|
||||
<document>
|
||||
<header>
|
||||
<title>Hacking HSSF</title>
|
||||
<authors>
|
||||
<person email="glens@apache.org" name="Glen Stampoultzis" id="GJS"/>
|
||||
<person email="acoliver@apache.org" name="Andrew Oliver" id="AO"/>
|
||||
</authors>
|
||||
</header>
|
||||
<body>
|
||||
<section><title>Where Can I Find Documentation on Feature X</title>
|
||||
<p>
|
||||
You might find the
|
||||
'Excel 97 Developer's Kit' (out of print, Microsoft Press, no
|
||||
restrictive covenants, available on Amazon.com) helpful for
|
||||
understanding the file format.
|
||||
</p>
|
||||
<p>
|
||||
Also useful is the <link href="http://sc.openoffice.org/excelfileformat.pdf">open office XLS spec</link>. We
|
||||
are collaborating with the maintainer of the spec so if you think you can add something to their
|
||||
document just send through your changes.
|
||||
</p>
|
||||
</section>
|
||||
<section><title>Help, I Can't Find Feature X Documented Anywhere</title>
|
||||
<ol>
|
||||
<li>
|
||||
Look at OpenOffice.org or Gnumeric sources if its implemented there.
|
||||
</li>
|
||||
<li>
|
||||
Use org.apache.poi.hssf.dev.BiffViewer to view the structure of the
|
||||
file. Experiment by adding one criteria entry at a time. See what it
|
||||
does to the structure, infer behavior and structure from it. Using the
|
||||
unix diff command (or get cygwin from www.cygwin.com for windows) you
|
||||
can figure out a lot very quickly. Unimplemented records show up as
|
||||
'UNKNOWN' and prints a hex dump.
|
||||
</li>
|
||||
</ol>
|
||||
</section>
|
||||
<section><title>Low-level Record Generation</title>
|
||||
<p>
|
||||
Low level records can be time consuming to created. We created a record
|
||||
generator to help generate some of the simpler tasks.
|
||||
</p>
|
||||
<p>
|
||||
We use XML
|
||||
descriptors to generate the Java code (which sure beats the heck out of
|
||||
the PERL scripts originally used ;-) for low level records. The
|
||||
generator is kinda alpha-ish right now and could use some enhancement,
|
||||
so you may find that to be about 1/2 of the work. Notice this is in
|
||||
org.apache.poi.hssf.record.definitions.
|
||||
</p>
|
||||
</section>
|
||||
<section><title>Important Notice</title>
|
||||
<p>One thing to note: If you are making a large code contribution we need to ensure
|
||||
any participants in this process have never
|
||||
signed a "Non Disclosure Agreement" with Microsoft, and have not
|
||||
received any information covered by such an agreement. If they have
|
||||
they'll not be able to participate in the POI project. For large contributions we
|
||||
may ask you to sign an agreement.</p>
|
||||
</section>
|
||||
<section><title>What Can I Work On?</title>
|
||||
<p>Check our <link href="../todo.html">todo list</link> or simply look for missing functionality. Start small
|
||||
and work your way up.</p>
|
||||
</section>
|
||||
<section><title>What Else Should I Know?</title>
|
||||
<p>Make sure you <link href="http://jakarta.apache.org/poi/contrib.html">read the contributing section</link>
|
||||
as it contains more generation information about contributing to Poi in general.</p>
|
||||
</section>
|
||||
</body>
|
||||
</document>
|
493
src/documentation/content/xdocs/hssf/how-to.xml
Normal file
493
src/documentation/content/xdocs/hssf/how-to.xml
Normal file
@ -0,0 +1,493 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Copyright (C) 2004 The Apache Software Foundation. All rights reserved. -->
|
||||
<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.1//EN" "../dtd/document-v11.dtd">
|
||||
|
||||
<document>
|
||||
<header>
|
||||
<title>The New Halloween Document</title>
|
||||
<authors>
|
||||
<person email="acoliver2@users.sourceforge.net" name="Andrew C. Oliver" id="AO"/>
|
||||
<person email="glens@apache.org" name="Glen Stampoultzis" id="GJS"/>
|
||||
<person email="sergeikozello@mail.ru" name="Sergei Kozello" id="SK"/>
|
||||
</authors>
|
||||
</header>
|
||||
<body>
|
||||
<section><title>How to use the HSSF API</title>
|
||||
|
||||
<section><title>Capabilities</title>
|
||||
<p>This release of the how-to outlines functionality for the CVS HEAD.
|
||||
Those looking for information on previous releases should
|
||||
look in the documentation distributed with that release.</p>
|
||||
<p>
|
||||
HSSF allows numeric, string, date or formuala cell values to be written to
|
||||
or read from an XLS file. Also
|
||||
in this release is row and column sizing, cell styling (bold,
|
||||
italics, borders,etc), and support for both built-in and user
|
||||
defined data formats. Also available is
|
||||
an event-based API for reading XLS files.
|
||||
It differs greatly from the read/write API
|
||||
and is intended for intermediate developers who need a smaller
|
||||
memory footprint.
|
||||
</p>
|
||||
</section>
|
||||
<section><title>General Use</title>
|
||||
<section><title>User API</title>
|
||||
<section><title>Writing a new one</title>
|
||||
|
||||
<p>The high level API (package: org.apache.poi.hssf.usermodel)
|
||||
is what most people should use. Usage is very simple.
|
||||
</p>
|
||||
<p>Workbooks are created by creating an instance of
|
||||
org.apache.poi.hssf.usermodel.HSSFWorkbook.
|
||||
</p>
|
||||
<p>Sheets are created by calling createSheet() from an existing
|
||||
instance of HSSFWorkbook, the created sheet is automatically added in
|
||||
sequence to the workbook. Sheets do not in themselves have a sheet
|
||||
name (the tab at the bottom); you set
|
||||
the name associated with a sheet by calling
|
||||
HSSFWorkbook.setSheetName(sheetindex,"SheetName",encoding).
|
||||
The name may be in 8bit format (HSSFWorkbook.ENCODING_COMPRESSED_UNICODE)
|
||||
or Unicode (HSSFWorkbook.ENCODING_UTF_16). Default encoding is 8bit per char.
|
||||
</p>
|
||||
<p>Rows are created by calling createRow(rowNumber) from an existing
|
||||
instance of HSSFSheet. Only rows that have cell values should be
|
||||
added to the sheet. To set the row's height, you just call
|
||||
setRowHeight(height) on the row object. The height must be given in
|
||||
twips, or 1/20th of a point. If you prefer, there is also a
|
||||
setRowHeightInPoints method.
|
||||
</p>
|
||||
<p>Cells are created by calling createCell(column, type) from an
|
||||
existing HSSFRow. Only cells that have values should be added to the
|
||||
row. Cells should have their cell type set to either
|
||||
HSSFCell.CELL_TYPE_NUMERIC or HSSFCell.CELL_TYPE_STRING depending on
|
||||
whether they contain a numeric or textual value. Cells must also have
|
||||
a value set. Set the value by calling setCellValue with either a
|
||||
String or double as a parameter. Individual cells do not have a
|
||||
width; you must call setColumnWidth(colindex, width) (use units of
|
||||
1/256th of a character) on the HSSFSheet object. (You can't do it on
|
||||
an individual basis in the GUI either).</p>
|
||||
<p>Cells are styled with HSSFCellStyle objects which in turn contain
|
||||
a reference to an HSSFFont object. These are created via the
|
||||
HSSFWorkbook object by calling createCellStyle() and createFont().
|
||||
Once you create the object you must set its parameters (colors,
|
||||
borders, etc). To set a font for an HSSFCellStyle call
|
||||
setFont(fontobj).
|
||||
</p>
|
||||
<p>Once you have generated your workbook, you can write it out by
|
||||
calling write(outputStream) from your instance of Workbook, passing
|
||||
it an OutputStream (for instance, a FileOutputStream or
|
||||
ServletOutputStream). You must close the OutputStream yourself. HSSF
|
||||
does not close it for you.
|
||||
</p>
|
||||
<p>Here is some example code (excerpted and adapted from
|
||||
org.apache.poi.hssf.dev.HSSF test class):</p>
|
||||
<source><![CDATA[
|
||||
short rownum;
|
||||
|
||||
// create a new file
|
||||
FileOutputStream out = new FileOutputStream("workbook.xls");
|
||||
// create a new workbook
|
||||
HSSFWorkbook wb = new HSSFWorkbook();
|
||||
// create a new sheet
|
||||
HSSFSheet s = wb.createSheet();
|
||||
// declare a row object reference
|
||||
HSSFRow r = null;
|
||||
// declare a cell object reference
|
||||
HSSFCell c = null;
|
||||
// create 3 cell styles
|
||||
HSSFCellStyle cs = wb.createCellStyle();
|
||||
HSSFCellStyle cs2 = wb.createCellStyle();
|
||||
HSSFCellStyle cs3 = wb.createCellStyle();
|
||||
HSSFDataFormat df = wb.createDataFormat();
|
||||
// create 2 fonts objects
|
||||
HSSFFont f = wb.createFont();
|
||||
HSSFFont f2 = wb.createFont();
|
||||
|
||||
//set font 1 to 12 point type
|
||||
f.setFontHeightInPoints((short) 12);
|
||||
//make it blue
|
||||
f.setColor( (short)0xc );
|
||||
// make it bold
|
||||
//arial is the default font
|
||||
f.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
|
||||
|
||||
//set font 2 to 10 point type
|
||||
f2.setFontHeightInPoints((short) 10);
|
||||
//make it red
|
||||
f2.setColor( (short)HSSFFont.COLOR_RED );
|
||||
//make it bold
|
||||
f2.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
|
||||
|
||||
f2.setStrikeout( true );
|
||||
|
||||
//set cell stlye
|
||||
cs.setFont(f);
|
||||
//set the cell format
|
||||
cs.setDataFormat(df.getFormat("#,##0.0"));
|
||||
|
||||
//set a thin border
|
||||
cs2.setBorderBottom(cs2.BORDER_THIN);
|
||||
//fill w fg fill color
|
||||
cs2.setFillPattern((short) HSSFCellStyle.SOLID_FOREGROUND);
|
||||
//set the cell format to text see HSSFDataFormat for a full list
|
||||
cs2.setDataFormat(HSSFDataFormat.getBuiltinFormat("text"));
|
||||
|
||||
// set the font
|
||||
cs2.setFont(f2);
|
||||
|
||||
// set the sheet name in Unicode
|
||||
wb.setSheetName(0, "\u0422\u0435\u0441\u0442\u043E\u0432\u0430\u044F " +
|
||||
"\u0421\u0442\u0440\u0430\u043D\u0438\u0447\u043A\u0430",
|
||||
HSSFWorkbook.ENCODING_UTF_16 );
|
||||
// in case of compressed Unicode
|
||||
// wb.setSheetName(0, "HSSF Test", HSSFWorkbook.ENCODING_COMPRESSED_UNICODE );
|
||||
// create a sheet with 30 rows (0-29)
|
||||
for (rownum = (short) 0; rownum < 30; rownum++)
|
||||
{
|
||||
// create a row
|
||||
r = s.createRow(rownum);
|
||||
// on every other row
|
||||
if ((rownum % 2) == 0)
|
||||
{
|
||||
// make the row height bigger (in twips - 1/20 of a point)
|
||||
r.setHeight((short) 0x249);
|
||||
}
|
||||
|
||||
//r.setRowNum(( short ) rownum);
|
||||
// create 10 cells (0-9) (the += 2 becomes apparent later
|
||||
for (short cellnum = (short) 0; cellnum < 10; cellnum += 2)
|
||||
{
|
||||
// create a numeric cell
|
||||
c = r.createCell(cellnum);
|
||||
// do some goofy math to demonstrate decimals
|
||||
c.setCellValue(rownum * 10000 + cellnum
|
||||
+ (((double) rownum / 1000)
|
||||
+ ((double) cellnum / 10000)));
|
||||
|
||||
String cellValue;
|
||||
|
||||
// create a string cell (see why += 2 in the
|
||||
c = r.createCell((short) (cellnum + 1));
|
||||
|
||||
// on every other row
|
||||
if ((rownum % 2) == 0)
|
||||
{
|
||||
// set this cell to the first cell style we defined
|
||||
c.setCellStyle(cs);
|
||||
// set the cell's string value to "Test"
|
||||
c.setEncoding( HSSFCell.ENCODING_COMPRESSED_UNICODE );
|
||||
c.setCellValue( "Test" );
|
||||
}
|
||||
else
|
||||
{
|
||||
c.setCellStyle(cs2);
|
||||
// set the cell's string value to "\u0422\u0435\u0441\u0442"
|
||||
c.setEncoding( HSSFCell.ENCODING_UTF_16 );
|
||||
c.setCellValue( "\u0422\u0435\u0441\u0442" );
|
||||
}
|
||||
|
||||
|
||||
// make this column a bit wider
|
||||
s.setColumnWidth((short) (cellnum + 1), (short) ((50 * 8) / ((double) 1 / 20)));
|
||||
}
|
||||
}
|
||||
|
||||
//draw a thick black border on the row at the bottom using BLANKS
|
||||
// advance 2 rows
|
||||
rownum++;
|
||||
rownum++;
|
||||
|
||||
r = s.createRow(rownum);
|
||||
|
||||
// define the third style to be the default
|
||||
// except with a thick black border at the bottom
|
||||
cs3.setBorderBottom(cs3.BORDER_THICK);
|
||||
|
||||
//create 50 cells
|
||||
for (short cellnum = (short) 0; cellnum < 50; cellnum++)
|
||||
{
|
||||
//create a blank type cell (no value)
|
||||
c = r.createCell(cellnum);
|
||||
// set it to the thick black border style
|
||||
c.setCellStyle(cs3);
|
||||
}
|
||||
|
||||
//end draw thick black border
|
||||
|
||||
|
||||
// demonstrate adding/naming and deleting a sheet
|
||||
// create a sheet, set its title then delete it
|
||||
s = wb.createSheet();
|
||||
wb.setSheetName(1, "DeletedSheet");
|
||||
wb.removeSheetAt(1);
|
||||
//end deleted sheet
|
||||
|
||||
// write the workbook to the output stream
|
||||
// close our file (don't blow out our file handles
|
||||
wb.write(out);
|
||||
out.close();
|
||||
]]></source>
|
||||
</section>
|
||||
<section><title>Reading or modifying an existing file</title>
|
||||
|
||||
<p>Reading in a file is equally simple. To read in a file, create a
|
||||
new instance of org.apache.poi.poifs.Filesystem, passing in an open InputStream, such as a FileInputStream
|
||||
for your XLS, to the constructor. Construct a new instance of
|
||||
org.apache.poi.hssf.usermodel.HSSFWorkbook passing the
|
||||
Filesystem instance to the constructor. From there you have access to
|
||||
all of the high level model objects through their assessor methods
|
||||
(workbook.getSheet(sheetNum), sheet.getRow(rownum), etc).
|
||||
</p>
|
||||
<p>Modifying the file you have read in is simple. You retrieve the
|
||||
object via an assessor method, remove it via a parent object's remove
|
||||
method (sheet.removeRow(hssfrow)) and create objects just as you
|
||||
would if creating a new xls. When you are done modifying cells just
|
||||
call workbook.write(outputstream) just as you did above.</p>
|
||||
<p>An example of this can be seen in
|
||||
<link href="http://cvs.apache.org/viewcvs/~checkout~/jakarta-poi/src/java/org/apache/poi/hssf/dev/HSSF.java?rev=1.1">org.apache.poi.hssf.dev.HSSF</link>.</p>
|
||||
</section>
|
||||
</section>
|
||||
<section><title>Event API</title>
|
||||
|
||||
<p>The event API is brand new. It is intended for intermediate
|
||||
developers who are willing to learn a little bit of the low level API
|
||||
structures. Its relatively simple to use, but requires a basic
|
||||
understanding of the parts of an Excel file (or willingness to
|
||||
learn). The advantage provided is that you can read an XLS with a
|
||||
relatively small memory footprint.
|
||||
</p>
|
||||
<p>To use this API you construct an instance of
|
||||
org.apache.poi.hssf.eventmodel.HSSFRequest. Register a class you
|
||||
create that supports the
|
||||
org.apache.poi.hssf.eventmodel.HSSFListener interface using the
|
||||
HSSFRequest.addListener(yourlistener, recordsid). The recordsid
|
||||
should be a static reference number (such as BOFRecord.sid) contained
|
||||
in the classes in org.apache.poi.hssf.record. The trick is you
|
||||
have to know what these records are. Alternatively you can call
|
||||
HSSFRequest.addListenerForAllRecords(mylistener). In order to learn
|
||||
about these records you can either read all of the javadoc in the
|
||||
org.apache.poi.hssf.record package or you can just hack up a
|
||||
copy of org.apache.poi.hssf.dev.EFHSSF and adapt it to your
|
||||
needs. TODO: better documentation on records.</p>
|
||||
<p>Once you've registered your listeners in the HSSFRequest object
|
||||
you can construct an instance of
|
||||
org.apache.poi.poifs.filesystem.FileSystem (see POIFS howto) and
|
||||
pass it your XLS file inputstream. You can either pass this, along
|
||||
with the request you constructed, to an instance of HSSFEventFactory
|
||||
via the HSSFEventFactory.processWorkbookEvents(request, Filesystem)
|
||||
method, or you can get an instance of DocumentInputStream from
|
||||
Filesystem.createDocumentInputStream("Workbook") and pass
|
||||
it to HSSFEventFactory.processEvents(request, inputStream). Once you
|
||||
make this call, the listeners that you constructed receive calls to
|
||||
their processRecord(Record) methods with each Record they are
|
||||
registered to listen for until the file has been completely read.
|
||||
</p>
|
||||
<p>A code excerpt from org.apache.poi.hssf.dev.EFHSSF (which is
|
||||
in CVS or the source distribution) is reprinted below with excessive
|
||||
comments:</p>
|
||||
<source><![CDATA[
|
||||
/**
|
||||
* This example shows how to use the event API for reading a file.
|
||||
*/
|
||||
public class EventExample
|
||||
implements HSSFListener
|
||||
{
|
||||
private SSTRecord sstrec;
|
||||
|
||||
/**
|
||||
* This method listens for incoming records and handles them as required.
|
||||
* @param record The record that was found while reading.
|
||||
*/
|
||||
public void processRecord(Record record)
|
||||
{
|
||||
switch (record.getSid())
|
||||
{
|
||||
// the BOFRecord can represent either the beginning of a sheet or the workbook
|
||||
case BOFRecord.sid:
|
||||
BOFRecord bof = (BOFRecord) record;
|
||||
if (bof.getType() == bof.TYPE_WORKBOOK)
|
||||
{
|
||||
System.out.println("Encountered workbook");
|
||||
// assigned to the class level member
|
||||
} else if (bof.getType() == bof.TYPE_WORKSHEET)
|
||||
{
|
||||
System.out.println("Encountered sheet reference");
|
||||
}
|
||||
break;
|
||||
case BoundSheetRecord.sid:
|
||||
BoundSheetRecord bsr = (BoundSheetRecord) record;
|
||||
System.out.println("New sheet named: " + bsr.getSheetname());
|
||||
break;
|
||||
case RowRecord.sid:
|
||||
RowRecord rowrec = (RowRecord) record;
|
||||
System.out.println("Row found, first column at "
|
||||
+ rowrec.getFirstCol() + " last column at " + rowrec.getLastCol());
|
||||
break;
|
||||
case NumberRecord.sid:
|
||||
NumberRecord numrec = (NumberRecord) record;
|
||||
System.out.println("Cell found with value " + numrec.getValue()
|
||||
+ " at row " + numrec.getRow() + " and column " + numrec.getColumn());
|
||||
break;
|
||||
// SSTRecords store a array of unique strings used in Excel.
|
||||
case SSTRecord.sid:
|
||||
sstrec = (SSTRecord) record;
|
||||
for (int k = 0; k < sstrec.getNumUniqueStrings(); k++)
|
||||
{
|
||||
System.out.println("String table value " + k + " = " + sstrec.getString(k));
|
||||
}
|
||||
break;
|
||||
case LabelSSTRecord.sid:
|
||||
LabelSSTRecord lrec = (LabelSSTRecord) record;
|
||||
System.out.println("String cell found with value "
|
||||
+ sstrec.getString(lrec.getSSTIndex()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Read an excel file and spit out what we find.
|
||||
*
|
||||
* @param args Expect one argument that is the file to read.
|
||||
* @throws IOException When there is an error processing the file.
|
||||
*/
|
||||
public static void main(String[] args) throws IOException
|
||||
{
|
||||
// create a new file input stream with the input file specified
|
||||
// at the command line
|
||||
FileInputStream fin = new FileInputStream(args[0]);
|
||||
// create a new org.apache.poi.poifs.filesystem.Filesystem
|
||||
POIFSFileSystem poifs = new POIFSFileSystem(fin);
|
||||
// get the Workbook (excel part) stream in a InputStream
|
||||
InputStream din = poifs.createDocumentInputStream("Workbook");
|
||||
// construct out HSSFRequest object
|
||||
HSSFRequest req = new HSSFRequest();
|
||||
// lazy listen for ALL records with the listener shown above
|
||||
req.addListenerForAllRecords(new EventExample());
|
||||
// create our event factory
|
||||
HSSFEventFactory factory = new HSSFEventFactory();
|
||||
// process our events based on the document input stream
|
||||
factory.processEvents(req, din);
|
||||
// once all the events are processed close our file input stream
|
||||
fin.close();
|
||||
// and our document input stream (don't want to leak these!)
|
||||
din.close();
|
||||
System.out.println("done.");
|
||||
}
|
||||
}
|
||||
]]></source>
|
||||
</section>
|
||||
<section><title>Low Level APIs</title>
|
||||
|
||||
<p>The low level API is not much to look at. It consists of lots of
|
||||
"Records" in the org.apache.poi.hssf.record.* package,
|
||||
and set of helper classes in org.apache.poi.hssf.model.*. The
|
||||
record classes are consistent with the low level binary structures
|
||||
inside a BIFF8 file (which is embedded in a POIFS file system). You
|
||||
probably need the book: "Microsoft Excel 97 Developer's Kit"
|
||||
from Microsoft Press in order to understand how these fit together
|
||||
(out of print but easily obtainable from Amazon's used books). In
|
||||
order to gain a good understanding of how to use the low level APIs
|
||||
should view the source in org.apache.poi.hssf.usermodel.* and
|
||||
the classes in org.apache.poi.hssf.model.*. You should read the
|
||||
documentation for the POIFS libraries as well.</p>
|
||||
</section>
|
||||
<section><title>HSSF Class/Test Application</title>
|
||||
|
||||
<p>The HSSF application is nothing more than a test for the high
|
||||
level API (and indirectly the low level support). The main body of
|
||||
its code is repeated above. To run it:
|
||||
</p>
|
||||
<ul>
|
||||
<li>download the poi-alpha build and untar it (tar xvzf
|
||||
tarball.tar.gz)
|
||||
</li>
|
||||
<li>set up your classpath as follows:
|
||||
<code>export HSSFDIR={wherever you put HSSF's jar files}
|
||||
export LOG4JDIR={wherever you put LOG4J's jar files}
|
||||
export CLASSPATH=$CLASSPATH:$HSSFDIR/hssf.jar:$HSSFDIR/poi-poifs.jar:$HSSFDIR/poi-util.jar:$LOG4JDIR/jog4j.jar</code>
|
||||
</li><li>type:
|
||||
<code>java org.apache.poi.hssf.dev.HSSF ~/myxls.xls write</code></li>
|
||||
</ul>
|
||||
<p></p>
|
||||
<p>This should generate a test sheet in your home directory called <code>"myxls.xls"</code>. </p>
|
||||
<ul>
|
||||
<li>Type:
|
||||
<code>java org.apache.poi.hssf.dev.HSSF ~/input.xls output.xls</code>
|
||||
<br/>
|
||||
<br/>
|
||||
This is the read/write/modify test. It reads in the spreadsheet, modifies a cell, and writes it back out.
|
||||
Failing this test is not necessarily a bad thing. If HSSF tries to modify a non-existant sheet then this will
|
||||
most likely fail. No big deal. </li>
|
||||
</ul>
|
||||
</section>
|
||||
<section><title>Logging facility</title>
|
||||
<p>Poi can dynamically select it's logging implementation. Poi trys to
|
||||
create a logger using the System property named "org.apache.poi.util.POILogger".
|
||||
Out of the box this can be set to one of three values:
|
||||
</p>
|
||||
<ul>
|
||||
<li>org.apache.poi.util.CommonsLogger</li>
|
||||
<li>org.apache.poi.util.NullLogger</li>
|
||||
<li>org.apache.poi.util.SystemOutLogger</li>
|
||||
</ul>
|
||||
<p>
|
||||
If the property is not defined or points to an invalid classthen the NullLogger is used.
|
||||
</p>
|
||||
<p>
|
||||
Refer to the commons logging package level javadoc for more information concerning how to
|
||||
<link href="http://jakarta.apache.org/commons/logging/api/index.html">configure commons logging.</link>
|
||||
</p>
|
||||
</section>
|
||||
<section><title>HSSF Developer's Tools</title>
|
||||
|
||||
<p>HSSF has a number of tools useful for developers to debug/develop
|
||||
stuff using HSSF (and more generally XLS files). We've already
|
||||
discussed the app for testing HSSF read/write/modify capabilities;
|
||||
now we'll talk a bit about BiffViewer. Early on in the development of
|
||||
HSSF, it was decided that knowing what was in a record, what was
|
||||
wrong with it, etc. was virtually impossible with the available
|
||||
tools. So we developed BiffViewer. You can find it at
|
||||
org.apache.poi.hssf.dev.BiffViewer. It performs two basic
|
||||
functions and a derivative.
|
||||
</p>
|
||||
<p>The first is "biffview". To do this you run it (assumes
|
||||
you have everything setup in your classpath and that you know what
|
||||
you're doing enough to be thinking about this) with an xls file as a
|
||||
parameter. It will give you a listing of all understood records with
|
||||
their data and a list of not-yet-understood records with no data
|
||||
(because it doesn't know how to interpret them). This listing is
|
||||
useful for several things. First, you can look at the values and SEE
|
||||
what is wrong in quasi-English. Second, you can send the output to a
|
||||
file and compare it.
|
||||
</p>
|
||||
<p>The second function is "big freakin dump", just pass a
|
||||
file and a second argument matching "bfd" exactly. This
|
||||
will just make a big hexdump of the file.
|
||||
</p>
|
||||
<p>Lastly, there is "mixed" mode which does the same as
|
||||
regular biffview, only it includes hex dumps of certain records
|
||||
intertwined. To use that just pass a file with a second argument
|
||||
matching "on" exactly.</p>
|
||||
<p>In the next release cycle we'll also have something called a
|
||||
FormulaViewer. The class is already there, but its not very useful
|
||||
yet. When it does something, we'll document it.</p>
|
||||
|
||||
</section>
|
||||
<section><title>What's Next?</title>
|
||||
|
||||
<p>Further effort on HSSF is going to focus on the following major areas: </p>
|
||||
<ul>
|
||||
<li>Performance: A lot of work is going on in CVS and mailing lists for greatly improving the
|
||||
memory efficiency of POI, as well as improving speed. Many approaches have been suggested, and a lot of code as been written.
|
||||
It now needs a lot of testing and bugfixing. </li>
|
||||
<li>Charts: This is a hard problem, with very little documentation.</li>
|
||||
</ul>
|
||||
<p><link href="../getinvolved/index.html"> So jump in! </link> </p>
|
||||
|
||||
</section>
|
||||
|
||||
</section>
|
||||
|
||||
</section>
|
||||
</body>
|
||||
</document>
|
43
src/documentation/content/xdocs/hssf/index.xml
Normal file
43
src/documentation/content/xdocs/hssf/index.xml
Normal file
@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Copyright (C) 2004 The Apache Software Foundation. All rights reserved. -->
|
||||
<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.1//EN" "../dtd/document-v11.dtd">
|
||||
|
||||
<document>
|
||||
<header>
|
||||
<title>HSSF</title>
|
||||
<subtitle>Overview</subtitle>
|
||||
<authors>
|
||||
<person name="Andrew C. Oliver" email="acoliver@apache.org"/>
|
||||
<person name="Nicola Ken Barozzi" email="barozzi@nicolaken.com"/>
|
||||
</authors>
|
||||
</header>
|
||||
|
||||
<body>
|
||||
<section><title>Overview</title>
|
||||
|
||||
<p>HSSF is the POI Project's pure Java implementation of the Excel '97(-2002) file format.</p>
|
||||
<p>HSSF provides a way to read spreadsheets create, modify, read and write XLS spreadsheets
|
||||
It provides:
|
||||
</p>
|
||||
<ul>
|
||||
<li>low level structures for those with special needs</li>
|
||||
<li>an eventmodel api for efficient read-only access</li>
|
||||
<li>a full usermodel api for creating, reading and modifying XLS files</li>
|
||||
</ul>
|
||||
<p>
|
||||
An alternate way of generating a spreadsheet is via the <link href="http://cocoon.apache.org">Cocoon</link> serializer (yet you'll still be using HSSF indirectly).
|
||||
With Cocoon you can serialize any XML datasource (which might be a ESQL page outputting in SQL for instance) by simply
|
||||
applying the stylesheet and designating the serializer.
|
||||
</p>
|
||||
<p>
|
||||
If you're merely reading spreadsheet data, then use the eventmodel api
|
||||
in the org.apache.poi.hssf.eventusermodel package.
|
||||
</p>
|
||||
<p>
|
||||
If you're modifying spreadsheet data then use the usermodel api. You
|
||||
can also generate spreadsheets this way.
|
||||
</p>
|
||||
|
||||
</section>
|
||||
</body>
|
||||
</document>
|
54
src/documentation/content/xdocs/hssf/limitations.xml
Normal file
54
src/documentation/content/xdocs/hssf/limitations.xml
Normal file
@ -0,0 +1,54 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Copyright (C) 2004 The Apache Software Foundation. All rights reserved. -->
|
||||
<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.1//EN" "../dtd/document-v11.dtd">
|
||||
|
||||
<document>
|
||||
<header>
|
||||
<title>Limitations</title>
|
||||
<authors>
|
||||
<person email="glens@apache.org" name="Glen Stampoultzis" id="GJS"/>
|
||||
</authors>
|
||||
</header>
|
||||
<body>
|
||||
<section><title>Version 2.0 limitations</title>
|
||||
<p>
|
||||
The intent of this document is to outline some of the known limitations of the
|
||||
POI HSSF API's. It is not intended to be complete list of every bug or missing
|
||||
feature of HSSF, rather it's purpose is to provide a broad feel for some of the
|
||||
functionality that is missing or broken.
|
||||
</p>
|
||||
<ul>
|
||||
<li>
|
||||
Charts<br/><br/>
|
||||
You can not currently create charts. You can
|
||||
however create a chart in Excel, modify the chart data values using HSSF and write
|
||||
a new spreadsheet out. This is possible because POI attempts to keep existing records
|
||||
intact as far as possible.<br/><br/>
|
||||
</li>
|
||||
<li>
|
||||
Rich Text<br/><br/>
|
||||
HSSF does not support rich text cells. Rich text cells are
|
||||
cells that have multiple fonts and styles in the once cell. Any attempt to read
|
||||
a spreadsheet that has rich text cells will throw an exception. This feature may
|
||||
be supported in the future but it is not currently planned. Patches are welcome.<br/><br/>
|
||||
</li>
|
||||
<li>
|
||||
Outlines<br/><br/>
|
||||
It is not yet possible to create outlines. Reading a spreadsheet with outlines
|
||||
may work correctly but has not been tested. Write support for outlines may
|
||||
be added in the future but it is not currently planned. Patches are welcome.<br/><br/>
|
||||
</li>
|
||||
<li>
|
||||
Macros<br/><br/>
|
||||
Macros can not be created. However, reading and re-writing files containing macros will
|
||||
safely preserve the macros.<br/><br/>
|
||||
</li>
|
||||
<li>
|
||||
Pivot Tables<br/><br/>
|
||||
Generating pivot tables is not supported. It has been reported that files containing pivot
|
||||
tables can be read and re-written safely.
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
</body>
|
||||
</document>
|
945
src/documentation/content/xdocs/hssf/quick-guide.xml
Normal file
945
src/documentation/content/xdocs/hssf/quick-guide.xml
Normal file
@ -0,0 +1,945 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Copyright (C) 2004 The Apache Software Foundation. All rights reserved. -->
|
||||
<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.1//EN" "document-v11.dtd">
|
||||
|
||||
<document>
|
||||
<header>
|
||||
<title>Busy Developers' Guide to HSSF Features</title>
|
||||
<authors>
|
||||
<person email="glens@apache.org" name="Glen Stampoultzis" id="GS"/>
|
||||
</authors>
|
||||
</header>
|
||||
<body>
|
||||
<section><title>Busy Developers' Guide to Features</title>
|
||||
<p>
|
||||
Want to use HSSF read and write spreadsheets in a hurry? This guide is for you. If you're after
|
||||
more in-depth coverage of the HSSF user-API please consult the <link href="how-to.html">HOWTO</link>
|
||||
guide as it contains actual descriptions of how to use this stuff.
|
||||
</p>
|
||||
<section><title>Index of Features</title>
|
||||
<ul>
|
||||
<li><link href="#NewWorkbook">How to create a new workbook</link></li>
|
||||
<li><link href="#NewSheet">How to create a sheet</link></li>
|
||||
<li><link href="#CreateCells">How to create cells</link></li>
|
||||
<li><link href="#CreateDateCells">How to create date cells</link></li>
|
||||
<li><link href="#CellTypes">Working with different types of cells</link></li>
|
||||
<li><link href="#Alignment">Aligning cells</link></li>
|
||||
<li><link href="#Borders">Working with borders</link></li>
|
||||
<li><link href="#FrillsAndFills">Fills and color</link></li>
|
||||
<li><link href="#MergedCells">Merging cells</link></li>
|
||||
<li><link href="#WorkingWithFonts">Working with fonts</link></li>
|
||||
<li><link href="#CustomColors">Custom colors</link></li>
|
||||
<li><link href="#ReadWriteWorkbook">Reading and writing</link></li>
|
||||
<li><link href="#NewLinesInCells">Use newlines in cells.</link></li>
|
||||
<li><link href="#DataFormats">Create user defined data formats.</link></li>
|
||||
<li><link href="#FitTo">Fit Sheet to One Page</link></li>
|
||||
<li><link href="#PrintArea2">Set print area for a sheet.</link></li>
|
||||
<li><link href="#FooterPageNumbers">Set page numbers on the footer of a sheet.</link></li>
|
||||
<li><link href="#ShiftRows">Shift rows.</link></li>
|
||||
<li><link href="#SelectSheet">Set a sheet as selected.</link></li>
|
||||
<li><link href="#Zoom">Set the zoom magnification for a sheet.</link></li>
|
||||
<li><link href="#Splits">Create split and freeze panes.</link></li>
|
||||
<li><link href="#Repeating">Repeating rows and columns.</link></li>
|
||||
<li><link href="#HeaderFooter">Headers and Footers.</link></li>
|
||||
<li><link href="#DrawingShapes">Drawing Shapes.</link></li>
|
||||
<li><link href="#StylingShapes">Styling Shapes.</link></li>
|
||||
<li><link href="#Graphics2d">Shapes and Graphics2d.</link></li>
|
||||
<li><link href="#Outlining">Outlining.</link></li>
|
||||
</ul>
|
||||
</section>
|
||||
<section><title>Features</title>
|
||||
<anchor id="NewWorkbook"/>
|
||||
<section><title>New Workbook</title>
|
||||
<source>
|
||||
HSSFWorkbook wb = new HSSFWorkbook();
|
||||
FileOutputStream fileOut = new FileOutputStream("workbook.xls");
|
||||
wb.write(fileOut);
|
||||
fileOut.close();
|
||||
</source>
|
||||
</section>
|
||||
<anchor id="NewSheet"/>
|
||||
<section><title>New Sheet</title>
|
||||
<source>
|
||||
HSSFWorkbook wb = new HSSFWorkbook();
|
||||
HSSFSheet sheet1 = wb.createSheet("new sheet");
|
||||
HSSFSheet sheet2 = wb.createSheet("second sheet");
|
||||
FileOutputStream fileOut = new FileOutputStream("workbook.xls");
|
||||
wb.write(fileOut);
|
||||
fileOut.close();
|
||||
</source>
|
||||
</section>
|
||||
<anchor id="CreateCells"/>
|
||||
<section><title>Creating Cells</title>
|
||||
<source>
|
||||
HSSFWorkbook wb = new HSSFWorkbook();
|
||||
HSSFSheet sheet = wb.createSheet("new sheet");
|
||||
|
||||
// Create a row and put some cells in it. Rows are 0 based.
|
||||
HSSFRow row = sheet.createRow((short)0);
|
||||
// Create a cell and put a value in it.
|
||||
HSSFCell cell = row.createCell((short)0);
|
||||
cell.setCellValue(1);
|
||||
|
||||
// Or do it on one line.
|
||||
row.createCell((short)1).setCellValue(1.2);
|
||||
row.createCell((short)2).setCellValue("This is a string");
|
||||
row.createCell((short)3).setCellValue(true);
|
||||
|
||||
// Write the output to a file
|
||||
FileOutputStream fileOut = new FileOutputStream("workbook.xls");
|
||||
wb.write(fileOut);
|
||||
fileOut.close();
|
||||
</source>
|
||||
</section>
|
||||
<anchor id="CreateDateCells"/>
|
||||
<section><title>Creating Date Cells</title>
|
||||
<source>
|
||||
HSSFWorkbook wb = new HSSFWorkbook();
|
||||
HSSFSheet sheet = wb.createSheet("new sheet");
|
||||
|
||||
// Create a row and put some cells in it. Rows are 0 based.
|
||||
HSSFRow row = sheet.createRow((short)0);
|
||||
|
||||
// Create a cell and put a date value in it. The first cell is not styled
|
||||
// as a date.
|
||||
HSSFCell cell = row.createCell((short)0);
|
||||
cell.setCellValue(new Date());
|
||||
|
||||
// we style the second cell as a date (and time). It is important to
|
||||
// create a new cell style from the workbook otherwise you can end up
|
||||
// modifying the built in style and effecting not only this cell but other cells.
|
||||
HSSFCellStyle cellStyle = wb.createCellStyle();
|
||||
cellStyle.setDataFormat(HSSFDataFormat.getBuiltinFormat("m/d/yy h:mm"));
|
||||
cell = row.createCell((short)1);
|
||||
cell.setCellValue(new Date());
|
||||
cell.setCellStyle(cellStyle);
|
||||
|
||||
// Write the output to a file
|
||||
FileOutputStream fileOut = new FileOutputStream("workbook.xls");
|
||||
wb.write(fileOut);
|
||||
fileOut.close();
|
||||
</source>
|
||||
</section>
|
||||
<anchor id="CellTypes"/>
|
||||
<section><title>Working with different types of cells</title>
|
||||
<source>
|
||||
HSSFWorkbook wb = new HSSFWorkbook();
|
||||
HSSFSheet sheet = wb.createSheet("new sheet");
|
||||
HSSFRow row = sheet.createRow((short)2);
|
||||
row.createCell((short) 0).setCellValue(1.1);
|
||||
row.createCell((short) 1).setCellValue(new Date());
|
||||
row.createCell((short) 2).setCellValue("a string");
|
||||
row.createCell((short) 3).setCellValue(true);
|
||||
row.createCell((short) 4).setCellType(HSSFCell.CELL_TYPE_ERROR);
|
||||
|
||||
// Write the output to a file
|
||||
FileOutputStream fileOut = new FileOutputStream("workbook.xls");
|
||||
wb.write(fileOut);
|
||||
fileOut.close();
|
||||
</source>
|
||||
</section>
|
||||
<anchor id="Alignment"/>
|
||||
<section><title>Demonstrates various alignment options</title>
|
||||
<source>
|
||||
public static void main(String[] args)
|
||||
throws IOException
|
||||
{
|
||||
HSSFWorkbook wb = new HSSFWorkbook();
|
||||
HSSFSheet sheet = wb.createSheet("new sheet");
|
||||
HSSFRow row = sheet.createRow((short) 2);
|
||||
createCell(wb, row, (short) 0, HSSFCellStyle.ALIGN_CENTER);
|
||||
createCell(wb, row, (short) 1, HSSFCellStyle.ALIGN_CENTER_SELECTION);
|
||||
createCell(wb, row, (short) 2, HSSFCellStyle.ALIGN_FILL);
|
||||
createCell(wb, row, (short) 3, HSSFCellStyle.ALIGN_GENERAL);
|
||||
createCell(wb, row, (short) 4, HSSFCellStyle.ALIGN_JUSTIFY);
|
||||
createCell(wb, row, (short) 5, HSSFCellStyle.ALIGN_LEFT);
|
||||
createCell(wb, row, (short) 6, HSSFCellStyle.ALIGN_RIGHT);
|
||||
|
||||
// Write the output to a file
|
||||
FileOutputStream fileOut = new FileOutputStream("workbook.xls");
|
||||
wb.write(fileOut);
|
||||
fileOut.close();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a cell and aligns it a certain way.
|
||||
*
|
||||
* @param wb the workbook
|
||||
* @param row the row to create the cell in
|
||||
* @param column the column number to create the cell in
|
||||
* @param align the alignment for the cell.
|
||||
*/
|
||||
private static void createCell(HSSFWorkbook wb, HSSFRow row, short column, short align)
|
||||
{
|
||||
HSSFCell cell = row.createCell(column);
|
||||
cell.setCellValue("Align It");
|
||||
HSSFCellStyle cellStyle = wb.createCellStyle();
|
||||
cellStyle.setAlignment(align);
|
||||
cell.setCellStyle(cellStyle);
|
||||
}
|
||||
</source>
|
||||
</section>
|
||||
<anchor id="Borders"/>
|
||||
<section><title>Working with borders</title>
|
||||
<source>
|
||||
HSSFWorkbook wb = new HSSFWorkbook();
|
||||
HSSFSheet sheet = wb.createSheet("new sheet");
|
||||
|
||||
// Create a row and put some cells in it. Rows are 0 based.
|
||||
HSSFRow row = sheet.createRow((short) 1);
|
||||
|
||||
// Create a cell and put a value in it.
|
||||
HSSFCell cell = row.createCell((short) 1);
|
||||
cell.setCellValue(4);
|
||||
|
||||
// Style the cell with borders all around.
|
||||
HSSFCellStyle style = wb.createCellStyle();
|
||||
style.setBorderBottom(HSSFCellStyle.BORDER_THIN);
|
||||
style.setBottomBorderColor(HSSFColor.BLACK.index);
|
||||
style.setBorderLeft(HSSFCellStyle.BORDER_THIN);
|
||||
style.setLeftBorderColor(HSSFColor.GREEN.index);
|
||||
style.setBorderRight(HSSFCellStyle.BORDER_THIN);
|
||||
style.setRightBorderColor(HSSFColor.BLUE.index);
|
||||
style.setBorderTop(HSSFCellStyle.BORDER_MEDIUM_DASHED);
|
||||
style.setTopBorderColor(HSSFColor.BLACK.index);
|
||||
cell.setCellStyle(style);
|
||||
|
||||
// Write the output to a file
|
||||
FileOutputStream fileOut = new FileOutputStream("workbook.xls");
|
||||
wb.write(fileOut);
|
||||
fileOut.close();
|
||||
</source>
|
||||
</section>
|
||||
<anchor id="FillsAndFrills"/>
|
||||
<section><title>Fills and colors</title>
|
||||
<source>
|
||||
HSSFWorkbook wb = new HSSFWorkbook();
|
||||
HSSFSheet sheet = wb.createSheet("new sheet");
|
||||
|
||||
// Create a row and put some cells in it. Rows are 0 based.
|
||||
HSSFRow row = sheet.createRow((short) 1);
|
||||
|
||||
// Aqua background
|
||||
HSSFCellStyle style = wb.createCellStyle();
|
||||
style.setFillBackgroundColor(HSSFColor.AQUA.index);
|
||||
style.setFillPattern(HSSFCellStyle.BIG_SPOTS);
|
||||
HSSFCell cell = row.createCell((short) 1);
|
||||
cell.setCellValue("X");
|
||||
cell.setCellStyle(style);
|
||||
|
||||
// Orange "foreground", foreground being the fill foreground not the font color.
|
||||
style = wb.createCellStyle();
|
||||
style.setFillForegroundColor(HSSFColor.ORANGE.index);
|
||||
style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
|
||||
cell = row.createCell((short) 2);
|
||||
cell.setCellValue("X");
|
||||
cell.setCellStyle(style);
|
||||
|
||||
// Write the output to a file
|
||||
FileOutputStream fileOut = new FileOutputStream("workbook.xls");
|
||||
wb.write(fileOut);
|
||||
fileOut.close();
|
||||
</source>
|
||||
</section>
|
||||
<anchor id="MergedCells"/>
|
||||
<section><title>Merging cells</title>
|
||||
<source>
|
||||
HSSFWorkbook wb = new HSSFWorkbook();
|
||||
HSSFSheet sheet = wb.createSheet("new sheet");
|
||||
|
||||
HSSFRow row = sheet.createRow((short) 1);
|
||||
HSSFCell cell = row.createCell((short) 1);
|
||||
cell.setCellValue("This is a test of merging");
|
||||
|
||||
sheet.addMergedRegion(new Region(1,(short)1,1,(short)2));
|
||||
|
||||
// Write the output to a file
|
||||
FileOutputStream fileOut = new FileOutputStream("workbook.xls");
|
||||
wb.write(fileOut);
|
||||
fileOut.close();
|
||||
</source>
|
||||
</section>
|
||||
<anchor id="WorkingWithFonts"/>
|
||||
<section><title>Working with fonts</title>
|
||||
<source>
|
||||
HSSFWorkbook wb = new HSSFWorkbook();
|
||||
HSSFSheet sheet = wb.createSheet("new sheet");
|
||||
|
||||
// Create a row and put some cells in it. Rows are 0 based.
|
||||
HSSFRow row = sheet.createRow((short) 1);
|
||||
|
||||
// Create a new font and alter it.
|
||||
HSSFFont font = wb.createFont();
|
||||
font.setFontHeightInPoints((short)24);
|
||||
font.setFontName("Courier New");
|
||||
font.setItalic(true);
|
||||
font.setStrikeout(true);
|
||||
|
||||
// Fonts are set into a style so create a new one to use.
|
||||
HSSFCellStyle style = wb.createCellStyle();
|
||||
style.setFont(font);
|
||||
|
||||
// Create a cell and put a value in it.
|
||||
HSSFCell cell = row.createCell((short) 1);
|
||||
cell.setCellValue("This is a test of fonts");
|
||||
cell.setCellStyle(style);
|
||||
|
||||
// Write the output to a file
|
||||
FileOutputStream fileOut = new FileOutputStream("workbook.xls");
|
||||
wb.write(fileOut);
|
||||
fileOut.close();
|
||||
</source>
|
||||
</section>
|
||||
<anchor id="CustomColors"/>
|
||||
<section><title>Custom colors</title>
|
||||
<source>
|
||||
HSSFWorkbook wb = new HSSFWorkbook();
|
||||
HSSFSheet sheet = wb.createSheet();
|
||||
HSSFRow row = sheet.createRow((short) 0);
|
||||
HSSFCell cell = row.createCell((short) 0);
|
||||
cell.setCellValue("Default Palette");
|
||||
|
||||
//apply some colors from the standard palette,
|
||||
// as in the previous examples.
|
||||
//we'll use red text on a lime background
|
||||
|
||||
HSSFCellStyle style = wb.createCellStyle();
|
||||
style.setFillForegroundColor(HSSFColor.LIME.index);
|
||||
style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
|
||||
|
||||
HSSFFont font = wb.createFont();
|
||||
font.setColor(HSSFColor.RED.index);
|
||||
style.setFont(font);
|
||||
|
||||
cell.setCellStyle(style);
|
||||
|
||||
//save with the default palette
|
||||
FileOutputStream out = new FileOutputStream("default_palette.xls");
|
||||
wb.write(out);
|
||||
out.close();
|
||||
|
||||
//now, let's replace RED and LIME in the palette
|
||||
// with a more attractive combination
|
||||
// (lovingly borrowed from freebsd.org)
|
||||
|
||||
cell.setCellValue("Modified Palette");
|
||||
|
||||
//creating a custom palette for the workbook
|
||||
HSSFPalette palette = wb.getCustomPalette();
|
||||
|
||||
//replacing the standard red with freebsd.org red
|
||||
palette.setColorAtIndex(HSSFColor.RED.index,
|
||||
(byte) 153, //RGB red (0-255)
|
||||
(byte) 0, //RGB green
|
||||
(byte) 0 //RGB blue
|
||||
);
|
||||
//replacing lime with freebsd.org gold
|
||||
palette.setColorAtIndex(HSSFColor.LIME.index, (byte) 255, (byte) 204, (byte) 102);
|
||||
|
||||
//save with the modified palette
|
||||
// note that wherever we have previously used RED or LIME, the
|
||||
// new colors magically appear
|
||||
out = new FileOutputStream("modified_palette.xls");
|
||||
wb.write(out);
|
||||
out.close();
|
||||
</source>
|
||||
</section>
|
||||
<anchor id="ReadWriteWorkbook"/>
|
||||
<section><title>Reading and Rewriting Workbooks</title>
|
||||
<source>
|
||||
POIFSFileSystem fs =
|
||||
new POIFSFileSystem(new FileInputStream("workbook.xls"));
|
||||
HSSFWorkbook wb = new HSSFWorkbook(fs);
|
||||
HSSFSheet sheet = wb.getSheetAt(0);
|
||||
HSSFRow row = sheet.getRow(2);
|
||||
HSSFCell cell = row.getCell((short)3);
|
||||
if (cell == null)
|
||||
cell = row.createCell((short)3);
|
||||
cell.setCellType(HSSFCell.CELL_TYPE_STRING);
|
||||
cell.setCellValue("a test");
|
||||
|
||||
// Write the output to a file
|
||||
FileOutputStream fileOut = new FileOutputStream("workbook.xls");
|
||||
wb.write(fileOut);
|
||||
fileOut.close();
|
||||
</source>
|
||||
</section>
|
||||
<anchor id="NewLinesInCells"/>
|
||||
<section><title>Using newlines in cells</title>
|
||||
<source>
|
||||
HSSFWorkbook wb = new HSSFWorkbook();
|
||||
HSSFSheet s = wb.createSheet();
|
||||
HSSFRow r = null;
|
||||
HSSFCell c = null;
|
||||
HSSFCellStyle cs = wb.createCellStyle();
|
||||
HSSFFont f = wb.createFont();
|
||||
HSSFFont f2 = wb.createFont();
|
||||
|
||||
cs = wb.createCellStyle();
|
||||
|
||||
cs.setFont( f2 );
|
||||
//Word Wrap MUST be turned on
|
||||
cs.setWrapText( true );
|
||||
|
||||
r = s.createRow( (short) 2 );
|
||||
r.setHeight( (short) 0x349 );
|
||||
c = r.createCell( (short) 2 );
|
||||
c.setCellType( HSSFCell.CELL_TYPE_STRING );
|
||||
c.setCellValue( "Use \n with word wrap on to create a new line" );
|
||||
c.setCellStyle( cs );
|
||||
s.setColumnWidth( (short) 2, (short) ( ( 50 * 8 ) / ( (double) 1 / 20 ) ) );
|
||||
|
||||
FileOutputStream fileOut = new FileOutputStream( "workbook.xls" );
|
||||
wb.write( fileOut );
|
||||
fileOut.close();</source>
|
||||
</section>
|
||||
<anchor id="DataFormats"/>
|
||||
<section><title>Data Formats</title>
|
||||
<source>
|
||||
HSSFWorkbook wb = new HSSFWorkbook();
|
||||
HSSFSheet sheet = wb.createSheet("format sheet");
|
||||
HSSFCellStyle style;
|
||||
HSSFDataFormat format = wb.createDataFormat();
|
||||
HSSFRow row;
|
||||
HSSFCell cell;
|
||||
short rowNum = 0;
|
||||
short colNum = 0;
|
||||
|
||||
row = sheet.createRow(rowNum++);
|
||||
cell = row.createCell(colNum);
|
||||
cell.setCellValue(11111.25);
|
||||
style = wb.createCellStyle();
|
||||
style.setDataFormat(format.getFormat("0.0"));
|
||||
cell.setCellStyle(style);
|
||||
|
||||
row = sheet.createRow(rowNum++);
|
||||
cell = row.createCell(colNum);
|
||||
cell.setCellValue(11111.25);
|
||||
style = wb.createCellStyle();
|
||||
style.setDataFormat(format.getFormat("#,##0.0000"));
|
||||
cell.setCellStyle(style);
|
||||
|
||||
FileOutputStream fileOut = new FileOutputStream("workbook.xls");
|
||||
wb.write(fileOut);
|
||||
fileOut.close();
|
||||
</source>
|
||||
</section>
|
||||
<anchor id="FitTo"/>
|
||||
<section><title>Fit Sheet to One Page</title>
|
||||
<source>
|
||||
HSSFWorkbook wb = new HSSFWorkbook();
|
||||
HSSFSheet sheet = wb.createSheet("format sheet");
|
||||
HSSFPrintSetup ps = sheet.getPrintSetup();
|
||||
|
||||
sheet.setAutobreaks(true);
|
||||
|
||||
ps.setFitHeight((short)1);
|
||||
ps.setFitWidth((short)1);
|
||||
|
||||
|
||||
// Create various cells and rows for spreadsheet.
|
||||
|
||||
FileOutputStream fileOut = new FileOutputStream("workbook.xls");
|
||||
wb.write(fileOut);
|
||||
fileOut.close();
|
||||
</source>
|
||||
</section>
|
||||
<anchor id="PrintArea2"/>
|
||||
<section><title>Set Print Area</title>
|
||||
<source>
|
||||
HSSFWorkbook wb = new HSSFWorkbook();
|
||||
HSSFSheet sheet = wb.createSheet("Sheet1");
|
||||
wb.setPrintArea(0, "$A$1:$C$2");
|
||||
//sets the print area for the first sheet
|
||||
//Alternatively:
|
||||
//wb.setPrintArea(0, 0, 1, 0, 0) is equivalent to using the name reference (See the JavaDocs for more details)
|
||||
|
||||
// Create various cells and rows for spreadsheet.
|
||||
|
||||
FileOutputStream fileOut = new FileOutputStream("workbook.xls");
|
||||
wb.write(fileOut);
|
||||
fileOut.close();
|
||||
|
||||
|
||||
</source>
|
||||
</section>
|
||||
|
||||
<anchor id="FooterPageNumbers"/>
|
||||
<section><title>Set Page Numbers on Footer</title>
|
||||
<source>
|
||||
HSSFWorkbook wb = new HSSFWorkbook();
|
||||
HSSFSheet sheet = wb.createSheet("format sheet");
|
||||
HSSFFooter footer = sheet.getFooter()
|
||||
|
||||
footer.setRight( "Page " + HSSFFooter.page() + " of " + HSSFFooter.numPages() );
|
||||
|
||||
|
||||
|
||||
// Create various cells and rows for spreadsheet.
|
||||
|
||||
FileOutputStream fileOut = new FileOutputStream("workbook.xls");
|
||||
wb.write(fileOut);
|
||||
fileOut.close();
|
||||
</source>
|
||||
</section>
|
||||
|
||||
<anchor id="ConvenienceFunctions"/>
|
||||
<section><title>Using the Convenience Functions</title>
|
||||
<p>
|
||||
The convenience functions live in contrib and provide
|
||||
utility features such as setting borders around merged
|
||||
regions and changing style attributes without explicitly
|
||||
creating new styles.
|
||||
</p>
|
||||
<source>
|
||||
HSSFWorkbook wb = new HSSFWorkbook();
|
||||
HSSFSheet sheet1 = wb.createSheet( "new sheet" );
|
||||
|
||||
// Create a merged region
|
||||
HSSFRow row = sheet1.createRow( (short) 1 );
|
||||
HSSFRow row2 = sheet1.createRow( (short) 2 );
|
||||
HSSFCell cell = row.createCell( (short) 1 );
|
||||
cell.setCellValue( "This is a test of merging" );
|
||||
Region region = new Region( 1, (short) 1, 4, (short) 4 );
|
||||
sheet1.addMergedRegion( region );
|
||||
|
||||
// Set the border and border colors.
|
||||
final short borderMediumDashed = HSSFCellStyle.BORDER_MEDIUM_DASHED;
|
||||
HSSFRegionUtil.setBorderBottom( borderMediumDashed,
|
||||
region, sheet1, wb );
|
||||
HSSFRegionUtil.setBorderTop( borderMediumDashed,
|
||||
region, sheet1, wb );
|
||||
HSSFRegionUtil.setBorderLeft( borderMediumDashed,
|
||||
region, sheet1, wb );
|
||||
HSSFRegionUtil.setBorderRight( borderMediumDashed,
|
||||
region, sheet1, wb );
|
||||
HSSFRegionUtil.setBottomBorderColor(HSSFColor.AQUA.index, region, sheet1, wb);
|
||||
HSSFRegionUtil.setTopBorderColor(HSSFColor.AQUA.index, region, sheet1, wb);
|
||||
HSSFRegionUtil.setLeftBorderColor(HSSFColor.AQUA.index, region, sheet1, wb);
|
||||
HSSFRegionUtil.setRightBorderColor(HSSFColor.AQUA.index, region, sheet1, wb);
|
||||
|
||||
// Shows some usages of HSSFCellUtil
|
||||
HSSFCellStyle style = wb.createCellStyle();
|
||||
style.setIndention((short)4);
|
||||
HSSFCellUtil.createCell(row, 8, "This is the value of the cell", style);
|
||||
HSSFCell cell2 = HSSFCellUtil.createCell( row2, 8, "This is the value of the cell");
|
||||
HSSFCellUtil.setAlignment(cell2, wb, HSSFCellStyle.ALIGN_CENTER);
|
||||
|
||||
// Write out the workbook
|
||||
FileOutputStream fileOut = new FileOutputStream( "workbook.xls" );
|
||||
wb.write( fileOut );
|
||||
fileOut.close();
|
||||
</source>
|
||||
</section>
|
||||
|
||||
<anchor id="ShiftRows"/>
|
||||
<section><title>Shift rows up or down on a sheet</title>
|
||||
<source>
|
||||
HSSFWorkbook wb = new HSSFWorkbook();
|
||||
HSSFSheet sheet = wb.createSheet("row sheet");
|
||||
|
||||
// Create various cells and rows for spreadsheet.
|
||||
|
||||
// Shift rows 6 - 11 on the spreadsheet to the top (rows 0 - 5)
|
||||
sheet.shiftRows(5, 10, -5);
|
||||
|
||||
FileOutputStream fileOut = new FileOutputStream("workbook.xls");
|
||||
wb.write(fileOut);
|
||||
fileOut.close();
|
||||
</source>
|
||||
</section>
|
||||
|
||||
<anchor id="SelectSheet"/>
|
||||
<section><title>Set a sheet as selected</title>
|
||||
<source>
|
||||
HSSFWorkbook wb = new HSSFWorkbook();
|
||||
HSSFSheet sheet = wb.createSheet("row sheet");
|
||||
sheet.setSelected(true);
|
||||
|
||||
// Create various cells and rows for spreadsheet.
|
||||
|
||||
FileOutputStream fileOut = new FileOutputStream("workbook.xls");
|
||||
wb.write(fileOut);
|
||||
fileOut.close();
|
||||
</source>
|
||||
</section>
|
||||
|
||||
<anchor id="Zoom"/>
|
||||
<section><title>Set the zoom magnification</title>
|
||||
<p>
|
||||
The zoom is expressed as a fraction. For example to
|
||||
express a zoom of 75% use 3 for the numerator and
|
||||
4 for the denominator.
|
||||
</p>
|
||||
<source>
|
||||
HSSFWorkbook wb = new HSSFWorkbook();
|
||||
HSSFSheet sheet1 = wb.createSheet("new sheet");
|
||||
sheet1.setZoom(3,4); // 75 percent magnification
|
||||
FileOutputStream fileOut = new FileOutputStream("workbook.xls");
|
||||
wb.write(fileOut);
|
||||
fileOut.close();
|
||||
</source>
|
||||
</section>
|
||||
|
||||
<anchor id="Splits"/>
|
||||
<section><title>Splits and freeze panes</title>
|
||||
<p>
|
||||
There are two types of panes you can create; freeze panes and split panes.
|
||||
</p>
|
||||
<p>
|
||||
A freeze pane is split by columns and rows. You create
|
||||
a freeze pane using the following mechanism:
|
||||
</p>
|
||||
<p>
|
||||
sheet1.createFreezePane( 3, 2, 3, 2 );
|
||||
</p>
|
||||
<p>
|
||||
The first two parameters are the columns and rows you
|
||||
wish to split by. The second two parameters indicate
|
||||
the cells that are visible in the bottom right quadrant.
|
||||
</p>
|
||||
<p>
|
||||
|
||||
Split pains appear differently. The split area is
|
||||
divided into four separate work area's. The split
|
||||
occurs at the pixel level and the user is able to
|
||||
adjust the split by dragging it to a new position.
|
||||
</p>
|
||||
<p>
|
||||
|
||||
Split panes are created with the following call:
|
||||
</p>
|
||||
<p>
|
||||
sheet2.createSplitPane( 2000, 2000, 0, 0, HSSFSheet.PANE_LOWER_LEFT );
|
||||
</p>
|
||||
<p>
|
||||
|
||||
The first parameter is the x position of the split.
|
||||
This is in 1/20th of a point. A point in this case
|
||||
seems to equate to a pixel. The second parameter is
|
||||
the y position of the split. Again in 1/20th of a point.
|
||||
</p>
|
||||
<p>
|
||||
The last parameter indicates which pane currently has
|
||||
the focus. This will be one of HSSFSheet.PANE_LOWER_LEFT,
|
||||
PANE_LOWER_RIGHT, PANE_UPPER_RIGHT or PANE_UPPER_LEFT.
|
||||
</p>
|
||||
<source>
|
||||
HSSFWorkbook wb = new HSSFWorkbook();
|
||||
HSSFSheet sheet1 = wb.createSheet("new sheet");
|
||||
HSSFSheet sheet2 = wb.createSheet("second sheet");
|
||||
HSSFSheet sheet3 = wb.createSheet("third sheet");
|
||||
HSSFSheet sheet4 = wb.createSheet("fourth sheet");
|
||||
|
||||
// Freeze just one row
|
||||
sheet1.createFreezePane( 0, 1, 0, 1 );
|
||||
// Freeze just one column
|
||||
sheet2.createFreezePane( 1, 0, 1, 0 );
|
||||
// Freeze the columns and rows (forget about scrolling position of the lower right quadrant).
|
||||
sheet3.createFreezePane( 2, 2 );
|
||||
// Create a split with the lower left side being the active quadrant
|
||||
sheet4.createSplitPane( 2000, 2000, 0, 0, HSSFSheet.PANE_LOWER_LEFT );
|
||||
|
||||
FileOutputStream fileOut = new FileOutputStream("workbook.xls");
|
||||
wb.write(fileOut);
|
||||
fileOut.close();
|
||||
</source>
|
||||
</section>
|
||||
|
||||
<anchor id="Repeating"/>
|
||||
<section><title>Repeating rows and columns</title>
|
||||
<p>
|
||||
It's possible to set up repeating rows and columns in
|
||||
your printouts by using the setRepeatingRowsAndColumns()
|
||||
function in the HSSFWorkbook class.
|
||||
</p>
|
||||
<p>
|
||||
This function Contains 5 parameters.
|
||||
The first parameter is the index to the sheet (0 = first sheet).
|
||||
The second and third parameters specify the range for the columns to repreat.
|
||||
To stop the columns from repeating pass in -1 as the start and end column.
|
||||
The fourth and fifth parameters specify the range for the rows to repeat.
|
||||
To stop the columns from repeating pass in -1 as the start and end rows.
|
||||
</p>
|
||||
<source>
|
||||
HSSFWorkbook wb = new HSSFWorkbook();
|
||||
HSSFSheet sheet1 = wb.createSheet("new sheet");
|
||||
HSSFSheet sheet2 = wb.createSheet("second sheet");
|
||||
|
||||
// Set the columns to repeat from column 0 to 2 on the first sheet
|
||||
wb.setRepeatingRowsAndColumns(0,0,2,-1,-1);
|
||||
// Set the the repeating rows and columns on the second sheet.
|
||||
wb.setRepeatingRowsAndColumns(1,4,5,1,2);
|
||||
|
||||
FileOutputStream fileOut = new FileOutputStream("workbook.xls");
|
||||
wb.write(fileOut);
|
||||
fileOut.close();
|
||||
</source>
|
||||
</section>
|
||||
|
||||
<anchor id="HeaderFooter"/>
|
||||
<section><title>Headers and Footers</title>
|
||||
<p>
|
||||
Example is for headers but applies directly to footers.
|
||||
</p>
|
||||
<source>
|
||||
HSSFWorkbook wb = new HSSFWorkbook();
|
||||
HSSFSheet sheet = wb.createSheet("new sheet");
|
||||
|
||||
HSSFHeader header = sheet.getHeader();
|
||||
header.setCenter("Center Header");
|
||||
header.setLeft("Left Header");
|
||||
header.setRight(HSSFHeader.font("Stencil-Normal", "Italic") +
|
||||
HSSFHeader.fontSize((short) 16) + "Right w/ Stencil-Normal Italic font and size 16");
|
||||
|
||||
FileOutputStream fileOut = new FileOutputStream("workbook.xls");
|
||||
wb.write(fileOut);
|
||||
fileOut.close();
|
||||
</source>
|
||||
</section>
|
||||
|
||||
<anchor id="DrawingShapes"/>
|
||||
<section><title>Drawing Shapes</title>
|
||||
<p>
|
||||
POI supports drawing shapes using the Microsoft Office
|
||||
drawing tools. Shapes on a sheet are organized in a
|
||||
hiearchy of groups and and shapes. The top-most shape
|
||||
is the patriarch. This is not visisble on the sheet
|
||||
at all. To start drawing you need to call <code>createPatriarch</code>
|
||||
on the <code>HSSFSheet</code> class. This has the
|
||||
effect erasing any other shape information stored
|
||||
in that sheet. By default POI will leave shape
|
||||
records alone in the sheet unless you make a call to
|
||||
this method.
|
||||
</p>
|
||||
<p>
|
||||
To create a shape you have to go through the following
|
||||
steps:
|
||||
</p>
|
||||
<ol>
|
||||
<li>Create the patriarch.</li>
|
||||
<li>Create an anchor to position the shape on the sheet.</li>
|
||||
<li>Ask the patriarch to create the shape.</li>
|
||||
<li>Set the shape type (line, oval, rectangle etc...)</li>
|
||||
<li>Set any other style details converning the shape. (eg:
|
||||
line thickness, etc...)</li>
|
||||
</ol>
|
||||
<source>
|
||||
HSSFPatriarch patriarch = sheet.createDrawingPatriarch();
|
||||
a = new HSSFClientAnchor( 0, 0, 1023, 255, (short) 1, 0, (short) 1, 0 );
|
||||
HSSFSimpleShape shape1 = patriarch.createSimpleShape(a1);
|
||||
shape1.setShapeType(HSSFSimpleShape.OBJECT_TYPE_LINE);
|
||||
</source>
|
||||
<p>
|
||||
Text boxes are created using a different call:
|
||||
</p>
|
||||
<source>
|
||||
HSSFTextbox textbox1 = patriarch.createTextbox(
|
||||
new HSSFClientAnchor(0,0,0,0,(short)1,1,(short)2,2));
|
||||
textbox1.setString(new HSSFRichTextString("This is a test") );
|
||||
</source>
|
||||
<p>
|
||||
It's possible to use different fonts to style parts of
|
||||
the text in the textbox. Here's how:
|
||||
</p>
|
||||
<source>
|
||||
HSSFFont font = wb.createFont();
|
||||
font.setItalic(true);
|
||||
font.setUnderline(HSSFFont.U_DOUBLE);
|
||||
HSSFRichTextString string = new HSSFRichTextString("Woo!!!");
|
||||
string.applyFont(2,5,font);
|
||||
textbox.setString(string );
|
||||
</source>
|
||||
<p>
|
||||
Just as can be done manually using Excel, it is possible
|
||||
to group shapes together. This is done by calling
|
||||
<code>createGroup()</code> and then creating the shapes
|
||||
using those groups.
|
||||
</p>
|
||||
<p>
|
||||
It's also possible to create groups within groups.
|
||||
</p>
|
||||
<warning>Any group you create should contain at least two
|
||||
other shapes or subgroups.</warning>
|
||||
<p>
|
||||
Here's how to create a shape group:
|
||||
</p>
|
||||
<source>
|
||||
// Create a shape group.
|
||||
HSSFShapeGroup group = patriarch.createGroup(
|
||||
new HSSFClientAnchor(0,0,900,200,(short)2,2,(short)2,2));
|
||||
|
||||
// Create a couple of lines in the group.
|
||||
HSSFSimpleShape shape1 = group.createShape(new HSSFChildAnchor(3,3,500,500));
|
||||
shape1.setShapeType(HSSFSimpleShape.OBJECT_TYPE_LINE);
|
||||
( (HSSFChildAnchor) shape1.getAnchor() ).setAnchor((short)3,3,500,500);
|
||||
HSSFSimpleShape shape2 = group.createShape(new HSSFChildAnchor((short)1,200,400,600));
|
||||
shape2.setShapeType(HSSFSimpleShape.OBJECT_TYPE_LINE);
|
||||
</source>
|
||||
<p>
|
||||
If you're being observant you'll noticed that the shapes
|
||||
that are added to the group use a new type of anchor:
|
||||
the <code>HSSFChildAnchor</code>. What happens is that
|
||||
the created group has it's own coordinate space for
|
||||
shapes that are placed into it. POI defaults this to
|
||||
(0,0,1023,255) but you are able to change it as desired.
|
||||
Here's how:
|
||||
</p>
|
||||
<source>
|
||||
myGroup.setCoordinates(10,10,20,20); // top-left, bottom-right
|
||||
</source>
|
||||
<p>
|
||||
If you create a group within a group it's also going
|
||||
to have it's own coordinate space.
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<anchor id="StylingShapes"/>
|
||||
<section><title>Styling Shapes</title>
|
||||
<p>
|
||||
By default shapes can look a little plain. It's possible
|
||||
to apply different styles to the shapes however. The
|
||||
sorts of things that can currently be done are:
|
||||
</p>
|
||||
<ul>
|
||||
<li>Change the fill color.</li>
|
||||
<li>Make a shape with no fill color.</li>
|
||||
<li>Change the thickness of the lines.</li>
|
||||
<li>Change the style of the lines. Eg: dashed, dotted.</li>
|
||||
<li>Change the line color.</li>
|
||||
</ul>
|
||||
<p>
|
||||
Here's an examples of how this is done:
|
||||
</p>
|
||||
<source>
|
||||
HSSFSimpleShape s = patriarch.createSimpleShape(a);
|
||||
s.setShapeType(HSSFSimpleShape.OBJECT_TYPE_OVAL);
|
||||
s.setLineStyleColor(10,10,10);
|
||||
s.setFillColor(90,10,200);
|
||||
s.setLineWidth(HSSFShape.LINEWIDTH_ONE_PT * 3);
|
||||
s.setLineStyle(HSSFShape.LINESTYLE_DOTSYS);
|
||||
</source>
|
||||
</section>
|
||||
<anchor id="Graphics2d"/>
|
||||
<section><title>Shapes and Graphics2d</title>
|
||||
<p>
|
||||
While the native POI shape drawing commands are the
|
||||
recommended way to draw shapes in a shape it's sometimes
|
||||
desirable to use a standard API for compatibility with
|
||||
external libraries. With this in mind we created some
|
||||
wrappers for <code>Graphics</code> and <code>Graphics2d</code>.
|
||||
</p>
|
||||
<warning>
|
||||
It's important to not however before continuing that
|
||||
<code>Graphics2d</code> is a poor match to the capabilities
|
||||
of the Microsoft Office drawing commands. The older
|
||||
<code>Graphics</code> class offers a closer match but is
|
||||
still a square peg in a round hole.
|
||||
</warning>
|
||||
<p>
|
||||
All Graphics commands are issued into an <code>HSSFShapeGroup</code>.
|
||||
Here's how it's done:
|
||||
</p>
|
||||
<source>
|
||||
a = new HSSFClientAnchor( 0, 0, 1023, 255, (short) 1, 0, (short) 1, 0 );
|
||||
group = patriarch.createGroup( a );
|
||||
group.setCoordinates( 0, 0, 80 * 4 , 12 * 23 );
|
||||
float verticalPointsPerPixel = a.getAnchorHeightInPoints(sheet) / (float)Math.abs(group.getY2() - group.getY1());
|
||||
g = new EscherGraphics( group, wb, Color.black, verticalPointsPerPixel );
|
||||
g2d = new EscherGraphics2d( g );
|
||||
drawChemicalStructure( g2d );
|
||||
</source>
|
||||
<p>
|
||||
The first thing we do is create the group and set it's coordinates
|
||||
to match what we plan to draw. Next we calculate a reasonable
|
||||
fontSizeMultipler then create the EscherGraphics object.
|
||||
Since what we really want is a <code>Graphics2d</code>
|
||||
object we create an EscherGraphics2d object and pass in
|
||||
the graphics object we created. Finally we call a routine
|
||||
that draws into the EscherGraphics2d object.
|
||||
</p>
|
||||
<p>
|
||||
The vertical points per pixel deserves some more explanation.
|
||||
One of the difficulties in converting Graphics calls
|
||||
into escher drawing calls is that Excel does not have
|
||||
the concept of absolute pixel positions. It measures
|
||||
it's cell widths in 'characters' and the cell heights in points.
|
||||
Unfortunately it's not defined exactly what type of character it's
|
||||
measuring. Presumably this is due to the fact that the Excel will be
|
||||
using different fonts on different platforms or even within the same
|
||||
platform.
|
||||
</p>
|
||||
<p>
|
||||
Because of this constraint we've had to implement the concept of a
|
||||
verticalPointsPerPixel. This the amount the font should be scaled by when
|
||||
you issue commands such as drawString(). To calculate this value
|
||||
use the follow formula:
|
||||
</p>
|
||||
<source>
|
||||
multipler = groupHeightInPoints / heightOfGroup
|
||||
</source>
|
||||
<p>
|
||||
The height of the group is calculated fairly simply by calculating the
|
||||
difference between the y coordinates of the bounding box of the shape. The
|
||||
height of the group can be calculated by using a convenience called
|
||||
<code>HSSFClientAnchor.getAnchorHeightInPoints()</code>.
|
||||
</p>
|
||||
<p>
|
||||
Many of the functions supported by the graphics classes
|
||||
are not complete. Here's some of the functions that are known
|
||||
to work.
|
||||
</p>
|
||||
<ul>
|
||||
<li>fillRect()</li>
|
||||
<li>fillOval()</li>
|
||||
<li>drawString()</li>
|
||||
<li>drawOval()</li>
|
||||
<li>drawLine()</li>
|
||||
<li>clearRect()</li>
|
||||
</ul>
|
||||
<p>
|
||||
Functions that are not supported will return and log a message
|
||||
using the POI logging infrastructure (disabled by default).
|
||||
</p>
|
||||
</section>
|
||||
<anchor id="Outlining"/>
|
||||
<section>
|
||||
<title>Outlining</title>
|
||||
<p>
|
||||
Outlines are great for grouping sections of information
|
||||
together and can be added easily to columns and rows
|
||||
using the POI API. Here's how:
|
||||
</p>
|
||||
<source>
|
||||
HSSFWorkbook wb = new HSSFWorkbook();
|
||||
HSSFSheet sheet1 = wb.createSheet("new sheet");
|
||||
|
||||
sheet1.groupRow( 5, 14 );
|
||||
sheet1.groupRow( 7, 14 );
|
||||
sheet1.groupRow( 16, 19 );
|
||||
|
||||
sheet1.groupColumn( (short)4, (short)7 );
|
||||
sheet1.groupColumn( (short)9, (short)12 );
|
||||
sheet1.groupColumn( (short)10, (short)11 );
|
||||
|
||||
FileOutputStream fileOut = new FileOutputStream(filename);
|
||||
wb.write(fileOut);
|
||||
fileOut.close();
|
||||
</source>
|
||||
<p>
|
||||
To collapse (or expand) an outline use the following calls:
|
||||
</p>
|
||||
<source>
|
||||
sheet1.setRowGroupCollapsed( 7, true );
|
||||
sheet1.setColumnGroupCollapsed( (short)4, true );
|
||||
</source>
|
||||
<p>
|
||||
The row/column you choose should contain an already
|
||||
created group. It can be anywhere within the group.
|
||||
</p>
|
||||
</section>
|
||||
</section>
|
||||
</section>
|
||||
</body>
|
||||
</document>
|
195
src/documentation/content/xdocs/hssf/record-generator.xml
Normal file
195
src/documentation/content/xdocs/hssf/record-generator.xml
Normal file
@ -0,0 +1,195 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Copyright (C) 2004 The Apache Software Foundation. All rights reserved. -->
|
||||
<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.1//EN" "../dtd/document-v11.dtd">
|
||||
|
||||
<document>
|
||||
<header>
|
||||
<title>Record Generator HOWTO</title>
|
||||
<authors>
|
||||
<person email="glens@apache.org" name="Glen Stampoultzis" id="glens"/>
|
||||
<person email="acoliver@apache.org" name="Andrew C. Oliver" id="acoliver"/>
|
||||
</authors>
|
||||
</header>
|
||||
<body>
|
||||
<section><title>How to Use the Record Generator</title>
|
||||
|
||||
<section><title>History</title>
|
||||
<p>
|
||||
The record generator was born from frustration with translating
|
||||
the Excel records to Java classes. Doing this manually is a time
|
||||
consuming process. It's also very easy to make mistakes.
|
||||
</p>
|
||||
<p>
|
||||
A utility was needed to take the defintition of what a
|
||||
record looked like and do all the boring and repetitive work.
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<section><title>Capabilities</title>
|
||||
<p>
|
||||
The record generator takes XML as input and produces the following
|
||||
output:
|
||||
</p>
|
||||
<ul>
|
||||
<li>A Java file capabile of decoding and encoding the record.</li>
|
||||
<li>A test class that provides a fill-in-the-blanks implementation
|
||||
of a test case for ensuring the record operates as
|
||||
designed.</li>
|
||||
</ul>
|
||||
</section>
|
||||
<section><title>Usage</title>
|
||||
<p>
|
||||
The record generator is invoked as an Ant target
|
||||
(generate-records). It goes through looking for all files in
|
||||
<code>src/records/defintitions</code> ending with _record.xml.
|
||||
It then creates two files; the Java record definition and the
|
||||
Java test case template.
|
||||
</p>
|
||||
<p>
|
||||
The records themselves have the following general layout:
|
||||
</p>
|
||||
<source><![CDATA[
|
||||
<record id="0x1032" name="Frame" package="org.apache.poi.hssf.record"
|
||||
excel-record-id="FRAME">
|
||||
<description>The frame record indicates whether there is a border
|
||||
around the displayed text of a chart.</description>
|
||||
<author>Glen Stampoultzis (glens at apache.org)</author>
|
||||
<fields>
|
||||
<field type="int" size="2" name="border type">
|
||||
<const name="regular" value="0" description="regular rectangle or no border"/>
|
||||
<const name="shadow" value="1" description="rectangle with shadow"/>
|
||||
</field>
|
||||
<field type="int" size="2" name="options">
|
||||
<bit number="0" name="auto size"
|
||||
description="excel calculates the size automatically if true"/>
|
||||
<bit number="1" name="auto position"
|
||||
description="excel calculates the position automatically"/>
|
||||
</field>
|
||||
</fields>
|
||||
</record>
|
||||
]]></source>
|
||||
<p>
|
||||
The following table details the allowable types and sizes for
|
||||
the fields.
|
||||
</p>
|
||||
<table>
|
||||
<tr>
|
||||
<th>Type</th>
|
||||
<th>Size</th>
|
||||
<th>Java Type</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>int</td>
|
||||
<td>1</td>
|
||||
<td>byte</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>int</td>
|
||||
<td>2</td>
|
||||
<td>short</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>int</td>
|
||||
<td>4</td>
|
||||
<td>int</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>int</td>
|
||||
<td>8</td>
|
||||
<td>long</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>int</td>
|
||||
<td>varword</td>
|
||||
<td>array of shorts</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>bits</td>
|
||||
<td>1</td>
|
||||
<td>A byte comprising of a bits (defined by the bit element)
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>bits</td>
|
||||
<td>2</td>
|
||||
<td>An short comprising of a bits</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>bits</td>
|
||||
<td>4</td>
|
||||
<td>A int comprising of a bits</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>float</td>
|
||||
<td>8</td>
|
||||
<td>double</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>hbstring</td>
|
||||
<td>java expression</td>
|
||||
<td>String</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>
|
||||
The Java records are regenerated each time the record generator is
|
||||
run, however the test stubs are only created if the test stub does
|
||||
not already exist. What this means is that you may change test
|
||||
stubs but not the generated records.
|
||||
</p>
|
||||
</section>
|
||||
<section><title>Custom Field Types</title>
|
||||
<p>
|
||||
Occationally the builtin types are not enough. More control
|
||||
over the encoding and decoding of the streams is required. This
|
||||
can be achieved using a custom type.
|
||||
</p>
|
||||
<p>
|
||||
A custom type lets you escape to java to define the way in which
|
||||
the field encodes and decodes. To code a custom type you
|
||||
declare your field like this:
|
||||
</p>
|
||||
<source><![CDATA[
|
||||
<field type="custom:org.apache.poi.hssf.record.LinkedDataFormulaField"
|
||||
size="var" name="formula of link" description="formula"/>
|
||||
]]></source>
|
||||
<p>
|
||||
Where the class name specified after <code>custom:</code> is a
|
||||
class implementing the interface <code>CustomField</code>.
|
||||
</p>
|
||||
<p>
|
||||
You can then implement the encoding yourself.
|
||||
</p>
|
||||
</section>
|
||||
<section><title>How it Works</title>
|
||||
<p>
|
||||
The record generation works by taking an XML file and styling it
|
||||
using XLST. Given that XSLT is a little limited in some ways it was
|
||||
necessary to add a little Java code to the mix.
|
||||
</p>
|
||||
<p>
|
||||
See record.xsl, record_test.xsl, FieldIterator.java,
|
||||
RecordUtil.java, RecordGenerator.java
|
||||
</p>
|
||||
<p>
|
||||
There is a corresponding "type" generator for HDF.
|
||||
See the HDF documentation for details.
|
||||
</p>
|
||||
</section>
|
||||
<section><title>Limitations</title>
|
||||
<p>
|
||||
The record generator does not handle all possible record types and
|
||||
goes not intend to perform this function. When dealing with a
|
||||
non-standard record sometimes the cost-benifit of coding the
|
||||
record by hand will be greater than attempting modify the
|
||||
generator. The main point of the record generator is to save
|
||||
time, so keep that in mind.
|
||||
</p>
|
||||
<p>
|
||||
Currently the the XSL file that generates the record calls out to
|
||||
Java objects. The Java code for the record generation is
|
||||
currently quite messy with minimal comments.
|
||||
</p>
|
||||
</section>
|
||||
</section>
|
||||
</body>
|
||||
</document>
|
183
src/documentation/content/xdocs/hssf/use-case.xml
Normal file
183
src/documentation/content/xdocs/hssf/use-case.xml
Normal file
@ -0,0 +1,183 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Copyright (C) 2004 The Apache Software Foundation. All rights reserved. -->
|
||||
<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.1//EN" "../dtd/document-v11.dtd">
|
||||
|
||||
<document>
|
||||
<header>
|
||||
<title>HSSF Use Cases</title>
|
||||
<authors>
|
||||
<person email="marc.johnson@yahoo.com" name="Marc Johnson" id="MJ"/>
|
||||
</authors>
|
||||
</header>
|
||||
<body>
|
||||
<section><title>HSSF Use Cases</title>
|
||||
<section><title>Use Case 1: Read existing HSSF</title>
|
||||
|
||||
<p><strong>Primary Actor:</strong> HSSF client</p>
|
||||
<p><strong>Scope:</strong> HSSF</p>
|
||||
<p><strong>Level:</strong> Summary</p>
|
||||
<p><strong>Stakeholders and Interests:</strong></p>
|
||||
<ul>
|
||||
<li>HSSF client- wants to read content
|
||||
of HSSF file</li>
|
||||
<li>HSSF - understands HSSF file</li>
|
||||
<li>POIFS - understands underlying POI
|
||||
file system</li>
|
||||
</ul>
|
||||
<p><strong>Precondition:</strong> None</p>
|
||||
<p><strong>Minimal Guarantee:</strong> None</p>
|
||||
<p><strong>Main Success Guarantee:</strong></p>
|
||||
<ol>
|
||||
<li>HSSF client requests HSSF to read
|
||||
a HSSF file, providing an InputStream
|
||||
containing HSSF file in question.</li>
|
||||
<li>HSSF requests POIFS to read the HSSF
|
||||
file, passing the InputStream
|
||||
object to POIFS (POIFS use case 1, read existing file system)</li>
|
||||
<li>HSSF reads the "Workbook"
|
||||
file (use case 4, read workbook entry)</li>
|
||||
</ol>
|
||||
<p><strong>Extensions:</strong></p>
|
||||
<p>2a. Exceptions
|
||||
thrown by POIFS will be passed on to the HSSF client.</p>
|
||||
</section>
|
||||
<section><title>Use Case 2: Write HSSF file</title>
|
||||
|
||||
<p><strong>Primary Actor:</strong> HSSF client</p>
|
||||
<p><strong>Scope:</strong> HSSF</p>
|
||||
<p><strong>Level:</strong> Summary</p>
|
||||
<p><strong>Stakeholders and Interests:</strong></p>
|
||||
<ul>
|
||||
<li>HSSF client- wants to write file
|
||||
out.</li>
|
||||
<li>HSSF - knows how to write file
|
||||
out.</li>
|
||||
<li>POIFS - knows how to write file
|
||||
system out.</li>
|
||||
</ul>
|
||||
<p><strong>Precondition:</strong></p>
|
||||
<ul>
|
||||
<li>File has been
|
||||
read (use case 1, read existing HSSF file) and subsequently modified
|
||||
or file has been created (use case 3, create HSSF file)</li>
|
||||
</ul>
|
||||
<p><strong>Minimal Guarantee:</strong> None</p>
|
||||
<p><strong>Main Success Guarantee:</strong></p>
|
||||
<ol>
|
||||
<li>HSSF client
|
||||
provides an OutputStream to
|
||||
write the file to.</li>
|
||||
<li>HSSF writes
|
||||
the "Workbook" to its associated POIFS file system (use case
|
||||
5, write workbook entry)</li>
|
||||
<li>HSSF
|
||||
requests POIFS to write its file system out, using the OutputStream
|
||||
obtained from the HSSF client (POIFS use case 2, write file system).</li>
|
||||
</ol>
|
||||
<p><strong>Extensions:</strong></p>
|
||||
<p>3a. Exceptions
|
||||
from POIFS are passed to the HSSF client.</p>
|
||||
|
||||
</section>
|
||||
<section><title>Use Case 3:Create HSSF file</title>
|
||||
|
||||
<p><strong>Primary Actor:</strong> HSSF client</p>
|
||||
<p><strong>Scope:</strong> HSSF</p>
|
||||
<p>
|
||||
<strong>Level:</strong> Summary</p>
|
||||
<p><strong>Stakeholders and Interests:</strong></p>
|
||||
<ul>
|
||||
<li>HSSF client- wants to create a new
|
||||
file.</li>
|
||||
<li>HSSF - knows how to create a new
|
||||
file.</li>
|
||||
<li>POIFS - knows how to creat a new
|
||||
file system.</li>
|
||||
</ul>
|
||||
<p><strong>Precondition:</strong></p>
|
||||
<p><strong>Minimal Guarantee:</strong> None</p>
|
||||
<p><strong>Main Success Guarantee:</strong></p>
|
||||
<ol>
|
||||
<li>HSSF requests
|
||||
POIFS to create a new file system (POIFS use case 3, create new file
|
||||
system)</li>
|
||||
</ol>
|
||||
<p><strong>Extensions:</strong>
|
||||
None</p>
|
||||
|
||||
</section>
|
||||
<section><title>Use Case 4: Read workbook entry</title>
|
||||
<p><strong>Primary Actor:</strong> HSSF</p>
|
||||
<p><strong>Scope:</strong> HSSF</p>
|
||||
<p>
|
||||
<strong>Level:</strong> Summary</p>
|
||||
<p><strong>Stakeholders and Interests:</strong></p>
|
||||
<ul>
|
||||
<li>HSSF - knows how to read the
|
||||
workbook entry</li>
|
||||
<li>POIFS - knows how to manage the file
|
||||
system.</li>
|
||||
</ul>
|
||||
<p><strong>Precondition:</strong></p>
|
||||
<ul>
|
||||
<li>The file
|
||||
system has been read (use case 1, read existing HSSF file) or has
|
||||
been created and written to (use case 3, create HSSF file system;
|
||||
use case 5, write workbook entry).</li>
|
||||
</ul>
|
||||
<p><strong>Minimal
|
||||
Guarantee:</strong> None</p>
|
||||
<p><strong>Main Success Guarantee:</strong></p>
|
||||
<ol>
|
||||
<li>
|
||||
HSSF requests POIFS for the "Workbook" file</li>
|
||||
<li>POIFS returns
|
||||
an InputStream for the file.</li>
|
||||
<li>HSSF reads
|
||||
from the InputStream provided by POIFS</li>
|
||||
<li>HSSF closes
|
||||
the InputStream provided by POIFS</li>
|
||||
</ol>
|
||||
<p><strong>Extensions:</strong></p>
|
||||
<p>3a. Exceptions
|
||||
thrown by POIFS will be passed on</p>
|
||||
</section>
|
||||
<section><title>Use Case 5: Write workbook entry</title>
|
||||
|
||||
|
||||
<p><strong>Primary Actor:</strong> HSSF</p>
|
||||
<p><strong>Scope:</strong> HSSF</p>
|
||||
<p>
|
||||
<strong>Level:</strong> Summary</p>
|
||||
<p><strong>Stakeholders and Interests:</strong></p>
|
||||
<ul>
|
||||
<li>HSSF - knows how to manage the
|
||||
write the workbook entry.</li>
|
||||
<li>POIFS - knows how to manage the file
|
||||
system.</li>
|
||||
</ul>
|
||||
<p><strong>Precondition:</strong>
|
||||
</p>
|
||||
<ul>
|
||||
<li>Either an existing HSSF file has
|
||||
been read (use case 1, read existing HSSF file) or an HSSF file has
|
||||
been created (use case 3, create HSSF file).</li>
|
||||
</ul>
|
||||
<p><strong>Minimal Guarantee:</strong> None</p>
|
||||
<p><strong>Main Success Guarantee:</strong></p>
|
||||
<ol>
|
||||
<li>HSSF
|
||||
checks the POIFS file system directory for the "Workbook"
|
||||
file (POIFS use case 8, read file system directory)</li>
|
||||
<li>If "Workbook" is in the directory, HSSF requests POIFS to
|
||||
replace it with the new workbook entry (POIFS use case 4, replace file
|
||||
in file system). Otherwise, HSSF requests POIFS to write the new
|
||||
workbook file, with the name "Workbook" (POIFS use case 6,
|
||||
write new file to file system)</li>
|
||||
</ol>
|
||||
<p><strong>Extensions:</strong>None</p>
|
||||
</section>
|
||||
|
||||
</section>
|
||||
</body>
|
||||
</document>
|
143
src/documentation/content/xdocs/index.xml
Normal file
143
src/documentation/content/xdocs/index.xml
Normal file
@ -0,0 +1,143 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Copyright (C) 2004 The Apache Software Foundation. All rights reserved. -->
|
||||
<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.1//EN" "./dtd/document-v11.dtd">
|
||||
|
||||
<document>
|
||||
<header>
|
||||
<title>Welcome to POI</title>
|
||||
<authors>
|
||||
<person id="AO" name="Andrew C. Oliver" email="acoliver@apache.org"/>
|
||||
<person id="GJS" name="Glen Stampoultzis" email="poi-user@jakarta.apache.org"/>
|
||||
<person id="AS" name="Avik Sengupta" email="poi-user@jakarta.apache.org"/>
|
||||
</authors>
|
||||
</header>
|
||||
|
||||
<body>
|
||||
<section><title>News</title>
|
||||
<p>All POI news can now be found at the <link href="http://nagoya.apache.org/poi/news/">poi news weblog</link>.</p>
|
||||
|
||||
</section>
|
||||
<section><title>Purpose</title>
|
||||
<p>
|
||||
The POI project consists of APIs for manipulating various file formats
|
||||
based upon Microsoft's OLE 2 Compound Document format using pure Java. In short, you can
|
||||
read and write MS Excel files using Java. Soon, you'll be able to read and write
|
||||
Word files using Java. POI is your Java Excel solution as well as your Word Excel solution.
|
||||
However, we have a complete API for porting other OLE 2 Compound Document formats and welcome
|
||||
others to participate.
|
||||
</p>
|
||||
<p>
|
||||
OLE 2 Compound Document Format based files include most Microsoft Office
|
||||
files such as XLS and DOC as well as MFC serialization API based file formats.
|
||||
</p>
|
||||
<p>
|
||||
As a general policy we try to collaborate as much as possible with other projects to
|
||||
provide this functionality. Examples include: <link href="http://xml.apache.org/cocoon">Cocoon</link> for
|
||||
which there are serializers for HSSF;
|
||||
<link href="http://www.openoffice.org">Open Office.org</link> with whom we collaborate in documenting the
|
||||
XLS format; and <link href="http://jakarta.apache.org/lucene">Lucene</link> for which we'll soon have file
|
||||
format interpretors. When practical, we donate components directly to those projects for POI-enabling them.
|
||||
</p>
|
||||
<section><title>Why/when would I use POI?</title>
|
||||
<p>
|
||||
We'll tackle this on a component level. POI refers to the whole project.
|
||||
</p>
|
||||
<p>
|
||||
So why should you use POIFS or HSSF?
|
||||
</p>
|
||||
<p>
|
||||
You'd use POIFS if you had a document written in OLE 2 Compound Document Format, probably written using
|
||||
MFC, that you needed to read in Java. Alternatively, you'd use POIFS to write OLE 2 Compound Document Format
|
||||
if you needed to inter-operate with software running on the Windows platform. We are not just bragging when
|
||||
we say that POIFS is the most complete and correct port of this file format to date!
|
||||
</p>
|
||||
<p>
|
||||
You'd use HSSF if you needed to read or write an Excel file using Java (XLS). You can also read and modify
|
||||
spreadsheets using this API, although right now writing is more mature.
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<section><title>What does POI stand for?</title>
|
||||
<p>
|
||||
POI stands for Poor Obfuscation Implementation. Why would we name our project such a derogatory name? Well,
|
||||
Microsoft's OLE 2 Compound Document Format is a poorly conceived thing. It is essentially an archive structured
|
||||
much like the old DOS FAT filesystem. Redmond chose, instead of using tar, gzip, zip or arc, to invent their own
|
||||
archive format that does not provide any standard encryption or compression, is not very appendable and is prone
|
||||
to fragmentation.
|
||||
</p>
|
||||
<p>
|
||||
Poi is also a Hawaiian delicacy that <link href="http://www.m-w.com">Merriam Webster's dictionary</link> defines as:
|
||||
"A Hawaiian food of taro root cooked, pounded, and kneaded to a paste and often allowed to ferment." This seemed
|
||||
strangely descriptive of the file format.
|
||||
</p>
|
||||
<p>
|
||||
So if you like acronyms, then POI is an acronym. If you hate them, then we just used the name of the food for our
|
||||
project. If you wish to signify your love or hate for acronyms, use POI or Poi to refer to the project respectively.
|
||||
</p>
|
||||
</section>
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
<section><title>Components To Date</title>
|
||||
<section><title>Overview</title>
|
||||
<p>A common misconception is that POI writes Excel files. POI is the name of the project. POI contains several
|
||||
components, one of which, HSSF, writes Excel files. The following are components of the entire POI project
|
||||
and a brief summary of their purpose.</p>
|
||||
</section>
|
||||
<section><title>POIFS (POI Filesystem)</title>
|
||||
<p>POIFS is the oldest and most stable part of the project. It is our port of the OLE 2 Compound Document Format to
|
||||
pure Java. It supports both read and write functionality. All of our components ultimately rely on it by
|
||||
definition. Please see <link href="./poifs/index.html">the POIFS project page</link> for more information.</p>
|
||||
</section>
|
||||
<section><title>HSSF (Horrible Spreadsheet Format)</title>
|
||||
<p>HSSF is our port of the Microsoft Excel 97(-2002) file format (BIFF8) to pure Java. It supports read and write
|
||||
capability. Please see <link href="./hssf/index.html">the HSSF project page</link> for more information.</p>
|
||||
</section>
|
||||
<section><title>HWPF</title>
|
||||
<p>HWPF is our port of the Microsoft Word 97 file format to pure Java. It supports read and write capability.
|
||||
Please see <link href="http://jakarta.apache.org/poi/hwpf/index.html">the HWPF project page for more information</link>. This component is
|
||||
in the early stages of development.It can already read and write simple files. Jump in!. (Please note that the HWPF codebase is NOT included in the 2.0 releases. Please use CVS to access this code.) </p>
|
||||
</section>
|
||||
<section><title>HPSF (Horrible Property Set Format)</title>
|
||||
<p>HPSF is our port of the OLE 2 property set format to pure
|
||||
Java. Property sets are mostly use to store a document's properties
|
||||
(title, author, date of last modification etc.), but they can be used
|
||||
for application-specific purposes as well. Currently HPSF supports
|
||||
read functionality only. Please see <link
|
||||
href="./hpsf/index.html">the HPSF project page</link> for more
|
||||
information.</p>
|
||||
</section>
|
||||
|
||||
</section>
|
||||
|
||||
<section><title>What happened to the HSSF Serializer?</title>
|
||||
<p>The HSSF Serializer, which was part of our 1.0 release and last builds on
|
||||
<link href="http://www.sourceforge.net/projects/poi">Sourceforge</link>, has been donated to the
|
||||
<link href="http://xml.apache.org/cocoon/">Cocoon</link> project, and is available starting from version
|
||||
2.0.2.</p>
|
||||
</section>
|
||||
|
||||
<section><title>Contributing </title>
|
||||
<p>
|
||||
So you'd like to contribute to the project? Great! We need enthusiastic, hard-working, talented folks to help
|
||||
us on the project in several areas. The first is bug reports and feature requests! The second is documentation -
|
||||
we'll be at your every beck and call if you've got a critique or you'd like to contribute or otherwise improve
|
||||
the documentation. We could especially use some help documenting the HSSF file format! Last, but not least, we
|
||||
could use some binary crunching Java coders to chew through the convolution that characterizes Microsoft's file
|
||||
formats and help us port new ones to a superior Java platform!
|
||||
</p>
|
||||
<p>So if you're motivated, ready, and have the time, join the mail lists and we'll be happy to help you get started on the
|
||||
project!
|
||||
</p>
|
||||
|
||||
|
||||
</section>
|
||||
</body>
|
||||
<footer>
|
||||
<legal>
|
||||
Copyright (c) @year@ The Apache Software Foundation All rights reserved.
|
||||
$Revision$ $Date$
|
||||
</legal>
|
||||
</footer>
|
||||
</document>
|
38
src/documentation/content/xdocs/mirrors.xml
Normal file
38
src/documentation/content/xdocs/mirrors.xml
Normal file
@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!-- Copyright (C) 2004 The Apache Software Foundation. All rights reserved. -->
|
||||
<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.1//EN" "./dtd/document-v11.dtd">
|
||||
|
||||
<document>
|
||||
<header>
|
||||
<title></title>
|
||||
<authors>
|
||||
<person id="AO" name="Andrew C. Oliver" email="acoliver@apache.org"/>
|
||||
</authors>
|
||||
</header>
|
||||
|
||||
<body>
|
||||
<section><title>Mirrors</title>
|
||||
<p>
|
||||
These are mirrors of the
|
||||
<link href="http://jakarta.apache.org/poi">POI</link> website.
|
||||
If you know of others...report them! :-)
|
||||
</p>
|
||||
</section>
|
||||
<section><title>Austria</title>
|
||||
<ul>
|
||||
<li><link href="http://gd.tuwien.ac.at/infosys/servers/http/apache-jakarta-site/poi/index.html">Austrian Mirror of Jakarta POI</link></li>
|
||||
</ul>
|
||||
</section>
|
||||
<section><title>Korea</title>
|
||||
<ul>
|
||||
<li><link href="http://jakarta.ktech21.co.kr/">Jakarta site partially translated into Korean and Mirrored</link></li>
|
||||
</ul>
|
||||
</section>
|
||||
</body>
|
||||
<footer>
|
||||
<legal>
|
||||
Copyright (c) @year@ The Apache Software Foundation All rights reserved.
|
||||
$Revision$ $Date$
|
||||
</legal>
|
||||
</footer>
|
||||
</document>
|
213
src/documentation/content/xdocs/news.xml
Normal file
213
src/documentation/content/xdocs/news.xml
Normal file
@ -0,0 +1,213 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!-- Copyright (C) 2004 The Apache Software Foundation. All rights reserved. -->
|
||||
<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.1//EN" "./dtd/document-v11.dtd">
|
||||
|
||||
<document>
|
||||
<header>
|
||||
<title></title>
|
||||
<authors>
|
||||
<person id="AO" name="Andrew C. Oliver" email="acoliver@apache.org"/>
|
||||
</authors>
|
||||
</header>
|
||||
|
||||
<body>
|
||||
<section><title>POI in the news</title>
|
||||
<p>
|
||||
These are articles/etc. posted about POI around the web. If you
|
||||
see POI in the news or mentioned at least somewhat prominently
|
||||
on a site (not your homepage that you put the work POI on in
|
||||
order to get us to link you and by the why here is a picture of
|
||||
your wife in kids) then send a patch to the list. In general
|
||||
equal time will be given so please feel free to send inflamatory
|
||||
defamation as well as favorable, technical and factual. Really
|
||||
stupid things won't be mentioned (sorry).
|
||||
</p>
|
||||
</section>
|
||||
<section><title>English</title>
|
||||
<ul>
|
||||
<li>
|
||||
<link href="http://archive.midrange.com/web400/200204/msg00023.html">Discussion about using POI on AS/400s</link>
|
||||
</li>
|
||||
<li>
|
||||
<link href="http://www.somelist.com/mails/23819.html">Discussion from back when we almost had POI as the filter for KOffice if politics and licenses hadn't killed iit</link>
|
||||
</li>
|
||||
<li>
|
||||
<link href="http://www.oreillynet.com/pub/wlg/1552?page=last&x-showcontent=text">Java discussion on O'Reilly Network including discussion about POI</link> - O'Reilly.net
|
||||
</li>
|
||||
<li>
|
||||
<link href="http://www.rollerweblogger.org/page/roller/20020715">Poor Obfuscation Implementation.</link> - Blog of David M. Johnson
|
||||
</li>
|
||||
<li>
|
||||
<link href="http://www.jsurfer.org/article.php?sid=322">
|
||||
POI 1.5-dev-rc2 released </link> - JSurfer
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<link href="http://directory.google.com/Top/Computers/Programming/Languages/Java/Class_Libraries/Data_Formats/Microsoft_Formats/"> Google says we're the most important in our category </link>
|
||||
</li>
|
||||
<li>
|
||||
<link href="http://www.javaworld.com/javaworld/javaqa/2002-05/01-qa-0503-excel3.html">It's POI-fect</link> - Tony Sintes, Javaworld
|
||||
</li>
|
||||
<li>
|
||||
<link href="http://www.need-a-cake.com/categories/cocoonWeblog/2002/03/07.html">
|
||||
Nicola announces POI serialization code
|
||||
</link> - Matthew Langham's Radio Weblog
|
||||
</li>
|
||||
<li>
|
||||
<link href="http://javalobby.org/discussionContext/showThreaded/frm/javalobby?folderId=20&discussionContextId=11523">
|
||||
Jakarta POI 1.4583 Released</link> - JavaLobby
|
||||
</li>
|
||||
<li>
|
||||
<link href="http://javalobby.org/discussionContext/showThreaded/frm/javalobby?discussionContextId=11442&folderId=20">
|
||||
POI project moves to Jakarta (OLE 2 CDF/Excel/Word in
|
||||
pure java)</link> - JavaLobby
|
||||
</li>
|
||||
<li>
|
||||
<link
|
||||
href="http://www.geocities.com/marcoschmidt.geo/java-image-coding.html">
|
||||
List of Java libraries to read and write image and document files
|
||||
</link> Marco Schmidt's homepage (normally we wouldn't
|
||||
feature someone's homepage but its an extensive list of
|
||||
information including "alternatives to POI" (for those
|
||||
of you who are very wealthy). But heck I think I'll
|
||||
bookmark his page for myself since he's like got every
|
||||
piece of info known to man linked or featured on it!
|
||||
</li>
|
||||
<li>
|
||||
<link href="http://radio.weblogs.com/0101350/">
|
||||
The Experiences of an Operator (Måns af Klercker)
|
||||
</link> - radio.weblogs.com
|
||||
</li>
|
||||
<li>
|
||||
<link href="http://dataconv.org/apps_office.html">
|
||||
DATACONV - Data Conversion Tools: Office
|
||||
</link> DATACONV
|
||||
</li>
|
||||
<li>
|
||||
<link href="http://chicago.sourceforge.net/devel/">
|
||||
Chicago Developer Page
|
||||
</link>
|
||||
</li>
|
||||
<li>
|
||||
<link href="http://www.onjava.com/pub/d/1157">
|
||||
POI/POI Serialization Project
|
||||
</link> - Man you know you've hit the bigtime when
|
||||
O'Reilly Likes you.. ;-)
|
||||
</li>
|
||||
<li>
|
||||
<link
|
||||
href="http://www.javaworld.com/netnews/index.shtml">
|
||||
News Around the Net
|
||||
</link> - Java World
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</section>
|
||||
<section><title>Nederlandstalige (Dutch)</title>
|
||||
<ul>
|
||||
<li>
|
||||
<link
|
||||
href="http://www.ster.be/java/java9.html">
|
||||
Een Excel-werkboek maken vanuit Java - Lieven Smits
|
||||
</link>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
<section><title>Deutsch (German)</title>
|
||||
<ul>
|
||||
<li> <link
|
||||
href="http://www.entwickler.com/itr/news/show.php3?id=6132&nodeid=82 ">Apache POI verffentlicht</link> - entwicker.com
|
||||
</li>
|
||||
<li>
|
||||
<link
|
||||
href="http://www.jsp-develop.de/newsletter/10/">
|
||||
Apache Jakarta-Projekt bringt Word und Excel in die Java-Welt </link> - jsp-develop.de (for the misguided who use JSP ;-) )
|
||||
</li>
|
||||
<li>
|
||||
<link
|
||||
href="http://www.entwickler.com/news/2002/02/5718/news.shtml">
|
||||
Neues Apache-Projekt bringt Word- und Excel nach Java
|
||||
</link> - entwickler.com
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
<section><title>Español (Spanish)</title>
|
||||
<ul>
|
||||
<li>
|
||||
<link href="http://www.javahispano.com/noticias/todas.jsp">
|
||||
OLE2 desde Java nativo
|
||||
</link> - javaHispano
|
||||
</li>
|
||||
<li>
|
||||
<link href="http://p2p.wrox.com/archive/java_espanol/2002-08/3.asp">Spanish discussion about Excel and Java including POI from Wrox forums</link>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
<section><title>Francais (French)</title>
|
||||
<ul>
|
||||
<li>
|
||||
<link href="http://linuxfr.org/section/D%E9veloppeur,0,1,8,0.html">
|
||||
Excel/OLE accessibles
|
||||
</link> - Da Linux French Page
|
||||
</li>
|
||||
<li>
|
||||
<link href="http://www.sogid.com/javalist/f2002/traiter_word_java.html">Discussion on POI in French</link>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
<section><title>Nihongo (Japanese)</title>
|
||||
<ul>
|
||||
<li>
|
||||
<link href="http://drpanda.freezope.org/Memo/docs/jakarta/poi/poi_sample">100% PureJava...</link> - Dr. Panda Portal
|
||||
</li>
|
||||
<li>
|
||||
<link
|
||||
href="http://www.gimlay.org/~andoh/java/javanew.html">
|
||||
What's new with java?
|
||||
</link> - gimlay.org
|
||||
</li>
|
||||
<li><link href="http://taka-2.com/jclass/POI/">Java?Excel?????</link> - appears to show how to use Japanese with POI</li>
|
||||
<li><link href="http://www.tech-arts.co.jp/macosx/webobjects-jp/htdocs/3200/3218.html">Various discussion in Japanese including on POI</link></li>
|
||||
<li><link href="http://muimi.com/j/jakarta/">Japanese resources on Jakarta projects including POI</link></li>
|
||||
<li><link href="http://www.fk.urban.ne.jp/home/kishida/">Kishida's site</link> various information, includes a snip about POI and Japanese.</li>
|
||||
|
||||
</ul>
|
||||
</section>
|
||||
<section><title>Dunno how to say Russian in Russian (Russian)</title>
|
||||
<ul>
|
||||
<li>
|
||||
<link href="http://www.nestor.minsk.by/kg/kg02/21/kg22108.html">
|
||||
Probably a translation of the Javalobby announcement of 1.5-final
|
||||
</link> Java-???????
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
<section><title>Dunno how to say Korean in Korean (Korean)</title>
|
||||
<ul>
|
||||
<li>
|
||||
<link href="http://www.javabrain.co.kr/AnswerView?questionId=1189&categoryId=8">Various discussion in Korean about Excel output/APIs including POI</link>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
<section><title>No freaking idea</title>
|
||||
<p>
|
||||
If you can read one of these languages, send mail to the list
|
||||
telling us what language it is and we'll categorize it!
|
||||
</p>
|
||||
<ul>
|
||||
<li>
|
||||
<link
|
||||
href="http://www.javacentrix.com/index.htm">
|
||||
If I had to guess, I'd say this is Thai, but
|
||||
maybe you actually know</link> - javacentrix.com
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
</body>
|
||||
<footer>
|
||||
<legal>
|
||||
Copyright (c) @year@ The Apache Software Foundation All rights reserved.
|
||||
$Revision$ $Date$
|
||||
</legal>
|
||||
</footer>
|
||||
</document>
|
20
src/documentation/content/xdocs/news/book.xml
Normal file
20
src/documentation/content/xdocs/news/book.xml
Normal file
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- Copyright (C) 2004 The Apache Software Foundation. All rights reserved. -->
|
||||
<!DOCTYPE book PUBLIC "-//APACHE//DTD Cocoon Documentation Book V1.0//EN" "../dtd/book-cocoon-v10.dtd">
|
||||
|
||||
<book software="Poi Project"
|
||||
title="Poi Project News Pages"
|
||||
copyright="@year@ Poi Project">
|
||||
|
||||
<menu label="Navigation">
|
||||
<menu-item label="Main" href="../index.html"/>
|
||||
</menu>
|
||||
|
||||
<menu label="News">
|
||||
<menu-item label="Logo Submissions" href="logocontest.html"/>
|
||||
</menu>
|
||||
|
||||
|
||||
</book>
|
||||
|
||||
|
175
src/documentation/content/xdocs/news/logocontest.xml
Normal file
175
src/documentation/content/xdocs/news/logocontest.xml
Normal file
@ -0,0 +1,175 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!-- Copyright (C) 2004 The Apache Software Foundation. All rights reserved. -->
|
||||
<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.1//EN" "document-v11.dtd">
|
||||
|
||||
<document>
|
||||
<header>
|
||||
<title></title>
|
||||
<authors>
|
||||
<person id="AO" name="Andrew C. Oliver" email="acoliver@apache.org"/>
|
||||
<person id="GS" name="Glen Stampoultzis" email="glens@apache.org"/>
|
||||
</authors>
|
||||
</header>
|
||||
|
||||
<body>
|
||||
<section><title>POI logos</title>
|
||||
<p>
|
||||
Here are the current logo submissions. Thanks to the artists!
|
||||
</p>
|
||||
<section><title>Michael Mosmann</title>
|
||||
<p>
|
||||
<img alt="logo" src="images/logoMichaelMosmann.png"/>
|
||||
</p>
|
||||
</section>
|
||||
<section><title>Loïc Lefèvre</title>
|
||||
<p>
|
||||
<img alt="logo" src="images/logoLoicLefevre.png"/>
|
||||
<img alt="logo" src="images/logoLoicLefevre2.png"/>
|
||||
</p>
|
||||
</section>
|
||||
<section><title>Glen Stampoultzis</title>
|
||||
<p>
|
||||
<img alt="logo" src="images/logoGlenStampoutlzis.png"/>
|
||||
</p>
|
||||
</section>
|
||||
<section><title>Marcus Gustafsson</title>
|
||||
<p>
|
||||
<img alt="logo" src="images/logoGustafsson1.png"/>
|
||||
<img alt="logo" src="images/logoGustafsson2.png"/>
|
||||
</p>
|
||||
</section>
|
||||
<section><title>Adrianus Handoyo</title>
|
||||
<p>
|
||||
<img alt="logo" src="images/logoAdria1.png"/>
|
||||
<img alt="logo" src="images/logoAdria2.png"/>
|
||||
<img alt="logo" src="images/logoAdria3.png"/>
|
||||
</p>
|
||||
</section>
|
||||
<section><title>RussellBeattie</title>
|
||||
<p>
|
||||
<img alt="logo" src="images/logoRussellBeattie1.png"/>
|
||||
<img alt="logo" src="images/logoRussellBeattie2.png"/>
|
||||
<img alt="logo" src="images/logoRussellBeattie3.png"/>
|
||||
</p>
|
||||
<p>
|
||||
<img alt="logo" src="images/logoRussellBeattie4.png"/>
|
||||
<img alt="logo" src="images/logoRussellBeattie5.png"/>
|
||||
</p>
|
||||
</section>
|
||||
<section><title>Daniel Fernandez</title>
|
||||
<p>
|
||||
<img alt="logo" src="images/logoDanielFernandez.png"/>
|
||||
</p>
|
||||
</section>
|
||||
<section><title>Andrew Clements</title>
|
||||
<p>
|
||||
<img alt="logo" src="images/logoAndrewClements.png"/>
|
||||
<img alt="logo" src="images/logoAndrewClements2.png"/>
|
||||
</p>
|
||||
</section>
|
||||
<section><title>Wendy Wise</title>
|
||||
<p>
|
||||
<img alt="logo" src="images/logoWendyWise.png"/>
|
||||
<img alt="logo" src="images/logoWendyWise2.png"/>
|
||||
</p>
|
||||
</section>
|
||||
<section><title>Nikhil Karmokar</title>
|
||||
<p>
|
||||
<img alt="logo" src="images/logoKarmokar1.png"/>
|
||||
<img alt="logo" src="images/logoKarmokar1s.png"/>
|
||||
</p>
|
||||
<p>
|
||||
<img alt="logo" src="images/logoKarmokar2.png"/>
|
||||
<img alt="logo" src="images/logoKarmokar2s.png"/>
|
||||
</p>
|
||||
<p>
|
||||
<img alt="logo" src="images/logoKarmokar3.png"/>
|
||||
<img alt="logo" src="images/logoKarmokar3s.png"/>
|
||||
</p>
|
||||
<p>
|
||||
<img alt="logo" src="images/logoKarmokar4.png"/>
|
||||
<img alt="logo" src="images/logoKarmokar4s.png"/>
|
||||
</p>
|
||||
<p>
|
||||
<img alt="logo" src="images/logoKarmokar5.png"/>
|
||||
<img alt="logo" src="images/logoKarmokar5s.png"/>
|
||||
</p>
|
||||
<p>
|
||||
<img alt="logo" src="images/logoKarmokar6.png"/>
|
||||
<img alt="logo" src="images/logoKarmokar6s.png"/>
|
||||
</p>
|
||||
</section>
|
||||
<section><title>Lieven Janssen</title>
|
||||
<p>
|
||||
<img alt="logo" src="images/logoJanssen1.png"/>
|
||||
<img alt="logo" src="images/logoJanssen2.png"/>
|
||||
</p>
|
||||
</section>
|
||||
<section><title>RaPi GmbH</title>
|
||||
<p>
|
||||
Contact Person: Fancy at: fancy at my-feiqi.com
|
||||
</p>
|
||||
<p>
|
||||
<img alt="logo" src="images/logoRaPiGmbH1.png"/>
|
||||
<img alt="logo" src="images/logoRaPiGmbH2.png"/>
|
||||
</p>
|
||||
<p>
|
||||
<img alt="logo" src="images/logoRaPiGmbH5.png"/>
|
||||
</p>
|
||||
<p>
|
||||
<img alt="logo" src="images/logoRaPiGmbH6.png"/>
|
||||
</p>
|
||||
<p>
|
||||
<img alt="logo" src="images/logoRaPiGmbH7.png"/>
|
||||
</p>
|
||||
<p>
|
||||
<img alt="logo" src="images/logoRaPiGmbH8.png"/>
|
||||
</p>
|
||||
<p>
|
||||
<img alt="logo" src="images/logoRaPiGmbH9.png"/>
|
||||
</p>
|
||||
<p>
|
||||
<img alt="logo" src="images/logoRaPiGmbH10.png"/>
|
||||
</p>
|
||||
<p>
|
||||
<img alt="logo" src="images/logoRaPiGmbH11.png"/>
|
||||
</p>
|
||||
<p>
|
||||
<img alt="logo" src="images/logoRaPiGmbH12.png"/>
|
||||
</p>
|
||||
</section>
|
||||
<section><title>Randy Stanard</title>
|
||||
<p>
|
||||
<img alt="logo" src="images/logoRandyStanard01.png"/>
|
||||
</p>
|
||||
<p>
|
||||
<img alt="logo" src="images/logoRandyStanard02.png"/>
|
||||
</p>
|
||||
<p>
|
||||
<img alt="logo" src="images/logoRandyStanard03.png"/>
|
||||
</p>
|
||||
<p>
|
||||
<img alt="logo" src="images/logoRandyStanard04.png"/>
|
||||
</p>
|
||||
<p>
|
||||
<img alt="logo" src="images/logoRandyStanard05.png"/>
|
||||
</p>
|
||||
<p>
|
||||
<img alt="logo" src="images/logoRandyStanard06.png"/>
|
||||
</p>
|
||||
<p>
|
||||
<img alt="logo" src="images/logoRandyStanard07.png"/>
|
||||
</p>
|
||||
<p>
|
||||
<img alt="logo" src="images/logoRandyStanard08.png"/>
|
||||
</p>
|
||||
</section>
|
||||
</section>
|
||||
</body>
|
||||
<footer>
|
||||
<legal>
|
||||
Copyright (c) @year@ The Apache Software Foundation All rights reserved.
|
||||
$Revision$ $Date$
|
||||
</legal>
|
||||
</footer>
|
||||
</document>
|
71
src/documentation/content/xdocs/overview.xml
Normal file
71
src/documentation/content/xdocs/overview.xml
Normal file
@ -0,0 +1,71 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Copyright (C) 2004 The Apache Software Foundation. All rights reserved. -->
|
||||
<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.1//EN" "./dtd/document-v11.dtd">
|
||||
|
||||
<document>
|
||||
<header>
|
||||
<title>Overview</title>
|
||||
<authors>
|
||||
<person id="AO" name="Andrew C. Oliver" email="acoliver2@users.sourceforge.net"/>
|
||||
</authors>
|
||||
</header>
|
||||
|
||||
<body>
|
||||
<section><title>What is it?</title>
|
||||
<p>The POI project is the master project for developing pure
|
||||
Java ports of file formats based on Microsoft's OLE 2 Compound
|
||||
Document Format. OLE 2 Compound Document Format is used by
|
||||
Microsoft Office Documents, as well as by programs using MFC
|
||||
property sets to serialize their document objects.
|
||||
</p>
|
||||
</section>
|
||||
<section><title>Sub-Projects</title>
|
||||
<p>
|
||||
There following are ports, packages or components contained in the POI project.
|
||||
</p>
|
||||
<section><title>POIFS</title>
|
||||
<p>
|
||||
<link href="poifs/index.html">POIFS</link> is the set of APIs
|
||||
for reading and writing OLE 2 Compound Document Formats using (only) Java.
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<section><title>HSSF</title>
|
||||
<p>
|
||||
<link href="hssf/index.html">HSSF</link> is the set of APIs
|
||||
for reading and writing Microsoft Excel 97(-XP) spreadsheet using (only) Java.
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<section><title>HDF</title>
|
||||
<p>
|
||||
<link href="hdf/index.html">HDF</link> is the set of APIs
|
||||
for reading and writing Microsoft Word 97(-XP) spreadsheet using (only) Java.
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<section><title>HPSF</title>
|
||||
<p>
|
||||
<link href="hpsf/index.html">HPSF</link> is the set of APIs
|
||||
for reading property sets using (only) Java.
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<section><title>POI-Utils</title>
|
||||
<p>
|
||||
<link href="utils/index.html">POI-Utils</link> are general purpose artifacts
|
||||
from POI development that have not yet been implemented elsewhere. We're
|
||||
always looking to donate these and maintain them as part of a general library
|
||||
used in another project. These are things we need to complete our mission but
|
||||
are generally outside of it.
|
||||
</p>
|
||||
</section>
|
||||
</section>
|
||||
</body>
|
||||
<footer>
|
||||
<legal>
|
||||
Copyright (c) @year@ The Poi Project All rights reserved.
|
||||
$Revision$ $Date$
|
||||
</legal>
|
||||
</footer>
|
||||
</document>
|
74
src/documentation/content/xdocs/patches.xml
Normal file
74
src/documentation/content/xdocs/patches.xml
Normal file
@ -0,0 +1,74 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Copyright (C) 2004 The Apache Software Foundation. All rights reserved. -->
|
||||
<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.1//EN" "./dtd/document-v11.dtd">
|
||||
<!-- Is this being used? -->
|
||||
|
||||
<document>
|
||||
<header>
|
||||
<title>Patch Queue</title>
|
||||
<authors>
|
||||
<person email="greenrd@hotmail.com" name="Robin Green"/>
|
||||
<person email="barozzi@nicolaken.com" name="Nicola Ken Barozzi"/>
|
||||
</authors>
|
||||
</header>
|
||||
<body>
|
||||
<section>
|
||||
<title>Introduction</title>
|
||||
<p>
|
||||
This is an
|
||||
<strong>informal</strong> list - in chronological order -
|
||||
of some of the noteworthy patches that have been posted
|
||||
to the
|
||||
<code>developers</code> mailing list.
|
||||
These patches are not (yet) part of the Poi project, but need reviewing for possible
|
||||
inclusion. This system was instituted because, due to the large volume of mail and
|
||||
the lack of time of the committers, some patches tended to get forgotten about. This
|
||||
queue does not guarantee that any patch will be reviewed within a reasonable time frame,
|
||||
but it does at least make them easier to find!
|
||||
</p>
|
||||
<p>
|
||||
<strong>Reviewers wanted!</strong> - If you have time to review and/or test these patches,
|
||||
we would be grateful for your time. Please post comments to the dev mailing lists.
|
||||
</p>
|
||||
<p>
|
||||
Before submitting a patch, please read the page on
|
||||
<link href="contrib.xml">Third-Party
|
||||
Contributions</link>. The preferred submission method for patches is:
|
||||
</p>
|
||||
<ul>
|
||||
<li>Post to Poi developers list</li>
|
||||
<li>Describe the patch, the reason for it and (if necessary) why this is important.</li>
|
||||
<li>Generate the patch in
|
||||
<code>diff -u</code> format from CVS
|
||||
</li>
|
||||
<li>Also generate a documentation patch or new file, if this is something that should be documented.
|
||||
</li>
|
||||
<li>Post as an attachment rather than inline (unless it is trivially small).</li>
|
||||
</ul>
|
||||
<p>Following the above guidelines will facilitate your patch being reviewed
|
||||
and applied efficiently.</p>
|
||||
</section>
|
||||
<section>
|
||||
<title>Patch Queue</title>
|
||||
<p>
|
||||
<strong> [Under Construction] </strong> Archive links will be added later.
|
||||
<strong>Please do not bother the patch submitters/authors</strong> without first reading the
|
||||
relevant post(s) in the
|
||||
<link href="mail-archives.xml">mailing list archives.</link>
|
||||
</p>
|
||||
<p>Vapourware will not be listed.</p>
|
||||
<table>
|
||||
<tr>
|
||||
<th>id</th>
|
||||
<th>Summary</th>
|
||||
<th>Reviewer</th>
|
||||
<th>Resolution</th>
|
||||
<th>Status</th>
|
||||
</tr>
|
||||
</table>
|
||||
<p>See also additional list of patches to be added in
|
||||
<link href="todo.xml">To Do</link>.
|
||||
</p>
|
||||
</section>
|
||||
</body>
|
||||
</document>
|
510
src/documentation/content/xdocs/plan/POI10Vision.xml
Normal file
510
src/documentation/content/xdocs/plan/POI10Vision.xml
Normal file
@ -0,0 +1,510 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Copyright (C) 2004 The Apache Software Foundation. All rights reserved. -->
|
||||
<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.1//EN" "document-v11.dtd">
|
||||
|
||||
<document>
|
||||
<header>
|
||||
<title>POI 1.0 Vision Document</title>
|
||||
<authors>
|
||||
<person name="Andrew C. Oliver" email="acoliver@apache.org"/>
|
||||
<person name="Marcus W. Johnson" email="mjohnson@apache.org"/>
|
||||
</authors>
|
||||
</header>
|
||||
|
||||
<body>
|
||||
|
||||
<section><title>Preface</title>
|
||||
<p>
|
||||
(21-Jan-02) While this document is just full of useful project
|
||||
introductory information and I do suggest those interested in getting
|
||||
involved in the project read it, it is woefully out of date.
|
||||
</p>
|
||||
<p>
|
||||
We deliberately allowed this document to run out of date because it
|
||||
is a good reflection of what the original vision was for POI 1.0.
|
||||
You'll note that some of the terminology is not used in quite the same
|
||||
way any longer. I've made some minor corrections where reading this
|
||||
confused me. An example: in some places this document may refer to
|
||||
POI API instead of POIFS API. When this vision was written we had
|
||||
an incomplete understanding of the project.
|
||||
</p>
|
||||
<p>
|
||||
Lastly, the scope of the project expanded dramatically near the end
|
||||
of the 1.0 cycle. Our vision at the time was to focus merely on the
|
||||
Excel port (having no idea how the project would grow or be received)
|
||||
and provide the OLE 2 Compound Document port for others to port later
|
||||
formats. We now plan to spearhead these ports under the umbrella of
|
||||
the POI project. So, you've been warned. Read on, but just realize
|
||||
that we had a fuzzy view of things to come, and hindsight is 20-20.
|
||||
</p>
|
||||
<p>
|
||||
If I recall major holes were: a complete understanding of the format
|
||||
of OLE 2 Compound Document format, Excel file format, and exactly how
|
||||
Cocoon 2 Serializers worked. (that just about covers the whole range
|
||||
huh?)
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<section><title>1. Introduction</title>
|
||||
<section><title>1.1 Purpose of this document</title>
|
||||
<p>
|
||||
The purpose of this document is to
|
||||
collect, analyze and define high-level requirements, user needs and
|
||||
features of the HSSF Serializer for Cocoon 2 and related libraries.
|
||||
The HSSF Serializer is a java class supporting the Serializer
|
||||
interface from the Cocoon 2 project and outputting in a compatible
|
||||
format of that used by the spreadsheet program Microsoft Excel '97.
|
||||
The HSSF Serializer will be responsible for converting XML
|
||||
spreadsheet-like documents into Excel-compatible XLS spreadsheets.
|
||||
</p>
|
||||
</section>
|
||||
|
||||
|
||||
<section><title>1.2 Project Overview</title>
|
||||
<p>
|
||||
Many web apps today hit a brick wall
|
||||
when it comes to the user request that they be able to easily
|
||||
manipulate their reports and data extracts in the popular Microsoft
|
||||
Excel spreadsheet format. This often causes inferior technologies to be
|
||||
chosen for the project simply because they easily support this
|
||||
format. This project seeks to extend existing XML, Java and Apache
|
||||
Cocoon 2 project technologies by:
|
||||
</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
providing an extensible library
|
||||
(POIFS) which reads/writes in a compatable format to OLE 2 Compound
|
||||
Document Format (aka Structured Storage Format) for easy
|
||||
implementation of other document types;
|
||||
</li>
|
||||
<li>
|
||||
providing a library (HSSF) for
|
||||
manipulating spreadsheet data and outputting it in a compatible
|
||||
format to Microsoft Excel XLS format;
|
||||
</li>
|
||||
<li>
|
||||
and providing a Cocoon 2
|
||||
Serializer (HSSFSerializer) for serializing XML documents as
|
||||
Excel-compatible spreadsheets.
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</section>
|
||||
</section>
|
||||
<section><title>2. User Description</title>
|
||||
<section><title>2.1 User/Market Demographics</title>
|
||||
<p>
|
||||
There are a number of enthusiastic
|
||||
users of XML, UNIX and Java technology. Secondly, the Microsoft
|
||||
solution for outputting Office Document formats often involves
|
||||
actually manipulating the software as an OLE Server. This method
|
||||
provides extremely low performance, extremely high overhead and is
|
||||
only capable of handling one document at a time.
|
||||
</p>
|
||||
<ol>
|
||||
<li>
|
||||
Our intended audience for the HSSF
|
||||
Serializer portion of this project are developers writing reports or
|
||||
data extracts in XML format.
|
||||
</li>
|
||||
<li>
|
||||
Our intended audience for the HSSF
|
||||
library portion of this project is ourselves as we are developing
|
||||
the Serializer and anyone who needs to write to Excel spreadsheets
|
||||
in a non-XML Java environment or who has specific needs not
|
||||
addressed by the Serializer.
|
||||
</li>
|
||||
<li>
|
||||
Our intended audience for the
|
||||
"POIFS" OLE 2 Compound Document format reader/writer is
|
||||
ourselves as we are writing the HSSF library and secondly, anyone
|
||||
wishing to provide other libraries for reading/writing OLE 2
|
||||
Compound Document Format in Java.
|
||||
</li>
|
||||
</ol>
|
||||
</section>
|
||||
<section><title>2.2. User environment</title>
|
||||
<p>
|
||||
The users of this software shall be
|
||||
developers in a Java environment on any Operating System or power
|
||||
users who are capable of XML document generation/deployment.
|
||||
</p>
|
||||
</section>
|
||||
<section><title>2.3. Key User Needs</title>
|
||||
<p>
|
||||
The OLE 2 Compound Document format is
|
||||
undocumented for all practical purposes and cryptic for all
|
||||
impractical purposes. Developer needs in this area include
|
||||
documentation and an easy to use library for reading and writing in
|
||||
this format without requiring the developer to have intimate
|
||||
knowledge of the format.
|
||||
</p>
|
||||
<p>
|
||||
There is currently no good way to write
|
||||
to Microsoft Excel documents from Java or from a non-Microsoft
|
||||
Windows based platform for that matter. Developers need an easy to
|
||||
use library that supports a reasonable feature set and allows
|
||||
seperation of data from formatting/stylistic concerns.
|
||||
</p>
|
||||
<p>
|
||||
There is currently no good way to
|
||||
transform XML data to Microsoft Excel. Apache's Cocoon 2 project
|
||||
supplies a complete framework for XML, but nothing for outputting in
|
||||
Excel's XLS format. Developers and power users alike need a simple
|
||||
method to output XML documents to Excel through server-side
|
||||
processing.
|
||||
</p>
|
||||
|
||||
|
||||
</section>
|
||||
<section><title>2.4. Alternatives and Competition</title>
|
||||
<p>
|
||||
Originally there weren't any decent <link href="../hssf/alternatives.html">alternatives</link> for reading or writing
|
||||
to Excel. This has changed somewhat.
|
||||
</p>
|
||||
</section>
|
||||
</section>
|
||||
<section><title>3. Project Overview</title>
|
||||
<section><title>3.1. Project Perspective</title>
|
||||
<p>
|
||||
The produced code shall be licensed by
|
||||
the Apache License as used by the Cocoon 2 project and maintained on
|
||||
a project page until such time as the Cocoon 2 developers accept it
|
||||
as a donation (at which time the copyright will be turned over to
|
||||
them).
|
||||
</p>
|
||||
</section>
|
||||
<section><title>3.2. Project Position Statement</title>
|
||||
<p>
|
||||
For developers on a Java and/or XML
|
||||
environment this project will provide all the tools necessary for
|
||||
outputting XML data in the Microsoft Excel format. This project seeks
|
||||
to make the use of Microsoft Windows based servers unnecessary for
|
||||
file format considerations and to fully document the OLE 2 Compound
|
||||
Document format. The project aims not only to provide the tools for
|
||||
serializing XML to Excel's file format and the tools for writing to
|
||||
that file format from Java, but also to provide the tools for later
|
||||
projects to convert other OLE 2 Compound Document formats to pure
|
||||
Java APIs.
|
||||
</p>
|
||||
</section>
|
||||
<section><title>3.3. Summary of Capabilities</title>
|
||||
<p>
|
||||
HSSF Serializer for Apache Cocoon 2
|
||||
</p>
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
Benefit
|
||||
</td>
|
||||
<td>
|
||||
Supporting Features
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
Standard XML tag language for sheet data
|
||||
</td>
|
||||
<td>
|
||||
Serializer will transform documents utilizing a defined tag
|
||||
language
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
Utilize XML to output in Excel
|
||||
</td>
|
||||
<td>
|
||||
Serializer will output in Excel
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
Java API to output in Excel on any platform
|
||||
</td>
|
||||
<td>
|
||||
The project will develop an API that outputs in Excel using
|
||||
pure Java.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
Make it easy for developers to port other OLE 2 Compound
|
||||
Document-based formats to Java.
|
||||
</td>
|
||||
<td>
|
||||
The POIFS library will contain both a high-level abstraction
|
||||
along with low-level constructs. The project will fully document
|
||||
the OLE 2 Compound Document Format.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</section>
|
||||
<section><title>3.4. Assumptions and Dependencies</title>
|
||||
<ul>
|
||||
<li>
|
||||
The HSSF Serializer will run on
|
||||
any Java 2 supporting platform with Apache Cocoon 2 installed along
|
||||
with the HSSF and POIFS APIs.
|
||||
</li>
|
||||
<li>
|
||||
The HSSF API requires a Java 2
|
||||
implementation and the POI API.
|
||||
</li>
|
||||
<li>
|
||||
The POIFS API requires a Java 2
|
||||
implementation.
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
</section>
|
||||
<section><title>4. Project Features</title>
|
||||
<p>
|
||||
The POIFS API will include:
|
||||
</p>
|
||||
<ul>
|
||||
<li>
|
||||
Low level structures representing
|
||||
the structures in a POI filesystems.
|
||||
</li>
|
||||
<li>
|
||||
A low-level API for
|
||||
creating/manipulating POI filesystems.
|
||||
</li>
|
||||
<li>
|
||||
A set of high level interfaces
|
||||
abstracting the user from the POI filesystem constructs and
|
||||
representing it as a standard filesystem (Files, directories, etc)
|
||||
</li>
|
||||
</ul>
|
||||
<p>
|
||||
The HSSF API will include:
|
||||
</p>
|
||||
<ul>
|
||||
<li>
|
||||
Low level structures representing
|
||||
the structures in an Excel file.
|
||||
</li>
|
||||
<li>
|
||||
A low-level API for creating and
|
||||
manipulating Excel files and writing them into POI filesystems.
|
||||
</li>
|
||||
<li>
|
||||
A high level model and style
|
||||
interface for manipulating spreadsheet data without knowing anything
|
||||
about the Excel format itself.
|
||||
</li>
|
||||
</ul>
|
||||
<section><title>4.1 POI Filesystem API</title>
|
||||
<p>
|
||||
The POI Filesystem API includes:
|
||||
</p>
|
||||
<ul>
|
||||
<li>An implementation of Big Blocks</li>
|
||||
<li>An implementation of Small Blocks</li>
|
||||
<li>An implementation of Header Blocks</li>
|
||||
<li>An implementation of Block Allocation Tables</li>
|
||||
<li>An implementation of Property Sets</li>
|
||||
<li>An implementation of the POI
|
||||
filesystem including functions to get and set the above constructs;
|
||||
compound functions for reading/writing files/directories.
|
||||
</li>
|
||||
<li>An abstraction of the POI
|
||||
filesystem providing interfaces representing Files, Directories,
|
||||
FileSystems in normal terminology and encapulating the above
|
||||
constructs.
|
||||
</li>
|
||||
<li>Full documentation of the POI file
|
||||
format.
|
||||
</li>
|
||||
<li>Full documentation of the APIs and
|
||||
interfaces provided through Javadoc, user documentation (aimed at
|
||||
developers using the APIs)
|
||||
</li>
|
||||
<li>Examples aimed at teaching the
|
||||
user to write code using POI. (titled: recipes for POI)
|
||||
</li>
|
||||
<li>Performance specifications.
|
||||
(Example POI filesystems rated by some measure of complexity along
|
||||
with system specifications and execution times for given operations)
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
<section><title>4.2 HSSF API</title>
|
||||
<p>
|
||||
The HSSF API includes:
|
||||
</p>
|
||||
<ul>
|
||||
<li>An implementation of Record
|
||||
(binary 2 byte type followed by 2 byte size (n) followed by n bytes)</li>
|
||||
<li>Implementations of many standard
|
||||
record types mapping the data bytes to fields along with methods to
|
||||
reserialize those fields</li>
|
||||
<li>An implementation of the HSSF File
|
||||
including functions to get/set the above constructs, create a blank
|
||||
file with the minimum required record types and mappings between
|
||||
getting/setting data and style in a workbook to the creation of
|
||||
record types, and read HSSF files.</li>
|
||||
<li>An abstraction of the HSSF file
|
||||
format providing interfaces representing the HSSF File, HSSF
|
||||
Workbook, HSSF Sheet, HSSF Column, HSSF Formulas in a manner
|
||||
seperating the data from the styling and encapsulating the above
|
||||
constructs.</li>
|
||||
<li>Full documentation of the HSSF
|
||||
file format (which will be a subset of the Excel '97 File format).
|
||||
This must be done with care for legal reasons.</li>
|
||||
<li>Full documentation of the APIs and
|
||||
interfaces provided through Javadoc, user documentation (aimed at
|
||||
developers using the apis).</li>
|
||||
<li>Examples aimed at teaching
|
||||
developers to use the APIs.
|
||||
</li>
|
||||
<li>Performance specifications.
|
||||
(Example files rated by some measure of complexity along with system
|
||||
specifications and execution times for given operations - possibly
|
||||
the same files used for POI's tests)</li>
|
||||
</ul>
|
||||
</section>
|
||||
<section><title>4.3 HSSF Serializer</title>
|
||||
<p>
|
||||
The HSSF Serializer subproject:
|
||||
</p>
|
||||
<ul>
|
||||
<li>A class supporting the Cocoon 2
|
||||
Serializer Interface.</li>
|
||||
<li>An interface between the SAX
|
||||
events and the HSSF APIs.</li>
|
||||
<li>A specified tag language for using
|
||||
with the Serializer.</li>
|
||||
<li>Documentation on the tag language
|
||||
for the HSSF Serializer</li>
|
||||
<li>Normal javadocs.</li>
|
||||
<li>Example XML files</li>
|
||||
<li>Performance specifications.
|
||||
(Example XML docs and stylesheets rated by some measure of
|
||||
complexity along with system specifications and execution times)</li>
|
||||
</ul>
|
||||
</section>
|
||||
</section>
|
||||
<section><title>5. Other Product Requirements</title>
|
||||
<section><title>5.1. Applicable Standards</title>
|
||||
<p>
|
||||
All Java code will be 100% pure Java.
|
||||
</p>
|
||||
</section>
|
||||
<section><title>5.2. System Requirements</title>
|
||||
<p>
|
||||
The minimum system requirements for POIFS are:
|
||||
</p>
|
||||
<ul>
|
||||
<li>64 Mbytes memory</li>
|
||||
<li>Java 2 environment</li>
|
||||
<li>Pentium or better processor (or equivalent on other platforms)</li>
|
||||
</ul>
|
||||
<p>
|
||||
The minimum system requirements for HSSF are:
|
||||
</p>
|
||||
<ul>
|
||||
<li>64 Mbytes memory</li>
|
||||
<li>Java 2 environment</li>
|
||||
<li>Pentium or better processor (or equivalent on other platforms)</li>
|
||||
<li>POIFS API</li>
|
||||
</ul>
|
||||
<p>
|
||||
The minimum system requirements for the HSSF Serializer are:
|
||||
</p>
|
||||
<ul>
|
||||
<li>64 Mbytes memory</li>
|
||||
<li>Java 2 environment</li>
|
||||
<li>Pentium or better processor (or equivalent on other platforms)</li>
|
||||
<li>Cocoon 2</li>
|
||||
<li>HSSF API</li>
|
||||
<li>POI API</li>
|
||||
</ul>
|
||||
</section>
|
||||
<section><title>5.3. Performance Requirements</title>
|
||||
<p>
|
||||
All components must perform well enough
|
||||
to be practical for use in a webserver environment (especially
|
||||
Cocoon2/Tomcat/Apache combo)
|
||||
</p>
|
||||
</section>
|
||||
<section><title>5.4. Environmental Requirements</title>
|
||||
<p>
|
||||
The software will run primarily in
|
||||
developer environments. We should make some allowances for
|
||||
not-highly-technical users to write XML documents for the HSSF
|
||||
Serializer. All other components will assume intermediate Java 2
|
||||
knowledge. No XML knowledge will be required except for using the
|
||||
HSSF Serializer. As much documentation as is practical shall be
|
||||
required for all components as XML is relatively new, and the
|
||||
concepts introduced for writing spreadsheets and to POI filesystems
|
||||
will be brand new to Java and many Java developers.
|
||||
</p>
|
||||
</section>
|
||||
</section>
|
||||
<section><title>6. Documentation Requirements</title>
|
||||
<section><title>6.1 POI Filesystem</title>
|
||||
<p>
|
||||
The filesystem as read and written by
|
||||
POI shall be fully documented and explained so that the average Java
|
||||
developer can understand it.
|
||||
</p>
|
||||
</section>
|
||||
<section><title>6.2. POI API</title>
|
||||
<p>
|
||||
The POI API will be fully documented
|
||||
through Javadoc. A walkthrough of using the high level POI API shall
|
||||
be provided. No documentation outside of the Javadoc shall be
|
||||
provided for the low-level POI APIs.
|
||||
</p>
|
||||
</section>
|
||||
<section><title>6.3. HSSF File Format</title>
|
||||
<p>
|
||||
The HSSF File Format as implemented by
|
||||
the HSSF API will be fully documented. No documentation will be
|
||||
provided for features that are not supported by HSSF API that are
|
||||
supported by the Excel 97 File Format. Care will be taken not to
|
||||
infringe on any "legal stuff".
|
||||
</p>
|
||||
</section>
|
||||
<section><title>6.4. HSSF API</title>
|
||||
<p>
|
||||
The HSSF API will be documented by
|
||||
javadoc. A walkthrough of using the high level HSSF API shall be
|
||||
provided. No documentation outside of the Javadoc shall be provided
|
||||
for the low level HSSF APIs.
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<section><title>6.5. HSSF Serializer</title>
|
||||
<p>
|
||||
The HSSF Serializer will be documented
|
||||
by javadoc.
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<section><title>6.6 HSSF Serializer Tag language</title>
|
||||
<p>
|
||||
The XML tag language along with
|
||||
function and usage shall be fully documented. Examples will be
|
||||
provided as well.
|
||||
</p>
|
||||
</section>
|
||||
</section>
|
||||
<section><title>7. Terminology</title>
|
||||
<section><title>7.1 Filesystem</title>
|
||||
<p>
|
||||
filesystem shall refer only to the POI formatted archive.
|
||||
</p>
|
||||
</section>
|
||||
<section><title>7.2 File</title>
|
||||
<p>
|
||||
file shall refer to the embedded data stream within a
|
||||
POI filesystem. This will be the actual embedded document.
|
||||
</p>
|
||||
</section>
|
||||
</section>
|
||||
</body>
|
||||
</document>
|
583
src/documentation/content/xdocs/plan/POI20Vision.xml
Normal file
583
src/documentation/content/xdocs/plan/POI20Vision.xml
Normal file
@ -0,0 +1,583 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Copyright (C) 2004 The Apache Software Foundation. All rights reserved. -->
|
||||
<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.1//EN" "document-v11.dtd">
|
||||
|
||||
<document>
|
||||
<header>
|
||||
<title>POI 2.0 Vision Document</title>
|
||||
<authors>
|
||||
<person name="Andrew C. Oliver" email="acoliver2@users.sourceforge.net"/>
|
||||
<person name="Marcus W. Johnson" email="mjohnson@apache.org"/>
|
||||
<person name="Glen Stampoultzis" email="gstamp@iprimus.com.au"/>
|
||||
<person name="Nicola Ken Barozzi" email="barozzi@nicolaken.com"/>
|
||||
</authors>
|
||||
</header>
|
||||
|
||||
<body>
|
||||
|
||||
<section><title>Preface</title>
|
||||
<p>
|
||||
This is the POI 2.0 cycle vision document. Although the vision
|
||||
has not changed and this document is certainly not out of date and
|
||||
the vision has not changed, the structure of the project has
|
||||
changed a bit. We're not going to change the vision document to
|
||||
reflect this (however proper that may be) because it would only
|
||||
involve deletion. There is no purpose in providing less
|
||||
information provided we give clarification.
|
||||
</p>
|
||||
<p>
|
||||
This document was created before the POI components for
|
||||
<link href="http://xml.apache.org/cocoon">Apache Cocoon</link>
|
||||
were accepted into the Cocoon project itself. It was also
|
||||
written before POI was accepted into Jakarta. So while the
|
||||
vision hasn't changed some of the components are actually now
|
||||
part of other projects. We'll still be working on them on the
|
||||
same timeline roughly (minus the overhead of coordination with
|
||||
other groups), but they are no longer technically part of the
|
||||
POI project itself.
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<section><title>1. Introduction</title>
|
||||
<section><title>1.1 Purpose of this document</title>
|
||||
<p>
|
||||
The purpose of this document is to
|
||||
collect, analyze and define high-level requirements, user needs,
|
||||
and features of the second release of the POI project software.
|
||||
The POI project currently consists of the following components:
|
||||
the HSSF Serializer, the HSSF library and the POIFS library.
|
||||
</p>
|
||||
<ul>
|
||||
<li>
|
||||
The HSSF Serializer is a set of Java classes whose main
|
||||
class supports the Serializer interface from the Cocoon
|
||||
2 project and outputs the serialized data in a format
|
||||
compatible with the spreadsheet program Microsoft Excel
|
||||
'97.
|
||||
</li>
|
||||
<li>
|
||||
The HSSF library is a set of classes for reading and
|
||||
writing Microsoft Excel 97 file format using pure Java.
|
||||
</li>
|
||||
<li>
|
||||
The POIFS library is a set of classes for reading and
|
||||
writing Microsoft's OLE 2 Compound Document format using
|
||||
pure Java.
|
||||
</li>
|
||||
</ul>
|
||||
<p>By the completion of this release cycle the POI project will also
|
||||
include the HSSF Generator and the HDF library.
|
||||
</p>
|
||||
<ul>
|
||||
<li>The HSSF Generator will be responsible for using HSSF to read
|
||||
in the XLS (Excel 97) file format and create SAX events. The HSSF
|
||||
Generator will support the applicable interfaces specified by the
|
||||
Apache Cocoon 2 project.
|
||||
</li>
|
||||
<li>The HDF library will provide a set of high level interfaces
|
||||
for reading and writing Microsoft Word 97 file format using pure
|
||||
Java.</li>
|
||||
</ul>
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
<section><title>1.2 Project Overview</title>
|
||||
<p>
|
||||
The first release of the POI project
|
||||
was an astounding success. This release seeks to build on that
|
||||
success by:
|
||||
</p>
|
||||
<ul>
|
||||
<li>
|
||||
Refactoring POIFS into imput and
|
||||
output classes as well as an event-driven API for reading.
|
||||
</li>
|
||||
<li>
|
||||
Refactor HSSF for greater
|
||||
performance as well as an event-driven API for reading
|
||||
</li>
|
||||
<li>
|
||||
Extend HSSF by adding the ability to read and write formulas.
|
||||
</li>
|
||||
<li>
|
||||
Extend HSSF by adding the ability to read and write
|
||||
user-defined styles.
|
||||
</li>
|
||||
<li>
|
||||
Create a Cocoon 2 Generator for HSSF using the same tags
|
||||
as the HSSF Serializer.
|
||||
</li>
|
||||
<li>
|
||||
Create a new library (HDF) for reading and writing
|
||||
Microsoft Word DOC format.
|
||||
</li>
|
||||
<li>
|
||||
Refactor the HSSFSerializer into a separate extensible
|
||||
POIFSSerializer and HSSFSerializer
|
||||
</li>
|
||||
<li>
|
||||
Providing the create excel charts. (write only)
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
</section>
|
||||
<section><title>2. User Description</title>
|
||||
<section><title>2.1 User/Market Demographics</title>
|
||||
<p>
|
||||
There are a number of enthusiastic
|
||||
users of XML, UNIX and Java technology. Furthermore, the Microsoft
|
||||
solution for outputting Office Document formats often involves
|
||||
actually manipulating the software as an OLE Server. This method
|
||||
provides extremely low performance, extremely high overhead and is
|
||||
only capable of handing one document at a time.
|
||||
</p>
|
||||
<ol>
|
||||
<li>
|
||||
Our intended audience for the HSSF
|
||||
Serializer portion of this project are developers writing reports or
|
||||
data extracts in XML format.
|
||||
</li>
|
||||
<li>
|
||||
Our intended audience for the HSSF
|
||||
library portion of this project is ourselves as we are developing
|
||||
the HSSF serializer and anyone who needs to read and write Excel
|
||||
spreadsheets in a non-XML Java environment, or who has specific
|
||||
needs not addressed by the Serializer
|
||||
</li>
|
||||
<li>
|
||||
Our intended audience for the
|
||||
POIFS library is ourselves as we are developing the HSSF and HDF
|
||||
libraries and anyone wishing to provide other libraries for
|
||||
reading/writing other file formats utilizing the OLE 2 Compound
|
||||
Document Format in Java.
|
||||
</li>
|
||||
<li>
|
||||
Our intended audience for the HSSF
|
||||
generator are developers who need to export Excel spreadsheets to
|
||||
XML in a non-proprietary environment.
|
||||
</li>
|
||||
<li>
|
||||
Our intended audience for the HDF
|
||||
library is ourselves, as we will be developing a HDF Serializer in a
|
||||
later release, and anyone wishing to add .DOC file processing and
|
||||
creation to their projects.
|
||||
</li>
|
||||
</ol>
|
||||
</section>
|
||||
<section><title>2.2. User environment</title>
|
||||
<p>
|
||||
The users of this software shall be
|
||||
developers in a Java environment on any operating system, or power
|
||||
users who are capable of XML document generation/deployment.
|
||||
</p>
|
||||
</section>
|
||||
<section><title>2.3. Key User Needs</title>
|
||||
<p>
|
||||
The HSSF library currently requires a
|
||||
full object representation to be created before reading values. This
|
||||
results in very high memory utilization. We need to reduce this
|
||||
substantially for reading. It would be preferable to do this for
|
||||
writing, but it may not be possible due to the constraints imposed by
|
||||
the file format itself. Memory utilization during read is our top
|
||||
user complaint.
|
||||
</p>
|
||||
<p>
|
||||
The POIFS library currently requires a
|
||||
full object representation to be created before reading values. This
|
||||
results in very high memory utilization. We need to reduce this
|
||||
substantially for reading.
|
||||
</p>
|
||||
<p>
|
||||
The HSSF library currently ignores
|
||||
formula cells and identifies them as "UnknownRecord" at the
|
||||
lower level of the API. We must provide a way to read and write
|
||||
formulas. This is now the top requested feature.
|
||||
</p>
|
||||
<p>
|
||||
The HSSF library currently does not support
|
||||
charts. This is a key requirement of some users who wish to use HSSF
|
||||
in a reporting engine.
|
||||
</p>
|
||||
<p>
|
||||
The HSSF Serializer currently does not
|
||||
provide serialization for cell styling. User's will want stylish
|
||||
spreadsheets to result from their XML.
|
||||
</p>
|
||||
<p>
|
||||
There is currently no way to generate
|
||||
the XML from an XLS that is consistent with the format used by the
|
||||
HSSF Serializer.
|
||||
</p>
|
||||
<p>
|
||||
There should be a way to read and write
|
||||
the DOC file format using pure Java.
|
||||
</p>
|
||||
|
||||
</section>
|
||||
<section><title>2.4. Alternatives and Competition</title>
|
||||
<p>
|
||||
Originally there weren't any decent <link href="../hssf/alternatives.html">alternatives</link> for reading or writing
|
||||
to Excel. This has changed somewhat.
|
||||
</p>
|
||||
</section>
|
||||
</section>
|
||||
<section><title>3. Project Overview</title>
|
||||
<section><title>3.1. Project Perspective</title>
|
||||
<p>
|
||||
The produced code shall be licensed by
|
||||
the Apache License as used by the Cocoon 2 project (APL 1.1) and
|
||||
maintained on at <link href="http://poi.sourceforge.net/">http://poi.sourceforge.net</link>
|
||||
and <link href="http://sourcefoge.net/projects/poi">http://sourcefoge.net/projects/poi</link>.
|
||||
It is our hope to at some point integrate with the various Apache
|
||||
projects (xml.apache.org and jakarta.apache.org), at which point we'd
|
||||
turn the copyright over to them.
|
||||
</p>
|
||||
</section>
|
||||
<section><title>3.2. Project Position Statement</title>
|
||||
<p>
|
||||
For developers on a Java and/or XML
|
||||
environment this project will provide all the tools necessary for
|
||||
outputting XML data in the Microsoft Excel format. This project seeks
|
||||
to make the use of Microsoft Windows based servers unnecessary for
|
||||
file format considerations and to fully document the OLE 2 Compound
|
||||
Document format. The project aims not only to provide the tools for
|
||||
serializing XML to Excel and Word file formats and the tools for
|
||||
writing to those file formats from Java, but also to provide the
|
||||
tools for later projects to convert other OLE 2 Compound Document
|
||||
formats to pure Java APIs.
|
||||
</p>
|
||||
</section>
|
||||
<section><title>3.3. Summary of Capabilities</title>
|
||||
<p>
|
||||
HSSF Serializer for Apache Cocoon 2
|
||||
</p>
|
||||
<table>
|
||||
<tr>
|
||||
<th>
|
||||
Benefit
|
||||
</th>
|
||||
<th>
|
||||
Supporting Features
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
Ability to serialize styles from XML spreadsheets.
|
||||
</td>
|
||||
<td>
|
||||
HSSFSerialzier will support styles.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
Ability to read and write formulas in XLS files.
|
||||
</td>
|
||||
<td>
|
||||
HSSF will support reading/writing formulas.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
Ability to output in MS Word on any platform using Java.
|
||||
</td>
|
||||
<td>
|
||||
The project will develop an API that outputs in Word format
|
||||
using pure Java.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
Enhance performance for reading and writing XLS files.
|
||||
</td>
|
||||
<td>
|
||||
HSSF will undergo a number of performance enhancements. HSSF
|
||||
will include a new event-based API for reading XLS files. POIFS
|
||||
will support a new event-based API for reading OLE2 CDF files.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
Ability to generate XML from XLS files
|
||||
</td>
|
||||
<td>
|
||||
The project will develop an HSSF Generator.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
The ability to generate charts
|
||||
</td>
|
||||
<td>
|
||||
HSSF will provide low level support for chart records as well
|
||||
as high level API support for generating charts. The ability
|
||||
to read chart information will not initially be provided.
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</section>
|
||||
<section><title>3.4. Assumptions and Dependencies</title>
|
||||
<ul>
|
||||
<li>
|
||||
The HSSF Serializer and Generator
|
||||
will support the Gnumeric 1.0 XML tag language.
|
||||
</li>
|
||||
<li>
|
||||
The HSSF Generator and HSSF
|
||||
Serializer will be mutually validating. It should be possible to
|
||||
have an XLS file created by the Serializer run through the Generator
|
||||
and the output back through the Serializer (via the Cocoon pipeline)
|
||||
and get the same file or a reasonable facimille (no one cares if it
|
||||
differs by the order of the binary records in some minor but
|
||||
non-visually recognizable manner).
|
||||
</li>
|
||||
<li>
|
||||
The HSSF Generator will run on any
|
||||
Java 2 supporting platform with Apache Cocoon 2 installed along with
|
||||
the HSSF and POIFS APIs.
|
||||
</li>
|
||||
<li>
|
||||
The HSSF Serializer will run on
|
||||
any Java 2 supporting platform with Apache Cocoon 2 installed along
|
||||
with the HSSF and POIFS APIs.
|
||||
</li>
|
||||
<li>
|
||||
The HDF API requires a Java 2
|
||||
implementation and the POIFS API.
|
||||
</li>
|
||||
<li>
|
||||
The HSSF API requires a Java 2
|
||||
implementation and the POIFS API.
|
||||
</li>
|
||||
<li>
|
||||
The POIFS API requires a Java 2
|
||||
implementation.
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</section>
|
||||
</section>
|
||||
<section><title>4. Project Features</title>
|
||||
<p>
|
||||
Enhancements to the POIFS API will
|
||||
include:
|
||||
</p>
|
||||
<ul>
|
||||
<li>
|
||||
An event driven API for reading
|
||||
POIFS Filesystems.
|
||||
</li>
|
||||
<li>
|
||||
A low-level API for
|
||||
creating/manipulating POI filesystems.
|
||||
</li>
|
||||
<li>
|
||||
Code improvements supporting
|
||||
greater separation between read and write structures.
|
||||
</li>
|
||||
</ul>
|
||||
<p>
|
||||
Enhancements to the HSSF API will
|
||||
include:
|
||||
</p>
|
||||
<ul>
|
||||
<li>
|
||||
An event driven API for reading
|
||||
XLS files.
|
||||
</li>
|
||||
<li>
|
||||
Performance improvements.
|
||||
</li>
|
||||
<li>
|
||||
Formula support (read/write)
|
||||
</li>
|
||||
<li>
|
||||
Support for user-defined data
|
||||
formats
|
||||
</li>
|
||||
<li>
|
||||
Better documentation of the file
|
||||
format and structure.
|
||||
</li>
|
||||
<li>
|
||||
An API for creation of charts.
|
||||
</li>
|
||||
</ul>
|
||||
<p>
|
||||
The HSSF Generator will include:
|
||||
</p>
|
||||
<ul>
|
||||
<li>
|
||||
A set of classes supporting the
|
||||
Cocoon 2 Generator interfaces providing a method for reading XLS
|
||||
files and outputting SAX events.
|
||||
</li>
|
||||
<li>
|
||||
The same tag format used by the
|
||||
HSSFSerializer in any given release.
|
||||
</li>
|
||||
</ul>
|
||||
<p>
|
||||
The HDF API will include:
|
||||
</p>
|
||||
<ul>
|
||||
<li>
|
||||
An event driven API for reading
|
||||
DOC files.
|
||||
</li>
|
||||
<li>
|
||||
A set of high and low level APIs
|
||||
for reading and writing DOC files.
|
||||
</li>
|
||||
<li>
|
||||
Documentation of the DOC file
|
||||
format or enhancements to existing documentation.
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
<section><title>5. Other Product Requirements</title>
|
||||
<section><title>5.1. Applicable Standards</title>
|
||||
<p>
|
||||
All Java code will be 100% pure Java.
|
||||
</p>
|
||||
</section>
|
||||
<section><title>5.2. System Requirements</title>
|
||||
<p>
|
||||
The minimum system requirements for the POIFS API are:
|
||||
</p>
|
||||
<ul>
|
||||
<li>64 Mbytes memory</li>
|
||||
<li>Java 2 environment</li>
|
||||
<li>Pentium or better processor (or equivalent on other platforms)</li>
|
||||
</ul>
|
||||
<p>
|
||||
The minimum system requirements for the the HSSF API are:
|
||||
</p>
|
||||
<ul>
|
||||
<li>64 Mbytes memory</li>
|
||||
<li>Java 2 environment</li>
|
||||
<li>Pentium or better processor (or equivalent on other platforms)</li>
|
||||
<li>POIFS API</li>
|
||||
</ul>
|
||||
<p>
|
||||
The minimum system requirements for the the HDF API are:
|
||||
</p>
|
||||
<ul>
|
||||
<li>64 Mbytes memory</li>
|
||||
<li>Java 2 environment</li>
|
||||
<li>Pentium or better processor (or equivalent on other platforms)</li>
|
||||
<li>POIFS API</li>
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
The minimum system requirements for the HSSF Serializer are:
|
||||
</p>
|
||||
<ul>
|
||||
<li>64 Mbytes memory</li>
|
||||
<li>Java 2 environment</li>
|
||||
<li>Pentium or better processor (or equivalent on other platforms)</li>
|
||||
<li>Cocoon 2</li>
|
||||
<li>HSSF API</li>
|
||||
<li>POI API</li>
|
||||
</ul>
|
||||
</section>
|
||||
<section><title>5.3. Performance Requirements</title>
|
||||
<p>
|
||||
All components must perform well enough
|
||||
to be practical for use in a webserver environment (especially
|
||||
the "killer trio": Cocoon2/Tomcat/Apache combo)
|
||||
</p>
|
||||
</section>
|
||||
<section><title>5.4. Environmental Requirements</title>
|
||||
<p>
|
||||
The software will run primarily in
|
||||
developer environments. We should make some allowances for
|
||||
not-highly-technical users to write XML documents for the HSSF
|
||||
Serializer. All other components will assume intermediate Java 2
|
||||
knowledge. No XML knowledge will be required except for using the
|
||||
HSSF Serializer. As much documentation as is practical shall be
|
||||
required for all components as XML is relatively new, and the
|
||||
concepts introduced for writing spreadsheets and to POI filesystems
|
||||
will be brand new to Java and many Java developers.
|
||||
</p>
|
||||
</section>
|
||||
</section>
|
||||
<section><title>6. Documentation Requirements</title>
|
||||
<section><title>6.1 POI Filesystem</title>
|
||||
<p>
|
||||
The filesystem as read and written by
|
||||
POI shall be fully documented and explained so that the average Java
|
||||
developer can understand it.
|
||||
</p>
|
||||
</section>
|
||||
<section><title>6.2. POI API</title>
|
||||
<p>
|
||||
The POI API will be fully documented
|
||||
through Javadoc. A walkthrough of using the high level POI API shall
|
||||
be provided. No documentation outside of the Javadoc shall be
|
||||
provided for the low-level POI APIs.
|
||||
</p>
|
||||
</section>
|
||||
<section><title>6.3. HSSF File Format</title>
|
||||
<p>
|
||||
The HSSF File Format as implemented by
|
||||
the HSSF API will be fully documented. No documentation will be
|
||||
provided for features that are not supported by HSSF API that are
|
||||
supported by the Excel 97 File Format. Care will be taken not to
|
||||
infringe on any "legal stuff". Additionally, we are
|
||||
collaborating with the fine folks at OpenOffice.org on
|
||||
*free* documentation of the format.
|
||||
</p>
|
||||
</section>
|
||||
<section><title>6.4. HSSF API</title>
|
||||
<p>
|
||||
The HSSF API will be documented by
|
||||
javadoc. A walkthrough of using the high level HSSF API shall be
|
||||
provided. No documentation outside of the Javadoc shall be provided
|
||||
for the low level HSSF APIs.
|
||||
</p>
|
||||
</section>
|
||||
<section><title>6.5 HDF API</title>
|
||||
<p>
|
||||
The HDF API will be documented by
|
||||
javadoc. A walkthrough of using the high level HDF API shall be
|
||||
provided. No documentation outside of the Javadoc shall be provided
|
||||
for the low level HDF APIs.
|
||||
</p>
|
||||
</section>
|
||||
<section><title>6.6 HSSF Serializer</title>
|
||||
<p>
|
||||
The HSSF Serializer will be documented
|
||||
by javadoc.
|
||||
</p>
|
||||
</section>
|
||||
<section><title>6.7 HSSF Generator</title>
|
||||
<p>
|
||||
The HSSF Generator will be documented
|
||||
by javadoc.
|
||||
</p>
|
||||
</section>
|
||||
<section><title>6.8 HSSF Serializer Tag language</title>
|
||||
<p>
|
||||
The XML tag language along with
|
||||
function and usage shall be fully documented. Examples will be
|
||||
provided as well.
|
||||
</p>
|
||||
</section>
|
||||
</section>
|
||||
<section><title>7. Terminology</title>
|
||||
<section><title>7.1 Filesystem</title>
|
||||
<p>
|
||||
filesystem shall refer only to the POI formatted archive.
|
||||
</p>
|
||||
</section>
|
||||
<section><title>7.2 File</title>
|
||||
<p>
|
||||
file shall refer to the embedded data stream within a
|
||||
POI filesystem. This will be the actual embedded document.
|
||||
</p>
|
||||
</section>
|
||||
</section>
|
||||
</body>
|
||||
</document>
|
21
src/documentation/content/xdocs/plan/book.xml
Normal file
21
src/documentation/content/xdocs/plan/book.xml
Normal file
@ -0,0 +1,21 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- Copyright (C) 2004 The Apache Software Foundation. All rights reserved. -->
|
||||
<!DOCTYPE book PUBLIC "-//APACHE//DTD Cocoon Documentation Book V1.0//EN" "../dtd/book-cocoon-v10.dtd">
|
||||
|
||||
<book software="Poi Project"
|
||||
title="Poi Project planning"
|
||||
copyright="@year@ Poi Project">
|
||||
|
||||
<menu label="Navigation">
|
||||
<menu-item label="Main" href="../index.html"/>
|
||||
</menu>
|
||||
|
||||
<menu label="Planning Documents">
|
||||
<menu-item label="1.0 Vision" href="POI10Vision.html"/>
|
||||
<menu-item label="2.0 Vision" href="POI20Vision.html"/>
|
||||
</menu>
|
||||
|
||||
|
||||
</book>
|
||||
|
||||
|
59
src/documentation/content/xdocs/plan/index.xml
Normal file
59
src/documentation/content/xdocs/plan/index.xml
Normal file
@ -0,0 +1,59 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Copyright (C) 2004 The Apache Software Foundation. All rights reserved. -->
|
||||
<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.1//EN" "../dtd/document-v11.dtd">
|
||||
|
||||
<document>
|
||||
<header>
|
||||
<title>Planning Documentation</title>
|
||||
<subtitle>Overview</subtitle>
|
||||
<authors>
|
||||
<person name="David Crossley" email="crossley@apache.org"/>
|
||||
<person name="Nicola Ken Barozzi" email="barozzi@nicolaken.com"/>
|
||||
</authors>
|
||||
</header>
|
||||
|
||||
<body>
|
||||
<section><title>Overview</title>
|
||||
|
||||
<p>This is a collection of notes to assist with long-term planning and
|
||||
development.
|
||||
</p>
|
||||
|
||||
<p>There is much discussion of issues and research topics (RT) threads on
|
||||
the <code>dev</code> mailing list (and elsewhere). However, details
|
||||
get lost in the sheer volume. This is the place to document the summary of
|
||||
discussions on some key topics. Some new and complex capabilities will take
|
||||
lots of design and specification before they can be implemented.
|
||||
</p>
|
||||
|
||||
<p>Another use for this collection of notes is as a place to quickly store
|
||||
a snippet from an email discussion or even a link to a discussion thread.
|
||||
The concepts can then be fleshed-out over time.
|
||||
</p>
|
||||
|
||||
<p>Anyone can participate in this process. Please get involved in discussion
|
||||
on <code>dev</code> and contribute patches for these summary planning
|
||||
documents via the normal <link href="../contrib.html">contribution</link>
|
||||
process.
|
||||
</p>
|
||||
|
||||
<p>These planning documents are intended to be concise notes only. They are
|
||||
also ever-evolving, because as issues are addressed these notes will be
|
||||
revised.
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<section><title>Topics and Issues</title>
|
||||
|
||||
<ul>
|
||||
<li><link href="release.html">Release Plan</link>
|
||||
- major things to do before the 2.0 release</li>
|
||||
<li><link href="doc.html">Documentation</link>
|
||||
- revisions and additions are required</li>
|
||||
<li>See the general <link href="../todo.html">To Do</link> list
|
||||
and the <code>dev</code> email archives for other issues</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
</body>
|
||||
</document>
|
64
src/documentation/content/xdocs/plan/release.xml
Normal file
64
src/documentation/content/xdocs/plan/release.xml
Normal file
@ -0,0 +1,64 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Copyright (C) 2004 The Apache Software Foundation. All rights reserved. -->
|
||||
<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.1//EN" "../dtd/document-v11.dtd">
|
||||
|
||||
<document>
|
||||
<header>
|
||||
<title>Release Plan 2.0</title>
|
||||
<subtitle>Planning Documentation</subtitle>
|
||||
<authors>
|
||||
<person name="David Crossley" email="crossley@apache.org"/>
|
||||
<person name="Nicola Ken Barozzi" email="barozzi@nicolaken.com"/>
|
||||
</authors>
|
||||
</header>
|
||||
|
||||
<body>
|
||||
<section><title>Preparation for release of Poi</title>
|
||||
<p>Todo</p>
|
||||
<!-- NKB todo
|
||||
<p>The 2.0 final release is scheduled for the end of November 2001.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The following is extracted from the thread
|
||||
[C2]: Release Candidate 2 ... 2001-10-29
|
||||
</p>
|
||||
|
||||
<source><![CDATA[
|
||||
> The question is now, what has to be done until then?
|
||||
>
|
||||
> 1) We have many open bugs in bugzilla. These must be reviewed
|
||||
> and then solved (or declared invalid etc).
|
||||
>
|
||||
> 2) Documentation updates (this area lacks most)
|
||||
> We could move this to the final release.
|
||||
Documentation must be happening all the time, and not left
|
||||
until last.
|
||||
|
||||
> 3) Decide what to backport from the 2.1 head.
|
||||
> I'm +1 on removing the CodeFactories completly in 2.0, too.
|
||||
> This would avoid any backcompatibility problems.
|
||||
>
|
||||
> 4) Layout the distribution
|
||||
> This is a point we haven't discussed yet. Currently our
|
||||
> distribution is a mixture of a source and a binary one.
|
||||
> We deliver the source and a compiled version, but in order
|
||||
> to run Cocoon, the user has to build a war file.
|
||||
> I propose to split this: one source distribution which is
|
||||
> similar to the current one but without the precompiled
|
||||
> cocoon jar and a binary distribution containing only the
|
||||
> war file. This war file should work in most servlet engines,
|
||||
> perhaps not in all.
|
||||
>
|
||||
> So anything missing here?
|
||||
|
||||
5) Ensure that licensing requirements have been met.
|
||||
update jars.xml, ensure proper banner in *.java header,
|
||||
verify the current LICENSE* files, ensure that external
|
||||
components have suitable licensing requirements.
|
||||
]]></source>
|
||||
-->
|
||||
</section>
|
||||
|
||||
</body>
|
||||
</document>
|
18
src/documentation/content/xdocs/poifs/book.xml
Normal file
18
src/documentation/content/xdocs/poifs/book.xml
Normal file
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- Copyright (C) 2004 The Apache Software Foundation. All rights reserved. -->
|
||||
<!DOCTYPE book PUBLIC "-//APACHE//DTD Cocoon Documentation Book V1.0//EN" "../dtd/book-cocoon-v10.dtd">
|
||||
|
||||
<book software="Poi Project"
|
||||
title="PoiFS"
|
||||
copyright="@year@ Poi Project">
|
||||
|
||||
<menu label="Navigation">
|
||||
<menu-item label="Main" href="../index.html"/>
|
||||
<menu-item label="How To" href="how-to.html"/>
|
||||
<menu-item label="File System Documentation" href="fileformat.html"/>
|
||||
<menu-item label="Use Cases" href="usecases.html"/>
|
||||
</menu>
|
||||
|
||||
</book>
|
||||
|
||||
|
677
src/documentation/content/xdocs/poifs/fileformat.xml
Normal file
677
src/documentation/content/xdocs/poifs/fileformat.xml
Normal file
@ -0,0 +1,677 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Copyright (C) 2004 The Apache Software Foundation. All rights reserved. -->
|
||||
<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.1//EN" "../dtd/document-v11.dtd">
|
||||
<document>
|
||||
<header>
|
||||
<title>POIFS File System Internals</title>
|
||||
<authors>
|
||||
<person email="mjohnson@apache.org" name="Marc Johnson" id="MJ"/>
|
||||
</authors>
|
||||
</header>
|
||||
<body>
|
||||
<section><title>POIFS File System Internals</title>
|
||||
<section><title>Introduction</title>
|
||||
<p>POIFS file systems are essentially normal files stored on a
|
||||
Java-compatible platform's native file system. They are
|
||||
typically identified by names ending in a four character
|
||||
extension noting what type of data they contain. For
|
||||
example, a file ending in ".xls" would likely
|
||||
contain spreadsheet data, and a file ending in
|
||||
".doc" would probably contain a word processing
|
||||
document. POIFS file systems are called "file
|
||||
system", because they contain multiple embedded files
|
||||
in a manner similar to traditional file systems. Along
|
||||
functional lines, it would be more accurate to call these
|
||||
POIFS archives. For the remainder of this document it is
|
||||
referred to as a file system in order to avoid confusion
|
||||
with the "files" it contains.</p>
|
||||
<p>POIFS file systems are compatible with those document
|
||||
formats used by a well-known software company's popular
|
||||
office productivity suite and programs outputting
|
||||
compatible data. Because the POIFS file system does not
|
||||
provide compression, encryption or any other worthwhile
|
||||
feature, its not a good choice unless you require
|
||||
interoperability with these programs.</p>
|
||||
<p>The POIFS file system does not encode the documents
|
||||
themselves. For example, if you had a word processor file
|
||||
with the extension ".doc", you would actually
|
||||
have a POIFS file system with a document file archived
|
||||
inside of that file system.</p>
|
||||
</section>
|
||||
<section><title>Document Conventions</title>
|
||||
<p>This document utilizes the numeric types as described by
|
||||
the Java Language Specification, which can be found at
|
||||
<link href="http://java.sun.com">http://java.sun.com</link>. In
|
||||
short:</p>
|
||||
<ul>
|
||||
<li>A <em>byte</em> is an 8 bit signed integer ranging from
|
||||
-128 to 127.</li>
|
||||
<li>A <em>short</em> is a 16 bit signed integer ranging from
|
||||
-32768 to 32767</li>
|
||||
<li>An <em>int</em> is a 32 bit signed integer ranging from
|
||||
-2147483648 to 2147483647</li>
|
||||
<li>A <em>long</em> is a 64 bit signed integer ranging from
|
||||
-9.22E18 to 9.22E18.</li>
|
||||
</ul>
|
||||
<p>The Java Language Specification spells out a number of
|
||||
other types that are not referred to by this document.</p>
|
||||
<p>Where this document makes references to "endian
|
||||
conversion" it is referring to the byte order of
|
||||
stored numbers. Numbers in "little-endian order"
|
||||
are stored with the <em>least</em> significant byte first. In
|
||||
order to properly read a short, for example, you'd read two
|
||||
bytes and then shift the second byte 8 bits to the left
|
||||
before performing an <code>or</code> operation to it
|
||||
against the first byte. The following code illustrates this
|
||||
method:</p>
|
||||
<source>
|
||||
public int getShort (byte[] rec)
|
||||
{
|
||||
return ((rec[1] << 8) | (rec[0] & 0x00ff));
|
||||
}</source>
|
||||
</section>
|
||||
<section><title>File System Walkthrough</title>
|
||||
<p>This is a walkthrough of a POIFS file system and how it is
|
||||
put together. It is not intended to give a concise
|
||||
description but to give a "big picture" of the
|
||||
general structure and how it's interpreted.</p>
|
||||
<p>A POIFS file system begins with a header. This header
|
||||
identifies locations in the file by function and provides a
|
||||
sanity check identifying a file as a POIFS file system.</p>
|
||||
<p>The first 64 bits of the header compose a <em>magic number
|
||||
identifier.</em> This identifier tells the client software
|
||||
that this is indeed a POIFS file system and that it should
|
||||
be treated as such. This is a "sanity check" to
|
||||
make sure this is a POIFS file system and not some other
|
||||
format. The header also contains an <em>array of block
|
||||
numbers</em>. These block numbers refer to blocks in the
|
||||
file. When these blocks are read together they form the
|
||||
<em>Block Allocation Table</em>. The header also contains a
|
||||
pointer to the first element in the <em>property table</em>,
|
||||
also known as the <em>root element</em>, and a pointer to the
|
||||
<em>small Block Allocation Table (SBAT)</em>.</p>
|
||||
<p>The <em>block allocation table</em> or <em>BAT</em>, along with
|
||||
the <em>property table</em>, specify which blocks in the file
|
||||
system belong to which files. After the header block, the
|
||||
file system is divided into identically sized blocks of
|
||||
data, numbered from 0 to however many blocks there are in
|
||||
the file system. For each file in the file system, its
|
||||
entry in the property table includes the index of the first
|
||||
block in the array of blocks. Each block's index into the
|
||||
array of blocks is also its index into the BAT, and the
|
||||
integer value stored at that index in the BAT gives the
|
||||
index of the next block in the array (and thus the index of
|
||||
the next BAT value). A special value is stored in the BAT
|
||||
to indicate "end of file".</p>
|
||||
<p>The <em>property table</em> is essentially the directory
|
||||
storage for the file system. It consists of the name of the
|
||||
file or directory, its <em>start block</em> in both the file
|
||||
system and <em>BAT</em>, and its actual size. The first
|
||||
property in the property table is the <em>root
|
||||
element</em>. It has two purposes: to be a directory entry
|
||||
(the root of the directory tree, to be specific), and to
|
||||
hold the start block for the <em>small block data</em>.</p>
|
||||
<p>Small block data is a special file that contains the data
|
||||
for small files (less than 4K bytes). It subdivides its
|
||||
blocks into smaller blocks and there is a special small
|
||||
block allocation table that, like the main BAT for larger
|
||||
files, is used to map a small file to its small blocks.</p>
|
||||
</section>
|
||||
<section><title>Header Block</title>
|
||||
<p>The POIFS file system begins with a <em>header
|
||||
block</em>. The first 64 bits of the header form a long
|
||||
<em>file type id</em> or <em>magic number identifier</em> of
|
||||
<code>0xE11AB1A1E011CFD0L</code>. This is basically a
|
||||
sanity check. If this isn't the first thing in the header
|
||||
(and consequently the file system) then this is not a
|
||||
POIFS file system and should be read with some other
|
||||
library.</p>
|
||||
<p>It's important to know the most important parts of the
|
||||
header. These are discussed in the rest of this
|
||||
section.</p>
|
||||
<section><title>BATs</title>
|
||||
<p>At offset <em>0x2C</em> is an int specifying the number
|
||||
of elements in the <em>BAT array</em>. The array at
|
||||
<em>0x4C</em> an array of ints. This array contains the
|
||||
indices of every block in the Block Allocation
|
||||
Table.</p>
|
||||
</section>
|
||||
<section><title>XBATs</title>
|
||||
<p>Very large POIFS archives may have more blocks than can
|
||||
be addressed by the BAT blocks enumerated in the header
|
||||
block. How large? Well, the BAT array in the header can
|
||||
contain up to 109 BAT block indices; each BAT block
|
||||
references up to 128 blocks, and each block is 512
|
||||
bytes, so we're talking about 109 * 128 * 512 =
|
||||
6.8MB. That's a pretty respectable document! But, you
|
||||
could have much more data than that, and in today's
|
||||
world of cheap gigabyte drives, why not? So, the BAT
|
||||
may be extended in that event. The integer value at
|
||||
offset <em>0x44</em> of the header is the index of the
|
||||
first <em>extended BAT (XBAT) block</em>. At offset
|
||||
<em>0x48</em> of the header, there is an int value that
|
||||
specifies how many XBAT blocks there are. The XBAT
|
||||
blocks begin at the specified index into the array of
|
||||
blocks making up the POIFS file system, and continue in
|
||||
sequence for the specified count of XBAT blocks.</p>
|
||||
<p>Each XBAT block contains the indices of up to 128 BAT
|
||||
blocks, so the document size can be expanded by another
|
||||
8MB for each XBAT block. The BAT blocks indexed by an
|
||||
XBAT block are appended to the end of the list of BAT
|
||||
blocks enumerated in the header block. Thus the BAT
|
||||
blocks enumerated in the header block are BAT blocks 0
|
||||
through 108, the BAT blocks enumerated in the first
|
||||
XBAT block are BAT blocks 109 through 236, the BAT
|
||||
blocks enumerated in the second XBAT block are BAT
|
||||
blocks 237 through 364, and so on.</p>
|
||||
<p>Through the use of XBAT blocks, the limit on the
|
||||
overall document size is that imposed by the 4-byte
|
||||
block indices; if the indices are unsigned ints, the
|
||||
maximum file size is 2 terabytes, 1 terabyte if the
|
||||
indices are treated as signed ints. Either way, I have
|
||||
yet to see a disk drive large enough to accommodate
|
||||
such a file on the shelves at the local office supply
|
||||
stores.</p>
|
||||
</section>
|
||||
<section><title>SBATs</title>
|
||||
<p>If a file contained in a POIFS archive is smaller than
|
||||
4096 bytes, it is stored in small blocks. Small blocks
|
||||
are 64 bytes in length and are contained within big
|
||||
blocks, up to 8 to a big block. As the main BAT is used
|
||||
to navigate the array of big blocks, so the <em>small
|
||||
block allocation table</em> is used to navigate the
|
||||
array of small blocks. The SBAT's start block index is
|
||||
found at offset <em>0x3C</em> of the header block, and
|
||||
remaining blocks constituting the SBAT are found by
|
||||
walking the main BAT as if it were an ordinary file in
|
||||
the POIFS file system (this process is described
|
||||
below).</p>
|
||||
</section>
|
||||
<section><title>Property Table Start Index</title>
|
||||
<p>An integer at address <em>0x30</em> specifies the start
|
||||
index of the property table. This integer is specified
|
||||
as a <em>"block index"</em>. The Property Table
|
||||
is stored, as is almost everything in a POIFS file
|
||||
system, in big blocks and walked via the BAT. The
|
||||
Property Table is described below.</p>
|
||||
</section>
|
||||
</section>
|
||||
<section><title>Property Table</title>
|
||||
<p>The property table is essentially nothing more than the
|
||||
directory system. Properties are 128 byte records
|
||||
contained within the 512 byte blocks. The first property
|
||||
is always the Root Entry. The following applies to
|
||||
individual properties within a property table:</p>
|
||||
<ul>
|
||||
<li>At offset <em>0x00</em> in the property is the
|
||||
"<em>name</em>". This is stored as an
|
||||
uncompressed 16 bit unicode string. In short every
|
||||
other byte corresponds to an "ASCII"
|
||||
character. The size of this string is stored at offset
|
||||
<em>0x40</em> (<em>string size</em>) as a short.</li>
|
||||
<li>At offset <em>0x42</em> is the <em>property type</em>
|
||||
(byte). The type is 1 for directory, 2 for file or 5
|
||||
for the Root Entry.</li>
|
||||
<li>At offset <em>0x43</em> is the <em>node color</em>
|
||||
(byte). The color is either 1, (black), or 0,
|
||||
(red). Properties are apparently meant to be arranged
|
||||
in a red-black binary tree, subject to the following
|
||||
rules:
|
||||
<ol>
|
||||
<li>The root of the tree is always black</li>
|
||||
<li>Two consecutive nodes cannot both be red</li>
|
||||
<li>A property is less than another property if its
|
||||
name length is less than the other property's name
|
||||
length</li>
|
||||
<li>If two properties have the same name length, the
|
||||
sort order is determined by the sort order of the
|
||||
properties' names.</li>
|
||||
</ol></li>
|
||||
<li>At offset <em>0x44</em> is the index (int) of the
|
||||
<em>previous property</em>.</li>
|
||||
<li>At offset <em>0x48</em> is the index (int) of the
|
||||
<em>next property</em>.</li>
|
||||
<li>At offset <em>0x4C</em> is the index (int) of the
|
||||
<em>first directory entry</em>. This is used by
|
||||
directory entries.</li>
|
||||
<li>At offset <em>0x74</em> is an integer giving the
|
||||
<em>start block</em> for the file described by this
|
||||
property. This index corresponds to an index in the
|
||||
array of indices that is the Block Allocation Table
|
||||
(or the Small Block Allocation Table) as well as the
|
||||
index of the first block in the file. This is used by
|
||||
files and the root entry.</li>
|
||||
<li>At offset <em>0x78</em> is an integer giving the total
|
||||
<em>actual size</em> of the file pointed at by this
|
||||
property. If the file size is less than 4096, the file
|
||||
is stored in small blocks and the SBAT is used to walk
|
||||
the small blocks making up the file. If the file size
|
||||
is 4096 or larger, the file is stored in big blocks
|
||||
and the main BAT is used to walk the big blocks making
|
||||
up the file. The exception to this rule is the <em>Root
|
||||
Entry</em>, which, regardless of its size, is
|
||||
<em>always</em> stored in big blocks and the main BAT is
|
||||
used to walk the big blocks making up this special
|
||||
file.</li>
|
||||
</ul>
|
||||
</section>
|
||||
<section><title>Root Entry</title>
|
||||
<p>The <em>Root Entry</em> in the <em>Property Table</em>
|
||||
contains the information necessary to read and write
|
||||
small files, which are files less than 4096 bytes
|
||||
long. The start block field of the Root Entry is the
|
||||
start index of the <em>Small Block Array</em>, which is
|
||||
read like any other file in the POIFS file system. Since
|
||||
the SBAT cannot be used without the Small Block Array,
|
||||
the Root Entry MUST be read or written using the <em>Block
|
||||
Allocation Table</em>. The blocks making up the Small
|
||||
Block Array are divided into 64-byte small blocks, up to
|
||||
the size indicated in the Root Entry (which should always
|
||||
be a multiple of 64).</p>
|
||||
</section>
|
||||
<section><title>Walking the Nodes of the Property Table</title>
|
||||
<p>The individual properties form a directory tree, with the
|
||||
<em>Root Entry</em> as the directory tree's root, as shown
|
||||
in the accompanying drawing. Note the numbers in
|
||||
parentheses in each node; they represent the node's index
|
||||
in the array of properties. The <em>NEXT_PROP</em>,
|
||||
<em>PREVIOUS_PROP</em>, and <em>CHILD_PROP</em> fields hold
|
||||
these indices, and are used to navigate the tree.</p>
|
||||
<p><img alt="property set" src="images/PropertySet.jpg" /></p>
|
||||
<p>Each directory entry (i.e., a property whose type is
|
||||
<em>directory</em> or <em>root entry</em>) uses its
|
||||
<em>CHILD_PROP</em> field to point to one of its
|
||||
subordinate (child) properties. It doesn't seem to matter
|
||||
which of its children it points to. Thus in the previous
|
||||
drawing, the Root Entry's CHILD_PROP field may contain 1,
|
||||
4, or the index of one of its other children. Similarly,
|
||||
the directory node (index 1) may have, in its CHILD_PROP
|
||||
field, 2, 3, or the index of one of its other
|
||||
children.</p>
|
||||
<p>The children of a given directory property point to each
|
||||
other in a similar fashion by using their
|
||||
<em>NEXT_PROP</em> and <em>PREVIOUS_PROP</em> fields.</p>
|
||||
<p>Unused <em>NEXT_PROP</em>, <em>PREVIOUS_PROP</em>, and
|
||||
<em>CHILD_PROP</em> fields contain the marker value of
|
||||
-1. All file properties have a value of -1 for their
|
||||
CHILD_PROP fields for example.</p>
|
||||
</section>
|
||||
<section><title>Block Allocation Table</title>
|
||||
<p>The <em>BAT blocks</em> are pointed at by the bat array
|
||||
contained in the header and supplemented, if necessary,
|
||||
by the <em>XBAT blocks</em>. These blocks form a large
|
||||
table of integers. These integers are block numbers. The
|
||||
<em>Block Allocation Table</em> holds chains of integers.
|
||||
These chains are terminated with -2. The elements in
|
||||
these chains refer to blocks in the files. The starting
|
||||
block of a file is NOT specified in the BAT. It is
|
||||
specified by the <em>property</em> for a given file. The
|
||||
elements in this BAT are both the block number (within
|
||||
the file minus the header) <em>and</em> the number of the
|
||||
next BAT element in the chain. This can be thought of as
|
||||
a linked list of blocks. The BAT array contains the links
|
||||
from one block to the next, including the end of chain
|
||||
marker.</p>
|
||||
<p>Here's an example: Let's assume that the BAT begins as
|
||||
follows:</p>
|
||||
<p><code>BAT[ 0 ] = 2</code></p>
|
||||
<p><code>BAT[ 1 ] = 5</code></p>
|
||||
<p><code>BAT[ 2 ] = 3</code></p>
|
||||
<p><code>BAT[ 3 ] = 4</code></p>
|
||||
<p><code>BAT[ 4 ] = 6</code></p>
|
||||
<p><code>BAT[ 5 ] = -2</code></p>
|
||||
<p><code>BAT[ 6 ] = 7</code></p>
|
||||
<p><code>BAT[ 7 ] = -2</code></p>
|
||||
<p><code>...</code></p>
|
||||
<p>Now, if we have a file whose Property Table entry says it
|
||||
begins with index 0, we walk the BAT array and see that
|
||||
the file consists of blocks 0 (because the start block is
|
||||
0), 2 (because BAT[ 0 ] is 2), 3 (BAT[ 2 ] is 3), 4 (BAT[
|
||||
3 ] is 4), 6 (BAT[ 4 ] is 6), and 7 (BAT[ 6 ] is 7). It
|
||||
ends at block 7 because BAT[ 7 ] is -2, which is the end
|
||||
of chain marker.</p>
|
||||
<p>Similarly, a file beginning at index 1 consists of
|
||||
blocks 1 and 5.</p>
|
||||
<p>Other special numbers in a BAT array are:</p>
|
||||
<ul>
|
||||
<li>-1, which indicates an unused block</li>
|
||||
<li>-3, which indicates a "special" block, such
|
||||
as a block used to make up the Small Block Array, the
|
||||
Property Table, the main BAT, or the SBAT</li>
|
||||
</ul>
|
||||
</section>
|
||||
<section><title>File System Structures</title>
|
||||
<p>The following outlines the basic file system structures.</p>
|
||||
<section><title>Header (block 1) -- 512 (0x200) bytes</title>
|
||||
<table>
|
||||
<tr>
|
||||
<td><em>Field</em></td>
|
||||
<td><em>Description</em></td>
|
||||
<td><em>Offset</em></td>
|
||||
<td><em>Length</em></td>
|
||||
<td><em>Default value or const</em></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>FILETYPE</td>
|
||||
<td>Magic number identifying this as a POIFS file
|
||||
system.</td>
|
||||
<td>0x0000</td>
|
||||
<td>Long</td>
|
||||
<td>0xE11AB1A1E011CFD0</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>UK1</td>
|
||||
<td>Unknown constant</td>
|
||||
<td>0x0008</td>
|
||||
<td>Integer</td>
|
||||
<td>0</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>UK2</td>
|
||||
<td>Unknown Constant</td>
|
||||
<td>0x000C</td>
|
||||
<td>Integer</td>
|
||||
<td>0</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>UK3</td>
|
||||
<td>Unknown Constant</td>
|
||||
<td>0x0014</td>
|
||||
<td>Integer</td>
|
||||
<td>0</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>UK4</td>
|
||||
<td>Unknown Constant (revision?)</td>
|
||||
<td>0x0018</td>
|
||||
<td>Short</td>
|
||||
<td>0x003B</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>UK5</td>
|
||||
<td>Unknown Constant (version?)</td>
|
||||
<td>0x001A</td>
|
||||
<td>Short</td>
|
||||
<td>0x0003</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>UK6</td>
|
||||
<td>Unknown Constant</td>
|
||||
<td>0x001C</td>
|
||||
<td>Short</td>
|
||||
<td>-2</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>LOG_2_BIG_BLOCK_SIZE</td>
|
||||
<td>Log, base 2, of the big block size</td>
|
||||
<td>0x001E</td>
|
||||
<td>Short</td>
|
||||
<td>9 (2 ^ 9 = 512 bytes)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>LOG_2_SMALL_BLOCK_SIZE</td>
|
||||
<td>Log, base 2, of the small block size</td>
|
||||
<td>0x0020</td>
|
||||
<td>Integer</td>
|
||||
<td>6 (2 ^ 6 = 64 bytes)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>UK7</td>
|
||||
<td>Unknown Constant</td>
|
||||
<td>0x0024</td>
|
||||
<td>Integer</td>
|
||||
<td>0</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>UK8</td>
|
||||
<td>Unknown Constant</td>
|
||||
<td>0x0028</td>
|
||||
<td>Integer</td>
|
||||
<td>0</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>BAT_COUNT</td>
|
||||
<td>Number of elements in the BAT array</td>
|
||||
<td>0x002C</td>
|
||||
<td>Integer</td>
|
||||
<td>required</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>PROPERTIES_START</td>
|
||||
<td>Block index of the first block of the property
|
||||
table</td>
|
||||
<td>0x0030</td>
|
||||
<td>Integer</td>
|
||||
<td>required</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>UK9</td>
|
||||
<td>Unknown Constant</td>
|
||||
<td>0x0034</td>
|
||||
<td>Integer</td>
|
||||
<td>0</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>UK10</td>
|
||||
<td>Unknown Constant</td>
|
||||
<td>0x0038</td>
|
||||
<td>Integer</td>
|
||||
<td>0x00001000</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SBAT_START</td>
|
||||
<td>Block index of first big block containing the small
|
||||
block allocation table (SBAT)</td>
|
||||
<td>0x003C</td>
|
||||
<td>Integer</td>
|
||||
<td>-2</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SBAT_Block_Count</td>
|
||||
<td>Number of big blocks holding the SBAT</td>
|
||||
<td>0x0040</td>
|
||||
<td>Integer</td>
|
||||
<td>1</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>XBAT_START</td>
|
||||
<td>Block index of the first block in the Extended Block
|
||||
Allocation Table (XBAT)</td>
|
||||
<td>0x0044</td>
|
||||
<td>Integer</td>
|
||||
<td>-2</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>XBAT_COUNT</td>
|
||||
<td>Number of elements in the Extended Block Allocation
|
||||
Table (to be added to the BAT)</td>
|
||||
<td>0x0048</td>
|
||||
<td>Integer</td>
|
||||
<td>0</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>BAT_ARRAY</td>
|
||||
<td>Array of block indices constituting the Block
|
||||
Allocation Table (BAT)</td>
|
||||
<td>0x004C, 0x0050, 0x0054 ... 0x01FC</td>
|
||||
<td>Integer[]</td>
|
||||
<td>-1 for unused elements, at least first element must
|
||||
be filled.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>N/A</td>
|
||||
<td>Header block data not otherwise described in this
|
||||
table</td>
|
||||
<td>N/A</td>
|
||||
<td>N/A</td>
|
||||
<td>-1</td>
|
||||
</tr>
|
||||
</table>
|
||||
</section>
|
||||
<section>
|
||||
<title>Block Allocation Table Block -- 512 (0x200) bytes</title>
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<em>Field</em>
|
||||
</td>
|
||||
<td>
|
||||
<em>Description</em>
|
||||
</td>
|
||||
<td>
|
||||
<em>Offset</em>
|
||||
</td>
|
||||
<td>
|
||||
<em>Length</em>
|
||||
</td>
|
||||
<td>
|
||||
<em>Default value or const</em>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>BAT_ELEMENT</td>
|
||||
<td>Any given element in the BAT block</td>
|
||||
<td>0x0000, 0x0004, 0x0008, ... 0x01FC</td>
|
||||
<td>Integer</td>
|
||||
<td>
|
||||
-1 = unused<br/>
|
||||
-2 = end of chain<br/>
|
||||
-3 = special (e.g., BAT block)<br/>
|
||||
All other values point to the next element in the
|
||||
chain and the next index of a block composing the
|
||||
file.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</section>
|
||||
<section><title>Property Block -- 512 (0x200) byte block</title>
|
||||
<table>
|
||||
<tr>
|
||||
<td><em>Field</em></td>
|
||||
<td><em>Description</em></td>
|
||||
<td><em>Offset</em></td>
|
||||
<td><em>Length</em></td>
|
||||
<td><em>Default value or const</em></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Properties[]</td>
|
||||
<td>This block contains the properties.</td>
|
||||
<td>0x0000, 0x0080, 0x0100, 0x0180</td>
|
||||
<td>128 bytes</td>
|
||||
<td>All unused space is set to -1.</td>
|
||||
</tr>
|
||||
</table>
|
||||
</section>
|
||||
<section><title>Property -- 128 (0x80) byte block</title>
|
||||
<table>
|
||||
<tr>
|
||||
<td><em>Field</em></td>
|
||||
<td><em>Description</em></td>
|
||||
<td><em>Offset</em></td>
|
||||
<td><em>Length</em></td>
|
||||
<td><em>Default value or const</em></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>NAME</td>
|
||||
<td>A unicode null-terminated uncompressed 16bit string
|
||||
(lose the high bytes) containing the name of the
|
||||
property.</td>
|
||||
<td>0x00, 0x02, 0x04, ... 0x3E</td>
|
||||
<td>Short[]</td>
|
||||
<td>0x0000 for unused elements, field required, 32
|
||||
(0x40) element max</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>NAME_SIZE</td>
|
||||
<td>Number of characters in the NAME field</td>
|
||||
<td>0x40</td>
|
||||
<td>Short</td>
|
||||
<td>Required</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>PROPERTY_TYPE</td>
|
||||
<td>Property type (directory, file, or root)</td>
|
||||
<td>0x42</td>
|
||||
<td>Byte</td>
|
||||
<td>1 (directory), 2 (file), or 5 (root entry)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>NODE_COLOR</td>
|
||||
<td>Node color</td>
|
||||
<td>0x43</td>
|
||||
<td>Byte</td>
|
||||
<td>0 (red) or 1 (black)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>PREVIOUS_PROP</td>
|
||||
<td>Previous property index</td>
|
||||
<td>0x44</td>
|
||||
<td>Integer</td>
|
||||
<td>-1</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>NEXT_PROP</td>
|
||||
<td>Next property index</td>
|
||||
<td>0x48</td>
|
||||
<td>Integer</td>
|
||||
<td>-1</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>CHILD_PROP</td>
|
||||
<td>First child property index</td>
|
||||
<td>0x4c</td>
|
||||
<td>Integer</td>
|
||||
<td>-1</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SECONDS_1</td>
|
||||
<td>Seconds component of the created timestamp?</td>
|
||||
<td>0x64</td>
|
||||
<td>Integer</td>
|
||||
<td>0</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>DAYS_1</td>
|
||||
<td>Days component of the created timestamp?</td>
|
||||
<td>0x68</td>
|
||||
<td>Integer</td>
|
||||
<td>0</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SECONDS_2</td>
|
||||
<td>Seconds component of the modified timestamp?</td>
|
||||
<td>0x6C</td>
|
||||
<td>Integer</td>
|
||||
<td>0</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>DAYS_2</td>
|
||||
<td>Days component of the modified timestamp?</td>
|
||||
<td>0x70</td>
|
||||
<td>Integer</td>
|
||||
<td>0</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>START_BLOCK</td>
|
||||
<td>Starting block of the file, used as the first block
|
||||
in the file and the pointer to the next block from
|
||||
the BAT</td>
|
||||
<td>0x74</td>
|
||||
<td>Integer</td>
|
||||
<td>Required</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SIZE</td>
|
||||
<td>Actual size of the file this property points
|
||||
to. (used to truncate the blocks to the real
|
||||
size).</td>
|
||||
<td>0x78</td>
|
||||
<td>Integer</td>
|
||||
<td>0</td>
|
||||
</tr>
|
||||
</table>
|
||||
</section>
|
||||
</section>
|
||||
</section>
|
||||
</body>
|
||||
</document>
|
355
src/documentation/content/xdocs/poifs/how-to.xml
Normal file
355
src/documentation/content/xdocs/poifs/how-to.xml
Normal file
@ -0,0 +1,355 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Copyright (C) 2004 The Apache Software Foundation. All rights reserved. -->
|
||||
<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.1//EN" "../dtd/document-v11.dtd">
|
||||
<document>
|
||||
<header>
|
||||
<title>How To Use the POIFS APIs</title>
|
||||
<authors>
|
||||
<person email="mjohnson@apache.org" name="Marc Johnson" id="MJ"/>
|
||||
</authors>
|
||||
</header>
|
||||
<body>
|
||||
<section><title>How To Use the POIFS APIs</title>
|
||||
<p>This document describes how to use the POIFS APIs to read, write, and modify files that employ a POIFS-compatible data structure to organize their content.</p>
|
||||
<section><title>Revision History</title>
|
||||
<ul>
|
||||
<li>02.10.2002 - completely rewritten from original documents on <link href="https://sourceforge.net/cvs/?group_id=32701">sourceforge</link></li>
|
||||
</ul>
|
||||
</section>
|
||||
<section><title>Target Audience</title>
|
||||
<p>This document is intended for Java developers who need to use the POIFS APIs to read, write, or modify files that employ a POIFS-compatible data structure to organize their content. It is not necessary for developers to understand the POIFS data structures, and an explanation of those data structures is beyond the scope of this document. It is expected that the members of the target audience will understand the rudiments of a hierarchical file system, and familiarity with the event pattern employed by Java APIs such as AWT would be helpful.</p>
|
||||
</section>
|
||||
<section><title>Glossary</title>
|
||||
<p>This document attempts to be consistent in its terminology, which is defined here:</p>
|
||||
<table>
|
||||
<tr>
|
||||
<td><em>Term</em></td>
|
||||
<td><em>Definition</em></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Directory</td>
|
||||
<td>A special file that may contain other directories and documents.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>DirectoryEntry</td>
|
||||
<td>Representation of a directory within another directory.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Document</td>
|
||||
<td>A file containing data, such as word processing data or a spreadsheet workbook.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>DocumentEntry</td>
|
||||
<td>Representation of a document within a directory.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Entry</td>
|
||||
<td>Representation of a file in a directory.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>File</td>
|
||||
<td>A named entity, managed and contained by the file system.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>File System</td>
|
||||
<td>The POIFS data structures, plus the contained directories and documents, which are maintained in a hierarchical directory structure.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Root Directory</td>
|
||||
<td>The directory at the base of a file system. All file systems have a root directory. The POIFS APIs will not allow the root directory to be removed or renamed, but it can be accessed for the purpose of reading its contents or adding files (directories and documents) to it.</td>
|
||||
</tr>
|
||||
</table>
|
||||
</section>
|
||||
</section>
|
||||
<section><title>Reading a File System</title>
|
||||
<p>This section covers reading a file system. There are two ways to read a file system; these techniques are sketched out in the following table, and then explained in greater depth in the sections following the table.</p>
|
||||
<table>
|
||||
<tr>
|
||||
<td><em>Technique</em></td>
|
||||
<td><em>Advantages</em></td>
|
||||
<td><em>Disadvantages</em></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Conventional Reading</td>
|
||||
<td>
|
||||
Simpler API similar to reading a conventional file system.<br/>
|
||||
Can read documents in any order.
|
||||
</td>
|
||||
<td>
|
||||
All files are resident in memory, whether your application needs them or not.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Event-Driven Reading</td>
|
||||
<td>
|
||||
Reduced footprint -- only the documents you care about are processed.<br/>
|
||||
Improved performance -- no time is wasted reading the documents you're not interested in.
|
||||
</td>
|
||||
<td>
|
||||
More complicated API.<br/>
|
||||
Need to know in advance which documents you want to read.<br/>
|
||||
No control over the order in which the documents are read.<br/>
|
||||
No way to go back and get additional documents except to re-read the file system, which may not be possible, e.g., if the file system is being read from an input stream that lacks random access support.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<section><title>Conventional Reading</title>
|
||||
<p>In this technique for reading, the entire file system is loaded into memory, and the entire directory tree can be walked by an application, reading specific documents at the application's leisure.</p>
|
||||
<section><title>Preparation</title>
|
||||
<p>Before an application can read a file from the file system, the file system needs to be loaded into memory. This is done by using the <code>org.apache.poi.poifs.filesystem.POIFSFileSystem</code> class. Once the file system has been loaded into memory, the application may need the root directory. The following code fragment will accomplish this preparation stage:</p>
|
||||
<source>
|
||||
// need an open InputStream; for a file-based system, this would be appropriate:
|
||||
// InputStream stream = new FileInputStream(fileName);
|
||||
POIFSFileSystem fs;
|
||||
try
|
||||
{
|
||||
fs = new POIFSFileSystem(inputStream);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
// an I/O error occurred, or the InputStream did not provide a compatible
|
||||
// POIFS data structure
|
||||
}
|
||||
DirectoryEntry root = fs.getRoot();</source>
|
||||
<p>Assuming no exception was thrown, the file system can then be read.</p>
|
||||
<p>Note: loading the file system can take noticeable time, particularly for large file systems.</p>
|
||||
</section>
|
||||
<section><title>Reading the Directory Tree</title>
|
||||
<p>Once the file system has been loaded into memory and the root directory has been obtained, the root directory can be read. The following code fragment shows how to read the entries in an <code>org.apache.poi.poifs.filesystem.DirectoryEntry</code> instance:</p>
|
||||
<source>
|
||||
// dir is an instance of DirectoryEntry ...
|
||||
for (Iterator iter = dir.getEntries(); iter.hasNext(); )
|
||||
{
|
||||
Entry entry = (Entry)iter.next();
|
||||
System.out.println("found entry: " + entry.getName());
|
||||
if (entry instanceof DirectoryEntry)
|
||||
{
|
||||
// .. recurse into this directory
|
||||
}
|
||||
else if (entry instanceof DocumentEntry)
|
||||
{
|
||||
// entry is a document, which you can read
|
||||
}
|
||||
else
|
||||
{
|
||||
// currently, either an Entry is a DirectoryEntry or a DocumentEntry,
|
||||
// but in the future, there may be other entry subinterfaces. The
|
||||
// internal data structure certainly allows for a lot more entry types.
|
||||
}
|
||||
}</source>
|
||||
</section>
|
||||
<section><title>Reading a Specific Document</title>
|
||||
<p>There are a couple of ways to read a document, depending on whether the document resides in the root directory or in another directory. Either way, you will obtain an <code>org.apache.poi.poifs.filesystem.DocumentInputStream</code> instance.</p>
|
||||
<section><title>DocumentInputStream</title>
|
||||
<p>The DocumentInputStream class is a simple implementation of InputStream that makes a few guarantees worth noting:</p>
|
||||
<ul>
|
||||
<li><code>available()</code> always returns the number of bytes in the document from your current position in the document.</li>
|
||||
<li><code>markSupported()</code> returns <code>true</code>.</li>
|
||||
<li><code>mark(int limit)</code> ignores the limit parameter; basically the method marks the current position in the document.</li>
|
||||
<li><code>reset()</code> takes you back to the position when <code>mark()</code> was last called, or to the beginning of the document if <code>mark()</code> has not been called.</li>
|
||||
<li><code>skip(long n)</code> will take you to your current position + n (but not past the end of the document).</li>
|
||||
</ul>
|
||||
<p>The behavior of <code>available</code> means you can read in a document in a single read call like this:</p>
|
||||
<source>
|
||||
byte[] content = new byte[ stream.available() ];
|
||||
stream.read(content);
|
||||
stream.close();</source>
|
||||
<p>The combination of <code>mark</code>, <code>reset</code>, and <code>skip</code> provide the basic mechanisms needed for random access of the document contents.</p>
|
||||
</section>
|
||||
<section><title>Reading a Document From the Root Directory</title>
|
||||
<p>If the document resides in the root directory, you can obtain a <code>DocumentInputStream</code> like this:</p>
|
||||
<source>
|
||||
// load file system
|
||||
try
|
||||
{
|
||||
DocumentInputStream stream = filesystem.createDocumentInputStream(documentName);
|
||||
// process data from stream
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
// no such document, or the Entry represented by documentName is not a
|
||||
// DocumentEntry
|
||||
}</source>
|
||||
</section>
|
||||
<section><title>Reading a Document From an Arbitrary Directory</title>
|
||||
<p>A more generic technique for reading a document is to obtain an <code>org.apache.poi.poifs.filesystem.DirectoryEntry</code> instance for the directory containing the desired document (recall that you can use <code>getRoot()</code> to obtain the root directory from its file system). From that DirectoryEntry, you can then obtain a <code>DocumentInputStream</code> like this:</p>
|
||||
<source>
|
||||
DocumentEntry document = (DocumentEntry)directory.getEntry(documentName);
|
||||
DocumentInputStream stream = new DocumentInputStream(document);
|
||||
</source>
|
||||
</section>
|
||||
</section>
|
||||
</section>
|
||||
<section><title>Event-Driven Reading</title>
|
||||
<p>The event-driven API for reading documents is a little more complicated and requires that your application know, in advance, which files it wants to read. The benefit of using this API is that each document is in memory just long enough for your application to read it, and documents that you never read at all are not in memory at all. When you're finished reading the documents you wanted, the file system has no data structures associated with it at all and can be discarded.</p>
|
||||
<section><title>Preparation</title>
|
||||
<p>The preparation phase involves creating an instance of <code>org.apache.poi.poifs.eventfilesystem.POIFSReader</code> and to then register one or more <code>org.apache.poi.poifs.eventfilesystem.POIFSReaderListener</code> instances with the <code>POIFSReader</code>.</p>
|
||||
<source>
|
||||
POIFSReader reader = new POIFSReader();
|
||||
// register for everything
|
||||
reader.registerListener(myOmnivorousListener);
|
||||
// register for selective files
|
||||
reader.registerListener(myPickyListener, "foo");
|
||||
reader.registerListener(myPickyListener, "bar");
|
||||
// register for selective files
|
||||
reader.registerListener(myOtherPickyListener, new POIFSDocumentPath(),
|
||||
"fubar");
|
||||
reader.registerListener(myOtherPickyListener, new POIFSDocumentPath(
|
||||
new String[] { "usr", "bin" ), "fubar");</source>
|
||||
</section>
|
||||
<section><title>POIFSReaderListener</title>
|
||||
<p><code>org.apache.poi.poifs.eventfilesystem.POIFSReaderListener</code> is an interface used to register for documents. When a matching document is read by the <code>org.apache.poi.poifs.eventfilesystem.POIFSReader</code>, the <code>POIFSReaderListener</code> instance receives an <code>org.apache.poi.poifs.eventfilesystem.POIFSReaderEvent</code> instance, which contains an open <code>DocumentInputStream</code> and information about the document.</p>
|
||||
<p>A <code>POIFSReaderListener</code> instance can register for individual documents, or it can register for all documents; once it has registered for all documents, subsequent (and previous!) registration requests for individual documents are ignored. There is no way to unregister a <code>POIFSReaderListener</code>.</p>
|
||||
<p>Thus, it is possible to register a single <code>POIFSReaderListener</code> for multiple documents - one, some, or all documents. It is guaranteed that a single <code>POIFSReaderListener</code> will receive exactly one notification per registered document. There is no guarantee as to the order in which it will receive notification of its documents, as future implementations of <code>POIFSReader</code> are free to change the algorithm for walking the file system's directory structure.</p>
|
||||
<p>It is also permitted to register more than one <code>POIFSReaderListener</code> for the same document. There is no guarantee of ordering for notification of <code>POIFSReaderListener</code> instances that have registered for the same document when <code>POIFSReader</code> processes that document.</p>
|
||||
<p>It is guaranteed that all notifications occur in the same thread. A future enhancement may be made to provide multi-threaded notifications, but such an enhancement would very probably be made in a new reader class, a <code>ThreadedPOIFSReader</code> perhaps.</p>
|
||||
<p>The following table describes the three ways to register a <code>POIFSReaderListener</code> for a document or set of documents:</p>
|
||||
<table>
|
||||
<tr>
|
||||
<td><em>Method Signature</em></td>
|
||||
<td><em>What it does</em></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>registerListener(POIFSReaderListener <em>listener</em>)</td>
|
||||
<td>registers <em>listener</em> for all documents.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>registerListener(POIFSReaderListener <em>listener</em>, String <em>name</em>)</td>
|
||||
<td>registers <em>listener</em> for a document with the specified <em>name</em> in the root directory.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>registerListener(POIFSReaderListener <em>listener</em>, POIFSDocumentPath <em>path</em>, String <em>name</em>)</td>
|
||||
<td>registers <em>listener</em> for a document with the specified <em>name</em> in the directory described by <em>path</em></td>
|
||||
</tr>
|
||||
</table>
|
||||
</section>
|
||||
<section><title>POIFSDocumentPath</title>
|
||||
<p>The <code>org.apache.poi.poifs.filesystem.POIFSDocumentPath</code> class is used to describe a directory in a POIFS file system. Since there are no reserved characters in the name of a file in a POIFS file system, a more traditional string-based solution for describing a directory, with special characters delimiting the components of the directory name, is not feasible. The constructors for the class are used as follows:</p>
|
||||
<table>
|
||||
<tr>
|
||||
<td><em>Constructor example</em></td>
|
||||
<td><em>Directory described</em></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>new POIFSDocumentPath()</td>
|
||||
<td>The root directory.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>new POIFSDocumentPath(null)</td>
|
||||
<td>The root directory.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>new POIFSDocumentPath(new String[ 0 ])</td>
|
||||
<td>The root directory.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>new POIFSDocumentPath(new String[ ] { "foo", "bar"} )</td>
|
||||
<td>in Unix terminology, "/foo/bar".</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>new POIFSDocumentPath(new POIFSDocumentPath(new String[] { "foo" }), new String[ ] { "fu", "bar"} )</td>
|
||||
<td>in Unix terminology, "/foo/fu/bar".</td>
|
||||
</tr>
|
||||
</table>
|
||||
</section>
|
||||
<section><title>Processing POIFSReaderEvent Events</title>
|
||||
<p>Processing <code>org.apache.poi.poifs.eventfilesystem.POIFSReaderEvent</code> events is relatively easy. After all of the <code>POIFSReaderListener</code> instances have been registered with <code>POIFSReader</code>, the <code>POIFSReader.read(InputStream stream)</code> method is called.</p>
|
||||
<p>Assuming that there are no problems with the data, as the <code>POIFSReader</code> processes the documents in the specified <code>InputStream</code>'s data, it calls registered <code>POIFSReaderListener</code> instances' <code>processPOIFSReaderEvent</code> method with a <code>POIFSReaderEvent</code> instance.</p>
|
||||
<p>The <code>POIFSReaderEvent</code> instance contains information to identify the document (a <code>POIFSDocumentPath</code> object to identify the directory that the document is in, and the document name), and an open <code>DocumentInputStream</code> instance from which to read the document.</p>
|
||||
</section>
|
||||
</section>
|
||||
</section>
|
||||
<section><title>Writing a File System</title>
|
||||
<p>Writing a file system is very much like reading a file system in that there are multiple ways to do so. You can load an existing file system into memory and modify it (removing files, renaming files) and/or add new files to it, and write it, or you can start with a new, empty file system:</p>
|
||||
<source>
|
||||
POIFSFileSystem fs = new POIFSFileSystem();</source>
|
||||
<section><title>The Naming of Names</title>
|
||||
<p>There are two restrictions on the names of files in a file system that must be considered when creating files:</p>
|
||||
<ol>
|
||||
<li>The name of the file must not exceed 31 characters. If it does, the POIFS API will silently truncate the name to fit.</li>
|
||||
<li>The name of the file must be unique within its containing directory. This seems pretty obvious, but if it isn't spelled out, there'll be hell to pay, to be sure. Uniqueness, of course, is determined <em>after</em> the name has been truncated, if the original name was too long to begin with.</li>
|
||||
</ol>
|
||||
</section>
|
||||
<section><title>Creating a Document</title>
|
||||
<p>A document can be created by acquiring a <code>DirectoryEntry</code> and calling one of the two <code>createDocument</code> methods:</p>
|
||||
<table>
|
||||
<tr>
|
||||
<td><em>Method Signature</em></td>
|
||||
<td><em>Advantages</em></td>
|
||||
<td><em>Disadvantages</em></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>CreateDocument(String name, InputStream stream)</td>
|
||||
<td>
|
||||
Simple API.
|
||||
</td>
|
||||
<td>
|
||||
Increased memory footprint (document is in memory until file system is written).
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>CreateDocument(String name, int size, POIFSWriterListener writer)</td>
|
||||
<td>
|
||||
Decreased memory footprint (only very small documents are held in memory, and then only for a short time).
|
||||
</td>
|
||||
<td>
|
||||
More complex API.<br/>
|
||||
Determining document size in advance may be difficult.<br/>
|
||||
Lose control over when document is to be written.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>Unlike reading, you don't have to choose between the in-memory and event-driven writing models; both can co-exist in the same file system.</p>
|
||||
<p>Writing is initiated when the <code>POIFSFileSystem</code> instance's <code>writeFilesystem()</code> method is called with an <code>OutputStream</code> to write to.</p>
|
||||
<p>The event-driven model is quite similar to the event-driven model for reading, in that the file system calls your <code>org.apache.poi.poifs.filesystem.POIFSWriterListener</code> when it's time to write your document, just as the <code>POIFSReader</code> calls your <code>POIFSReaderListener</code> when it's time to read your document. Internally, when <code>writeFilesystem()</code> is called, the final POIFS data structures are created and are written to the specified <code>OutputStream</code>. When the file system needs to write a document out that was created with the event-driven model, it calls the <code>POIFSWriterListener</code> back, calling its <code>processPOIFSWriterEvent()</code> method, passing an <code>org.apache.poi.poifs.filesystem.POIFSWriterEvent</code> instance. This object contains the <code>POIFSDocumentPath</code> and name of the document, its size, and an open <code>org.apache.poi.poifs.filesystem.DocumentOutputStream</code> to which to write. A <code>DocumentOutputStream</code> is a wrapper over the <code>OutputStream</code> that was provided to the <code>POIFSFileSystem</code> to write to, and has the responsibility of making sure that the document your application writes fits within the size you specified for it.</p>
|
||||
</section>
|
||||
<section><title>Creating a Directory</title>
|
||||
<p>Creating a directory is similar to creating a document, except that there's only one way to do so:</p>
|
||||
<source>
|
||||
DirectoryEntry createdDir = existingDir.createDirectory(name);</source>
|
||||
</section>
|
||||
<section><title>Using POIFSFileSystem Directly To Create a Document Or Directory</title>
|
||||
<p>As with reading documents, it is possible to create a new document or directory in the root directory by using convenience methods of POIFSFileSystem.</p>
|
||||
<table>
|
||||
<tr>
|
||||
<td>DirectoryEntry Method Signature</td>
|
||||
<td>POIFSFileSystem Method Signature</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>createDocument(String name, InputStream stream)</td>
|
||||
<td>createDocument(InputStream stream, String name)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>createDocument(String name, int size, POIFSWriterListener writer)</td>
|
||||
<td>createDocument(String name, int size, POIFSWriterListener writer)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>createDirectory(String name)</td>
|
||||
<td>createDirectory(String name)</td>
|
||||
</tr>
|
||||
</table>
|
||||
</section>
|
||||
</section>
|
||||
<section><title>Modifying a File System</title>
|
||||
<p>It is possible to modify an existing POIFS file system, whether it's one your application has loaded into memory, or one which you are creating on the fly.</p>
|
||||
<section><title>Removing a Document</title>
|
||||
<p>Removing a document is simple: you get the <code>Entry</code> corresponding to the document and call its <code>delete()</code> method. This is a boolean method, but should always return <code>true</code>, indicating that the operation succeeded.</p>
|
||||
</section>
|
||||
<section><title>Removing a Directory</title>
|
||||
<p>Removing a directory is also simple: you get the <code>Entry</code> corresponding to the directory and call its <code>delete()</code> method. This is a boolean method, but, unlike deleting a document, may not always return <code>true</code>, indicating that the operation succeeded. Here are the reasons why the operation may fail:</p>
|
||||
<ul>
|
||||
<li>The directory still has files in it (to check, call <code>isEmpty()</code> on its DirectoryEntry; is the return value <code>false</code>?)</li>
|
||||
<li>The directory is the root directory. You cannot remove the root directory.</li>
|
||||
</ul>
|
||||
</section>
|
||||
<section><title>Renaming a File</title>
|
||||
<p>Regardless of whether the file is a directory or a document, it can be renamed, with one exception - the root directory has a special name that is expected by the components of a major software vendor's office suite, and the POIFS API will not let that name be changed. Renaming is done by acquiring the file's corresponding <code>Entry</code> instance and calling its <code>renameTo</code> method, passing in the new name.</p>
|
||||
<p>Like <code>delete</code>, <code>renameTo</code> returns <code>true</code> if the operation succeeded, otherwise <code>false</code>. Reasons for failure include these:</p>
|
||||
<ul>
|
||||
<li>The new name is the same as another file in the same directory. And don't forget - if the new name is longer than 31 characters, it <em>will</em> be silently truncated. In its original length, the new name may have been unique, but truncated to 31 characters, it may not be unique any longer.</li>
|
||||
<li>You tried to rename the root directory.</li>
|
||||
</ul>
|
||||
</section>
|
||||
</section>
|
||||
</body>
|
||||
</document>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user