怎么样在打印一个数据窗口上方加一个标题

lvcjh 2001-06-25 01:48:47
本人要打印一个数据报表,怎么样在一个数据窗口上方打印一个标题
然后换行,再把数据窗口中的内容输出
...全文
112 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
tanye 2001-06-25
  • 打赏
  • 举报
回复
这叫通用
有误:adw_dw.object.dataindow.Header.Height = adw_dw.object.dataindow.Header.Height + ai_y + ai_height
改正:
adw_dw.object.datawindow.Header.Height = adw_dw.object.datawindow.Header.Height + ai_y + ai_height
有误:"' font.height='-" + String(ai_size) +&
" font.weight='700' font.family='1' " +&
改正:"' font.height='-" + String(ai_size) +&
"' font.weight='700' font.family='1' " +&


pbworm 2001-06-25
  • 打赏
  • 举报
回复
将标题也做到数据窗口里面就可以了。
xingjiaren 2001-06-25
  • 打赏
  • 举报
回复
需这么费事么?
tanye 2001-06-25
  • 打赏
  • 举报
回复
我刚根据你的要求赶制了一个函数,
用于动态插入一个标题(在Header),
你可以根据具体情况修改参数:

//====================================================================
// [PUBLIC] Function add_title in n_zyx_dwedit inherited from datawindow
//--------------------------------------------------------------------
// Description:
//--------------------------------------------------------------------
// Arguments:
//
// [value] datawindow adw_dw
// <数据窗口>
// [value] string as_title
// <显示文本>
// [value] integer ai_x
// <X>
// [value] integer ai_y
// <Y>
// [value] integer ai_width
// <Width>
// [value] integer ai_height
// <Height>
// [value] string as_font
// <Font>
// [value] integer ai_size
// <Size>
////--------------------------------------------------------------------
// Returns: (INTEGER)
//====================================================================

integer li_rtn = 0,li_move;
string ls_array,ls_arraytype,ls_object,ls_band;
long p_len,ls_pos,ll_newrno
ls_array = adw_dw.Object.DataWindow.Objects;
p_len = len(ls_array);
ls_pos = pos(ls_array,'~t')
li_move = ai_y + ai_height

adw_dw.setredraw(false)
adw_dw.object.dataindow.Header.Height = adw_dw.object.dataindow.Header.Height + ai_y + ai_height
do while len(ls_array) > 0
if ls_pos > 0 then
ls_object = left(ls_array,ls_pos - 1)
ls_array = mid(ls_array,ls_pos + 1);
ls_pos = pos(ls_array,'~t')
else
ls_object = trim(ls_array)
ls_array = ''
end if
if upper(adw_dw.describe(ls_object + ".Band")) = 'HEADER' then
if upper(adw_dw.describe(ls_object + ".Type")) <> 'LINE' then
adw_dw.modify(ls_object + ".Y='" + string(long(adw_dw.describe(ls_object + ".Y")) + li_move) + "'")
else
adw_dw.modify(ls_object + ".Y1='" + string(long(adw_dw.describe(ls_object + ".Y1")) + li_move) + "'")
adw_dw.modify(ls_object + ".Y2='" + string(long(adw_dw.describe(ls_object + ".Y2")) + li_move) + "'")
end if
end if
loop;

adw_dw.modify("Create Text(band=Header color='0' alignment='0' border='2' x='" +&
String(ai_x) + "' y='" + String(ai_y) + "' width='" +&
String(ai_width) + "' height='" +&
string(ai_height) + "' name=text_001" +&
" text='" + as_title + "' font.face='" + as_font +&
"' font.height='-" + String(ai_size) +&
" font.weight='700' font.family='1' " +&
"font.underline='1' background.mode='1' background.color='0'");

return 1

未来得急测试!
juneball 2001-06-25
  • 打赏
  • 举报
回复
用嵌套报表
bigman_lfj 2001-06-25
  • 打赏
  • 举报
回复
偶有一个笨方法,加一个文本框,正常显示visible=fasle
打印时 设置 visible=true
再设置一下文本的内容dw_control.object.文本框.text="你所要的内容“

要不就用printtext()制定位置打印

1,079

社区成员

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

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