/* xls2xml: Converts from Microsoft Excel files to XML. Copyright 1999 Roberto Arturo Tena Sanchez This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* Roberto Arturo Tena Sanchez */ #include #include #include #include #include #include /* RSTRING - Cell with Character Formatting */ int pD6 (void) { U16 temp; U16 count_chars; U16 count_formatting; U16 i; U8 * string, * formatting; xmlNodePtr cell; assert_return (xls2xml, parameters->record.opcode == 0xD6, 19); test (parameters->record.size >= 9, 15); assert_return (xls2xml, parameters->this_cells != NULL, 19); count_chars = fil_sreadU16 (parameters->record.info + 6); count_formatting = *(parameters->record.info + 8 + count_chars); string = malloc (3 + 2 + count_chars + count_formatting * 4); /* copy string length */ fil_swriteU16 (string, &count_chars); /* copy flags */ *(string+2) = 0x08; /* no extended, compressed, rich string */ /* copy formatting count */ fil_swriteU16 (string+3, &count_formatting); /* copy string */ memcpy (string + 5, parameters->record.info + 8, count_chars); /* copy formatting */ for ( i = 0, formatting = parameters->record.info + 8 + count_chars + 1; i < count_formatting; i++, formatting += 2 ) { temp = *(formatting); fil_swriteU16 (string + 3 + 2 + count_chars + 4*i, &temp); temp = *(formatting + 1); fil_swriteU16 (string + 3 + 2 + count_chars + 4*i + 2, &temp); } test_call (write_unicode_xml_child (parameters->this_cells, &cell, "cell", (unsigned char *)string, 3 + 2 + count_chars + count_formatting * 4, NULL), int); test_call (create_cell_coord (cell, fil_sreadU16 (parameters->record.info), fil_sreadU16 (parameters->record.info+2)), int); return 0; }