Server cannot set content type after HTTP headers have been sent - Excel

Doing recordlist to excel and trying to download but receiving this message:

Server cannot set content type after HTTP headers have been sent.

Solution

Hi Vinicius,

You are probably trying a download in a Screen Action that is called from a Button or Link with Method Ajax Submit. This isn't possible (this is a limitation of HTTP). You need a Button with Method Submit (not Ajax).

Solution

Thanks @Kilian Hekhuis, i found the answer from my problem

Hi Hanafi,

Glad I could be of help :). Happy coding!

Kilian Hekhuis wrote:

Hi Hanafi,

Glad I could be of help :). Happy coding!

 Hi, sorry to interrupt you. You said "You need a Button with Method Submit (not Ajax) ". Is this applicable to a button in an Web Block?

I will appreciate your reply since I am a starter....

 

Hi Mitsunoba,

If you want to download a file, you need to trigger it with a Button that's set to Submit, otherwise it won't work. Whether or not it's in a Web Block is of no concern, since ultimately, the Web Block is just part of the page.