语法作用
返回纵向分割线,用于矩阵或表格的条件格式图标中,以进行列或区块的分割。参数说明:
- lineColor:线条颜色(如"#3498db")
- strokeWidth:线条粗细(建议100)
- lineStyle:样式("solid"实线, "dashed"虚线)
- position:位置("center"居中, "left"靠左, "right"靠右)。
XF.SvgChart.MatrixSplitLine(lineColor:string,strokeWidth:int64,lineStyle:string,position:string)
函数代码
该函数的实现代码如下:
/// 返回纵向分割线,用于矩阵或表格的条件格式图标中,以进行列或区块的分割。lineColor:线条颜色(如"#3498db");strokeWidth:线条粗细(建议100);lineStyle:样式("solid"实线, "dashed"虚线);position:位置("center"居中, "left"靠左, "right"靠右)
Function XF.SvgChart.MatrixSplitLine = (lineColor:string,strokeWidth:int64,lineStyle:string,position:string) =>
VAR __InputColor = COALESCE( lineColor, "Gray" )
VAR __SafeColor = SUBSTITUTE( __InputColor, "#", "%23" )
VAR __SafeWidth = IF( strokeWidth <= 0, 2, strokeWidth )
VAR __SafeStyle = IF( LOWER( lineStyle ) = "dashed", "dashed", "solid" )
VAR __SafePosition = LOWER( position )
VAR __CanvasWidth = 480
VAR __CanvasHeight = 480
VAR __XPos =
SWITCH(
TRUE(),
__SafePosition = "left", 0,
__SafePosition = "right", __CanvasWidth,
__CanvasWidth / 2
)
VAR __DashAttribute =
IF(
__SafeStyle = "dashed",
"stroke-dasharray='30, 30'",
""
)
RETURN
"data:image/svg+xml;utf8," &
"<svg class='xifeng' xmlns='http://www.w3.org/2000/svg' " &
"width='" & __CanvasWidth & "' height='" & __CanvasHeight & "'>" &
"<line " &
"x1='" & __XPos & "' y1='0' " &
"x2='" & __XPos & "' y2='" & __CanvasHeight & "' " &
"stroke='" & __SafeColor & "' " &
"stroke-width='" & __SafeWidth & "' " &
__DashAttribute &
"/>" &
"</svg>"
应用示例
在矩阵的采购价字段右边添加一条分割线,如下图所示:






