mirror of
https://github.com/QtExcel/QXlsx.git
synced 2025-01-16 04:42:53 +08:00
Merge pull request #341 from hxbb00/master
fix: workbook.xml.rels with absolute path
This commit is contained in:
commit
9c704961d0
@ -607,15 +607,21 @@ bool Workbook::loadFromXmlFile(QIODevice *device)
|
||||
|
||||
AbstractSheet *sheet = addSheet(name, sheetId, type);
|
||||
sheet->setSheetState(state);
|
||||
QString strFilePath = filePath();
|
||||
if (relationship.target.startsWith("/")) {
|
||||
QString fullPath = QDir::cleanPath(relationship.target.mid(1));
|
||||
|
||||
// const QString fullPath = QDir::cleanPath(splitPath(strFilePath).constFirst() +
|
||||
// QLatin1String("/") + relationship.target);
|
||||
const auto parts = splitPath(strFilePath);
|
||||
QString fullPath =
|
||||
QDir::cleanPath(parts.first() + QLatin1String("/") + relationship.target);
|
||||
|
||||
sheet->setFilePath(fullPath);
|
||||
sheet->setFilePath(fullPath);
|
||||
}else{
|
||||
QString strFilePath = filePath();
|
||||
|
||||
// const QString fullPath = QDir::cleanPath(splitPath(strFilePath).constFirst() +
|
||||
// QLatin1String("/") + relationship.target);
|
||||
const auto parts = splitPath(strFilePath);
|
||||
QString fullPath =
|
||||
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")))
|
||||
|
Loading…
x
Reference in New Issue
Block a user