rkhelper.cs
来自「Excel的操作,其中可以读取及写入Excel 文件」· CS 代码 · 共 53 行
CS
53 行
using System;
namespace Microsoft.Fawvw.Components.NExcel.Read.Biff
{
/// <summary> Helper to convert an RK number into a double or an integer</summary>
sealed class RKHelper
{
/// <summary> Private constructor to prevent instantiation</summary>
private RKHelper()
{
}
/// <summary> Converts excel's internal RK format into a double value
///
/// </summary>
/// <param name="rk">the rk number in bits
/// </param>
/// <returns> the double representation
/// </returns>
public static double getDouble(int rk)
{
if ((rk & 0x02) != 0)
{
int intval = rk >> 2;
double Value = (double) intval;
if ((rk & 0x01) != 0)
{
Value /= 100;
}
return Value;
}
else
{
long valbits = ( ((long) rk) & 0xfffffffc);
valbits <<= 32;
double Value = BitConverter.Int64BitsToDouble(valbits);
if ((rk & 0x01) != 0)
{
Value /= 100;
}
return Value;
}
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?