Information générale
Catégorie:
COM/DCOM et OLE Automation
Titre:
Word Automation - Graphics in header
Below is my attempt at putting a picture and some text into a header of a Word Document. What I have works. However, it does not generate the desired affect. What I wish to create is a header in which the graphic is left justified and the text is right justified. It is further complicated by the fact that part of the text ("Executive Summary") is to be on the same line as the Graphic. The dotted line and the "plans.customer" will be below the graphic. In the model created through word, the text "Executive Summary" is contained within a Textbox so we can move it anywhere we wish.
I tried to figure out how to insert a text box but have yet to be able to do that. Any help would be appreciated. Thanks.
oHeader = oDoc.Sections.Last.Headers[WdHeaderFooterPrimary]
oHeader.LinkToPrevious = .F.
oHeaderRange = oHeader.Range()
oHeaderRange.Text = ""
oShape = oDoc.InlineShapes.AddPicture("F:\SOMEPLACE\LOGOS\LOGO_CSR_BLACK.BMP",.f.,.t.,oHeaderRange)
oShape.Height = 45
oShape.Width = 95
oHeaderRange.InsertAfter("Executive Summary")
oHeaderRange.InsertAfter(CR)
oHeaderRange.InsertAfter("--------------------------------------------------------------------------------------------")
oHeaderRange.InsertAfter(CR)
oHeaderRange.InsertAfter(ALLTRIM(plans.customer))
oHeaderRange.ParagraphFormat.Alignment = wdAlignParagraphRight
oHeaderRange.Font.Name = FONT_NAME_STANDARD
oHeaderRange.Font.Size = FONT_SIZE_STANDARD_PLUS_ONE
oHeaderRange.Bold = 1
oHeaderRange.Collapse(wdCollapseEnd)
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement