Don't create the default "Sheet1" worksheet
Unless the user want to access it, or the user want to save an empty workbook.
This commit is contained in:
@@ -96,9 +96,6 @@ void DocumentPrivate::init()
|
||||
|
||||
if (workbook.isNull())
|
||||
workbook = QSharedPointer<Workbook>(new Workbook(Workbook::F_NewFromScratch));
|
||||
|
||||
if (workbook->sheetCount() == 0)
|
||||
workbook->addSheet();
|
||||
}
|
||||
|
||||
bool DocumentPrivate::loadPackage(QIODevice *device)
|
||||
|
||||
@@ -255,6 +255,8 @@ AbstractSheet *Workbook::insertSheet(int index, const QString &name, AbstractShe
|
||||
AbstractSheet *Workbook::activeSheet() const
|
||||
{
|
||||
Q_D(const Workbook);
|
||||
if (d->sheets.isEmpty())
|
||||
const_cast<Workbook*>(this)->addSheet();
|
||||
return d->sheets[d->activesheetIndex].data();
|
||||
}
|
||||
|
||||
@@ -426,6 +428,8 @@ void Workbook::saveToXmlFile(QIODevice *device) const
|
||||
{
|
||||
Q_D(const Workbook);
|
||||
d->relationships->clear();
|
||||
if (d->sheets.isEmpty())
|
||||
const_cast<Workbook *>(this)->addSheet();
|
||||
|
||||
QXmlStreamWriter writer(device);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user