如何将Lotus Range值放入数组 [英] How to get Lotus range values into array

查看:151
本文介绍了如何将Lotus Range值放入数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Lotus 123中是否有一种快速方法可以将范围内的所有单元格值都放入数组.我正在寻找类似于Excel VBA的东西,它的速度非常快.

Is there a fast method in Lotus 123 to get all cell values in a range into an array. I'm looking for something similar to Excel VBA where it's very fast.

Dim arrValues() As Variant
arrValues = rg.Value

生成的数组也可以被操纵并放回表中;就我而言,我想将其放入Excel.基本上取代复制和粘贴.在内存中的数组上进行操作比一次处理一个单元要快得多.

The resulting array can also be manipulated and put back into the sheet; In my case I want to then put it into Excel. Basically replacing copy and paste. Operating on an array in memory is much faster than manipulating cells one at a time.

我知道如何通过一次读取一个单元格来做到这一点,但是我正在寻找一种类似于Excel的更快方法.

I know how to do it by reading cells one at a time but I'm looking for a faster method similar to Excel.

'Lotus Script
Dim r As Range
Set r = CurrentDocument.Ranges("A:A1..A:D4")
Dim x, y As Integer
For x = 0 To 3
    For y = 0 To 3
        Print (r.Cell(x, y).cellvalue)
    Next
Next

请注意,我不是特别用VBA进行标记,因为只有知道Lotus Script的人才能回答.这与VBA无关.

Note that I'm specifically NOT tagging with VBA because this can only be answered by someone that knows Lotus Script. This is NOT about VBA.

如何将Lotus 123范围值放入数组中?

How do I get Lotus 123 range values into array?

推荐答案

在帮助文件Range.GetCellData方法中发现了此问题.

Found this in help files: Range.GetCellData method.

获取一个范围内的数据,该数据被引用为指向单个单元格内容的一组指针.此方法分配用于复制范围内容的内存,在内存中设置值,并返回可由外部C程序使用的数组指针.

Gets the data in a range, referenced as a set of pointers to the contents of individual cells. This method allocates memory for copying the contents of the range, sets the values in memory, and returns an array pointer that can be used by an external C program.

语法

arraypointer = range.GetCellData(celldatatype)

arraypointer = range.GetCellData(celldatatype)

参数单元格数据类型

Variant(CellDataType枚举).返回的单元格数据的格式.下表列出了此参数的允许值.

Variant (CellDataType enumeration). The format for the returned cell data. The following table lists the allowed values for this parameter.

值和说明

  • $ CellValue 返回指向字符串数组的指针.字符串包含单元格求值的格式值.空白单元格将导致NULL指针.
  • $ FormulaContents 返回指向字符串数组的指针.这类似于 $ CellValue(字符串除外)是公式单元格的内容(例如,"+ A1 + @ SUM(B1)").所有其他类型的单元格都将导致NULL指针.
  • $ Double 返回指向双精度数组的指针.空白单元格和标签将返回零. NA和ERR被编码为无效数字.
  • $CellValue Return a pointer to an array of strings. The strings contain the formatted values that the cells evaluate to. Blank cells result in NULL pointers.
  • $FormulaContents Return a pointer to an array of strings. This is similar to $CellValue, except the strings are the contents of formula cells (for example, "+A1+@SUM(B1)"). All other types of cells result in NULL pointers.
  • $Double Return a pointer to an array of doubles. Blank cells and labels are returned as zero. NA and ERR are encoded as invalid numbers.

返回值:

长.指向指针数组的指针,范围内的每个单元格一个.数组按行/列/表排序.例如,代表范围[A:A1..B:B2]的数组将以以下顺序给出:A:A1,A:A2,A:B1,A:B2,B:A1,B:A2,B: B1,B:B2.

Long. A pointer to an array of pointers, one for each cell in the range. The array is ordered by row/column/sheet. For example, an array representing the range [A:A1..B:B2] would be given in the order A:A1, A:A2, A:B1, A:B2, B:A1, B:A2, B:B1, B:B2.

用法

此方法在内部为返回的数组分配内存,并且调用方必须释放该内存.

This method allocates the memory for the returned array internally, and the caller must free that memory.

这篇关于如何将Lotus Range值放入数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