Some more code modularization.
This commit is contained in:
parent
4f2cdde40b
commit
117379f7a6
@ -9,7 +9,7 @@ man_MANS = xlhtml.1
|
||||
bin_SCRIPTS = nsopen nsxlview
|
||||
bin_PROGRAMS = xlhtml
|
||||
LDADD = ../cole/libcole.a -lm
|
||||
xlhtml_SOURCES = support.c xlhtml.c html.c ascii.c xml.c
|
||||
xlhtml_SOURCES = support.c xlhtml.c html.c ascii.c xml.c setupExtraction.c engine.c
|
||||
xldump_SOURCES = xldump.c
|
||||
xlcdump_SOURCES = xlcdump.c
|
||||
AM_CFLAGS = -Wall -Wshadow -Wcast-align -Wpointer-arith
|
||||
|
@ -83,9 +83,10 @@ man_MANS = xlhtml.1
|
||||
bin_SCRIPTS = nsopen nsxlview
|
||||
bin_PROGRAMS = xlhtml
|
||||
LDADD = ../cole/libcole.a -lm
|
||||
xlhtml_SOURCES = support.c xlhtml.c html.c ascii.c xml.c
|
||||
xlhtml_SOURCES = support.c xlhtml.c html.c ascii.c xml.c setupExtraction.c engine.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 =
|
||||
@ -96,7 +97,8 @@ DEFS = @DEFS@ -I. -I$(srcdir) -I..
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBS = @LIBS@
|
||||
xlhtml_OBJECTS = support.o xlhtml.o html.o ascii.o xml.o
|
||||
xlhtml_OBJECTS = support.o xlhtml.o html.o ascii.o xml.o \
|
||||
setupExtraction.o engine.o
|
||||
xlhtml_LDADD = $(LDADD)
|
||||
xlhtml_DEPENDENCIES = ../cole/libcole.a
|
||||
xlhtml_LDFLAGS =
|
||||
@ -109,7 +111,6 @@ xlcdump_LDADD = $(LDADD)
|
||||
xlcdump_DEPENDENCIES = ../cole/libcole.a
|
||||
xlcdump_LDFLAGS =
|
||||
SCRIPTS = $(bin_SCRIPTS) $(noinst_SCRIPTS)
|
||||
AM_CFLAGS = -Wall -Wshadow -Wcast-align -Wpointer-arith
|
||||
|
||||
CFLAGS = @CFLAGS@
|
||||
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
@ -384,6 +385,7 @@ 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: doxygen.conf xlhtml.c ascii.c xml.c html.c support.c xlhtml.h tuneable.h
|
||||
@echo Generating documentation...
|
||||
doxygen doxygen.conf
|
||||
|
@ -26,78 +26,85 @@
|
||||
|
||||
|
||||
|
||||
void OutputPartialTableAscii(void)
|
||||
void
|
||||
OutputPartialTableAscii (void)
|
||||
{
|
||||
int i, j, k;
|
||||
|
||||
SetupExtraction();
|
||||
SetupExtraction ();
|
||||
|
||||
/* Here's where we dump the Html Page out */
|
||||
for (i=first_sheet; i<=last_sheet; i++) /* For each worksheet */
|
||||
for (i = first_sheet; i <= last_sheet; i++) /* For each worksheet */
|
||||
{
|
||||
if (ws_array[i] == 0)
|
||||
continue;
|
||||
if ((ws_array[i]->biggest_row == -1)||(ws_array[i]->biggest_col == -1))
|
||||
if ((ws_array[i]->biggest_row == -1)
|
||||
|| (ws_array[i]->biggest_col == -1))
|
||||
continue;
|
||||
if (ws_array[i]->c_array == 0)
|
||||
continue;
|
||||
|
||||
/* Now dump the table */
|
||||
for (j=ws_array[i]->first_row; j<=ws_array[i]->biggest_row; j++)
|
||||
for (j = ws_array[i]->first_row; j <= ws_array[i]->biggest_row; j++)
|
||||
{
|
||||
for (k=ws_array[i]->first_col; k<=ws_array[i]->biggest_col; k++)
|
||||
for (k = ws_array[i]->first_col; k <= ws_array[i]->biggest_col; k++)
|
||||
{
|
||||
int safe, numeric=0;
|
||||
cell *c = ws_array[i]->c_array[(j*ws_array[i]->max_cols)+k]; /* This stuff happens for each cell... */
|
||||
int safe, numeric = 0;
|
||||
cell *c = ws_array[i]->c_array[(j * ws_array[i]->max_cols) + k]; /* This stuff happens for each cell... */
|
||||
|
||||
if (c)
|
||||
{
|
||||
numeric = IsCellNumeric(c);
|
||||
numeric = IsCellNumeric (c);
|
||||
if (!numeric && Csv)
|
||||
printf("\"");
|
||||
safe = IsCellSafe(c);
|
||||
printf ("\"");
|
||||
safe = IsCellSafe (c);
|
||||
|
||||
if (c->ustr.str)
|
||||
{
|
||||
if (safe)
|
||||
output_formatted_data(&(c->ustr), xf_array[c->xfmt]->fmt_idx, numeric, IsCellFormula(c));
|
||||
output_formatted_data (&(c->ustr),
|
||||
xf_array[c->xfmt]->fmt_idx,
|
||||
numeric, IsCellFormula (c));
|
||||
else
|
||||
OutputString(&(c->ustr));
|
||||
OutputString (&(c->ustr));
|
||||
}
|
||||
else if (!Csv)
|
||||
printf(" "); /* Empty cell... */
|
||||
printf (" "); /* Empty cell... */
|
||||
}
|
||||
else
|
||||
{ /* Empty cell... */
|
||||
if (!Csv)
|
||||
printf(" ");
|
||||
printf (" ");
|
||||
else
|
||||
printf("\"");
|
||||
printf ("\"");
|
||||
}
|
||||
if (ws_array[i]->c_array[(j*ws_array[i]->max_cols)+k]) /* Honor Column spanning ? */
|
||||
if (ws_array[i]->c_array[(j * ws_array[i]->max_cols) + k]) /* Honor Column spanning ? */
|
||||
{
|
||||
if (ws_array[i]->c_array[(j*ws_array[i]->max_cols)+k]->colspan != 0)
|
||||
k += ws_array[i]->c_array[(j*ws_array[i]->max_cols)+k]->colspan-1;
|
||||
if (ws_array[i]->c_array[(j * ws_array[i]->max_cols) + k]->
|
||||
colspan != 0)
|
||||
k +=
|
||||
ws_array[i]->c_array[(j * ws_array[i]->max_cols) +
|
||||
k]->colspan - 1;
|
||||
}
|
||||
if (!numeric && Csv)
|
||||
printf("\"");
|
||||
printf ("\"");
|
||||
|
||||
if (Csv && (k < ws_array[i]->biggest_col))
|
||||
{ /* big cheat here: quoting everything! */
|
||||
putchar(','); /* Csv Cell Separator */
|
||||
putchar (','); /* Csv Cell Separator */
|
||||
}
|
||||
else
|
||||
{
|
||||
if (( !Csv )&&( k != ws_array[i]->biggest_col ))
|
||||
putchar('\t'); /* Ascii Cell Separator */
|
||||
if ((!Csv) && (k != ws_array[i]->biggest_col))
|
||||
putchar ('\t'); /* Ascii Cell Separator */
|
||||
}
|
||||
}
|
||||
if (Csv)
|
||||
printf("\r\n");
|
||||
printf ("\r\n");
|
||||
else
|
||||
putchar(0x0A); /* Row Separator */
|
||||
putchar (0x0A); /* Row Separator */
|
||||
}
|
||||
if (!Csv)
|
||||
printf("\n\n"); /* End of Table 2 LF-CR */
|
||||
printf ("\n\n"); /* End of Table 2 LF-CR */
|
||||
}
|
||||
}
|
||||
|
323
xlhtml/html.c
323
xlhtml/html.c
@ -28,372 +28,395 @@
|
||||
|
||||
|
||||
/* prototypes for functions in this file */
|
||||
void output_header(void);
|
||||
void output_footer(void);
|
||||
void output_header (void);
|
||||
void output_footer (void);
|
||||
|
||||
|
||||
void OutputTableHTML(void)
|
||||
void
|
||||
OutputTableHTML (void)
|
||||
{
|
||||
int i, j, k;
|
||||
|
||||
output_header();
|
||||
output_header ();
|
||||
if (center_tables)
|
||||
{
|
||||
printf("<CENTER>");
|
||||
do_cr();
|
||||
printf ("<CENTER>");
|
||||
do_cr ();
|
||||
}
|
||||
|
||||
SetupExtraction();
|
||||
SetupExtraction ();
|
||||
|
||||
/* Here's where we dump the Html Page out */
|
||||
for (i=first_sheet; i<=last_sheet; i++) /* For each worksheet */
|
||||
for (i = first_sheet; i <= last_sheet; i++) /* For each worksheet */
|
||||
{
|
||||
update_default_font(i);
|
||||
update_default_font (i);
|
||||
if (ws_array[i] == 0)
|
||||
continue;
|
||||
if ((ws_array[i]->biggest_row == -1)||(ws_array[i]->biggest_col == -1))
|
||||
if ((ws_array[i]->biggest_row == -1)
|
||||
|| (ws_array[i]->biggest_col == -1))
|
||||
continue;
|
||||
if (ws_array[i]->c_array == 0)
|
||||
continue;
|
||||
trim_sheet_edges(i);
|
||||
trim_sheet_edges (i);
|
||||
|
||||
/* Print its name */
|
||||
if (next_ws_title > 0)
|
||||
{
|
||||
if (ws_array[i]->ws_title.str)
|
||||
{
|
||||
printf("<CENTER><H1>");
|
||||
OutputString(&ws_array[i]->ws_title);
|
||||
printf("</H1></CENTER><br>");
|
||||
do_cr();
|
||||
printf ("<CENTER><H1>");
|
||||
OutputString (&ws_array[i]->ws_title);
|
||||
printf ("</H1></CENTER><br>");
|
||||
do_cr ();
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("<H1><CENTER>(Unknown Page)</CENTER></H1><br>");
|
||||
do_cr();
|
||||
printf ("<H1><CENTER>(Unknown Page)</CENTER></H1><br>");
|
||||
do_cr ();
|
||||
}
|
||||
}
|
||||
|
||||
/* Now dump the table */
|
||||
printf("<FONT FACE=\"");
|
||||
OutputString(&default_font);
|
||||
printf ("<FONT FACE=\"");
|
||||
OutputString (&default_font);
|
||||
if (default_fontsize != 3)
|
||||
printf("\" SIZE=\"%d", default_fontsize);
|
||||
printf("\">");
|
||||
do_cr();
|
||||
printf("<TABLE BORDER=\"1\" CELLSPACING=\"2\">");
|
||||
do_cr();
|
||||
printf ("\" SIZE=\"%d", default_fontsize);
|
||||
printf ("\">");
|
||||
do_cr ();
|
||||
printf ("<TABLE BORDER=\"1\" CELLSPACING=\"2\">");
|
||||
do_cr ();
|
||||
if (TableHeaders)
|
||||
{
|
||||
printf("<TR><TH></TH>");
|
||||
for (k=ws_array[i]->first_col; k<=ws_array[i]->biggest_col; k++)
|
||||
printf ("<TR><TH></TH>");
|
||||
for (k = ws_array[i]->first_col; k <= ws_array[i]->biggest_col; k++)
|
||||
{
|
||||
char col_hdr[3];
|
||||
if (k < 26)
|
||||
{
|
||||
col_hdr[0]='A' + (k % 26);
|
||||
col_hdr[1]='\0';
|
||||
col_hdr[0] = 'A' + (k % 26);
|
||||
col_hdr[1] = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
col_hdr[0]='A' - 1 + (k / 26);
|
||||
col_hdr[1]='A' + (k % 26);
|
||||
col_hdr[2]='\0';
|
||||
col_hdr[0] = 'A' - 1 + (k / 26);
|
||||
col_hdr[1] = 'A' + (k % 26);
|
||||
col_hdr[2] = '\0';
|
||||
}
|
||||
printf("<TH>%s%s",col_hdr,(aggressive ? "" : "</TH>"));
|
||||
printf ("<TH>%s%s", col_hdr, (aggressive ? "" : "</TH>"));
|
||||
}
|
||||
printf("</TR>\n");
|
||||
printf ("</TR>\n");
|
||||
}
|
||||
for (j=ws_array[i]->first_row; j<=ws_array[i]->biggest_row; j++)
|
||||
for (j = ws_array[i]->first_row; j <= ws_array[i]->biggest_row; j++)
|
||||
{
|
||||
update_default_alignment(i, j);
|
||||
printf("<TR");
|
||||
if (null_string((U8 *)default_alignment))
|
||||
printf(">");
|
||||
update_default_alignment (i, j);
|
||||
printf ("<TR");
|
||||
if (null_string ((U8 *) default_alignment))
|
||||
printf (">");
|
||||
else
|
||||
{
|
||||
if (strcmp(default_alignment, "left") != 0)
|
||||
printf(" ALIGN=\"%s\"", default_alignment);
|
||||
if (strcmp (default_alignment, "left") != 0)
|
||||
printf (" ALIGN=\"%s\"", default_alignment);
|
||||
if (!aggressive)
|
||||
printf(" VALIGN=\"bottom\">\n");
|
||||
printf (" VALIGN=\"bottom\">\n");
|
||||
else
|
||||
printf(">");
|
||||
printf (">");
|
||||
}
|
||||
if (TableHeaders)
|
||||
printf("<TH>%d%s",j+1,(aggressive ? "" : "</TH>"));
|
||||
for (k=ws_array[i]->first_col; k<=ws_array[i]->biggest_col; k++)
|
||||
printf ("<TH>%d%s", j + 1, (aggressive ? "" : "</TH>"));
|
||||
for (k = ws_array[i]->first_col; k <= ws_array[i]->biggest_col; k++)
|
||||
{
|
||||
output_cell(ws_array[i]->c_array[(j*ws_array[i]->max_cols)+k],0); /* This stuff happens for each cell... */
|
||||
if (ws_array[i]->c_array[(j*ws_array[i]->max_cols)+k])
|
||||
output_cell (ws_array[i]->c_array[(j * ws_array[i]->max_cols) + k], 0); /* This stuff happens for each cell... */
|
||||
if (ws_array[i]->c_array[(j * ws_array[i]->max_cols) + k])
|
||||
{
|
||||
if (ws_array[i]->c_array[(j*ws_array[i]->max_cols)+k]->colspan != 0)
|
||||
k += ws_array[i]->c_array[(j*ws_array[i]->max_cols)+k]->colspan-1;
|
||||
if (ws_array[i]->c_array[(j * ws_array[i]->max_cols) + k]->
|
||||
colspan != 0)
|
||||
k +=
|
||||
ws_array[i]->c_array[(j * ws_array[i]->max_cols) +
|
||||
k]->colspan - 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (!aggressive)
|
||||
printf("</TR>\n");
|
||||
printf ("</TR>\n");
|
||||
}
|
||||
printf("</TABLE></FONT><HR>");
|
||||
do_cr();
|
||||
printf ("</TABLE></FONT><HR>");
|
||||
do_cr ();
|
||||
}
|
||||
|
||||
if (center_tables)
|
||||
{
|
||||
printf("</CENTER>");
|
||||
do_cr();
|
||||
printf ("</CENTER>");
|
||||
do_cr ();
|
||||
}
|
||||
|
||||
/* Print the author's name in itallics... */
|
||||
if (author.str)
|
||||
{
|
||||
printf("<FONT SIZE=\"-1\"><I>Spreadsheet's Author: ");
|
||||
OutputString(&author);
|
||||
printf("</I></FONT><br>");
|
||||
do_cr();
|
||||
printf ("<FONT SIZE=\"-1\"><I>Spreadsheet's Author: ");
|
||||
OutputString (&author);
|
||||
printf ("</I></FONT><br>");
|
||||
do_cr ();
|
||||
}
|
||||
|
||||
/* Print when & how the file was last updated. */
|
||||
printf("<FONT SIZE=\"-1\"><I>Last Updated ");
|
||||
printf ("<FONT SIZE=\"-1\"><I>Last Updated ");
|
||||
if (lastUpdated)
|
||||
printf("%s ", lastUpdated);
|
||||
printf ("%s ", lastUpdated);
|
||||
switch (file_version)
|
||||
{
|
||||
case EXCEL95:
|
||||
printf("with Excel 5.0 or 95");
|
||||
printf ("with Excel 5.0 or 95");
|
||||
break;
|
||||
case EXCEL97:
|
||||
printf("with Excel 97");
|
||||
printf ("with Excel 97");
|
||||
break;
|
||||
default:
|
||||
printf("with Excel ????");
|
||||
printf ("with Excel ????");
|
||||
break;
|
||||
}
|
||||
printf("</I></FONT><br>");
|
||||
do_cr();
|
||||
printf ("</I></FONT><br>");
|
||||
do_cr ();
|
||||
|
||||
/* Next print Disclaimers... */
|
||||
if (NoFormat)
|
||||
{
|
||||
printf("<br>* This cell's format is not supported.<br>");
|
||||
do_cr();
|
||||
printf ("<br>* This cell's format is not supported.<br>");
|
||||
do_cr ();
|
||||
}
|
||||
if ((notAccurate)&&(formula_warnings))
|
||||
if ((notAccurate) && (formula_warnings))
|
||||
{
|
||||
printf("<br>** This cell's data may not be accurate.<br>");
|
||||
do_cr();
|
||||
printf ("<br>** This cell's data may not be accurate.<br>");
|
||||
do_cr ();
|
||||
}
|
||||
if (NotImplemented)
|
||||
{
|
||||
printf("<br>*** This cell's data type will be supported in the future.<br>");
|
||||
do_cr();
|
||||
printf
|
||||
("<br>*** This cell's data type will be supported in the future.<br>");
|
||||
do_cr ();
|
||||
}
|
||||
if (Unsupported)
|
||||
{
|
||||
printf("<br>**** This cell's type is unsupported.<br>");
|
||||
do_cr();
|
||||
printf ("<br>**** This cell's type is unsupported.<br>");
|
||||
do_cr ();
|
||||
}
|
||||
|
||||
/* Now out exceeded capacity warnings... */
|
||||
if (MaxWorksheetsExceeded || MaxRowExceeded || MaxColExceeded || MaxStringsExceeded ||
|
||||
MaxFontsExceeded || MaxPalExceeded || MaxXFExceeded || MaxFormatsExceeded )
|
||||
printf("<FONT COLOR=\"%s\">", colorTab[0x0A]);
|
||||
if (MaxWorksheetsExceeded || MaxRowExceeded || MaxColExceeded
|
||||
|| MaxStringsExceeded || MaxFontsExceeded || MaxPalExceeded
|
||||
|| MaxXFExceeded || MaxFormatsExceeded)
|
||||
printf ("<FONT COLOR=\"%s\">", colorTab[0x0A]);
|
||||
if (MaxWorksheetsExceeded)
|
||||
{
|
||||
printf("The Maximum Number of Worksheets was exceeded, you might want to increase it.<br>");
|
||||
do_cr();
|
||||
printf
|
||||
("The Maximum Number of Worksheets was exceeded, you might want to increase it.<br>");
|
||||
do_cr ();
|
||||
}
|
||||
if (MaxRowExceeded)
|
||||
{
|
||||
printf("The Maximum Number of Rows was exceeded, you might want to increase it.<br>");
|
||||
do_cr();
|
||||
printf
|
||||
("The Maximum Number of Rows was exceeded, you might want to increase it.<br>");
|
||||
do_cr ();
|
||||
}
|
||||
if (MaxColExceeded)
|
||||
{
|
||||
printf("The Maximum Number of Columns was exceeded, you might want to increase it.<br>");
|
||||
do_cr();
|
||||
printf
|
||||
("The Maximum Number of Columns was exceeded, you might want to increase it.<br>");
|
||||
do_cr ();
|
||||
}
|
||||
if (MaxStringsExceeded)
|
||||
{
|
||||
printf("The Maximum Number of Strings was exceeded, you might want to increase it.<br>");
|
||||
do_cr();
|
||||
printf
|
||||
("The Maximum Number of Strings was exceeded, you might want to increase it.<br>");
|
||||
do_cr ();
|
||||
}
|
||||
if (MaxFontsExceeded)
|
||||
{
|
||||
printf("The Maximum Number of Fonts was exceeded, you might want to increase it.<br>");
|
||||
do_cr();
|
||||
printf
|
||||
("The Maximum Number of Fonts was exceeded, you might want to increase it.<br>");
|
||||
do_cr ();
|
||||
}
|
||||
if (MaxPalExceeded)
|
||||
{
|
||||
printf("The Maximum Number of Color Palettes was exceeded, you might want to increase it.<br>");
|
||||
do_cr();
|
||||
printf
|
||||
("The Maximum Number of Color Palettes was exceeded, you might want to increase it.<br>");
|
||||
do_cr ();
|
||||
}
|
||||
if (MaxXFExceeded)
|
||||
{
|
||||
printf("The Maximum Number of Extended Formats was exceeded, you might want to increase it.<br>");
|
||||
do_cr();
|
||||
printf
|
||||
("The Maximum Number of Extended Formats was exceeded, you might want to increase it.<br>");
|
||||
do_cr ();
|
||||
}
|
||||
if (MaxFormatsExceeded)
|
||||
{
|
||||
printf("The Maximum Number of Formats was exceeded, you might want to increase it.<br>");
|
||||
do_cr();
|
||||
printf
|
||||
("The Maximum Number of Formats was exceeded, you might want to increase it.<br>");
|
||||
do_cr ();
|
||||
}
|
||||
if (MaxWorksheetsExceeded || MaxRowExceeded || MaxColExceeded || MaxStringsExceeded ||
|
||||
MaxFontsExceeded || MaxPalExceeded || MaxXFExceeded || MaxFormatsExceeded )
|
||||
printf("</FONT>");
|
||||
if (MaxWorksheetsExceeded || MaxRowExceeded || MaxColExceeded
|
||||
|| MaxStringsExceeded || MaxFontsExceeded || MaxPalExceeded
|
||||
|| MaxXFExceeded || MaxFormatsExceeded)
|
||||
printf ("</FONT>");
|
||||
|
||||
printf(" <br>");
|
||||
do_cr();
|
||||
printf (" <br>");
|
||||
do_cr ();
|
||||
|
||||
/* Output Credit */
|
||||
printf("<hr><FONT SIZE=\"-1\">Created with <a href=\"http://chicago.sf.net/xlhtml\">xlhtml %s</a></FONT><br>", VERSION);
|
||||
do_cr();
|
||||
printf
|
||||
("<hr><FONT SIZE=\"-1\">Created with <a href=\"http://chicago.sf.net/xlhtml\">xlhtml %s</a></FONT><br>",
|
||||
VERSION);
|
||||
do_cr ();
|
||||
|
||||
/* Output Tail */
|
||||
output_footer();
|
||||
output_footer ();
|
||||
}
|
||||
|
||||
void output_header(void)
|
||||
void
|
||||
output_header (void)
|
||||
{ /* Ouput Header */
|
||||
if (NoHeaders)
|
||||
return;
|
||||
if (!aggressive)
|
||||
{
|
||||
printf("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML Transitional//EN\"");
|
||||
do_cr();
|
||||
printf("\"http://www.w3.org/TR/REC-html40/loose.dtd\">");
|
||||
do_cr();
|
||||
printf ("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML Transitional//EN\"");
|
||||
do_cr ();
|
||||
printf ("\"http://www.w3.org/TR/REC-html40/loose.dtd\">");
|
||||
do_cr ();
|
||||
}
|
||||
printf("<HTML>\n");
|
||||
printf("<HEAD>\n");
|
||||
do_cr();
|
||||
printf("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=");
|
||||
if ((UnicodeStrings <= 1)&&CodePage&&(CodePage != 1252))
|
||||
printf("windows-%d\">", CodePage);
|
||||
printf ("<HTML>\n");
|
||||
printf ("<HEAD>\n");
|
||||
do_cr ();
|
||||
printf ("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=");
|
||||
if ((UnicodeStrings <= 1) && CodePage && (CodePage != 1252))
|
||||
printf ("windows-%d\">", CodePage);
|
||||
else
|
||||
{
|
||||
switch (UnicodeStrings)
|
||||
{
|
||||
case 0:
|
||||
printf("iso-8859-1\">"); /* Latin-1 */
|
||||
printf ("iso-8859-1\">"); /* Latin-1 */
|
||||
break;
|
||||
case 1:
|
||||
printf("windows-1252\">"); /* Microsoft */
|
||||
printf ("windows-1252\">"); /* Microsoft */
|
||||
break;
|
||||
default:
|
||||
printf("utf-8\">"); /* Unicode */
|
||||
printf ("utf-8\">"); /* Unicode */
|
||||
break;
|
||||
}
|
||||
}
|
||||
do_cr();
|
||||
do_cr ();
|
||||
|
||||
if (!aggressive)
|
||||
{
|
||||
printf("<meta name=\"GENERATOR\" content=\"xlhtml\">");
|
||||
do_cr();
|
||||
printf ("<meta name=\"GENERATOR\" content=\"xlhtml\">");
|
||||
do_cr ();
|
||||
}
|
||||
printf("<TITLE>");
|
||||
printf ("<TITLE>");
|
||||
if (title)
|
||||
printf("%s", title);
|
||||
printf ("%s", title);
|
||||
else
|
||||
printf("%s", filename);
|
||||
printf("</TITLE>");
|
||||
do_cr();
|
||||
printf("</HEAD>");
|
||||
do_cr();
|
||||
do_cr();
|
||||
printf("<BODY TEXT=\"#%s\" BGCOLOR=\"#%s\"",
|
||||
printf ("%s", filename);
|
||||
printf ("</TITLE>");
|
||||
do_cr ();
|
||||
printf ("</HEAD>");
|
||||
do_cr ();
|
||||
do_cr ();
|
||||
printf ("<BODY TEXT=\"#%s\" BGCOLOR=\"#%s\"",
|
||||
default_text_color, default_background_color);
|
||||
if (default_image)
|
||||
printf("BACKGROUND=\"%s\"", default_image);
|
||||
printf("><br>");
|
||||
do_cr();
|
||||
printf ("BACKGROUND=\"%s\"", default_image);
|
||||
printf ("><br>");
|
||||
do_cr ();
|
||||
}
|
||||
|
||||
void output_footer(void)
|
||||
void
|
||||
output_footer (void)
|
||||
{
|
||||
if (NoHeaders)
|
||||
return;
|
||||
printf("</BODY></HTML>");
|
||||
do_cr();
|
||||
fflush(stdout);
|
||||
printf ("</BODY></HTML>");
|
||||
do_cr ();
|
||||
fflush (stdout);
|
||||
}
|
||||
|
||||
void output_start_html_attr(html_attr *h, unsigned int fnt_idx, int do_underlines)
|
||||
void
|
||||
output_start_html_attr (html_attr * h, unsigned int fnt_idx,
|
||||
int do_underlines)
|
||||
{
|
||||
if (fnt_idx < next_font)
|
||||
{
|
||||
if (((font_array[fnt_idx]->underline&0x0023) > 0)&&(do_underlines))
|
||||
if (((font_array[fnt_idx]->underline & 0x0023) > 0) && (do_underlines))
|
||||
{
|
||||
printf("<U>");
|
||||
printf ("<U>");
|
||||
h->uflag = 1;
|
||||
}
|
||||
if (font_array[fnt_idx]->bold >= 0x02BC)
|
||||
{
|
||||
h->bflag = 1;
|
||||
printf("<B>");
|
||||
printf ("<B>");
|
||||
}
|
||||
if (font_array[fnt_idx]->attr & 0x0002)
|
||||
{
|
||||
h->iflag = 1;
|
||||
printf("<I>");
|
||||
printf ("<I>");
|
||||
}
|
||||
if (font_array[fnt_idx]->attr & 0x0008)
|
||||
{
|
||||
h->sflag = 1;
|
||||
printf("<S>");
|
||||
printf ("<S>");
|
||||
}
|
||||
if ((font_array[fnt_idx]->super & 0x0003) == 0x0001)
|
||||
{
|
||||
h->spflag = 1;
|
||||
printf("<SUP>");
|
||||
printf ("<SUP>");
|
||||
}
|
||||
else if ((font_array[fnt_idx]->super & 0x0003) == 0x0002)
|
||||
{
|
||||
h->sbflag = 1;
|
||||
printf("<SUB>");
|
||||
printf ("<SUB>");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void output_end_html_attr(html_attr *h)
|
||||
void
|
||||
output_end_html_attr (html_attr * h)
|
||||
{
|
||||
if (h->sbflag)
|
||||
{
|
||||
printf("</SUB>");
|
||||
printf ("</SUB>");
|
||||
h->sbflag = 0;
|
||||
}
|
||||
else if (h->spflag)
|
||||
{
|
||||
printf("</SUP>");
|
||||
printf ("</SUP>");
|
||||
h->spflag = 0;
|
||||
}
|
||||
if (h->sflag)
|
||||
{
|
||||
printf("</S>");
|
||||
printf ("</S>");
|
||||
h->sflag = 0;
|
||||
}
|
||||
if (h->iflag)
|
||||
{
|
||||
printf("</I>");
|
||||
printf ("</I>");
|
||||
h->iflag = 0;
|
||||
}
|
||||
if (h->bflag)
|
||||
{
|
||||
printf("</B>");
|
||||
printf ("</B>");
|
||||
h->bflag = 0;
|
||||
}
|
||||
if (h->uflag)
|
||||
{
|
||||
if (h->uflag == 1)
|
||||
printf("</U>");
|
||||
printf ("</U>");
|
||||
else
|
||||
printf("</A>");
|
||||
printf ("</A>");
|
||||
h->uflag = 0;
|
||||
}
|
||||
if (h->fflag)
|
||||
{
|
||||
printf("</FONT>");
|
||||
printf ("</FONT>");
|
||||
h->fflag = 0;
|
||||
}
|
||||
}
|
||||
|
94
xlhtml/setupExtraction.c
Normal file
94
xlhtml/setupExtraction.c
Normal file
@ -0,0 +1,94 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include "xlhtml.h"
|
||||
#include "support.h"
|
||||
|
||||
extern int Xtract;
|
||||
extern int xp;
|
||||
extern int sheet_count;
|
||||
extern int xr1 ;
|
||||
extern int xr2 ;
|
||||
extern int xc1 ;
|
||||
extern int xc2 ;
|
||||
extern int Ascii;
|
||||
|
||||
|
||||
|
||||
void
|
||||
SetupExtraction (void)
|
||||
{
|
||||
if (Xtract)
|
||||
{ /* Revise the page settings... */
|
||||
/* printf("-%d %d %d %d %d<br>\n", xp, xr1, xr2, xc1, xc2); */
|
||||
if ((xp >= first_sheet) && (xp <= last_sheet) && (xp <= sheet_count))
|
||||
{
|
||||
first_sheet = xp;
|
||||
last_sheet = xp;
|
||||
if (xr1 < 0)
|
||||
{
|
||||
xr1 = (S16) ws_array[xp]->first_row;
|
||||
xr2 = (S16) ws_array[xp]->biggest_row;
|
||||
}
|
||||
else if ((xr1 >= ws_array[xp]->first_row)
|
||||
&& (xr1 <= ws_array[xp]->biggest_row)
|
||||
&& (xr2 >= ws_array[xp]->first_row)
|
||||
&& (xr2 <= ws_array[xp]->biggest_row))
|
||||
{
|
||||
ws_array[xp]->first_row = xr1;
|
||||
ws_array[xp]->biggest_row = xr2;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Ascii)
|
||||
fprintf (stderr, "Error - Row not in range during extraction"
|
||||
" (%d or %d not in [%ld..%ld])\n", xr1, xr2,
|
||||
(long) ws_array[xp]->first_row,
|
||||
(long) ws_array[xp]->biggest_row);
|
||||
else
|
||||
{
|
||||
printf ("Error - Row not in range during extraction.");
|
||||
output_footer ();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (xc1 < 0)
|
||||
{
|
||||
xc1 = ws_array[xp]->first_col;
|
||||
xc2 = ws_array[xp]->biggest_col;
|
||||
}
|
||||
else if ((xc1 >= ws_array[xp]->first_col)
|
||||
&& (xc1 <= ws_array[xp]->biggest_col)
|
||||
&& (xc2 >= ws_array[xp]->first_col)
|
||||
&& (xc2 <= ws_array[xp]->biggest_col))
|
||||
{
|
||||
ws_array[xp]->first_col = xc1;
|
||||
ws_array[xp]->biggest_col = xc2;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Ascii)
|
||||
fprintf (stderr, "Error - Col not in range during extraction"
|
||||
" (%d or %d not in [%d..%d])\n", xc1, xc2,
|
||||
ws_array[xp]->first_col, ws_array[xp]->biggest_col);
|
||||
else
|
||||
{
|
||||
printf ("Error - Col not in range during extraction.\n");
|
||||
output_footer ();
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Ascii)
|
||||
fprintf (stderr, "Error - Page not in range during extraction.");
|
||||
else
|
||||
{
|
||||
printf ("Error - Page not in range during extraction.");
|
||||
output_footer ();
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
148
xlhtml/support.c
148
xlhtml/support.c
@ -30,18 +30,20 @@
|
||||
|
||||
int DatesR1904 = 0; /*!< Flag that the dates are based on McIntosh Dates system */
|
||||
|
||||
void print_version(void)
|
||||
void
|
||||
print_version (void)
|
||||
{
|
||||
printf("xlhtml %s \nCopyright (c) 1999-2002, Charles Wyble\n"
|
||||
"Released under GPL.\n", VERSION );
|
||||
exit(0);
|
||||
printf ("xlhtml %s \nCopyright (c) 1999-2002, Charles Wyble\n"
|
||||
"Released under GPL.\n", VERSION);
|
||||
exit (0);
|
||||
}
|
||||
|
||||
void display_usage(void)
|
||||
void
|
||||
display_usage (void)
|
||||
{
|
||||
fprintf(stderr, "\nxlhtml converts excel files (.xls) to Html.\n"
|
||||
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"
|
||||
"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"
|
||||
@ -60,81 +62,89 @@ fprintf(stderr, "\nxlhtml converts excel files (.xls) to Html.\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@thewybles.com\n");
|
||||
fprintf (stderr, "\nReport bugs to jackshck@thewybles.com\n");
|
||||
exit (1);
|
||||
}
|
||||
|
||||
void do_cr(void)
|
||||
void
|
||||
do_cr (void)
|
||||
{
|
||||
extern int aggressive;
|
||||
if (!aggressive)
|
||||
putchar('\n');
|
||||
putchar ('\n');
|
||||
}
|
||||
|
||||
U16 getShort(U8 *ptr)
|
||||
U16
|
||||
getShort (U8 * ptr)
|
||||
{
|
||||
if (ptr == 0)
|
||||
return (U16)0;
|
||||
return (U16) 0;
|
||||
|
||||
return (U16)((*(ptr+1)<<8)+*ptr);
|
||||
return (U16) ((*(ptr + 1) << 8) + *ptr);
|
||||
}
|
||||
|
||||
/*! This is used in the RK number, so signedness counts */
|
||||
S32 getLong(U8 *ptr)
|
||||
S32
|
||||
getLong (U8 * ptr)
|
||||
{
|
||||
if (ptr == 0)
|
||||
return (S32)0;
|
||||
return (S32) 0;
|
||||
|
||||
return (S32)(*(ptr+3)<<24)+(*(ptr+2)<<16)+(*(ptr+1)<<8)+*ptr;
|
||||
return (S32) (*(ptr + 3) << 24) + (*(ptr + 2) << 16) + (*(ptr + 1) << 8) +
|
||||
*ptr;
|
||||
}
|
||||
|
||||
#ifndef WORDS_BIGENDIAN /* Defined in <config.h> */
|
||||
#ifdef __arm__
|
||||
/* cross-endian doubles in little endian ARM */
|
||||
void getDouble(U8 *ptr, F64 *d)
|
||||
void
|
||||
getDouble (U8 * ptr, F64 * d)
|
||||
{
|
||||
size_t i;
|
||||
F64 dd;
|
||||
U8 *t = (U8 *)ⅆ
|
||||
U8 *t = (U8 *) & dd;
|
||||
|
||||
for (i=0; i<sizeof(F64); i++)
|
||||
*(t+i) = *(ptr+(i^4));
|
||||
for (i = 0; i < sizeof (F64); i++)
|
||||
*(t + i) = *(ptr + (i ^ 4));
|
||||
|
||||
*d = (F64)dd;
|
||||
*d = (F64) dd;
|
||||
}
|
||||
#else
|
||||
/*! Little Endian - 0x86 family */
|
||||
void getDouble(U8 *ptr, F64 *d)
|
||||
void
|
||||
getDouble (U8 * ptr, F64 * d)
|
||||
{
|
||||
size_t i;
|
||||
F64 dd;
|
||||
U8 *t = (U8 *)ⅆ
|
||||
U8 *t = (U8 *) & dd;
|
||||
|
||||
for (i=0; i<sizeof(F64); i++)
|
||||
*(t+i) = *(ptr+i);
|
||||
for (i = 0; i < sizeof (F64); i++)
|
||||
*(t + i) = *(ptr + i);
|
||||
|
||||
*d = (F64)dd;
|
||||
*d = (F64) dd;
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
/*! Big Endian version - UltraSparc's, etc. */
|
||||
void getDouble (U8 *ptr, F64 *d)
|
||||
void
|
||||
getDouble (U8 * ptr, F64 * d)
|
||||
{
|
||||
size_t i;
|
||||
F64 dd;
|
||||
U8 *t = (U8 *)ⅆ
|
||||
U8 *t = (U8 *) & dd;
|
||||
|
||||
for (i=0; i<sizeof(F64); i++)
|
||||
*(t+i) = *(ptr+sizeof(F64) - 1 - i);
|
||||
for (i = 0; i < sizeof (F64); i++)
|
||||
*(t + i) = *(ptr + sizeof (F64) - 1 - i);
|
||||
|
||||
*d = (F64)dd;
|
||||
*d = (F64) dd;
|
||||
}
|
||||
#endif
|
||||
|
||||
int null_string(U8 *str)
|
||||
int
|
||||
null_string (U8 * str)
|
||||
{ /* FIXME: This function may not be unicode safe */
|
||||
U8 *ptr;
|
||||
if ((str == NULL)||(*str == 0))
|
||||
if ((str == NULL) || (*str == 0))
|
||||
return 1;
|
||||
|
||||
ptr = str;
|
||||
@ -146,27 +156,28 @@ int null_string(U8 *str)
|
||||
return 1;
|
||||
}
|
||||
|
||||
void FracToTime(U8 *cnum, int *hr, int *minut, int *sec, int *msec)
|
||||
void
|
||||
FracToTime (U8 * cnum, int *hr, int *minut, int *sec, int *msec)
|
||||
{
|
||||
int Hr, Min, Sec, Msec;
|
||||
F64 fnum, tHr, tMin, tSec, tMsec;
|
||||
|
||||
if (msec)
|
||||
fnum = atof((char *)&cnum[0])+(0.05 / 86400.0); /* Round off to 1/10th seconds */
|
||||
fnum = atof ((char *) &cnum[0]) + (0.05 / 86400.0); /* Round off to 1/10th seconds */
|
||||
else if (sec)
|
||||
fnum = atof((char *)&cnum[0])+(0.5 / 86400.0); /* Round off to seconds */
|
||||
fnum = atof ((char *) &cnum[0]) + (0.5 / 86400.0); /* Round off to seconds */
|
||||
else
|
||||
fnum = atof((char *)&cnum[0])+(30 / 86400.0); /* Round off to minutes */
|
||||
fnum = atof ((char *) &cnum[0]) + (30 / 86400.0); /* Round off to minutes */
|
||||
tHr = 24.0 * fnum;
|
||||
Hr = (int)tHr;
|
||||
tMin = (tHr - (F64)Hr) * 60.0;
|
||||
Min = (int)tMin;
|
||||
tSec = (tMin - (F64)Min) * 60.0;
|
||||
Sec = (int)tSec;
|
||||
tMsec = (tSec - (F64)Sec) * 10.0;
|
||||
Msec = (int)tMsec;
|
||||
Hr = (int) tHr;
|
||||
tMin = (tHr - (F64) Hr) * 60.0;
|
||||
Min = (int) tMin;
|
||||
tSec = (tMin - (F64) Min) * 60.0;
|
||||
Sec = (int) tSec;
|
||||
tMsec = (tSec - (F64) Sec) * 10.0;
|
||||
Msec = (int) tMsec;
|
||||
|
||||
Hr = Hr%24; /* Fix roll-overs */
|
||||
Hr = Hr % 24; /* Fix roll-overs */
|
||||
if (hr)
|
||||
*hr = Hr;
|
||||
if (minut)
|
||||
@ -178,24 +189,25 @@ void FracToTime(U8 *cnum, int *hr, int *minut, int *sec, int *msec)
|
||||
}
|
||||
|
||||
|
||||
void NumToDate(long num, int *year, int *month, int *day)
|
||||
void
|
||||
NumToDate (long num, int *year, int *month, int *day)
|
||||
{
|
||||
const int ldays[]={31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
|
||||
const int ndays[]={31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
|
||||
const int ldays[] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
|
||||
const int ndays[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
|
||||
|
||||
int t, i, y = 0;
|
||||
|
||||
num = num%36525L; /* Trim century */
|
||||
while (num > (((y%4) == 0) ? 366 : 365))
|
||||
num -= ((y++%4) == 0) ? 366 : 365;
|
||||
num = num % 36525L; /* Trim century */
|
||||
while (num > (((y % 4) == 0) ? 366 : 365))
|
||||
num -= ((y++ % 4) == 0) ? 366 : 365;
|
||||
|
||||
*year = y;
|
||||
t = num;
|
||||
if (DatesR1904)
|
||||
*year += 4; /* Adjust for McIntosh... */
|
||||
if ((*year%4) == 0)
|
||||
if ((*year % 4) == 0)
|
||||
{ /* Leap Year */
|
||||
for (i=0; i<12; i++)
|
||||
for (i = 0; i < 12; i++)
|
||||
{
|
||||
if (t <= ldays[i])
|
||||
break;
|
||||
@ -204,7 +216,7 @@ void NumToDate(long num, int *year, int *month, int *day)
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i=0; i<12; i++)
|
||||
for (i = 0; i < 12; i++)
|
||||
{
|
||||
if (t <= ndays[i])
|
||||
break;
|
||||
@ -212,7 +224,7 @@ void NumToDate(long num, int *year, int *month, int *day)
|
||||
}
|
||||
}
|
||||
/* Some fixups... */
|
||||
*month = 1+i;
|
||||
*month = 1 + i;
|
||||
if (t == 0)
|
||||
t = 1;
|
||||
*day = t;
|
||||
@ -227,27 +239,31 @@ typedef S32 swords[2];
|
||||
#ifndef WORDS_BIGENDIAN /*! Defined in <config.h> */
|
||||
#ifdef __arm__
|
||||
/* cross-endian doubles in little endian ARM */
|
||||
void RKtoDouble(S32 n, F64 *d)
|
||||
void
|
||||
RKtoDouble (S32 n, F64 * d)
|
||||
{
|
||||
noaliasdub(swords,d)[0] = n << 2;
|
||||
noaliasdub(swords,d)[1] = 0;
|
||||
noaliasdub (swords, d)[0] = n << 2;
|
||||
noaliasdub (swords, d)[1] = 0;
|
||||
}
|
||||
#else
|
||||
/*! Little Endian - 0x86 family */
|
||||
void RKtoDouble(S32 n, F64 *d)
|
||||
void
|
||||
RKtoDouble (S32 n, F64 * d)
|
||||
{
|
||||
noaliasdub(swords,d)[0] = 0;
|
||||
noaliasdub(swords,d)[1] = n << 2;
|
||||
noaliasdub (swords, d)[0] = 0;
|
||||
noaliasdub (swords, d)[1] = n << 2;
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
/*! Big Endian version - UltraSparc's, etc. */
|
||||
void RKtoDouble(S32 n, F64 *d)
|
||||
void
|
||||
RKtoDouble (S32 n, F64 * d)
|
||||
{
|
||||
U8 *ptr = (U8 *)&n;
|
||||
U8 *ptr = (U8 *) & n;
|
||||
|
||||
noaliasdub(swords,d)[1] = 0;
|
||||
noaliasdub(swords,d)[0] =
|
||||
((*(ptr+0)<<24)+(*(ptr+1)<<16)+(*(ptr+2)<<8)+(*(ptr+3))) << 2;
|
||||
noaliasdub (swords, d)[1] = 0;
|
||||
noaliasdub (swords, d)[0] =
|
||||
((*(ptr + 0) << 24) + (*(ptr + 1) << 16) + (*(ptr + 2) << 8) +
|
||||
(*(ptr + 3))) << 2;
|
||||
}
|
||||
#endif
|
||||
|
218
xlhtml/xlcdump.c
218
xlhtml/xlcdump.c
@ -40,7 +40,7 @@ static char FileName[2][12] = /* The section of the Excel Spreadsheet we read
|
||||
|
||||
/* Function Prototypes */
|
||||
COLE_LOCATE_ACTION_FUNC dump_file;
|
||||
static void output_opcode_string(int);
|
||||
static void output_opcode_string (int);
|
||||
|
||||
/* Global data */
|
||||
static char filename[128];
|
||||
@ -48,21 +48,22 @@ static char filename[128];
|
||||
int aggressive = 0; /*!< Aggressive html optimization */
|
||||
|
||||
|
||||
int main (int argc, char **argv)
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
int f_ptr = 0;
|
||||
COLEFS * cfs;
|
||||
COLEFS *cfs;
|
||||
COLERRNO colerrno;
|
||||
|
||||
if (argc < 2)
|
||||
{
|
||||
fprintf (stderr, "dump - Outputs excel chart records for analysis.\n"
|
||||
"Usage: "PRGNAME" <FILE>\n");
|
||||
"Usage: " PRGNAME " <FILE>\n");
|
||||
exit (1);
|
||||
}
|
||||
else
|
||||
{
|
||||
strncpy(filename, argv[1], 124);
|
||||
strncpy (filename, argv[1], 124);
|
||||
cfs = cole_mount (filename, &colerrno);
|
||||
if (cfs == NULL)
|
||||
{
|
||||
@ -71,7 +72,8 @@ int main (int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
while (cole_locate_filename (cfs, FileName[f_ptr], NULL, dump_file, &colerrno))
|
||||
while (cole_locate_filename
|
||||
(cfs, FileName[f_ptr], NULL, dump_file, &colerrno))
|
||||
{
|
||||
if (f_ptr)
|
||||
{
|
||||
@ -92,27 +94,27 @@ int main (int argc, char **argv)
|
||||
}
|
||||
|
||||
|
||||
void dump_file(COLEDIRENT *cde, void *_info)
|
||||
void
|
||||
dump_file (COLEDIRENT * cde, void *_info)
|
||||
{
|
||||
unsigned int length=0, opcode=0, target=0, count = 0;
|
||||
unsigned int length = 0, opcode = 0, target = 0, count = 0;
|
||||
unsigned char buf[16];
|
||||
COLEFILE *cf;
|
||||
COLERRNO err;
|
||||
|
||||
(void) _info; /*UNUSED*/
|
||||
|
||||
cf = cole_fopen_direntry(cde, &err);
|
||||
(void) _info;
|
||||
/*UNUSED*/ 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");
|
||||
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 */
|
||||
while (cole_fread (cf, buf, 8, &err)) /* For mode >= 1 */
|
||||
#else
|
||||
while (cole_fread(cf, buf, 1, &err))
|
||||
while (cole_fread (cf, buf, 1, &err))
|
||||
#endif
|
||||
{
|
||||
if (MODE == 0)
|
||||
@ -120,251 +122,257 @@ void dump_file(COLEDIRENT *cde, void *_info)
|
||||
if (count == 0)
|
||||
{
|
||||
length = 0;
|
||||
opcode = (unsigned)buf[0];
|
||||
opcode = (unsigned) buf[0];
|
||||
target = 80; /* ficticious number */
|
||||
printf("<br>");
|
||||
printf ("<br>");
|
||||
}
|
||||
else if (count == 1)
|
||||
opcode |= (buf[0]<<8)&0x0000FFFFL;
|
||||
opcode |= (buf[0] << 8) & 0x0000FFFFL;
|
||||
else if (count == 2)
|
||||
length = (unsigned)buf[0];
|
||||
length = (unsigned) buf[0];
|
||||
else if (count == 3)
|
||||
{
|
||||
length |= (buf[0]<<8);
|
||||
length |= (buf[0] << 8);
|
||||
target = length;
|
||||
printf("<br>\nLength:%04X Opcode:%04X - ", length, opcode);
|
||||
output_opcode_string(opcode);
|
||||
puts("<br>\n");
|
||||
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);
|
||||
if (isprint (buf[0]))
|
||||
putc (buf[0], stdout);
|
||||
#else
|
||||
printf("%02X ", buf[0]);
|
||||
if (((count-3) % 8) == 0)
|
||||
printf("<br>\n");
|
||||
printf ("%02X ", buf[0]);
|
||||
if (((count - 3) % 8) == 0)
|
||||
printf ("<br>\n");
|
||||
#endif
|
||||
}
|
||||
if (count == (target+3))
|
||||
if (count == (target + 3))
|
||||
count = 0;
|
||||
else
|
||||
count++;
|
||||
}
|
||||
else /* mode >= 1 */
|
||||
{
|
||||
printf("%02x %02x %02x %02x %02x %02x %02x %02x ",
|
||||
(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");
|
||||
printf
|
||||
("%02x %02x %02x %02x %02x %02x %02x %02x ",
|
||||
(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);
|
||||
printf ("</BODY></HTML>\n");
|
||||
cole_fclose (cf, &err);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void output_opcode_string(int opcode)
|
||||
static void
|
||||
output_opcode_string (int opcode)
|
||||
{
|
||||
switch (opcode&0x00FF)
|
||||
switch (opcode & 0x00FF)
|
||||
{
|
||||
|
||||
case 0x10:
|
||||
case 0x01:
|
||||
puts("UNITS: Chart Units");
|
||||
puts ("UNITS: Chart Units");
|
||||
break;
|
||||
case 0x02:
|
||||
puts("CHART: Location and overall chart dimensions");
|
||||
puts ("CHART: Location and overall chart dimensions");
|
||||
break;
|
||||
case 0x03:
|
||||
puts("SERIES: Series Definition");
|
||||
puts ("SERIES: Series Definition");
|
||||
break;
|
||||
case 0x06:
|
||||
puts("DATAFORMAT: Series and Data Point Numbers");
|
||||
puts ("DATAFORMAT: Series and Data Point Numbers");
|
||||
break;
|
||||
case 0x07:
|
||||
puts("LINEFORMAT: Style of a line or border");
|
||||
puts ("LINEFORMAT: Style of a line or border");
|
||||
break;
|
||||
case 0x09:
|
||||
puts("MARKERFORMAT: Style of a line marker");
|
||||
puts ("MARKERFORMAT: Style of a line marker");
|
||||
break;
|
||||
case 0x0A:
|
||||
puts("AREAFORMAT: Colors and patterns for an area");
|
||||
puts ("AREAFORMAT: Colors and patterns for an area");
|
||||
break;
|
||||
case 0x0B:
|
||||
puts("PIEFORMAT: Position of the pie slice");
|
||||
puts ("PIEFORMAT: Position of the pie slice");
|
||||
break;
|
||||
case 0x0C:
|
||||
puts("ATTACHEDLABEL: Series data/value labels");
|
||||
puts ("ATTACHEDLABEL: Series data/value labels");
|
||||
break;
|
||||
case 0x0D:
|
||||
puts("SERIESTEXT: Legend/category/value text");
|
||||
puts ("SERIESTEXT: Legend/category/value text");
|
||||
break;
|
||||
case 0x14:
|
||||
puts("CHARTFORMAT: Parent record for chart group");
|
||||
puts ("CHARTFORMAT: Parent record for chart group");
|
||||
break;
|
||||
case 0x15:
|
||||
puts("LEGEND: Legend type and position");
|
||||
puts ("LEGEND: Legend type and position");
|
||||
break;
|
||||
case 0x16:
|
||||
puts("SERIESLIST: Specifies the series in an overlay chart");
|
||||
puts ("SERIESLIST: Specifies the series in an overlay chart");
|
||||
break;
|
||||
case 0x17:
|
||||
puts("BAR: Chart group is a bar or column chart group");
|
||||
puts ("BAR: Chart group is a bar or column chart group");
|
||||
break;
|
||||
case 0x18:
|
||||
puts("LINE: Chart group is a line chart group");
|
||||
puts ("LINE: Chart group is a line chart group");
|
||||
break;
|
||||
case 0x19:
|
||||
puts("PIE: Chart group is a pie chart group");
|
||||
puts ("PIE: Chart group is a pie chart group");
|
||||
break;
|
||||
case 0x1A:
|
||||
puts("AREA: Chart group is an area chart group");
|
||||
puts ("AREA: Chart group is an area chart group");
|
||||
break;
|
||||
case 0x1B:
|
||||
puts("SCATTER: Chart group is a scatter chart group");
|
||||
puts ("SCATTER: Chart group is a scatter chart group");
|
||||
break;
|
||||
case 0x1C:
|
||||
puts("CHARTLINE: Drop/Hi-Lo/Series Lines on a line chart");
|
||||
puts ("CHARTLINE: Drop/Hi-Lo/Series Lines on a line chart");
|
||||
break;
|
||||
case 0x1D:
|
||||
puts("AXIS: Axis Type");
|
||||
puts ("AXIS: Axis Type");
|
||||
break;
|
||||
case 0x1E:
|
||||
puts("TICK: Tick marks and labels format");
|
||||
puts ("TICK: Tick marks and labels format");
|
||||
break;
|
||||
case 0x1F:
|
||||
puts("VALUERANGE: Defines value axis scale");
|
||||
puts ("VALUERANGE: Defines value axis scale");
|
||||
break;
|
||||
case 0x20:
|
||||
puts("CATSERRANGE: Defines a category or series axis");
|
||||
puts ("CATSERRANGE: Defines a category or series axis");
|
||||
break;
|
||||
case 0x21:
|
||||
puts("AXISLINEFORMAT: Defines a line that spans an axis");
|
||||
puts ("AXISLINEFORMAT: Defines a line that spans an axis");
|
||||
break;
|
||||
case 0x22:
|
||||
puts("CHARTFORMTLINK: Not Used");
|
||||
puts ("CHARTFORMTLINK: Not Used");
|
||||
break;
|
||||
case 0x24:
|
||||
puts("DEFAULTTEXT: Default data label text properties");
|
||||
puts ("DEFAULTTEXT: Default data label text properties");
|
||||
break;
|
||||
case 0x25:
|
||||
puts("TEXT: Defines display of text fields");
|
||||
puts ("TEXT: Defines display of text fields");
|
||||
break;
|
||||
case 0x26:
|
||||
puts("FONTX: Font Index");
|
||||
puts ("FONTX: Font Index");
|
||||
break;
|
||||
case 0x27:
|
||||
puts("OBJECTLINK: Attaches Text to chart or chart item");
|
||||
puts ("OBJECTLINK: Attaches Text to chart or chart item");
|
||||
break;
|
||||
case 0x32:
|
||||
puts("FRAME: Defines border shape around displayed text");
|
||||
puts ("FRAME: Defines border shape around displayed text");
|
||||
break;
|
||||
case 0x33:
|
||||
puts("BEGIN: Defines the beginning of an object");
|
||||
puts ("BEGIN: Defines the beginning of an object");
|
||||
break;
|
||||
case 0x34:
|
||||
puts("END: Defines the end of an object");
|
||||
puts ("END: Defines the end of an object");
|
||||
break;
|
||||
case 0x35:
|
||||
puts("PLOTAREA: Frame belongs to ploat area");
|
||||
puts ("PLOTAREA: Frame belongs to ploat area");
|
||||
break;
|
||||
case 0x3A:
|
||||
puts("3d Chart group");
|
||||
puts ("3d Chart group");
|
||||
break;
|
||||
case 0x3C:
|
||||
puts("PICF: Picture Format");
|
||||
puts ("PICF: Picture Format");
|
||||
break;
|
||||
case 0x3D:
|
||||
puts("DROPBAR: Defines drop bars");
|
||||
puts ("DROPBAR: Defines drop bars");
|
||||
break;
|
||||
case 0x3E:
|
||||
puts("RADAR: Chart group is a radar chart group");
|
||||
puts ("RADAR: Chart group is a radar chart group");
|
||||
break;
|
||||
case 0x3F:
|
||||
puts("SURFACE: Chart group is a surface chart group");
|
||||
puts ("SURFACE: Chart group is a surface chart group");
|
||||
break;
|
||||
case 0x40:
|
||||
puts("RADARAREA: Chart group is a radar area chart group");
|
||||
puts ("RADARAREA: Chart group is a radar area chart group");
|
||||
break;
|
||||
case 0x41:
|
||||
puts("AXISPARENT: Axis size and location");
|
||||
puts ("AXISPARENT: Axis size and location");
|
||||
break;
|
||||
case 0x43:
|
||||
puts("LEGENDXN: Legend Exception");
|
||||
puts ("LEGENDXN: Legend Exception");
|
||||
break;
|
||||
case 0x44:
|
||||
puts("SHTPROPS: Sheet Properties");
|
||||
puts ("SHTPROPS: Sheet Properties");
|
||||
break;
|
||||
case 0x45:
|
||||
puts("SERTOCRT: Series chart-group index");
|
||||
puts ("SERTOCRT: Series chart-group index");
|
||||
break;
|
||||
case 0x46:
|
||||
puts("AXESUSED: Number of axes sets");
|
||||
puts ("AXESUSED: Number of axes sets");
|
||||
break;
|
||||
case 0x48:
|
||||
puts("SBASEREF: PivotTable Reference");
|
||||
puts ("SBASEREF: PivotTable Reference");
|
||||
break;
|
||||
case 0x4A:
|
||||
puts("SERPARENT: Trendline or Errorbar series index");
|
||||
puts ("SERPARENT: Trendline or Errorbar series index");
|
||||
break;
|
||||
case 0x4B:
|
||||
puts("SERAUXTREND: Series trendline");
|
||||
puts ("SERAUXTREND: Series trendline");
|
||||
break;
|
||||
case 0x4E:
|
||||
puts("IFMT: Number-Format Index");
|
||||
puts ("IFMT: Number-Format Index");
|
||||
break;
|
||||
case 0x4F:
|
||||
puts("POS: Position information");
|
||||
puts ("POS: Position information");
|
||||
break;
|
||||
case 0x50:
|
||||
puts("ALRUNS: Text formatting");
|
||||
puts ("ALRUNS: Text formatting");
|
||||
break;
|
||||
case 0x51:
|
||||
puts("AI: Linked data");
|
||||
puts ("AI: Linked data");
|
||||
break;
|
||||
case 0x5B:
|
||||
puts("Series ErrorBar");
|
||||
puts ("Series ErrorBar");
|
||||
break;
|
||||
case 0x5D:
|
||||
puts("SERFMT: Series Format");
|
||||
puts ("SERFMT: Series Format");
|
||||
break;
|
||||
case 0x60:
|
||||
puts("FBI: Font Basis");
|
||||
puts ("FBI: Font Basis");
|
||||
break;
|
||||
case 0x61:
|
||||
puts("BOPPOP: Bar of pie/pie of pie chart options");
|
||||
puts ("BOPPOP: Bar of pie/pie of pie chart options");
|
||||
break;
|
||||
case 0x62:
|
||||
puts("AXCEXT: Axis options");
|
||||
puts ("AXCEXT: Axis options");
|
||||
break;
|
||||
case 0x63:
|
||||
puts("DAT: Data Table Options");
|
||||
puts ("DAT: Data Table Options");
|
||||
break;
|
||||
case 0x64:
|
||||
puts("PLOTGROWTH: Font scale factors");
|
||||
puts ("PLOTGROWTH: Font scale factors");
|
||||
break;
|
||||
case 0x65:
|
||||
puts("SIINDEX: Series Index");
|
||||
puts ("SIINDEX: Series Index");
|
||||
break;
|
||||
case 0x66:
|
||||
puts("GELFRAME: Fill data");
|
||||
puts ("GELFRAME: Fill data");
|
||||
break;
|
||||
case 0x67:
|
||||
puts("Custom bar of pie/ pie of pie chart options");
|
||||
puts ("Custom bar of pie/ pie of pie chart options");
|
||||
break;
|
||||
default:
|
||||
puts("Unknown Chart Opcode");
|
||||
puts ("Unknown Chart Opcode");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
352
xlhtml/xldump.c
352
xlhtml/xldump.c
@ -41,7 +41,7 @@ static char FileName[2][12] = /* The section of the Excel Spreadsheet we read
|
||||
/* Function Prototypes */
|
||||
COLE_LOCATE_ACTION_FUNC dump_file;
|
||||
/*static void main_line_processor(int opcode, char data);*/
|
||||
static void output_opcode_string(int);
|
||||
static void output_opcode_string (int);
|
||||
|
||||
/* Global data */
|
||||
static char filename[128];
|
||||
@ -49,21 +49,22 @@ static char filename[128];
|
||||
int aggressive = 0; /*!< Aggressive html optimization */
|
||||
|
||||
|
||||
int main (int argc, char **argv)
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
int f_ptr = 0;
|
||||
COLEFS * cfs;
|
||||
COLEFS *cfs;
|
||||
COLERRNO colerrno;
|
||||
|
||||
if (argc < 2)
|
||||
{
|
||||
fprintf (stderr, "dump - Outputs excel file records for analysis.\n"
|
||||
"Usage: "PRGNAME" <FILE>\n");
|
||||
"Usage: " PRGNAME " <FILE>\n");
|
||||
exit (1);
|
||||
}
|
||||
else
|
||||
{
|
||||
strncpy(filename, argv[1], 124);
|
||||
strncpy (filename, argv[1], 124);
|
||||
cfs = cole_mount (filename, &colerrno);
|
||||
if (cfs == NULL)
|
||||
{
|
||||
@ -72,7 +73,8 @@ int main (int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
while (cole_locate_filename (cfs, FileName[f_ptr], NULL, dump_file, &colerrno))
|
||||
while (cole_locate_filename
|
||||
(cfs, FileName[f_ptr], NULL, dump_file, &colerrno))
|
||||
{
|
||||
if (f_ptr)
|
||||
{
|
||||
@ -93,27 +95,27 @@ int main (int argc, char **argv)
|
||||
}
|
||||
|
||||
|
||||
void dump_file(COLEDIRENT *cde, void *_info)
|
||||
void
|
||||
dump_file (COLEDIRENT * cde, void *_info)
|
||||
{
|
||||
unsigned int length=0, opcode=0, target=0, count = 0;
|
||||
unsigned int length = 0, opcode = 0, target = 0, count = 0;
|
||||
unsigned char buf[16];
|
||||
COLEFILE *cf;
|
||||
COLERRNO err;
|
||||
|
||||
(void) _info; /*UNUSED*/
|
||||
|
||||
cf = cole_fopen_direntry(cde, &err);
|
||||
(void) _info;
|
||||
/*UNUSED*/ 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");
|
||||
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 */
|
||||
while (cole_fread (cf, buf, 8, &err)) /* For mode >= 1 */
|
||||
#else
|
||||
while (cole_fread(cf, buf, 1, &err))
|
||||
while (cole_fread (cf, buf, 1, &err))
|
||||
#endif
|
||||
{
|
||||
if (MODE == 0)
|
||||
@ -121,55 +123,61 @@ void dump_file(COLEDIRENT *cde, void *_info)
|
||||
if (count == 0)
|
||||
{
|
||||
length = 0;
|
||||
opcode = (unsigned)buf[0];
|
||||
opcode = (unsigned) buf[0];
|
||||
target = 80; /* ficticious number */
|
||||
printf("<br>");
|
||||
printf ("<br>");
|
||||
}
|
||||
else if (count == 1)
|
||||
opcode |= (buf[0]<<8)&0x0000FFFFL;
|
||||
opcode |= (buf[0] << 8) & 0x0000FFFFL;
|
||||
else if (count == 2)
|
||||
length = (unsigned)buf[0];
|
||||
length = (unsigned) buf[0];
|
||||
else if (count == 3)
|
||||
{
|
||||
length |= (buf[0]<<8);
|
||||
length |= (buf[0] << 8);
|
||||
target = length;
|
||||
printf("<br>\nLength:%04X Opcode:%04X - ", length, opcode);
|
||||
output_opcode_string(opcode);
|
||||
puts("<br>\n");
|
||||
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);
|
||||
if (isprint (buf[0]))
|
||||
putc (buf[0], stdout);
|
||||
#else
|
||||
printf("%02X ", buf[0]);
|
||||
if (((count-3) % 8) == 0)
|
||||
printf("<br>\n");
|
||||
printf ("%02X ", buf[0]);
|
||||
if (((count - 3) % 8) == 0)
|
||||
printf ("<br>\n");
|
||||
#endif
|
||||
}
|
||||
if (count == (target+3))
|
||||
if (count == (target + 3))
|
||||
count = 0;
|
||||
else
|
||||
count++;
|
||||
}
|
||||
else /* mode >= 1 */
|
||||
{
|
||||
printf("%02x %02x %02x %02x %02x %02x %02x %02x ",
|
||||
(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");
|
||||
printf
|
||||
("%02x %02x %02x %02x %02x %02x %02x %02x ",
|
||||
(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);
|
||||
printf ("</BODY></HTML>\n");
|
||||
cole_fclose (cf, &err);
|
||||
}
|
||||
|
||||
/*static void main_line_processor(int opcode, char data)
|
||||
@ -177,330 +185,331 @@ void dump_file(COLEDIRENT *cde, void *_info)
|
||||
}
|
||||
*/
|
||||
|
||||
static void output_opcode_string(int opcode)
|
||||
static void
|
||||
output_opcode_string (int opcode)
|
||||
{
|
||||
switch (opcode&0x00FF)
|
||||
switch (opcode & 0x00FF)
|
||||
{
|
||||
|
||||
/* start of documented general opcodes */
|
||||
|
||||
case 0x0A:
|
||||
puts("\nEOF: End of File");
|
||||
puts ("\nEOF: End of File");
|
||||
break;
|
||||
case 0x0C:
|
||||
puts("CALCCOUNT: Iteration count");
|
||||
puts ("CALCCOUNT: Iteration count");
|
||||
break;
|
||||
case 0x0D:
|
||||
puts("CalcMode: Calculation mode");
|
||||
puts ("CalcMode: Calculation mode");
|
||||
break;
|
||||
case 0x0E:
|
||||
puts("Precision");
|
||||
puts ("Precision");
|
||||
break;
|
||||
case 0x0F:
|
||||
puts("Reference Mode");
|
||||
puts ("Reference Mode");
|
||||
break;
|
||||
case 0x10:
|
||||
puts("Delta: Iteration Increment");
|
||||
puts ("Delta: Iteration Increment");
|
||||
break;
|
||||
case 0x11:
|
||||
puts("Iteration Mode");
|
||||
puts ("Iteration Mode");
|
||||
break;
|
||||
case 0x12:
|
||||
puts("Protection Flag");
|
||||
puts ("Protection Flag");
|
||||
break;
|
||||
case 0x13:
|
||||
puts("Protection Password");
|
||||
puts ("Protection Password");
|
||||
break;
|
||||
case 0x14:
|
||||
puts("Print Header on each page");
|
||||
puts ("Print Header on each page");
|
||||
break;
|
||||
case 0x15:
|
||||
puts("Print Footer on each page");
|
||||
puts ("Print Footer on each page");
|
||||
break;
|
||||
case 0x16:
|
||||
puts("External Count: Number of external references");
|
||||
puts ("External Count: Number of external references");
|
||||
break;
|
||||
case 0x17:
|
||||
puts("External reference");
|
||||
puts ("External reference");
|
||||
break;
|
||||
case 0x18:
|
||||
puts("NAME");
|
||||
puts ("NAME");
|
||||
break;
|
||||
case 0x19:
|
||||
puts("Windows are Protected");
|
||||
puts ("Windows are Protected");
|
||||
break;
|
||||
case 0x1A:
|
||||
puts("Vertical Page Breaks");
|
||||
puts ("Vertical Page Breaks");
|
||||
break;
|
||||
case 0x1B:
|
||||
puts("Horizontal Page Breaks");
|
||||
puts ("Horizontal Page Breaks");
|
||||
break;
|
||||
case 0x1C:
|
||||
puts("Cell Note");
|
||||
puts ("Cell Note");
|
||||
break;
|
||||
case 0x1D:
|
||||
puts("Selection");
|
||||
puts ("Selection");
|
||||
break;
|
||||
case 0x22:
|
||||
puts("1904 date system");
|
||||
puts ("1904 date system");
|
||||
break;
|
||||
case 0x26:
|
||||
puts("Left Margin Measurement");
|
||||
puts ("Left Margin Measurement");
|
||||
break;
|
||||
case 0x27:
|
||||
puts("Right Margin Measurement");
|
||||
puts ("Right Margin Measurement");
|
||||
break;
|
||||
case 0x28:
|
||||
puts("Top Margin Measurement");
|
||||
puts ("Top Margin Measurement");
|
||||
break;
|
||||
case 0x29:
|
||||
puts("Bottom Margin Measurement");
|
||||
puts ("Bottom Margin Measurement");
|
||||
break;
|
||||
case 0x2A:
|
||||
puts("Print Row/Column Labels");
|
||||
puts ("Print Row/Column Labels");
|
||||
break;
|
||||
case 0x2B:
|
||||
puts("Print Gridlines Flag");
|
||||
puts ("Print Gridlines Flag");
|
||||
break;
|
||||
case 0x2F:
|
||||
puts("File is Password protected");
|
||||
puts ("File is Password protected");
|
||||
break;
|
||||
case 0x31:
|
||||
puts("FONT");
|
||||
puts ("FONT");
|
||||
break;
|
||||
case 0x3C:
|
||||
puts("Continues long records");
|
||||
puts ("Continues long records");
|
||||
break;
|
||||
case 0x3D:
|
||||
puts("Window1");
|
||||
puts ("Window1");
|
||||
break;
|
||||
case 0x40:
|
||||
puts("BACKUP: Save Backup Version of the File");
|
||||
puts ("BACKUP: Save Backup Version of the File");
|
||||
break;
|
||||
case 0x41:
|
||||
puts("Number of Panes and their position");
|
||||
puts ("Number of Panes and their position");
|
||||
break;
|
||||
case 0x42:
|
||||
puts("CODEPAGE: Default code page");
|
||||
puts ("CODEPAGE: Default code page");
|
||||
break;
|
||||
case 0x4D:
|
||||
puts("PLS: Environment specific print record");
|
||||
puts ("PLS: Environment specific print record");
|
||||
break;
|
||||
case 0x50:
|
||||
puts("DCON: Data consolidation information");
|
||||
puts ("DCON: Data consolidation information");
|
||||
break;
|
||||
case 0x51:
|
||||
puts("DCONREF: Data consolidation references");
|
||||
puts ("DCONREF: Data consolidation references");
|
||||
break;
|
||||
case 0x52:
|
||||
puts("DCONNAME: Data Consolidation Named References");
|
||||
puts ("DCONNAME: Data Consolidation Named References");
|
||||
break;
|
||||
case 0x55:
|
||||
puts("DEFCOLWIDTH: Default Column Width");
|
||||
puts ("DEFCOLWIDTH: Default Column Width");
|
||||
break;
|
||||
case 0x59:
|
||||
puts("XCT: CRN Record Count");
|
||||
puts ("XCT: CRN Record Count");
|
||||
break;
|
||||
case 0x5A:
|
||||
puts("CRN: Nonresident operands");
|
||||
puts ("CRN: Nonresident operands");
|
||||
break;
|
||||
case 0x5B:
|
||||
puts("FILESHARING:File-sharing information");
|
||||
puts ("FILESHARING:File-sharing information");
|
||||
break;
|
||||
case 0x5C:
|
||||
puts("Write Access");
|
||||
puts ("Write Access");
|
||||
break;
|
||||
case 0x5D:
|
||||
puts("OBJ: Describes a Graphic object");
|
||||
puts ("OBJ: Describes a Graphic object");
|
||||
break;
|
||||
case 0x5E:
|
||||
puts("UNCALCED: Recalculation Status");
|
||||
puts ("UNCALCED: Recalculation Status");
|
||||
break;
|
||||
case 0x5F:
|
||||
puts("SAVERECALC: Recalculate before save");
|
||||
puts ("SAVERECALC: Recalculate before save");
|
||||
break;
|
||||
case 0x60:
|
||||
puts("TEMPLATE: Workbook is a template");
|
||||
puts ("TEMPLATE: Workbook is a template");
|
||||
break;
|
||||
case 0x63:
|
||||
puts("OBJPROTECT: Objects are protected");
|
||||
puts ("OBJPROTECT: Objects are protected");
|
||||
break;
|
||||
case 0x7D:
|
||||
puts("COLINFO: Column formatting information");
|
||||
puts ("COLINFO: Column formatting information");
|
||||
break;
|
||||
case 0x7E:
|
||||
puts("RK Number");
|
||||
puts ("RK Number");
|
||||
break;
|
||||
case 0x7F:
|
||||
puts("IMDATA: Image data");
|
||||
puts ("IMDATA: Image data");
|
||||
break;
|
||||
case 0x80:
|
||||
puts("GUTS: Size of row and column gutters");
|
||||
puts ("GUTS: Size of row and column gutters");
|
||||
break;
|
||||
case 0x81:
|
||||
puts("WSBOOL: Additional workspace information");
|
||||
puts ("WSBOOL: Additional workspace information");
|
||||
break;
|
||||
case 0x82:
|
||||
puts("GRIDSET: State change of gridlines option");
|
||||
puts ("GRIDSET: State change of gridlines option");
|
||||
break;
|
||||
case 0x83:
|
||||
puts("HCENTER: Center between horizontal margins");
|
||||
puts ("HCENTER: Center between horizontal margins");
|
||||
break;
|
||||
case 0x84:
|
||||
puts("VCENTER: Center between vertical margins");
|
||||
puts ("VCENTER: Center between vertical margins");
|
||||
break;
|
||||
case 0x85:
|
||||
puts("BoundSheet");
|
||||
puts ("BoundSheet");
|
||||
break;
|
||||
case 0x86:
|
||||
puts("WRITEPROT: Workbook is Write-protected");
|
||||
puts ("WRITEPROT: Workbook is Write-protected");
|
||||
break;
|
||||
case 0x87:
|
||||
puts("ADDIN: Workbook is add-in macro");
|
||||
puts ("ADDIN: Workbook is add-in macro");
|
||||
break;
|
||||
case 0x88:
|
||||
puts("EDG: Edition globals");
|
||||
puts ("EDG: Edition globals");
|
||||
break;
|
||||
case 0x89:
|
||||
puts("PUB: Publisher");
|
||||
puts ("PUB: Publisher");
|
||||
break;
|
||||
case 0x8C:
|
||||
puts("COUNTRY: Default country and WIN.INI Country");
|
||||
puts ("COUNTRY: Default country and WIN.INI Country");
|
||||
break;
|
||||
case 0x8D:
|
||||
puts("HIDEOBJ: Object display options");
|
||||
puts ("HIDEOBJ: Object display options");
|
||||
break;
|
||||
case 0x90:
|
||||
puts("SORT: Sorting options");
|
||||
puts ("SORT: Sorting options");
|
||||
break;
|
||||
case 0x91:
|
||||
puts("SUB: Subscriber");
|
||||
puts ("SUB: Subscriber");
|
||||
break;
|
||||
case 0x92:
|
||||
puts("Palette Info");
|
||||
puts ("Palette Info");
|
||||
break;
|
||||
case 0x94:
|
||||
puts("LHRECORD: .WK? File Conversion Information");
|
||||
puts ("LHRECORD: .WK? File Conversion Information");
|
||||
break;
|
||||
case 0x95:
|
||||
puts("LHNGRAPH: Named Graph Information");
|
||||
puts ("LHNGRAPH: Named Graph Information");
|
||||
break;
|
||||
case 0x96:
|
||||
puts("SOUND: Sound note");
|
||||
puts ("SOUND: Sound note");
|
||||
break;
|
||||
case 0x98:
|
||||
puts("LPR: Sheet was printed using LINE.PRINT()");
|
||||
puts ("LPR: Sheet was printed using LINE.PRINT()");
|
||||
break;
|
||||
case 0x99:
|
||||
puts("STANDARDWIDTH: Standard column width");
|
||||
puts ("STANDARDWIDTH: Standard column width");
|
||||
break;
|
||||
case 0x9A:
|
||||
puts("FNGROUPNAME: Function Group name");
|
||||
puts ("FNGROUPNAME: Function Group name");
|
||||
break;
|
||||
case 0x9B:
|
||||
puts("FILTERMODE: Sheet contains filtered list");
|
||||
puts ("FILTERMODE: Sheet contains filtered list");
|
||||
break;
|
||||
case 0x9C:
|
||||
puts("FNGROUPCOUNT: Built-in function group count");
|
||||
puts ("FNGROUPCOUNT: Built-in function group count");
|
||||
break;
|
||||
case 0x9D:
|
||||
puts("AUTOFILTERINFO: Drop Down Arrow Count");
|
||||
puts ("AUTOFILTERINFO: Drop Down Arrow Count");
|
||||
break;
|
||||
case 0x9E:
|
||||
puts("AUTOFILTER: AutoFilter data");
|
||||
puts ("AUTOFILTER: AutoFilter data");
|
||||
break;
|
||||
case 0xA0:
|
||||
puts("SCL: Window Zoom magnification");
|
||||
puts ("SCL: Window Zoom magnification");
|
||||
break;
|
||||
case 0xA1:
|
||||
puts("Page Setup");
|
||||
puts ("Page Setup");
|
||||
break;
|
||||
case 0xA9:
|
||||
puts("COORDLIST: Polygon Object Vertex coordinates");
|
||||
puts ("COORDLIST: Polygon Object Vertex coordinates");
|
||||
break;
|
||||
case 0xAB:
|
||||
puts("GCW: Global Column-Wdith flags");
|
||||
puts ("GCW: Global Column-Wdith flags");
|
||||
break;
|
||||
case 0xAE:
|
||||
puts("SCENMAN: Scenario Output data");
|
||||
puts ("SCENMAN: Scenario Output data");
|
||||
break;
|
||||
case 0xAF:
|
||||
puts("PROT4REV: Shared Workbook protection flag");
|
||||
puts ("PROT4REV: Shared Workbook protection flag");
|
||||
break;
|
||||
case 0xB0:
|
||||
puts("SXVIEW: View Definition");
|
||||
puts ("SXVIEW: View Definition");
|
||||
break;
|
||||
case 0xB1:
|
||||
puts("SXVD: View Fields");
|
||||
puts ("SXVD: View Fields");
|
||||
break;
|
||||
case 0xB2:
|
||||
puts("SXVI: View Item");
|
||||
puts ("SXVI: View Item");
|
||||
break;
|
||||
case 0xB4:
|
||||
puts("SXIVD: Row/Column Field Ids");
|
||||
puts ("SXIVD: Row/Column Field Ids");
|
||||
break;
|
||||
case 0xB5:
|
||||
puts("SXLI: Line item array");
|
||||
puts ("SXLI: Line item array");
|
||||
break;
|
||||
case 0xB6:
|
||||
puts("SXPI: Page item");
|
||||
puts ("SXPI: Page item");
|
||||
break;
|
||||
case 0xB8:
|
||||
puts("DOCROUTE: Routing slip information");
|
||||
puts ("DOCROUTE: Routing slip information");
|
||||
break;
|
||||
case 0xB9:
|
||||
puts("RECIPNAME: Recipient name");
|
||||
puts ("RECIPNAME: Recipient name");
|
||||
break;
|
||||
case 0xBC:
|
||||
puts("SHRFMLA: Shared formula");
|
||||
puts ("SHRFMLA: Shared formula");
|
||||
break;
|
||||
case 0xBD:
|
||||
puts("MULRK: Multiple RK cells");
|
||||
puts ("MULRK: Multiple RK cells");
|
||||
break;
|
||||
case 0xBE:
|
||||
puts("Multiple Blanks");
|
||||
puts ("Multiple Blanks");
|
||||
break;
|
||||
case 0xC1:
|
||||
puts("MMS: ADDMENU/DELMENU Record Group count");
|
||||
puts ("MMS: ADDMENU/DELMENU Record Group count");
|
||||
break;
|
||||
case 0xC2:
|
||||
puts("ADDMENU: Menu Addition");
|
||||
puts ("ADDMENU: Menu Addition");
|
||||
break;
|
||||
case 0xC3:
|
||||
puts("DELMENU: Menu Deletion");
|
||||
puts ("DELMENU: Menu Deletion");
|
||||
break;
|
||||
case 0xC5:
|
||||
puts("SXDI: Data Item");
|
||||
puts ("SXDI: Data Item");
|
||||
break;
|
||||
case 0xC6:
|
||||
puts("SXDB: PivtoTable Cache Data");
|
||||
puts ("SXDB: PivtoTable Cache Data");
|
||||
break;
|
||||
case 0xCD:
|
||||
puts("SXSTRING: String");
|
||||
puts ("SXSTRING: String");
|
||||
break;
|
||||
case 0xD0:
|
||||
puts("SXTBL: Multiple Consolidation Source Info");
|
||||
puts ("SXTBL: Multiple Consolidation Source Info");
|
||||
break;
|
||||
case 0xD1:
|
||||
puts("SXTBRGIITM: Page Item Name Count");
|
||||
puts ("SXTBRGIITM: Page Item Name Count");
|
||||
break;
|
||||
case 0xD2:
|
||||
puts("SXTBPG: Page Item Indexes");
|
||||
puts ("SXTBPG: Page Item Indexes");
|
||||
break;
|
||||
case 0xD3:
|
||||
puts("OBPROJ: Visual Basic Project");
|
||||
puts ("OBPROJ: Visual Basic Project");
|
||||
break;
|
||||
case 0xD5:
|
||||
puts("SXIDSTM: Stream ID");
|
||||
puts ("SXIDSTM: Stream ID");
|
||||
break;
|
||||
case 0xD6:
|
||||
puts("RString");
|
||||
puts ("RString");
|
||||
break;
|
||||
case 0xD7:
|
||||
puts("DBCELL: Stream offsets");
|
||||
puts ("DBCELL: Stream offsets");
|
||||
break;
|
||||
case 0xDA:
|
||||
puts("BOOKBOOL: Workbook option flag");
|
||||
puts ("BOOKBOOL: Workbook option flag");
|
||||
break;
|
||||
|
||||
/* error in ms docs
|
||||
@ -513,76 +522,75 @@ static void output_opcode_string(int opcode)
|
||||
*/
|
||||
|
||||
case 0xDD:
|
||||
puts("SCENPROTECT: Scenario protection");
|
||||
puts ("SCENPROTECT: Scenario protection");
|
||||
break;
|
||||
case 0xDE:
|
||||
puts("OLESIZE: Size of an OLE object");
|
||||
puts ("OLESIZE: Size of an OLE object");
|
||||
break;
|
||||
case 0xDF:
|
||||
puts("UDDESC: Description string for chart autoformat");
|
||||
puts ("UDDESC: Description string for chart autoformat");
|
||||
break;
|
||||
case 0xE0:
|
||||
puts("Extended Format");
|
||||
puts ("Extended Format");
|
||||
break;
|
||||
case 0xE1:
|
||||
puts("INTERFACEHDR: Beginning of User Interface Records");
|
||||
puts ("INTERFACEHDR: Beginning of User Interface Records");
|
||||
break;
|
||||
case 0xE2:
|
||||
puts("INTERFACEEND: End of User interface records");
|
||||
puts ("INTERFACEEND: End of User interface records");
|
||||
break;
|
||||
case 0xE3:
|
||||
puts("SXVS: View source");
|
||||
puts ("SXVS: View source");
|
||||
break;
|
||||
case 0xEA:
|
||||
puts("TABIDCONF: Sheet tab ID of Conflict history");
|
||||
puts ("TABIDCONF: Sheet tab ID of Conflict history");
|
||||
break;
|
||||
case 0xEB:
|
||||
puts("MSODRAWINGGROUP: MS Office Drawing Group");
|
||||
puts ("MSODRAWINGGROUP: MS Office Drawing Group");
|
||||
break;
|
||||
case 0xEC:
|
||||
puts("MSODRAWING: MS Office Drawing");
|
||||
puts ("MSODRAWING: MS Office Drawing");
|
||||
break;
|
||||
case 0xED:
|
||||
puts("MS Office Drawing Selection");
|
||||
puts ("MS Office Drawing Selection");
|
||||
break;
|
||||
case 0xF0:
|
||||
puts("SXRULE: PivotTable Rule data");
|
||||
puts ("SXRULE: PivotTable Rule data");
|
||||
break;
|
||||
case 0xF1:
|
||||
puts("SXEX: PivotTable Extended information");
|
||||
puts ("SXEX: PivotTable Extended information");
|
||||
break;
|
||||
case 0xF2:
|
||||
puts("SXFILT: PivotTable Rule Filter");
|
||||
puts ("SXFILT: PivotTable Rule Filter");
|
||||
break;
|
||||
case 0xF6:
|
||||
puts("SXNAME: PivotTable Name");
|
||||
puts ("SXNAME: PivotTable Name");
|
||||
break;
|
||||
case 0xF7:
|
||||
puts("SXSELECT: PivotTable Selection Information");
|
||||
puts ("SXSELECT: PivotTable Selection Information");
|
||||
break;
|
||||
case 0xF8:
|
||||
puts("PivotTable Name Pair");
|
||||
puts ("PivotTable Name Pair");
|
||||
break;
|
||||
case 0xF9:
|
||||
puts("PivotTable Parsed Expression");
|
||||
puts ("PivotTable Parsed Expression");
|
||||
break;
|
||||
case 0xFB:
|
||||
puts("PivotTable Format Record");
|
||||
puts ("PivotTable Format Record");
|
||||
break;
|
||||
case 0xFC:
|
||||
puts("Shared String Table");
|
||||
puts ("Shared String Table");
|
||||
break;
|
||||
case 0xFD:
|
||||
puts("Cell Value, String Constant/SST");
|
||||
puts ("Cell Value, String Constant/SST");
|
||||
break;
|
||||
case 0xFF:
|
||||
puts("Extended Shared String Table");
|
||||
puts ("Extended Shared String Table");
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
puts("Unknown Opcode");
|
||||
puts ("Unknown Opcode");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
4906
xlhtml/xlhtml.c
4906
xlhtml/xlhtml.c
File diff suppressed because it is too large
Load Diff
149
xlhtml/xml.c
149
xlhtml/xml.c
@ -25,143 +25,168 @@
|
||||
|
||||
|
||||
|
||||
void OutputTableXML(void)
|
||||
void
|
||||
OutputTableXML (void)
|
||||
{
|
||||
int i, j, k;
|
||||
|
||||
printf( "<?xml version=\"1.0\" encoding=\"" );
|
||||
printf ("<?xml version=\"1.0\" encoding=\"");
|
||||
switch (UnicodeStrings)
|
||||
{
|
||||
case 0:
|
||||
printf("iso-8859-1\" ?>\n"); /* Latin-1 */
|
||||
printf ("iso-8859-1\" ?>\n"); /* Latin-1 */
|
||||
break;
|
||||
case 1:
|
||||
printf("windows-1252\"?>\n"); /* Microsoft */
|
||||
printf ("windows-1252\"?>\n"); /* Microsoft */
|
||||
break;
|
||||
default:
|
||||
printf("utf-8\"?>\n"); /* Unicode */
|
||||
printf ("utf-8\"?>\n"); /* Unicode */
|
||||
break;
|
||||
}
|
||||
|
||||
SetupExtraction();
|
||||
SetupExtraction ();
|
||||
|
||||
printf( "<excel_workbook>\n" );
|
||||
printf( "\t<sheets>\n" );
|
||||
printf ("<excel_workbook>\n");
|
||||
printf ("<workbook_title>");
|
||||
if (title)
|
||||
printf ("%s", title);
|
||||
else
|
||||
printf ("%s", filename);
|
||||
printf ("</workbook_title>\n");
|
||||
|
||||
|
||||
printf ("\t<sheets>\n");
|
||||
|
||||
/* Here's where we dump the Html Page out */
|
||||
for (i=first_sheet; i<=last_sheet; i++) /* For each worksheet */
|
||||
for (i = first_sheet; i <= last_sheet; i++) /* For each worksheet */
|
||||
{
|
||||
trim_sheet_edges(i);
|
||||
update_default_font(i);
|
||||
trim_sheet_edges (i);
|
||||
update_default_font (i);
|
||||
if (ws_array[i] == 0)
|
||||
continue;
|
||||
if ((ws_array[i]->biggest_row == -1)||(ws_array[i]->biggest_col == -1))
|
||||
if ((ws_array[i]->biggest_row == -1)
|
||||
|| (ws_array[i]->biggest_col == -1))
|
||||
continue;
|
||||
if (ws_array[i]->c_array == 0)
|
||||
continue;
|
||||
|
||||
printf( "\t\t<sheet>\n" );
|
||||
printf( "\t\t\t<page>%d</page>\n", i );
|
||||
printf ("\t\t<sheet>\n");
|
||||
printf ("\t\t\t<page>%d</page>\n", i);
|
||||
|
||||
/* Print its name */
|
||||
if (next_ws_title > 0)
|
||||
{
|
||||
if (ws_array[i]->ws_title.str)
|
||||
{
|
||||
printf("\t\t\t<pagetitle>");
|
||||
OutputString(&ws_array[i]->ws_title);
|
||||
printf("</pagetitle>\n");
|
||||
printf ("\t\t\t<pagetitle>");
|
||||
OutputString (&ws_array[i]->ws_title);
|
||||
printf ("</pagetitle>\n");
|
||||
}
|
||||
else
|
||||
printf("\t\t\t<pagetitle>(Unknown Page)</pagetitle>\n");
|
||||
printf ("\t\t\t<pagetitle>(Unknown Page)</pagetitle>\n");
|
||||
}
|
||||
|
||||
printf( "\t\t\t<firstrow>%ld</firstrow>\n", (unsigned long)ws_array[i]->first_row );
|
||||
printf( "\t\t\t<lastrow>%d</lastrow>\n", (int) ws_array[i]->biggest_row );
|
||||
printf( "\t\t\t<firstcol>%ld</firstcol>\n", (long) ws_array[i]->first_col );
|
||||
printf( "\t\t\t<lastcol>%d</lastcol>\n", (int)ws_array[i]->biggest_col );
|
||||
printf( "\t\t\t<rows>\n" );
|
||||
printf ("\t\t\t<firstrow>%ld</firstrow>\n",
|
||||
(unsigned long) ws_array[i]->first_row);
|
||||
printf ("\t\t\t<lastrow>%d</lastrow>\n",
|
||||
(int) ws_array[i]->biggest_row);
|
||||
printf ("\t\t\t<firstcol>%ld</firstcol>\n",
|
||||
(long) ws_array[i]->first_col);
|
||||
printf ("\t\t\t<lastcol>%d</lastcol>\n",
|
||||
(int) ws_array[i]->biggest_col);
|
||||
printf ("\t\t\t<rows>\n");
|
||||
|
||||
for (j=ws_array[i]->first_row; j<=ws_array[i]->biggest_row; j++)
|
||||
for (j = ws_array[i]->first_row; j <= ws_array[i]->biggest_row; j++)
|
||||
{
|
||||
update_default_alignment(i, j);
|
||||
printf("\t\t\t\t<row>\n");
|
||||
for (k=ws_array[i]->first_col; k<=ws_array[i]->biggest_col; k++)
|
||||
update_default_alignment (i, j);
|
||||
printf ("\t\t\t\t<row>\n");
|
||||
for (k = ws_array[i]->first_col; k <= ws_array[i]->biggest_col; k++)
|
||||
{
|
||||
printf("\t\t\t\t\t<cell row=\"%d\" col=\"%d\"", j, k );
|
||||
output_cell(ws_array[i]->c_array[(j*ws_array[i]->max_cols)+k], 1); /* This stuff happens for each cell... */
|
||||
printf("</cell>\n" );
|
||||
if (ws_array[i]->c_array[(j*ws_array[i]->max_cols)+k])
|
||||
printf ("\t\t\t\t\t<cell row=\"%d\" col=\"%d\"", j, k);
|
||||
output_cell (ws_array[i]->c_array[(j * ws_array[i]->max_cols) + k], 1); /* This stuff happens for each cell... */
|
||||
printf ("</cell>\n");
|
||||
if (ws_array[i]->c_array[(j * ws_array[i]->max_cols) + k])
|
||||
{
|
||||
if (ws_array[i]->c_array[(j*ws_array[i]->max_cols)+k]->colspan != 0)
|
||||
k += ws_array[i]->c_array[(j*ws_array[i]->max_cols)+k]->colspan-1;
|
||||
if (ws_array[i]->c_array[(j * ws_array[i]->max_cols) + k]->
|
||||
colspan != 0)
|
||||
k +=
|
||||
ws_array[i]->c_array[(j * ws_array[i]->max_cols) +
|
||||
k]->colspan - 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
printf("\t\t\t\t</row>\n");
|
||||
printf ("\t\t\t\t</row>\n");
|
||||
}
|
||||
printf( "\t\t\t</rows>\n" );
|
||||
printf("\t\t</sheet>\n");
|
||||
printf ("\t\t\t</rows>\n");
|
||||
printf ("\t\t</sheet>\n");
|
||||
}
|
||||
printf( "\t</sheets>\n" );
|
||||
printf ("\t</sheets>\n");
|
||||
|
||||
/* Print the author's name in itallics... */
|
||||
if (author.str)
|
||||
{
|
||||
printf("\t<author>");
|
||||
OutputString(&author);
|
||||
printf("</author>\n");
|
||||
printf ("\t<author>");
|
||||
OutputString (&author);
|
||||
printf ("</author>\n");
|
||||
}
|
||||
|
||||
/* Print when & how the file was last updated. */
|
||||
if (lastUpdated)
|
||||
printf("\t<lastwrite>%s</lastwrite>", lastUpdated);
|
||||
printf( "\t<excelversion>" );
|
||||
printf ("\t<lastwrite>%s</lastwrite>", lastUpdated);
|
||||
printf ("\t<excelversion>");
|
||||
switch (file_version)
|
||||
{
|
||||
case EXCEL95:
|
||||
printf("using Excel 5.0 or 95");
|
||||
printf ("using Excel 5.0 or 95");
|
||||
break;
|
||||
case EXCEL97:
|
||||
printf("using Excel 97/2000");
|
||||
printf ("using Excel 97/2000");
|
||||
break;
|
||||
default:
|
||||
printf("using Excel ????");
|
||||
printf ("using Excel ????");
|
||||
break;
|
||||
}
|
||||
printf("</excelversion>\n");
|
||||
printf ("</excelversion>\n");
|
||||
|
||||
/* Next print Disclaimers... */
|
||||
if (NoFormat)
|
||||
printf("\t<noformat>%d</noformat>\n", NoFormat );
|
||||
if ((notAccurate)&&(formula_warnings))
|
||||
printf("\t<accuracy>%d</accuracy>\n", notAccurate );
|
||||
printf ("\t<noformat>%d</noformat>\n", NoFormat);
|
||||
if ((notAccurate) && (formula_warnings))
|
||||
printf ("\t<accuracy>%d</accuracy>\n", notAccurate);
|
||||
if (NotImplemented)
|
||||
printf("\t<notimplemented>%d</notimplemented>\n", NotImplemented );
|
||||
printf ("\t<notimplemented>%d</notimplemented>\n", NotImplemented);
|
||||
if (Unsupported)
|
||||
printf("\t<unsupported>%d</unsupported>\n", Unsupported );
|
||||
printf ("\t<unsupported>%d</unsupported>\n", Unsupported);
|
||||
|
||||
/* Now out exceeded capacity warnings... */
|
||||
if (MaxWorksheetsExceeded)
|
||||
printf("\t<MaxWorksheetsExceeded>The Maximum Number of Worksheets were exceeded, you might want to increase it.</MaxWorksheetsExceeded>\n ");
|
||||
printf
|
||||
("\t<MaxWorksheetsExceeded>The Maximum Number of Worksheets were exceeded, you might want to increase it.</MaxWorksheetsExceeded>\n ");
|
||||
if (MaxRowExceeded)
|
||||
printf("\t<MaxRowExceeded>The Maximum Number of Rows were exceeded, you might want to increase it.</MaxRowExceeded>\n ");
|
||||
printf
|
||||
("\t<MaxRowExceeded>The Maximum Number of Rows were exceeded, you might want to increase it.</MaxRowExceeded>\n ");
|
||||
if (MaxColExceeded)
|
||||
printf("\t<MaxColExceeded>The Maximum Number of Columns were exceeded, you might want to increase it.</MaxColExceeded>\n");
|
||||
printf
|
||||
("\t<MaxColExceeded>The Maximum Number of Columns were exceeded, you might want to increase it.</MaxColExceeded>\n");
|
||||
if (MaxStringsExceeded)
|
||||
printf("\t<MaxStringsExceeded>The Maximum Number of Strings were exceeded, you might want to increase it.</MaxStringsExceeded>\n");
|
||||
printf
|
||||
("\t<MaxStringsExceeded>The Maximum Number of Strings were exceeded, you might want to increase it.</MaxStringsExceeded>\n");
|
||||
if (MaxFontsExceeded)
|
||||
printf("\t<MaxFontsExceeded>The Maximum Number of Fonts were exceeded, you might want to increase it.</MaxFontsExceeded>\n");
|
||||
printf
|
||||
("\t<MaxFontsExceeded>The Maximum Number of Fonts were exceeded, you might want to increase it.</MaxFontsExceeded>\n");
|
||||
if (MaxPalExceeded)
|
||||
printf("\t<MaxPalExceeded>The Maximum Number of Color Palettes were exceeded, you might want to increase it.</MaxPalExceeded>\n");
|
||||
printf
|
||||
("\t<MaxPalExceeded>The Maximum Number of Color Palettes were exceeded, you might want to increase it.</MaxPalExceeded>\n");
|
||||
if (MaxXFExceeded)
|
||||
printf("\t<MaxXFExceeded>The Maximum Number of Extended Formats were exceeded, you might want to increase it.</MaxXFExceeded>\n");
|
||||
printf
|
||||
("\t<MaxXFExceeded>The Maximum Number of Extended Formats were exceeded, you might want to increase it.</MaxXFExceeded>\n");
|
||||
if (MaxFormatsExceeded)
|
||||
printf("\t<MaxFormatsExceeded>The Maximum Number of Formats were exceeded, you might want to increase it.</MaxFormatsExceeded>\n");
|
||||
printf
|
||||
("\t<MaxFormatsExceeded>The Maximum Number of Formats were exceeded, you might want to increase it.</MaxFormatsExceeded>\n");
|
||||
|
||||
/* Output Credit */
|
||||
printf("\t<tool>Created with xlhtml %s</tool>\n", VERSION);
|
||||
printf("\t<toollink>http://chicago.sf.net/xlhtml/</toollink>\n");
|
||||
printf( "</excel_workbook>\n" );
|
||||
printf ("\t<tool>Created with xlhtml %s</tool>\n", VERSION);
|
||||
printf ("\t<toollink>http://chicago.sf.net/xlhtml/</toollink>\n");
|
||||
printf ("</excel_workbook>\n");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user