FoxPro/Visual FoxPro - Mandar imagen a encabezado con automatizacion ole

 
Vista:

Mandar imagen a encabezado con automatizacion ole

Publicado por Beatriz (88 intervenciones) el 19/05/2008 23:48:44
Hola, necesito me ayuden en lo siguiente:
Estoy creando un encabezado en un documento de word con automatizacion desde visual fox, ahi inserto un logo, pero no se cuales son las propiedades para configurar lo ancho y lo alto del .bmp, mi codigo es el siguiente:

&&Aca estoy mandando una imagen al encabezado
WITH oDocument.Sections [1].headers[1]
oRange = .Range()
oDocument.inlineShapes.AddPicture("c: eciboiconoslogo-c.bmp",.F.,.T., oRange)
oRange.ParagraphFormat.Alignment = wdAlignParagraphJustify
oRange.InsertParagraphAfter()
oRange.Insertafter("-----------------Continuación de acta Nº"+" "+TRIM(expediente))
oRange.InsertParagraphAfter()
ENDWITH

Otra cosa, necesitaria que a partir de la pagina dos se inserte en el encabezado el
oRange.Insertafter("-----------------Continuación de acta Nº"+" "+TRIM(expediente)), pero no se como, con mi codigo se inserta esa leyendo desde el encabezado de la primera pag, es mas necesito mostrar el logo solo en la primer pagina.....y no lo he logrado
Si alguien me pudiera ayudar, mil gracias
Atte Beatriz
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:Mandar imagen a encabezado con automatizacion o

Publicado por sergio (737 intervenciones) el 20/05/2008 16:29:57
Lo tenes que hacer con un programa externo y luego insertarlo, no conozco una forma, la otra que te queda es insertar el logo en un documento word, y desde ahi crearte una macro y en esa macro ejecutas los camandos para achicar el logo, una vez terminada la macro , abris la macro y ves que comandos utilizo el word para achicar la imagen y esos comandos los pones en visual fox
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:Mandar imagen a encabezado con automatizacion o

Publicado por Beatriz (88 intervenciones) el 20/05/2008 18:17:26
Hola Sergio¡¡¡Muchas gracias por tus ideas...asi lo hice modifique la imagen desde el picture manager....y asi he logrado insertar la imagen con el tamaño adecuado...pero no se como hacer para que el logo solo se inserte en la primer pagina, como tambien el texto ...."continuacion. de documento.......se me inserte en el encabezado a partir de la segunda hoja¡¡¡¡
Si sabes...me cuentas gracias
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:Mandar imagen a encabezado con automatizacion o

Publicado por DOUGLAS (297 intervenciones) el 20/05/2008 17:46:05
hola te dejo este documento pueda que te sirva. ahora, yo te recomendaria crear el formato de encabezado antes o sea apartir de un documento, tener el formato ya diseñado a eso me refiero. al menos que las imagenes no sean las mimas, seria levantar el archivo o crear una copia del origianl y trabajarlo por si estas en red y no afectas el uso compartido de archivos.

AUTOMATIZACION DE WORD________________________________________
Local loWord
loWord = CREATEOBJECT("Word.Application")
loWord.Documents.Add()
loWord.ActiveDocument.Selection.Type("I love FoxPro!")
loWord.PrintOut()
loWord.Quit()

I cut and pasted this and got the following error:
OLE error code 0x80020011: Does not support a collection.
on the 'type' line. Is this code specific to O2K?

It's better not to work with Word's Selection object, but if you do, you need to remember that it's a member of the Word Application object, not of Document. There's only one Selection object for the entire Word instance. A better way to do this is:
Local loWord
loWord = CREATEOBJECT("Word.Application")
loWord.Documents.Add()
loRange = loWord.ActiveDocument.Range()
loRange.InsertAfter("I love FoxPro!")
loWord.ActiveDocument.SaveAs("c: emp est.doc")
loWord.PrintOut()
loWord.Quit()
release loRange, loWord

Also, be aware that if you close Word too soon after printing, it can raise an error.
Use the Background Printing Status property to see if Word is ready to be closed. -- Garrett Fitzgerald
________________________________________
To generate and send email from MS Outlook:

