Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to generate a Watermark in Word from VFP?
Message
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
00756085
Message ID:
00759797
Views:
11
Try this...

I don't know what attempts or how close, but you may have received an error by trying to get at the InLineShapes(1) if you didn't FIRST do a MOVE LEFT 1 character to "highlight" focus of selection to include the picture... If not, the selection is all of -- nothing, just the cursor sitting there.

Anyhow, with obvious changes of the Image file to add, the "Save As" and oWord.Close(), you should be set with this.
oWord = CREATEOBJECT( "Word.Application" )
WITH oWord
	.Visible = .T.

	.Documents.Add()
	.ActiveWindow.ActivePane.View.Type = 3  && wdPrintView
	.ActiveWindow.ActivePane.View.SeekView = 1  && wdSeekPrimaryHeader
	.Selection.InlineShapes.AddPicture( "c:\somePicture.bmp", .F., .T. )
	.Selection.MoveLeft( 1, 1, 1 )
	.Selection.InlineShapes(1).Fill.Visible = 0  && msoFalse

	WITH .Selection.InlineShapes(1)
		.Fill.Transparency = 0
		.Line.Weight = .75
		.Line.Transparency = 0
		.Line.Visible = 0  && msoFalse
		.LockAspectRatio = -1  && msoTrue
		.Height = 360
		.Width = 550

		WITH .PictureFormat
			.Brightness = .85
			.Contrast = .15
			.CropLeft = 0
			.CropRight = 0
			.CropTop = 0
			.CropBottom = 0
		ENDWITH
	ENDWITH

	.ActiveWindow.ActivePane.View.SeekView = 0  && wdSeekMainDocument
	.ActiveDocument.SaveAs( "C:\NewWordDoc.doc" )
ENDWITH
HTH
Previous
Reply
Map
View

Click here to load this message in the networking platform