1 (edited by moylua 04/09/2015 08:24:53 am)

Topic: Bug in Excel Reports

Hello, i experienced bug when generating excel reports.

My Server:
CENTOS 6.5
mysql 5.1
php 5.3
Nginx 1.6
Php-fpm


http://i57.tinypic.com/2vk00nr.jpg

2 (edited by apmuthu 04/09/2015 02:16:22 pm)

Re: Bug in Excel Reports

What language and fonts are you using and are they enabled in your CentOS?
Is it a browser mangling issue?

Try making the demo company print standard reports first before troubleshooting other issues.

Attached your Screenshot here.

It looks like you are using Arial font. See if your CentOS has that installed.

Post's attachments

2vk00nr.jpg 13.6 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.

Re: Bug in Excel Reports

The attached file is what you should get for the Chart of Accounts for the demo data in en_US-demo.sql CoA.

Post's attachments

ChartOfAccounts.xls 9 kb, 2 downloads since 2015-04-09 

You don't have the permssions to download the attachments of this post.

Re: Bug in Excel Reports

update:

I am using windows in my development machine. The Centos in production. I have noticed in CentOS that when viewing the raw output using notepad++. The excel file has one blank row on top. Removing that would make the excel work.

http://i61.tinypic.com/bg9qe.png

5 (edited by apmuthu 04/10/2015 06:40:08 am)

Re: Bug in Excel Reports

Try to save the file from the URL in centos using wget and see if the blank line appears.

Also examine the file in a hex editor to see if it is a CRLF or just LF - (0D 0A or just 0A).

Then we can programattically remove it if it exists as the first character(s).

Attaching your screenshot for the forum.

Post's attachments

bg9qe.jpg 28.7 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.

6 (edited by moylua 04/10/2015 06:58:46 am)

Re: Bug in Excel Reports

LF "0A" exists as first character. Removing the first line removes the 0A. I think is not a browser issue

Re: Bug in Excel Reports

Please verify that the same result occurs when a different browser is used. Thanks for your patience in providing valuable feedback.

Re: Bug in Excel Reports

tried with chrome and firefox. still the same.

i would like to know the use of this function. since it has a Line Feed code "0x000A"

function _storeEof()
    {
        $record    = 0x000A;   // Record identifier
        $length    = 0x0000;   // Number of bytes to follow
        $header    = pack("vv", $record, $length);
        $this->_append($header);
    }

Re: Bug in Excel Reports

The file reporting/includes/Workbook.php has the functions to write the Excel file and the said function is part of it that helps store the End of File characters (Eof) for the header in a hexadecimal byte packed manner. It is possible that some PHP versions on some platforms may be putting out blank headers and only these separators get to the top.

BIFF means BInary File Format. There are many types of BIFF records.  Each has a 4 byte header.  The first two bytes are an opcode that specifies the record type.  The second two bytes specify record length.  Header values are stored in byte-reversed form (less significant byte first).  The rest of the record is the data itself

Other places where this is used so is at:
Line 195: http://voltampmedia.com/PHPExcel/html/_b_i_f_fwriter_8php_source.html
Line 195: http://phpcrossref.com/xref/moodle/lib/phpexcel/PHPExcel/Writer/Excel5/BIFFwriter.php.html#_storeeof

The Microsoft Excel Format is documented at:
https://www.openoffice.org/sc/excelfileformat.pdf
Excel97-2007 Binary File Format *.xls Specification.pdf
http://www.opennet.ru/docs/formats/xls.txt

Re: Bug in Excel Reports

I have just checked the generated file in the company folder and it was good. I tried removing the line

include_once($path_to_root . "/includes/session.inc");

from the prn_redirect.php file. The new line disappeared. Not sure if not including session.inc would cause some problems.

according to some stackoverflow answers, if you declare php closing tags ?> there might be newline inserts

Re: Bug in Excel Reports

The php closing tag issue generally comes up on PHP 5.4 onwards.
The include_once should have no effect and is needed to enforce authority to download only if logged in.
If the generated file is good, then the browser transfer may be the issue. Check the apache error logs for any clues.