PowerBulider数据窗口转MicroSoft Execl、Word程序源代码

PowerBulider数据窗口转MicroSoft Execl、Word程序源代码 

一、f_cncharnum函数 f_cncharnum.srf
$PBExportHeader$f_cncharnum.srf
$PBExportComments$得到字符串中汉字或者双字节的个数
global type f_cncharnum from function_object
end type

forward prototypes
global function integer f_cncharnum (string aString)
end prototypes

global function integer f_cncharnum (string aString);
//函数名: f_cncharnum
//用途: 返回一个字符串中汉字的个数
//输入: aString - string, 给定的字符串
//返回值: li_num - Integer, 给定的字符串中汉字的个数
//注意: 1. 此方法基于汉字的国标汉字库区位编码的有效性,不符合此编码的系统此函数无效!
// 2. 若汉字串含有非汉字字符,如图形符号或ASCII码,则这些非汉字字符将保持不变.
//例如: li_ret = f_cncharnum("摆渡人ferryman") li_ret = 3

string ls_ch //临时单元
string ls_SecondSecTable //存放所有国标二级汉字读音
integer li_num = 0 //返回值
integer i,j

For i = 1 to Len(aString)
ls_ch = Mid(aString,i,1)
If Asc(ls_ch) >= 128 then //是汉字
li_num++
i = i+1
End if
Next

Return li_num

end function

二、PBToExcel函数f_outputtoexcel_new.srf

$PBExportHeader$f_outputtoexcel_new.srf
global type f_outputtoexcel_new from function_object
end type

forward prototypes
global function integer f_outputtoexcel_new (datawindow adw)
end prototypes

global function integer f_outputtoexcel_new (datawindow adw);
//函数名:f_outputtoexcel_new
//输入: adw - datawindow,指定的数据窗口
//返回值: Integer
constant integer ppLayoutBlank = 12
OLEObject ole_object
ole_object = CREATE OLEObject

integer li_ret

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值