From koffice-devel Thu Aug 14 02:41:51 2008 From: Sebastian Sauer Date: Thu, 14 Aug 2008 02:41:51 +0000 To: koffice-devel Subject: Re: Writing images to ODT's Message-Id: <200808140441.51787.mail () dipe ! org> X-MARC-Message: https://marc.info/?l=koffice-devel&m=121868175311002 On Thursday 14 August 2008, cricketc@gmail.com wrote: > Hey everyone, > > I'm working on converting MS docs to ODT's, and I'm trying to write > the images from the doc into the ODT. Has anyone else done that with > the ODF libraries yet? Should I just create a KoStoreDevice and write > to that? How would I add that file to the KoStore for the whole ODT? probably something like we do in libs/flake/KoShapeSavingContext.cpp; bool KoShapeSavingContext::saveImages( KoStore * store, KoXmlWriter * manifestWriter ) const { QString fileName("/tmp/temp.png"); // Find the mimetype only by the extension, not by file content (as the file is empty!) const QString mimetype( KMimeType::findByPath( fileName, 0 ,true )->name() ); QMapIterator i( m_pixmaps ); while( i.hasNext() ) { i.next(); if( store->open( i.key() ) ) { KoStoreDevice dev(store); if ( ! i.value().save(&dev, "PNG" ) ) return false; // e.g. bad image? if ( !store->close() ) return false; // e.g. disk full manifestWriter->addManifestEntry( i.key(), mimetype ); } } return true; } _______________________________________________ koffice-devel mailing list koffice-devel@kde.org https://mail.kde.org/mailman/listinfo/koffice-devel