Mijn vraag is wat de juiste command is via Powershell om iets te plakken in Word met Keep Source Formatting. Mijn script is nu als volgt:
$source1 = 'C:\Temp\LEAReport.doc'
$source2 = 'C:\Temp\UCIReport.doc'
$destination = 'C:\Temp\Done\archive.docx'
$word = New-Object -ComObject word.application
$word.visible = $true
$doc3 = $word.documents.open($destination)
$doc1 = $word.documents.open($source1)
$doc2 = $word.documents.open($source2)
$bookmark1 = $doc3.Bookmarks.Item("LEAreport")
$bookmark2 = $doc3.Bookmarks.Item("UCIreport")
$doc2.Range().Copy()
$bookmark2.Range.Paste()
$doc1.Range().Copy()
$bookmark1.Range.Paste()
$doc1.Close()
$doc2.Close()
$doc3.SaveAs("C:\Temp\Done\archive1.docx")
$doc3.Close()
Door de opmaak van doc3 gaat het bij het plakken van de content van doc2 niet goed. Als je het via Word doet, gaat het wel goed als je Keep Source Formatting gebruikt bij Paste Special. Maar ik weet niet wat de powershell command daarvoor is.
$source1 = 'C:\Temp\LEAReport.doc'
$source2 = 'C:\Temp\UCIReport.doc'
$destination = 'C:\Temp\Done\archive.docx'
$word = New-Object -ComObject word.application
$word.visible = $true
$doc3 = $word.documents.open($destination)
$doc1 = $word.documents.open($source1)
$doc2 = $word.documents.open($source2)
$bookmark1 = $doc3.Bookmarks.Item("LEAreport")
$bookmark2 = $doc3.Bookmarks.Item("UCIreport")
$doc2.Range().Copy()
$bookmark2.Range.Paste()
$doc1.Range().Copy()
$bookmark1.Range.Paste()
$doc1.Close()
$doc2.Close()
$doc3.SaveAs("C:\Temp\Done\archive1.docx")
$doc3.Close()
Door de opmaak van doc3 gaat het bij het plakken van de content van doc2 niet goed. Als je het via Word doet, gaat het wel goed als je Keep Source Formatting gebruikt bij Paste Special. Maar ik weet niet wat de powershell command daarvoor is.
If we are all God's children, what makes Jesus so special?
Battle.net tag