Jump to content

how can i send crlf to word07?


waldoo
 Share

Recommended Posts

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)

Link to comment
Share on other sites

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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...