简体   繁体   English

有没有一种方法可以将.xlsx和.xls文件转换为CODE中制表符分隔的文本文件

[英]Is there a way to convert .xlsx and .xls file into tab delimited text files in CODE

I'm writing a WCF service which accepts an an Excel file (xls/xlsx) as a byte array, and now I need to convert it into a format I can read. 我正在编写一个WCF服务,该服务接受一个Excel文件(xls / xlsx)作为字节数组,现在我需要将其转换为可以读取的格式。 Earlier I had tried this using Interop.Excel, but this was working only on my local machine, and Not on the server. 之前,我曾使用Interop.Excel尝试过此操作,但这仅在本地计算机上有效,而在服务器上则无效。 Apparently I needed MS Excel installed on my server, which is not recommended. 显然我需要在服务器上安装MS Excel,不建议这样做。 I have 2 options- 我有2个选项-

  1. either use a third party library to read the byte excel file 要么使用第三方库读取字节excel文件
  2. convert the byte file to a text format and read it from there(this is already written in my service) 将字节文件转换为文本格式并从那里读取(这已经写在我的服务中)

I'm trying to go with #2 for now. 我现在正尝试使用#2。 Any ideas as to how I can begin with this 关于如何开始的任何想法

I think you should give a try to the option of the Interop.Excel referenced on the server, if you know that everyone using the service will be using a Windows OS and they have the same office version. 我想您应该尝试一下服务器上引用的Interop.Excel选项,如果您知道所有使用该服务的人都将使用Windows OS,并且它们具有相同的办公版本。

Good luck! 祝好运!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM