Group:  General ยป microsoft.public.office.xml
Thread: wordml and linked images

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

wordml and linked images
"Marcos" <melugardo[ at ]cambridgesoft.com> 26.10.2005 21:33:07
I have an xsl file that takes two xml files. one is a list of images the
other is data from a database.
the xsl file produces a word document.

the problem is that the images are linked not embedded in the document:
<w:pict>
<v:shape id="_x0000_s1029" type="#_x0000_t75" alt="structure"
style="position:absolute;left:0;text-align:left;margin-left:198.25pt;margin-
top:16.3pt;width:0.80in;height:0.80in;z-index:1;mso-wrap-distance-left:14.4p
t;mso-wrap-distance-right:9.35pt;mso-position-horizontal-relative:text;mso-p
osition-vertical-relative:line">
<v:imagedata src="http://elugardo2/chemcatmgr/cdx/27-0550.emf"/>
<w10:wrap type="square" side="left"/>
</v:shape>
</w:pict>

so when the server the image file is on is no longer available, Word
displays a broken image.
Is there a way for my xsl sheet to specify that the linked image should be
embedded?

even if I save the document after as a word doc, the image will not be
displayed as embedded.

maybe there is way to do this in vb6 after the doc is created? Loop through
the images and set them to be embedded rather than linked?

thanks for the help


Re: wordml and linked images
"llasserre" <llasserre[ at ]gmail.com> 28.10.2005 08:35:52
'lo,
u have a VB solution :
do an update of link (image link) and breack them.
look's like that
Set objWord = CreateObject("WORD.APPLICATION")
With objWord
.Documents.Open FileName:=NomFichierSortie
.Selection.WholeStory
.Selection.Fields.Update
nb = .ActiveDocument.Fields.Count
For i = 1 To nb
.ActiveDocument.Fields(i).Unlink
Next i

Anyway i'm looking for inserting list of image in wordml document,
can u see me how is u'r xsl source to make that ?

Thank's

Re: wordml and linked images
"Marcos" <melugardo[ at ]cambridgesoft.com> 28.10.2005 18:23:17
Thanks I think that will work. Do you know what the performance for this
would be in a large doc?

as an answer to your question:
I use asp to generate an xml file containing the images in a directory:

buildXML Server.MapPath("../cdx"), "emf"

sub buildXML(path,strFileType)

dim fs, ts, folder, item, theExtension

set fs = CreateObject("Scripting.FileSystemObject")
set folder = fs.GetFolder(path)

strFileType = Ucase(strFileType)

strxml = "<files>" & vbCrLf

'get list of files.
for each item in folder.Files
theExtension = UCase(right(item.name, 3))
if theExtension = strFileType then
strxml = strxml & "<file>" & item.name & "</file>" & vbCrLf
end if
next

strxml = strxml & "</files>"
xmlfile = path &"\" & "files.xml"

set ts = fs.CreateTextFile(xmlfile)
ts.write strxml
ts.close
set ts = nothing
set fs = nothing
set folder = nothing
set item = nothing
end sub


then I include that file in my xsl:
<xsl:variable name="structure-root"
select="document('http://localhost/chemcatmgr/cdx/files.xml')"/>

since the file names correspond to the record id name, I make a variable:
<xsl:variable name="catnum">
<xsl:value-of select="concat(ns0:catalogitemnumber,'.emf')"/>
</xsl:variable>

and then I link to the image in the imagedata tag:
<w:pict>
<v:shape id="_x0000_s1037" type="#_x0000_t75" alt="structure"
style="position:absolute;margin-left:198.25pt;margin-top:16.3pt;width:{$stru
ctureprintsize}in;height:{$structureprintsize}in;z-index:3;mso-wrap-distance
-left:14.4pt;mso-wrap-distance-right:9.35pt;mso-position-horizontal-relative
:text;mso-position-vertical-relative:line">
<v:imagedata
src="{concat('http://locahost/chemcatmgr/cdx/',$catnum)}"/>
<w10:wrap type="square" side="left"/>
</v:shape>
</w:pict>

The {} characters make the function execute rather than have it displayed in
the wordml doc.

(the structureprintsize is taken from another xml file in my example)


