Jump to content



Photo

ExcelEX


  • Please log in to reply
7 replies to this topic

#1 golfinhu

golfinhu

    Wayfarer

  • Active Members
  • Pip
  • 94 posts

Posted 11 August 2012 - 10:14 PM

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:
AutoIt         
#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)

Attached Files


Edited by golfinhu, 11 August 2012 - 10:15 PM.






#2 golfinhu

golfinhu

    Wayfarer

  • Active Members
  • Pip
  • 94 posts

Posted 14 August 2012 - 05:07 AM

someone tested?
noticed a bug?
please report it to me!

#3 kalel69

kalel69

    Seeker

  • Active Members
  • 16 posts

Posted 20 August 2012 - 02:09 PM

MOST EXCELLENT!

I've already tried and tested, as you know golfinhu, this one: _ExcelReadSheetToArrayEX($oExcel, $iStartRow = 1, $iStartColumn = 1, $iRowCnt = 0, $iColCnt = 0, $iColShift = 0)

Its extremely fast, 10 x 's as fast actually, if not faster, and works GREAT! I'm not sure what corners you cut to increase the time, but man, it produces the same results, and 1000x faster!
I use it most every one of my apps I build for work. I can't think you enough. As you know, I requested you to do the same with the_ExcelWriteSheetFromArrayEx

But this is even better. So many newer faster functions to play with. I can't wait to get my hands on them! Its like its my birthday!
As soon as I get a chance to test the new ones above, I'll post back here and let you know. Thanks again!

#4 Dizzy

Dizzy

    Polymath

  • Active Members
  • PipPipPipPip
  • 214 posts

Posted 01 September 2012 - 07:27 AM

Hi golfinhu,

perfect !!!! :ILA2:

I can't belive the speed.
Please keep on working at the other functions.

Thanks for sharing!

Greets
Dizzy

#5 ptrex

ptrex

    Universalist

  • MVPs
  • 2,399 posts

Posted 03 September 2012 - 08:47 AM

@golfinhu

The ExcelEx in the Zip file seems broken and can't be extracted ?

rgds
ptrex

#6 Spiff59

Spiff59

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 1,312 posts

Posted 30 September 2012 - 09:26 PM

Rename the downloa

@golfinhu

The ExcelEx in the Zip file seems broken and can't be extracted ?

rgds
ptrex

Rename the downloaded file to ExcelEx.rar.gz. Extracting that will result in a ExcelEX.rar file that will then extract correctly.

#7 water

water

    ?

  • MVPs
  • 10,691 posts

Posted 30 September 2012 - 09:29 PM

I downloaded the ExcelEX.rar file to Windows 7 today and was able to unrar/unzip it using 7Zip without problems.

UDFs:

Active Directory (2012-10-12 - Version 1.3.0.0 released) - Download - General Help & Support - Example Scripts - Wiki

OutlookEX (2012-10-07 - Version 0.9.0.0 released) - Download - General Help & Support - Example Scripts - Wiki

ExcelChart (2013-01-21 - Version 0.3.1.1 released) - Download - General Help & Support - Example Scripts

WordEX (2012-12-29 - Version 1.3 released) - Download

ExcelEX (2013-05-11 - Alpha 4 released) - Download


#8 Spiff59

Spiff59

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 1,312 posts

Posted 30 September 2012 - 09:51 PM

I downloaded the ExcelEX.rar file to Windows 7 today and was able to unrar/unzip it using 7Zip without problems.

I know, downloading compressed files off the forum still works for many of us, but as of a few months ago, not for some of us. Both my work and home machines have the problem, BrewManNH has a machine with the problem, and apparently ptrex too. if I searched around the forums I could probably find a dozen "Your zip file is bad!" comments related to the issue. Compressed files downloaded from the forum are coming down compressed a second time in the GZip format. I started a thread in the "chat" forum about it.

Edit: Using 7Zip may also be a work-around for the issue, as I only have WinZip and WinRar installed.

Edited by Spiff59, 30 September 2012 - 09:57 PM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users