Jump to content

Mrtn

Members
  • Posts

    4
  • Joined

  • Last visited

Everything posted by Mrtn

  1. Thanks for the tip water, i will implement this in my code, however the cells in my excel document are filled with autoit, so I know that they are empty. Maybe it is better to construct a string with my array and then write the consctructed string to word?
  2. there are blank cells in my excel dcument indeed, those array elements are empty. I did check for empty array elements by For $j = 0 To UBound($aStreng) - 1 If IsObj($oWordApp) Then If $aStreng[$j] = "" Then ;<----- check if array element is empty MsgBox(0, "", "leeg") $oWordApp.Selection.TypeText("empty") $oWordApp.Selection.TypeParagraph Else $oWordApp.Selection.TypeText($aStreng[$j]) $oWordApp.Selection.TypeParagraph EndIf ConsoleWrite($aStreng[$j] & @CRLF) EndIf Next if i run this, the loop stops after the first empty array element? ("empty" is typed in word document) I'm out of clues...
  3. I need some help here, I'm having trouble with my Word object: Arrays are filled, word document opens fine, $oWordApp is object , first loop "For $j = 0" works (first array element is processed in Word) but then I get the following error : The requested action with this object has failed.: $oWordApp.Selection.TypeText($aStreng[$j]) $oWordApp.Selection.TypeText($aStreng[$j])^ ERROR i'm a little bit lost here.. please help oh, and the code : If FileExists($sFilePath1) Then ;---> check of bestand bestaat If WinExists($Project & " Strenggegevens.xls") Then MsgBox(262144, "", "Excel bestand is open") WinClose($Project & " Strenggegevens.xls") WinWaitClose($Project & " Strenggegevens.xls") $oExcel = _ExcelBookOpen($sFilePath1) Else ;---> open excel bestand $oExcel = _ExcelBookOpen($sFilePath1) EndIf Else MsgBox(262144, "error", "Strenggegevens bestaan niet, aan het werk luie hond! ;)", 2) EndIf If IsObj($oExcel) Then $nStrengen = _ExcelReadCell($oExcel, 1, 1) $oWordApp = _WordCreate($templateWord) $oWordApp.activedocument.SaveAs($sDirProjecten & $Project & "\" & $Project & " StrengRapport.doc") For $i = 4 To $nStrengen $aStreng = _ExcelReadArray($oExcel, $i, 1, 33) ;~ _ArrayDisplay($aStreng) For $j = 0 To UBound($aStreng) - 1 If IsObj($oWordApp) Then ;<--- control line!! $oWordApp.Selection.TypeText($aStreng[$j]) $oWordApp.Selection.TypeParagraph Sleep(100) ConsoleWrite($aStreng[$j] & @CRLF) EndIf Next $oWordApp.Selection.TypeParagraph Next $oWordApp.Selection.TypeParagraph $oWordApp.Selection.TypeText("----------------") $oWordApp.Selection.TypeParagraph $oWordApp.Selection.TypeText("totaal aantal strengen = " & $nStrengen) Endif
  4. the _AreaPoly() function which returns the area of a closed polygon, have been included. Someone might find a use for them oneday. Hi, i'm following this topic a little bit. Currently i'm trying to make a GUI with area info of calculated geometry. I rewrote the _AreaPoly() a little bit so it is of use (for me) with the GDI+ polygons. Func _AreaPoly(ByRef $aPoints) Local $Med, $size $size = UBound($aPoints) Local $sPolygon[$size][2] $aPolygon = $aPoints ReDim $aPolygon[$size + 1][2] $aPolygon[$size][0] = $aPolygon[1][0] $aPolygon[$size][1] = $aPolygon[1][1] For $n = 1 To UBound($aPolygon) - 2 $Med += $aPolygon[$n][0] * $aPolygon[$n + 1][1] - $aPolygon[$n + 1][0] * $aPolygon[$n][1] Next $Med /= 2 Return $Med EndFunc ;==>_AreaPoly
×
×
  • Create New...