其實很簡單的,給你一段參考..
Select the DataWindow by deselecting all controls; then set values in the Properties view, Print Specifications tab.
To specify a user-defined paper size, set the Paper.Size property to 255 or 256, then set the Print.CustomPage.Length and Print.Custom.Page.Width properties to the desired size. With Paper.Size set to 255, Length and Width are in the units specified for the DataWindow on the General page in the Properties view. For example:
// DataWindow Units set to 1/1000 inch
dw1.Modify("DataWindow.Print.Paper.Size=255")
//9.875 inches long
dw1.Modify("DataWindow.Print.CustomPage.Length=9875")
//7.375 inches wide
dw1.Modify("DataWindow.Print.CustomPage.Width=7375")
With Paper.Size set to 256, Length and Width are in millimeters:
dw1.Modify("DataWindow.Print.Paper.Size=256")
//25.4 centimeters long
dw1.Modify("DataWindow.Print.CustomPage.Length=254")
//19.5 centimeters wide
dw1.Modify("DataWindow.Print.CustomPage.Width=195")
if ii_print_mode = 1 then
is_print_range = '0'
end if
If ii_print_mode = 2 Then //部分打印,则选择页码
//如果页码范围为空,则打印全部
If is_print_range = "" Or IsNull(is_print_range) Then
ii_print_mode = 1
is_print_range = '0'
End If
dw_print.object.datawindow.print.page.range=is_print_range
End If
if ii_print_mode = 3 then //当前页
long row
string tmp
row = dw_print.getrow()
tmp = dw_print.describe("evaluate('page()',"+string(row)+")")
if len(tmp) > 0 then
dw_print.modify(" datawindow.print.page.range = '"+tmp+"'")
end if
end if