;#FUNCTION#============================================================================================================= ; Name...........: _Array2HTMLTable() ; Description ...: Returns HTML string with a table created from a Autoit array ; Syntax.........: ($aArray, $BodyBGColor = "#ffffff", $HighlightBGColor = "#F0F9FF", $HeaderBGColor = "#007EE5", $BodyTxtColor = "#000000", $HeaderTxtColor = "#ffffff", $HeadersOn = 1) ; Parameters ....: $aArray - The Array to use ; $BodyBGColor - [optional] The Hex color for the table body background. ; $HighlightBGColor - [optional] The Hex color for the highlight background. ; $HeaderBGColor - [optional] The Hex color for the table header background. ; $BodyTxtColor - [optional] The Hex color for the table body Text. ; $HeaderTxtColor - [optional] The Hex color for the table header Text. ; $HeadersOn - [optional] Turns off the header. Headers are the contents found on the first row of the Autoit array if this feature is turned off then ; the frist row of the autoit array is placed into the table body. ; Return values .: Success - The HTML string ; Failure - -1 or -2 depending on the problem ; Author ........: XThrax aka uncommon ; Remarks .......: CSS and JavaScript are use to make the table look nice. If you know a lot more about either you can add to it or manipulate it. I used the code I found on this website. ; http://webdesign.about.com/od/examples/l/bltables.htm ; Related .......: _IETableWriteToArray() ; Link ..........; ; Example .......; No ; ===================================================================================================================== Func _Array2HTMLTable($aArray, $BodyBGColor = "#ffffff", $HighlightBGColor = "#F0F9FF", $HeaderBGColor = "#007EE5", $BodyTxtColor = "#000000", $HeaderTxtColor = "#ffffff", $HeadersOn = 1) If IsArray($aArray) = 0 Then Return -1 Local $aTRlines = '' Local $aTHlines = '' Local $aTDlines = '' Local $BodyStart = 1 Local $TotalRows = UBound($aArray);rows Local $TotalColumns = UBound($aArray, 2);columns Local $CSS = 'table {margin: 1em; border-collapse: collapse; }' & @CRLF & _ 'td, th {padding: .3em; border: 1px #ccc solid; }' & @CRLF & _ 'thead {background: ' & $HeaderBGColor & '; }' & @CRLF & _ 'thead {color:' & $HeaderTxtColor & ';}' & @CRLF & _ 'tbody {background: ' & $BodyBGColor & '; }' & @CRLF & _ 'tbody {color: ' & $BodyTxtColor & '; }' & @CRLF & _ '#highlight tr.hilight { background: ' & $HighlightBGColor & '; } ' Local $JavaScript = "function tableHighlightRow() {" & @CRLF & _ " if (document.getElementById && document.createTextNode) {" & @CRLF & _ " var tables=document.getElementsByTagName('table');" & @CRLF & _ " for (var i=0;i 1 Then $BodyStart = 0 Else If $TotalRows < 2 Then Return -2;there needs to be at least two rows if headers are on For $x = 0 To $TotalColumns - 1 $aTHlines = $aTHlines & ' ' & $aArray[0][$x] & '' & @CRLF Next EndIf For $x = $BodyStart To $TotalRows - 1 $aTDlines = '' For $i = 0 To $TotalColumns - 1 $aTDlines = $aTDlines & ' ' & $aArray[$x][$i] & '' & @CRLF Next $aTRlines = $aTRlines & '' & @CRLF & _ $aTDlines & _ '' & @CRLF Next $HTML = '' & @CRLF & _ ' ' & @CRLF & _ '' & @CRLF & _ '' & @CRLF & _ '' & @CRLF & _ '

' & @CRLF & _ '' & @CRLF & _ '' & @CRLF & _ $aTHlines & _ '' & @CRLF & _ '' & @CRLF & _ '

' & @CRLF & _ $aTRlines & _ '' & @CRLF & _ '
' Return $HTML EndFunc ;==>_Array2HTMLTable