Search the Community
Showing results for tags 'excelwritesheettoarrayex'.
-
Firs of all, i'm sorry for my bad english, but i'm brazilian! I've modified many functions of Excel.au3 to make it much more fast and created anothers functions the function list is above: Functions inside UDF: _ExcelColumnLetter($iColumn) _ExcelColumnNumber($sColumn) _ExcelFormatR1C1ToA1($iRowFrom, $iColFrom, $iRowTo = "", $iColTo = "") _ExcelFormatA1ToR1C1($sRange) _ExcelReadSheetToArrayEX($oExcel, $iStartRow = 1, $iStartColumn = 1, $iRowCnt = 0, $iColCnt = 0, $iColShift = 0) _ExcelPasteSpecial($oExcel, $sRange, $xPasteType = -4104, $xPasteSpecialOp = -4142) _ExcelFormatPainter($oExcel, $sRangeFrom, $sRangeTo = 0, $xPasteType = -4104, $xPasteSpecialOp = -4142) _ExcelWriteSheetFromArrayEx($oExcel, $aArray, $iStartRow = 1, $iStartColumn = 1, $iArrayRowStart = 0, $iArrayColStart = 0) _ExcelWriteArrayEX($oExcel, $aArray, $iStartRow = 1, $iStartColumn = 1, $iArrayRowStart = 0, $iDirection = 0) if someone wants to fix my specifications can be at ease! in the attached file have a examples of functions! Note: functions that are written by other people and i just modified, i left specified within the UDF I hope it is useful to you, it's much more fast than original functions! Thanks a lot! Examples: #include #include ;Generate an Array Local $aArray[100][15] For $i = 0 To 99 For $j = 0 To 14 $aArray[$i][$j] = "Line: " & $i + 1 & " - Col: " & $j + 1 Next Next ;Create Excel Object Local $oExcel = _ExcelBookNew() ;Write a 2d Array to Excel with default values (start in R1C1 cell and write all itens in array). MsgBox(0,'',"Press OK to write an Array to Excel.") _ExcelWriteSheetFromArrayEx($oExcel, $aArray) $oExcel.ActiveSheet.Columns("A:O").AutoFit ;Format 2 First's lines. MsgBox(0,'',"Press OK to format the 2 first Excel cells.") With $oExcel.ActiveSheet.Range("A1:O100") .Select .HorizontalAlignment = 3 .Borders.LineStyle = 1 EndWith $oExcel.ActiveSheet.Range("A1:O1").Interior.Color = 0xDAC0CC $oExcel.ActiveSheet.Range("A2:O2").Interior.Color = 0xF0B00A $oExcel.ActiveSheet.Range("A2:O2").Font.Bold = True ;Copy this style to all anothers Cells with _ExcelFormatPainter MsgBox(0,'',"Press OK to copy the style of the 2 first's cells to to all anothers cells.") _ExcelFormatPainter($oExcel, "A1:O2", 0, $xlPasteFormats, $xlPasteSpecialOperationNone) $oExcel.ActiveSheet.Range("A1").Select ;Read all data to array MsgBox(0,'',"Press OK to read all cells to and array.") Local $aCells = _ExcelReadSheetToArrayEX($oExcel) _ArrayDisplay($aCells) ;read 3 columns from Excel starting from 5nd and 50 rows starting from 1st row MsgBox(0,'',"Press OK to read 50 rows and 3 cols and to and array.") Local $aCells = _ExcelReadSheetToArrayEX($oExcel, 1, 5, 50, 3) _ArrayDisplay($aCells) _ExcelBookClose($oExcel) ;Create another Excel Object Local $oExcel = _ExcelBookNew() ;Write an Array to Excel Starting from 50 row and 12 col of array and write it starting from 2nd row and 3rd col of excel MsgBox(0,'',"Press OK to write an Array to Excel.") _ExcelWriteSheetFromArrayEx($oExcel, $aArray, 2, 3, 50, 12) MsgBox(0,'',"Press OK to Close.") _ExcelBookClose($oExcel) ;Write an 1D Array Local $oExcel = _ExcelBookNew() Local $aArray[5] = ["LocoDarwin", "Jon", "big_daddy", "DaleHolm", "GaryFrost"] MsgBox(0,'',"Press OK to write an Array to Excel.") _ExcelWriteArrayEX($oExcel, $aArray) ; Write the Array Horizontally _ExcelWriteArrayEX($oExcel,$aArray, 5, 1, 0, 1) ; Write the Array Vertically, starting on the 5th Row MsgBox(0,'',"Press OK to Exit.") _ExcelBookClose($oExcel)ExcelEX.rar