Article 文章和相关数据类别列表
我想以excel格式导出文章列表和相关数据类别,我已尝试通过knowledgeArticleVersion导出,但无法在列表中添加数据类别列。能帮忙吗 这是我尝试的代码Article 文章和相关数据类别列表,article,Article,我想以excel格式导出文章列表和相关数据类别,我已尝试通过knowledgeArticleVersion导出,但无法在列表中添加数据类别列。能帮忙吗 这是我尝试的代码 controller class: public class contactquery{ public PageReference Export() { return page.testExportexcel; } Public string Artdata; public Li
controller class:
public class contactquery{
public PageReference Export() {
return page.testExportexcel;
}
Public string Artdata;
public List<KnowledgeArticleVersion> cs{get; set;}
public contactquery()
{
List<KnowledgeArticleVersion> cs1 = new list<KnowledgeArticleVersion>();
cs = (KnowledgeArticleVersion [])database.query('Select id,ArticleNumber,ArticleType,FirstPublishedDate,Language,LastModifiedDate,LastPublishedDate,Title,urlname from KnowledgeArticleVersion where PublishStatus = \'Online\' and language = \'en_US\'');
for (KnowledgeArticleVersion c : cs)
{
System.debug(Artdata);
cs1.add(c);
}
}
}
控制器类:
公共类联系人查询{
公共页面引用导出(){
返回page.testExportexcel;
}
公共数据;
公共列表cs{get;set;}
公共联系人查询()
{
List cs1=新列表();
cs=(KnowledgeArticleVersion[])数据库。查询('从KnowledgeArticleVersion中选择id、ArticleNumber、ArticleType、FirstPublishedDate、Language、LastModifiedDate、LastPublishedDate、Title、urlname,其中PublishStatus=\'Online\'和Language='en\u US\');
for(KnowledgeArticle c版:cs)
{
系统调试(Artdata);
cs1.添加(c);
}
}
}
用于显示文章列表的VF页面:
<apex:page controller="contactquery" >
<apex:form >
<apex:pageBlock title="List of Published Articles" >
<div align="center">
<apex:commandButton action="{!Export}" value="Export"/>
</div>
<apex:pageBlockTable value="{!cs}" var="arti">
<apex:column value="{!arti.title}"/>
<apex:column value="{!arti.Urlname}"/>
<apex:column value="{!arti.ArticleNumber}"/>
<apex:column value="{!arti.ArticleType}"/>
<apex:column value="{!arti.FirstPublishedDate}"/>
<apex:column value="{!arti.Language}"/>
<apex:column value="{!arti.LastModifiedDate}"/>
<apex:column value="{!arti.LastPublishedDate}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
出口功能的Vf页面:
<apex:page controller="contactquery" contentType="application/vnd.ms-excel#SalesForceExport.xls" cache="true">
<apex:pageBlock title="Export Results" >
<apex:pageBlockTable value="{!cs}" var="arti">
apex:column value="{!arti.title}"/>
<apex:column value="{!arti.Urlname}"/>
<apex:column value="{!arti.ArticleNumber}"/>
<apex:column value="{!arti.ArticleType}"/>
<apex:column value="{!arti.FirstPublishedDate}"/>
<apex:column value="{!arti.Language}"/>
<apex:column value="{!arti.LastModifiedDate}"/>
<apex:column value="{!arti.LastPublishedDate}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:page>
顶点:列值=“{!arti.title}”/>
“无法在列表中添加数据类别列”-会发生什么情况?您是否收到生成错误?它会引发异常吗?它默默地什么也不做吗?请编辑您的问题以包含更多信息,因为您的问题很难帮助您。谢谢。嘿,因为knowledgeArticleVersion对象在列表中没有datacategory name字段可获取,所以我面临这个问题。请建议我获取所有已发布文章的对象,并以表格格式获取,它应该有相关的数据类别名称,并且文章的数据类别组名称应该添加到表列中。