Comments (2)
the problem is in the
ExcelLibrary\Office\Excel\BinaryFileFormat\Encode\WorkSheetEncoder.cs file
Changing the encodecell routine to be like the one below resolved my issue with
the library.
private static CellValue EncodeCell(Cell cell, SharedResource sharedResource)
{
object value = cell.Value;
if (value is int || value is short)
{
RK rk = new RK();
rk.Value = (uint)(Convert.ToInt32(value) << 2 | 2);
return rk;
}
else if (value is decimal)
{
//if (Math.Abs((decimal)value) <= (decimal)5368709.11)
//{
// RK rk = new RK();
// rk.Value = (uint)((int)((decimal)value * 100) << 2 | 3); // integer and mul
// return rk;
//}
//else
//{
NUMBER number = new NUMBER();
number.Value = (double)(decimal)value;
return number;
//}
}
else if (value is double)
{
//RK rk = new RK();
//Int64 data = BitConverter.DoubleToInt64Bits((double)value);
//rk.Value = (uint)(data >> 32) & 0xFFFFFFFC;
//return rk;
NUMBER number = new NUMBER();
number.Value = (double)value;
return number;
}
else if (value is string)
{
LABELSST label = new LABELSST();
label.SSTIndex = sharedResource.GetSSTIndex((string)value);
return label;
}
else if (value is DateTime)
{
NUMBER number = new NUMBER();
number.Value = sharedResource.EncodeDateTime((DateTime)value);
return number;
}
else if (value is bool)
{
BOOLERR boolerr = new BOOLERR();
boolerr.ValueType = 0;
boolerr.Value = Convert.ToByte((bool)value);
return boolerr;
}
else if (value is ErrorCode)
{
BOOLERR boolerr = new BOOLERR();
boolerr.ValueType = 1;
boolerr.Value = ((ErrorCode)value).Code;
return boolerr;
}
else
{
throw new Exception("Invalid cell value.");
}
}
Original comment by [email protected]
on 10 Jun 2010 at 4:24
from excellibrary.
lewis:
I did exactly what you have done here. It works perfectly. However I would like
to know why the code looked like that. I can not understand it, but it has to
be a reason, that's for sure.
Is it going to be a new release containing these modifications in a near future
?
Thanks in advance.
Ariel.
Original comment by [email protected]
on 22 Aug 2012 at 12:05
from excellibrary.
Related Issues (20)
- Corrupted data
- how to insert hyperlink to excel sheet from application
- Generating excel files does not work on windows 8.1 excel 2013
- Signed Assembly
- Unable to read XLS file (file is corrupted) HOT 1
- File with less than 100 rows causes corruption
- Column size set
- I am unable to open the .xls files which I have created earlier. HOT 1
- Code to close the file?
- Load() give's me the error, Buffer cannot be null. I can't open excel files.
- me123
- put string to cell keyword not working
- WrapText issue
- Can't Read From Client Machine To Server Code
- How to set right align in excel cell
- aa
- aaa
- sss
- 222
- xlsx format
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from excellibrary.