ciao a tutti,
un cortesia vorrei poter inserire un jpg dentro un file RTF di word nel posto che voglio io:
ho trovato questo codice ma non mi da la possibilità di specificare dove inserire jpg in piu vorrei che il file non viene salvato ma aperto prima poi dicedo io se salvare o meno:
qui sotto il codice... grazie per ogni risposta
<%
Function ZeroPad(vItem, nLen)
ZeroPad = vItem
Do While Len(ZeroPad) < nLen
ZeroPad = "0" & ZeroPad
Loop
End Function
Set oFS = Server.CreateObject("Scripting.FileSystemObject")
Set oRTF = oFS.CreateTextFile(Server.MapPath(".") & "\test.rtf", True)
oRTF.WriteLine("{\rtf1")
'Write the font table
sRTF = "{\fonttbl {\f0\froman\fcharset0 Times New Roman;}" & _
"{\f1\froman\fcharset0 Times New Roman;}" & _
"{\f2\fmodern\fcharset0 Courier New;}}"
oRTF.WriteLine sRTF
'Write the title and author for the document properties
oRTF.WriteLine "{\info{\title Output to RTF}{\author SomeGuy}}"
oRTF.WriteLine "this is a jpeg>>>"
'JPEG Header thing
oRTF.WriteLine "{\*\shppict{\pict\jpegblip"
'Our JPEG file to read
Set oPic = oFS.OpenTextFile(Server.MapPath(".") & "\test.jpg", 1, False)
'Transform binary to a BLIP
sData = ""
Do While Not oPic.AtEndOfStream
sData = sData & LCase(ZeroPad(Hex(Asc(oPic.Read(1))),2))
If Len(sData) Mod 128 = 0 Then
oRTF.WriteLine sData
sData = ""
End If
Loop
If Len(sData) > 0 Then
oRTF.WriteLine sData
End If
'End of JPEG Header
oRTF.WriteLine "}}"
oRTF.WriteLine "<<<"
oRTF.WriteLine "}"
%>

Rispondi quotando