"llasserre" <llasserre[ at ]gmail.com> wrote in message
news:1130488552.734277.100800[ at ]o13g2000cwo.googlegroups.com...
[Quoted Text]
> 'lo,
> u have a VB solution :
> do an update of link (image link) and breack them.
> look's like that
> Set objWord = CreateObject("WORD.APPLICATION")
> With objWord
> .Documents.Open FileName:=NomFichierSortie
> .Selection.WholeStory
> .Selection.Fields.Update
> nb = .ActiveDocument.Fields.Count
> For i = 1 To nb
> .ActiveDocument.Fields(i).Unlink
> Next i
>
> Anyway i'm looking for inserting list of image in wordml document,
> can u see me how is u'r xsl source to make that ?
>
> Thank's
>


Re: wordml and linked images
"Marcos" <melugardo[ at ]cambridgesoft.com> 28.10.2005 18:29:15
You put me on the right track. The url below has a nice function to do it:
http://west-wind.com/weblog/posts/1178.aspx

"Marcos" <melugardo[ at ]cambridgesoft.com> wrote in message
news:OQHWty%232FHA.2600[ at ]tk2msftngp13.phx.gbl...
[Quoted Text]
> Thanks I think that will work. Do you know what the performance for this
> would be in a large doc?
>
> as an answer to your question:
> I use asp to generate an xml file containing the images in a directory:
>
> buildXML Server.MapPath("../cdx"), "emf"
>
> sub buildXML(path,strFileType)
>
> dim fs, ts, folder, item, theExtension
>
> set fs = CreateObject("Scripting.FileSystemObject")
> set folder = fs.GetFolder(path)
>
> strFileType = Ucase(strFileType)
>
> strxml = "<files>" & vbCrLf
>
> 'get list of files.
> for each item in folder.Files
> theExtension = UCase(right(item.name, 3))
> if theExtension = strFileType then
> strxml = strxml & "<file>" & item.name & "</file>" & vbCrLf
> end if
> next
>
> strxml = strxml & "</files>"
> xmlfile = path &"\" & "files.xml"
>
> set ts = fs.CreateTextFile(xmlfile)
> ts.write strxml
> ts.close
> set ts = nothing
> set fs = nothing
> set folder = nothing
> set item = nothing
> end sub
>
>
> then I include that file in my xsl:
> <xsl:variable name="structure-root"
> select="document('http://localhost/chemcatmgr/cdx/files.xml')"/>
>
> since the file names correspond to the record id name, I make a variable:
> <xsl:variable name="catnum">
> <xsl:value-of select="concat(ns0:catalogitemnumber,'.emf')"/>
> </xsl:variable>
>
> and then I link to the image in the imagedata tag:
> <w:pict>
> <v:shape id="_x0000_s1037" type="#_x0000_t75" alt="structure"
>
style="position:absolute;margin-left:198.25pt;margin-top:16.3pt;width:{$stru
>
ctureprintsize}in;height:{$structureprintsize}in;z-index:3;mso-wrap-distance
> -left:14.4pt;mso-wrap-distance-right:9.35pt;mso-position-horizontal-relati
ve
> :text;mso-position-vertical-relative:line">
> <v:imagedata
> src="{concat('http://locahost/chemcatmgr/cdx/',$catnum)}"/>
> <w10:wrap type="square" side="left"/>
> </v:shape>
> </w:pict>
>
> The {} characters make the function execute rather than have it displayed
in
> the wordml doc.
>
> (the structureprintsize is taken from another xml file in my example)
>
>
> "llasserre" <llasserre[ at ]gmail.com> wrote in message
> news:1130488552.734277.100800[ at ]o13g2000cwo.googlegroups.com...
> > 'lo,
> > u have a VB solution :
> > do an update of link (image link) and breack them.
> > look's like that
> > Set objWord = CreateObject("WORD.APPLICATION")
> > With objWord
> > .Documents.Open FileName:=NomFichierSortie
> > .Selection.WholeStory
> > .Selection.Fields.Update
> > nb = .ActiveDocument.Fields.Count
> > For i = 1 To nb
> > .ActiveDocument.Fields(i).Unlink
> > Next i
> >
> > Anyway i'm looking for inserting list of image in wordml document,
> > can u see me how is u'r xsl source to make that ?
> >
> > Thank's
> >
>
>


Re: wordml and linked images
"llasserre" <llasserre[ at ]gmail.com> 07.11.2005 09:55:18
Hello,
I haven't try atm the performance in large doc.
I have just made an XSL to make a tagged Wordml with just tags Nammed
IMAGE to replace this tags with all the <w:pict .....>.
And replace the <w:bindata ... BAse64 data
by a <xsl:value-of select="." /> so it take Base64 from XmlData.

But i'm going to test u'r methos ... seeme better :>

Thank's anyways
(if u find other things can u mail tem to me ? )

C U

Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net