是否可以通过if条件来更新Visualforce页面的内容类型?
一直在寻找一种更新Apex的方法:页面内容类型,但看不到有关它的任何来源。 我有此ATM:
<apex:page standardController="sObject" extensions="<apexClass>"
</apex:page>
扩展程序中的Apex类具有很多功能,并且页面中间有一个HREF,该功能链接到模板时,当单击时可以查看并保存为CSV文件。 但是,我没有查看模板,而是想将功能升级到可下载的功能。因此,我想找到一种更新标题的方法,即单击链接时,它会添加此contentType =“ application/vnd.ms-excel
the Apex:page
。想知道VF中是否有这样的事情?
Been looking for a way to update an apex:page content type but don't see any source about it AHAHA.
I have this ATM:
<apex:page standardController="sObject" extensions="<apexClass>"
</apex:page>
the apex class in the extension has a lot of functionalities and i have an href in the middle of the page that is linked to a template which when clicked can be viewed and saved as a CSV file.
but instead of viewing a template, I wanted to upgrade the functionality into a downloadable one. So i want to find a way to update the header that when the link gets clicked it adds this contenttype="application/vnd.ms-excel
to the header of the apex:page.
you guys have an idea if there's such a thing in VF?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,您几乎可以将表达式放在任何Visualforce参数中,包括
APEX:page
'scontentType
。这样的事情:但是,请务必检查一下它在闪电体验中的行为(如果使用)。上次我玩它时,Lex有一些额外的输出,最终我作弊了。我将CSV输出到HIDDENT HTML元素,使用JavaScript抓住它。
Yes, you can put expressions in pretty much any Visualforce parameter including
apex:page
'scontentType
. Something like this:But be sure to check how it behaves in Lightning Experience (if you use it). Last time I played with it there was some extra output in LEX and eventually I cheated. I output CSV to hiddent html element, grab it with JavaScript.