分类: 信息化
2019-10-25 21:55:00
属性 | 英文说明 |
baseColWidth (Base Column Width) |
Specifies the number of characters of the maximum digit width of the normal style's font. See defaultColWidth description in this section for details on calculating this value. See the col element description, particularly the width attribute description, for more information on what is meant by "maximum digit width".
The possible values for this attribute are defined by the W3C XML Schema unsignedInt datatype. |
defaultColWidth (Default Column Width) |
Default column width measured as the number of characters of the maximum digit width of the normal style's font.
If the user has not set this manually, then it can be calculated: If the user has set this manually, then there is no calculation, and simply a value is specified.
The possible values for this attribute are defined by the W3C XML Schema double datatype. |
defaultRowHeight (Default Row Height) |
Default row height measured in point size. Optimization so we don't have to write the
height on all rows. When the row height of all rows in a sheet is the default value, then that value is written here, and customHeight is not set. If a few rows have a different height, that information is written directly on each row. However, if most or all of the rows in the sheet have the same height, but that height isn't the default height, then that height value should be written here (as an optimization), and the customHeight flag should also be set. In this case, all rows having this height do not need to express the height, only rows whose height differs from this value need to be explicitly expressed.
The possible values for this attribute are defined by the W3C XML Schema double
datatype.
|
Defines column width and column formatting for one or more columns of the worksheet.
Attributes |
Description |
width (Column Width) |
Column width measured as the number of characters of the maximum digit width of the numbers 0, 1, 2, ..., 9 as rendered in the normal style's font. There are 4 pixels of margin padding (two on each side), plus 1 pixel padding for the gridlines. width = Truncate([{Number of Characters} * {Maximum Digit Width} + {5 pixel padding}]/{Maximum Digit Width}*256)/256
[Example: Using the Calibri font as an example, the maximum digit width of 11 point font size is 7 pixels (at 96 dpi). In fact, each digit is the same width for this font. Therefore, if the cell width is 8 characters wide, the value of this attribute must be
Truncate([8*7+5]/7*256)/256 = 8.7109375. end example] (expressed in terms of pixels), use this calculation: =Truncate(((256 * {width} + Truncate(128/{Maximum Digit Width}))/256)*{Maximum Digit Width}) [Example: Using the same example as above, the calculation would be Truncate(((256*8.7109375+Truncate(128/7))/256)*7) = 61 pixels. end example] To translate from pixels to character width, use this calculation: =Truncate(({pixels}-5)/{Maximum Digit Width} * 100+0.5)/100 [Example: Using the example above, the calculation would be Truncate((61- 5)/7*100+0.5)/100 = 8 characters. end example] [Note: when wide borders are applied, part of the left/right border must overlap with the 2 pixel padding on each side. Wide borders do not affect the width calculation of the column. end note] [Note: When the sheet is in the mode to view formulas instead of values, the pixel width of the column is doubled. end note]
The possible values for this attribute are defined by the W3C XML Schema double datatype.
列宽度,以数字 0、1、......、9 的最大数字宽度的字符数度量,以普通样式的字体呈现。边距填充有 4 个像素(每侧两个),加上网格线的 1 像素填充。
二 、要从像素转换为字符宽度,请使用此计算:
|
Default column width measured as the number of characters of the maximum digit width of the normal style's font.
If the user has not set this manually, then it can be calculated:
defaultColWidth = baseColumnWidth + {margin padding (2 pixels on each side, totalling 4 pixels)} + {gridline (1pixel)} (公式-3)
Column width measured as the number of characters of the maximum digit width of the numbers 0, 1, 2, ..., 9 as rendered in the normal style's font.
There are 4 pixels of margin padding (two on each side), plus 1 pixel padding for the gridlines.width = Truncate([{Number of Characters} * {Maximum Digit Width} + {5 pixel padding}]/{Maximum Digit Width}*256)/256 (公式-4)
- MAC WPS计算 默认字体:宋体 大小12磅 defaultColWidth值:9.1428
宽度为9.1428的像素为 px=9.1428*8 =73.14 (so easy。。。。。上面balabala一大堆也没说清楚)宽度为1.79厘米的像素为 px=1.79/2.54*96 =67.65
宽度为1.93厘米的像素为 px=1.93/2.54*96 =72.94 (同样的设置在windows下)
不知道WPS为何在MAC系统下计算的厘米数与WINDOWS下为何不同,难道是bug。不过73.14-67.65=5.49px(难道是2*padding+1gridlines)不计算在内,有懂WPS的人可以告诉我一下。当然对比两个系统下WPS还有其他差异,此处就不再一一描述来,总之研究WPS还是在WINDOWS下比较好(笔者被坑惨了,吐槽一下)。
- WINDOWS WPS计算 默认字体:宋体 大小11磅 defaultColWidth值:9
宽度width为9的像素为 px=9*8 =72.00宽度为1.9厘米的像素为 px=1.9/2.54*96 =71.81
同样设置,在col上设置列宽时:
宽度width为22.375的像素为 px=22.375*8 =179宽度为4.74厘米的像素为 px=4.74/2.54*96 =179.14
至于defaultColWidth怎么计算出来,欢迎知道的专业人事告诉笔者一下,多谢。