Plugin Directory

Changeset 3228381


Ignore:
Timestamp:
01/25/2025 09:56:26 AM (14 months ago)
Author:
wibergsweb
Message:

Bugfix headers and using column by names with Excel-files

Location:
csv-to-html
Files:
890 added
2 edited

Legend:

Unmodified
Added
Removed
  • csv-to-html/trunk/csvtohtml.php

    r3227745 r3228381  
    44Plugin URI: http://www.wibergsweb.se/plugins/csvtohtml
    55Description:Display/edit/synchronize csv-file(s) dynamically into a html-table
    6 Version: 3.33
     6Version: 3.34
    77Author: Wibergs Web
    88Author URI: http://www.wibergsweb.se/
     
    3434    private $filter_operators;                      //Used for is_row_applicable and multfilters
    3535    private $allowed_html;
     36    private $use_zero_basedindex = true;            //This is need together with PHPSpreadsheet because it uses 1-based-index instead of normally 0-based index
    3637
    3738    /**
     
    22272228     *  This function is a helper function for including or excluding columns in the final html table
    22282229     *
    2229      *  @param  string $what_columns             What columns it is about (1,2,3,7-12)
    2230      *  @return array                                        What columns to use
     2230     *  @param  string  $what_columns             What columns it is about (1,2,3,7-12)
     2231     *  @return array                             
    22312232     *                 
    22322233     */       
     
    22682269
    22692270        //Which columns to use?
    2270         $use_cols = array();
     2271        $use_cols = [];
    22712272        foreach ( $ex_cols as $c )
    22722273        {
    2273             $use_cols[] = (int)($c - 1);
    2274         }
    2275                    
     2274            $use_cols[] = $this->use_zero_basedindex ? (int)($c - 1) : (int)$c;
     2275        }
     2276
    22762277        return $use_cols;
    22772278    }
     
    35613562                        //This is an Excel-file, convert it to csv before moving on
    35623563                        if ( stristr( $file, '.xlsx' ) !== false )
    3563                         {                           
     3564                        {         
     3565                            //When false, it uses 1-based index as PHPSpreedsheet wants
     3566                            //This is important to keep track of columns (hiding, including etc)
     3567                            $this->use_zero_basedindex = false;                                                         
    35643568                            $file = $this->convert_from_excel( $file, $selected_sheets );
    35653569                        }
     
    36643668        //Fetch content and make it "viewable" into a table       
    36653669        $values_from_obj = $obj->fetch_content( $content_arr, $headerrows_start, $cutarr_fromend );
    3666 
     3670        $header_values = $values_from_obj['header_values'];
    36673671        $this->header_values = array_slice( $header_values, 0 );
    36683672        $original_headervalues = array_slice( $header_values,0 );     //Used for setting correct column for user sorting when rendering table
     
    49894993                    else
    49904994                    {
     4995                        if ( empty( $tablecell_hidecolumn_class[$m_colkey]) )
     4996                        {
     4997                            $tablecell_hidecolumn_class[$m_colkey] = '';
     4998                        }
    49914999                        $html .= '<'. $tdh . ' data-editable="' . $editable . '" class="' . $tablecell_hidecolumn_class[$m_colkey] . 'td colset colset-' . $nr_col . '">';
    49925000                    }
  • csv-to-html/trunk/readme.txt

    r3227745 r3228381  
    66Requires at least: 3.0.1
    77Tested up to: 6.7
    8 Stable Tag: 3.33
     8Stable Tag: 3.34
    99License: GPLv2
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    140140
    141141== Changelog ==
     142= 3.34 = (2025-01-25)
     143Bugfix headers not showing
     144Bugfix include columns by name when fetching Excel-files
     145
    142146= 3.33 = (2025-01-23)
    143147Bugfix Reading xlsx-files
Note: See TracChangeset for help on using the changeset viewer.