|
Thanks for sharing this great package.
The reason for NaN issue is due to there is shared formula record after formula record.
WorksheetDecoder.cs
private static List<record> ReadRecords(Stream stream, out MSODRAWING drawingRecord)
{
List<record> records = new List<record>();
drawingRecord = null;
Record record = Record.Read(stream);
Record last_record = record;
Record last_formula_record = null;
last_record.Decode();
if (record is BOF && ((BOF)record).StreamType == StreamType.Worksheet)
{
while (record.Type != RecordType.EOF)
{
if (record.Type == RecordType.CONTINUE)
{
last_record.ContinuedRecords.Add(record);
}
else
{
switch (record.Type)
{
case RecordType.STRING:
if (last_formula_record is FORMULA)
{
record.Decode();
(last_formula_record as FORMULA).StringRecord = record as STRING;
}
break;
case RecordType.MSODRAWING:
if (drawingRecord == null)
{
drawingRecord = record as MSODRAWING;
records.Add(record);
}
else
{
drawingRecord.ContinuedRecords.Add(record);
}
break;
default:
records.Add(record);
break;
}
if (record.Type == RecordType.FORMULA)
last_formula_record = record;
else if (record.Type != RecordType.SHRFMLA && record.Type != RecordType.ARRAY)
last_formula_record = null;
last_record = record;
}
record = Record.Read(stream);
}
records.Add(record);
}
return records;
}
</record></record></record>
|
|
|
|
|
Thanks for sharing.
dnpro
"Very bad programmer"
|
|
|
|
|
My excel file has dates like: 1/25/2009
But when I look at my value in code it is (cell.StringValue) 39838.
I noticed that the DateTimeValue property is filled out, but then how will I know that this cell is a date? Since all cells have that property.
Thanks!
Tim M
|
|
|
|
|
This can be judged from cell's numberformat but the current code doesn's support this. WorkSheetEncoder already supports numberformat. I will add numberformat to decoder in the next version.
I am happy to work with people doing great projects.
|
|
|
|
|
I am using:
using Microsoft.Office.Tools.Excel;
but I get the following errors
The event 'Microsoft.Office.Tools.Excel.Workbook.Open' can only appear on the left hand side of += or -=
Cannot apply indexing with [] to an expression of type 'Microsoft.Office.Interop.Excel.Sheets'
Cannot apply indexing with [] to an expression of type 'Microsoft.Office.Interop.Excel.Range'
I tried to download your source code ZIP file, but can't for some reason.
Thanks for your help!
|
|
|
|
|
you should verify whether the input file is a xls file or not, you may use the api provided by structured storage.
Regards,
unruledboy_at_gmail_dot_com
http://www.xnlab.com
|
|
|
|
|
When I use this program for reading an Excel file with no any protected Workbook, it works fine. Problem raised when I've tried to read an Excel file with protected Workbook(to prevent users to rename/modify Sheet Names), then method ReadBytes(BinaryReader reader, int count) call itself (recursively) until "Stack Overflow" error raised.
Any idea or suggestion?
Shah
modified on Friday, December 5, 2008 11:14 AM
|
|
|
|
|
I am not able to read decimal data from the cell by using this library.pls help
|
|
|
|
|
Hi,
This Excel reader is not able to read Excel 2007 files(.xlsx).I will be happy if anyone can tell me how to read the .xlsx file using this feature(QiHe). Is there any update available for this?
Thanks!!
|
|
|
|
|
Hi to all,
I am using this code to read the office 2007 excel(.xlsx) file but it throws exception unknown file format.There is any update available of this project for office 2007.
Thanks,
Amar
|
|
|
|
|
Hi
I'm trying to write a small app to scan directories and find documents with embeded links or VBA code. I've tried using office interop but find alot of issues with it. This approach looks like just the job, just one small problem; When I click on a node in the tree (VBA or OLE info for example) the text that is displayed in the 'TextView' is not readable, it looks like an encoding issue but I can't where to change it. Has anyone come across this issue and managed to fix it?
Thanks
D
|
|
|
|
|
I don't think this has come up yet, but the program seems to be treating xls spreadsheets made by OpenOffice oddly. In particular, it's truncating numbers at the decimal randomly. Try opening http://sinbios.org/test.xls first in a spreadsheet application, and then in the supplied program, and you'll see that many of the numbers are truncated. Note that these numbers were inputted by hand, not using formulae. Perhaps they're being mistakenly cast into int somewhere?
|
|
|
|
|
Found the issue, turns out DecodeRK() in Record.cs returned num as an int if isFloat is false, and obviously the isFloat test is returning false for some values that should be true. Since for me it doesn't matter if integers are returned as doubles, I just changed the type of num from int to double even when isFloat is false.
|
|
|
|
|
Hi Liu Junfeng,
Absolutely this is a useful to get rid of Com-Ecel, but i have few issues in using this lib, those are, reading cell-value and cell-comment using named-cell. can you help me out in this regard....
I think mostly the answer is, you are not supporting this feature......but any ho...let me know any possibility..
Thanks for the great library.....
Mukthesh
|
|
|
|
|
Hi Liu,
After downloading your code and turning it into DLLs, I tried it out. It works very well with a single workbook but not with the next 180 of them. This is the situation: I have a SharePoint library with both .xls and .xlsx, a total of 181. They get downloaded into memory, including their streams, and I iterate through them leaving the xlsx out. As the program goes to each workbook and your code checks the header, the check fails. The bytes starting from the second workbook don't match the ones specified in your code. Now, the problem it that it works for the first file regardless of what file is the first. Do you have any ideas?
Thanks,
humble.apprentice
|
|
|
|
|
I facing the same issue, any solution for this ?
|
|
|
|
|
Firstly .xlsx file is not supported. If the file is .xls and still get "File header not recognized." message, maybe it is other versions of Compound Document. You can try comment this line
if (!doc.CheckHeader()) return null;
I am happy to work with people doing great projects.
|
|
|
|
|
Hi,
Yes, I know that xlsx is not supported, the 180 docs I mention where only xls. Any ideas?
Thanks,
humble.apprentice
|
|
|
|
|
After downloading the source I get an application where I expected a .dll (assembly) code. Maybe its misspacked?
|
|
|
|
|
Just switch the 'output type' from 'windows application' to 'class library' in the project's properties and you will get a dll.
|
|
|
|
|
Hi... Is there any way to edit the cells?
I mean, also without the nasty Interop?
Open mind for a different view.
|
|
|
|
|
Hi! I tried to see color of cells in test application but I couldn't to see. Can someone tell me why? Thank you very much, Andriy
|
|
|
|
|
I've a problem when a try to open some excel files :
sometimes, somes cells uses a user-defined format. For exemple a cell has a numeric value (1234567) but the user-defined format is (0# ## ## ##). So the value shown in excel is for exemple "01 23 45 67".
Is there a way to retreive this user-defined format with this library ?
thanks in advance
|
|
|
|
|
Hi
I'm using heavy use of your library, but I'm having problems with formulas. Someones are decoded and others not.
Is it possible to get the formula text, not the result?. I don't need the result, only read the cell with the formula as is ( ie =A1 ).
For the decoded formulas, I can use StringRecord property, but for the undecoded ones, the property value is null.
In Formula.cs you define public Byte[] FormulaData; . Do I need to parse the byte array acording to the Excel File definition?. This would be overkill for me beacuse I only need the formula text
Thanks in advance
|
|
|
|
|
Hello
I'm using your library a works like a charm.
The only drawback is that reading cell values with spanish characters like Ñ or é returns a character '?' instead of the correct value.
Is there a workaround for this?. I was using a propietary library for reading excel files but I'd prefer to use yours
Greetings from Spain
|
|
|
|