C#提取物通过OLEDB格式的文本从Excel [英] C# extract formatted text from Excel through OLEDB

查看:127
本文介绍了C#提取物通过OLEDB格式的文本从Excel的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从一个大的已经格式化了文本 Excel中文件中读取数据。我提取数据到数据表通过对象的OleDbConnection &安培; 于GetOleDbSchemaTable 。但所提取的数据不包括任何格式的信息。



我的要求是,我需要提取唯一的非删除线的文本。



我没有任何问题的同时阅读和一切是完全没有问题。但我的提取应 Excel中这我无法找到解决方案是基于文本格式。



什么要在添加的的connectionString 这是如下:

 的connectionString =供应商= Microsoft.ACE.OLEDB.12.0;数据源=+文件名+;扩展属性= \的Excel 12.0的Xml; HDR = YES;模式=读;只读= TRUE; \; 



约束:




  1. 使用的OleDbConnection - 无互操作


  2. 从阅读中DataTable对象



解决方案

要尽我所知,你不能只用ACE驾驶员做到这一点。话虽这么说,如果约束不断提升,这是使用工具:
的http:// closedxml。 codeplex.com/


I am reading data from a large excel file which has got formatted texts. I extract the data to DataTable object through oleDBConnection & GetOleDbSchemaTable. But the extracted data doesn't include any formatted information.

My requirement is, I need to extract only non-Strikethrough texts.

I don't have any issues while reading and everything is perfectly fine. But my extraction should be based on text format in excel which I am unable to find the solution.

Anything to be added in the connectionString which is as follows:

connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + fileName + "; Extended Properties=\"Excel 12.0 Xml;HDR=YES;Mode=Read;ReadOnly=True;\"";

Constraints:

  1. Using OleDBConnection - No Interop

  2. Reading to DataTable Object

解决方案

To the best of my knowledge, you cannot do this with just the ACE driver. That being said, if the constraints are ever lifted, this is the tool to use: http://closedxml.codeplex.com/

这篇关于C#提取物通过OLEDB格式的文本从Excel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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