BO中的webi表格能wps表格固定表头头吗

使用BO JAVA SDK打开WEBI报表,并进行PDF、EXCEL、CSV、HTML导出 - 推酷
使用BO JAVA SDK打开WEBI报表,并进行PDF、EXCEL、CSV、HTML导出
整个实现流程是这样的:
1、打开一个WEBI报表
2、运行查询
3、设置查询条件
4、进行导出
5、关闭资源
需要注意的是,在设置查询条件之前,需要运行一次查询。
import java.io.F
import java.io.FileOutputS
import java.io.IOE
import java.util.D
import java.util.HashM
import com.businessobjects.rebean.wi.BinaryV
import com.businessobjects.rebean.wi.CSVV
import com.businessobjects.rebean.wi.DocumentI
import com.businessobjects.rebean.wi.HTMLV
import com.businessobjects.rebean.wi.OutputFormatT
import com.businessobjects.rebean.wi.PaginationM
import com.businessobjects.rebean.wi.P
import com.businessobjects.rebean.wi.P
import com.businessobjects.rebean.wi.R
import com.businessobjects.rebean.wi.ReportE
import com.businessobjects.rebean.wi.ReportE
import com.businessobjects.rebean.wi.R
import com.crystaldecisions.sdk.exception.SDKE
import com.crystaldecisions.sdk.framework.CrystalE
import com.crystaldecisions.sdk.framework.IEnterpriseS
import com.crystaldecisions.sdk.framework.ISessionM
import com.crystaldecisions.store.IInfoO
import com.crystaldecisions.store.IInfoO
import com.crystaldecisions.store.IInfoS
public class ExportWebiDocument {
public static void main(String[] args) {
// The exported documents will be saved to this folder
System.out.println(&Working Directory: & + System.getProperty(&user.dir&));
IEnterpriseSession enterpriseSession =
ReportEngines reportEngines =
String host = &localhost&;
String user = &Administrator&;
String pass = &&;
String auth = &secEnterprise&;
String name = &/Report Samples/My Report&;
// Prepare answers to prompts
// It is assumed that the report has two prompts &Country:& and &Year:&
HashMap&String, String[]& answers = new HashMap&String, String[]&();
answers.put(&Country:&, new String[]{&US&, &France&});
answers.put(&Year:&, new String[]{&FY2004&});
// Connect to CMS
System.out.println(&Connecting...&);
ISessionMgr sessionMgr = CrystalEnterprise.getSessionMgr();
enterpriseSession = sessionMgr.logon(user, pass, host, auth);
// Initialize Webi report engine
reportEngines = (ReportEngines) enterpriseSession.getService(&ReportEngines&);
ReportEngine reportEngine = (ReportEngine) reportEngines.getService(ReportEngines.ReportEngineType.WI_REPORT_ENGINE);
// Retrive the list of all document and search the one with the specified name
// If the Id or CUID of the document is known, the query can be more specific,
// so there will be no need to loop through whole list of Webi documents.
IInfoStore infoStore = (IInfoStore) enterpriseSession.getService(&InfoStore&);
String query = &select SI_ID, SI_NAME, SI_FILES from CI_INFOOBJECTS where SI_KIND = 'Webi' and SI_INSTANCE=0&;
IInfoObjects infoObjects = (IInfoObjects) infoStore.query(query);
for (Object object : infoObjects) {
IInfoObject infoObject = (IInfoObject)
String path = getInfoObjectPath(infoObject);
System.out.println(path);
if (path.equals(name)) {
String title = infoObject.getTitle();
// Open the document
DocumentInstance doc = reportEngine.openDocument(infoObject.getID());
// Refresh the document
doc.refresh();
// Set prompts
Prompts prompts = doc.getPrompts();
for (int i = 0; i & prompts.getCount(); i++) {
Prompt prompt = prompts.getItem(i);
System.out.println(prompt.getID());
String[] answer = answers.get(prompt.getID());
if (answer != null) {
prompt.enterValues(answer);
for (String value : answer) {
System.out.println(&
& + value);
doc.setPrompts();
// Check that all mandatory prompts are answered
if (doc.getMustFillPrompts()) {
System.out.println(&ERROR: Mandatory prompts has not been entered&);
// Check the contexts do not need to be resolved
if (doc.getMustFillContexts()) {
System.out.println(&ERROR: Contexts has not been entered&);
CSVView csvView = (CSVView)doc.getDataProviders().getView(OutputFormatType.CSV);
writeBytes(csvView.getContent().getBytes(), title + & & + &.csv&);
BinaryView binaryView2 = (BinaryView)doc.getView(OutputFormatType.PDF);
writeBytes(binaryView2.getContent(), title + &.pdf&);
BinaryView xlsView = (BinaryView)doc.getView(OutputFormatType.XLS);
writeBytes(xlsView.getContent(), title + &.xls&);
Reports reports = doc.getReports();
for (int i = 0; i & reports.getCount(); i++)
Report report = reports.getItem(i);
report.setPaginationMode(PaginationMode.Listing);
HTMLView htmlView = (HTMLView) report.getView(OutputFormatType.DHTML);
writeBytes(htmlView.getContent().getBytes(), title + & & + i + &.html&);
doc.closeDocument();
} catch (SDKException ex) {
ex.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (reportEngines != null)
reportEngines.close();
if (enterpriseSession != null)
enterpriseSession.logoff();
System.out.println(&Finished!&);
public static String getInfoObjectPath(IInfoObject infoObject) throws SDKException {
String path = &/& + infoObject.getTitle();
while (infoObject.getParentID() != 0) {
infoObject = infoObject.getParent();
path = &/& + infoObject.getTitle() +
public static void writeBytes(byte[] data, String filename) throws IOException {
File file = new File(filename);
FileOutputStream fstream = new FileOutputStream(file);
fstream.write(data);
fstream.close();
已发表评论数()
请填写推刊名
描述不能大于100个字符!
权限设置: 公开
仅自己可见
正文不准确
标题不准确
排版有问题
主题不准确
没有分页内容
图片无法显示
视频无法显示
与原文不一致【图文】02.BO的WEBI前台展示培训_百度文库
两大类热门资源免费畅读
续费一年阅读会员,立省24元!
评价文档:
02.BO的WEBI前台展示培训
上传于||暂无简介
大小:2.52MB
登录百度文库,专享文档复制特权,财富值每天免费拿!
你可能喜欢博客访问: 29689
博文数量: 22
注册时间:
be simple be happy
ITPUB论坛APP
ITPUB论坛APP
APP发帖 享双倍积分
IT168企业级官微
微信号:IT168qiye
系统架构师大会
微信号:SACC2013
分类: 数据仓库与数据挖掘
BO官方文档:using sap netweaver business intelligence in universe designer
总结:Webi开发大概分这么些功能:
表格的类型(垂直/水平/交叉);
多级钻取;
变量(含公式函数嵌套等);
条件(报警器吧);
维度合并?;
统计图的形式展现(柱状/三维柱状/圆饼);
百分比平均数最值
1-0 Webi开发报表前选择维度时可设置多个查询过滤器,可选择多个过滤器之间的关系为‘或’or ‘和’,过滤器的操作分类有[常量][列表中的值][提示即用户输入]
1.1&平均值/最大值/最小值/百分比/总和等 的路径: 分析→条件
1.2&部分报表分主从报表,需要对参数进行传递,动态显示从报表信息:/hanmos/archive//2606982.html
1.3 度量排序& 4.1中与3.x中不再一样?
5.0.页眉和页尾的编辑:插入空白单元格或预定义中页码/总页数等,再在单元格中编辑如下:
① ="报表作者"+DocumentAuthor()&
②&="第"+ Page() +"页" + "/" +"共"+ NumberOfPages()+"页"&
③&="统计日期"+ CurrentDate()
5.1 各函数使用示例:
①&=If([销售数量]>5000;"骨灰级客户";"正常客户") & &→销量超过5000时,返回骨灰级客户,否则返回正常客户
& &&=If ([销售数量] > 8000;"excellent"; If ([销售数量] >=6000;"good";"normal"))?
& & =If ( [销售数量]>8000;"high revennu"; If ([销售数量]>6000;"normal revennu" ); If([销售数量]>2000;"lowl revenue";"very lowl revenue"))?
②=Substr([Cn Description];1;2) &“UMTS数据卡” 返回“UM”;“数据卡” 返回”数据“
③ format(@select(TIME\Order Date),'yyyy') 获取order date中年
& &format(@select(Date\Order Date),'mm') 获取月
& &format(@select(Date\Order Date),'dd')获取 天
& &'Q'+format(@select(Date\Order Date),'q')获取季
④占比计算
销售占比:产品组的销售金额/事业部下该产品组的销售金额 →①=(Sum ([销售数量]) In([产品组]))/(Sum ( [销售数量]) In ([事业部])) &②将事业部维度拆分,使用 =Percentage([销售金额];break)?;
销售偏差:(事业部产品组销售占比-区域总的销售占比)/区域总的销售占比;
区域总的销售占比:sum(产品组销售金额)/sum(区域销售金额);
PS:设置数字显示格式路径:选中列右键→设置数字格式→百分比
阅读(2753) | 评论(0) | 转发(0) |
相关热门文章
给主人留下些什么吧!~~
请登录后评论。君,已阅读到文档的结尾了呢~~
2016年度精品--BO WEBI中统计表设计技巧之表头拆分篇
扫扫二维码,随身浏览文档
手机或平板扫扫即可继续访问
2016年度精品--BO WEBI中统计表设计技巧之表头拆分篇
举报该文档为侵权文档。
举报该文档含有违规或不良信息。
反馈该文档无法正常浏览。
举报该文档为重复文档。
推荐理由:
将文档分享至:
分享完整地址
文档地址:
粘贴到BBS或博客
flash地址:
支持嵌入FLASH地址的网站使用
html代码:
&embed src='/DocinViewer--144.swf' width='100%' height='600' type=application/x-shockwave-flash ALLOWFULLSCREEN='true' ALLOWSCRIPTACCESS='always'&&/embed&
450px*300px480px*400px650px*490px
支持嵌入HTML代码的网站使用
您的内容已经提交成功
您所提交的内容需要审核后才能发布,请您等待!
3秒自动关闭窗口

我要回帖

更多关于 电子表格固定表头 的文章

 

随机推荐