Gradebook

 
 
Picture of Fred Senese
Problem with Excel Export in 1.6.1+
 
We've recently upgraded to Moodle 1.6.1+. When we hit "Download in Excel Format" in the gradebook now, we just get the grades- no student names, no column headings.

If we hit "Download in Text Format" and then save that as an .xls file, then everything works as it did in 1.6...

Is this a bug?
Picture of Mark Schumann
Re: Problem with Excel Export in 1.6.1+
 
I'm getting the same problem.
Picture of Greg Francom
Re: Problem with Excel Export in 1.6.1+
 
I have a similar problem in 1.6.1+.  Excel will not open any files that are downloaded from any gradebook in our site.  When I open them in openoffice there are many errors in many cells that say *** ERROR IN SST *** I can't find any other references to this problem.  there is no error in moodle itself, just in the excel file that downloads.
Picture of Joan Codina Filba
Re: Problem with Excel Export in 1.6.1+
 
here is a patch to export to open document format. The code is a project from some students and is not very much structured, as they should have done a class with similar functions as the excel export class.
The open document format is an open format, and it avoids the problem of exporting to excel where some data appears as text and gives problems when using them in formulas
This is what they did...
Picture of Greg Francom
Re: Problem with Excel Export in 1.6.1+
 
I like the idea of exporting to open document format.  Are there any installation instructions that I could use to try this out on a test installation of moodle?
Picture of Andrei Barhatov
Re: Problem with Excel Export in 1.6.1+
 

The same problem: empty names & headers in Excel.

Before I also had encountered problem with entirely empty xls-file (filesize=0). But I fix it by adding to /grade/lib.php line:

  $workbook->pear_excel_workbook->setTempDir($CFG->dataroot."/temp");

after line:

        $workbook = new MoodleExcelWorkbook("-");

Now xls is not empty, but there are no students & headers in file, only numbers/grades.

Picture of Paulo Matos
Re: Problem with Excel Export in 1.6.1+
 
Hi Andrei!

You (and devels) should fix this at lib/excellib.class.php, adding this 2 lines of code to class constructor:

 
    function MoodleExcelWorkbook($filename) {
        global $CFG;
    /// Internally, create one PEAR Spreadsheet_Excel_Writer_Workbook class
        $this->pear_excel_workbook = new Spreadsheet_Excel_Writer($filename);
    /// Prepare it to accept UTF-16LE data and to encode it properly
        $this->pear_excel_workbook->setVersion(8);
    //paulo.matos: set appropriate temp dir
        $this->pear_excel_workbook->setTempDir($CFG->dataroot."/temp");
    }

 


this way you won't have to change it elsewhere.

I created an entry on tracker with this issue, see MDL-7176.

Regards,

Paulo Matos
Picture of Andrei Barhatov
Re: Problem with Excel Export in 1.6.1+
 

I've solved this problem in my server. Cause of problem: function iconv() doesn't work, although iconv module is switched on.

Such test.php:

<?php
 ini_set("display_errors","on");
 echo iconv("ISO-8859-1", "UTF-8", "This is a test.");
 phpinfo();
?>

output:

Notice: iconv() [function.iconv]: Wrong charset, cannot convert from `ISO-8859-1' to `UTF-8' ...

On my server mbstring seems work fine, so I simple at lib/textlib.class.php change line:

