Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: workbook.xml.rels with absolute path #341

Merged
merged 1 commit into from
Aug 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletions QXlsx/source/xlsxworkbook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -607,15 +607,21 @@ bool Workbook::loadFromXmlFile(QIODevice *device)

AbstractSheet *sheet = addSheet(name, sheetId, type);
sheet->setSheetState(state);
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);
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() +
// 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")))
Expand Down
Loading