Hi everybody i have implemented this code to detect more than one image: #define Word_File hb_dirbase() + "MyFileTxt.docx"
procedure Main
local oWord
local oDoc
local oImgs
local oShape
oWord := Win_OleCreateObject( "Word.Application" )
oWord:Visible := .T.
oDoc := oWord:documents:open( Word_File )
if oDoc:InlineShapes:Count > 0
oImgs := oWord:Documents:Add()
for each oShape in oDoc:InlineShapes
oShape:Range:CopyAsPicture()
oImgs:Paragraphs:Add()
oWord:Selection:Paste()
endfor
endif
oWord := NIL
return
it just only works with one image and when i tested with more than one image i got this erroe:
Error 121896500/0 S_OK: PASTE
why and how i can modify this code to make it able to work with more than one image
oWord:Selection:Paste()
On Wednesday, April 5, 2023 at 1:42:41 PM UTC-7, Silvester Roklasfonoshio wrote:Thank you very much for your answer my dear brother ...it works perfectly with one image i mean when the word document has one image it can correctly extract that image and paste it in new word document but when the document has more than one image it
Hi everybody i have implemented this code to detect more than one image: #define Word_File hb_dirbase() + "MyFileTxt.docx"
procedure Main
local oWord
local oDoc
local oImgs
local oShape
oWord := Win_OleCreateObject( "Word.Application" )
oWord:Visible := .T.
oDoc := oWord:documents:open( Word_File )
if oDoc:InlineShapes:Count > 0
oImgs := oWord:Documents:Add()
for each oShape in oDoc:InlineShapes
oShape:Range:CopyAsPicture()
oImgs:Paragraphs:Add()
oWord:Selection:Paste()
endfor
endif
oWord := NIL
return
it just only works with one image and when i tested with more than one image i got this erroe:
Error 121896500/0 S_OK: PASTE
why and how i can modify this code to make it able to work with more than one imageYou are copying from oWord, and creating and instance in oImgs, but then...
oWord:Selection:Paste()
Is that right? I don't do this, so I don't see how you are directing output images to oImgs... just throwing it at the Word.Application and hoping for it to know what you meant to happen.
David A. Smith
في الخميس، 6 أبريل 2023 في تمام الساعة 8:07:14 م UTC+4، كتب dlzc رسالة نصها:just paste the first image and give me the previous error i show you previously :
On Wednesday, April 5, 2023 at 1:42:41 PM UTC-7, Silvester Roklasfonoshio wrote:
Hi everybody i have implemented this code to detect more than one image: #define Word_File hb_dirbase() + "MyFileTxt.docx"
procedure Main
local oWord
local oDoc
local oImgs
local oShape
oWord := Win_OleCreateObject( "Word.Application" )
oWord:Visible := .T.
oDoc := oWord:documents:open( Word_File )
if oDoc:InlineShapes:Count > 0
oImgs := oWord:Documents:Add()
for each oShape in oDoc:InlineShapes
oShape:Range:CopyAsPicture()
oImgs:Paragraphs:Add()
oWord:Selection:Paste()
endfor
endif
oWord := NIL
return
it just only works with one image and when i tested with more than one image i got this erroe:
Error 121896500/0 S_OK: PASTE
why and how i can modify this code to make it able to work with more than one imageYou are copying from oWord, and creating and instance in oImgs, but then...
oWord:Selection:Paste()
Is that right? I don't do this, so I don't see how you are directing output images to oImgs... just throwing it at the Word.Application and hoping for it to know what you meant to happen.
David A. SmithThank you very much for your answer my dear brother ...it works perfectly with one image i mean when the word document has one image it can correctly extract that image and paste it in new word document but when the document has more than one image it
Error 121896500/0 S_OK: PASTEIam still waiting for your answer my dear brother .
and i dont know why ? so what do suggest ? where is the problem exactly ?
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 251 |
Nodes: | 16 (0 / 16) |
Uptime: | 156:30:23 |
Calls: | 5,528 |
Calls today: | 1 |
Files: | 11,672 |
Messages: | 5,099,109 |