/** * This function opens a new table using the style as set in the assoziative array $properties. * The parameters in the array should be named as the CSS property names e.g. 'width'. * * The currently supported properties are: * width, border-collapse, background-color * * The table must be closed by calling 'table_close'. * * @author LarsDW223 * * @param array $properties * @param null $maxcols * @param null $numrows */ function _odtTableOpenUseProperties($properties, $maxcols = NULL, $numrows = NULL) { $this->p_close(); // Create style. $style_obj = $this->factory->createTableTableStyle($properties, NULL, $this->_getAbsWidthMindMargins(100)); $this->docHandler->addAutomaticStyle($style_obj); $style_name = $style_obj->getProperty('style-name'); // Open the table referencing our style. $this->doc .= '<table:table table:style-name="' . $style_name . '">'; $this->state->enter('table', 'table'); if (empty($properties['width'])) { // If the caller did not specify a table width, save the style name // to eventually later replace the table width set in createTableTableStyle() // with the sum of all column width (in _odtTableClose). $this->state->setTableStyle($style_name); } // Create columns with predefined and temporarily remembered style names. if (empty($maxcols)) { // Try to automatically detect the number of columns. $this->state->setTableAutoColumns(true); $this->doc .= '<ColumnsPlaceholder>'; } else { $this->state->setTableAutoColumns(false); $table_column_styles = $this->state->getTableColumnStyles(); for ($column = 0; $column < $maxcols; $column++) { $this->style_count++; $style_name = 'odt_auto_style_table_column_' . $this->style_count; $table_column_styles[$column] = $style_name; $this->doc .= '<table:table-column table:style-name="' . $style_name . '"/>'; } } // We start with the first column $this->state->setTableCurrentColumn(0); }
/** * This function opens a new table using the style as set in the assoziative array $properties. * The parameters in the array should be named as the CSS property names e.g. 'width'. * * The currently supported properties are: * width, border-collapse, background-color * * The table must be closed by calling 'table_close'. * * @author LarsDW223 * * @param array $properties * @param null $maxcols * @param null $numrows */ function _odtTableOpenUseProperties($properties, $maxcols = NULL, $numrows = NULL) { unset($this->temp_content); // We are starting a new table header declaration. // The flag will be set to false on opening the first table cell of the body. $this->temp_in_header = true; // Create style. $style_obj = $this->factory->createTableTableStyle($properties, NULL, $this->_getAbsWidthMindMargins(100)); $this->docHandler->addAutomaticStyle($style_obj); $style_name = $style_obj->getProperty('style-name'); if (empty($properties['width'])) { // If the caller did not specify a table width, save the style name // to eventually later replace the table width set in createTableTableStyle() // with the sum of all column width (in _odtTableClose). $this->temp_table_style = $style_name; } // Open the table referencing our style. $this->doc .= '<table:table table:style-name="' . $style_name . '">'; // Delete any old values in the temporary column styles array. for ($column = 0; $column < count($this->temp_table_column_styles); $column++) { unset($this->temp_table_column_styles[$column]); } // Create columns with predefined and temporarily remembered style names. if (empty($maxcols)) { // Try to automatically detect the number of columns. $this->temp_autocols = true; $this->doc .= '<ColumnsPlaceholder>'; unset($this->temp_cols); } else { $this->temp_autocols = false; for ($column = 0; $column < $maxcols; $column++) { $this->style_count++; $style_name = 'odt_auto_style_table_column_' . $this->style_count; $this->temp_table_column_styles[$column] = $style_name; $this->doc .= '<table:table-column table:style-name="' . $style_name . '"/>'; } } // Reset temporary column counter $this->temp_column = 0; $this->temp_maxcols = 0; }