查询Excel电子表格以获取单元格格式....(百分比) [英] Query excel spreadsheet for cell format.... (percentage)

查看:176
本文介绍了查询Excel电子表格以获取单元格格式....(百分比)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用.Net 4.0和excel 2003

我如何使用oledb连接来检索excel电子表格的单元格格式...我特别想确定单元格列(或单元格本身)是否为数字百分比格式.

我似乎在 GetOleDbSchemaTable <中找不到此信息/a>方法.

例:我的Web应用程序从excel电子表格中读取数字.这很好用;但是,如果数字以百分比格式显示,则excel将其显示为(fraction * 100),但实际值是小数点后的分数(1/3 = .3333 ..)-Excel显示为33.33%-(请注意小数点).

因此,我需要一种区分百分比和百分比的方法.是什么让我的webapp无法正常工作...

有什么想法吗?
在此先感谢.....

I am using the .Net 4.0 and excel 2003

How can i use an oledb connection to retrieve the cell format of an excel spreadsheet... I specifically want to find out if a cell column (or cell itself) is in a numeric percentage format.

I cannot seem to find this information in the GetOleDbSchemaTable method.

EX: My web app reads numbers from an excel spreadsheet. This works fine; However, if the numbers are in a percentage format, excel displays it as (fraction*100) but the actual value is a fractional decimal (1/3 = .3333..) - Excel displays as 33.33% - (Notice the decimal point).

Therefore, i need a way of distinguishing between what is a percentage & what is not to allow my webapp to work properly...

Any ideas?
Thanks in advance.....

推荐答案

不只是百分比格式,在尝试读取Excel单元格值时可能引起问题.看看此MSDN文章 [
There are more than just percentage formats that can cause issues when trying to read Excel cell values. Take a look at this MSDN article [^]on retrieving cell values; it has a lot of useful code snippets.


这篇关于查询Excel电子表格以获取单元格格式....(百分比)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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