求救,数据窗口打印的奇怪问题

fujingbo 2002-11-19 10:36:28
这段程序实现将数据窗口数据转换出来在word中打印,在某些应用中无法转换标题头文字,显示为?,但在某些应用中可以,(标题头文字为宋体9号)不知道大家有没有遇到过相似问题,相关代码如下:

//得到数据窗口数据的列数与行数(行数应该是数据行数 + 1)
ll_colnum = ll_num
ll_rownum = dw_2.rowcount() + 1

ole_object.Documents.Add()
ole_object.ActiveDocument.Tables.Add(ole_object.Selection.Range, ll_rownum, ll_colnum)

string ls_colname
integer i,j,k

for i = 1 to ll_colnum
//得到标题头的名字
ls_value = ls_objtag[i]
ole_object.Selection.TypeText(ls_value)
for k = 1 to f_cncharnum(ls_value)
ole_object.Selection.TypeBackspace()
next
ole_object.Selection.MoveRight(wdCell)
next

dw_2.setredraw(false)
ole_object.Selection.MoveLeft(wdCell)
string column_name
for i = 2 to ll_rownum
for j = 1 to ll_colnum
column_name = ls_objs[j]
if dw_2.Describe(column_name + '.type') = 'column' then
ls_value = dw_2.Describe("Evaluate('LookupDisplay("+column_name+")',"+string(i - 1)+")")
end if
if dw_2.Describe(column_name + '.type') = 'compute' then
ls_value = dw_2.Describe("Evaluate('" + dw_2.Describe(column_name + '.expression') + "',"+string(i - 1)+")")
end if
ole_object.Selection.MoveRight(wdCell)
ole_object.Selection.TypeText(ls_value)
for k = 1 to f_cncharnum(ls_value)
ole_object.Selection.TypeBackspace()
next
next
next
dw_2.setredraw(true)

constant long wdFormatDocument = 0

SetPointer(oldpointer)



其中f_cncharnum代码如下:

//用途:返回一个字符串中汉字的个数
//输入:astring - string,给定的字符串
//返回值:li_num - integer 给定的字符串中汉字的个数
//注意:1、此方法基于汉字的国际汉字库区位编码的有效性,不符合此编码的系统此函数无效
//2、若汉字串含有非汉字字符,如图形符号或有ASCII码,则这些汉字字符将保持不变
string ls_ch
string ls_SecondSectTable //存入所有国标二级汉字读音
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



谢谢!
...全文
20 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
fujingbo 2002-12-15
  • 打赏
  • 举报
回复
真的耶,谢谢!
yahoo11 2002-12-14
  • 打赏
  • 举报
回复
这个问题是由于你在SQL SEVER中建表过程当中没有考虑到为表的各列(属性)加TAG,因为在PB中建表时,这是一个必要操作。而SQL SEVER则不是。
fujingbo 2002-11-19
  • 打赏
  • 举报
回复
其中wdCell为12

1,110

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder 相关问题讨论
社区管理员
  • 基础类社区
  • WorldMobile
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