+ printf ("<style index=\"%d\"", i);
+ match_byte_assert(i);
+ match_byte_assert(0x31);
+ printf(" font=\"%s\"", get_string());
+
+ printf(" size=\"%gpt\"", get_float());
+
+ int style = get_u32();
+ if (style & 1)
+ printf(" bold=\"true\"");
+ if (style & 2)
+ printf(" italic=\"true\"");
+
+ bool underline = data[pos++];
+ if (underline)
+ printf(" underline=\"true\"");
+
+ int halign = get_u32();
+ printf(" halign=%d", halign);
+
+ int valign = get_u32();
+ printf(" valign=%d", valign);
+
+ printf (" fgcolor=\"%s\"", get_string());
+ printf (" bgcolor=\"%s\"", get_string());
+
+ if (!match_byte(0))
+ match_byte_assert(1);
+
+ char *alt_fgcolor = get_string();
+ if (alt_fgcolor[0])
+ printf (" altfg=\"%s\"", alt_fgcolor);
+ char *alt_bgcolor = get_string();
+ if (alt_bgcolor[0])
+ printf (" altbg=\"%s\"", alt_bgcolor);
+
+ if (version > 1)
+ {
+ printf(" margins=\"");
+ for (int i = 0; i < 4; i++)
+ {
+ if (i)
+ putchar(' ');
+ printf("%d", get_u32());
+ }
+ putchar('"');
+ }
+
+ printf ("/>\n");
+ }
+
+ int x1 = get_u32();
+ int x1_end = pos + x1;
+ printf("<borders>\n");
+ match_be32_assert(1);
+ int n_borders = get_be32();
+ for (int i = 0; i < n_borders; i++)
+ {
+ int type = get_be32();
+ int stroke = get_be32();
+ int color = get_be32();
+ printf(" <border type=\"%d\" stroke=\"%s\" color=\"#%06x\"/>\n",
+ type,
+ (stroke == 0 ? "none"
+ : stroke == 1 ? "solid"
+ : stroke == 2 ? "dashed"
+ : stroke == 3 ? "thick"
+ : stroke == 4 ? "thin"
+ : stroke == 5 ? "double"
+ : "<error>"),
+ color);
+ }
+ bool grid = get_byte();
+ pos += 3;
+ printf(" <grid show=\"%s\"/>\n", grid ? "yes" : "no");
+ printf("</borders>\n");
+ assert(pos == x1_end);
+
+ int skip = get_u32();
+ assert(skip == 18 || skip == 25);
+ pos += skip;
+
+ int x3 = get_u32();
+ int x3_end = pos + x3;
+ if (version == 3)
+ {
+ match_be32_assert(1);
+ get_be32();
+ printf("<settings layer=\"%d\"", get_be32());
+ if (!get_bool())
+ printf(" skipempty=\"false\"");
+ if (!get_bool())
+ printf(" showdimensionincorner=\"false\"");
+ if (!get_bool())
+ printf(" markers=\"numeric\"");
+ if (!get_bool())
+ printf(" footnoteposition=\"subscript\"");
+ get_byte();
+ int nbytes = get_be32();
+ int end = pos + nbytes;
+ printf("\n");
+ while (pos + 4 <= end)
+ printf(" %d", get_be32());
+ pos = end;
+ printf("\n");
+ pos += nbytes;
+ char *notes = get_string_be();
+ if (notes[0])
+ printf(" notes=\"%s\"", notes);
+ char *look = get_string_be();
+ if (look[0])
+ printf(" look=\"%s\"", look);
+ printf(">\n");