Search the Community
Showing results for tags 'line break'.
-
I'm trying to write data from array into .text file with line break and i did it successfully. but now I want to write from the same array into already empty excel with with line breaks means each value of array should be written in next cell automatically as it's happening in text file using "Filewrite" Looking for guidance. Here is my code; $file = fileopen(@scriptdir & "\source.txt", 10) $IE = _IECreate("http://www.example.com") $source = _IEDocReadHTML($IE) FileWrite($file, $source) $target_source1 = _StringBetween($source, '<span>', '</span>') If Not @error Then For $i=0 To UBound($target_source1) -1 FileWrite (@scriptdir & "\save.txt", $target_source2[$i] & @crlf) ; I want to write above array onto excel file Next EndIf
-
Hi, im writing from an array to an excel sheet and want to use line breaks. The following piece of code does not do this job (instead of the line break the "[...]chr(10)[...]" is displayed in the cell: #include <Array.au3> #include <Excel.au3> #include <MsgBoxConstants.au3> ; Create application object and create a new workbook Local $oAppl = _Excel_Open() If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeWrite Example", "Error creating the Excel application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended) Local $oWorkbook = _Excel_BookNew($oAppl) If @error Then MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeWrite Example", "Error creating the new workbook." & @CRLF & "@error = " & @error & ", @extended = " & @extended) _Excel_Close($oAppl) Exit EndIf ; ***************************************************************************** ; Write a 1D array to the active sheet in the active workbook ; ***************************************************************************** Local $aArray1D[3] = ['"Zeile 1 " & vbLf & " Zeile 2"', 'B', 'CC'] _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, $aArray1D, "A3") If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeWrite Example 2", "Error writing to worksheet." & @CRLF & "@error = " & @error & ", @extended = " & @extended) MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeWrite Example 2", "1D array successfully written.") What am i doing wrong? Any help is appreciated. Best regards Daniel
-
Im trying to edit a file, I want to find a string which has a line break in it, and replace it with a string that has multiple line breaks in it. editfile.txt looks like this: dog cat mouse chicken my au3 script looks like this but is not working, i suspect because of how I am trying to do the line breaks? Func EditFile($CurrentFile) $szFile = "$CurrentFile" $szText = FileRead($szFile,FileGetSize($szFile)) $szText = StringReplace($szText, "Cat" & @CRLF & "Dog", "Hippo" & @CRLF "Lion" & @CRLF & "Tiger") FileDelete($szFile) FileWrite($szFile,$szText) EndFunc ;--EditFile-- But once ran the file should look like this: Hippo Lion Tiger cat mouse chicken I cannot replace by line number as the animals are not in the same line in each copy of the file i want to run against. Can anyone help?
- 2 replies
-
- line break
- stringreplace
-
(and 1 more)
Tagged with: