From 04e76eef319c9948d7e6da833bc807210e4a1193 Mon Sep 17 00:00:00 2001 From: Xavier Perseguers Date: Thu, 29 Aug 2024 23:28:47 +0200 Subject: [PATCH] [BUGFIX] Add version check for ColWidthPx and RowHeightPx Resolves: #27 --- docs/ExcelSheet.php | 6 ++++-- excel.c | 10 ++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/docs/ExcelSheet.php b/docs/ExcelSheet.php index 4aaf539..d7e3905 100644 --- a/docs/ExcelSheet.php +++ b/docs/ExcelSheet.php @@ -397,7 +397,7 @@ public function colWidth($column) } // colWidth /** - * Returns the cell width + * Returns the cell width in pixels * * @see ExcelSheet::rowHeight() * @see ExcelSheet::colWidth() @@ -405,6 +405,7 @@ public function colWidth($column) * @see ExcelSheet::setRowHeight() * @param int $column 0-based column number * @return float + * @since libXL 3.8.6.0 */ public function colWidthPx($column) { @@ -1106,7 +1107,7 @@ public function rowHeight($row) } // rowHeight /** - * Returns the row height + * Returns the row height in pixels * * @see ExcelSheet::colWidth() * @see ExcelSheet::colWidthPx() @@ -1114,6 +1115,7 @@ public function rowHeight($row) * @see ExcelSheet::setRowHeight() * @param int $row 0-based row number * @return float + * @since libXL 3.8.6.0 */ public function rowHeightPx($row) { diff --git a/excel.c b/excel.c index e13f473..34d0d41 100644 --- a/excel.c +++ b/excel.c @@ -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) @@ -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 */ @@ -6035,6 +6037,7 @@ 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() @@ -6042,6 +6045,7 @@ 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) @@ -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) @@ -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} };