[gnumeric] Lotus: read more from wk4 files.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Lotus: read more from wk4 files.
- Date: Wed, 5 May 2021 00:01:25 +0000 (UTC)
commit d1b8c70f5d0c3543db369f543059a8d982e7a1f7
Author: Morten Welinder <terra gnome org>
Date: Tue May 4 20:00:54 2021 -0400
Lotus: read more from wk4 files.
plugins/lotus-123/ChangeLog | 5 +++++
plugins/lotus-123/lotus-types.h | 2 ++
plugins/lotus-123/lotus.c | 40 +++++++++++++++++++++++++++++++++++-----
3 files changed, 42 insertions(+), 5 deletions(-)
---
diff --git a/plugins/lotus-123/ChangeLog b/plugins/lotus-123/ChangeLog
index b853c465a..7268db0c6 100644
--- a/plugins/lotus-123/ChangeLog
+++ b/plugins/lotus-123/ChangeLog
@@ -1,3 +1,8 @@
+2021-05-04 Morten Welinder <terra gnome org>
+
+ * lotus.c (lotus_read_new): Parse wk4 row widths. Parse sheet
+ names in yet another record type.
+
2021-03-14 Morten Welinder <terra gnome org>
* Release 1.12.49
diff --git a/plugins/lotus-123/lotus-types.h b/plugins/lotus-123/lotus-types.h
index 39326c0f5..f3f9abdb3 100644
--- a/plugins/lotus-123/lotus-types.h
+++ b/plugins/lotus-123/lotus-types.h
@@ -39,6 +39,8 @@
#define LOTUS_STRING 0x33
/* Stuff observed in new formats only: */
+#define LOTUS_COLW4 0x7
+#define LOTUS_HIDDENCOL 0x8
#define LOTUS_USER_RANGE 0x9
#define LOTUS_SYSTEMRANGE 0xa
#define LOTUS_ZEROFORCE 0xb
diff --git a/plugins/lotus-123/lotus.c b/plugins/lotus-123/lotus.c
index 7675b3983..e9ad88c87 100644
--- a/plugins/lotus-123/lotus.c
+++ b/plugins/lotus-123/lotus.c
@@ -6,6 +6,9 @@
* Michael Meeks (mmeeks gnu org)
* Stephen Wood (saw genhomepage com)
* Morten Welinder (terra gnome org)
+ *
+ * Docs are scarce.
+ * https://www.mettalogic.co.uk/tim/l123/l123r4.html
**/
#include <gnumeric-config.h>
#include <gnumeric.h>
@@ -1955,6 +1958,20 @@ lotus_read_new (LotusState *state, record_t *r)
case LOTUS_EOF:
goto done;
+ case LOTUS_COLW4: CHECK_RECORD_SIZE (>= 4) {
+ Sheet *sheet = lotus_get_sheet (state->wb, r->data[0]);
+ int i, n = (r->len - 4) / 2;
+ for (i = 0; i < n; i++) {
+ guint8 col = r->data[4 + 2 * i];
+ guint8 chars = r->data[5 + 2 * i];
+ gboolean value_set = TRUE;
+ // Very approximate
+ double size = lotus_twips_to_points (chars * (20 * 72 / 11));
+ sheet_col_set_size_pts (sheet, col, size, value_set);
+ }
+ break;
+ }
+
case LOTUS_FORMAT: CHECK_RECORD_SIZE (>= 2) {
Sheet *sheet = lotus_get_sheet (state->wb, r->data[0]);
guint8 subtype = GSF_LE_GET_GUINT8 (r->data + 1);
@@ -2187,16 +2204,29 @@ lotus_read_new (LotusState *state, record_t *r)
break;
}
+ case 0x36b0: CHECK_RECORD_SIZE (> 5) {
+ // Sheet name
+ guint8 sheetno = GSF_LE_GET_GUINT8 (r->data + 2);
+ char *name = g_strndup (r->data + 4, r->len - 5);
+ Sheet *sheet = lotus_get_sheet (state->wb, sheetno);
+ g_object_set (sheet, "name", name, NULL);
+ g_free (name);
+ break;
+ }
+
default:
g_printerr ("Unknown style record 0x%x/%04x of length %d.\n",
r->type, subtype,
r->len);
- case 0xfab: /* Edge style */
- case 0xfb4: /* Interior style */
- case 0xfc9: /* Frame style */
- case 0xfe6: /* Named style */
- case 0xffa: /* Style pool */
+ case 0x07d7: // Row height
+ case 0x0fab: // Edge style
+ case 0x0fb4: // Interior style
+ case 0x0fc9: // Frame style
+ case 0x0fe6: // Background style
+ case 0x0ff0: // Text style
+ case 0x0ffa: // Style pool
+ case 0x32e7: // Named style
break;
}
break;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]