Dim pj As PrintJob, buff As String, I As Long
Set pj = New PrintJob
pj.Clear
Open "test.rpt" For Input As #1
buff = Input(LOF(1), #1)
Close #1
pj.OriginY = 20
pj.OriginX = 20
pj.LoadTextBuffer buff, 20
pj.AddText vbNullString,30,30,"sample"
For I = 1 To pj.CountTextBoxes
buff = pj.ItemTextBoxes(I).Text
buff = Replace(S, "<Barcode>", Fix(Rnd*1000))
pj.ItemTextBoxes(I).Text = buff
Next N
pj.PrintCurrentJob Printer
Printer.EndDoc
Set pj = Nothing
; Report file for class collection PrintJob
Begin Font Title
Name = "Arial"
Charset = 204
Size = 10
Bold = True
End Font
Begin Font Barcode
Name = "EanGnivc"
Size = 22
End Font
Begin Shape Image
Rect = (3;3)-(30;10)
Picture = <LOGO>
End Shape
Begin Shape Textbox
Rect = (40;3)-(30;7)
Color = R0 G0 B0
Font = Title
AlignX = Right
AlignY = Bottom
Text = "Title №: "
Format = False
End Shape
Begin Shape Textbox
Rect = (70;3)-(30;7)
Color = R0 G0 B0
Font = Title
AlignX = Center
AlignY = Bottom
Text = <Numcode>
Format = False
End Shape
Begin Shape Line
Rect = (40;10)-(60;0)
Color = R0 G0 B0
LineWidth = 0.5
End Shape
Begin Shape Box
Rect = (40;11)-(60;8)
LineWidth = 0.1
ForeColor = R0 G0 B0
Outline = False
BackColor = R224 G224 B224
Fill = True
End Shape
Begin Shape Textbox
Rect = (40;11)-(60;8)
Color = R0 G0 B0
Font = Barcode
AlignX = Center
AlignY = Center
Text = <Barcode>
Format = False
End Shape
Begin Shape Textbox
Rect = (113;14)-(36;5)
Color = R0 G0 B0
Font = Title
AlignX = Center
AlignY = Bottom
Text = "Numcode № <Numcode>"
Format = False
End Shape
alibek писал(а):TEH3OP, могу предложить набор классов, которые еще более все упростят :)
Правда они недоделанные (нет Preview, да и все рисование я хотел на API сделать), но тем не менее работают без сбоев.
Сейчас этот форум просматривают: Google-бот и гости: 3