Skip to content

Commit

Permalink
[BUGFIX] Add version check for ColWidthPx and RowHeightPx
Browse files Browse the repository at this point in the history
Resolves: doPhp#27
  • Loading branch information
xperseguers committed Aug 29, 2024
1 parent e218ad4 commit 04e76ee
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
6 changes: 4 additions & 2 deletions docs/ExcelSheet.php
Original file line number Diff line number Diff line change
Expand Up @@ -397,14 +397,15 @@ public function colWidth($column)
} // colWidth

/**
* Returns the cell width
* Returns the cell width in pixels
*
* @see ExcelSheet::rowHeight()
* @see ExcelSheet::colWidth()
* @see ExcelSheet::setColWidth()
* @see ExcelSheet::setRowHeight()
* @param int $column 0-based column number
* @return float
* @since libXL 3.8.6.0
*/
public function colWidthPx($column)
{
Expand Down Expand Up @@ -1106,14 +1107,15 @@ public function rowHeight($row)
} // rowHeight

/**
* Returns the row height
* Returns the row height in pixels
*
* @see ExcelSheet::colWidth()
* @see ExcelSheet::colWidthPx()
* @see ExcelSheet::setColWidth()
* @see ExcelSheet::setRowHeight()
* @param int $row 0-based row number
* @return float
* @since libXL 3.8.6.0
*/
public function rowHeightPx($row)
{
Expand Down
10 changes: 8 additions & 2 deletions excel.c
Original file line number Diff line number Diff line change
Expand Up @@ -2849,6 +2849,7 @@ EXCEL_METHOD(Sheet, rowHeight)
}
/* }}} */

#if LIBXL_VERSION >= 0x03080600
/* {{{ proto double ExcelSheet::colWidthPx(int column)
Returns the cell width pixels */
EXCEL_METHOD(Sheet, colWidthPx)
Expand All @@ -2864,6 +2865,7 @@ EXCEL_METHOD(Sheet, rowHeightPx)
PHP_EXCEL_SHEET_GET_DOUBLE_STATE(RowHeightPx)
}
/* }}} */
#endif

/* {{{ proto string ExcelSheet::readComment(int row, int column)
Read comment from a cell */
Expand Down Expand Up @@ -6035,13 +6037,15 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_Sheet_rowHeight, 0, 0, 1)
ZEND_ARG_INFO(0, row)
ZEND_END_ARG_INFO()

#if LIBXL_VERSION >= 0x03080600
ZEND_BEGIN_ARG_INFO_EX(arginfo_Sheet_colWidthPx, 0, 0, 1)
ZEND_ARG_INFO(0, column)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX(arginfo_Sheet_rowHeightPx, 0, 0, 1)
ZEND_ARG_INFO(0, row)
ZEND_END_ARG_INFO()
#endif

ZEND_BEGIN_ARG_INFO_EX(arginfo_Sheet_readComment, 0, 0, 2)
ZEND_ARG_INFO(0, row)
Expand Down Expand Up @@ -6742,8 +6746,6 @@ zend_function_entry excel_funcs_sheet[] = {
EXCEL_ME(Sheet, removeCol, arginfo_Sheet_removeCol, 0)
EXCEL_ME(Sheet, colWidth, arginfo_Sheet_colWidth, 0)
EXCEL_ME(Sheet, rowHeight, arginfo_Sheet_rowHeight, 0)
EXCEL_ME(Sheet, colWidthPx, arginfo_Sheet_colWidthPx, 0)
EXCEL_ME(Sheet, rowHeightPx, arginfo_Sheet_rowHeightPx, 0)
EXCEL_ME(Sheet, readComment, arginfo_Sheet_readComment, 0)
EXCEL_ME(Sheet, writeComment, arginfo_Sheet_writeComment, 0)
EXCEL_ME(Sheet, setColWidth, arginfo_Sheet_setColWidth, 0)
Expand Down Expand Up @@ -6863,6 +6865,10 @@ zend_function_entry excel_funcs_sheet[] = {
EXCEL_ME(Sheet, addDataValidation, arginfo_Sheet_addDataValidation, 0)
EXCEL_ME(Sheet, addDataValidationDouble, arginfo_Sheet_addDataValidationDouble, 0)
EXCEL_ME(Sheet, removeDataValidations, arginfo_Sheet_removeDataValidations, 0)
#endif
#if LIBXL_VERSION >= 0x03080600
EXCEL_ME(Sheet, colWidthPx, arginfo_Sheet_colWidthPx, 0)
EXCEL_ME(Sheet, rowHeightPx, arginfo_Sheet_rowHeightPx, 0)
#endif
{NULL, NULL, NULL}
};
Expand Down

0 comments on commit 04e76ee

Please sign in to comment.