形状

添加形状

func (f *File) AddShape(sheet string, opts *Shape) error

根据给定的工作表名、单元格坐标和样式(包括偏移、缩放、拉伸、宽高比和打印属性等)在指定单元格添加形状。例如,在名为 Sheet1 的工作表上添加文本框(矩形):

lineWidth := 1.2
err := f.AddShape("Sheet1",
    &excelize.Shape{
        Cell: "G6",
        Type: "rect",
        Line: excelize.ShapeLine{Color: "4286F4", Width: &lineWidth},
        Fill: excelize.Fill{Color: []string{"8EB9FF"}},
        Paragraph: []excelize.RichTextRun{
            {
                Text: "Rectangle Shape",
                Font: &excelize.Font{
                    Bold:      true,
                    Italic:    true,
                    Family:    "Times New Roman",
                    Size:      18,
                    Color:     "777777",
                    Underline: "sng",
                },
            },
        },
        Width:  180,
        Height: 40,
    },
)

下面是 Excelize 所支持的所有形状:

名称 形状 预览
accentBorderCallout1 标注:线形(带边框和强调线)

accentBorderCallout2 标注:弯曲线形(带边框和强调线)

accentBorderCallout3 标注:双弯曲线形(带边框和强调线)

accentCallout1 标注:线形(带强调线)

accentCallout2 标注:弯曲线形(带强调线)

accentCallout3 标注:双弯曲线形(带强调线)

actionButtonBackPrevious 动作按钮:后退或前一项

actionButtonBeginning 动作按钮:转到开头

actionButtonBlank 动作按钮:空白

actionButtonDocument 动作按钮:文档

actionButtonEnd 动作按钮:转到结尾

actionButtonForwardNext 动作按钮:前进或下一项

actionButtonHelp 动作按钮:帮助

actionButtonHome 动作按钮:转到主页

actionButtonInformation 动作按钮:获取信息

actionButtonMovie 动作按钮:视频

actionButtonReturn 动作按钮:上一张

actionButtonSound 动作按钮:声音

arc 曲线的弧形状

bentArrow 箭头:圆角右

bentConnector2 弯曲的连接器 2 形状

bentConnector3 弯曲的连接器 3 形状

bentConnector4 弯曲的连接器 4 形状

bentConnector5 连接符:肘形

bentUpArrow 箭头:直角上

bevel 矩形:棱台

blockArc 空心弧

borderCallout1 标注:线形

borderCallout2 标注:弯曲线形

borderCallout3 标注:双弯曲线形

bracePair 双大括号

bracketPair 双括号

callout1 标注:线形(无边框)

callout2 标注:弯曲线形(无边框)

callout3 标注:双弯曲线形(无边框)

can 圆柱体

chartPlus 图表加上形状

chartStar 图表的星形

chartX 图表 X 形状

chevron 箭头:V 形

chord 弦形

circularArrow 箭头:环形

cloud 云形

cloudCallout 云形标注

corner L 形

cornerTabs 角选项卡形状

cube 立方体

curvedConnector2 弧形

curvedConnector3 链接符:曲线

curvedConnector4 曲线的连接符 4 形状

curvedConnector5 曲线的连接符 5 形状

curvedDownArrow 箭头:上弧形

curvedLeftArrow 箭头:右弧形

curvedRightArrow 箭头:左弧形

curvedUpArrow 箭头:下弧形

decagon 十边形

diagStripe 斜纹

diamond 菱形

dodecagon 十二边形

donut 圆:空心

doubleWave 双波形

downArrow 箭头:下

downArrowCallout 标注:下箭头

ellipse 椭圆形

ellipseRibbon 带形:前凸弯

ellipseRibbon2 带形:上凸弯

flowChartAlternateProcess 流程图:可选过程

flowChartCollate 流程图:对照

flowChartConnector 流程图:接点

flowChartDecision 流程图:决策

flowChartDelay 流程图:延期

flowChartDisplay 流程图:显示

flowChartDocument 流程图:文档

flowChartExtract 流程图:摘录

flowChartInputOutput 流程图:数据

