Skip to content
Open
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions QXlsx/header/xlsxworksheet_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,10 @@ class WorksheetPrivate : public AbstractSheetPrivate

public:
int checkDimensions(int row, int col, bool ignore_row = false, bool ignore_col = false);
void resolveCellPosition(CellReference &position,
bool hasExplicitReference,
int &row,
int &column);
Format cellFormat(int row, int col) const;
QString generateDimensionString() const;
void calculateSpans() const;
Expand Down
22 changes: 18 additions & 4 deletions QXlsx/source/xlsxworksheet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2342,10 +2342,7 @@ void WorksheetPrivate::loadXmlSheetData(QXmlStreamReader &reader)
QXmlStreamAttributes attributes = reader.attributes();
QString r = attributes.value(QLatin1String("r")).toString();
CellReference pos(r);
if (r.isEmpty()) {
pos.setRow(row_num);
pos.setColumn(++col_num);
}
resolveCellPosition(pos, !r.isEmpty(), row_num, col_num);

// get format
Format format;
Expand Down Expand Up @@ -2475,6 +2472,23 @@ void WorksheetPrivate::loadXmlSheetData(QXmlStreamReader &reader)
dimension.setLastColumn(col_num);
}

void WorksheetPrivate::resolveCellPosition(CellReference &position,
bool hasExplicitReference,
int &row,
int &column)
{
if (!hasExplicitReference) {
position.setRow(row);
position.setColumn(++column);
} else if (position.isValid()) {
row = position.row();
column = position.column();
}

if (position.isValid())
checkDimensions(position.row(), position.column());
}

void WorksheetPrivate::loadXmlColumnsInfo(QXmlStreamReader &reader)
{
Q_ASSERT(reader.name() == QLatin1String("cols"));
Expand Down