Initial revision

This commit is contained in:
slidedraw
2002-03-20 15:31:36 +00:00
commit 89c4cdb2d7
148 changed files with 40909 additions and 0 deletions

198
xlhtml/ChangeLog Normal file
View File

@@ -0,0 +1,198 @@
xlHtml ChangeLog
0.4.9.3 03/19/02
*Began code modularization
*Changed pointers to xlhtml web site
0.4.9.2 03/13/02
*Turned over xlhtml to Charles Wyble
*Added a patch to support bold formatting
0.4.9.1 03/10/02
* Fixed bug in cole.c which causes errors reading ppthtml files - Takahiro Kamba
* Fixed bug in page name output for non-html output
* xlhtml now uses Microsoft CodePages - Victor Wagner
0.4.9.0 12/09/01
* Cleanup of cole library to pass lint better
* Added command line switches for --help --ascii, usage - Charles Wyble
* Don't read past buffer end on malformed fonts.
0.4 12/03/01
* removed spurrious tab before closing XML tag - Mike Ralphson
* Fixed bug in trim edges
* Many signed / unsigned cleanups
* Updated the xldump utility - Charles Wyble
* Added xlcdump utility to dump chart information - Charles Wyble
* Added doxygen doco generation - Rafael Kitover
* Added patch to support String Formulas - Rafael Kitover
* Changed unsupported numeric formats to output using floating point
technique with the decimal suppressed. Was truncating to MAXINT.
* Fixed bug where CSV was not escaping currency fields - Rafael Kitover
* Fixed bug where unknown field types were not escaped in CSV
- Rafael Kitover
* Fixed bug in cell merging where the whole row was selected
* Fixed bug in mailto hyperlink
* Now supports custom colors
* New command line option -nh to suppress header & body tags in html
* Fixed bug where tab delimited was allowing an extra tab at the EOL
* Fixed bug in blank cells for CSV output - Thorsten Koch
* Added test for negative value in cole_fread
* Optimized html further so it suppresses alignment of blank rows
* Improved portability to DOS & WIN32
* Moved everything over to U8, U16, U32, F32, & F64 data types. This is in
effort to improve support on 64 bit platforms.
* Added the xlv script from Asher Blum
0.3 10/19/01
* Added drive letter check for DOS & Windows
* Fixed situation where ellipses were not being rendered correctly
* Fixed Unicode problem in Label Cells
* Fixed problem where cells created by row data were not being updated
when the cell was officially created.
* Program renamed to xlhtml...all lowercase.
* Moved xlHtml over to a new makefile system. It does a static build now.
* Finished moving cole library to mkstemp from tempnam()
* Cole library unlinks temp files after opening so they are deleted
* Fixed Numeric formats that need a comma
* Fixed font name to not have Rich Text
* Added bounds checking to Row Info opcode
* Fixed hyperlinks that are unicode.
* Scripts changed to use mkstemp
* Added support for many currency & accounting formats
* Aggressive optimizations make smaller html now
* Fixed several cases where Ascii output had html in it
* Added CSV output patch from Rob Arnold
* Added support for multiple fonts in same cell
* Added patch for continuation from Hironori
* Added support for multiple style attributes in same cell
* Added support for Hyperlinks
* Added XML patch from Jason Venner
* Added xls-handler for Apache
0.2.8 01/14/2001
* Added man page
* Improved Error Messages - David Brukman
* Added empty SST strings - David Brukman
* Fixed bug in RKtoDouble - David Brukman
* Fixed extended string + rich string
* Fixed a misplaced array initialization for ws_array
* Fixed problem where the html closing tags were being output during error
messages when -asc option was given
* Changed all the comments over to standard C comments for increased
portability
0.2.6 12/26/1999
* xlHtml is now self-scaling to whatever xls file you are viewing
* More Unicode fixups
* Added -m command line option to suppress multibyte
* Added -asc & -dp commandline options to get ascii output and dump
spreadsheet parameters.
* Added -xp -xc -xr commandline options to extract a range of columns and
rows on a page. This will facilitate integration with gnuplot.
* Fixed RK floating point bug
* Increased precision from 6 digits to 15 digits.
0.2.4 12/04/1999
* Added Cell Merging capabilities
* Added -te command line option to "trim the edges" (empty rows or
columns at the edges of a worksheet).
* Added the contributed excel2text script to let mutt clients see xls
attachments
* Added a -v command line switch for version information
* Added code to optimize font size statements similar to font face
* Fixed Unicode bugs in font name and sheet name - Thanks Hironori !
* Re-wrote the cole_fread function. Changes were submitted to Arturo.
0.2.2 11/05/1999
* Fixed problem with date calculation
* Fixed cells that had a string with only spaces in it
* Unicode, unicode, unicode
* Fixed a formula handling error for Excel 95
* Many little bug fixes
* Ported to Borland C++ 5.0 under Win32
0.2.0 10/11/1999
* Added support for fraction data formats
* Added -c command line option to center tables
* Added -bc command line option to override the background color
* Added -tc command line optine to override the text color
* Added -bi command line option to add a background image
* Added better support for Excel 95 & 5.0. Had to disable
colors since it looked crazy. Probably has a different palette.
* Added -a command line to use aggressive optimization. This doesn't
generate closing tags for TD & TR tags. This could be a problem
for older browsers.
* Further reduced generated html output.
* Program now displays the last saved value of a formula.
* Added command line option to suppress warning that formula data
may be stale or inaccurate.
* Updated uploader.pl documentation
* Added nsopen *bash* script in contrib directory
0.1.8 9/29/1999
* Added support for text built-in cell format
* Reduced the amount of html output
* Upgraded to the cole-2.0.1 Library
* Moved xlHtml and all its files into the xlHtml directory
0.1.6 9/25/1999
* Re-designed the Test.xls file to really workout xlHtml
* Added support for most built-in cell formats :date, time,
number, and scientific formats
* Added support for general formatting
* Fixed MS induced glitch in LabelSST - only very large files
would have this problem.
* Fixed bug in default Row XF's - only seen in colored blank cells
* Optimized html tags. Avg 40% less html!
* Added more documentation in README-xlHtml
* Cleaned out document folder. It had some files that were created
from the ./configure script. Reduced total tar size significantly.
* Fixed bug in RK number conversion
0.1.4 9/15/1999
* Added support for Sub & Superscripting
* Added -nc command line option to uncolored output
* Added support for font sizes
* Added support for vertical alignment
* Added 16 more colors to built-in palette
* Added default row formatting
* Added support for left, center, & right justification
0.1.2 9/11/1999
* Added Support for Bold, Underline, and Itallics Fonts
* Now extracts Font Name
* Colorizes Fonts based on default palette - 40 colors
* Continue Record Support added for big files
* Better protection for corrupt files
0.1.0 8/23/1999
* Added Support for RK & MulRK cells
* Now pulls the title & last updated date from Global Data
* Added stubs for all cell types that will be supported
* Minor corrections based on BIFF8 specs
0.0.6 08/20/1999
* Added support for Multiple Worksheets
* Added support for BoolErr for Office 97 files
* Added support for Worksheet's title from the tab
* Test.xls in examples directory is now Multi-worksheet
0.0.4 08/17/1999
* Added support for Floating Point (Number) Cells
* Added basic support to collect font info
* Added basic support to collect cell attributes
* Added several error messages
* Added lots of comments to the code
0.0.2 08/13/1999 First public release.
* Packaged with the cole library and hacked the Makefile and configure
scripts.
* added disclaimer for floating point since its not correct.
* string support is finished.
* Labels are now supported.
0.0.1 08/8/1999 Initial Release.
*So far it supports most strings, empty cells, and integers.

23
xlhtml/Makefile.am Normal file
View File

@@ -0,0 +1,23 @@
## Process this file with automake to produce Makefile.in
EXTRA_DIST = README ChangeLog TODO THANKS Test.xls Test.html xlhtml.1
INCLUDES = -I../cole
noinst_PROGRAMS = xldump xlcdump
noinst_SCRIPTS = xls-handler gpdemo
man_MANS = xlhtml.1
bin_SCRIPTS = nsopen nsxlview
bin_PROGRAMS = xlhtml
LDADD = ../cole/libcole.a
xlhtml_SOURCES = support.c xlhtml.c
xldump_SOURCES = xldump.c
xlcdump_SOURCES = xlcdump.c
AM_CFLAGS = -Wall -Wshadow -Wcast-align -Wpointer-arith
doc:
@echo Generating documentation...
doxygen doxygen.conf
@echo done.
distclean:
rm -rf doc

398
xlhtml/Makefile.in Normal file
View File

