[prev in list] [next in list] [prev in thread] [next in thread]
List: koffice-devel
Subject: Re: Writing images to ODT's
From: Sebastian Sauer <mail () dipe ! org>
Date: 2008-08-14 2:41:51
Message-ID: 200808140441.51787.mail () dipe ! org
[Download RAW message or body]
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<QString, QPixmap> 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
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic