Jump to content
Sign in to follow this  
waldoo

how can i send crlf to word07?

Recommended Posts

waldoo

hello autoit community! ;)

this is my problem, i tried several things but i can't seem to get it to work:

when i try to write some text into a word07 file i can't create a carriage return/line feed. all i get is some text or squares:

$template = @ScriptDir & "\somefilewithastarinit.doc"
$oWord = ObjCreate("Word.Application")                      
$oWord.Visible = 1                                  
$oWordDocuments = $oWord.Documents                      
$oWordDocument = $oWordDocuments.Open($template)    

_WordDocFindReplace($oWordDocument,"*","line1" & @crlf & "line2" & @cr & "line3" & '<crlf>' & "line4" & 0x0D & 0x0A & "line5",1,0,0,1)

results in a text in the word file looking like this:

line1[][]line2[]line3<crlf>line41310line5 :)

([] here represents a square, as you see none of the four ideas works)

as you can imagine, what i want is that:

line1

line2

line3

line4

line5

i bet there's one autoit-guru out there who knows that... B)

Share this post


Link to post
Share on other sites
water

See the Remarks for Function _WordDocFindReplaceRemarks:

"You can search for special characters by specifying appropriate character codes. For example, "^p" corresponds to a paragraph mark and "^t" corresponds to a tab character.

You specify special characters and advanced search criteria just as you do for the Find argument."

According to word a manual line feed is "^l".

Hope this helps


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
waldoo

:)

great... this is exactly what i was looking for (in the last three hours...) ^^

thank you!

Share this post


Link to post
Share on other sites
water

Glad to be of service :)

Just for the records:

A list of codes can be found here. Paragraph "Codes for items you want to find and replace".


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.