1
0
mirror of https://github.com/QtExcel/QXlsx.git synced 2025-01-30 05:02:52 +08:00

fix: workbook.xml.rels with absolute path

https://github.com/QtExcel/QXlsx/issues/310
This commit is contained in:
hxbb00 2024-07-29 12:01:43 +08:00 committed by GitHub
parent db36c652ed
commit 3192b808a2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -607,6 +607,11 @@ bool Workbook::loadFromXmlFile(QIODevice *device)
AbstractSheet *sheet = addSheet(name, sheetId, type);
sheet->setSheetState(state);
if (relationship.target.startsWith("/")) {
QString fullPath = QDir::cleanPath(relationship.target.mid(1));
sheet->setFilePath(fullPath);
}else{
QString strFilePath = filePath();
// const QString fullPath = QDir::cleanPath(splitPath(strFilePath).constFirst() +
@ -616,6 +621,7 @@ bool Workbook::loadFromXmlFile(QIODevice *device)
QDir::cleanPath(parts.first() + QLatin1String("/") + relationship.target);
sheet->setFilePath(fullPath);
}
} else if (reader.name() == QLatin1String("workbookPr")) {
QXmlStreamAttributes attrs = reader.attributes();
if (attrs.hasAttribute(QLatin1String("date1904")))