Excel中:转储单元属性阵列阵列、单元、属性、Excel

由网友(小3让我看清楚了妳的爱°)分享简介:我知道我可以快速地倾倒Excel单元格的值到这样一个数组:I know I can quickly dump the values of excel cells into an array like so:object[,] values = workSheet.UsedRange.Value2 as object...

我知道我可以快速地倾倒Excel单元格的值到这样一个数组:

I know I can quickly dump the values of excel cells into an array like so:

object[,] values = workSheet.UsedRange.Value2 as object[,];

我可以做类似的细胞比它们的值等属性的东西吗?例如,我想获得单元格颜色,但对象[,] CC = workSheet.UsedRange.Interior.Color为对象[,]; 的结果 CC 被空。

通过纸张循环获得细胞的属性发生数量级以上。

Looping through the sheet to get cell attributes takes orders of magnitude longer.

推荐答案

虽晚不迟。简单地说,如果没有一个code存根,

Better late than never. Briefly, in absence of a code stub,

保存表为XML格式的文件。读取该文件与XML阅读器,查询XML对象styleID(或你想要或需要的东西)。查询styleID的颜色attrbiute,并匹配了相同的每个细胞。 LINQ查询XML的数据库应该只需要几行做到这一切。

Save the sheet as an xml formatted file. Read the file in with an xml reader, query the xml object for styleID (or anything else you want or need). Query the styleID's for color attrbiute, and match up same to each cell. LINQ queries on xml database should need only a couple of lines to do all this.

阅读全文

相关推荐

最新文章