Export to excel and pdf does not work in my script in version 2.2

QuestionsExport to excel and pdf does not work in my script in version 2.2
Francisco José Segura Noya asked 2 years ago

Hi, Abud,

I try for hours that my grid is exported to excel.

It has always worked, but in Phpgrid version 2.2, the xlsx file can not be read by Excel.

The same goes for exporting to PDF. It says: "TCPDF ERROR: Some data has already been output, can not send PDF file"

In the demos it works.

Here is my script:

https://pastebin.com/9k3gFA66

Thank you

4 Answers
Abu Ghufran answered 2 years ago

Please check in your code OR included files code, there must be some white space character (newline etc) or html code rendered before $g->render() function call.

If there are no html or white spaces, there could be BOM character issue as well which need to be removed:
https://stackoverflow.com/questions/32986445/remove-a-bom-character-in-a-file

The error "TCPDF ERROR: Some data has already been output, can not send PDF file" tells exactly that.

Francisco Javier Jiménez answered 2 years ago

Hi, Abud,

In my script, if I use the "jqgrid_dist.php" file of the 2.1 version of phpgrid, the exported file is xls and Excel normally opens it.

In that same script, if I use the "jqgrid_dist.php" file of the 2.2 version of phpgrid, the exported file is xlsx and Excel does not recognize it as a valid file and displays an error.

The Excel program I use is Microsoft Office Professional Plus 2013, so it works with the xlsx extension

Francisco Javier Jiménez answered 2 years ago

Of version 2.2 I am using the resource "Responsive PHP Grid (enhanced)"

Abu Ghufran answered 2 years ago

Hi,

It's little difficult to tell the reason.
You can send me complete code and database dump with few records for testing.

I can regenerate this case and tell you the fix.
You can email at [email protected]

Your Answer

19 + 11 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating / 5. Vote count:

We are sorry that this post was not useful for you!

Let us improve this post!