More generally, see Outlook Automation.

( Note: This doesn't work with OutlookExpress or other email programs, such as Eudora. Check out Tapi Fax Automation for a way to control whatever TAPI-compliant email program is registered. Eudora Is TAPI-Compliant... I don't know about OE -- wgcs)
#DEFINE MAILITEM 0
#DEFINE IMPORTANCELOW 0
#DEFINE IMPORTANCENORMAL 1
#DEFINE IMPORTANCEHIGH 2

oOutLookObject = CreateObject("Outlook.Application")
oEmailItem = oOutLookObject.CreateItem(MAILITEM)

WITH oEmailItem
.Recipients.Add("[email protected]") && uses the Recipients collection
.Subject = "Automation sample"
.Importance = IMPORTANCENORMAL
.Body = "This is easy!"
.Attachments.Add("c:mydirsample.txt") && Note that the fully qualified path and file is required.
.Send
ENDWITH

RELEASE oEmailItem
RELEASE oOutLookObject

Note that attachments is a collection inside the message object.

For more details, check the excellent series of articles by John Petersen in FoxTalk August and September 1998

-- Alex Feldstein

Check the article http://www.vbsquare.com/internet/outlook1/
________________________________________
Also check out OLE section of Knowledge Base Watch for other samples.

http://msdn.microsoft.com/library/officedev/off2000/woobjApplication.htm
________________________________________
How can I spell check a Memo field using Word and save corrections?

In this example, mytable.memofield is the field.....
oWord=CREATEOBJECT("Word.Application")
oWord.WindowState=2
_CLIPTEXT=mytable.memofield
oWord.Documents.Add.Content.Paste
oWord.ActiveDocument.CheckSpelling()
oWord.Visible=.F.
=oWord.ActiveDocument.Select
cText=oWord.Selection.Text
cText=LEFT(cText,LEN(cText)-1)
REPLACE mytable.memofield WITH cText
_CLIPTEXT=""
oWord.Documents.Close(0)
oWord.Quit(0)

--- John Koziol
________________________________________
How can I parse an address using Outlook?
See Parsing Addresses
________________________________________

Word automation page breaks
I am using Word automation to generate a document using info pulled in from a table. Some of the sections are several pages long, so I'm using the following logic to control the page breaks:


SCAN
oRange.Collapse(0) && wdCollapseEnd
nVPos =
oRange.Information(6)/Thisform.nPtsPerInch
cText = < formatted text based on the current record >
nInches = Thisform.nLineHt * INT(LEN(cText)/Thisform.nCharsPerLine)+ 1
IF nVPos + nInches > Thisform.nBottomMargin && Not enough room on page
oRange.InsertBreak(7) && wdPageBreak
oRange.InsertAfter([(Section 1, cont.) ]+CR+CR)
ENDIF
oRange.InsertAfter(cText)
ENDSCAN

The various form properties nPtsPerInch, nLineHt, etc are set prior to running the routine based on the font selected, etc. In theory, nVPos is the vertical position in inches from the top of the page.

This works fine on my system here using Office XP, but when I get weird page breaks when I run it on the client’s machine (which has Office 2000). After inserting some debugging code, I determined the problem to be in using the value of oRange.Information(6) to determine the page position. On my system, this gets reset properly after I insert the page break, but on their computer it just keeps incrementing, so it ends up telling me it’s 16” from the top of an 11” page.

The documentation from which I learned about the oRange.Information() method was written for Office 2000, so it should not be and issue of Office versions.

Anyone have a suggestion on how to fix this or know an alternate workaround for handling the page breaks?

--SteinGoering

Douglas
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:Mandar imagen a encabezado con automatizacion o

Publicado por Beatriz (88 intervenciones) el 20/05/2008 18:20:55
Gracias Douglas, pero la verdad no quiero trabajar con una plantilla...sino armar el documento de word siempre desde el programa....ahora te pregunto:
Como hago para que un texto fijo en un encabezado , se me inserte a partir de la segunda hoja y no la primera????asi como tambien el logo solo se me inserte en la primer pagina???
Mucho te agradeceré si sabes, me cuentes¡¡Gracias
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar