Hi, I'm writing a Qt application that edits an ods file. I can access content.xml, read it, make the changes that I need on the QDomDocument, but when I save it, it creates a second content.xml file inside the archive. Does anyone know what I'm doing wrong?
This is the relevant part of the code:
1 2 3 4 5 6 7 8 9 10 11
|
//WRITING PART
QuaZip zipOut(filename);
zipOut.open(QuaZip::mdAdd);
QuaZipFile fileOut(&zipOut);
const QuaZipNewInfo* newinfo= new QuaZipNewInfo(info);
//fileOut.open(QuaZIODevice::WriteOnly,*newinfo);
fileOut.open(QuaZIODevice::WriteOnly,QuaZipNewInfo(CONTENT_XML));
fileOut.write(xml.toByteArray());
fileOut.close();
zipOut.close();
delete newinfo;
|
xml is a QDomDocument
CONTENT_XML is defined as "content.xml"
When I use QuaZip::mdAdd, it creates a new content.xml file
With QuaZip::mdAppend and QuaZip::mdCreate, it deletes all the files in the archive and creates content.xml inside it.
And with QuaZip::mdUnzip, it just won't open the file in WriteOnly.