How to draw an line-arrow?(如何画直线箭头) NPOI-V2.6.1 #1167
-
How to use HSSFClientAnchor、HSSFSimpleShape draw an line-arrow? Divider------------------------------------------------------------------------------------------------------- HSSFClientAnchor c1 = new HSSFClientAnchor(dx1, dy1, dx2, dy2, start_x, start_y, end_x, end_y);
HSSFSimpleShape shape = patriarch.CreateSimpleShape(c1);
shape.ShapeType = HSSFSimpleShape.OBJECT_TYPE_LINE;
shape.LineStyle = HSSFShape.LINESTYLE_SOLID;
//在NPOI中线的宽度12700表示1pt,所以这里是0.5pt粗的线条。
shape.LineWidth = _lineWidth;
shape.SetLineStyleColor(110, 10, 110); Modify one of the enumeration values(shape.ShapeType 、shape.LineStyle) ? 是修改shape.ShapeType 、shape.LineStyle其中的某个值吗 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I have found a solution. void AddArrow(HSSFSimpleShape shape) void AddArrowOverTurn(HSSFSimpleShape shape) |
Beta Was this translation helpful? Give feedback.
I have found a solution.
void AddArrow(HSSFSimpleShape shape)
{
Type type = shape.GetType();
MethodInfo methodInfo = type.GetMethod("SetPropertyValue", BindingFlags.Instance | BindingFlags.NonPublic);
if (methodInfo != null)
{
var escherSimpleProperty2 = new EscherSimpleProperty(EscherProperties.LINESTYLE__LINESTARTARROWHEAD, false, false, 0x01);
methodInfo.Invoke(shape, new object[] { escherSimpleProperty2 });
}
}
void AddArrowOverTurn(HSSFSimpleShape shape)
{
Type type = shape.GetType();
MethodInfo methodInfo = type.GetMethod("SetPropertyValue", BindingFlags.Instance | BindingFlags.NonPublic);
if (methodInfo != null)
{
var escherSimpleProperty2 = new EscherSimpleProperty(EscherPropertie…