[prev in list] [next in list] [prev in thread] [next in thread]
List: koffice-devel
Subject: Programatically create kspread doc
From: PiggZ <adam () piggz ! co ! uk>
Date: 2008-06-03 21:16:58
Message-ID: g24ccj$2o0$1 () ger ! gmane ! org
[Download RAW message or body]
Hi
Can someone in the know tell me where the following code goes wrong? Kspread wont \
load the file, oo.o will but shows a blank sheet. content.xml shows an empty document \
like this:
<office:automatic-styles/>
<office:body>
<office:spreadsheet>
</office:spreadsheet>
</office:body>
</office:document-content>
The code executes all the way through because the final debug statement is printed.
Cheers
And the code:
KSpread::Doc *ksdoc = new KSpread::Doc();
KSpread::Sheet *sht = ksdoc->map()->createSheet();
sht->setSheetName(doc->title());
sht->setText(0,0,"Hello");
sht->setText(1,1,"There");
///=============================
KoStore* store = KoStore::createStore( "/home/piggz/kexitest.ods", KoStore::Write);
if ( store->bad() )
{
delete store;
return;
}
kDebug() <<"Saving to OASIS format";
// Tell KoStore not to touch the file names
store->disallowNameExpansion();
KoOdfWriteStore odfStore( store );
KoXmlWriter* manifestWriter = odfStore.manifestWriter( ksdoc->mimeType() );
KoEmbeddedDocumentSaver embeddedSaver;
KoDocument::SavingContext documentContext( odfStore, embeddedSaver );
if ( !ksdoc->saveOdf( documentContext ) )
{
kDebug() <<"saveOdf failed";
delete store;
return;
}
// Save embedded objects
if ( !embeddedSaver.saveEmbeddedDocuments( documentContext ) )
{
kDebug() <<"save embedded documents failed";
delete store;
return ;
}
// Write out manifest file
if ( !odfStore.closeManifestWriter() )
{
kDebug() << "Error while trying to write 'META-INF/manifest.xml'. Partition full?";
delete store;
return;
}
if ( !store->finalize() )
{
delete store;
return;
}
kDebug() << "SAVED OK" << endl;
delete store;
delete doc;
_______________________________________________
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