/** * Word Document Exporting API * Proposed Draft v0.1 * Sept. 22, 2000 * * (c) Dom Lachowicz */ /* * This draft is under constant revision. * Expect it to change often and unannounced. */ typedef struct wvExporterTAG { /** * Consider everything here private. * Yes, that means you! */ wvStream *main; wvStream *table0; wvStream *data; wvStream *summaryInformation; /* 0 or more object streams that we won't use right now */ /* we'll need a *lot* of accounting information here */ FIB m_fib; /* others.. */ } wvExporter; /*********************************************************************/ /** * Creates a MSWord 97 exporter object * */ wvExporter *wvExporter_create(const char *filename); /** * Closes and saves the MSWord97 document */ void wvExporter_close(wvExporter *wv); /*********************************************************************/ /* * I think this covers all known types */ /** * Puts the string value associated with 'key' into * the Summary Stream */ void wvExporter_summaryPutString(wvExporter *wv, U32 key, const char *value); /** * Puts the long value associated with 'key' * into the Summary Stream */ void wvExporter_summaryPutLong(wvExporter *wv, U32 key, long value); /** * Puts the value associated with 'key' * into the Summary Stream. Converts 'value' into * the appropriate type (string or long) accordingly. */ void wvExporter_summaryPut(wvExporter *wv, U32 key, const char *value); /** * Puts the time value associated with 'key' into * the Summary Stream. * Possibly -=Initially unsupported=- */ void wvExporter_summaryPutDate(wvExporter *wv, U32 key, time_t *value); /*********************************************************************/ /* * No font or paragraph properties will be * initially supported */ /** * Sets foreground color * -=Initially unsupported=- */ void wvExporter_setForeColor(wvExporter *wv, U32 color); /** * Sets background color * -=Initially unsupported=- */ void wvExporter_setBackColor(wvExporter *wv, U32 color); /** * Sets the font face * See listing for common valid values * -=Initially unsupported=- */ void wvExporter_setFontFace(wvExporter *wv, const char *face); /** * Sets the font size *in half points* * -=Initially unsupported=- */ void wvExporter_setFontSize(wvExporter *wv, double half_points); /** * Set the font weight * -=Initially unsupported=- */ void wvExporter_setFontWeight(wvExporter *wv, U32 fw); /** * Wrapper around all other font calls * -=Initially unsupported=- */ void wvExporter_setFont(wvExporter *wv, const char *face, double half_points, U32 fw); /*********************************************************************/ /* * Def: section - a contiguous sequence of paragraphs within * the text stream. Equivalent to chapters in * book. The boundaries of sections mark where * the layout rules for a document (# columns, * etc...) are changed. */ /** * Begins a section * For now, please count on there only * being 1 section per document */ void wvExporter_sectionBegin(wvExporter *wv); /** * Ends a section */ void wvExporter_sectionEnd(wvExporter *wv); /* * Def: paragraph - contiguous sequence of characters within * the text stream, delimited by a paragraph * mark (ASCII(13)). */ /** * Begins a paragraph */ void wvExporter_paraBegin(wvExporter *wv); /** * Ends a paragraph */ void wvExporter_paraEnd(wvExporter *wv); /* * Def: text run - contiguous sequence of characters within * the text stream with the same character * formatting properties. */ /** * Write a run of text. Can cross paragraph boundaries. * Don't expect that to work though. Always close * your paragraphs! This function can be called more than once * on the same "run of text" - i.e. you can put this call * into a loop. C++ example: * while(!myRun.isEmpty()) { * wvExporter_textRun(wv, myRun.getElement()); * myRun.advanceNextElement(); * } */ void wvExporter_textRun(wvExporter *wv, const char *text); /** * Page break (ASCII(12)) */ void wvExporter_pageBreak(wvExporter *wv); /** * Column break (ASCII(14)) */ void wvExporter_columnBreak(wvExporter *wv); /** * "Hard" break - line break that's not a paragraph end * ASCII(11) */ void wvExporter_hardBreak(wvExporter *wv); /** * Exports a picture to the word document * -=Initially Unsupported=- */ void wvExporter_expPicture(wvExporter *wv, U32 type, const unsigned char *bytes); /** * Begin field * As of Word97, 91 different field types * -=Initially Unsupported=- */ void wvExporter_beginField(wvExporter *wv, int field_code); /** * End field * -=Initially Unsupported=- */ void wvExporter_endField(wvExporter *wv);