| 构造器和说明 |
|---|
CellContentDrawer(Canvas canvas)
通过已有Canvas构造单元格
注意该方法将会替换Canvas的绘制器为单元格的绘制器。
|
CellContentDrawer(double x,
double y,
double width,
double height)
创建单元格
|
public static Boolean DEBUG
public CellContentDrawer(Canvas canvas)
注意该方法将会替换Canvas的绘制器为单元格的绘制器。
canvas - Canvaspublic CellContentDrawer(double x,
double y,
double width,
double height)
x - 左下角x坐标y - 左下角y坐标width - 宽度height - 高度public void draw(DrawContext ctx) throws IOException
draw 在接口中 Drawerctx - 绘制上下文IOException - 图形绘制异常public String getValue()
public CellContentDrawer setValue(String value)
value - 单元格文字内容public CellContentDrawer setValue(Path imgPath, double w, double h)
imgPath - 图片路径,仅支持png、jpg、jpeg、gif、bmp格式w - 图片宽度,单位:毫米h - 图片高度,单位:毫米public CellContentDrawer setValue(Path imgPath) throws IOException
图片宽度与高度通过 DrawContext.mm(int) } 方法转换为毫米
imgPath - 图片路径,仅支持png、jpg、jpeg、gif、bmp格式IOException - 图片加载异常public String getColor()
public CellContentDrawer setColor(String color)
color - 单元格颜色,格式:#000000、rgb(0,0,0)、rgba(0,0,0,1)public String getFontName()
public CellContentDrawer setFontName(String fontName)
fontName - 字体名称,仅支持系统安装字体,且不会嵌入到OFD中。public double getFontSize()
public CellContentDrawer setFontSize(double fontSize)
fontSize - 字号,默认:3(单位:毫米)public Canvas getCanvas()
public TextAlign getTextAlign()
public CellContentDrawer setTextAlign(TextAlign textAlign)
textAlign - 文字对齐方式public VerticalAlign getVerticalAlign()
VerticalAlign.centerpublic CellContentDrawer setVerticalAlign(VerticalAlign verticalAlign)
verticalAlign - 文字垂直方向浮动方式public Double getLineSpace()
public CellContentDrawer setLineSpace(Double lineSpace)
lineSpace - 行间距@Deprecated public Boolean getBlob()
getBold()
是否加粗@Deprecated public CellContentDrawer setBlob(Boolean bolb)
setBold(Boolean)
设置 是否加粗
bolb - 是否加粗public Boolean getBold()
public CellContentDrawer setBold(Boolean bold)
bold - 是否加粗public Boolean getItalic()
public CellContentDrawer setItalic(Boolean italic)
italic - 是否斜体,true - 斜体、false - 正常public Double getLetterSpacing()
public CellContentDrawer setLetterSpacing(Double letterSpacing)
letterSpacing - 文字之间的间距,可以为负数,默认为:0。public Path getImgPath()
public double getImgWidth()
public double getImgHeight()
public CellContentDrawer setUnderline(boolean underline)
underline - true - 启下划线,false - 禁用下划线public boolean getUnderline()
public CellContentDrawer setDeleteLine(boolean deleteLine)
deleteLine - true - 启删除线,false - 禁用删除线public boolean getDeleteLine()
public String getFontWeight()
public void setFontWeight(String fontWeight)
fontWeight - 字体宽度,应遵循 CSS3标准,可选值为 normal | bold | bolder | lighter | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900public CellContentDrawer setFont(String fontName, Path fontPath)
注意OFDRW不会提供任何字体裁剪功能,您的字体文件将直接加入OFD文件中,这可能造成文件体积剧增。
fontName - 字体名称,如“思源宋体”fontPath - 字体文件所在路径Copyright © 2024. All rights reserved.