Sign in to follow this  
Followers 0
Shane0000

Simulating a Line Break in Word 2007

3 posts in this topic

#1 ·  Posted (edited)

 a Shift + Enter line break for Word 2007. is chr(11)

#include <word.au3>
$sText = 'Test' & @LF & 'Test' & @CR & 'Test' & @CRLF & 'test' & chr(10) & 'test' & chr(13) & 'test'
$oWord = _Word_Create()
$oDoc = _Word_DocAdd($oWord)
$oRange = $oDoc.Range
$oRange.InsertAfter ($sText)
$iEnd = $oRange.End
_Word_DocSaveAs($oDoc,'c:\test.doc')

hehe dancing all around chr(11)

Edited by Shane0000

Share this post


Link to post
Share on other sites



Is this a question or did you solve your problem?


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

#3 ·  Posted (edited)

It was a question born of too many hours of programming and too few hours of sleep. :)

Answered now thank you, alas there is no button to mark as answered by your self hehe

Edited by Shane0000

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

  • Similar Content

    • anoig
      By anoig
      Hi all, 

      First, I want to give a huge shout-out to the community. I'm completely self-taught, and have never had to actually ask a question before because the forum is that good at answering questions and explaining things. However, I'm kind of stumped here, and I've been stuck on this problem for almost a full day.

      I'm working on a script to populate drafts of deeds at work. I have the main GUI and  a function (ctrl($n) and read()) for adding fields to find and data to replace it with to an array for later use with _word_docfindreplace. All of that works. However, due to the way I have the forms set up, I need to create additional fields and info based on the data that's there. Specifically, if there's only one buyer, I need to add the field [Buyer1&2] and the data in $aArray_Base for [Buyer 1]. I also need to add a field [Buyer 2] and have a blank data set in the next column over in the array, and I need to do the same for the Seller. To this end, the function parties() sets boolean variables $2buyers and $2sellers accordingly. Then, I have buyers() and sellers() to populate the data. 

      The problem that I'm running into is that each function works... when ONLY the buyer 1 name field is filled, and when ONLY the seller 1 field is filled.

      So if I fill Buyer 1 Name and save it, the data is populated correctly. But when I fill Buyer 1 and Seller 1 name, only the buyer 1 data populates correctly. Worse, when I fill several fields, neither populate correctly. I have no idea why this happens. I've added messageboxes to debug throughout the entire process and can't pinpoint what's causing the issue. The entire script is below. The function(s) in question are buyers() and sellers(). Only Sellers() has messageboxes throughout.

      Can someone help walk me through what might be causing this and help me find a solution? Thanks a ton in advance, and sorry for the wall of text.
      -Anoig
       
    • water
      By water
      My computer has been upgraded from Office 2010 to Office 2016.
      Are there any features of Office 2013 or Office 2016 which you now want to see in the Excel, Word or Outlook UDF?
    • Jury
      By Jury
      As near as I can ascertain using the Word UDF the paragraph count does not count the numbered paragraphs in a document but counts something like all paragraphs (numbered , un-numbered, indented) minus empty lines.  Is there any easy way of getting the first level numbered paragraph numbers?  You'll see in my test document there are just 7 numbered paragraphs.
      #include <Word.au3> #include <Array.au3> Local $oWord = _Word_Create() Local $sDocument = @MyDocumentsDir & "\test.docx" Local $oDoc = _Word_DocOpen($oWord, $sDocument, Default, Default, True) $oRange = $oDoc.Range $sText = $oRange.Text $aLines = StringSplit($sText, @CR) _ArrayDisplay($aLines) $wdPropertyParas = 24 $sParas = $oDoc.BuiltInDocumentProperties($wdPropertyParas).Value $sParas = $sParas ConsoleWrite($sParas & @CRLF)  
      test.docx
    • FrancescoDiMuro
      By FrancescoDiMuro
      Good morning everyone
      I was talking about this UDF in this thread, but for not confusing "arguments", I opened a new thread...
      So, the issue I'm having, is the format of the table, that you can see in the image above... Can you help me out please? Thanks  
      Text of the previous post:
       
      Local $oWord = _Word_Create(False)             If @error Then                 MsgBox($MB_ICONERROR, "Errore!", "Errore durante la creazione dell'oggetto Word." & @CRLF & "Errore: " & @error)             Else                 ; The field alreay exists, but would be nice if I can create it... I thought at _FileCreate() :)                 Local $oDoc = _Word_DocOpen($oWord, $sCartellaModelli & "\Esportazione_Modello.doc")                 If @error Then                     MsgBox($MB_ICONERROR, "Errore!", "Errore durante l'aggiunta di un nuovo documento Word." & "Errore: " & @error)                 Else                     Local $oRange = _Word_DocRangeSet($oWord, 0)                     If @error Then                         MsgBox($MB_ICONERROR, "Errore!", "Errore durante il settaggio del range nel documento Word." & @CRLF & "Errore: " & @error)                     Else                         _Word_DocTableWrite($oRange, $aListView, Default)                         If @error Then                             MsgBox($MB_ICONERROR, "Errore!", "Errore durante la creazione della tabella." & @CRLF & "Errore: " & @error & "Informazioni: " & @extended)                         Else                             _Word_DocSaveAs($oDoc, $sCartellaEsportazioni & "\Esportazione_di_prova.doc")                         EndIf                     EndIf                 EndIf             EndIf And this is the actual result: