Lade...
 

Ansteuerung von Word

Ansteuerung von Word

Kopieren von Textblöcken mit InstantView®

 

Inserting of text into a word document: If you want to copy a word document into another word document, use either copy & paste or FormattedText (property of Selection and Range). Example: There are two documents: srcDocument and dstDocument. You want to copy srcDocument into dstDocument. 1) Put srcDocument at the end of dstDocument Var(srcRange) srcDocument Call(GetContent) -> srcRange // srcRange holds the complete srcDocument as Range object Var(dstRange) dstDocument Call(GetContent) -> dstRange // dstRange holds the complete dstDocument as Range object 0 dstRange Call(Collapse) // shrink dstRange to the end srcRange dstRange Call(PutFormattedText) // copy srcRange to dstRange and take care of format information // => appends srcRange to dstRange If you leave out 'Call(Collapse)', dstDocument will be replaced by srcDocument. 2) Put srcDocument at the current selection Var(srcRange) srcDocument Call(GetContent) -> srcRange // see above Var(dstSelection) dstDocument Call(GetAppliction) call(GetSelection) -> dstSelection // gets the current selection (= cursor) 0 dstSelection Call(Collapse) // shrink the selection to the place after the current selection // => the cursor is placed directly after the current selection srcRange dstSelection Call(PutFormattedText) // inserts srcRange at the new cursor position Here 'Call(Collapse)' is important because Word does not copy correctly when dstSelection spans more than 0 characters.