en la pagina de documentacion de gambas indica que al llenar todos los datos draw.text( string, x, y, width, heigth, aling), donde con ancho y alto se dibuja un cuadro virtual donde se dibujara el texto que se indique, el texto que se ingrese se ajustara de manera automatica a el cuadro virtual que se genera con la coordenadas indicadas esto no ocurre en la practica.
necesito con urgencia que me indiquen una manera adecuada de ajustar el texto al cuadro dado. en el codigo que deje aca estoy ajustando el texto de una manera que no creo que sea la mas idonea pero es la mejor que se me ocurrio dada la poca documentacion que logro conseguir googleando.
Draw.Text(emergencia, 900, my, 1550, 300, Align.Center)
aca les pongo una parte del codigo con el que estoy trabajando
PUBLIC SUB Report()
DIM hora AS String
DIM fecha2 AS String
DIM fichero AS String
DIM ficheropdf AS String ' aca el nombre del fichero a generar
DIM mx AS Integer ' margen izquierdo
DIM my AS Integer 'margen superior
DIM i AS Integer
DIM p AS Integer 'numero de pagina
DIM estado AS Picture
DIM emergencia AS String
DIM emergencia1 AS String
DIM emergencia2 AS String
DIM emergencia3 AS String
DIM emergencialargo AS Integer
'generar un fichero con los artículos que hay en la bd
hora = Format(Now, "hh:mm:ss")
fecha2 = Format(Now, "dd-mm-yyyy")
fichero = "/tmp/temporal.ps"
ficheropdf = User.home & "/Escritorio/historicoMOD1-" & fecha2 & ".pdf"
Printer.copies = 1
Printer.name = ""
Printer.size = "A4"
Printer.Orientation = Printer.Landscape
Printer.file = fichero
Draw.Begin(Printer)
Draw.Font.size = 11
Draw.Font.Bold = TRUE
mx = 300 ' margen izquierdo
my = 1200 ' margen superior
'cabecera
cabezeraimg()
'cuerpo *************************************************************
p = 1
FOR i = 0 TO list_user.Rows.Count - 1
Draw.Font.size = 10
Draw.Font.bold = FALSE
Draw.LineWidth = 2
Draw.Line(mx, my, 6500, my)
Draw.Text("" & list_user[i, 0].Text & "", 200, my, 700, 300, Align.Center) 'codigo
Draw.Line(900, my, 900, my + 300)
emergencialargo = String.Len(list_user[i, 1].Text)
emergencia = list_user[i, 1].Text
IF emergencialargo > 34 THEN
emergencia1 = Left(emergencia, 34)
emergencia = Right(emergencia, -34)
emergencia2 = Left(emergencia, 34)
emergencia = Right(emergencia, -34)
emergencia3 = Left(emergencia, 34)
Draw.Text(emergencia1, 900, my, 1550, 300, Align.TopNormal) 'emergencia linea 1 aca es donde parto el texto para dejarlo en
Draw.Text(emergencia2, 900, my, 1550, 300, Align.Justify) 'emergencia linea 2 tres lineas
Draw.Text(emergencia3, 900, my, 1550, 300, Align.BottomNormal) 'emergencia linea 3
ELSE
Draw.Text(emergencia, 900, my, 1550, 300, Align.Center) 'emergencia
ENDIF
Draw.Line(2450, my, 2450, my + 300)
Draw.Text("" & list_user[i, 2].Text & "", 2450, my, 950, 300, Align.Center) 'tipo emergencia
Draw.Text("" & list_user[i, 3].Text & "", 3400, my, 450, 300, Align.Center) 'fecha
Draw.Text("" & list_user[i, 4].Text & "", 3850, my, 350, 300, Align.Center) 'hora
Draw.Text("" & list_user[i, 5].Text & "", 4200, my, 750, 300, Align.Center) 'organismo
Draw.Text("" & list_user[i, 6].Text & "", 4950, my, 450, 300, Align.Center) 'alarma
Draw.Text("" & list_user[i, 7].Text & "", 5400, my, 800, 300, Align.Center) 'atendida
Draw.Text("" & list_user[i, 8].Text & "", 6200, my, 600, 300, Align.Center) 'estado
my = my + 300
IF (my > 4000) THEN 'debemos comenzar una nueva página
Draw.Font.Size = 10
Draw.LineWidth = 5
Draw.Line(3300, 4475, 4100, 4475)
Draw.Text("FIRMA Y SELLO", 3350, 4550,,, Align.Justify)
Draw.Text("fecha: " & fecha2 & " hora: " & hora & "", mx, 4700,,, Align.Justify)
Draw.Text("pagina " & p & "", 6200, 4700,,, Align.Justify)
p = p + 1
'incluimos la cabecera y modificamos el valor de y
Printer.NewPage
Draw.Font.Size = 11
Draw.Font.Bold = TRUE
cabezeraimg()
my = 1125
ELSE
Draw.Font.Bold = FALSE
Draw.LineWidth = 5
Draw.Line(3300, 4475, 4100, 4475)
Draw.Text("FIRMA Y SELLO", 3350, 4550,,, Align.Justify)
IF p = 1 THEN Draw.Text("fecha: " & fecha2 & " hora: " & hora & "", mx, 4700,,, Align.Justify)
IF p = 1 THEN Draw.Text("pagina " & p & "", 6200, 4700,,, Align.Justify)
ENDIF
NEXT
Draw.End
'convertimos el fichero ps a pdf
SHELL "ps2pdf " & fichero & " " & ficheropdf WAIT
Message.Info("Fichero generado en el escritorio")
END
PUBLIC SUB cabezeraimg()
DIM logo AS Picture
logo = Picture["imagenes/maro list usuarios.png"]
Draw.Picture(logo, 1200, 100, 4500, 1000)
Draw.Text("" & list_user.Columns[0].Text & "", 200, 1050, 700, 100, Align.Center) 'codigo
Draw.Text("" & list_user.Columns[1].Text & "", 900, 1050, 1550, 100, Align.Center) 'emergencia
Draw.Text("" & list_user.Columns[2].Text & "", 2450, 1050, 950, 100, Align.Center) 'tipo emergencia
Draw.Text("" & list_user.Columns[3].Text & "", 3400, 1050, 450, 100, Align.Center) 'fecha
Draw.Text("" & list_user.Columns[4].Text & "", 3850, 1050, 350, 100, Align.Center) 'hora
Draw.Text("" & list_user.Columns[5].Text & "", 4200, 1050, 750, 100, Align.Center) 'organismo
Draw.Text("" & list_user.Columns[6].Text & "", 4950, 1050, 450, 100, Align.Center) 'alarma
Draw.Text("" & list_user.Columns[7].Text & "", 5400, 1050, 800, 100, Align.Center) 'atendida
Draw.Text("" & list_user.Columns[8].Text & "", 6200, 1050, 600, 100, Align.Center) 'estado
END