Silverlight读取Excel文件

London_2012cl 2012-07-05 06:08:54
因Silverlight不支持Ado.net,不能把Excel当做是数据源来操作,请教有什么其他的办法直接操作Excel文件吗?我就是想读取Excel文件中行和列的数据。
...全文
414 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
我要有出息 2014-07-14
  • 打赏
  • 举报
回复
引用 5 楼 London_2012cl 的回复:
昏,我自己研究出来了,其实很简单啊。。。。竟然没有多少人知道。
楼主,是什么方法?我也急需解决这个问题呢,求分享
hai_na_bai_chuan_ 2013-04-17
  • 打赏
  • 举报
回复
既然研究出来了,可以说出来方法吗?
jiangli9060 2012-08-02
  • 打赏
  • 举报
回复
哥们 看上面你说已经研究出来了 教教我啊 我也在为这个发愁呢 谢谢 加我Q 1064987123 或者发我邮箱的 感谢
London_2012cl 2012-07-10
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 的回复:]
引用 3 楼 的回复:

用服务或者Socket调用一般处理程序,将流传过去,通过NPOI来实现。


错了,是调用一般处理程序,把实现的方法写在这里面!我之前主要用的是NPOI不受com组建的限制,然后将要读取的值传过去,然后就OK了
[/Quote]
哦,是吗。。。。
London_2012cl 2012-07-10
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 的回复:]
参数一下
http://www.cnblogs.com/salam/archive/2010/08/21/1805367.html
有源码下载
读取Excel(xlsx)文件数据

  xlsx文件是由一个压缩文件和一个载有关于什么是内部的拉链系列信息的XML文件.
public class UnZipper { private Stream stream; public UnZ……
[/Quote]

一般的操作根本不需要这么繁琐,不过还是谢谢你。。。。
London_2012cl 2012-07-10
  • 打赏
  • 举报
回复
昏,我自己研究出来了,其实很简单啊。。。。竟然没有多少人知道。
白鸽 2012-07-09
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 的回复:]

用服务或者Socket调用一般处理程序,将流传过去,通过NPOI来实现。
[/Quote]

错了,是调用一般处理程序,把实现的方法写在这里面!我之前主要用的是NPOI不受com组建的限制,然后将要读取的值传过去,然后就OK了
白鸽 2012-07-09
  • 打赏
  • 举报
回复
用服务或者Socket调用一般处理程序,将流传过去,通过NPOI来实现。
London_2012cl 2012-07-09
  • 打赏
  • 举报
回复
还没有其他的人有什么更好的方法啊。。。。。
wwwljh 2012-07-06
  • 打赏
  • 举报
回复
参数一下
http://www.cnblogs.com/salam/archive/2010/08/21/1805367.html
有源码下载
读取Excel(xlsx)文件数据

  xlsx文件是由一个压缩文件和一个载有关于什么是内部的拉链系列信息的XML文件.
public class UnZipper { private Stream stream; public UnZipper(Stream zipFileStream) { this.stream = zipFileStream; } /// <summary> /// 获取文件流 /// </summary> /// <param name="filename">文件的全路径</param> /// <returns></returns> public Stream GetFileStream(string filename) { //文件地址 Uri fileUri = new Uri(filename, UriKind.Relative); //保存 StreamResourceInfo info = new StreamResourceInfo(this.stream, null); if (this.stream is System.IO.FileStream) { this.stream.Seek(0, SeekOrigin.Begin); } StreamResourceInfo stream = System.Windows.Application.GetResourceStream(info, fileUri); if (stream != null) { return stream.Stream; } return null; } public IEnumerable<string> GetFileNamesInZip() { BinaryReader reader = new BinaryReader(stream); stream.Seek(0, SeekOrigin.Begin); string name = null; List<string> names = new List<string>(); while (ParseFileHeader(reader, out name)) { names.Add(name); } return names; } /// <summary> /// 读取内容 /// </summary> /// <param name="reader">流</param> /// <param name="filename">文件名</param> /// <returns></returns> private static bool ParseFileHeader(BinaryReader reader, out string filename) { filename = null; if (reader.BaseStream.Position < reader.BaseStream.Length) { int headerSignature = reader.ReadInt32(); if (headerSignature == 67324752) //ggggggrrrrrrrrrrrrrrrrr { reader.BaseStream.Seek(2, SeekOrigin.Current); short genPurposeFlag = reader.ReadInt16(); if (((((int)genPurposeFlag) & 0x08) != 0)) return false; reader.BaseStream.Seek(10, SeekOrigin.Current); int compressedSize = reader.ReadInt32(); int unCompressedSize = reader.ReadInt32(); short fileNameLenght = reader.ReadInt16(); short extraFieldLenght = reader.ReadInt16(); filename = new string(reader.ReadChars(fileNameLenght)); if (string.IsNullOrEmpty(filename)) return false; reader.BaseStream.Seek(extraFieldLenght + compressedSize, SeekOrigin.Current); if (unCompressedSize == 0) return ParseFileHeader(reader, out filename); else return true; } } return false; }}

8,757

社区成员

发帖
与我相关
我的任务
社区描述
WPF/Silverlight相关讨论
社区管理员
  • WPF/Silverlight社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