From 8570ed47db7dba03038c5cd9f43a0006bec66f41 Mon Sep 17 00:00:00 2001 From: slidedraw Date: Thu, 16 May 2002 15:20:20 +0000 Subject: [PATCH] Added a RPM Spec file, and added some bug fixes. Also removed toplevel Change Log and AUTHORS file. --- AUTHORS | 1 - ChangeLog | 0 xlhtml/ChangeLog | 3 +- xlhtml/xlhtml.1 | 106 ++++++++++++++++++++++++++++---------- xlhtml/xlhtml.c | 130 ++++++++++++++++++++++------------------------- 5 files changed, 141 insertions(+), 99 deletions(-) delete mode 100644 AUTHORS delete mode 100644 ChangeLog diff --git a/AUTHORS b/AUTHORS deleted file mode 100644 index 4b673e8..0000000 --- a/AUTHORS +++ /dev/null @@ -1 +0,0 @@ - Charles Wyble diff --git a/ChangeLog b/ChangeLog deleted file mode 100644 index e69de29..0000000 diff --git a/xlhtml/ChangeLog b/xlhtml/ChangeLog index 5205d49..8fd04f6 100644 --- a/xlhtml/ChangeLog +++ b/xlhtml/ChangeLog @@ -1,7 +1,7 @@ xlHtml ChangeLog HEAD - - Vaclav Dvorak: + - Vaclav Dvorak * Temporary fix for non-Unicode 8-bit characters in utf-8 output until real charset conversion is in place * Fixed some typos and formatting @@ -17,6 +17,7 @@ HEAD output, or MaxStringsExceeded * Enabled compilation warnings, made sure there are none * More code modularization + * Fixed handling of fonts (fixes some segfaults, closes bug 529044) * Added some Alpha portability fixes. 0.5 04/13/02 diff --git a/xlhtml/xlhtml.1 b/xlhtml/xlhtml.1 index f987b81..9cce8bb 100644 --- a/xlhtml/xlhtml.1 +++ b/xlhtml/xlhtml.1 @@ -1,15 +1,33 @@ .\"Created with GNOME Manpages Editor Wizard .\"http://gmanedit.sourceforge.net .\"Sergio Rua +.\"Updated by hand of Vaclav Dvorak .\" -.TH xlhtml 1 "October 13, 2001" "xlhtml" +.TH xlhtml 1 "May 15, 2002" "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 ] +.RB [ \-nc ] +.RB [ \-a ] +.RB [ \-fw ] +.RB [ \-bc\fINNNNNN\fP ] +.RB [ \-tc\fINNNNNN\fP ] +.RB [ \-bi\fI/path\fP ] +.RB [ \-c ] +.RB [ \-te ] +.RB [ \-v ] +.RB [ \-m ] +.RB [ \-asc ] +.RB [ \-dp ] +.RB [ \-xp:\fIN\fP ] +.RB [ \-xc:\fIN\fP ] +.RB [ \-xr:\fIN\fP ] +.RB [ \-xml ] +.RB [ \-csv ] +.RB \fIFILE\fP .br .SH DESCRIPTION @@ -17,59 +35,93 @@ 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. +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 +.TP +.BR \-nc tells it not to colorize the output. -.IP -a -aggressively optimize html by removing or VALIGN="bottom" Some older browsers may not display properly in this mode. -.IP -fw +.TP +.BR \-a +aggressively optimize html by removing or VALIGN="bottom". Some +older browsers may not display properly in this mode. +.TP +.BR \-fw suppress formula warnings about accuracy -.IP -bc +.TP +.BR \-bc Override the background color. e.g. -bg808080 for gray -.IP -tc +.TP +.BR \-tc Override the text color. e.g. -tcFF0000 for red -.IP -bi +.TP +.BR \-bi Use background image. e.g. -bi/home/httpd/icon/tar.gif -.IP -c +.TP +.BR \-c Centers the tables horizontally -.IP -te +.TP +.BR \-te Trims empty rows & columns at the edges of a worksheet -.IP -v +.TP +.BR \-v Prints program version -.IP -m +.TP +.BR \-m No encoding for multibyte -.IP -asc +.TP +.BR \-asc Ascii out of -dp and extraction data (-x?) -.IP -dp +.TP +.BR \-dp Dump page count and max columns and rows per page -.IP -xp +.TP +.BR \-xp Page for extraction (zero based) -.IP -xc +.TP +.BR \-xc Columns (separated by a dash) for extraction (zero based) -.IP -xr +.TP +.BR \-xr Rows (separated by a dash) to be extracted (zero based) -.IP -xml +.TP +.BR \-xml Output in XML -.IP -csv +.TP +.BR \-csv Output in Comma Separated Values -.IP -nh +.TP +.BR \-nh Suppress header and body tags in html output - +.PP 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 +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: +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. +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 +Steve Grubb, Charles N Wyble diff --git a/xlhtml/xlhtml.c b/xlhtml/xlhtml.c index e93fccc..60108c8 100644 --- a/xlhtml/xlhtml.c +++ b/xlhtml/xlhtml.c @@ -1145,82 +1145,72 @@ void main_line_processor(U16 opcode, U16 version, U32 count, U16 last, U8 data) break; case 0x31: /* Font */ working_buffer[bufidx++] = data; - if (bufidx > 14) /* Address 14 has length in unicode chars */ - { - if ((file_version == EXCEL95)&&(bufidx == last)) - { /* Microsoft doesn't stick to their documentation. Excel 97 is supposed - to be 0x0231...but it's not. Have to use file_version to separate them. */ - unsigned int i; - U16 size, attr, c_idx, b, su; - U8 u; + if ((file_version == EXCEL95) && (bufidx == last) && (last >= 15)) + { /* Microsoft doesn't stick to their documentation. Excel 97 is supposed + to be 0x0231...but it's not. Have to use file_version to separate them. */ + unsigned int i; + U16 size, attr, c_idx, b, su; + U8 u; - size = getShort(&working_buffer[0]); - attr = getShort(&working_buffer[2]); - c_idx = getShort(&working_buffer[4]); - b = getShort(&working_buffer[6]); - su = getShort(&working_buffer[8]); - u = working_buffer[10]; - buflast = working_buffer[14]; - for (i=0; i= 16)) + { /* Microsoft doesn't stick to their documentation. Excel 97 is supposed + to be 0x0231...but it's not. Have to use file_version to separate them. */ + unsigned int i; + U16 len; + U16 size, attr, c_idx, b, su; + U8 u, uni; + + size = getShort(&working_buffer[0]); + attr = getShort(&working_buffer[2]); + c_idx = getShort(&working_buffer[4]); + b = getShort(&working_buffer[6]); + su = getShort(&working_buffer[8]); + u = working_buffer[10]; + buflast = working_buffer[14]; + + if (working_buffer[15] & 0x01) + { + uni = 2; + len = 2 * (U16)buflast; + for (i=0; i 0x0080U) && (uni == 0)) - uni = 1; - } - } - else + else + { + uni = 0; + len = (U16)buflast; + for (i=0; i= 0x80U) + uni = 1; } - - working_buffer[len] = 0; - -/* printf("S:%04X A:%04X C:%04X B:%04X SU:%04X U:%02X\n", - size, attr,c_idx,b,su,u); - printf("BL:%d L:%d Uni:%d\n", buflast, len, uni); - printf("%X %X %X %X\n", working_buffer[15], working_buffer[16], working_buffer[17], working_buffer[18]); - printf("f:%s\n", working_buffer); */ - add_font(size, attr, c_idx, b, su, u, uni, &working_buffer[0], len); } + + working_buffer[len] = 0; + +/* printf("S:%04X A:%04X C:%04X B:%04X SU:%04X U:%02X\n", + size, attr,c_idx,b,su,u); + printf("BL:%d L:%d Uni:%d\n", buflast, len, uni); + printf("%X %X %X %X\n", working_buffer[15], working_buffer[16], working_buffer[17], working_buffer[18]); + printf("f:%s\n", working_buffer); */ + add_font(size, attr, c_idx, b, su, u, uni, &working_buffer[0], len); } break; case 0x14: /* Header */