通过Columnwise使用OpenXML读取Excel文件 [英] Read Excel file using OpenXML by Columnwise

查看:73
本文介绍了通过Columnwise使用OpenXML读取Excel文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我在Excel中错过了匹配的列数 EX:我的Excel文件标题行包含10列,预计5行拥有相同的10列,但下一行包含12列。

I  m having miss matched counts of columns in my excel EX: my excel file header row contains 10 columns and forecoming 5 rows having same 10 columns but the next row contains 12 columns .

所以如果我能逐列读取excel,感觉会更好,所以请帮助我解决这个问题。

So I feel better if I can read excel columnwise ,so plase help me to resolve this problem.

提前致谢




 

推荐答案

根据描述,您希望按列读取数据。据我所知,当我们使用Open XML读取单元格值时,我们需要先按行查找数据,然后我们可以按列读取数据。因为XML中的数据存储如下所示,行
元素在sheetdata元素中只是子元素:

Based on the description, you want to read the data by column. As far as I know, when we read the cell value using Open XML, we need to find the data by row first, then we can read the data by column. Because the data store in XML is like below, the row element is only child in the sheetdata element:

<?xml version="1.0" encoding="UTF-8" ?> 
<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
    <sheetData>
        <row r="1">
            <c r="A1">
                <v>100</v> 
            </c>
        </row>
    </sheetData>
</worksheet>

您可以从以下链接获得有关Open XML开发的更多详细信息:

You can get more detail about Open XML developing from link below:

如何:将文本插入电子表格文档中的单元格(Open XML SDK)

电子表格(Open XML SDK)

了解Open XML文件格式

祝你好运

Fei


这篇关于通过Columnwise使用OpenXML读取Excel文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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