Sign in to follow this  
Followers 0
Blacktongue

Sending large blocks of Text to Word

4 posts in this topic

Hi:

I am another newbie and don't mind spending some time at learning auto it but would appriceiate some general guidance. I am trying to write a treeview gui that lets me select multiple large blocks of text with checkboxes at different levels in the tree and then combines them and sends them all to a WORD document. I am doing okay with the treeview and checkboxes I think, but don't know the best way to insert very large blocks of text into word. The text includes symbols, formats, punctuation marks, etc. ... Is 'send' the only way to do this? This would involve a tremendous amount of formatting details in the code which I would like to avoid.

Thanks, BT

Share this post


Link to post
Share on other sites

#2 ·  Posted (edited)

$file = FileOpen("DocumentNameHere.txt", 9) ;9 means if it doesnt exist it creates the file AND it opens it in write mode adding all new info to the bottom
$text = "Your text here lawl I suppose depending on your text there'd be an easier way..." ;your text
FileWrite($file, $text)   ; writes the info to the new fil

I guess... lol

Beats Send() by a mile

Edited by Foy

Share this post


Link to post
Share on other sites

Send() only simulates keystrokes and there's a delay as they are not instant, also if the user decides to use his keyboard while it's Send()-ing then it screws up the text being sent. ;)

It also can only send to teh active window, FileWrite() sends it almost instantly and silently. :)

Hope that all helps. :P

Share this post


Link to post
Share on other sites

Something like this?

#include <Word.au3>

$sText = FileRead(@WindowsDir & "\WindowsUpdate.log")

$oWordApp = _WordCreate()
$oDoc = _WordDocGetCollection($oWordApp, 0)
$oDoc.Range.Text = $sText

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0