Fixed review comments: Removed deprecated members. Replaced string arguments by CellRange.
This commit is contained in:
+45
-62
@@ -515,88 +515,68 @@ bool Document::unmergeCells(const CellRange &range)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Sets the column properties for all columns from \a colFirst to \a colLast with
|
Sets width in characters of a range of columns.
|
||||||
the given \a width, \a format and \a hidden. Column
|
Returns true on success.
|
||||||
width measured as the number of characters of the maximum digit width of the
|
|
||||||
numbers 0, 1, 2, ..., 9 as rendered in the normal style's font.
|
|
||||||
\a colFirst and \a colLast are all 1-indexed.
|
|
||||||
|
|
||||||
Return false if failed.
|
|
||||||
*/
|
*/
|
||||||
bool Document::setColumn(int colFirst, int colLast, double width, const Format &format, bool hidden)
|
bool Document::setColumnWidth(const CellRange &range, double width)
|
||||||
{
|
{
|
||||||
if (Worksheet *sheet = currentWorksheet())
|
if (Worksheet *sheet = currentWorksheet())
|
||||||
return sheet->setColumn(colFirst, colLast, width, format, hidden);
|
return sheet->setColumnWidth(range, width);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\overload
|
Sets format property of a range of columns.
|
||||||
|
Returns true on success.
|
||||||
Sets column width and format for all columns from \a colFirst to \a colLast with
|
|
||||||
the given \a width and \a format. Column
|
|
||||||
\a width measured as the number of characters of the maximum digit width of the
|
|
||||||
numbers 0, 1, 2, ..., 9 as rendered in the normal style's font.
|
|
||||||
\a colFirst and \a colLast should be "A", "B", "C", ...
|
|
||||||
*/
|
*/
|
||||||
bool Document::setColumn(const QString &colFirst, const QString &colLast, double width, const Format &format, bool hidden)
|
bool Document::setColumnFormat(const CellRange &range, const Format &format)
|
||||||
{
|
{
|
||||||
if (Worksheet *sheet = currentWorksheet())
|
if (Worksheet *sheet = currentWorksheet())
|
||||||
return sheet->setColumn(colFirst, colLast, width, format, hidden);
|
return sheet->setColumnFormat(range, format);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Document::setColumnWidth(const QString &column, double width)
|
/*!
|
||||||
{
|
Sets hidden property of a range of columns. Columns are 1-indexed.
|
||||||
return setColumnWidth(column,column,width);
|
Hidden columns are not visible.
|
||||||
}
|
Returns true on success.
|
||||||
|
*/
|
||||||
bool Document::setColumnFormat(const QString &column, const Format &format)
|
bool Document::setColumnHidden(const CellRange &range, bool hidden)
|
||||||
{
|
|
||||||
return setColumnFormat(column,column,format);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Document::setColumnHidden(const QString &column, bool hidden)
|
|
||||||
{
|
|
||||||
return setColumnHidden(column,column,hidden);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Document::setColumnWidth(const QString &colFirst, const QString &colLast, double width)
|
|
||||||
{
|
{
|
||||||
if (Worksheet *sheet = currentWorksheet())
|
if (Worksheet *sheet = currentWorksheet())
|
||||||
return sheet->setColumnWidth(colFirst, colLast, width);
|
return sheet->setColumnWidth(range, hidden);
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Document::setColumnFormat(const QString &colFirst, const QString &colLast, const Format &format)
|
|
||||||
{
|
|
||||||
if (Worksheet *sheet = currentWorksheet())
|
|
||||||
return sheet->setColumnFormat(colFirst, colLast, format);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Document::setColumnHidden(const QString &colFirst, const QString &colLast, bool hidden)
|
|
||||||
{
|
|
||||||
if (Worksheet *sheet = currentWorksheet())
|
|
||||||
return sheet->setColumnWidth(colFirst, colLast, hidden);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Sets width in characters of a range of columns. Columns are 1-indexed.
|
||||||
|
Returns true on success.
|
||||||
|
*/
|
||||||
bool Document::setColumnWidth(int column, double width)
|
bool Document::setColumnWidth(int column, double width)
|
||||||
{
|
{
|
||||||
return setColumnWidth(column,column,width);
|
return setColumnWidth(column,column,width);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Sets format property of a range of columns. Columns are 1-indexed.
|
||||||
|
*/
|
||||||
bool Document::setColumnFormat(int column, const Format &format)
|
bool Document::setColumnFormat(int column, const Format &format)
|
||||||
{
|
{
|
||||||
return setColumnFormat(column,column,format);
|
return setColumnFormat(column,column,format);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Sets hidden property of a column. Columns are 1-indexed.
|
||||||
|
*/
|
||||||
bool Document::setColumnHidden(int column, bool hidden)
|
bool Document::setColumnHidden(int column, bool hidden)
|
||||||
{
|
{
|
||||||
return setColumnHidden(column,column,hidden);
|
return setColumnHidden(column,column,hidden);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Sets width in characters of a range of columns. Columns are 1-indexed.
|
||||||
|
Returns true on success.
|
||||||
|
*/
|
||||||
bool Document::setColumnWidth(int colFirst, int colLast, double width)
|
bool Document::setColumnWidth(int colFirst, int colLast, double width)
|
||||||
{
|
{
|
||||||
if (Worksheet *sheet = currentWorksheet())
|
if (Worksheet *sheet = currentWorksheet())
|
||||||
@@ -604,6 +584,9 @@ bool Document::setColumnWidth(int colFirst, int colLast, double width)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Sets format property of a range of columns. Columns are 1-indexed.
|
||||||
|
*/
|
||||||
bool Document::setColumnFormat(int colFirst, int colLast, const Format &format)
|
bool Document::setColumnFormat(int colFirst, int colLast, const Format &format)
|
||||||
{
|
{
|
||||||
if (Worksheet *sheet = currentWorksheet())
|
if (Worksheet *sheet = currentWorksheet())
|
||||||
@@ -611,6 +594,10 @@ bool Document::setColumnFormat(int colFirst, int colLast, const Format &format)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Sets hidden property of a range of columns. Columns are 1-indexed.
|
||||||
|
*/
|
||||||
bool Document::setColumnHidden(int colFirst, int colLast, bool hidden)
|
bool Document::setColumnHidden(int colFirst, int colLast, bool hidden)
|
||||||
{
|
{
|
||||||
if (Worksheet *sheet = currentWorksheet())
|
if (Worksheet *sheet = currentWorksheet())
|
||||||
@@ -618,6 +605,9 @@ bool Document::setColumnHidden(int colFirst, int colLast, bool hidden)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Returns width of the column in characters of the normal font. Columns are 1-indexed.
|
||||||
|
*/
|
||||||
double Document::columnWidth(int column)
|
double Document::columnWidth(int column)
|
||||||
{
|
{
|
||||||
if (Worksheet *sheet = currentWorksheet())
|
if (Worksheet *sheet = currentWorksheet())
|
||||||
@@ -625,6 +615,9 @@ double Document::columnWidth(int column)
|
|||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Returns formatting of the column. Columns are 1-indexed.
|
||||||
|
*/
|
||||||
Format Document::columnFormat(int column)
|
Format Document::columnFormat(int column)
|
||||||
{
|
{
|
||||||
if (Worksheet *sheet = currentWorksheet())
|
if (Worksheet *sheet = currentWorksheet())
|
||||||
@@ -632,6 +625,9 @@ Format Document::columnFormat(int column)
|
|||||||
return Format();
|
return Format();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Returns true if column is hidden. Columns are 1-indexed.
|
||||||
|
*/
|
||||||
bool Document::isColumnHidden(int column)
|
bool Document::isColumnHidden(int column)
|
||||||
{
|
{
|
||||||
if (Worksheet *sheet = currentWorksheet())
|
if (Worksheet *sheet = currentWorksheet())
|
||||||
@@ -639,19 +635,6 @@ bool Document::isColumnHidden(int column)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
Sets the properties of \a row with the given \a height, \a format and \a hidden.
|
|
||||||
\a row is 1-indexed.
|
|
||||||
|
|
||||||
Returns false if failed.
|
|
||||||
*/
|
|
||||||
bool Document::setRow(int row, double height, const Format &format, bool hidden)
|
|
||||||
{
|
|
||||||
if (Worksheet *sheet = currentWorksheet())
|
|
||||||
return sheet->setRow(row, row, height, format, hidden);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Sets the \a format of the row \a row.
|
Sets the \a format of the row \a row.
|
||||||
Rows are 1-indexed.
|
Rows are 1-indexed.
|
||||||
|
|||||||
+3
-12
@@ -66,16 +66,9 @@ public:
|
|||||||
bool unmergeCells(const CellRange &range);
|
bool unmergeCells(const CellRange &range);
|
||||||
bool unmergeCells(const QString &range);
|
bool unmergeCells(const QString &range);
|
||||||
|
|
||||||
Q_DECL_DEPRECATED
|
bool setColumnWidth(const CellRange &range, double width);
|
||||||
bool setColumn(int colFirst, int colLast, double width, const Format &format=Format(), bool hidden=false);
|
bool setColumnFormat(const CellRange &range, const Format &format);
|
||||||
Q_DECL_DEPRECATED
|
bool setColumnHidden(const CellRange &range, bool hidden);
|
||||||
bool setColumn(const QString &colFirst, const QString &colLast, double width, const Format &format=Format(), bool hidden=false);
|
|
||||||
bool setColumnWidth(const QString &column, double width);
|
|
||||||
bool setColumnFormat(const QString &column, const Format &format);
|
|
||||||
bool setColumnHidden(const QString &column, bool hidden);
|
|
||||||
bool setColumnWidth(const QString &colFirst, const QString &colLast, double width);
|
|
||||||
bool setColumnFormat(const QString &colFirst, const QString &colLast, const Format &format);
|
|
||||||
bool setColumnHidden(const QString &colFirst, const QString &colLast, bool hidden);
|
|
||||||
bool setColumnWidth(int column, double width);
|
bool setColumnWidth(int column, double width);
|
||||||
bool setColumnFormat(int column, const Format &format);
|
bool setColumnFormat(int column, const Format &format);
|
||||||
bool setColumnHidden(int column, bool hidden);
|
bool setColumnHidden(int column, bool hidden);
|
||||||
@@ -86,8 +79,6 @@ public:
|
|||||||
Format columnFormat(int column);
|
Format columnFormat(int column);
|
||||||
bool isColumnHidden(int column);
|
bool isColumnHidden(int column);
|
||||||
|
|
||||||
Q_DECL_DEPRECATED
|
|
||||||
bool setRow(int row, double height, const Format &format=Format(), bool hidden=false);
|
|
||||||
bool setRowHeight(int row, double height);
|
bool setRowHeight(int row, double height);
|
||||||
bool setRowFormat(int row, const Format &format);
|
bool setRowFormat(int row, const Format &format);
|
||||||
bool setRowHidden(int row, bool hidden);
|
bool setRowHidden(int row, bool hidden);
|
||||||
|
|||||||
+13
-58
@@ -1564,59 +1564,14 @@ QList<int> WorksheetPrivate ::getColumnIndexes(int colFirst, int colLast)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Sets column \a width and \a format for all columns from \a colFirst to \a colLast. Column
|
Sets width in characters of a range of columns.
|
||||||
width measured as the number of characters of the maximum digit width of the
|
|
||||||
numbers 0, 1, 2, ..., 9 as rendered in the normal style's font. If format
|
|
||||||
equals 0 then format is ignored. Both \a colFirst and \a colLast are all 1-indexed.
|
|
||||||
Hides the column if \a hidden is true.
|
|
||||||
|
|
||||||
Return true if success.
|
|
||||||
*/
|
|
||||||
bool Worksheet::setColumn(int colFirst, int colLast, double width, const Format &format, bool hidden)
|
|
||||||
{
|
|
||||||
Q_D(Worksheet);
|
|
||||||
|
|
||||||
QList <QSharedPointer<XlsxColumnInfo> > columnInfoList = d->getColumnInfoList(colFirst, colLast);
|
|
||||||
foreach(QSharedPointer<XlsxColumnInfo> columnInfo, columnInfoList) {
|
|
||||||
columnInfo->width = width;
|
|
||||||
columnInfo->format = format;
|
|
||||||
columnInfo->hidden = hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(columnInfoList.count() > 0) {
|
|
||||||
d->workbook->styles()->addXfFormat(format);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Sets column width and format for all columns from colFirst to colLast. Column
|
|
||||||
width measured as the number of characters of the maximum digit width of the
|
|
||||||
numbers 0, 1, 2, ..., 9 as rendered in the normal style's font. If format
|
|
||||||
equals 0 then format is ignored. \a colFirst and \a colLast should be "A", "B", "C", ...
|
|
||||||
*/
|
|
||||||
bool Worksheet::setColumn(const QString &colFirst, const QString &colLast, double width, const Format &format, bool hidden)
|
|
||||||
{
|
|
||||||
int col1 = xl_col_name_to_value(colFirst);
|
|
||||||
int col2 = xl_col_name_to_value(colLast);
|
|
||||||
|
|
||||||
if (col1 == -1 || col2 == -1)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return setColumn(col1, col2, width, format, hidden);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Sets width in characters of a range of columns. Columns can be specified as "A", "B" ... "Z".
|
|
||||||
Returns true on success.
|
Returns true on success.
|
||||||
*/
|
*/
|
||||||
bool Worksheet::setColumnWidth(const QString &colFirst, const QString &colLast, double width)
|
bool Worksheet::setColumnWidth(const CellRange &range, double width)
|
||||||
{
|
{
|
||||||
int col1 = xl_col_name_to_value(colFirst);
|
int col1 = range.firstColumn();
|
||||||
int col2 = xl_col_name_to_value(colLast);
|
int col2 = range.lastColumn();
|
||||||
if (col1 == -1 || col2 == -1)
|
if (col1 < 0|| col2 < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return setColumnWidth(col1, col2, width);
|
return setColumnWidth(col1, col2, width);
|
||||||
@@ -1626,11 +1581,11 @@ bool Worksheet::setColumnWidth(const QString &colFirst, const QString &colLast,
|
|||||||
Sets format property of a range of columns. Columns are 1-indexed.
|
Sets format property of a range of columns. Columns are 1-indexed.
|
||||||
Returns true on success.
|
Returns true on success.
|
||||||
*/
|
*/
|
||||||
bool Worksheet::setColumnFormat(const QString &colFirst, const QString &colLast, const Format &format)
|
bool Worksheet::setColumnFormat(const CellRange& range, const Format &format)
|
||||||
{
|
{
|
||||||
int col1 = xl_col_name_to_value(colFirst);
|
int col1 = range.firstColumn();
|
||||||
int col2 = xl_col_name_to_value(colLast);
|
int col2 = range.lastColumn();
|
||||||
if (col1 == -1 || col2 == -1)
|
if (col1 < 0|| col2 < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return setColumnFormat(col1, col2, format);
|
return setColumnFormat(col1, col2, format);
|
||||||
@@ -1641,11 +1596,11 @@ bool Worksheet::setColumnFormat(const QString &colFirst, const QString &colLast,
|
|||||||
Hidden columns are not visible.
|
Hidden columns are not visible.
|
||||||
Returns true on success.
|
Returns true on success.
|
||||||
*/
|
*/
|
||||||
bool Worksheet::setColumnHidden(const QString &colFirst, const QString &colLast, bool hidden)
|
bool Worksheet::setColumnHidden(const CellRange &range, bool hidden)
|
||||||
{
|
{
|
||||||
int col1 = xl_col_name_to_value(colFirst);
|
int col1 = range.firstColumn();
|
||||||
int col2 = xl_col_name_to_value(colLast);
|
int col2 = range.lastColumn();
|
||||||
if (col1 == -1 || col2 == -1)
|
if (col1 < 0|| col2 < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return setColumnHidden(col1, col2, hidden);
|
return setColumnHidden(col1, col2, hidden);
|
||||||
|
|||||||
@@ -101,13 +101,9 @@ public:
|
|||||||
bool unmergeCells(const CellRange &range);
|
bool unmergeCells(const CellRange &range);
|
||||||
QList<CellRange> mergedCells() const;
|
QList<CellRange> mergedCells() const;
|
||||||
|
|
||||||
Q_DECL_DEPRECATED
|
bool setColumnWidth(const CellRange& range, double width);
|
||||||
bool setColumn(int colFirst, int colLast, double width, const Format &format=Format(), bool hidden=false);
|
bool setColumnFormat(const CellRange& range, const Format &format);
|
||||||
Q_DECL_DEPRECATED
|
bool setColumnHidden(const CellRange& range, bool hidden);
|
||||||
bool setColumn(const QString &colFirst, const QString &colLast, double width, const Format &format=Format(), bool hidden=false);
|
|
||||||
bool setColumnWidth(const QString &colFirst, const QString &colLast, double width);
|
|
||||||
bool setColumnFormat(const QString &colFirst, const QString &colLast, const Format &format);
|
|
||||||
bool setColumnHidden(const QString &colFirst, const QString &colLast, bool hidden);
|
|
||||||
bool setColumnWidth(int colFirst, int colLast, double width);
|
bool setColumnWidth(int colFirst, int colLast, double width);
|
||||||
bool setColumnFormat(int colFirst, int colLast, const Format &format);
|
bool setColumnFormat(int colFirst, int colLast, const Format &format);
|
||||||
bool setColumnHidden(int colFirst, int colLast, bool hidden);
|
bool setColumnHidden(int colFirst, int colLast, bool hidden);
|
||||||
|
|||||||
Reference in New Issue
Block a user