@@ -0,0 +1,398 @@
# Makefile.in generated automatically by automake 1.4-p4 from Makefile.am
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
SHELL = @SHELL@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
DESTDIR =
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
transform = @program_transform_name@
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
host_alias = @host_alias@
host_triplet = @host@
CC = @CC@
COLE_MAJOR = @COLE_MAJOR@
COLE_MICRO = @COLE_MICRO@
COLE_MINOR = @COLE_MINOR@
HOST_ALIAS_NAME = @HOST_ALIAS_NAME@
HOST_CANONICAL_NAME = @HOST_CANONICAL_NAME@
HOST_CPU = @HOST_CPU@
HOST_OS = @HOST_OS@
HOST_VENDOR = @HOST_VENDOR@
MAKEINFO = @MAKEINFO@
PACKAGE = @PACKAGE@
RANLIB = @RANLIB@
STRIP = @STRIP@
VERSION = @VERSION@
EXTRA_DIST = README ChangeLog TODO THANKS Test.xls Test.html xlhtml.1
INCLUDES = -I../cole
noinst_PROGRAMS = xldump xlcdump
noinst_SCRIPTS = xls-handler gpdemo
man_MANS = xlhtml.1
bin_SCRIPTS = nsopen nsxlview
bin_PROGRAMS = xlhtml
LDADD = ../cole/libcole.a
xlhtml_SOURCES = support.c xlhtml.c
xldump_SOURCES = xldump.c
xlcdump_SOURCES = xlcdump.c
AM_CFLAGS = -Wall -Wshadow -Wcast-align -Wpointer-arith
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../config.h
CONFIG_CLEAN_FILES =
PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS)
DEFS = @DEFS@ -I. -I$(srcdir) -I..
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
xlhtml_OBJECTS = support.o xlhtml.o
xlhtml_LDADD = $(LDADD)
xlhtml_DEPENDENCIES = ../cole/libcole.a
xlhtml_LDFLAGS =
xldump_OBJECTS = xldump.o
xldump_LDADD = $(LDADD)
xldump_DEPENDENCIES = ../cole/libcole.a
xldump_LDFLAGS =
xlcdump_OBJECTS = xlcdump.o
xlcdump_LDADD = $(LDADD)
xlcdump_DEPENDENCIES = ../cole/libcole.a
xlcdump_LDFLAGS =
SCRIPTS = $(bin_SCRIPTS) $(noinst_SCRIPTS)
CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
man1dir = $(mandir)/man1
MANS = $(man_MANS)
NROFF = nroff
DIST_COMMON = README ChangeLog Makefile.am Makefile.in THANKS TODO
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = tar
GZIP_ENV = --best
SOURCES = $(xlhtml_SOURCES) $(xldump_SOURCES) $(xlcdump_SOURCES)
OBJECTS = $(xlhtml_OBJECTS) $(xldump_OBJECTS) $(xlcdump_OBJECTS)
all: all-redirect
.SUFFIXES:
.SUFFIXES: .S .c .o .s
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --foreign --include-deps xlhtml/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
mostlyclean-binPROGRAMS:
clean-binPROGRAMS:
-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
distclean-binPROGRAMS:
maintainer-clean-binPROGRAMS:
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(bindir)
@list='$(bin_PROGRAMS)'; for p in $$list; do \
if test -f $$p; then \
echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \
$(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
else :; fi; \
done
uninstall-binPROGRAMS:
@$(NORMAL_UNINSTALL)
list='$(bin_PROGRAMS)'; for p in $$list; do \
rm -f $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
done
mostlyclean-noinstPROGRAMS:
clean-noinstPROGRAMS:
-test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS)
distclean-noinstPROGRAMS:
maintainer-clean-noinstPROGRAMS:
.c.o:
$(COMPILE) -c $<
.s.o:
$(COMPILE) -c $<
.S.o:
$(COMPILE) -c $<
mostlyclean-compile:
-rm -f *.o core *.core
clean-compile:
distclean-compile:
-rm -f *.tab.c
maintainer-clean-compile:
xlhtml: $(xlhtml_OBJECTS) $(xlhtml_DEPENDENCIES)
@rm -f xlhtml
$(LINK) $(xlhtml_LDFLAGS) $(xlhtml_OBJECTS) $(xlhtml_LDADD) $(LIBS)
xldump: $(xldump_OBJECTS) $(xldump_DEPENDENCIES)
@rm -f xldump
$(LINK) $(xldump_LDFLAGS) $(xldump_OBJECTS) $(xldump_LDADD) $(LIBS)
xlcdump: $(xlcdump_OBJECTS) $(xlcdump_DEPENDENCIES)
@rm -f xlcdump
$(LINK) $(xlcdump_LDFLAGS) $(xlcdump_OBJECTS) $(xlcdump_LDADD) $(LIBS)
install-binSCRIPTS: $(bin_SCRIPTS)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(bindir)
@list='$(bin_SCRIPTS)'; for p in $$list; do \
if test -f $$p; then \
echo " $(INSTALL_SCRIPT) $$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`"; \
$(INSTALL_SCRIPT) $$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \
else if test -f $(srcdir)/$$p; then \
echo " $(INSTALL_SCRIPT) $(srcdir)/$$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`"; \
$(INSTALL_SCRIPT) $(srcdir)/$$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \
else :; fi; fi; \
done
uninstall-binSCRIPTS:
@$(NORMAL_UNINSTALL)
list='$(bin_SCRIPTS)'; for p in $$list; do \
rm -f $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \
done
install-man1:
$(mkinstalldirs) $(DESTDIR)$(man1dir)
@list='$(man1_MANS)'; \
l2='$(man_MANS)'; for i in $$l2; do \
case "$$i" in \
*.1*) list="$$list $$i" ;; \
esac; \
done; \
for i in $$list; do \
if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
else file=$$i; fi; \
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst"; \
$(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst; \
done
uninstall-man1:
@list='$(man1_MANS)'; \
l2='$(man_MANS)'; for i in $$l2; do \
case "$$i" in \
*.1*) list="$$list $$i" ;; \
esac; \
done; \
for i in $$list; do \
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
echo " rm -f $(DESTDIR)$(man1dir)/$$inst"; \
rm -f $(DESTDIR)$(man1dir)/$$inst; \
done
install-man: $(MANS)
@$(NORMAL_INSTALL)
$(MAKE) $(AM_MAKEFLAGS) install-man1
uninstall-man:
@$(NORMAL_UNINSTALL)
$(MAKE) $(AM_MAKEFLAGS) uninstall-man1
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP)
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
here=`pwd` && cd $(srcdir) \
&& mkid -f$$here/ID $$unique $(LISP)
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
mostlyclean-tags:
clean-tags:
distclean-tags:
-rm -f TAGS ID
maintainer-clean-tags:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = xlhtml
distdir: $(DISTFILES)
@for file in $(DISTFILES); do \
d=$(srcdir); \
if test -d $$d/$$file; then \
cp -pr $$d/$$file $(distdir)/$$file; \
else \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $$d/$$file $(distdir)/$$file || :; \
fi; \
done
info-am:
info: info-am
dvi-am:
dvi: dvi-am
check-am: all-am
check: check-am
installcheck-am:
installcheck: installcheck-am
install-exec-am: install-binPROGRAMS install-binSCRIPTS
install-exec: install-exec-am
install-data-am: install-man
install-data: install-data-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
install: install-am
uninstall-am: uninstall-binPROGRAMS uninstall-binSCRIPTS uninstall-man
uninstall: uninstall-am
all-am: Makefile $(PROGRAMS) $(SCRIPTS) $(MANS)
all-redirect: all-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
installdirs:
$(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(bindir) \
$(DESTDIR)$(mandir)/man1
mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
maintainer-clean-generic:
mostlyclean-am: mostlyclean-binPROGRAMS mostlyclean-noinstPROGRAMS \
mostlyclean-compile mostlyclean-tags \
mostlyclean-generic
mostlyclean: mostlyclean-am
clean-am: clean-binPROGRAMS clean-noinstPROGRAMS clean-compile \
clean-tags clean-generic mostlyclean-am
clean: clean-am
distclean-am: distclean-binPROGRAMS distclean-noinstPROGRAMS \
distclean-compile distclean-tags distclean-generic \
clean-am
distclean: distclean-am
maintainer-clean-am: maintainer-clean-binPROGRAMS \
maintainer-clean-noinstPROGRAMS \
maintainer-clean-compile maintainer-clean-tags \
maintainer-clean-generic distclean-am
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
maintainer-clean: maintainer-clean-am
.PHONY: mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \
maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \
mostlyclean-noinstPROGRAMS distclean-noinstPROGRAMS \
clean-noinstPROGRAMS maintainer-clean-noinstPROGRAMS \
mostlyclean-compile distclean-compile clean-compile \
maintainer-clean-compile uninstall-binSCRIPTS install-binSCRIPTS \
install-man1 uninstall-man1 install-man uninstall-man tags \
mostlyclean-tags distclean-tags clean-tags maintainer-clean-tags \
distdir info-am info dvi-am dvi check check-am installcheck-am \
installcheck install-exec-am install-exec install-data-am install-data \
install-am install uninstall-am uninstall all-redirect all-am all \
installdirs mostlyclean-generic distclean-generic clean-generic \
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
doc:
@echo Generating documentation...
doxygen doxygen.conf
@echo done.
distclean:
rm -rf doc
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

123
xlhtml/README Normal file
View File

@@ -0,0 +1,123 @@
Welcome to xlhtml.
I. INTRODUCTION
The xlhtml program will take an Excel 95, or 97 file as input and convert
it to highly optimized html. The output is via standard out so it can be
re-directed to files or piped to filters or used as a gateway on the internet.
II. INSTALLATION
If you are upgrading, run the 'make uninstall' target from the original directory
before following these steps.
To build this application, from the top directory type:
./configure --prefix=/<target installation directory e.g. /usr/local or /opt>
make
make install
Then to finish it up, you will need to go into netscape and tell the navigator
to use the nsxlview script to handle Microsoft Excel files.
e.g. <path to executable>/nsxlview %s
You should be able to then browse to a file and open it. There is a file
included in the xlhtml directory you can test with: Test.xls.
The shell scripts: nsxlview & nsopen may need modification to correct the
paths to fit your system. Also, depending on where you install it, you
may have to modify your PATH environmental variable.
III. UNINSTALLING
You may want to keep this directory around since you can do a make uninstall
later. In the meantime, I suggest doing a make clean after installation to
minimize disk space useage.
IV. COMMANDLINE OPTIONS
xlhtml now has several command line options that let you tailor its output. The
command is now: xlhtml [-nc -a -fw -bc -tc -bi -c] file.xls
Where -nc tells it not to colorize the output.
-a aggressively optimize html by removing </TR> </TD> or VALIGN="bottom"
Some older browsers may not display properly in this mode.
-fw suppress formula warnings about accuracy
-bc Override the background color. e.g. -bg808080 for gray
-tc Override the text color. e.g. -tcFF0000 for red
-bi Use background image e.g. -bi/home/httpd/icon/tar.gif
-c Centers the tables horizontally
-te Trims empty rows & columns at the edges of a worksheet
-v Prints program version
-m No encoding for multibyte
-asc Ascii out of -dp and extraction data (-x?)
-dp Dump page count and max columns and rows per page
-xp Page for extraction (zero based)
-xc Columns (separated by a dash) for extraction (zero based)
-xr Rows (separated by a dash) to be extracted (zero based)
An example of the extraction command line is:
xlhtml -fw -asc -xp:0 -xr:2-6 -xc:0-1 Test.xls
The extraction output is:
Formatted output of cells by column left to right, columns separated
by a tab, end of row is: 0x0A, end of file: \n\n
*NOTE: Run the gpdemo file for a demonstration plot in Netscape. Also,
you MUST specify all 3 -x commands or the results may not be as desired.
V. PERFORMANCE TUNING
There are some user "tunable" parameters in the beginning of the xlhtml.c file.
The program allocates resources in chunks so that it scales efficiently without
wasting memory. The smaller the chunks, the less wasted memory. The trade off,
though, is that it has to allocate memory more often - which slows things down.
Odds are, you should never need to change them from the default.
VI. INTERNATIONAL CHARACTERS
xlhtml uses three different character sets. It tries to use ascii until it
finds a character greater than 127. At this point, it switches to the
windows-1252 characterset. If the excel file specifies any 2 byte characters,
it switches to utf-8. This handles most situations correctly. If however,
you find yourself with a system that does not support utf-8 (text mode
browsers & some versions of unix) and you need multi-byte support,
try using the program lv.It can be downloaded from:
http://www.ff.iij4u.or.jp/~nrt/lv/
The text only browser, w3m, could be used as follows for Japanese:
xlhtml file.xls | lv -Iu8 -Oej | w3m -T text/html
(Thanks to Hironori Sakamoto for this suggestion.)
VII. TROUBLESHOOTING
Using Netscape, you may occassionally see a file not found error. This usually
comes when printing or going back to a previously converted file. This is
the default behavior and it can be changed by commenting out the rm $tmp*
in nsxlview. I do this so you don't have files hanging around in your tmp
directory where other people might be able to see them.
In general, if you can type xlhtml and get a usage error message, the PATH
is working. If you don't, your PATH environmental variable needs adjusting.
Next try passing the full path to xlhtml of the file you want converted. If it
has problems with it, you may have a file the system can't interpret. To check
your installation, try passing the full path of xlhtml/Test.xls and see what
it does with that.
If you get an error message saying "get another compiler"...this comes from the
cole library. It needs a recent copy of automake, autoconf, or libtool. You
can manually adjust the header files if you know you machine data sizes.
VIII. CONTRIBUTED SCRIPTS
xlhtml now has a contributed scripts directory. If you look in the xlhtml/contrib
directory you will find what people are giving me. I cannot offer support for
files I didn't create, but there is contact information with the files. If you
have something to share...send it to me. If you've contributed...THANKS!
Charles N Wyble
jackshck@yahoo.com

12
xlhtml/THANKS Normal file
View File

@@ -0,0 +1,12 @@
Arturo Tena for the cole 2.0 library
Caolan McNamara for MSWordView...where I got the nsopen & nsxlview scripts
David Nicol for the Uploader Perl script
Bradley Marshall for converting the nsxlview & nsopen scripts to bash
Glen Stewart for rounding up the convertXLS scripts
Hironori Sakamoto for several BIG unicode patches
Gary Johnson for the excel2text mutt script
David Brukman for xlhtml patch
Jason Venner for the XML patch
Asher Blum for the xlv script

5
xlhtml/TODO Normal file
View File

@@ -0,0 +1,5 @@
0.4 ?
Fix nasty Unicode bug when very large shared string tables are encountereds
Support String formulas
Reduce memory footprint
Support data types by using their format string

BIN
xlhtml/Test.xls Normal file

Binary file not shown.

406
xlhtml/contrib/convertXLS.cgi Executable file
View File

@@ -0,0 +1,406 @@
#!/usr/bin/perl
#
# File Upload Script, slightly modified by Caolan.McNamara@ul.ie to
# serve as a msword to html gateway.
# original notice follows
#
# modify lines 89 & 401 for your own configuration.
#
#
#
#
# File Upload Script Version 6.00
# Created by Jeff Carnahan jeffc@terminalp.com
# Created on: 4/8/95 Last Modified on: 01/23/98 23:06
# Scripts Archive: http://www.terminalp.com/scripts/
#
# ---------------------------------------------------------------------
#
# Copyright (C) 1996 Jeffrey D. Carnahan
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or (at
# your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# A full copy of the GNU General Public License can be retrieved from
# http://www.terminalp.com/scripts/license.shtml
#
# - Jeff Carnahan <jeffc@terminalp.com
#
# ---------------------------------------------------------------------
# Program Specific Quickie Notes:
# * Make Sure The First Line Is Pointing To The Correct Location Of Perl 5.
# * Make Sure This Program is chmodded with the permissions '755'.
#
# Version: Time Stamp: History:
# ____________________________________________________________________
#
# 1.00 04/08/96 00:00 The script was created.
# 1.10 04/23/96 00:00 Added User and Group ID to allow file
# changing by the actual user, also updated
# a security hole which allowed any user with
# the UID of 1376 to own the uploaded files.
# Also Updated the INSTALL program and README
# files.
# 3.00 05/07/96 00:00 New release with group and user id fixes, it
# updates a previously unreleased version (2.0)
# 3.10 05/10/96 00:00 Stupid Typo in script fixed, it was
# causing problems for some users.
# 4.00 08/04/96 23:16 Security hole regarding '../' paths
# fixed. Thanks to: Rus Berrett. Mime
# type error fixed. Thanks to: Bob Stewart.
# 4.01 08/07/96 11:20 Typo fixed in &NoOpen. Thanks to Marco
# Dings.
# 5.00 10/06/96 21:42 Fully rewrote script around CGI.pm library.
# As soon as I get the time, I'll write more
# features into it, but for now, this version
# is stable (to the best of my knowledge).
# 5.01 02/09/97 12:41 Fixed some typo's, and added support for
# Netscape Communicator.
# 5.02 05/07/97 15:37 Fixed a possible binary file uploading,
# added easier support for NT, and fixed
# documentation problems. Added the FAQ.
# 5.03 06/19/97 17:30 Fixed a bug which resulted in all files
# appearing to be less than one byte in
# size, thus uploads weren't saved.
# 6.00 01/23/98 23:06 Added multiple-file uploading. You can
# now upload more than one file at a time.
# Also added $MAXIMUM_UPLOAD variable to
# restrict file upload sizes. Script
# completely re-written. Removed buggy
# NT support, and simplified variables.
# CGI.pm is no longer bundled with this
# script. If you need it, download it
# from:
# http://www.genome.wi.mit.edu/ftp/pub/software/WWW/cgi_docs.html
#
# ---------------------------------------------------------------------
# Configurable Options Follow:
#
BEGIN {
$SAVE_DIRECTORY = "/tmp";
#
# --> Variable:
# $SAVE_DIRECTORY
# --> Function:
# Defines the path to the directory
# on the server that should be used
# as the folder to save files into.
# --> Directory Permissions:
# a+rwx
# --> Additional Notes:
# This path should not have a
# trailing forward slash. Also
# remember that this is a path, not
# a URL. Use something similar to:
#
# /home/myself/www/uploads
#
$MAXIMUM_UPLOAD = 0;
#
# --> Variable:
# $MAXIMUM_UPLOAD
# --> Function:
# Defines the number of bytes that
# can be uploaded. Files that exceed
# this limit will not be saved on the
# server.
# --> Additional Notes:
# Set this to zero in order to
# disable size checking.
#
$ALLOW_INDEX = 0;
#
# --> Variable:
# $ALLOW_INDEX
# --> Function:
# If set to zero, files whose
# names begin with the word
# index will not be saved.
#
# Set to one to allow files
# named index* to be uploaded.
# --> Additional Notes:
#
$SUCCESS_LOCATION = ""
#
# --> Variable:
# $SUCCESS_LOCATION
# --> Function:
# Defines the URL that users
# should be redirected to if
# the script works properly. If
# this is left blank, a default
# page will be returned to the
# user.
# --> Additional Notes:
# This is a COMPLETE URL, not
# a path.
}
#
# End of Configurable Options.
# ---------------------------------------------------------------------
# ---------------------------------------------------------------------
# --> Do Not Change Anything Below This Line. <-- #
# ---------------------------------------------------------------------
# ---------------------------------------------------------------------
$| = 1;
chop $SAVE_DIRECTORY if ($SAVE_DIRECTORY =~ /\/$/);
use CGI qw(:standard);
$query = new CGI;
if ( (!(-e $SAVE_DIRECTORY)) ||
(!(-W $SAVE_DIRECTORY)) ||
(!(-d $SAVE_DIRECTORY)) ) {
print header;
print <<__END_OF_HTML_CODE__;
<HTML>
<HEAD>
<TITLE>Error: Bad Directory</TITLE>
</HEAD>
<BODY link="#CC0000" alink="#FF3300" vlink="#330099" text="#000000" bgcolor="#ffffff" background="../pics/weave.jpg">
<table border=0 width=590> <!-- begin table-->
<tr>
<tr>
<td valign="top" width="110">
<img src="../pics/sidebar.gif" usemap="#sidebar.gif" border="0">
<br>
</td>
<td width="480"> <!-- total = 590 -->
<H1>Bad Directory</H1>
<P>
The directory you specified:
<BR>
<BLOCKQUOTE>
<TT>\$SAVE_DIRECTORY = "<B>$SAVE_DIRECTORY</B>";</TT>
</BLOCKQUOTE>
<BR>
is invalid. This problem is caused by one of the three following reasons:
<OL>
<LI>The directory doesn't exist. Make sure that this directory is a complete path name, not
a URL or something similar. It should look similar to <TT>/home/username/public_html/uploads</TT>
<P>
<LI>The directory isn't writable. Make sure that this directory is writable by all users. At
your UNIX command prompt, type <TT>chmod 777 $SAVE_DIRECTORY</TT>
<P>
<LI>The directory you specified isn't really a directory. Make sure that this is indeed a directory
and not a file.
</OL>
<HR SIZE=1>
</td>
</tr>
</table>
</BODY>
</HTML>
__END_OF_HTML_CODE__
exit;
}
foreach $key (sort {$a <=> $b} $query->param()) {
next if ($key =~ /^\s*$/);
next if ($query->param($key) =~ /^\s*$/);
next if ($key !~ /^file-to-upload-(\d+)$/);
$Number = $1;
if ($query->param($key) =~ /([^\/\\]+)$/) {
$Filename = $1;
$Filename =~ s/^\.+//;
$File_Handle = $query->param($key);
if (!$ALLOW_INDEX && $Filename =~ /^index/i) {
print header;
print <<__END_OF_HTML_CODE__;
<HTML>
<HEAD>
<TITLE>Error: Filename Problem</TITLE>
</HEAD>
<BODY link="#CC0000" alink="#FF3300" vlink="#330099" text="#000000" bgcolor="#ffffff" background="../pics/weave.jpg">
<table border=0 width=590> <!-- begin table-->
<tr>
<tr>
<td valign="top" width="110">
<img src="../pics/sidebar.gif" usemap="#sidebar.gif" border="0">
<br>
</td>
<td width="480"> <!-- total = 590 -->
<H1>Filename Problem</H1>
<P>
You attempted to upload a file that isn't properly formatted. The system administrator
has decided that you can't upload files that begin with the word '<B>index</B>'. Please
rename the file on your computer, and try uploading it again.
<P>
<HR SIZE=1>
</td>
</tr>
</table>
</BODY>
</HTML>
__END_OF_HTML_CODE__
exit;
}
} else {
$FILENAME_IN_QUESTION = $query->param($key);
print header;
print <<__END_OF_HTML_CODE__;
<HTML>
<HEAD>
<TITLE>Error: Filename Problem</TITLE>
</HEAD>
<BODY link="#CC0000" alink="#FF3300" vlink="#330099" text="#000000" bgcolor="#ffffff" background="../pics/weave.jpg">
<table border=0 width=590> <!-- begin table-->
<tr>
<tr>
<td valign="top" width="110">
<img src="../pics/sidebar.gif" usemap="#sidebar.gif" border="0">
<br>
</td>
<td width="480"> <!-- total = 590 -->
<H1>Filename Problem</H1>
<P>
You attempted to upload a file that isn't properly formatted. The file in question
is <TT><B>$FILENAME_IN_QUESTION</B></TT> Please rename the file on your computer, and
attempt to upload it again. Files may not have forward or backward slashes in their
names. Also, they may not be prefixed with one (or more) periods.
<P>
<HR SIZE=1>
</td>
</tr>
</table>
</BODY>
</HTML>
__END_OF_HTML_CODE__
exit;
}
if (!open(OUTFILE, ">$SAVE_DIRECTORY\/$Filename")) {
print "Content-type: text/plain\n\n";
print "-------------------------\n";
print "Error:\n";
print "-------------------------\n";
print "File: $SAVE_DIRECTORY\/$Filename\n";
print "-------------------------\n";
print "There was an error opening the Output File\n";
print "for Writing.\n\n";
print "Make sure that the directory:\n";
print "$SAVE_DIRECTORY\n";
print "has been chmodded with the permissions '777'.\n\n";
print "Also, make sure that if your attempting\n";
print "to overwrite an existing file, that the\n";
print "existing file is chmodded '666' or better.\n\n";
print "The Error message below should help you diagnose\n";
print "the problem.\n\n";
print "Error: $!\n";
exit;
}
undef $BytesRead;
undef $Buffer;
while ($Bytes = read($File_Handle,$Buffer,1024)) {
$BytesRead += $Bytes;
print OUTFILE $Buffer;
}
push(@Files_Written, "$SAVE_DIRECTORY\/$Filename");
$TOTAL_BYTES += $BytesRead;
$Confirmation{$File_Handle} = $BytesRead;
close($File_Handle);
close(OUTFILE);
chmod (0666, "$SAVE_DIRECTORY\/$Filename");
}
$FILES_UPLOADED = scalar(keys(%Confirmation));
if ($TOTAL_BYTES > $MAXIMUM_UPLOAD && $MAXIMUM_UPLOAD > 0) {
foreach $File (@Files_Written) {
unlink $File;
}
print header;
print <<__END_OF_HTML_CODE__;
<HTML>
<HEAD>
<TITLE>Error: Limit Reached</TITLE>
</HEAD>
<BODY link="#CC0000" alink="#FF3300" vlink="#330099" text="#000000" bgcolor="#ffffff" background="../pics/weave.jpg">
<table border=0 width=590> <!-- begin table-->
<tr>
<tr>
<td valign="top" width="110">
<img src="../pics/sidebar.gif" usemap="#sidebar.gif" border="0">
<br>
</td>
<td width="480"> <!-- total = 590 -->
<H1>Limit Reached</H1>
<P>
You have reached your upload limit. You attempted to upload <B>$FILES_UPLOADED</B> files, totalling
<B>$TOTAL_BYTES</B>. This exceeds the maximum limit of <B>$MAXIMUM_UPLOAD</B> bytes, set by the system
administrator. <B>None</B> of your files were successfully saved. Please try again.
<P>
<HR SIZE=1>
</td>
</tr>
</table>
</BODY>
</HTML>
__END_OF_HTML_CODE__
exit;
}
if ($SUCCESS_LOCATION !~ /^\s*$/) {
print $query->redirect($SUCCESS_LOCATION);
} else {
print header;
$command = join(' ',"/opt/bin/xlhtml -a ","\"$SAVE_DIRECTORY\/$Filename\"");
system($command);
system "rm -f $SAVE_DIRECTORY/$Filename";
foreach $key (keys (%Confirmation)) {
print "$key - $Confirmation{$key} bytes\n";
}
print <<__END_OF_HTML_CODE__;
<P>
<HR SIZE=1>
__END_OF_HTML_CODE__
exit;
}
# ---------------------------------------------------------------------
# EOF

View File

@@ -0,0 +1,43 @@
<html>
<head><title>MS Excel Spreadsheet converter Web Gateway</title></head>
<BODY BGCOLOR=tan>
<center>
<h1>An Excel Sheet converter Web Gateway</h1>
</center>
This is a web gateway converter for Excel Spreadsheet
documents to html. This tool will convert any Microsoft Excel spreadsheet (XLS) file you
send it, and then display the results in HTML format for you to read with your web
browser.
<p>
To use this tool, press the Browse button below, and select the MS Excel XLS document
you want to convert. Then Press the Upload File button to send it here for conversion.
<p>
<FORM ENCTYPE="multipart/form-data" ACTION="cgi-bin/convertXLS.cgi" METHOD="POST">
<TABLE ALIGN=center BORDER=0 WIDTH="460">
<TR>
<TD ALIGN=RIGHT>
File:
</TD>
<TD>
<INPUT TYPE="FILE" NAME="file-to-upload-01" SIZE="35">
</TD>
</TR>
<TR>
<TD COLSPAN=2>&nbsp;<BR></TD>
</TR>
<TR>
<TD>
<INPUT TYPE="SUBMIT" VALUE="Upload File!">
</TD>
<TD ALIGN=RIGHT>
<INPUT TYPE="RESET" VALUE="Reset Form">
</TD>
</TR>
</TABLE>
</FORM>
<br>
<hr>
</body></html>

View File

@@ -0,0 +1,20 @@
convertXLS is a cgi-bin script that allows you to set up a file
conversion server. There are no restrictions on file size.
To set it up on Apache:
1) copy convertXLS.html to /home/httpd/html
2) copy convertXLS.cgi to /home/httpd/cgi-bin
3) Change to the cgi-bin directory in step 2 and open
the convertXLS.cgi file with an editor. Find line
388 and change the path to where you installed
xlhtml.
To Test:
1) start Netscape and goto http://localhost/convertXLS.html
2) Browse to xlhtml directory and chose Test.xls if you
don't have an Excel file.

