We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
部分简化源码 XSSFFont : IFont { double FontHeight { get { if (ct_FontSize != null) return (double)(short)(ct_FontSize.val * 20.0); return DEFAULT_FONT_SIZE * 20.0; } set { ct_FontSize.val = value; // BUG: 赋值没有除于 20; } } short FontHeightInPoints { get { return (short)(this.FontHeight / 20.0); } set { ct_FontSize.val = value; } } } FontHeight 属性的 set 部分 没有将 value 除于 20 再保存.. 此 BUG 在 NPOIv2.2.1.0 已存在至v2.4, 更早的版本没接触... HSSFFont 没有问题... 微软关于 CT_FontSize 的定义, val 的单位是 Point. https://msdn.microsoft.com/en-us/library/office/documentformat.openxml.spreadsheet.fontsize.aspx
一点建议: FontHeight/FontHeightInPoints 的数据类型设计很不合理...类型设置相反了. FontHeight 使用 short, 单位为 1/20 Point, 单位很小了, 没必要有小数部分. FontHeightInPoints 使用 double 或者 float, 单位为 Point, 需要小数部分; Excel 软件是支持小数字号的, 例如 10.5 磅... 目前 NPOI 只能设置整数字号, 即使设置小数, 也会在内部类型转换后损失小数部分...
The text was updated successfully, but these errors were encountered:
这确实是个bug,感谢
Sorry, something went wrong.
下个版本将把FontHeight和FontHeightInPoints 都改成double,以适应所有情况。
fdcadaf
tonyqus
No branches or pull requests
部分简化源码
XSSFFont : IFont {
double FontHeight {
get {
if (ct_FontSize != null)
return (double)(short)(ct_FontSize.val * 20.0);
return DEFAULT_FONT_SIZE * 20.0;
}
set {
ct_FontSize.val = value; // BUG: 赋值没有除于 20;
}
}
short FontHeightInPoints {
get {
return (short)(this.FontHeight / 20.0);
}
set {
ct_FontSize.val = value;
}
}
}
FontHeight 属性的 set 部分 没有将 value 除于 20 再保存..
此 BUG 在 NPOIv2.2.1.0 已存在至v2.4, 更早的版本没接触...
HSSFFont 没有问题...
微软关于 CT_FontSize 的定义, val 的单位是 Point.
https://msdn.microsoft.com/en-us/library/office/documentformat.openxml.spreadsheet.fontsize.aspx
一点建议:
FontHeight/FontHeightInPoints 的数据类型设计很不合理...类型设置相反了.
FontHeight 使用 short, 单位为 1/20 Point, 单位很小了, 没必要有小数部分.
FontHeightInPoints 使用 double 或者 float, 单位为 Point, 需要小数部分;
Excel 软件是支持小数字号的, 例如 10.5 磅...
目前 NPOI 只能设置整数字号, 即使设置小数, 也会在内部类型转换后损失小数部分...
The text was updated successfully, but these errors were encountered: