将DW数据窗口导出为EXCEL文件的方法(整理)
2008-04-27 05:21
477 查看
本文为摘自CSDN论坛帖子收集整理后汇总版本:
---2004年9月3日整理
---原贴见:
http://community.csdn.net/Expert/topic/3328/3328715.xml?temp=8.050799E-04
鉴于现在很多朋友询问pb数据导出到EXCEL中的问题,导出去后格式和数据
类型不对了,自己写了几个用户对象,
希望能抛砖引玉,加强技术交流,得到大家的支持。
1.nvo_EXCEL只要是两个接口函数
导出数据存储的数据,可以定义EXCEL的标题
publicfunctionintegeruf_toEXCEL(datastoreads_data,readonlystringas_title)
导出数据窗口的数据,可以定义EXCEL的标题
publicfunctionintegeruf_toEXCEL(datawindowaDW_data,readonlystringas_title)
2.下面是两个用户对象的sru文件,自己导入到工程中
$PBExportHeader$uo_ds_base.sru
$PBExportComments$数据存储基类
forward
globaltypeuo_ds_basefromdatastore
endtype
endforward
globaltypeuo_ds_basefromdatastore
stringdataobject="d_expression"
endtype
globaluo_ds_baseuo_ds_base
forwardprototypes
publicfunctionanyuf_getitemvalue(longal_row,stringas_colname)
publicfunctionstringuf_about()
publicfunctionstringuf_globalreplace(stringas_source,stringas_old,stringas_new)
endprototypes
publicfunctionanyuf_getitemvalue(longal_row,stringas_colname);
//*************************************************//
//function:得到任意的列的值
//parm :
// 1.al_row :指定行
// 2.as_colname :指定列的列名
//return :-1isfailorsuccessisvaluetoyou
//author :hzh
//date :2002.11.05
//************************************************//
Strings_tempcoltype
anya_ret
s_tempcoltype=Lower(THIS.Describe(as_colname+".coltype"))
//forstringtype
IFLeft(s_tempcoltype,4)="char"ORLeft(s_tempcoltype,4)="varc"then
a_ret=THIS.GetItemString(al_row,as_colname)
ENDIF
//fordecimaltype
IFLeft(s_tempcoltype,7)="decimal"then
a_ret=THIS.GetItemDecimal(al_row,as_colname)
ENDIF
//fordatetype
IFs_tempcoltype="date"THEN
a_ret=THIS.GetItemDate(al_row,as_colname)
ENDIF
//fordatetimetype
IFs_tempcoltype="datetime"THEN
a_ret=THIS.GetItemDateTime(al_row,as_colname)
ENDIF
//fornumbertype
IFs_tempcoltype="number"THEN
a_ret=THIS.GetItemNumber(al_row,as_colname)
ENDIF
//fortimetype
IFs_tempcoltype="time"THEN
a_ret=THIS.GetItemTime(al_row,as_colname)
ENDIF
//fortimestamptype
IFs_tempcoltype="timestamp"THEN
a_ret=THIS.GetItemTime(al_row,as_colname)
ENDIF
//forintorlong
IFs_tempcoltype="int"ORs_tempcoltype="long"THEN
a_ret=THIS.GetItemnumber(al_row,as_colname)
ENDIF
IFIsNull(a_ret)THEN
RETURN-1
ENDIF
RETURNa_ret
endfunction
publicfunctionstringuf_about();
strings_func=""
s_func="1.求得表达式的值(uf_evaluate)"+&
"2.根据SQL,创建数据存储(uf_setsqlselect)~r~n"+&
"3.得到任意列的值(uf_getitemvalue)~r~n"
//s_func+=SUPER::uf_about()1
---2004年9月3日整理
---原贴见:
http://community.csdn.net/Expert/topic/3328/3328715.xml?temp=8.050799E-04
鉴于现在很多朋友询问pb数据导出到EXCEL中的问题,导出去后格式和数据
类型不对了,自己写了几个用户对象,
希望能抛砖引玉,加强技术交流,得到大家的支持。
1.nvo_EXCEL只要是两个接口函数
导出数据存储的数据,可以定义EXCEL的标题
publicfunctionintegeruf_toEXCEL(datastoreads_data,readonlystringas_title)
导出数据窗口的数据,可以定义EXCEL的标题
publicfunctionintegeruf_toEXCEL(datawindowaDW_data,readonlystringas_title)
2.下面是两个用户对象的sru文件,自己导入到工程中
$PBExportHeader$uo_ds_base.sru
$PBExportComments$数据存储基类
forward
globaltypeuo_ds_basefromdatastore
endtype
endforward
globaltypeuo_ds_basefromdatastore
stringdataobject="d_expression"
endtype
globaluo_ds_baseuo_ds_base
forwardprototypes
publicfunctionanyuf_getitemvalue(longal_row,stringas_colname)
publicfunctionstringuf_about()
publicfunctionstringuf_globalreplace(stringas_source,stringas_old,stringas_new)
endprototypes
publicfunctionanyuf_getitemvalue(longal_row,stringas_colname);
//*************************************************//
//function:得到任意的列的值
//parm :
// 1.al_row :指定行
// 2.as_colname :指定列的列名
//return :-1isfailorsuccessisvaluetoyou
//author :hzh
//date :2002.11.05
//************************************************//
Strings_tempcoltype
anya_ret
s_tempcoltype=Lower(THIS.Describe(as_colname+".coltype"))
//forstringtype
IFLeft(s_tempcoltype,4)="char"ORLeft(s_tempcoltype,4)="varc"then
a_ret=THIS.GetItemString(al_row,as_colname)
ENDIF
//fordecimaltype
IFLeft(s_tempcoltype,7)="decimal"then
a_ret=THIS.GetItemDecimal(al_row,as_colname)
ENDIF
//fordatetype
IFs_tempcoltype="date"THEN
a_ret=THIS.GetItemDate(al_row,as_colname)
ENDIF
//fordatetimetype
IFs_tempcoltype="datetime"THEN
a_ret=THIS.GetItemDateTime(al_row,as_colname)
ENDIF
//fornumbertype
IFs_tempcoltype="number"THEN
a_ret=THIS.GetItemNumber(al_row,as_colname)
ENDIF
//fortimetype
IFs_tempcoltype="time"THEN
a_ret=THIS.GetItemTime(al_row,as_colname)
ENDIF
//fortimestamptype
IFs_tempcoltype="timestamp"THEN
a_ret=THIS.GetItemTime(al_row,as_colname)
ENDIF
//forintorlong
IFs_tempcoltype="int"ORs_tempcoltype="long"THEN
a_ret=THIS.GetItemnumber(al_row,as_colname)
ENDIF
IFIsNull(a_ret)THEN
RETURN-1
ENDIF
RETURNa_ret
endfunction
publicfunctionstringuf_about();
strings_func=""
s_func="1.求得表达式的值(uf_evaluate)"+&
"2.根据SQL,创建数据存储(uf_setsqlselect)~r~n"+&
"3.得到任意列的值(uf_getitemvalue)~r~n"
//s_func+=SUPER::uf_about()1
相关文章推荐
- 将DW数据窗口导出为EXCEL文件的方法(整理)
- 将DW数据窗口导出为EXCEL文件的方法(整理)
- 关于EXP-00056: 遇到 ORACLE 错误 1455 ORA-01455: 转换列溢出整数数据类型 EXP-00000: 导出终止失败 的问题解决方法整理
- 用ASP将数据读数导出EXCEL文件的四种方法
- 用ASP将数据读数导出EXCEL文件的四种方法
- 【PB】将PB数据窗口中的数据导出到EXCEL文件
- SQL SERVER使用OpenRowset,、OpenDataSource函数导入、导出数据到Excel 的几种方法(整理)
- 将数据窗口保存为Excel文件的方法
- 用ASP将数据读数导出EXCEL文件的四种方法
- SQL SERVER使用OpenRowset,、OpenDataSource函数导入、导出数据到Excel 的几种方法(整理)
- 用ASP将数据读数导出EXCEL文件的四种方法
- C#将数据集DataSet中的数据导出到EXCEL文件的几种方法
- PB 打开数据窗口(开任何一个dw或创建dw)出错 解决方法
- C#导出数据到Excel文件的方法
- 在PB中动态修改数据窗口DW的SQL语句方法注意事项
- C#将数据集DataSet中的数据导出到EXCEL文件的几种方法
- 命令窗口下:Oracle数据导入导出imp/exp sp2-0734:未知的命令开头'imp...解决方法
- C#将数据集DataSet中的数据导出到EXCEL文件的几种方法
- PB 数据窗口导出PDF,同一个数据窗口多次调用保存方法,合并到一个PDF中
- datagrid数据导出到excel文件给客户端下载的几种方法 (转)