Yo creo que ya es la última llamada a TWORD que me queda por corregir, pero estoy bloqueado o ya le he hecho tantas pruebas que no sé ni lo que hago, no sé. ¿Alguna sugerencia?
Esta es la llamada al método
Code: Select all
oWord:TextBox( 03.10, 16.50, 03.90, 19.20, aText[ni][1], oFnt[2], , ,1, {,,.T.,,,,,},{,,,.T.,,},,)
Este es el código del método que yo tengo, la versión que está en el foro
Code: Select all
METHOD TextBox( nTop, nLeft, nBottom, nRight, cTexto, oFuente, nclrtext, nClrBack, nJustify, afondo, alinea, lvertadjust, norientacion) CLASS TWord
local oShapes,oCuadro,oFill,oLinea, oFontC, oText, oCuadroText
local nPad := 0, n, oWrap, nheighttext,;
lnocabe := .f., nheightbox:= 0
DEFAULT nTop := 0, nLeft := 0, nBottom := 10, nRight := 10,;
cTexto := ' ', oFuente := TFont():New(),;
nClrText := nRGB(0,0,0), nJustify := 0,;
afondo := {}, alinea := {}, lvertadjust := .f.,;
norientacion := 1
nheighttext := oFuente:nHeight
if norientacion > 3
norientacion := 1
endif
do case
case nJustify = 1
nPad := 2
case nJustify = 2
nPad := 1
case nJustify = 6
nPad := 0
endcase
if ::lsetcm
nTop := nTop*28.35
nLeft := nLeft*28.35
nBottom := nBottom*28.35
nRight := nRight*28.35
endif
oShapes := ::oSelection:Get( "Shapes" )
oCuadro := oShapes:Invoke( "AddTextbox", norientacion,INT(nLeft),INT(nTop),INT(nRight-nLeft),INT(nBottom-nTop) )
oFill := oCuadro:Get( "Fill" )
oCuadro:Set( 'RelativeHorizontalPosition',1)
oCuadro:Set( 'RelativeVerticalPosition',1)
//Fill
for n = 1 to len(afondo)
do case
case n = 1 .and. afondo[n] <> NIL
oFillColor := oFill:Get( "ForeColor")
oFillColor:Set( 'RGB', afondo[1] )
case n = 2 .and. afondo[n] <> NIL
oFillColor := oFill:Get( "BackColor")
oFillColor:Set( 'RGB', afondo[2] )
case n = 3 .and. afondo[n] <> NIL
oFill:Set( 'Transparency', afondo[3])
case n = 4 .and. afondo[n] <> NIL
oFill:Invoke( 'TwoColorGradient', afondo[4], afondo[5] )
case n = 6 .and. afondo[n] <> NIL
oFill:Invoke( 'Patterned', afondo[6] )
case n = 7 .and. afondo[n] <> NIL
oFill:Invoke( 'PresetTextured', afondo[7] )
case n = 8 .and. afondo[n] <> NIL
oFill:Invoke( 'UserTextured' , afondo[8] )
endcase
next n
//Linea de contorno
oLinea := oCuadro:Get( "Line" )
for n = 1 to len(alinea)
do case
case n = 1
oLinea:Set( "Weight", alinea[1] )
case n = 2
oLinea:Set( "ForeColor", alinea[2] )
case n = 3
oLinea:Set( "BackColor", alinea[3] )
case n = 4
oLinea:Set( "Transparency", alinea[4])
case n = 5
oLinea:Set( "DashStyle", alinea[5] )
case n = 5
oLinea:Set( "Style", alineas[6] )
endcase
next n
oCuadroText := oCuadro:Get( "TextFrame" )
oText := oCuadroText:Get( "TextRange" )
oFontC := oText:Get( "Font")
oFontC:Set( "Name" , oFuente:cFaceName )
oFontC:Set( "Size" , INT(oFuente:nHeight) )
oFontC:Set( "Bold" , oFuente:lBold )
oFontC:Set( "Color" , nclrtext )
oText:Set( 'HighlightColorIndex', nClrBack )
oText:Set( "Text", cTexto )
oParagraph := oText:Get( "ParagraphFormat")
oParagraph:Set( "Alignment", nPad )
if lvertadjust
nheightbox := 0
oCuadro:Set( 'Height', nheightbox)
::oActiveDoc:Invoke( 'ComputeStatistics',2,.t.)
lnocabe := oCuadroText:Get( 'Overflowing')
nheightbox := nheightbox + nHeighttext //+ OleGetProperty(oParagraph,'SpaceBefore')
do whil lnocabe = .t. .and. nheightbox <= nBottom - nTop
oCuadro:Set( 'Height', nheightbox)
oText:Set( "Text", cTexto )
::oActiveDoc:Invoke( 'ComputeStatistics',2,.t.)
lnocabe := oCuadroText:Get( 'Overflowing')
nheightbox := nheightbox + nHeighttext //+ OleGetProperty(oParagraph,'SpaceBefore')
enddo
else
::oActiveDoc:Invoke( 'ComputeStatistics',2,.t.)
lnocabe := oCuadroText:Get( 'Overflowing')
nheightbox := nBottom
endif
lcorta := lnocabe
ctexto2 := ctexto
do whil lcorta .and. !empty(ctexto2)
ctexto2 := Dellastword(ctexto2)
oText:Set( 'Text', ctexto2)
::oActiveDoc:Invoke('ComputeStatistics',2,.t.)
lcorta := oCuadroText:Get( 'Overflowing')
enddo
::ctextoverflow := strtran(ctexto, ctexto2, '')
::loverflowing := lnocabe
::oLastSay := otext
release oParagraph, OLinea, oFillColor, oFill, oFontC, oText,oCuadroText, oCuadro
if ::lsetcm
::nlastrow := nBottom/28.35
else
::nlastrow := nBottom
endif
RETURN Nil
No hay manera, el argumento en "Transparency" da error