23
xlhtml/contrib/excel2text Executable file
View File

@@ -0,0 +1,23 @@
#!/bin/sh
# excel2text - convert MS Excel files to ASCII text
#
# Written by Gary Johnson, Agilent Technologies <gjohnson@agilent.com>.
prog=${0##*/}
htmlfile=$1.html
if [ $# -ne 1 ]
then
echo "Usage: $prog file" >&2
exit 2
fi
if [ -f $htmlfile ]
then
echo "$prog: $htmlfile already exists." >&2
exit 2
fi
xlhtml -te $1 > $htmlfile
w3m -dump $htmlfile
rm -f $htmlfile

View File

@@ -0,0 +1,24 @@
To enable Mutt to display Excel attachments, follow these steps.
1. Make sure the following programs are in a directory in your PATH:
excel2text
xlhtml
w3m <http://ei5nazha.yz.yamagata-u.ac.jp/~aito/w3m/eng/>
2. Add these lines to Mutt's mailcap file:
application/excel; excel2text %s; copiousoutput
application/ms-Excel; excel2text %s; copiousoutput
application/msexcel; excel2text %s; copiousoutput
application/vnd.ms-excel; excel2text %s; copiousoutput
application/x-excel; excel2text %s; copiousoutput
application/x-msexcel; excel2text %s; copiousoutput
3. To have Mutt automatically expand Excel attachments in-line, in
addition to being able to view the attachments from the attachments
menu, add these lines to Mutt's configuration file (e.g.,
~/.muttrc):
auto_view application/excel application/ms-Excel
auto_view application/msexcel application/vnd.ms-excel
auto_view application/x-excel application/x-msexcel

30
xlhtml/contrib/nsopen Executable file
View File

@@ -0,0 +1,30 @@
#!/bin/sh
if [ $# != 1 ];
then
echo "Usage: $0 file"
exit 1
fi
file=$1
if [ ! -f $file ]
then
echo "$0: $file is not a file!"
exit 2
fi
if [ ! -r $file ]
then
echo "$0: File $file cannot be read"
exit 4
fi
#Try to open file in an existing netscape window
(netscape -no-about-splash -remote "openFile(${file})") >& /dev/null
#if this fails, it means that netscape is not running, so start it
if [ $status ]
then
netscape -no-about-splash -no-install file:${file}
fi

47
xlhtml/contrib/nsxlview Executable file
View File

@@ -0,0 +1,47 @@
#!/bin/bash
file=$1
if [ "$file"xx == xx ]
then
echo "Usage: $0 file.doc"
exit 1
fi
source=$1
#Generate a unique html filename (/tmp/scriptname.pidnum.html)
# should use mkstemp, this is wholly bogus.
com=basename $0
tmp=/tmp/${com}:t.$$
html=${tmp}.html
xlhtml $source > $html
if [ ! $? ]
then
echo "xlhtml failed"
exit 4
fi
if [ ! -s $html ]
then
echo "$0: failed to generate HTML file"
exit 1
fi
#File exists and is of length > 0, so open it
nsopen $html
#I do NOT remove the html file so that the user can click
#on the "Back" button without generating a "file not found"
#error - but uncomment the next line if you want it.
if [ "$tmp"zz == zz ];
then
echo "Aargh: \$tmp was null."
else
rm ${tmp}*
fi
exit 0

274
xlhtml/contrib/uploader.pl Executable file
View File

@@ -0,0 +1,274 @@
#!/usr/bin/perl
=pod
primary key is in $in{'pk'}
FILE ITSELF is in the data somehow
Then we offer a variety of links to go to next -- enterimage for
all entries with a text entry but no photo entry?
=cut
sub mydie($){
print <<"BLAM";
<hr>
<b>Error</b> $_[0]
BLAM
exit
}
flock LOG,LOCK_EX;
seek(LOG,0,2);
print LOG
scalar(localtime)," $ENV{'REMOTE_ADDR'} $0 $$;$S\n";
print <<"FOO";
Content-Type: text/html
FOO
foreach $C (split(';',$ENV{'HTTP_COOKIE'})){
$C =~ m/^(\w+)=(.*)$/ and $Cookies{$1} = $2;
};
&ReadParsearoni;
=pod
$in{'filename'} is the file name.
while(my ($k,$v) = each %in){
print "$k --> $v <hr>\n";
};
=cut
# adjust path to your xlhtml executable in the next line
print `/opt/bin/xlhtml -a $in{'filename'}`;
unlink $in{'filename'}; # comment out to keep uploaded files
exit;
sub PrintForm(){
print <<FORM;
<html><head>
<title>Excel Spreadsheet Converter</title></head>
<body>
<br>
<form method=post enctype="multipart/form-data" action="uploader.pl">
<TABLE><TR>
<TD>What Excel file to display?</TD>
<TD><INPUT TYPE="file" SIZE=40 NAME="filename"></TD>
</TR>
<TR><TD>&nbsp;</TD><TD>&nbsp;</TD></TR>
<TR><TD>&nbsp;</TD>
<TD align="center"><INPUT TYPE="submit" VALUE="upload"></TD>
</TR></TABLE>
</form></body></html>
FORM
exit;
};
=pod
file uploading code ripped from
# Perl Routines to Manipulate CGI input
# cgi-lib@pobox.com
# $Id: uploader.pl,v 1.1 2002/03/20 15:33:03 slidedraw Exp $
#
# Copyright (c) 1993-1998 Steven E. Brenner
# For more information, see:
# http://cgi-lib.stanford.edu/cgi-lib/
and modified heavily.
(david nicol davidnicol@acm.org 02/22/1999)
and yet again
(david nicol davidnicol@acm.org 09/27/1999)
=cut
sub ReadParsearoni {
# Parameters affecting cgi-lib behavior
# User-configurable parameters affecting file upload.
# Do not change the following parameters unless you have special reasons
$cgi_lib'bufsize = 8192; # default buffer size when reading multipart
$cgi_lib'maxbound = 100; # maximum boundary length to be encounterd
# Get several useful env variables
$type = $ENV{'CONTENT_TYPE'};
$len = $ENV{'CONTENT_LENGTH'};
$meth = $ENV{'REQUEST_METHOD'};
$maxdata = 131072; # maximum bytes to accept via POST - 2^17
if ($len > $maxdata) {
mydie "Excel file is too large, at $len. The maximum size permitted is $maxdata";
}
unless ($ENV{'CONTENT_TYPE'} =~ m#^multipart/form-data#) {
# mydie "expecting multipart/form-data to upload an Excel Spreadsheet";
PrintForm;
};
local ($buf, $boundary, $head, @heads, $cd, $ct, $fname, $ctype, $blen);
local ($bpos, $lpos, $left, $amt, $fn, $ser);
local ($bufsize, $maxbound) =
($cgi_lib'bufsize, $cgi_lib'maxbound);
# The following lines exist solely to eliminate spurious warning messages
$buf = '';
($boundary) = $type =~ /boundary="([^"]+)"/; #"; # find boundary
($boundary) = $type =~ /boundary=(\S+)/ unless $boundary;
mydie ("Boundary not provided: probably a bug in your server")
unless $boundary;
$boundary = "--" . $boundary;
$blen = length ($boundary);
if ($ENV{'REQUEST_METHOD'} ne 'POST') {
mydie("Invalid request method for multipart/form-data: $meth\n");
}
$writefiles = './tempdata/';
stat ($writefiles);
mydie "Cannot write to directory $writefiles" unless -d _ && -w _;
# read in the data and split into parts:
# put headers in @in and data in %in
# General algorithm:
# There are two dividers: the border and the '\r\n\r\n' between
# header and body. Iterate between searching for these
# Retain a buffer of size(bufsize+maxbound); the latter part is
# to ensure that dividers don't get lost by wrapping between two bufs
# Look for a divider in the current batch. If not found, then
# save all of bufsize, move the maxbound extra buffer to the front of
# the buffer, and read in a new bufsize bytes. If a divider is found,
# save everything up to the divider. Then empty the buffer of everything
# up to the end of the divider. Refill buffer to bufsize+maxbound
# Note slightly odd organization. Code before BODY: really goes with
# code following HEAD:, but is put first to 'pre-fill' buffers. BODY:
# is placed before HEAD: because we first need to discard any 'preface,'
# which would be analagous to a body without a preceeding head.
$left = $len;
PART: # find each part of the multi-part while reading data
while (1) {
die $@ if $errflag;
$amt = ($left > $bufsize+$maxbound-length($buf)
? $bufsize+$maxbound-length($buf): $left);
$errflag = (($got = read(STDIN, $buf, $amt, length($buf))) != $amt);
mydie "Short Read: wanted $amt, got $got\n" if $errflag;
$left -= $amt;
$in{$name} .= "\0" if defined $in{$name};
$in{$name} .= $fn if $fn;
$name=~/([-\w]+)/; # This allows $insfn{$name} to be untainted
if (defined $1) {
$insfn{$1} .= "\0" if defined $insfn{$1};
$insfn{$1} .= $fn if $fn;
}
BODY:
while (($bpos = index($buf, $boundary)) == -1) {
if ($left == 0 && $buf eq '') {
foreach $value (values %insfn) {
unlink(split("\0",$value));
}
mydie("cgi-lib.pl: reached end of input while seeking boundary " .
"of multipart. Format of CGI input is wrong.\n");
}
die $@ if $errflag;
if ($name) { # if no $name, then it's the prologue -- discard
if ($fn) { print FILE substr($buf, 0, $bufsize); }
else { $in{$name} .= substr($buf, 0, $bufsize); }
}
$buf = substr($buf, $bufsize);
$amt = ($left > $bufsize ? $bufsize : $left); #$maxbound==length($buf);
$errflag = (($got = read(STDIN, $buf, $amt, length($buf))) != $amt);
die "Short Read: wanted $amt, got $got\n" if $errflag;
$left -= $amt;
}
if (defined $name) { # if no $name, then it's the prologue -- discard
if ($fn) { print FILE substr($buf, 0, $bpos-2); }
else { $in {$name} .= substr($buf, 0, $bpos-2); } # kill last \r\n
}
close (FILE);
last PART if substr($buf, $bpos + $blen, 2) eq "--";
substr($buf, 0, $bpos+$blen+2) = '';
$amt = ($left > $bufsize+$maxbound-length($buf)
? $bufsize+$maxbound-length($buf) : $left);
$errflag = (($got = read(STDIN, $buf, $amt, length($buf))) != $amt);
die "Short Read: wanted $amt, got $got\n" if $errflag;
$left -= $amt;
undef $head; undef $fn;
HEAD:
while (($lpos = index($buf, "\r\n\r\n")) == -1) {
if ($left == 0 && $buf eq '') {
foreach $value (values %insfn) {
unlink(split("\0",$value));
}
mydie("cgi-lib: reached end of input while seeking end of " .
"headers. Format of CGI input is wrong.\n$buf");
}
die $@ if $errflag;
$head .= substr($buf, 0, $bufsize);
$buf = substr($buf, $bufsize);
$amt = ($left > $bufsize ? $bufsize : $left); #$maxbound==length($buf);
$errflag = (($got = read(STDIN, $buf, $amt, length($buf))) != $amt);
die "Short Read: wanted $amt, got $got\n" if $errflag;
$left -= $amt;
}
$head .= substr($buf, 0, $lpos+2);
push (@in, $head);
@heads = split("\r\n", $head);
($cd) = grep (/^\s*Content-Disposition:/i, @heads);
($ct) = grep (/^\s*Content-Type:/i, @heads);
($name) = $cd =~ /\bname="([^"]+)"/i; #";
($name) = $cd =~ /\bname=([^\s:;]+)/i unless defined $name;
($fname) = $cd =~ /\bfilename="([^"]*)"/i; #"; # filename can be null-str
($fname) = $cd =~ /\bfilename=([^\s:;]+)/i unless defined $fname;
$incfn{$name} .= (defined $in{$name} ? "\0" : "") .
(defined $fname ? $fname : "");
($ctype) = $ct =~ /^\s*Content-type:\s*"([^"]+)"/i; #";
($ctype) = $ct =~ /^\s*Content-Type:\s*([^\s:;]+)/i unless defined $ctype;
$inct{$name} .= (defined $in{$name} ? "\0" : "") . $ctype;
$fn = $writefiles."temp$$"."a";
while (-e $fn){ $fn++ };
open (FILE, ">$fn") || mydie("Couldn't open $fn $!\n");
#print "Wanting to write " and mydie("Couldn't open $fn $!\n");
substr($buf, 0, $lpos+4) = '';
undef $fname;
undef $ctype;
}
if ($errflag) {
local ($errmsg, $value);
$errmsg = $@ || $errflag;
foreach $value (values %insfn) {
unlink(split("\0",$value));
}
mydie($errmsg);
} else {
# everything's ok.
}
}

