Процедура печати из MSFlexGrid
Private Sub cmdPrint_Click() Dim c As Integer Dim n As Integer Dim p As Integer Dim page As Integer Dim i As Integer Dim x As Integer Dim Y As Integer Dim xx As Integer Dim z As Integer Dim OStrWidth As Integer Dim Dob As Integer Dim StWidth(15) As Integer Dim NumDob As Integer Dim str As String Dim sss(15) As String Dim StrWidth(30) As String Dim title As String p = 1 page = 1 'Установка свойств объекта Printer Printer.Orientation = 2 MousePointer = 11 x = Printer.ScaleWidth * 0.01 Y = Printer.ScaleHeight * 0.02 Printer.PaperSize = 9 Printer.FontName = "Times New Roman cyr" Printer.FontSize = 10 Printer.DrawWidth = 2 For z = 1 To Grid.Cols - 1 Step 1 Grid.Row = 0 Grid.Col = z StrWidth(z) = Grid.Text Next z 'Печать заголовка xx = 4 title = Label1.Caption Printer.CurrentX = x * 25 Printer.CurrentY = Y * c Printer.Print title c = c + 1 'Печать названий столбцов Printer.FontSize = 8 Printer.DrawWidth = 2 Printer.Line (x * 4, Y * c)-(x * 88, Y * c) Printer.DrawWidth = 1 For z = 1 To Grid.Cols Step 1 If z = 1 Or z = Grid.Cols Then Printer.DrawWidth = 2 Else Printer.DrawWidth = 1 End If Printer.Line (x * xx, Y * c)-(x * xx, Y * (c + 1)) Printer.CurrentX = x * (xx + 0.2) Printer.CurrentY = Y * (c + 0.1) Printer.Print StrWidth(z) If z = 2 Then xx = xx + (84 / (Grid.Cols - 1)) - _ (84 / (4 * (Grid.Cols - 1))) If z = 3 Then xx = xx + (84 / (Grid.Cols - 1)) + (84 / (4 * (Grid.Cols - 1))) Else If Not z = 2 Then xx = xx + (84 / (Grid.Cols - 1)) End If Next z c = c + 1 Printer.DrawWidth = 2 Printer.Line (x * 4, Y * c)-(x * 88, Y * c) Printer.DrawWidth = 1 'Печать строк из MSFlexGrid i = 1 25 Grid.Row = i If c = 35 Then p = 1 xx = 4 Grid.Col = 0 'Переход на новую страницу If c > 38 Then If p = 1 Then Printer.DrawWidth = 2 Printer.Line (x * 4, Y * c)-(x * 88, Y * c) Printer.CurrentX = x * 84 Printer.CurrentY = Y * (39.1) Printer.Print "Стр. "; page Printer.NewPage p = p + 1 page = page + 1 c = 0 Printer.FontName = "Times New Roman cyr" Printer.FontSize = 8 Printer.DrawWidth = 2 Printer.Line (x * 4, Y * c)-(x * 88, Y * c) Printer.DrawWidth = 1 For z = 1 To Grid.Cols Step 1 If z = 1 Or z = Grid.Cols Then Printer.DrawWidth = 2 Else Printer.DrawWidth = 1 End If Printer.Line (x * xx, Y * c)-(x * xx, Y * (c + 1)) Printer.CurrentX = x * (xx + 0.2) Printer.CurrentY = Y * (c + 0.1) Printer.Print StrWidth(z) If z = 2 Then xx = xx + (84 / (Grid.Cols - 1)) - _ (84 / (4 * (Grid.Cols - 1))) If z = 3 Then xx = xx + (84 / (Grid.Cols - 1)) + _ (84 / (4 * (Grid.Cols - 1))) Else If Not z = 2 Then xx = xx + (84 / (Grid.Cols - 1)) End If Next z c = c + 1 Printer.DrawWidth = 2 Printer.Line (x * 4, Y * c)-(x * 88, Y * c) Printer.DrawWidth = 1 xx = 4 End If End If 'Печать длинной строкой через всю таблицу названия группы If Not Grid.Text = "" Then If c > 36 Then ' Переход на новую страницу If p = 1 Then Printer.DrawWidth = 2 Printer.Line (x * 4, Y * c)-(x * 88, Y * c) Printer.CurrentX = x * 84 Printer.CurrentY = Y * (39.1) Printer.Print "Стр. "; page Printer.NewPage p = p + 1 page = page + 1 c = 0 Printer.FontName = "Times New Roman cyr" Printer.FontSize = 8 Printer.DrawWidth = 2 Printer.Line (x * 4, Y * c)-(x * 88, Y * c) Printer.DrawWidth = 1 For z = 1 To Grid.Cols Step 1 If z = 1 Or z = Grid.Cols Then Printer.DrawWidth = 2 Else Printer.DrawWidth = 1 End If Printer.Line (x * xx, Y * c)-(x * xx, Y * (c + 1)) Printer.CurrentX = x * (xx + 0.2) Printer.CurrentY = Y * (c + 0.1) Printer.Print StrWidth(z) If z = 2 Then xx = xx + (84 / (Grid.Cols - 1)) - _ (84 / (3 * (Grid.Cols - 1))) If z = 3 Then xx = xx + (84 / (Grid.Cols - 1)) + _ (84 / (3 * (Grid.Cols - 1))) Else If Not z = 2 Then xx = xx + (84 / (Grid.Cols - 1)) End If Next z c = c + 1 Printer.DrawWidth = 2 Printer.Line (x * 4, Y * c)-(x * 88, Y * c) Printer.DrawWidth = 1 xx = 4 End If End If Printer.DrawWidth = 2 Printer.Line (x * 4, Y * c)-(x * 4, Y * (c + 1)) Printer.Line (x * 88, Y * c)-(x * 88, Y * (c + 1)) Printer.CurrentX = x * (xx + 0.2) Printer.CurrentY = Y * (c + 0.1) Printer.Print Grid.Text c = c + 1 Printer.DrawWidth = 1 Printer.Line (x * 4, Y * c)-(x * 88, Y * c) End If For z = 1 To Grid.Cols - 1 Step 1 Grid.Col = z If z = 1 Or z = Grid.Cols Then Printer.DrawWidth = 2 Else Printer.DrawWidth = 1 End If If z = 2 And Grid.Text = "Итого с начала года:" Then GoTo 10 If z = 2 And InStr(1, Grid.Text, "В т.ч. за ") Then GoTo 10 Printer.Line (x * xx, Y * c)-(x * xx, Y * (c + 1)) Printer.CurrentX = x * (xx + 0.2) Printer.CurrentY = Y * (c + 0.1) Printer.Print Grid.Text 10 If z = 2 Then xx = xx + (84 / (Grid.Cols - 1)) - _ (84 / (4 * (Grid.Cols - 1))) If z = 3 Then xx = xx + (84 / (Grid.Cols - 1)) + (84 / (4 * (Grid.Cols - 1))) Else If Not z = 2 Then xx = xx + (84 / (Grid.Cols - 1)) End If Next z Printer.DrawWidth = 2 Printer.Line (x * xx, Y * c)-(x * xx, Y * (c + 1)) Printer.DrawWidth = 1 c = c + 1 Printer.Line (x * 4, Y * c)-(x * 88, Y * c) i = i + 1 If i