if (extension_loaded('iconv')) {

to

if (extension_loaded('iconv')&&0) { //!!!!

And "excel download" function now works.

Picture of Fred Senese
Re: Problem with Excel Export in 1.6.1+
 
Andrei,

Thanks. I tried this, but it doesn't seem to work for me. The Excel file still doesn't have any student names or column headings, only the raw grades.
Picture of Peter Petač
Re: Problem with Excel Export in 1.6.1+
 
Try this fix (replace contents of file "/grades/lib.php" on your server - be sure to make backup first). It worked out for me perfectly. Good luck.
Picture of Fred Senese
Re: Problem with Excel Export in 1.6.1+
 
Hurray! It worked. Thank you Peter!!
Picture of Michael McDermott
Re: Problem with Excel Export in 1.6.1+
 

I have a similar problem. I have one course that has 80 users and 15 assignments. So far grades have been entered for 2 assignments. 

There are no problems with the export with 60 students, but over sixty I get corrupt data and a warning from excel, when I try to download to excel.

I am worried that the problem is going to come with less students every time a new assignment is added.

Text downloads don't work at all.

Mike McDermott

Picture of Paul Nijbakker
Re: Problem with Excel Export in 1.6.1+
Group Particularly helpful Moodlers
Hi all,

We get the same problem as Fred, but in our version of Moodle 1.6.3. None of the suggested solutions in this thread works. What to do?

Rgrds,
Paul.
Picture of Peter Sereinigg
Re: Problem with Excel Export in 1.6.1+
 

try to do the export in a textformat and copy this into the exdelsheet. this shout work. the problem is known, but its an excel lib problem. no idea, when this will be solved...

peter

Picture of Jean-Michel Védrine
Re: Problem with Excel Export in 1.6.1+
Group DevelopersGroup Particularly helpful Moodlers
Hello,
The excellib problem is now fixed in CVS for the 1.8 branch.
Unfortunately it is not currently backported to the 1.6 and 1.7 branchs !
As it is only a few lines change in lib/excellib.class.php it would be very easy to do so.
I have done it for Moodle 1.7 and I am joining it to this post.
Doing a compare with the 1.6x version should not be too difficult.
For it to work you will also need to add the line :
$CFG->excelisofiles = true;
to your root config.php file.
Please note that it works by coding Excel file using utf-8 rather than utf-16 so due to excel limitations, strings in cells are limited to 255 chars.
Also very interesting in Moodle 1.8 is the export to OpenDocument format. As I needed it I have also backported this one to 1.7 for all quiz reports (but not gradebook currently). Contact me if you are interested.

Picture of Jean-Michel Védrine
Re: Problem with Excel Export in 1.6.1+
Group DevelopersGroup Particularly helpful Moodlers
Well,
In fact I realized after my previous post that it would be good to have ods export of grades for the end of the semester so i did it for Moodle 1.7. And here it is.
There are 2 files to replace in grade/ and a new file in lib/ folders.
You must also define somewhere the new 'downloadods' string in your lang files but I dont remember where I put it when i did the ods quiz reports export (at the same place the 'downloadexcel' and 'downloadtext' strings are defined I think !).
Some work would be needed to backport this to Moodle 1.6 because of all the stuff introduced in 1.7 for roles.
Picture of Jean-Michel Védrine
Re: Problem with Excel Export in 1.6.1+
Group DevelopersGroup Particularly helpful Moodlers
Well, nobody asked for it but here is a version of my backport for Moodle 1.6.x branch
It will
  1. - correct the Excel export problem
  2. add an export to OpenDocument (.ods) button
For the Excel export fix to work, you need to add a line :
$CFG->excelisofiles = true;

to your root config.php file.
Please note that it works by coding Excel file using iso_88591 rather than utf-16le so it is of no use for Moodle sites using charset other than iso_88591 and due to excel limitations, strings in cells are limited to 255 chars.

For the ods export button to look good, you need to add a line
$string['downloadods'] ='Download in ODS format';
to your lang moodle.php file
Please note that these files are for Moodle 1.6.x only. If you use Moodle 1.7.x see my other zip file in the same discussion
egg gamer
Re: Problem with Excel Export in 1.6.1+
 
Great Work Jean !!.

It worked perfectly in 1.6.1+ on W2K-SP2.

Thank a lot

Eduardo
One poor developer...
Re: Problem with Excel Export in 1.6.1+
Group DevelopersGroup Documentation writersGroup Moodle HQGroup Particularly helpful MoodlersGroup Testers
Hi,

the Excel generation library with support to generate latin files have been backported to Moodle 1.6 and 1.7.

For correctness, now the $CFG->excelisofiles setting have been deprecated (will work until Moodle 1.9) in favour of $CFG->latinexcelexport. So it's highly recommended to change it asap.

More info at: http://tracker.moodle.org/browse/MDL-7993

Ciao smile
Picture of Paul Nijbakker
Re: Problem with Excel Export in 1.6.1+
Group Particularly helpful Moodlers
Hi Eloy,

The correction is announced for versions 1.8, 1.7.2 and 1.6.5 in the tracker, but version 1.6.5 has not been released (yet). Is the correction perhaps part of 1.6.4+ instead?

Rgrds,
Paul.
Picture of Paul Nijbakker
Re: Problem with Excel Export in 1.6.1+
Group Particularly helpful Moodlers

Never mind, I tried it out, it has not been repaired in 1.6.4+, so I'll be patient until 1.6.5 is released.

Rgrds,
Paul.

Picture of Paul Nijbakker
Re: Problem with Excel Export in 1.6.1+
Group Particularly helpful Moodlers

Hi,

I downloaded and installed 1.6.5 as soon as it was released, but unfortunately, the Excel export still does not work (and I had such high hopes).sadmixedsaddead

Rgrds,
Paul.

Picture of Paul Nijbakker
Re: Problem with Excel Export in 1.6.1+
Group Particularly helpful Moodlers
Maybe it's me, so I attached an exported Excel file, in case someone can make something out of it.

Rgrds,
Paul.
One poor developer...
Re: Problem with Excel Export in 1.6.1+
Group DevelopersGroup Documentation writersGroup Moodle HQGroup Particularly helpful MoodlersGroup Testers
Hi Paul,

sorry by the delay, I just saw this message because of another message posted below by Rodney today.

This is just to confirm you that the patch was applied for 1.6.4+ when I originally posted my message. So it's included in 1.6.5.

Just to be sure, did you set: $CFG->latinexcelexport = true; in your config.php? It's the flag that transforms excel output to a safer format (if not set, the original, less stable, format is used).

People running 1.8, be noted that this setting should be handled from the admin menu instead of manual editing of config.php

Looking your Excel file to see if I find something meaningful...

Ciao smile
Picture of Paul Nijbakker
Re: Problem with Excel Export in 1.6.1+
Group Particularly helpful Moodlers

Hello Eloy,

I did not have that line in config.php (I assumed it would be part of the 1.6.5 upgrade). Unfortunately, even with that line in place the Excel export is not successful. I have attached the result.

Rgrds,
Paul.

Picture of Ger Tielemans
Also ane excel problem
 

I had a working excel dump under 165, when suddenly... it no longer pops-up but creates this inline. (I was not working on the grades on that moment...

Any idea where to look?


Picture of Richard Burton
Re: Also ane excel problem
 
Hi Ger

Did you manage to solve this one as I have the same problem?

Thanks

Richard
Picture of Richard Burton
Re: Also ane excel problem
 
Hi Ger

I have worked out why this was happening with my install. It appears the lang file (lang/en_utf8/webquest.php) for the webquest module was breaking the setting of the mime type so the browser was believing the data was html.

Instead of replacing the existing webquest.php file in the lang folder with the one supplied by the module I have added the extra entries to the existing page.

Richard
Picture of Jonathan Lewis
Re: Also ane excel problem
 
Well, I'm still having the same problem. I deleted the webquest lang file, but still no joy.

I can't see how a lang file would interfere with mime types, anyway - not that I understand php too well! Any other suggestions? The export works fine elsewhere - e.g. in Quiz, Choice - but is fouled up in Gradebook.
Verdon
Re: Problem with Excel Export in 1.6.1+
 
> People running 1.8, be noted that this setting should be handled from the admin menu instead of manual editing of config.php

$CFG->latinexcelexport = true

Whereabouts in the admin might I find that?
Picture of Richard Ackland
Re: Problem with Excel Export in 1.6.1+
 
Just found it in Langauge -> Language Settings
Picture of Ramón Trigo
Re: Problem with Excel Export in 1.6.1+
 
Hi Jean, a great work! my moodle works again. Thanks for the support.
Picture of Paul Nijbakker
Re: Problem with Excel Export in 1.6.1+
Group Particularly helpful Moodlers
Thanks Peter,

Yes, I did that and it works (except that grades with decimals are turned into dates by Excel, but we can overcome that.

I hope this bug will be fixed soon and included in 1.6.3+ along with some of the other numerous issues we have with 1.6.3.

Rgrds,
Paul.
Picture of Rodney Spaulding
Re: Problem with Excel Export in 1.6.1+ and 1.8+
 

From Bug Tracker:

[

Tim Hunt commented on MDL-9156:

-------------------------------

This is a known issue,

It is a general problem with all excel downloads in Moodle, not just the quiz ones, and it is to do with character set issues. I suggest you add your suggestion to that thread, to help the other people who are working on this.

> Quiz Results Download to Excel creates excel file with errors

> -------------------------------------------------------------

>

> Key: MDL-9156
> URL:

Prior to upgrade to 1.8.+ about 14 hours ago, the download to excel in
my quiz worked fine, now it downloads a file that when opened with
excel, excel reports an error. (Damage to the file was so extensive
that repairs were not possible. Excel attempted to recover your
formulas and values, but some data may have been lost or corrupted.)

Seems still a problem in 1.8+

http://tracker.moodle.org/browse/MDL-9156?page=comments#action_28832 ] http://moodle.org/mod/forum/discuss.php?d=53302, and as you can see, it has been going on for some time.http://tracker.moodle.org/browse/MDL-9156
> Project: Moodle
> Issue Type: Bug
> Components: Quiz
> Affects Versions: 1.8
> Environment: Linux based host