You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
9.5 KiB
9.5 KiB
Format attributes
Cell attributes table
Attribute value | Full name | Explanation |
Example value | Aspose method or attribute |
ct | celltype | Cell value format: text, time, etc. | Cell format | |
bg | background | background color | #fff000 | setBackgroundColor |
ff | fontfamily | Font | 0 Microsoft Yahei, 1 Song, 2 ST Heiti, 3 ST Kaiti, 4 ST FangSong, 5 ST Song, 6 Chinese New Wei, 7 Chinese Xingkai, 8 Chinese Lishu, 9 Arial, 10 Times New Roman, 11 Tahoma, 12 Verdana | Style.Font object's Name property. |
fc | fontcolor | font color | #fff000 | Style.Font object's Color property |
bl | bold | Bold | 0 Regular, 1 Bold | Style.Font object's IsBold property to true. |
it | italic | Italic | 0 Regular, 1 Italic | |
fs | fontsize | font size | 14 | Style.Font object's Size property. |
cl | cancelline | Cancelline | 0 Regular, 1 Cancelline | Style.Font object's Underline property |
ul | underline | Underline | 0 Regular, 1 Underline | |
bs | borderstyle | Border style | 0 none | LineStyle |
1 Thin | ||||
2 Hair | ||||
3 Dotted | ||||
4 Dashed | ||||
5 DashDot | ||||
6 DashDotDot | ||||
7 Double | ||||
8 Medium | ||||
9 MediumDashed | ||||
10 MediumDashDot | ||||
11 MediumDashDotDot | ||||
12 SlantedDashDot | ||||
13 Thick | ||||
bc | bordercolor | Border color | #fff000 | setBorderColor |
bs_t | borderstyleTop | Top border style | Same as above | |
bc_t | bordercolorTop | Top border color | ||
bs_b | borderstyleBottom | Bottom border style | ||
bc_b | bordercolorBottom | Bottom border color | ||
bs_l | borderstyleLeft | Left border style | ||
bc_l | bordercolorLeft | Left border color | ||
bs_r | borderstyleRight | Right border style | ||
bc_r | bordercolorRight | Right border color | ||
vt | verticaltype | Vertical alignment | 0 middle, 1 up, 2 down | setVerticalAlignment |
ht | horizontaltype | Horizontal alignment | 0 center, 1 left, 2 right | setHorizontalAlignment |
mc | mergecell | Merge Cells | {rs: 10, cs:5} indicates that the cells from this cell to 10 rows and 5 columns are merged. | Merge |
tr | textrotate | Text rotation | 0: 0、1: 45 、2: -45、3 Vertical text、4: 90 、5: -90 | setRotationAngle |
fl | floatlenght | Decimal places | 3 | |
tb | textbeak | Text wrap | 0 truncation, 1 overflow, 2 word wrap | 2: setTextWrapped 0和1: IsTextWrapped = true |
ov | originvalue | Original value | ||
v | value | Display value | ||
f | function | formula | setFormula setArrayFormula workbook.calculateFormula(); |
The following is the storage of 3 cells:
[
{r:0, c:1, v: { v:"display", f:"=SUM(A2)", bg:"#fff000", bs:"1",bc:"#000"}},
{r:10, c:11, v:"value2"},
{r:10, c:11, v:{f:"=sum", v:"100"}}
]
Cell format
ReferenceAspose.Cells
The format is set to:
{
"v": "",
"f": "",
"ct": {
"v": 1,
"f": "#,##0.00",
"t": " Decimal"
}
}
Parameter | Explanation | Usage |
---|---|---|
v | value, shortcut setting value in Aspose | var currencyStyle = book.CreateStyle(); currencyStyle.Number = 8; |
f | Format: format definition string $#,##0;$-#,##0 |
var currencyStyle = book.CreateStyle(); currencyStyle.Custom = "#,##0 SEK"; |
t | Type: 0: General 1: Decimal 2: Currency 3: Percentage 4: Scientific 5: Fraction 6: Date 7: Time 8: Accounting 9: Text 10: DateTime |
The type is the format distinguished by the front end. When importing excel, the type is distinguished according to the keyword of the format character: 1. YYYY, MM, DD is 6 |
Aspose is set as follows:
Value | Type | Format String |
---|---|---|
0 | General | General |
1 | Decimal | 0 |
2 | Decimal | 0.00 |
3 | Decimal | #,##0 |
4 | Decimal | #,##0.00 |
5 | Currency | $#,##0;$-#,##0 |
6 | Currency | $#,##0;$-#,##0 |
7 | Currency | $#,##0.00;$-#,##0.00 |
8 | Currency | $#,##0.00;$-#,##0.00 |
9 | Percentage | 0% |
10 | Percentage | 0.00% |
11 | Scientific | 0.00E+00 |
12 | Fraction | # ?/? |
13 | Fraction | # / |
14 | Date | m/d/yy |
15 | Date | d-mmm-yy |
16 | Date | d-mmm |
17 | Date | mmm-yy |
18 | Time | h:mm AM/PM |
19 | Time | h:mm:ss AM/PM |
20 | Time | h:mm |
21 | Time | h:mm:ss |
22 | Time | m/d/yy h:mm |
37 | Currency | #,##0;-#,##0 |
38 | Currency | #,##0;-#,##0 |
39 | Currency | #,##0.00;-#,##0.00 |
40 | Currency | #,##0.00;-#,##0.00 |
41 | Accounting | _ * #,##0_ ;_ * "_ ;_ @_ |
42 | Accounting | _ $* #,##0_ ;_ $* "_ ;_ @_ |
43 | Accounting | _ * #,##0.00_ ;_ * "??_ ;_ @_ |
44 | Accounting | _ $* #,##0.00_ ;_ $* "??_ ;_ @_ |
45 | Time | mm:ss |
46 | Time | h :mm:ss |
47 | Time | mm:ss.0 |
48 | Scientific | ##0.0E+00 |
49 | Text | @ |
Import/export only considers the data style that the user sees. For example, the way to process the date format in excel is to convert the date into a number: 42736 represents 2017-1-1.