View File

@@ -0,0 +1,25 @@
uploader.pl is a cgi-bin wrapper that allows a server with xlhtml
to convert xls files via the Netscape Upload form. Note: there is a
file size limit of 128K. Here's the steps to get it working on Apache:
1) With a editor, go to line 45 and correct the path to the xlhtml
executable on your system. You can use 'which xlhtml' if you don't know.
Also, line 1 may need changing depending on where perl is on your system.
2) Copy the file uploader to /home/httpd/cgi-bin
3) cd /home/httpd/cgi-bin
4) chmod +x uploader.pl from the cgi-bin directory
5) In the cgi-bin directory mkdir tempdata
6) chmod 0007 tempdata
7) In Netscape, type: http://localhost/cgi-bin/uploader.pl and press Enter.
If it is setup correctly, you should have a form and then you can
select Test.xls if you don't have one and try it.
enjoy
________________________________________________________________________
David Nicol 816.235.1187 nicold@umkc.edu
"Atomkraft? Nein, danke!" -- Martin Schwartz

59
xlhtml/contrib/xlhtml.dtd Normal file
View File

@@ -0,0 +1,59 @@
<!ELEMENT B ( #PCDATA | I | U | SUB | SUP | S )* >
<!ELEMENT I ( #PCDATA | B | U | SUB | SUP | S )* >
<!ELEMENT U ( #PCDATA | B | I | SUB | SUP | S )* >
<!ELEMENT S ( #PCDATA | B | I | SUB | SUP | U )* >
<!ELEMENT SUP ( #PCDATA | B | I | SUB | S | U )* >
<!ELEMENT SUB ( #PCDATA | B | I | S | SUP | U )* >
<!ELEMENT author ( #PCDATA ) >
<!ELEMENT cell ( #PCDATA | U | B | I | SUB | SUP | S | Unsupported | NotImplemented | NotAccurate | NoFormat )* >
<!ATTLIST cell col NMTOKEN #REQUIRED >
<!ATTLIST cell row NMTOKEN #REQUIRED >
<!ATTLIST cell colspan NMTOKEN >
<!ATTLIST cell rowspan NMTOKEN >
<!ELEMENT Unsupported #EMPTY >
<!ELEMENT NotImplemented #EMPTY >
<!ELEMENT NotAccurate #EMPTY >
<!ELEMENT NoFormat #EMPTY >
<!ELEMENT excel_workbook ( sheets, author, excelversion, tool, toollink ) >
<!ELEMENT excelversion ( #PCDATA ) >
<!ELEMENT accuracy ( #PCDATA ) >
<!ELEMENT notimplemented ( #PCDATA ) >
<!ELEMENT notsupported ( #PCDATA ) >
<!ELEMENT MaxWorksheetsExceeded ( #PCDATA ) >
<!ELEMENT MaxRowExceeded ( #PCDATA ) >
<!ELEMENT MaxColExceeded ( #PCDATA ) >
<!ELEMENT MaxPalExceeded ( #PCDATA ) >
<!ELEMENT MaxFEExceeded ( #PCDATA ) >
<!ELEMENT MaxFormatsExceeded ( #PCDATA ) >
<!ELEMENT firstcol ( #PCDATA ) >
<!ELEMENT firstrow ( #PCDATA ) >
<!ELEMENT lastcol ( #PCDATA ) >
<!ELEMENT lastrow ( #PCDATA ) >
<!ELEMENT page ( #PCDATA ) >
<!ELEMENT pagetitle ( #PCDATA ) >
<!ELEMENT row ( cell+ ) >
<!ELEMENT rows ( row+ ) >
<!ELEMENT sheet ( page, pagetitle, firstrow, lastrow, firstcol, lastcol, rows ) >
<!ELEMENT sheets ( sheet ) >
<!ELEMENT tool ( #PCDATA ) >
<!ELEMENT toollink ( #PCDATA ) >

View File

@@ -0,0 +1,2 @@
xlhtml.dtd is the dtd file that is needed for the XML output option.

72
xlhtml/contrib/xlv Executable file
View File

@@ -0,0 +1,72 @@
#!/usr/bin/perl -w
#
# xlv - pass xl file thru xlHtml and display as plain text
# The point of this script is to produce legible approximation of the
# spreadsheet within 80 columns, sacrificing data as necessary to fit.
# This aids reading mail with mutt. Works well for phone lists and stuff
# like that.
#
# Copyright Asher Blum <asher@wildspark.com> November 2000
# Released per the GNU General Public License
use strict;
my $term_width = 80;
undef $/;
my $xls = <>;
my $fn = "/tmp/$$.xls";
open "XL", ">$fn" or die "Can't open XLS: $!";
print XL $xls;
close XL;
open HTML, "xlhtml $fn |" or die "Can't start xlhtml: $!";
my $page = <HTML>;
close HTML;
my @table;
$page =~ s/&nbsp;/ /g;
$page =~ s/\s+/ /g;
my @rows = split(/<TR[^>]*>/i, $page);
shift @rows;
my @total_width = my @width = map 0, split /<TD[^>]*>/i, $rows[ 0 ];
foreach my $row(@rows) {
my @cells = split /<TD[^>]*>/i, $row;
shift @cells;
pop @cells;
for(0..$#cells) {
$cells[ $_ ] =~ s/<[^>]+>//g;
$cells[ $_ ] =~ s/\s+$//;
$width[ $_ ] = length($cells[ $_ ])
unless $width[ $_ ] > length($cells[ $_ ]);
$total_width[ $_ ] += length($cells[ $_ ]);
}
push @table, [ @cells ];
}
# Now trim the widths to fit avail terminal width
my @avg_width = map($_ / @rows, @total_width);
my @waste_width = map($width[ $_ ] - $avg_width[ $_ ], 0..$#width);
while(sum(@width) > $term_width - @width) { # remember, we waste 1
space
my $mw = most_wasteful();
$width[ most_wasteful() ]--;
@waste_width = map($width[ $_ ] - $avg_width[ $_ ], 0..$#width);
}
foreach my $row(@table) {
for(0..(@$row - 1)) {
printf('%-' . $width[ $_ ] . '.' . $width[ $_ ] . 's ', $row->[ $_ ]);
}
print"\n";
}
sub sum {
my $s;
$s += $_ for @_;
$s;
}
sub most_wasteful {
my $max = 0;
for(0..$#waste_width) {
$max = $_ if $waste_width[ $_ ] > $max;
}
$max;
}

164
xlhtml/doxygen.conf Normal file
View File

@@ -0,0 +1,164 @@
# Doxyfile 0.1
#---------------------------------------------------------------------------
# General configuration options
#---------------------------------------------------------------------------
PROJECT_NAME = xlhtml
PROJECT_NUMBER =
OUTPUT_DIRECTORY = doc
OUTPUT_LANGUAGE = English
EXTRACT_ALL = YES
EXTRACT_PRIVATE = NO
EXTRACT_STATIC = YES
HIDE_UNDOC_MEMBERS = NO
HIDE_UNDOC_CLASSES = NO
BRIEF_MEMBER_DESC = YES
REPEAT_BRIEF = YES
ALWAYS_DETAILED_SEC = NO
FULL_PATH_NAMES = NO
STRIP_FROM_PATH =
INTERNAL_DOCS = NO
CLASS_DIAGRAMS = NO
SOURCE_BROWSER = NO
INLINE_SOURCES = NO
STRIP_CODE_COMMENTS = YES
CASE_SENSE_NAMES = YES
SHORT_NAMES = NO
HIDE_SCOPE_NAMES = NO
VERBATIM_HEADERS = NO
SHOW_INCLUDE_FILES = NO
JAVADOC_AUTOBRIEF = NO
INHERIT_DOCS = YES
INLINE_INFO = NO
SORT_MEMBER_DOCS = YES
DISTRIBUTE_GROUP_DOC = NO
TAB_SIZE = 8
GENERATE_TODOLIST = YES
GENERATE_TESTLIST = YES
GENERATE_BUGLIST = YES
ALIASES =
ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30
OPTIMIZE_OUTPUT_FOR_C = YES
SHOW_USED_FILES = YES
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
QUIET = NO
WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
WARN_FORMAT = "$file:$line: $text"
WARN_LOGFILE =
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = xlhtml.c
FILE_PATTERNS =
RECURSIVE = NO
EXCLUDE =
EXCLUDE_PATTERNS =
EXAMPLE_PATH =
EXAMPLE_PATTERNS =
IMAGE_PATH =
INPUT_FILTER =
FILTER_SOURCE_FILES = NO
#---------------------------------------------------------------------------
# configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
ALPHABETICAL_INDEX = NO
COLS_IN_ALPHA_INDEX = 5
IGNORE_PREFIX =
#---------------------------------------------------------------------------
# configuration options related to the HTML output
#---------------------------------------------------------------------------
GENERATE_HTML = YES
HTML_OUTPUT = html
HTML_HEADER =
HTML_FOOTER =
HTML_STYLESHEET =
HTML_ALIGN_MEMBERS = YES
GENERATE_HTMLHELP = NO
GENERATE_CHI = NO
BINARY_TOC = NO
TOC_EXPAND = NO
DISABLE_INDEX = NO
ENUM_VALUES_PER_LINE = 4
GENERATE_TREEVIEW = NO
TREEVIEW_WIDTH = 250
#---------------------------------------------------------------------------
# configuration options related to the LaTeX output
#---------------------------------------------------------------------------
GENERATE_LATEX = NO
LATEX_OUTPUT = latex
COMPACT_LATEX = NO
PAPER_TYPE = a4wide
EXTRA_PACKAGES =
LATEX_HEADER =
PDF_HYPERLINKS = NO
USE_PDFLATEX = NO
LATEX_BATCHMODE = NO
#---------------------------------------------------------------------------
# configuration options related to the RTF output
#---------------------------------------------------------------------------
GENERATE_RTF = NO
RTF_OUTPUT = rtf
COMPACT_RTF = NO
RTF_HYPERLINKS = NO
RTF_STYLESHEET_FILE =
RTF_EXTENSIONS_FILE =
#---------------------------------------------------------------------------
# configuration options related to the man page output
#---------------------------------------------------------------------------
GENERATE_MAN = NO
MAN_OUTPUT = man
MAN_EXTENSION = .3
MAN_LINKS = NO
#---------------------------------------------------------------------------
# configuration options related to the XML output
#---------------------------------------------------------------------------
GENERATE_XML = NO
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = NO
EXPAND_ONLY_PREDEF = NO
SEARCH_INCLUDES = YES
INCLUDE_PATH =
INCLUDE_FILE_PATTERNS =
PREDEFINED =
EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------
# Configuration::addtions related to external references
#---------------------------------------------------------------------------
TAGFILES =
GENERATE_TAGFILE =
ALLEXTERNALS = NO
PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
HAVE_DOT = NO
CLASS_GRAPH = YES
COLLABORATION_GRAPH = YES
TEMPLATE_RELATIONS = YES
INCLUDE_GRAPH = YES
INCLUDED_BY_GRAPH = YES
GRAPHICAL_HIERARCHY = YES
DOT_PATH =
DOTFILE_DIRS =
MAX_DOT_GRAPH_WIDTH = 1024
MAX_DOT_GRAPH_HEIGHT = 1024
GENERATE_LEGEND = YES
DOT_CLEANUP = YES
#---------------------------------------------------------------------------
# Configuration::addtions related to the search engine
#---------------------------------------------------------------------------
SEARCHENGINE = NO
CGI_NAME = search.cgi
CGI_URL =
DOC_URL =
DOC_ABSPATH =
BIN_ABSPATH = /usr/local/bin/
EXT_DOC_PATHS =

46
xlhtml/gpdemo Executable file
View File

@@ -0,0 +1,46 @@
#!/bin/csh
# File to render
set source = Test.xls
#Generate a unique html filename (/tmp/scriptname.pidnum.html)
set com = $0
set tmp = /tmp/$com:t.$$
set gpcommand = $tmp.gp
set gpdata = $tmp.dat
set gpout = $tmp.gif
# create gnuplot command file
echo "set terminal gif small size 250,125 interlace xfdf5e6 x000000 x404040 x0000ff x00ff00" > $gpcommand
echo "set grid ytics" >> $gpcommand
echo "set nokey" >> $gpcommand
echo "set nolabel" >> $gpcommand
echo "set data style lines" >> $gpcommand
echo "set noxzeroaxis" >> $gpcommand
echo "set noyzeroaxis" >> $gpcommand
echo 'set output "'$gpout'"' >> $gpcommand
echo 'plot "'$gpdata'"' >> $gpcommand
# create the data file
xlhtml -fw -asc -xp:0 -xc:0-1 -xr:2-6 $source > $gpdata
if ((!(-s $gpcommand)) | (!(-s $gpdata)) |($status)) then
echo "$0: failed to generate gnuplot command or data files"
exit 1
endif
#File exists and is of length > 0, so do it...
gnuplot $gpcommand
if (!(-s $gpout)) then
echo "$0: failed to generate gif file"
exit 1
endif
# Display the results in Netscape
nsopen $gpout
# Clean up
rm $tmp*
exit 0

20
xlhtml/nsopen Executable file
View File

@@ -0,0 +1,20 @@
#!/bin/csh
if ($#argv != 1) then
echo "Usage: $0 file"
exit 1
endif
set file = $argv[1]
if (!(-r $file)) then
echo "$0"": File $file cannot be read"
exit 1
endif
#Try to open file in an existing netscape window
(netscape -no-about-splash -remote "openFile(${file})") >& /dev/null
#if this fails, it means that netscape is not running, so start it
if ($status) then
netscape -no-about-splash -no-install file:${file}
endif

30
xlhtml/nsxlview Executable file
View File

@@ -0,0 +1,30 @@
#!/bin/csh
if ($#argv != 1) then
echo "Usage: $0 file.xls"
exit 1
endif
set source = $argv[1]
#Generate a unique html filename (/tmp/scriptname.pidnum.html)
#set com = $0
#set tmp = /tmp/$com:t.$$
#set html = $tmp.html
set tmp = `mktemp -q /tmp/nsxlview.XXXXXX` || exit 1
set tmp2 = `mktemp -q $tmp/nsxlview.XXXXXX` || exit 1
set html = $tmp2.html
xlhtml -a $source > $html
if ((!(-r $html)) | ($status)) then
echo "$0"": failed to generate HTML file"
exit 1
endif
#File exists and is of length > 0, so open it
nsopen $html
rm -rf $tmp*
exit 0

63
xlhtml/support.c Normal file
View File

@@ -0,0 +1,63 @@
/* Various support functions for xlhtml. */
#include <stdio.h>
#include "support.h"
void print_version(void)
{
printf("xlhtml \nCopyright (c) 1999-2002, Charles Wyble\n"
"Released under GPL.\n");
exit(1);
}
void display_usage(void)
{
fprintf(stderr, "\nxlhtml converts excel files (.xls) to Html.\n"
"Copyright (c) 1999-2001, Charles Wyble. Released under GPL.\n"
"Usage: xlhtml [-xp:# -xc:#-# -xr:#-# -bc###### -bi???????? -tc######] <FILE>\n"
"\t-a: aggressive html optimization\n"
"\t-asc ascii output for -dp & -x? options\n"
"\t-csv comma separated value output for -dp & -x? options\n"
"\t-xml XML output\n"
"\t-bc: Set default background color - default white\n"
"\t-bi: Set background image path\n"
"\t-c: Center justify tables\n"
"\t-dp: Dumps page count and max rows & colums per page\n"
"\t-v: Prints program version number\n"
"\t-fw: Suppress formula warnings\n"
"\t-m: No encoding for multibyte\n"
"\t-nc: No Colors - black & white\n"
"\t-nh: No Html Headers\n"
"\t-tc: Set default text color - default black\n"
"\t-te: Trims empty rows & columns at the edges of a worksheet\n"
"\t-xc: Columns (separated by a dash) for extraction (zero based)\n"
"\t-xp: Page extracted (zero based)\n"
"\t-xr: Rows (separated by a dash) to be extracted (zero based)\n");
fprintf(stderr, "\nReport bugs to jackshck@yahoo.com\n");
exit (1);
}
void do_cr(void)
{
extern int aggressive;
if (!aggressive)
putchar('\n');
}
U16 getShort(U8 *ptr)
{
if (ptr == 0)
return (U16)0;
return (U16)((*(ptr+1)<<8)+*ptr);
}
/*! This is used in the RK number, so signedness counts */
S32 getLong(U8 *ptr)
{
if (ptr == 0)
return (S32)0;
return (S32)(*(ptr+3)<<24)+(*(ptr+2)<<16)+(*(ptr+1)<<8)+*ptr;
}

7
xlhtml/tuneable.h Normal file
View File

@@ -0,0 +1,7 @@
#define XFORMATS_INCR 64 /*!< Increments to allocate extended formats */
#define FONTS_INCR 32 /*!< Increments to allocate fonts */
#define WORKSHEETS_INCR 4 /*!< Increments to allocate worksheet pages */
#define COLS_INCR (U16)24 /*!< Increments to allocate Columns per Worksheet page */
#define ROWS_INCR (U32)128 /*!< Increments to allocate Rows per Worksheet page */
#define STRINGS_INCR 256UL /*!< Increments to allocate the string array - */

372
xlhtml/xlcdump.c Normal file
View File

@@ -0,0 +1,372 @@
/*
xlcdump - dumps individual chart records for analysis
Copyright 2002 Charles N Wyble <jackshck@yahoo.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#if !(defined( __BORLANDC__ ) || defined( __WIN32__ ))
#include "config.h" /* Created by ./configure script */
#include "cole.h"
#else
#include "config.h.in" /* Created by ./configure script */
#include "cole.h.in"
#include <io.h> /* for umask */
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h> /* for strcpy() */
#include <ctype.h> /* For isprint */
#define MODE 0 /* 0 - ascii; 1 - hex */
#define TEXT 0 /* In ascii mode, 0 - ascii, 1 - hex */
#define PRGNAME "xlcdump"
#define MAX_COLS 64
#define MAX_ROWS 512
static char FileName[2][12] = /* The section of the Excel Spreadsheet we read in */
{
"/Workbook", /* Office 97 */
"/Book" /* Everything else ? */
};
/* Function Prototypes */
COLE_LOCATE_ACTION_FUNC dump_file;
static void output_opcode_string(int);
/* Global data */
static char filename[128];
int main (int argc, char **argv)
{
int f_ptr = 0;
COLEFS * cfs;
COLERRNO colerrno;
if (argc < 2)
{
fprintf (stderr, "dump - Outputs excel chart records for analysis.\n"
"Usage: "PRGNAME" <FILE>\n");
exit (1);
}
else
{
strncpy(filename, argv[1], 124);
cfs = cole_mount (filename, &colerrno);
if (cfs == NULL)
{
cole_perror (PRGNAME, colerrno);
exit (1);
}
}
while (cole_locate_filename (cfs, FileName[f_ptr], NULL, dump_file, &colerrno))
{
if (f_ptr)
{
cole_perror (PRGNAME, colerrno);
break;
}
else
f_ptr++;
}
if (cole_umount (cfs, &colerrno))
{
cole_perror ("travel", colerrno);
exit (1);
}
return 0;
}
void dump_file(COLEDIRENT *cde, void *_info)
{
unsigned int length=0, opcode=0, target=0, count = 0;
unsigned char buf[16];
COLEFILE *cf;
COLERRNO err;
cf = cole_fopen_direntry(cde, &err);
/* Ouput Header */
printf("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2//EN\">\n");
printf("<HTML><HEAD><TITLE>%s", filename);
printf("</TITLE></HEAD><BODY>\n");
/* Output body */
#if (MODE == 1)
while (cole_fread(cf, buf, 8, &err)) /* For mode >= 1 */
#else
while (cole_fread(cf, buf, 1, &err))
#endif
{
if (MODE == 0)
{
if (count == 0)
{
length = 0;
opcode = (unsigned)buf[0];
target = 80; /* ficticious number */
printf("<br>");
}
else if (count == 1)
opcode |= (buf[0]<<8)&0x0000FFFFL;
else if (count == 2)
length = (unsigned)buf[0];
else if (count == 3)
{
length |= (buf[0]<<8);
target = length;
printf("<br>\nLength:%04X Opcode:%04X - ", length, opcode);
output_opcode_string(opcode);
puts("<br>\n");
}
if (count > 3)
{ /* Here is where we want to process the data */
/* based on the opcode... */
#if (TEXT == 0)
if (isprint(buf[0]))
putc(buf[0], stdout);
#else
printf("%02X ", buf[0]);
if (((count-3) % 8) == 0)
printf("<br>\n");
#endif
}
if (count == (target+3))
count = 0;
else
count++;
}
else /* mode >= 1 */
{
printf("%02x %02x %02x %02x %02x %02x %02x %02x &nbsp; &nbsp; &nbsp; &nbsp; ",
(unsigned)buf[0], (unsigned)buf[1], (unsigned)buf[2], (unsigned)buf[3],
(unsigned)buf[4], (unsigned)buf[5], (unsigned)buf[6], (unsigned)buf[7]);
putchar(buf[0]); putchar(buf[1]);
putchar(buf[2]); putchar(buf[3]);
putchar(buf[4]); putchar(buf[5]);
putchar(buf[6]); putchar(buf[7]);
printf("<br>\n");
}
}
/* Output Tail */
printf("</BODY></HTML>\n");
cole_fclose(cf, &err);
}
static void output_opcode_string(int opcode)
{
switch (opcode&0x00FF)
{
case 0x10:
case 0x01:
puts("UNITS: Chart Units");
break;
case 0x02:
puts("CHART: Location and overall chart dimensions");
break;
case 0x03:
puts("SERIES: Series Definition");
break;
case 0x06:
puts("DATAFORMAT: Series and Data Point Numbers");
break;
case 0x07:
puts("LINEFORMAT: Style of a line or border");
break;
case 0x09:
puts("MARKERFORMAT: Style of a line marker");
break;
case 0x0A:
puts("AREAFORMAT: Colors and patterns for an area");
break;
case 0x0B:
puts("PIEFORMAT: Position of the pie slice");
break;
case 0x0C:
puts("ATTACHEDLABEL: Series data/value labels");
break;
case 0x0D:
puts("SERIESTEXT: Legend/category/value text");
break;
case 0x14:
puts("CHARTFORMAT: Parent record for chart group");
break;
case 0x15:
puts("LEGEND: Legend type and position");
break;
case 0x16:
puts("SERIESLIST: Specifies the series in an overlay chart");
break;
case 0x17:
puts("BAR: Chart group is a bar or column chart group");
break;
case 0x18:
puts("LINE: Chart group is a line chart group");
break;
case 0x19:
puts("PIE: Chart group is a pie chart group");
break;
case 0x1A:
puts("AREA: Chart group is an area chart group");
break;
case 0x1B:
puts("SCATTER: Chart group is a scatter chart group");
break;
case 0x1C:
puts("CHARTLINE: Drop/Hi-Lo/Series Lines on a line chart");
break;
case 0x1D:
puts("AXIS: Axis Type");
break;
case 0x1E:
puts("TICK: Tick marks and labels format");
break;
case 0x1F:
puts("VALUERANGE: Defines value axis scale");
break;
case 0x20:
puts("CATSERRANGE: Defines a category or series axis");
break;
case 0x21:
puts("AXISLINEFORMAT: Defines a line that spans an axis");
break;
case 0x22:
puts("CHARTFORMTLINK: Not Used");
break;
case 0x24:
puts("DEFAULTTEXT: Default data label text properties");
break;
case 0x25:
puts("TEXT: Defines display of text fields");
break;
case 0x26:
puts("FONTX: Font Index");
break;
case 0x27:
puts("OBJECTLINK: Attaches Text to chart or chart item");
break;
case 0x32:
puts("FRAME: Defines border shape around displayed text");
break;
case 0x33:
puts("BEGIN: Defines the beginning of an object");
break;
case 0x34:
puts("END: Defines the end of an object");
break;
case 0x35:
puts("PLOTAREA: Frame belongs to ploat area");
break;
case 0x3A:
puts("3d Chart group");
break;
case 0x3C:
puts("PICF: Picture Format");
break;
case 0x3D:
puts("DROPBAR: Defines drop bars");
break;
case 0x3E:
puts("RADAR: Chart group is a radar chart group");
break;
case 0x3F:
puts("SURFACE: Chart group is a surface chart group");
break;
case 0x40:
puts("RADARAREA: Chart group is a radar area chart group");
break;
case 0x41:
puts("AXISPARENT: Axis size and location");
break;
case 0x43:
puts("LEGENDXN: Legend Exception");
break;
case 0x44:
puts("SHTPROPS: Sheet Properties");
break;
case 0x45:
puts("SERTOCRT: Series chart-group index");
break;
case 0x46:
puts("AXESUSED: Number of axes sets");
break;
case 0x48:
puts("SBASEREF: PivotTable Reference");
break;
case 0x4A:
puts("SERPARENT: Trendline or Errorbar series index");
break;
case 0x4B:
puts("SERAUXTREND: Series trendline");
break;
case 0x4E:
puts("IFMT: Number-Format Index");
break;
case 0x4F:
puts("POS: Position information");
break;
case 0x50:
puts("ALRUNS: Text formatting");
break;
case 0x51:
puts("AI: Linked data");
break;
case 0x5B:
puts("Series ErrorBar");
break;
case 0x5D:
puts("SERFMT: Series Format");
break;
case 0x60:
puts("FBI: Font Basis");
break;
case 0x61:
puts("BOPPOP: Bar of pie/pie of pie chart options");
break;
case 0x62:
puts("AXCEXT: Axis options");
break;
case 0x63:
puts("DAT: Data Table Options");
break;
case 0x64:
puts("PLOTGROWTH: Font scale factors");
break;
case 0x65:
puts("SIINDEX: Series Index");
break;
case 0x66:
puts("GELFRAME: Fill data");
break;
case 0x67:
puts("Custom bar of pie/ pie of pie chart options");
break;
default:
puts("Unknown Chart Opcode");
break;
}
}

591
xlhtml/xldump.c Normal file
View File

@@ -0,0 +1,591 @@
/*
dump - dumps individual records for analysis
Copyright 2002 Charles N Wyble <jackshck@yahoo.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#if !(defined( __BORLANDC__ ) || defined( __WIN32__ ))
#include "config.h" /* Created by ./configure script */
#include "cole.h"
#else
#include "config.h.in" /* Created by ./configure script */
#include "cole.h.in"
#include <io.h> /* for umask */
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h> /* for strcpy() */
#include <ctype.h> /* For isprint */
#define MODE 0 /* 0 - ascii; 1 - hex */
#define TEXT 0 /* In ascii mode, 0 - ascii, 1 - hex */
#define PRGNAME "xldump"
#define MAX_COLS 64
#define MAX_ROWS 512
static char FileName[2][12] = /* The section of the Excel Spreadsheet we read in */
{
"/Workbook", /* Office 97 */
"/Book" /* Everything else ? */
};
/* Function Prototypes */
COLE_LOCATE_ACTION_FUNC dump_file;
/*static void main_line_processor(int opcode, char data);*/
static void output_opcode_string(int);
/* Global data */
static char filename[128];
int main (int argc, char **argv)
{
int f_ptr = 0;
COLEFS * cfs;
COLERRNO colerrno;
if (argc < 2)
{
fprintf (stderr, "dump - Outputs excel file records for analysis.\n"
"Usage: "PRGNAME" <FILE>\n");
exit (1);
}
else
{
strncpy(filename, argv[1], 124);
cfs = cole_mount (filename, &colerrno);
if (cfs == NULL)
{
cole_perror (PRGNAME, colerrno);
exit (1);
}
}
while (cole_locate_filename (cfs, FileName[f_ptr], NULL, dump_file, &colerrno))
{
if (f_ptr)
{
cole_perror (PRGNAME, colerrno);
break;
}
else
f_ptr++;
}
if (cole_umount (cfs, &colerrno))
{
cole_perror ("travel", colerrno);
exit (1);
}
return 0;
}
void dump_file(COLEDIRENT *cde, void *_info)
{
unsigned int length=0, opcode=0, target=0, count = 0;
unsigned char buf[16];
COLEFILE *cf;
COLERRNO err;
cf = cole_fopen_direntry(cde, &err);
/* Ouput Header */
printf("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2//EN\">\n");
printf("<HTML><HEAD><TITLE>%s", filename);
printf("</TITLE></HEAD><BODY>\n");
/* Output body */
#if (MODE == 1)
while (cole_fread(cf, buf, 8, &err)) /* For mode >= 1 */
#else
while (cole_fread(cf, buf, 1, &err))
#endif
{
if (MODE == 0)
{
if (count == 0)
{
length = 0;
opcode = (unsigned)buf[0];
target = 80; /* ficticious number */
printf("<br>");
}
else if (count == 1)
opcode |= (buf[0]<<8)&0x0000FFFFL;
else if (count == 2)
length = (unsigned)buf[0];
else if (count == 3)
{
length |= (buf[0]<<8);
target = length;
printf("<br>\nLength:%04X Opcode:%04X - ", length, opcode);
output_opcode_string(opcode);
puts("<br>\n");
}
if (count > 3)
{ /* Here is where we want to process the data */
/* based on the opcode... */
#if (TEXT == 0)
if (isprint(buf[0]))
putc(buf[0], stdout);
#else
printf("%02X ", buf[0]);
if (((count-3) % 8) == 0)
printf("<br>\n");
#endif
}
if (count == (target+3))
count = 0;
else
count++;
}
else /* mode >= 1 */
{
printf("%02x %02x %02x %02x %02x %02x %02x %02x &nbsp; &nbsp; &nbsp; &nbsp; ",
(unsigned)buf[0], (unsigned)buf[1], (unsigned)buf[2], (unsigned)buf[3],
(unsigned)buf[4], (unsigned)buf[5], (unsigned)buf[6], (unsigned)buf[7]);
putchar(buf[0]); putchar(buf[1]);
putchar(buf[2]); putchar(buf[3]);
putchar(buf[4]); putchar(buf[5]);
putchar(buf[6]); putchar(buf[7]);
printf("<br>\n");
}
}
/* Output Tail */
printf("</BODY></HTML>\n");
cole_fclose(cf, &err);
}
/*static void main_line_processor(int opcode, char data)
{
}
*/
static void output_opcode_string(int opcode)
{
switch (opcode&0x00FF)
{
/* start of documented general opcodes */
case 0x0A:
puts("\nEOF: End of File");
break;
case 0x0C:
puts("CALCCOUNT: Iteration count");
break;
case 0x0D:
puts("CalcMode: Calculation mode");
break;
case 0x0E:
puts("Precision");
break;
case 0x0F:
puts("Reference Mode");
break;
case 0x10:
puts("Delta: Iteration Increment");
break;
case 0x11:
puts("Iteration Mode");
break;
case 0x12:
puts("Protection Flag");
break;
case 0x13:
puts("Protection Password");
break;
case 0x14:
puts("Print Header on each page");
break;
case 0x15:
puts("Print Footer on each page");
break;
case 0x16:
puts("External Count: Number of external references");
break;
case 0x17:
puts("External reference");
break;
case 0x19:
puts("Windows are Protected");
break;
case 0x1A:
puts("Vertical Page Breaks");
break;
case 0x1B:
puts("Horizontal Page Breaks");
break;
case 0x1C:
puts("Cell Note");
break;
case 0x1D:
puts("Selection");
break;
case 0x22:
puts("1904 date system");
break;
case 0x26:
puts("Left Margin Measurement");
break;
case 0x27:
puts("Right Margin Measurement");
break;
case 0x28:
puts("Top Margin Measurement");
break;
case 0x29:
puts("Bottom Margin Measurement");
break;
case 0x2A:
puts("Print Row/Column Labels");
break;
case 0x2B:
puts("Print Gridlines Flag");
break;
case 0x2F:
puts("File is Password protected");
break;
case 0x3C:
puts("Continues long records");
break;
case 0x3D:
puts("Window1");
break;
case 0x40:
puts("BACKUP: Save Backup Version of the File");
break;
case 0x41:
puts("Number of Panes and their position");
break;
/* error in ms docs.
case 0x42:
puts("CODEPAGE: Default code page");
break;
case 0x42:
puts("CODENAME: VBE Object Name");
break;
*/
case 0x4D:
puts("PLS: Environment specific print record");
break;
case 0x50:
puts("DCON: Data consolidation information");
break;
case 0x51:
puts("DCONREF: Data consolidation references");
break;
case 0x52:
puts("DCONNAME: Data Consolidation Named References");
break;
case 0x55:
puts("DEFCOLWIDTH: Default Column Width");
break;
case 0x59:
puts("XCT: CRN Record Count");
break;
case 0x5A:
puts("CRN: Nonresident operands");
break;
case 0x5B:
puts("FILESHARING:File-sharing information");
break;
case 0x5C:
puts("Write Access");
break;
case 0x5D:
puts("OBJ: Describes a Graphic object");
break;
case 0x5E:
puts("UNCALCED: Recalculation Status");
break;
case 0x5F:
puts("SAVERECALC: Recalculate before save");
break;
case 0x60:
puts("TEMPLATE: Workbook is a template");
break;
case 0x63:
puts("OBJPROTECT: Objects are protected");
break;
case 0x7D:
puts("COLINFO: Column formatting information");
break;
case 0x7E:
puts("RK Number");
break;
case 0x7F:
puts("IMDATA: Image data");
break;
case 0x80:
puts("GUTS: Size of row and column gutters");
break;
case 0x81:
puts("WSBOOL: Additional workspace information");
break;
case 0x82:
puts("GRIDSET: State change of gridlines option");
break;
case 0x83:
puts("HCENTER: Center between horizontal margins");
break;
case 0x84:
puts("VCENTER: Center between vertical margins");
break;
case 0x85:
puts("BoundSheet");
break;
case 0x86:
puts("WRITEPROT: Workbook is Write-protected");
break;
case 0x87:
puts("ADDIN: Workbook is add-in macro");
break;
case 0x88:
puts("EDG: Edition globals");
break;
case 0x89:
puts("PUB: Publisher");
break;
case 0x8C:
puts("COUNTRY: Default country and WIN.INI Country");
break;
case 0x8D:
puts("HIDEOBJ: Object display options");
break;
case 0x90:
puts("SORT: Sorting options");
break;
case 0x91:
puts("SUB: Subscriber");
break;
case 0x92:
puts("Palette Info");
break;
case 0x94:
puts("LHRECORD: .WK? File Conversion Information");
break;
case 0x95:
puts("LHNGRAPH: Named Graph Information");
break;
case 0x96:
puts("SOUND: Sound note");
break;
case 0x98:
puts("LPR: Sheet was printed using LINE.PRINT()");
break;
case 0x99:
puts("STANDARDWIDTH: Standard column width");
break;
case 0x9A:
puts("FNGROUPNAME: Function Group name");
break;
case 0x9B:
puts("FILTERMODE: Sheet contains filtered list");
break;
case 0x9C:
puts("FNGROUPCOUNT: Built-in function group count");
break;
case 0x9D:
puts("AUTOFILTERINFO: Drop Down Arrow Count");
break;
case 0x9E:
puts("AUTOFILTER: AutoFilter data");
break;
case 0xA0:
puts("SCL: Window Zoom magnification");
break;
case 0xA1:
puts("Page Setup");
break;
case 0xA9:
puts("COORDLIST: Polygon Object Vertex coordinates");
break;
case 0xAB:
puts("GCW: Global Column-Wdith flags");
break;
case 0xAE:
puts("SCENMAN: Scenario Output data");
break;
case 0xAF:
puts("PROT4REV: Shared Workbook protection flag");
break;
case 0xB0:
puts("SXVIEW: View Definition");
break;
case 0xB1:
puts("SXVD: View Fields");
break;
case 0xB2:
puts("SXVI: View Item");
break;
case 0xB4:
puts("SXIVD: Row/Column Field Ids");
break;
case 0xB5:
puts("SXLI: Line item array");
break;
case 0xB6:
puts("SXPI: Page item");
break;
case 0xB8:
puts("DOCROUTE: Routing slip information");
break;
case 0xB9:
puts("RECIPNAME: Recipient name");
break;
case 0xBC:
puts("SHRFMLA: Shared formula");
break;
case 0xBD:
puts("MULRK: Multiple RK cells");
break;
case 0xBE:
puts("Multiple Blanks");
break;
case 0xC1:
puts("MMS: ADDMENU/DELMENU Record Group count");
break;
case 0xC2:
puts("ADDMENU: Menu Addition");
break;
case 0xC3:
puts("DELMENU: Menu Deletion");
break;
case 0xC5:
puts("SXDI: Data Item");
break;
case 0xC6:
puts("SXDB: PivtoTable Cache Data");
break;
case 0xCD:
puts("SXSTRING: String");
break;
case 0xD0:
puts("SXTBL: Multiple Consolidation Source Info");
break;
case 0xD1:
puts("SXTBRGIITM: Page Item Name Count");
break;
case 0xD2:
puts("SXTBPG: Page Item Indexes");
break;
case 0xD3:
puts("OBPROJ: Visual Basic Project");
break;
case 0xD5:
puts("SXIDSTM: Stream ID");
break;
case 0xD6:
puts("RString");
break;
case 0xD7:
puts("DBCELL: Stream offsets");
break;
case 0xDA:
puts("BOOKBOOL: Workbook option flag");
break;
/* error in ms docs
case 0xDC:
puts("PARAMQRY: Query parameters");
break;
case 0xDC:
puts("SXEXT: External source information");
break;
*/
case 0xDD:
puts("SCENPROTECT: Scenario protection");
break;
case 0xDE:
puts("OLESIZE: Size of an OLE object");
break;
case 0xDF:
puts("UDDESC: Description string for chart autoformat");
break;
case 0xE0:
puts("Extended Format");
break;
case 0xE1:
puts("INTERFACEHDR: Beginning of User Interface Records");
break;
case 0xE2:
puts("INTERFACEEND: End of User interface records");
break;
case 0xE3:
puts("SXVS: View source");
break;
case 0xEA:
puts("TABIDCONF: Sheet tab ID of Conflict history");
break;
case 0xEB:
puts("MSODRAWINGGROUP: MS Office Drawing Group");
break;
case 0xEC:
puts("MSODRAWING: MS Office Drawing");
break;
case 0xED:
puts("MS Office Drawing Selection");
break;
case 0xF0:
puts("SXRULE: PivotTable Rule data");
break;
case 0xF1:
puts("SXEX: PivotTable Extended information");
break;
case 0xF2:
puts("SXFILT: PivotTable Rule Filter");
break;
case 0xF6:
puts("SXNAME: PivotTable Name");
break;
case 0xF7:
puts("SXSELECT: PivotTable Selection Information");
break;
case 0xF8:
puts("PivotTable Name Pair");
break;
case 0xF9:
puts("PivotTable Parsed Expression");
break;
case 0xFB:
puts("PivotTable Format Record");
break;
case 0xFC:
puts("Shared String Table");
break;
case 0xFD:
puts("Cell Value, String Constant/SST");
break;
case 0xFF:
puts("Extended Shared String Table");
break;
default:
puts("Unknown Opcode");
break;
}
}

75
xlhtml/xlhtml.1 Normal file
View File

@@ -0,0 +1,75 @@
.\"Created with GNOME Manpages Editor Wizard
.\"http://gmanedit.sourceforge.net
.\"Sergio Rua <srua@gpul.org>
.\"
.TH xlhtml 1 "October 13, 2001" "xlhtml"
.SH NAME
xlhtml \- A program for converting Microsoft Excel Files .xls
.SH SYNOPSIS
.B xlhtml
.RI [ -nc ] [ -a ] [ -fw ] [ -bcNNNNNN ] [ -tcNNNNNN ] [ -bi/path ] [ -c ] [ -te ] [ -v ] [ -m ] [ -asc ] [ -dp ] [ -xp:N ] [ -xc:N ] [ -xr:N ] [ -xml ] [ -csv ]
.br
.SH DESCRIPTION
This manual page explains the
.B xlhtml
program. The program
.B xlhtml
is used to convert Microsoft Excel Spreadsheet files into either html or tab delimitted ASCII. The program can be interfaced with helper scripts for viewing email attachments. Most use of this program is through the helper scripts and one would probably rarely resort to using the commandline interface.
.SH OPTIONS
.B
.IP -nc
tells it not to colorize the output.
.IP -a
aggressively optimize html by removing </TR> </TD> or VALIGN="bottom" Some older browsers may not display properly in this mode.
.IP -fw
suppress formula warnings about accuracy
.IP -bc
Override the background color. e.g. -bg808080 for gray
.IP -tc
Override the text color. e.g. -tcFF0000 for red
.IP -bi
Use background image. e.g. -bi/home/httpd/icon/tar.gif
.IP -c
Centers the tables horizontally
.IP -te
Trims empty rows & columns at the edges of a worksheet
.IP -v
Prints program version
.IP -m
No encoding for multibyte
.IP -asc
Ascii out of -dp and extraction data (-x?)
.IP -dp
Dump page count and max columns and rows per page
.IP -xp
Page for extraction (zero based)
.IP -xc
Columns (separated by a dash) for extraction (zero based)
.IP -xr
Rows (separated by a dash) to be extracted (zero based)
.IP -xml
Output in XML
.IP -csv
Output in Comma Separated Values
.IP -nh
Suppress header and body tags in html output
An example of the extraction command line is:
xlhtml -fw -asc -xp:0 -xr:2-6 -xc:0-1 Test.xls
The extraction output is:
Formatted output of cells by column left to right, columns separated by a tab, end of row is: 0x0A, end of file: \n\n
.SH NOTES
To interface to Netscape Navigator: first locate the help scripts nsxlview & nsopen. Go into the Edit Preferences dialog box. Click on the Navigator Category and hilight the Applications menu item. Look for Microsoft Excel Worksheet. If you don't see it create one. The MIME type should be: application/vnd.ms-excel The suffixes should be: xls,xlt,xlm,xld,xla,xlc,xlw,xll In the handled by section of the dialog box, check the Application checkbox and set the path to wherever the nsxlview helper script is located and pass a %s argument. For example, if nsxlview is located in /usr/local/bin, then you would put:
/usr/local/bin/nsxlview %s
in the Application path box.. (As a side note, make sure the nsxlview script can find the xlhtml program or it won't work.) Click on the OK and you are done. You should be able to use the Test.xls file that is distributed with the program to verify its configured correctly.
.SH AUTHOR
Charles N Wyble

4636
xlhtml/xlhtml.c Normal file

File diff suppressed because it is too large Load Diff

45
xlhtml/xlhtml.h Normal file
View File

@@ -0,0 +1,45 @@
#if !(defined( __BORLANDC__ ) || defined( __WIN32__ ))
#include "config.h" /* Created by ./configure script */
#include "support.h" /* Needs to be before internal.h */
#include "internal.h" /* Needs to be before cole */
#include "cole.h"
#else
#include "config.h.in" /* Created by ./configure script */
#include "support.h" /* Needs to be before internal.h */
#include "internal.h" /* Needs to be before cole */
#include "cole.h.in"
#include <io.h> /* for umask */
#include <dir.h>
#endif
#include <stdlib.h> /* For atof(), calloc() */
#include <string.h> /* For string functions */
#include <math.h> /* For fabs() */
#include <ctype.h> /* For isprint() */
#include <errno.h>
/* Used by packed string array Opcode: 0xFC */
#define HARD_MAX_ROWS_97 0x7FFE /*!< Used in add_wb_array to prevent OOM */
#define HARD_MAX_ROWS_95 0x3FFF /*!< Used in add_wb_array to prevent OOM */
#define HARD_MAX_COLS 256 /*!< Used in add_wb_array to prevent OOM */
U16 HARD_MAX_ROWS = HARD_MAX_ROWS_97;
/**********************************
*
* Don't change anything below here...
*
************************************/
#if defined( __WIN32__ ) || defined( __BORLANDC__ )
#define VERSION "0.4.9.1"
#endif
#define PRGNAME "xlhtml"
#define WBUFF_SIZE 8240 /*!< The working buffer. SB 522+10+4(header) bytes minimum = 536 */
#define MAX_COLORS 65 /*!< This is the size of the built-in color table */
#define EXCEL95 0x500 /*!< This is the file stamp for biff7 - Excel 5 & 95 */
#define EXCEL97 0x600 /*!< This is the file stamp for biff8 - Excel 97 & 2000 */
#if !(defined( __WIN32__ ) || defined( __BORLANDC__ ))
#include <sys/stat.h>
#define GLOBAL_UMASK (S_IXUSR|S_IWGRP|S_IRGRP|S_IXGRP|S_IWOTH|S_IROTH|S_IXOTH)
#else
#define GLOBAL_UMASK (2)
#endif

8
xlhtml/xls-handler Executable file
View File

@@ -0,0 +1,8 @@
#!/bin/sh
echo "Content-type: text/html"
echo
echo
/usr/local/bin/xlhtml $PATH_TRANSLATED

1331
xlhtml/xyz Normal file

File diff suppressed because it is too large Load Diff