# 格式属性 ## 单元格属性表
属性值 全称
说明
值示例 Aspose方法或者属性
ct celltype 单元格值格式:文本、时间等 单元格格式
bg background 背景颜色 #fff000 setBackgroundColor
ff fontfamily 字体 0 微软雅黑、1 宋体(Song)、2 黑体(ST Heiti)、3 楷体(ST Kaiti)、 4仿宋(ST FangSong)、 5 新宋体(ST Song)、 6 华文新魏、 7华文行楷、 8 华文隶书、 9 Arial、 10 Times New Roman 、11 Tahoma 、12 Verdana Style.Font object's Name property.
fc fontcolor 字体颜色 #fff000 Style.Font object's Color property
bl bold 粗体 0 常规 、 1加粗 Style.Font object's IsBold property to true.
it italic 斜体 0 常规 、 1 斜体
fs fontsize 字体大小 14 Style.Font object's Size property.
cl cancelline 删除线 0 常规 、 1 删除线 Style.Font object's Underline property
vt verticaltype 垂直对齐 0 中间、1 上、2下 setVerticalAlignment
ht horizontaltype 水平对齐 0 居中、1 左、2右 setHorizontalAlignment
mc mergecell 合并单元格 { rs: 10, cs:5 } 表示从此cell开始到10行5列的cell进行合并。 Merge
tr textrotate 文字旋转 0: 0、1: 45 、2:-45、3 竖排文字、4: 90 、5:-90 setRotationAngle
tb textbeak 文本换行 0 截断、1溢出、2 自动换行 2:setTextWrapped
0和1:IsTextWrapped = true
v value 原始值
m monitor 显示值
f function 公式 setFormula
setArrayFormula
workbook.calculateFormula();
以下为3个单元格存储: ```json [ { "r": 10, "c": 11, "v": { "f": "=MAX(A7:A9)", "ct": { "fa": "General", "t": "n" }, "v": 100, "m": "100" } }, { "r": 0, "c": 1, "v": { "v": 12, "f": "=SUM(A2)", "bg": "#fff000" } }, { "r": 10, "c": 11, "v": "值2" } ] ``` ##
单元格格式
参考[Aspose.Cells](https://docs.aspose.com/display/cellsnet/List+of+Supported+Number+Formats#ListofSupportedNumberFormats-Aspose.Cells) 格式设置为: ```json { "ct": { "fa": "General", "t": "g" }, "m": "2424", "v": 2424 } ``` |参数|说明|值| | ------------ | ------------ | ------------ | |fa|Format格式的定义串| 如"General"| |t|Type类型|如"g"| 可选择的设置如下: | 格式 | ct.fa值 | ct.t值 | m值示例 |备注 | |----------|----------|-------------------------|------------------------- |------------------------- | | 自动 | General | g | Luckysheet || | 纯文本 | @ | s | Luckysheet || |


**数字格式** | | | | | | 整数 | 0 | n | 1235 | 0位小数 || | 数字一位小数 | 0.0 | n | 1234.6 | 0.0中,点后面0的个数就代表小数位数,原始数字位数大,设置位数小时会做四舍五入 | | 数字两位小数 | 0.00 | n | 1234.56 || | 更多数字格式 | #,##0 | n | 1,235 || | 更多数字格式 | #,##0.00 | n | 1,234.56 || | 更多数字格式 | #,##0_);(#,##0) | n | 1,235 || | 更多数字格式 | #,##0_);[Red](#,##0) | n | 1,235 || | 更多数字格式 | #,##0.00_);(#,##0.00) | n | 1,234.56 || | 更多数字格式 | #,##0.00_);[Red](#,##0.00) | n | 1,234.56 || | 更多数字格式 | $#,##0_);($#,##0) | n | $1,235 || | 更多数字格式 | $#,##0_);[Red]($#,##0) | n | $1,235 || | 更多数字格式 | $#,##0.00_);($#,##0.00) | n | $1,234.56 || | 更多数字格式 | $#,##0.00_);[Red]($#,##0.00) | n | $1,234.56 || | 更多数字格式 | _($* #,##0_);_(...($* "-"_);_(@_) | n | $ 1,235 || | 更多数字格式 | _(* #,##0_);_(*..._(* "-"_);_(@_) | n | 1,235 || | 更多数字格式 | _($* #,##0.00_);_(...($* "-"_);_(@_) | n | $ 1,234.56 || | 更多数字格式 | _(* #,##0.00_);...* "-"??_);_(@_) | n | 1,234.56 || | 百分比整数 | 0% | n | 123456% |也支持 #0% 的用法| | 百分比 | 0.00% | n | 123456.00% |也支持 #0.00% 的用法,点后面0的个数就代表小数位数| | 科学计数 | 0.00E+00 | n | 1.23E+03 || | 科学计数 | ##0.0E+0 | n | 1.2E+3 || | 分数 | # ?/? | n | 1234 5/9 || | 分数 | # ??/?? | n | 1234 14/25 || | 万元 | w | n |12万3456|| | 万元2位小数 | w0.00 | n |12万3456.00|| | 会计 | ¥(0.00) | n || | 货币 | ¥0.00 或者 ¥ #.00 | n || | 日期 | yyyy-MM-dd | d || | 时间 | hh:mm AM/PM | d || | 时间24H | hh:mm | d || | 日期时间 | yyyy-MM-dd hh:mm AM/PM | d || | 日期时间24H | yyyy-MM-dd hh:mm | d || | 日期时间24H | yyyy-MM-dd hh:mm | d || 导入/导出只用考虑用户看到的数据样式,例如excel中处理日期格式的方式为把日期统一转换为数字:42736 代表 2017-1-1