The issue is the following;
When I create a new document from the template containing the above
code, I can see that the code is part working as when I toggle to the
text view of the INCLUDEPICTURE code, the file name I would expect to
see as the source of the image is correct. The image itself however,
has not updated. If I move into the header field and select All and
then press F9, nothing changes. Nor if I do a print preview or what
ever. In order for the graphic to show, I must SAVE THE DOCUMENT, close
it, open it and then go in and press select all+ F9. this is obviously
a massive inconvenience, considering the document is created correctly
with the fields updated with the relavent values, why isnt the picture
actually showing until I save and reopen? I would like to find a
solution to this which doesnt involve writing VBA code in the Word
document itself, it would be massively preferable to achieve this from
the .NET code that drives the whole process.
Any ideas?
"mog" <mog...@gmail.com> wrote in message
news:1159349684.3...@b28g2000cwb.googlegroups.com...
> In order for the graphic to show, I must SAVE THE DOCUMENT, close
> it, open it and then go in and press select all+ F9.
>
Could you give us an example of the path information you're putting
in the document property?
Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17
2005)
http://www.word.mvps.org
This reply is posted in the Newsgroup; please post any follow
question or reply in the newsgroup and not by e-mail :-)
oCustomProps = d.CustomDocumentProperties()
For each prop in oCustomProps
if prop.Name ="headerA" Then prop.value = "THEIMAGE.jpg"
Next
Dim afield As Word.Field
For Each afield In
d.Sections(1).Headers(Word.WdHeaderFooterIndex.wdHeaderFooterFirstPage).Range.Fields()
On Error Resume Next
If afield.LinkFormat.AutoUpdate = False Then
afield.LinkFormat.Update()
Next afield
For Each afield In
d.Sections(1).Headers(Word.WdHeaderFooterIndex.wdHeaderFooterFirstPage).Range.Fields()
On Error Resume Next
If afield.LinkFormat.AutoUpdate = False Then
afield.LinkFormat.Update()
Next afield
For Each afield In
d.Sections(1).Headers(Word.WdHeaderFooterIndex.wdHeaderFooterFirstPage).Range.Fields()
On Error Resume Next
If afield.LinkFormat.AutoUpdate = False Then
afield.LinkFormat.Update()
Next afield
d.Activate()
In the Word Document (in the header) I have this code.
{INCLUDEPICTURE "{DOCPROPERTY "headerA"}" \* MERGEFORMAT}
{DOCPROPERTY "headerA"}
The {DOCPROPERTY "headerA"} line proves that the value is being fed
into the document OK.
Like I said, it works, in so much as all I have to do is *save the
document*, and then toggle field codes a few times, or press F9 whilst
selecting everything in the header, and the image is updated. But I
would really like to do this manual bit BEFORE the page is saved and
then loaded! Any ideas?
> Like I said, it works, in so much as all I have to do is *save
the
> document*, and then toggle field codes a few times, or press F9
whilst
> selecting everything in the header, and the image is updated. But
I
> would really like to do this manual bit BEFORE the page is saved
and
> then loaded! Any ideas?
>
OK, so you're putting only a file name into the document property.
<<When I create a new document from the template containing the
above code, I can see that the code is part working as when I
toggle to the text view of the INCLUDEPICTURE code, the file name I
would expect to see as the source of the image is correct. The
image itself however, has not updated... In order for the graphic
to show, I must SAVE THE DOCUMENT, close it, open it and then go in
and press select all+ F9.>>
It's quite logical that the document can't show the graphic without
a full path if the document has never been saved. How should Word
know where to look for it? Try saving the document, first, then
insert the file path information and update the fields.
Or, try putting the entire path to the graphic into the doc
variable, update the fields, save the document, then change the
contents of the doc variable to leave just the name.