I would like to know the options to manipulate the Excel spreadsheets using ASP.NET 2.0 without using Excel object as web server does not have MS Office installed.
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Generic Generics in Managed C++
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
Newer versions of Excel support XML-based spreadsheet files, which should be easy to manipulate.
Microsoft has lately released the full specifications for all Office binary file formats, but implementing those is a total overkill for your needs.
You can use 3rd party conversion tools to convert the Excel files to a format you're comfortable manipulating (assuming it can be converted back to Excel).
We use SpreadsheetGear in our application for this same reason. It is a .Net library that can read/write/edit Excel files without having Excel installed on the machine. It is a commercial library though, so you will have to buy it - although you can deploy it royalty free, meaning that you only need licences to develop using it, not for each deployment.
You can use ADO to read and write to Excel.
More: http://support.microsoft.com/kb/257819
EDIT: I see that MSDASQL is deprecated by Microsoft, so these are better connection strings.
If HDR is set to No, it is possible to overwrite existing headers using either the position counting from zero, or the default field (column) name, which is F1, F2 ... Fn counting from the first column of the selection range. If HDR is set to yes, then field (column) names are the first row. Invalid names will be set to the default name.
Mode is an enum, so you could have
Mode=Share Deny None;
orMode=Read|Share Deny Read|Share Deny Write;
, for example.You can optionally include in the connection string:
Setting MaxScanRows and IMEX will only be of much use if you tamper with the registry.
Possible values of IMEX are:
-- http://support.microsoft.com/kb/194124
As all 3 above has said. You can only do it with Office 2007 excel sheets as those are stored as XML data in a zip file.
For older excel versions, you need 3rd party components.
I don't know if you have any control over the excel files, but if you have you can save the files as XML. This way you can use XSLT/XPath to retrieve or transform the data inside the Excelml
You can use the Open XML SDK to manipulate Office 2007 documents