Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ExcelSheet.GetCells faster
#1
Is possible?
#2
Member function ExcelSheet.GetCellsFast
Code:
Copy      Help
function ARRAY(str)&a [$range] ;;range examples: "" (all), "sel" (selection), "A1:C3" (range), press F1 to see more.

;Gets whole or part of worksheet into array.

;a - variable for data.
;;;This function creates array of 2 dimensions.
;range - specifies part of worksheet from which to get data. Default: "" - all (used range).
;;;Examples: "sel" (selection in active sheet), "A1:C3" (range), "A:C" (columns A, B and C), "3:3" (row 3), "A1" (cell), "Named" (named range).

;See also: <FE_ExcelRow>.

;Errors: _error

;EXAMPLE
;;display selected cells
;ARRAY(str) a
;ExcelSheet es.Init
;es.GetCellsFast(a "sel")
;int r c
;for r 0 a.len
,;out "-----Row %i-----" r+1
,;for c 0 a.len(1)
,,;out a[c r]


if(!ws) Init

int i j nr nc
Excel.Range r cell

GetRange(range r nr nc)

ARRAY(VARIANT) av=r.Value

a.create(av.len av.len(1))
for i 0 a.len
,for j 0 a.len(1)
,,a[j i]=av[i+1 j+1]

err+ E

In next QM will add flag "fast" to GetCells.
#3
Thanks.
#4
Is not easier to replace the function directly?
#5
May not work with some sheets, or get some values different.
#6
Thanks again.
#7
In QM 2.3.3 I want to replace GetCells code with this faster code.
Questions to all using GetCellsFast and SetCellsFast.

1. Are these functions reliable?
2. Did you ever notice some differences between GetCells and GetCellsFast? For example, maybe values of some cells are different.

Now I don't remember why I did not use this faster code in GetCells. Maybe just because did not test speed with large worksheets.
#8
In principle, the two functions work ok.

I use a mixture of both.

One suggestion, if possible, I would create a function (SetCell) for changing ColorIndex, font size and style, border ...


Forum Jump:


Users browsing this thread: 1 Guest(s)