Browse Source

Bugfix: return default row height if row has no custom height.

master
eho 11 years ago
committed by Debao Zhang
parent
commit
1eea854740
  1. 11
      src/xlsx/xlsxworksheet.cpp

11
src/xlsx/xlsxworksheet.cpp

@ -1702,8 +1702,9 @@ double Worksheet::rowHeight(int row)
Q_D(Worksheet); Q_D(Worksheet);
int min_col = d->dimension.firstColumn() < 0 ? 0 : d->dimension.firstColumn(); int min_col = d->dimension.firstColumn() < 0 ? 0 : d->dimension.firstColumn();
if (d->checkDimensions(row, min_col, false, true)) if (d->checkDimensions(row, min_col, false, true) || !d->rowsInfo.contains(row))
return d->sheetFormatProps.defaultRowHeight; //return default on invalid row? return d->sheetFormatProps.defaultRowHeight; //return default on invalid row
return d->rowsInfo[row]->height; return d->rowsInfo[row]->height;
} }
@ -1966,21 +1967,21 @@ void WorksheetPrivate::loadXmlSheetData(QXmlStreamReader &reader)
} }
} }
} else if (reader.name() == QLatin1String("c")) { } else if (reader.name() == QLatin1String("c")) { //Cell
QXmlStreamAttributes attributes = reader.attributes(); QXmlStreamAttributes attributes = reader.attributes();
QString r = attributes.value(QLatin1String("r")).toString(); QString r = attributes.value(QLatin1String("r")).toString();
CellReference pos(r); CellReference pos(r);
//get format //get format
Format format; Format format;
if (attributes.hasAttribute(QLatin1String("s"))) { if (attributes.hasAttribute(QLatin1String("s"))) { //"s" == style index
int idx = attributes.value(QLatin1String("s")).toString().toInt(); int idx = attributes.value(QLatin1String("s")).toString().toInt();
format = workbook->styles()->xfFormat(idx); format = workbook->styles()->xfFormat(idx);
if (!format.isValid()) if (!format.isValid())
qDebug()<<QStringLiteral("<c s=\"%1\">Invalid style index: ").arg(idx)<<idx; qDebug()<<QStringLiteral("<c s=\"%1\">Invalid style index: ").arg(idx)<<idx;
} }
if (attributes.hasAttribute(QLatin1String("t"))) { if (attributes.hasAttribute(QLatin1String("t"))) { // "t" == cell data type
QString type = attributes.value(QLatin1String("t")).toString(); QString type = attributes.value(QLatin1String("t")).toString();
if (type == QLatin1String("s")) { if (type == QLatin1String("s")) {
//string type //string type

Loading…
Cancel
Save