flowChartInternalStorage 流程图:内部贮存

flowChartMagneticDisk 流程图:磁盘

flowChartMagneticDrum 流程图:直接访问存储器

flowChartMagneticTape 流程图:顺序访问存储器

flowChartManualInput 流程图:手动输入

flowChartManualOperation 流程图:手动操作

flowChartMerge 流程图:合并

flowChartMultidocument 流程图:多文档

flowChartOfflineStorage 流程图:离页存储

flowChartOffpageConnector 流程图:离页连接符

flowChartOnlineStorage 流程图:存储数据

flowChartOr 流程图:或者

flowChartPredefinedProcess 流程图:预定义过程

flowChartPreparation 流程图:准备

flowChartProcess 流程图:过程

flowChartPunchedCard 流程图:卡片

flowChartPunchedTape 流程图:资料带

flowChartSort 流程图:排序

flowChartSummingJunction 流程图:汇总连接

flowChartTerminator 流程图:终止

foldedCorner 矩形:折角

frame 图文框

funnel 漏斗形

gear6 齿轮 6 形状

gear9 齿轮 9 形状

halfFrame 半闭框

heart 心形

heptagon 七边形

hexagon 六边形

homePlate 箭头:五边形

horizontalScroll 卷形:水平

irregularSeal1 爆炸形 1

irregularSeal2 爆炸形 2

leftArrow 箭头:左

leftArrowCallout 标注:左箭头

leftBrace 左大括号

leftBracket 左中括号

leftCircularArrow 左侧的环形箭头形状

leftRightArrow 箭头:左右

leftRightArrowCallout 标注:左右箭头

leftRightCircularArrow 左右环形箭头形状

leftRightRibbon 左右功能区形状

leftRightUpArrow 箭头:丁字

leftUpArrow 箭头:直角双向

lightningBolt 闪电形

line 直线

lineInv 形状:反向直线

mathDivide 除号

mathEqual 等号

mathMinus 减号

mathMultiply 乘号

mathNotEqual 不等号

mathPlus 加号

moon 新月形

nonIsoscelesTrapezoid 梯形

noSmoking 禁止符

notchedRightArrow 箭头:燕尾形

octagon 八边形

parallelogram 平行四边形

pentagon 五边形

pie 不完整圆

pieWedge 饼图楔入形状

plaque 缺角矩形

plaqueTabs 板选项卡形状

plus 十字形

quadArrow 箭头:十字

quadArrowCallout 标注:十字箭头

rect 矩形

ribbon 带形:前凸

ribbon2 带形:上凸

rightArrow 箭头:右

rightArrowCallout 批注:右箭头

rightBrace 右中括号

rightBracket 右大括号

round1Rect 矩形:单圆角

round2DiagRect 矩形:对角圆角

round2SameRect 矩形:圆顶角

roundRect 矩形:圆角

rtTriangle 直角三角形

smileyFace 笑脸

snip1Rect 矩形:减去单角

snip2DiagRect 矩形:减去对角

snip2SameRect 矩形:减去左右顶角

snipRoundRect 矩形:一个圆顶角,减去另一个顶角

squareTabs 方形选项卡形状

star10 星形:十角

star12 星形:十二角

star16 星形:十六角

star24 星形:二十四角

star32 星形:三十二角

star4 星形:四角

star5 星形:五角

star6 星形:六角

star7 星形:七角

star8 星形:八角

straightConnector1 直线连接符 1 形状

stripedRightArrow 箭头:虚尾

sun 太阳形

swooshArrow Swoosh 箭头形状

teardrop 泪滴形

trapezoid 梯形

triangle 等腰三角形

upArrow 箭头:上

upArrowCallout 批注:上箭头

upDownArrow 箭头:上下

upDownArrowCallout 批注:上下箭头

uturnArrow 箭头:手杖形

verticalScroll 卷形:垂直

wave 波形

wedgeEllipseCallout 对话气泡:椭圆形

wedgeRectCallout 对话气泡:矩形

wedgeRoundRectCallout 对话气泡:圆角矩形

results matching ""

    No results matching ""