All the reports in the world are the most complicated to count as Chinese. When you look at the report headers of foreigners, there is only one line. However, the headers of Chinese people generally have several layers. It is good to give you the last two layers. In addition, what Chinese people like most is the movable header, which means this year is another format that may be changed to next year. This also raises a challenge for programmers who write the header program. We also know that PowerBuilder's datawindow has powerful retrieval functions, and PowerBuilder is a database front-end development tool. However, beginners think that it can only be used as a static report, in fact, it hides more functions behind it, and datawindow can also make dynamic report types.
The following program was used in my previous project. I hope to give you a prompt.
String ls_part1, ls_aux1, ls_aux2, is_temp, ls_syntax
Ulong ai_x1 = 0, ai_x2 = 0, ai_y1 = 0, ai_y2 = 88, ai_style = 0, ai_width = 0, ai_linecolor = 1, h_y1, h_y2
Ulong cil_posx, cil_width, temp_x, temp_y, temp_ze
Integer char_w, I = 1, font = 19
Ulong F1 = 0, f2 = 0, F3 = 0, save_i1, save_i2
Ulong col_table_len = 0, as_old1, as_old2, col_len2 = 0, col_len3 = 0
String as_syntax, as_table
Ulong y0, Y1, Y2, Y3, Y4, id = 0
String as_name, as_unit, as_column
String as_head1, as_head2, as_head3, as_head4, as_head5, as_date
Ulong height
// Char_w = margin. paper_size * 1000/margin. font_size
// Char_w = 1500/margin. font_size * 10
// Char_w = 1500/100*10
Char_w = 1
Of_profilestring_margin ()
// Margin. top = 250
/Margin. bottom = 250
// Margin. right = 250
// Margin. left = 250
// Margin. head = 4330
// Margin. detail = 730
// Margin. footer= 100
// Margin. title = 2000
// Margin. paper_size = 35.4
// Margin. font_size = 30
Y0 = margin. title
Y1 = y0 + (margin. head-y0)/4
Y2 = y0 + 2 * (margin. head-y0)/4
Y3 = y0 + 3 * (margin. head-y0)/4
Y4 = margin. head
Height = y1-y0
As_table = 'release 8 ;~ R ~ N' + &
'Datawindow (units = 3 timer_interval = 0 color = 1073741824 processing = 0 print. margin. bottom = '+ string (margin. bottom) + &
'Print. margin. left = '+ string (margin. left) + 'print. margin. right = '+ string (margin. right) + 'print. margin. top = '+ string (margin. top) + &
'Print. preview. buttons = no) header (height = '+ string (margin. head) +') detail (height = '+ string (margin. detail) + &
') Footer (height =' + string (margin. footer) + ') table ()'
Do while table [I]. name <> "/0"
As_name = table [I]. name
As_unit = table [I]. unit
Cil_width = table [I]. len * char_w
As_column = "column _" + string (id)
As_head1 = "h1 _" + string (id)
As_head2 = "h2 _" + string (id)
As_head3 = "H3 _" + String (ID)
As_head4 = "H4 _" + String (ID)
As_head5 = "H11 _" + String (ID) // ö» ó~~~» ² ã µä~~ä~í~~~~~~~~ä~ço · ö£~~~~~~~~~×ö limit limit µä±ä» ó ð ° üró ° ã 'limit
Choose case table [I]. Layer
Case "1"
If table [I]. unit = "" then
If F1 = 0 then
Save_i1 = I
F1 = 1
Table [I]. x = col_table_len
Else
Temp_x = table [save_i1]. x
Temp_cel = col_table_len-table [save_i1]. x
If table [save_i1]. Len * char_w> = temp_cel then
Temp_cel = table [save_i1]. Len * char_w
Col_table_len = table [save_i1]. x + temp_cel
End if
Ls_aux1 = uf_text ("Header", table [save_i1]. Name, as_head1, temp_x, y0, height, temp_pencil)
As_syntax + = ls_aux1
// Maid
Ai_x1 = temp_x
Ai_x2 = col_table_len
H_y1 = Y1
H_y2 = Y1
Ls_aux1 = uf_lineh (ID, ai_x1, h_y1, ai_x2, h_y2, 0, 1)
As_syntax + = ls_aux1
Ai_x1 = col_table_len
Ai_x2 = col_table_len
H_y1 = y0
H_y2 = Y4
Ls_aux1 = uf_lineh (ID, ai_x1, h_y1, ai_x2, h_y2, 0, 1)
As_syntax + = ls_aux1
H_y1 = 0
H_y2 = margin. Detail
Ls_aux1 = uf_lined (ID, ai_x1, h_y1, ai_x2, h_y2, 0, 1)
As_syntax + = ls_aux1
Col_len2 = 0
Save_i1 = I
F1 = 1
Table [I]. x = col_table_len
End if
Else // ö» ó~~~» ² ~µä~~ä ¿
If F1 = 1 then
Temp_x = table [save_i1]. x
Temp_cel = col_table_len-table [save_i1]. x
If table [save_i1]. Len * char_w> = temp_cel then
Temp_cel = table [save_i1]. Len * char_w
Col_table_len = table [save_i1]. x + temp_cel
End if
Ls_aux1 = uf_text ("Header", table [save_i1]. Name, as_head1, temp_x, y0, height, temp_pencil)
As_syntax + = ls_aux1
// Maid
AI_x1 = temp_x
AI_x2 = col_table_len
H_Y1 = y1
H_Y2 = y1
Ls_aux1 = uf_lineh (id, Ai_x1, h_y1, Ai_x2, h_y2, 0, 1)
As_syntax + = ls_aux1
F1 = 0
AI_x1 = col_table_len
AI_x2 = col_table_len
H_Y1 = y0
H_Y2 = y4
Ls_aux1 = uf_lineh (id, Ai_x1, h_y1, Ai_x2, h_y2, 0, 1)
As_syntax + = ls_aux1
H_Y1 = 0
H_Y2 = margin. detail
Ls_aux1 = uf_lined (id, Ai_x1, h_y1, Ai_x2, h_y2, 0, 1)
As_syntax + = ls_aux1
End if
Id ++
As_table = uf_tablecolumn (as_table, as_column)
Ls_aux1 = uf_detailcolumn (as_column, id, col_table_len, margin. detail/4, margin. detail, cil_width, font)
As_syntax + = ls_aux1
Temp_y = (y3 + y0)/2
Ls_aux1 = uf_text ("Header", table [I]. Name, as_head5, col_table_len, temp_y, height, cil_width)
As_syntax + = ls_aux1
Ls_aux1 = uf_text ("Header", table [I]. Unit, as_head4, col_table_len, Y3, height, cil_width)
As_syntax + = ls_aux1
Col_table_len + = cil_width
Ai_x1 = col_table_len
Ai_x2 = col_table_len
H_y1 = y0
H_y2 = Y4
Ls_aux1 = uf_lineh (ID, ai_x1, h_y1, ai_x2, h_y2, 0, 1)
As_syntax + = ls_aux1
H_y1 = 0
H_y2 = margin. Detail
Ls_aux1 = uf_lined (id, Ai_x1, h_y1, Ai_x2, h_y2, 0, 1)
As_syntax + = ls_aux1
End if
Case "2"
If table [I]. unit = "" then // 'hangzhouúmicroúè ~² then
If f2 = 0 then
Save_i2 = I
F2 = 1
Table [I]. x = col_table_len
Else // í¬ Ê ± ° ené Ï 'ç çâ ¼ µú¶ ¶ þ ² then
Temp_x = table [save_i2]. x
Temp_cel = col_table_len-table [save_i2]. x
If table [save_i2]. len * char_w> = temp_cel then
Temp_cel = table [save_i2]. len * char_w
Col_table_len = table [save_i2]. x + temp_cel
End if
Ls_aux1 = uf_text ("Header", table [save_i2]. Name, as_head2, temp_x, Y1, height, temp_pencil)
As_syntax + = ls_aux1
Ai_x1 = col_table_len
Ai_x2 = col_table_len
H_y1 = Y1
H_y2 = Y2
Ls_aux1 = uf_lineh (ID, ai_x1, h_y1, ai_x2, h_y2, 0, 1)
As_syntax + = ls_aux1
// Fig
Ai_x1 = temp_x
Ai_x2 = col_table_len
H_Y1 = y2
H_Y2 = y2
Ls_aux1 = uf_lineh (id, Ai_x1, h_y1, Ai_x2, h_y2, 0, 1)
As_syntax + = ls_aux1
Col_len3 = 0
Save_i2 = I
F2 = 1
Table [I]. x = col_table_len
End if
F3 = 1
Else // snapshot» Ó Ð µúè ý ² Snapshot
If f2 = 1 then
Temp_x = table [save_i2]. x
Temp_cel = col_table_len-table [save_i2]. x
If table [save_i2]. Len * char_w> = temp_cel then
Temp_cel = table [save_i2]. Len * char_w
Col_table_len = table [save_i2]. x + temp_cel
End if
Ls_aux1 = uf_text ("Header", table [save_i2]. Name, as_head2, temp_x, Y1, height, temp_pencil)
As_syntax + = ls_aux1
Ai_x1 = col_table_len
Ai_x2 = col_table_len
H_y1 = Y1
H_y2 = Y2
Ls_aux1 = uf_lineh (id, Ai_x1, h_y1, Ai_x2, h_y2, 0, 1)
As_syntax + = ls_aux1
// Fig
AI_x1 = temp_x
AI_x2 = col_table_len
H_Y1 = y2
H_Y2 = y2
Ls_aux1 = uf_lineh (id, Ai_x1, h_y1, Ai_x2, h_y2, 0, 1)
As_syntax + = ls_aux1
F2 = 0
End if
Id ++
As_table = uf_tablecolumn (as_table, as_column)
Ls_aux1 = uf_detailcolumn (as_column, id, col_table_len, margin. detail/4, margin. detail, cil_width, font)
As_syntax + = ls_aux1
Temp_y = (y1 + y2)/2
Ls_aux1 = uf_text ("header", table [I]. name, as_head2, col_table_len, temp_y, height, cil_width)
As_syntax + = ls_aux1
Ls_aux1 = uf_text ("header", table [I]. unit, as_head4, col_table_len, y3, height, cil_width)
As_syntax + = ls_aux1
AI_x1 = col_table_len
AI_x2 = col_table_len
H_y1 = Y1
H_y2 = Y4
Ls_aux1 = uf_lineh (ID, ai_x1, h_y1, ai_x2, h_y2, 0, 1)
As_syntax + = ls_aux1
H_y1 = 0
H_y2 = margin. Detail
Ls_aux1 = uf_lined (ID, ai_x1, h_y1, ai_x2, h_y2, 0, 1)
As_syntax + = ls_aux1
Col_table_len + = cil_width
End if
Case "3"
Id ++
As_table = uf_tablecolumn (as_table, as_column)
Ls_aux1 = uf_detailcolumn (as_column, ID, col_table_len, margin. Detail/4, margin. Detail, cil_width, font)
As_syntax + = ls_aux1
Ls_aux1 = uf_text ("Header", table [I]. Name, as_head3, col_table_len, Y2, height, cil_width)
As_syntax + = ls_aux1
Ls_aux1 = uf_text ("Header", table [I]. Unit, as_head4, col_table_len, Y3, height, cil_width)
As_syntax + = ls_aux1
Ai_x1 = col_table_len
Ai_x2 = col_table_len
¿Commandid 'commandid was commandid ''' Y1-> Y4
If F3 = 1 then
H_y1 = Y1
H_Y2 = y4
F3 = 0
Else // ************************************************ when there are too many '{ó ¦ {{{{{y2-> y4
H_Y1 = y2
H_Y2 = y4
End if
Ls_aux1 = uf_lineh (id, Ai_x1, h_y1, Ai_x2, h_y2, 0, 1)
As_syntax + = ls_aux1
H_Y1 = 0
H_Y2 = margin. detail
Ls_aux1 = uf_lined (id, Ai_x1, h_y1, Ai_x2, h_y2, 0, 1)
As_syntax + = ls_aux1
Col_len3 = 1
Col_table_len + = cil_width
End choose
I ++
Loop
If F1 = 1 then
Temp_x = table [save_i1]. x
Temp_cel = col_table_len-table [save_i1]. x
If table [save_i1]. Len * char_w> = temp_cel then
Temp_cel = table [save_i1]. Len * char_w
Col_table_len = table [save_i1]. x + temp_cel
End if
Ls_aux1 = uf_text ("Header", table [save_i1]. Name, as_head1, temp_x, y0, height, temp_pencil)
As_syntax + = ls_aux1
Id ++
// Maid
Ai_x1 = temp_x
Ai_x2 = col_table_len
H_y1 = Y1
H_y2 = Y1
Ls_aux1 = uf_lineh (ID, ai_x1, h_y1, ai_x2, h_y2, 0, 1)
As_syntax + = ls_aux1
End if
If F2 = 1 then
Temp_x = table [save_i2]. x
Temp_cel = col_table_len-table [save_i2]. x
If table [save_i2]. Len * char_w> = temp_cel then
Temp_cel = table [save_i2]. Len * char_w
Col_table_len = table [save_i2]. x + temp_cel
End if
Ls_aux1 = uf_text ("Header", table [save_i2]. Name, as_head1, temp_x, Y1, height, temp_pencil)
As_syntax + = ls_aux1
// Fig
Ai_x1 = temp_x
Ai_x2 = col_table_len
H_y1 = Y2
H_y2 = Y2
Ls_aux1 = uf_lineh (ID, ai_x1, h_y1, ai_x2, h_y1, 0, 1)
As_syntax + = ls_aux1
End if
// ± Í mañäzä×ó ×ó ë µ µäheader ö± ï ß
Id ++
Ai_x1 = 0
Ai_x2 = 0
H_y1 = y0
H_y2 = Y4
Ls_aux1 = uf_lineh (ID, ai_x1, h_y1, ai_x2, h_y2, 0, 1)
As_syntax + = ls_aux1
// ± Í mañäzä×ó ×ó ë µ µädetail ö± ï ß
Id ++
Ai_x1 = 0
Ai_x2 = 0
H_y1 = 0
// H_y2 = margin. Detail-3
Ls_aux1 = uf_lined (ID, ai_x1, h_y1, ai_x2, h_y2, 0, 1)
As_syntax + = ls_aux1
// ± Í mañeüä×ó ó ò ë ********************************************************
Id ++
Ai_x1 = col_table_len
Ai_x2 = col_table_len
H_y1 = y0
H_y2 = Y4
Ls_aux1 = uf_lineh (ID, ai_x1, h_y1, ai_x2, h_y2, 0, 1)
As_syntax + = ls_aux1
// ± Í mañeüä×ó ó ò ë µ µädetail ö± ï ß
Id ++
Ai_x1 = col_table_len
Ai_x2 = col_table_len
H_y1 = 0
// H_y2 = margin. Detail-3
Ls_aux1 = uf_lined (ID, ai_x1, h_y1, ai_x2, h_y2, 0, 1)
As_syntax + = ls_aux1
// ± Í mañeüä×é é ï ë µ µäheader ö± ï ß
Id ++
Ai_x1 = 0
Ai_x2 = col_table_len
H_y1 = y0
H_y2 = y0
Ls_aux1 = uf_lineh (ID, ai_x1, h_y1, ai_x2, h_y2, 0, 1)
As_syntax + = ls_aux1
// ± Í mañeäµúè %² ó {μ ¥î» ö¼ äµäheader ö± ï ß
Id ++
H_y1 = Y3
H_y2 = Y3
Ls_aux1 = uf_lineh (ID, ai_x1, h_y1, ai_x2, h_y2, 0, 1)
As_syntax + = ls_aux1
// ± Í maññúheader çoró ö öð × î µ×² ¿µäö± ï ß
H_y1 = Y4-50
H_y2 = Y4-50
Ls_aux1 = uf_lineh (ID, ai_x1, h_y1, ai_x2, h_y2, 0, 1)
As_syntax + = ls_aux1
// ± Í mañäzúdetail çoró ò × î µ×² ¿µäö± ï ß
Id ++
H_y1 = margin. Detail-50
H_y2 = margin. Detail-50
Ls_aux1 = uf_lined (ID, ai_x1, h_y1, ai_x2, h_y2, 0, 1)
As_syntax + = ls_aux1
/*
Id ++
H_y1 = margin. Detail-10
H_y2 = margin. Detail-10
Ls_aux1 = uf_lined (ID, ai_x1, 20, ai_x2, 20, 0, 0, 1)
As_syntax + = ls_aux1
*/
// Ò ô ï â ç '******************************************
// Cil_width = Len
Cil_width = col_table_len
Ls_aux1 = uf_title_text ("Header", title, (col_table_len-cil_width)/2, Y0/8, height, cil_width,-20, 2)
As_syntax + = ls_aux1
String startday, deadday, startmonth, deadmonth
If Day (startdate) <10 then
Startday = "0" + String (Day (startdate ))
Else
Startday = string (Day (startdate ))
End if
If Day (deadline) <10 then
Deadday = "0" + String (Day (deadline ))
Else
Deadday = string (Day (deadline ))
End if
If month (startdate) <10 then
Startmonth = "0" + string (month (startdate ))
Else
Startmonth = string (month (startdate ))
End if
If month (deadline) <10 then
Deadmonth = "0" + string (month (deadline ))
Else
Deadmonth = string (month (deadline ))
End if
As_date = string (year (startdate) + "-" + startmonth + "-" + startday + "öá" + &
String (year (deadline) + "-" + deadmonth + "-" + deadday
Cil_width = len (as_date) * char_W
Cil_width = col_table_len
Ls_aux1 = uf_title_text ("header", as_date, (col_table_len-cil_width)/2, y0/2, height, cil_width,-12,2)
As_syntax + = ls_aux1
// ¸ ± Ê Ì â
Temp_x = 10
Char_w = 400
Cil_width = len
Ls_aux1 = uf_title_text ("Header", "00000000±μ ¥ 0000» £°" + tbdw, temp_x, y0 * 3/4, height, cil_width)
As_syntax + = ls_aux1
Temp_x + = cil_width
Cil_width = Len ("öæ ± í") * char_w
Ls_aux1 = uf_title_text ("Header", "öæ ±í£°", temp_x, y0 * 3/4, height, cil_width)
As_syntax + = ls_aux1
Temp_x + = cil_width
Cil_width = Len ("character") * char_w
Ls_aux1 = uf_title_text ("Header", "11", temp_x, y0 * 3/4, height, cil_width)
As_syntax + = ls_aux1
Temp_x + = cil_width
Cil_width = Len ("£20.20.20.") * char_w
Ls_aux1 = uf_title_text ("Header", "£20.0000£°", temp_x, y0 * 3/4, height, cil_width)
As_syntax + = ls_aux1
Temp_x + = cil_width
Cil_width = Len ("character") * char_w
Ls_aux1 = uf_title_text ("Header", "12", temp_x, y0 * 3/4, height, cil_width,-12, 0)
As_syntax + = ls_aux1
Temp_x + = cil_width
Cil_width = len ("ç?¢") * char_w
Ls_aux1 = uf_title_text ("header", "ç?£°", temp_x, y0 * 3/4, height, cil_width)
As_syntax + = ls_aux1
Temp_x + = cil_width
Cil_width = len ("character") * char_w
Ls_aux1 = uf_title_text ("header", "13", temp_x, y0 * 3/4, height, cil_width,-12, 0)
As_syntax + = ls_aux1
Temp_x + = cil_width
Cil_width = len ("À ¸ ää:") * char_w
Ls_aux1 = uf_title_text ("header", "À ¸ ä¿ Ê ý", temp_x, y0 * 3/4, height, cil_width)
As_syntax + = ls_aux1
Temp_x + = cil_width
Cil_width = len ("0000° rows") * char_w
Ls_aux1 = uf_title_text ("header", lms, temp_x, y0 * 3/4, height, cil_width,-, 0)
As_syntax + = ls_aux1
Temp_x + = cil_width
Cil_width = len ("Ï î äú 'úâ ë:") * char_w
Ls_aux1 = uf_title_text ("Header", "ï ä ää 'úâ ë", temp_x, y0 * 3/4, height, cil_width,-12, 0)
As_syntax + = ls_aux1
Temp_x + = cil_width
Cil_width = Len ("0000° rows") * char_w
Ls_aux1 = uf_title_text ("Header", xmdm, temp_x, y0 * 3/4, height, cil_width,-, 0)
As_syntax + = ls_aux1
Temp_x + = cil_width
Cil_width = Len ("ø ê ý:") * char_w
Ls_aux1 = uf_title_text ("Header", "ø too many rows", temp_x, y0 * 3/4, height, cil_width)
As_syntax + = ls_aux1
Temp_x + = cil_width
Cil_width = Len ("0000° rows") * char_w
Ls_aux1 = uf_title_text ("Header", XSS, temp_x, y0 * 3/4, height, cil_width,-, 0)
As_syntax + = ls_aux1
//
Ls_syntax = as_table + as_syntax
// Idw_area.create (ls_syntax)
Return (ls_syntax)