File tree Expand file tree Collapse file tree 1 file changed +15
-9
lines changed Expand file tree Collapse file tree 1 file changed +15
-9
lines changed Original file line number Diff line number Diff line change @@ -607,15 +607,21 @@ bool Workbook::loadFromXmlFile(QIODevice *device)
607
607
608
608
AbstractSheet *sheet = addSheet (name, sheetId, type);
609
609
sheet->setSheetState (state);
610
- QString strFilePath = filePath ();
611
-
612
- // const QString fullPath = QDir::cleanPath(splitPath(strFilePath).constFirst() +
613
- // QLatin1String("/") + relationship.target);
614
- const auto parts = splitPath (strFilePath);
615
- QString fullPath =
616
- QDir::cleanPath (parts.first () + QLatin1String (" /" ) + relationship.target );
617
-
618
- sheet->setFilePath (fullPath);
610
+ if (relationship.target .startsWith (" /" )) {
611
+ QString fullPath = QDir::cleanPath (relationship.target .mid (1 ));
612
+
613
+ sheet->setFilePath (fullPath);
614
+ }else {
615
+ QString strFilePath = filePath ();
616
+
617
+ // const QString fullPath = QDir::cleanPath(splitPath(strFilePath).constFirst() +
618
+ // QLatin1String("/") + relationship.target);
619
+ const auto parts = splitPath (strFilePath);
620
+ QString fullPath =
621
+ QDir::cleanPath (parts.first () + QLatin1String (" /" ) + relationship.target );
622
+
623
+ sheet->setFilePath (fullPath);
624
+ }
619
625
} else if (reader.name () == QLatin1String (" workbookPr" )) {
620
626
QXmlStreamAttributes attrs = reader.attributes ();
621
627
if (attrs.hasAttribute (QLatin1String (" date1904" )))
You can’t perform that action at this time.
0 commit comments