XLS Import and encoding

Any critical bugs will be fixed within 24-48 hours.
Also qdPM is in active development so any other issues will be fixed in next versions

XLS Import and encoding

Postby Theck » Wed Aug 03, 2016 2:06 pm

Last week I installed the last version of QDPM and I was trying to create something like a template for our projects because all they share very similar tasks, phases, times, etc.

The process I followed was to export the tasks of a template project as CSV and import to the real project. First of all it's curious that you export in CSV but import in XLS ;)

Then, I've converted the CSV to XLS using LibreOffice. That file appears as UTF-16, parsed and saved as XLS, no options changed on the LibreOffice parser. Next I went to my installation of QDPM and tried to import it, resulting in a mess due to the file encoding (I'm from Spain and some tasks, user names and other fields use accent marks). Also, the values of number cells appeared as the literal "General".

After some days trying to convert differently the CSV to XLS I gave up and I've modified the core to make it work. I modified /core/lib/excel_reader.php, method val(), next is the new code:
Code: Select all
function val($row,$col,$sheet=0) {
      $col = $this->getCol($col);
      if (array_key_exists($row,$this->sheets[$sheet]['cells']) && array_key_exists($col,$this->sheets[$sheet]['cells'][$row])) {
                        $val = $this->sheets[$sheet]['cells'][$row][$col];
                        $val = utf8_encode($val);
         return $val;
      return "";

As you can see, only added an ut8_encode call, but it worked. Also, I've formatted the excel number cells as 2 decimal number and it works well.
Posts: 1
Joined: Wed Aug 03, 2016 1:57 pm

Return to Bug Report

Who is online

Users browsing this forum: No registered users and 3 guests