com.aspose.words
Class Stroke

java.lang.Object
    extended by com.aspose.words.Stroke

public class Stroke 
extends java.lang.Object

Defines a stroke for a shape.

Use the Shape.Stroke property to access stroke properties of a shape. You do not create instances of the Stroke class directly.

Example:

Shows how change stroke properties.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

Shape shape = builder.insertShape(ShapeType.RECTANGLE, RelativeHorizontalPosition.LEFT_MARGIN, 100.0,
        RelativeVerticalPosition.TOP_MARGIN, 100.0, 200.0, 200.0, WrapType.NONE);

// Basic shapes, such as the rectangle, have two visible parts.
// 1 -  The fill, which applies to the area within the outline of the shape:
shape.getFill().setForeColor(Color.WHITE);

// 2 -  The stroke, which marks the outline of the shape:
// Modify various properties of this shape's stroke.
Stroke stroke = shape.getStroke();
stroke.setOn(true);
stroke.setWeight(5.0);
stroke.setColor(Color.RED);
stroke.setDashStyle(DashStyle.SHORT_DASH_DOT_DOT);
stroke.setJoinStyle(JoinStyle.MITER);
stroke.setEndCap(EndCap.SQUARE);
stroke.setLineStyle(ShapeLineStyle.TRIPLE);

doc.save(getArtifactsDir() + "Shape.Stroke.docx");
See Also:
Shape.Stroke

Property Getters/Setters Summary
java.awt.ColorgetBackColor()
voidsetBackColor(java.awt.Color value)
           Gets or sets the background color of the stroke.
java.awt.ColorgetColor()
voidsetColor(java.awt.Color value)
           Defines the color of a stroke.
java.awt.ColorgetColor2()
voidsetColor2(java.awt.Color value)
           Defines a second color for a stroke.
intgetDashStyle()
voidsetDashStyle(int value)
           Specifies the dot and dash pattern for a stroke. The value of the property is DashStyle integer constant.
intgetEndArrowLength()
voidsetEndArrowLength(int value)
           Defines the arrowhead length for the end of a stroke. The value of the property is ArrowLength integer constant.
intgetEndArrowType()
voidsetEndArrowType(int value)
           Defines the arrowhead for the end of a stroke. The value of the property is ArrowType integer constant.
intgetEndArrowWidth()
voidsetEndArrowWidth(int value)
           Defines the arrowhead width for the end of a stroke. The value of the property is ArrowWidth integer constant.
intgetEndCap()
voidsetEndCap(int value)
           Defines the cap style for the end of a stroke. The value of the property is EndCap integer constant.
java.awt.ColorgetForeColor()
voidsetForeColor(java.awt.Color value)
           Gets or sets the foreground color of the stroke.
byte[]getImageBytes()
           Defines the image for a stroke image or pattern fill.
intgetJoinStyle()
voidsetJoinStyle(int value)
           Defines the join style of a polyline. The value of the property is JoinStyle integer constant.
intgetLineStyle()
voidsetLineStyle(int value)
           Defines the line style of the stroke. The value of the property is ShapeLineStyle integer constant.
booleangetOn()
voidsetOn(boolean value)
           Defines whether the path will be stroked.
doublegetOpacity()
voidsetOpacity(double value)
           Defines the amount of transparency of a stroke. Valid range is from 0 to 1.
intgetStartArrowLength()
voidsetStartArrowLength(int value)
           Defines the arrowhead length for the start of a stroke. The value of the property is ArrowLength integer constant.
intgetStartArrowType()
voidsetStartArrowType(int value)
           Defines the arrowhead for the start of a stroke. The value of the property is ArrowType integer constant.
intgetStartArrowWidth()
voidsetStartArrowWidth(int value)
           Defines the arrowhead width for the start of a stroke. The value of the property is ArrowWidth integer constant.
doublegetTransparency()
voidsetTransparency(double value)
           Gets or sets a value between 0.0 (opaque) and 1.0 (clear) representing the degree of transparency of the stroke.
booleangetVisible()
voidsetVisible(boolean value)
           Gets or sets a flag indicating whether the stroke is visible.
doublegetWeight()
voidsetWeight(double value)
           Defines the brush thickness that strokes the path of a shape in points.
 

Property Getters/Setters Detail

getBackColor/setBackColor

public java.awt.Color getBackColor() / public void setBackColor(java.awt.Color value)
Gets or sets the background color of the stroke. The default value for a Shape is java.awt.Color.WHITE.

Example:

Show how to set marker formatting.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

Shape shape = builder.insertChart(ChartType.SCATTER, 432.0, 252.0);
Chart chart = shape.getChart();

// Delete default generated series.
chart.getSeries().clear();
ChartSeries series = chart.getSeries().add("AW Series 1", new double[] { 0.7, 1.8, 2.6, 3.9 },
        new double[] { 2.7, 3.2, 0.8, 1.7 });

// Set marker formatting.
series.getMarker().setSize(40);
series.getMarker().setSymbol(MarkerSymbol.SQUARE);
ChartDataPointCollection dataPoints = series.getDataPoints();
dataPoints.get(0).getMarker().getFormat().getFill().presetTextured(PresetTexture.DENIM);
dataPoints.get(0).getMarker().getFormat().getStroke().setForeColor(Color.YELLOW);
dataPoints.get(0).getMarker().getFormat().getStroke().setBackColor(Color.RED);
dataPoints.get(1).getMarker().getFormat().getFill().presetTextured(PresetTexture.WATER_DROPLETS);
dataPoints.get(1).getMarker().getFormat().getStroke().setForeColor(Color.YELLOW);
dataPoints.get(1).getMarker().getFormat().getStroke().setVisible(false);
dataPoints.get(2).getMarker().getFormat().getFill().presetTextured(PresetTexture.GREEN_MARBLE);
dataPoints.get(2).getMarker().getFormat().getStroke().setForeColor(Color.YELLOW);
dataPoints.get(3).getMarker().getFormat().getFill().presetTextured(PresetTexture.OAK);
dataPoints.get(3).getMarker().getFormat().getStroke().setForeColor(Color.YELLOW);
dataPoints.get(3).getMarker().getFormat().getStroke().setTransparency(0.5);

doc.save(getArtifactsDir() + "Charts.MarkerFormatting.docx");

getColor/setColor

public java.awt.Color getColor() / public void setColor(java.awt.Color value)
Defines the color of a stroke.

The default value for a Shape is java.awt.Color.BLACK.

Example:

Shows to create a variety of shapes.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// Below are four examples of shapes that we can insert into our documents.
// 1 -  Dotted, horizontal, half-transparent red line
// with an arrow on the left end and a diamond on the right end:
Shape arrow = new Shape(doc, ShapeType.LINE);
arrow.setWidth(200.0);
arrow.getStroke().setColor(Color.RED);
arrow.getStroke().setStartArrowType(ArrowType.ARROW);
arrow.getStroke().setStartArrowLength(ArrowLength.LONG);
arrow.getStroke().setStartArrowWidth(ArrowWidth.WIDE);
arrow.getStroke().setEndArrowType(ArrowType.DIAMOND);
arrow.getStroke().setEndArrowLength(ArrowLength.LONG);
arrow.getStroke().setEndArrowWidth(ArrowWidth.WIDE);
arrow.getStroke().setDashStyle(DashStyle.DASH);
arrow.getStroke().setOpacity(0.5);

Assert.assertEquals(arrow.getStroke().getJoinStyle(), JoinStyle.MITER);

builder.insertNode(arrow);

// 2 -  Thick black diagonal line with rounded ends:
Shape line = new Shape(doc, ShapeType.LINE);
line.setTop(40.0);
line.setWidth(200.0);
line.setHeight(20.0);
line.setStrokeWeight(5.0);
line.getStroke().setEndCap(EndCap.ROUND);

builder.insertNode(line);

// 3 -  Arrow with a green fill:
Shape filledInArrow = new Shape(doc, ShapeType.ARROW);
filledInArrow.setWidth(200.0);
filledInArrow.setHeight(40.0);
filledInArrow.setTop(100.0);
filledInArrow.getFill().setForeColor(Color.GREEN);
filledInArrow.getFill().setVisible(true);

builder.insertNode(filledInArrow);

// 4 -  Arrow with a flipped orientation filled in with the Aspose logo:
Shape filledInArrowImg = new Shape(doc, ShapeType.ARROW);
filledInArrowImg.setWidth(200.0);
filledInArrowImg.setHeight(40.0);
filledInArrowImg.setTop(160.0);
filledInArrowImg.setFlipOrientation(FlipOrientation.BOTH);

BufferedImage image = ImageIO.read(getAsposelogoUri().toURL().openStream());
Graphics2D graphics2D = image.createGraphics();

// When we flip the orientation of our arrow, we also flip the image that the arrow contains.
// Flip the image the other way to cancel this out before getting the shape to display it.
AffineTransform at = new AffineTransform();
at.concatenate(AffineTransform.getScaleInstance(1, -1));
at.concatenate(AffineTransform.getTranslateInstance(0, -image.getHeight()));
graphics2D.transform(at);
graphics2D.drawImage(image, 0, 0, null);
graphics2D.dispose();

filledInArrowImg.getImageData().setImage(image);
builder.insertNode(filledInArrowImg);

doc.save(getArtifactsDir() + "Drawing.VariousShapes.docx");

getColor2/setColor2

public java.awt.Color getColor2() / public void setColor2(java.awt.Color value)
Defines a second color for a stroke.

The default value for a Shape is java.awt.Color.WHITE.

Example:

Shows how to process shape stroke features.
Document doc = new Document(getMyDir() + "Shape stroke pattern border.docx");
Shape shape = (Shape) doc.getChild(NodeType.SHAPE, 0, true);
Stroke stroke = shape.getStroke();

// Strokes can have two colors, which are used to create a pattern defined by two-tone image data.
// Strokes with a single color do not use the Color2 property.
Assert.assertEquals(new Color((128), (0), (0), (255)), stroke.getColor());
Assert.assertEquals(new Color((255), (255), (0), (255)), stroke.getColor2());

Assert.assertNotNull(stroke.getImageBytes());
FileUtils.writeByteArrayToFile(new File(getArtifactsDir() + "Drawing.StrokePattern.png"), stroke.getImageBytes());

getDashStyle/setDashStyle

public int getDashStyle() / public void setDashStyle(int value)
Specifies the dot and dash pattern for a stroke. The value of the property is DashStyle integer constant.

The default value is DashStyle.SOLID.

Example:

Shows to create a variety of shapes.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// Below are four examples of shapes that we can insert into our documents.
// 1 -  Dotted, horizontal, half-transparent red line
// with an arrow on the left end and a diamond on the right end:
Shape arrow = new Shape(doc, ShapeType.LINE);
arrow.setWidth(200.0);
arrow.getStroke().setColor(Color.RED);
arrow.getStroke().setStartArrowType(ArrowType.ARROW);
arrow.getStroke().setStartArrowLength(ArrowLength.LONG);
arrow.getStroke().setStartArrowWidth(ArrowWidth.WIDE);
arrow.getStroke().setEndArrowType(ArrowType.DIAMOND);
arrow.getStroke().setEndArrowLength(ArrowLength.LONG);
arrow.getStroke().setEndArrowWidth(ArrowWidth.WIDE);
arrow.getStroke().setDashStyle(DashStyle.DASH);
arrow.getStroke().setOpacity(0.5);

Assert.assertEquals(arrow.getStroke().getJoinStyle(), JoinStyle.MITER);

builder.insertNode(arrow);

// 2 -  Thick black diagonal line with rounded ends:
Shape line = new Shape(doc, ShapeType.LINE);
line.setTop(40.0);
line.setWidth(200.0);
line.setHeight(20.0);
line.setStrokeWeight(5.0);
line.getStroke().setEndCap(EndCap.ROUND);

builder.insertNode(line);

// 3 -  Arrow with a green fill:
Shape filledInArrow = new Shape(doc, ShapeType.ARROW);
filledInArrow.setWidth(200.0);
filledInArrow.setHeight(40.0);
filledInArrow.setTop(100.0);
filledInArrow.getFill().setForeColor(Color.GREEN);
filledInArrow.getFill().setVisible(true);

builder.insertNode(filledInArrow);

// 4 -  Arrow with a flipped orientation filled in with the Aspose logo:
Shape filledInArrowImg = new Shape(doc, ShapeType.ARROW);
filledInArrowImg.setWidth(200.0);
filledInArrowImg.setHeight(40.0);
filledInArrowImg.setTop(160.0);
filledInArrowImg.setFlipOrientation(FlipOrientation.BOTH);

BufferedImage image = ImageIO.read(getAsposelogoUri().toURL().openStream());
Graphics2D graphics2D = image.createGraphics();

// When we flip the orientation of our arrow, we also flip the image that the arrow contains.
// Flip the image the other way to cancel this out before getting the shape to display it.
AffineTransform at = new AffineTransform();
at.concatenate(AffineTransform.getScaleInstance(1, -1));
at.concatenate(AffineTransform.getTranslateInstance(0, -image.getHeight()));
graphics2D.transform(at);
graphics2D.drawImage(image, 0, 0, null);
graphics2D.dispose();

filledInArrowImg.getImageData().setImage(image);
builder.insertNode(filledInArrowImg);

doc.save(getArtifactsDir() + "Drawing.VariousShapes.docx");

getEndArrowLength/setEndArrowLength

public int getEndArrowLength() / public void setEndArrowLength(int value)
Defines the arrowhead length for the end of a stroke. The value of the property is ArrowLength integer constant.

The default value is ArrowLength.MEDIUM.

Example:

Shows to create a variety of shapes.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// Below are four examples of shapes that we can insert into our documents.
// 1 -  Dotted, horizontal, half-transparent red line
// with an arrow on the left end and a diamond on the right end:
Shape arrow = new Shape(doc, ShapeType.LINE);
arrow.setWidth(200.0);
arrow.getStroke().setColor(Color.RED);
arrow.getStroke().setStartArrowType(ArrowType.ARROW);
arrow.getStroke().setStartArrowLength(ArrowLength.LONG);
arrow.getStroke().setStartArrowWidth(ArrowWidth.WIDE);
arrow.getStroke().setEndArrowType(ArrowType.DIAMOND);
arrow.getStroke().setEndArrowLength(ArrowLength.LONG);
arrow.getStroke().setEndArrowWidth(ArrowWidth.WIDE);
arrow.getStroke().setDashStyle(DashStyle.DASH);
arrow.getStroke().setOpacity(0.5);

Assert.assertEquals(arrow.getStroke().getJoinStyle(), JoinStyle.MITER);

builder.insertNode(arrow);

// 2 -  Thick black diagonal line with rounded ends:
Shape line = new Shape(doc, ShapeType.LINE);
line.setTop(40.0);
line.setWidth(200.0);
line.setHeight(20.0);
line.setStrokeWeight(5.0);
line.getStroke().setEndCap(EndCap.ROUND);

builder.insertNode(line);

// 3 -  Arrow with a green fill:
Shape filledInArrow = new Shape(doc, ShapeType.ARROW);
filledInArrow.setWidth(200.0);
filledInArrow.setHeight(40.0);
filledInArrow.setTop(100.0);
filledInArrow.getFill().setForeColor(Color.GREEN);
filledInArrow.getFill().setVisible(true);

builder.insertNode(filledInArrow);

// 4 -  Arrow with a flipped orientation filled in with the Aspose logo:
Shape filledInArrowImg = new Shape(doc, ShapeType.ARROW);
filledInArrowImg.setWidth(200.0);
filledInArrowImg.setHeight(40.0);
filledInArrowImg.setTop(160.0);
filledInArrowImg.setFlipOrientation(FlipOrientation.BOTH);

BufferedImage image = ImageIO.read(getAsposelogoUri().toURL().openStream());
Graphics2D graphics2D = image.createGraphics();

// When we flip the orientation of our arrow, we also flip the image that the arrow contains.
// Flip the image the other way to cancel this out before getting the shape to display it.
AffineTransform at = new AffineTransform();
at.concatenate(AffineTransform.getScaleInstance(1, -1));
at.concatenate(AffineTransform.getTranslateInstance(0, -image.getHeight()));
graphics2D.transform(at);
graphics2D.drawImage(image, 0, 0, null);
graphics2D.dispose();

filledInArrowImg.getImageData().setImage(image);
builder.insertNode(filledInArrowImg);

doc.save(getArtifactsDir() + "Drawing.VariousShapes.docx");

getEndArrowType/setEndArrowType

public int getEndArrowType() / public void setEndArrowType(int value)
Defines the arrowhead for the end of a stroke. The value of the property is ArrowType integer constant.

The default value is ArrowType.NONE.

Example:

Shows to create a variety of shapes.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// Below are four examples of shapes that we can insert into our documents.
// 1 -  Dotted, horizontal, half-transparent red line
// with an arrow on the left end and a diamond on the right end:
Shape arrow = new Shape(doc, ShapeType.LINE);
arrow.setWidth(200.0);
arrow.getStroke().setColor(Color.RED);
arrow.getStroke().setStartArrowType(ArrowType.ARROW);
arrow.getStroke().setStartArrowLength(ArrowLength.LONG);
arrow.getStroke().setStartArrowWidth(ArrowWidth.WIDE);
arrow.getStroke().setEndArrowType(ArrowType.DIAMOND);
arrow.getStroke().setEndArrowLength(ArrowLength.LONG);
arrow.getStroke().setEndArrowWidth(ArrowWidth.WIDE);
arrow.getStroke().setDashStyle(DashStyle.DASH);
arrow.getStroke().setOpacity(0.5);

Assert.assertEquals(arrow.getStroke().getJoinStyle(), JoinStyle.MITER);

builder.insertNode(arrow);

// 2 -  Thick black diagonal line with rounded ends:
Shape line = new Shape(doc, ShapeType.LINE);
line.setTop(40.0);
line.setWidth(200.0);
line.setHeight(20.0);
line.setStrokeWeight(5.0);
line.getStroke().setEndCap(EndCap.ROUND);

builder.insertNode(line);

// 3 -  Arrow with a green fill:
Shape filledInArrow = new Shape(doc, ShapeType.ARROW);
filledInArrow.setWidth(200.0);
filledInArrow.setHeight(40.0);
filledInArrow.setTop(100.0);
filledInArrow.getFill().setForeColor(Color.GREEN);
filledInArrow.getFill().setVisible(true);

builder.insertNode(filledInArrow);

// 4 -  Arrow with a flipped orientation filled in with the Aspose logo:
Shape filledInArrowImg = new Shape(doc, ShapeType.ARROW);
filledInArrowImg.setWidth(200.0);
filledInArrowImg.setHeight(40.0);
filledInArrowImg.setTop(160.0);
filledInArrowImg.setFlipOrientation(FlipOrientation.BOTH);

BufferedImage image = ImageIO.read(getAsposelogoUri().toURL().openStream());
Graphics2D graphics2D = image.createGraphics();

// When we flip the orientation of our arrow, we also flip the image that the arrow contains.
// Flip the image the other way to cancel this out before getting the shape to display it.
AffineTransform at = new AffineTransform();
at.concatenate(AffineTransform.getScaleInstance(1, -1));
at.concatenate(AffineTransform.getTranslateInstance(0, -image.getHeight()));
graphics2D.transform(at);
graphics2D.drawImage(image, 0, 0, null);
graphics2D.dispose();

filledInArrowImg.getImageData().setImage(image);
builder.insertNode(filledInArrowImg);

doc.save(getArtifactsDir() + "Drawing.VariousShapes.docx");

getEndArrowWidth/setEndArrowWidth

public int getEndArrowWidth() / public void setEndArrowWidth(int value)
Defines the arrowhead width for the end of a stroke. The value of the property is ArrowWidth integer constant.

The default value is ArrowWidth.MEDIUM.

Example:

Shows to create a variety of shapes.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// Below are four examples of shapes that we can insert into our documents.
// 1 -  Dotted, horizontal, half-transparent red line
// with an arrow on the left end and a diamond on the right end:
Shape arrow = new Shape(doc, ShapeType.LINE);
arrow.setWidth(200.0);
arrow.getStroke().setColor(Color.RED);
arrow.getStroke().setStartArrowType(ArrowType.ARROW);
arrow.getStroke().setStartArrowLength(ArrowLength.LONG);
arrow.getStroke().setStartArrowWidth(ArrowWidth.WIDE);
arrow.getStroke().setEndArrowType(ArrowType.DIAMOND);
arrow.getStroke().setEndArrowLength(ArrowLength.LONG);
arrow.getStroke().setEndArrowWidth(ArrowWidth.WIDE);
arrow.getStroke().setDashStyle(DashStyle.DASH);
arrow.getStroke().setOpacity(0.5);

Assert.assertEquals(arrow.getStroke().getJoinStyle(), JoinStyle.MITER);

builder.insertNode(arrow);

// 2 -  Thick black diagonal line with rounded ends:
Shape line = new Shape(doc, ShapeType.LINE);
line.setTop(40.0);
line.setWidth(200.0);
line.setHeight(20.0);
line.setStrokeWeight(5.0);
line.getStroke().setEndCap(EndCap.ROUND);

builder.insertNode(line);

// 3 -  Arrow with a green fill:
Shape filledInArrow = new Shape(doc, ShapeType.ARROW);
filledInArrow.setWidth(200.0);
filledInArrow.setHeight(40.0);
filledInArrow.setTop(100.0);
filledInArrow.getFill().setForeColor(Color.GREEN);
filledInArrow.getFill().setVisible(true);

builder.insertNode(filledInArrow);

// 4 -  Arrow with a flipped orientation filled in with the Aspose logo:
Shape filledInArrowImg = new Shape(doc, ShapeType.ARROW);
filledInArrowImg.setWidth(200.0);
filledInArrowImg.setHeight(40.0);
filledInArrowImg.setTop(160.0);
filledInArrowImg.setFlipOrientation(FlipOrientation.BOTH);

BufferedImage image = ImageIO.read(getAsposelogoUri().toURL().openStream());
Graphics2D graphics2D = image.createGraphics();

// When we flip the orientation of our arrow, we also flip the image that the arrow contains.
// Flip the image the other way to cancel this out before getting the shape to display it.
AffineTransform at = new AffineTransform();
at.concatenate(AffineTransform.getScaleInstance(1, -1));
at.concatenate(AffineTransform.getTranslateInstance(0, -image.getHeight()));
graphics2D.transform(at);
graphics2D.drawImage(image, 0, 0, null);
graphics2D.dispose();

filledInArrowImg.getImageData().setImage(image);
builder.insertNode(filledInArrowImg);

doc.save(getArtifactsDir() + "Drawing.VariousShapes.docx");

getEndCap/setEndCap

public int getEndCap() / public void setEndCap(int value)
Defines the cap style for the end of a stroke. The value of the property is EndCap integer constant.

The default value is EndCap.FLAT.

Example:

Shows to create a variety of shapes.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// Below are four examples of shapes that we can insert into our documents.
// 1 -  Dotted, horizontal, half-transparent red line
// with an arrow on the left end and a diamond on the right end:
Shape arrow = new Shape(doc, ShapeType.LINE);
arrow.setWidth(200.0);
arrow.getStroke().setColor(Color.RED);
arrow.getStroke().setStartArrowType(ArrowType.ARROW);
arrow.getStroke().setStartArrowLength(ArrowLength.LONG);
arrow.getStroke().setStartArrowWidth(ArrowWidth.WIDE);
arrow.getStroke().setEndArrowType(ArrowType.DIAMOND);
arrow.getStroke().setEndArrowLength(ArrowLength.LONG);
arrow.getStroke().setEndArrowWidth(ArrowWidth.WIDE);
arrow.getStroke().setDashStyle(DashStyle.DASH);
arrow.getStroke().setOpacity(0.5);

Assert.assertEquals(arrow.getStroke().getJoinStyle(), JoinStyle.MITER);

builder.insertNode(arrow);

// 2 -  Thick black diagonal line with rounded ends:
Shape line = new Shape(doc, ShapeType.LINE);
line.setTop(40.0);
line.setWidth(200.0);
line.setHeight(20.0);
line.setStrokeWeight(5.0);
line.getStroke().setEndCap(EndCap.ROUND);

builder.insertNode(line);

// 3 -  Arrow with a green fill:
Shape filledInArrow = new Shape(doc, ShapeType.ARROW);
filledInArrow.setWidth(200.0);
filledInArrow.setHeight(40.0);
filledInArrow.setTop(100.0);
filledInArrow.getFill().setForeColor(Color.GREEN);
filledInArrow.getFill().setVisible(true);

builder.insertNode(filledInArrow);

// 4 -  Arrow with a flipped orientation filled in with the Aspose logo:
Shape filledInArrowImg = new Shape(doc, ShapeType.ARROW);
filledInArrowImg.setWidth(200.0);
filledInArrowImg.setHeight(40.0);
filledInArrowImg.setTop(160.0);
filledInArrowImg.setFlipOrientation(FlipOrientation.BOTH);

BufferedImage image = ImageIO.read(getAsposelogoUri().toURL().openStream());
Graphics2D graphics2D = image.createGraphics();

// When we flip the orientation of our arrow, we also flip the image that the arrow contains.
// Flip the image the other way to cancel this out before getting the shape to display it.
AffineTransform at = new AffineTransform();
at.concatenate(AffineTransform.getScaleInstance(1, -1));
at.concatenate(AffineTransform.getTranslateInstance(0, -image.getHeight()));
graphics2D.transform(at);
graphics2D.drawImage(image, 0, 0, null);
graphics2D.dispose();

filledInArrowImg.getImageData().setImage(image);
builder.insertNode(filledInArrowImg);

doc.save(getArtifactsDir() + "Drawing.VariousShapes.docx");

getForeColor/setForeColor

public java.awt.Color getForeColor() / public void setForeColor(java.awt.Color value)
Gets or sets the foreground color of the stroke. The default value for a Shape is java.awt.Color.BLACK.

Example:

Show how to set marker formatting.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

Shape shape = builder.insertChart(ChartType.SCATTER, 432.0, 252.0);
Chart chart = shape.getChart();

// Delete default generated series.
chart.getSeries().clear();
ChartSeries series = chart.getSeries().add("AW Series 1", new double[] { 0.7, 1.8, 2.6, 3.9 },
        new double[] { 2.7, 3.2, 0.8, 1.7 });

// Set marker formatting.
series.getMarker().setSize(40);
series.getMarker().setSymbol(MarkerSymbol.SQUARE);
ChartDataPointCollection dataPoints = series.getDataPoints();
dataPoints.get(0).getMarker().getFormat().getFill().presetTextured(PresetTexture.DENIM);
dataPoints.get(0).getMarker().getFormat().getStroke().setForeColor(Color.YELLOW);
dataPoints.get(0).getMarker().getFormat().getStroke().setBackColor(Color.RED);
dataPoints.get(1).getMarker().getFormat().getFill().presetTextured(PresetTexture.WATER_DROPLETS);
dataPoints.get(1).getMarker().getFormat().getStroke().setForeColor(Color.YELLOW);
dataPoints.get(1).getMarker().getFormat().getStroke().setVisible(false);
dataPoints.get(2).getMarker().getFormat().getFill().presetTextured(PresetTexture.GREEN_MARBLE);
dataPoints.get(2).getMarker().getFormat().getStroke().setForeColor(Color.YELLOW);
dataPoints.get(3).getMarker().getFormat().getFill().presetTextured(PresetTexture.OAK);
dataPoints.get(3).getMarker().getFormat().getStroke().setForeColor(Color.YELLOW);
dataPoints.get(3).getMarker().getFormat().getStroke().setTransparency(0.5);

doc.save(getArtifactsDir() + "Charts.MarkerFormatting.docx");

getImageBytes

public byte[] getImageBytes()
Defines the image for a stroke image or pattern fill.

Example:

Shows how to process shape stroke features.
Document doc = new Document(getMyDir() + "Shape stroke pattern border.docx");
Shape shape = (Shape) doc.getChild(NodeType.SHAPE, 0, true);
Stroke stroke = shape.getStroke();

// Strokes can have two colors, which are used to create a pattern defined by two-tone image data.
// Strokes with a single color do not use the Color2 property.
Assert.assertEquals(new Color((128), (0), (0), (255)), stroke.getColor());
Assert.assertEquals(new Color((255), (255), (0), (255)), stroke.getColor2());

Assert.assertNotNull(stroke.getImageBytes());
FileUtils.writeByteArrayToFile(new File(getArtifactsDir() + "Drawing.StrokePattern.png"), stroke.getImageBytes());

getJoinStyle/setJoinStyle

public int getJoinStyle() / public void setJoinStyle(int value)
Defines the join style of a polyline. The value of the property is JoinStyle integer constant.

The default value is JoinStyle.ROUND.

Example:

Shows how change stroke properties.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

Shape shape = builder.insertShape(ShapeType.RECTANGLE, RelativeHorizontalPosition.LEFT_MARGIN, 100.0,
        RelativeVerticalPosition.TOP_MARGIN, 100.0, 200.0, 200.0, WrapType.NONE);

// Basic shapes, such as the rectangle, have two visible parts.
// 1 -  The fill, which applies to the area within the outline of the shape:
shape.getFill().setForeColor(Color.WHITE);

// 2 -  The stroke, which marks the outline of the shape:
// Modify various properties of this shape's stroke.
Stroke stroke = shape.getStroke();
stroke.setOn(true);
stroke.setWeight(5.0);
stroke.setColor(Color.RED);
stroke.setDashStyle(DashStyle.SHORT_DASH_DOT_DOT);
stroke.setJoinStyle(JoinStyle.MITER);
stroke.setEndCap(EndCap.SQUARE);
stroke.setLineStyle(ShapeLineStyle.TRIPLE);

doc.save(getArtifactsDir() + "Shape.Stroke.docx");

getLineStyle/setLineStyle

public int getLineStyle() / public void setLineStyle(int value)
Defines the line style of the stroke. The value of the property is ShapeLineStyle integer constant.

The default value is ShapeLineStyle.SINGLE.

Example:

Shows how change stroke properties.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

Shape shape = builder.insertShape(ShapeType.RECTANGLE, RelativeHorizontalPosition.LEFT_MARGIN, 100.0,
        RelativeVerticalPosition.TOP_MARGIN, 100.0, 200.0, 200.0, WrapType.NONE);

// Basic shapes, such as the rectangle, have two visible parts.
// 1 -  The fill, which applies to the area within the outline of the shape:
shape.getFill().setForeColor(Color.WHITE);

// 2 -  The stroke, which marks the outline of the shape:
// Modify various properties of this shape's stroke.
Stroke stroke = shape.getStroke();
stroke.setOn(true);
stroke.setWeight(5.0);
stroke.setColor(Color.RED);
stroke.setDashStyle(DashStyle.SHORT_DASH_DOT_DOT);
stroke.setJoinStyle(JoinStyle.MITER);
stroke.setEndCap(EndCap.SQUARE);
stroke.setLineStyle(ShapeLineStyle.TRIPLE);

doc.save(getArtifactsDir() + "Shape.Stroke.docx");

getOn/setOn

public boolean getOn() / public void setOn(boolean value)
Defines whether the path will be stroked.

The default value for a Shape is true.

Example:

Shows how change stroke properties.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

Shape shape = builder.insertShape(ShapeType.RECTANGLE, RelativeHorizontalPosition.LEFT_MARGIN, 100.0,
        RelativeVerticalPosition.TOP_MARGIN, 100.0, 200.0, 200.0, WrapType.NONE);

// Basic shapes, such as the rectangle, have two visible parts.
// 1 -  The fill, which applies to the area within the outline of the shape:
shape.getFill().setForeColor(Color.WHITE);

// 2 -  The stroke, which marks the outline of the shape:
// Modify various properties of this shape's stroke.
Stroke stroke = shape.getStroke();
stroke.setOn(true);
stroke.setWeight(5.0);
stroke.setColor(Color.RED);
stroke.setDashStyle(DashStyle.SHORT_DASH_DOT_DOT);
stroke.setJoinStyle(JoinStyle.MITER);
stroke.setEndCap(EndCap.SQUARE);
stroke.setLineStyle(ShapeLineStyle.TRIPLE);

doc.save(getArtifactsDir() + "Shape.Stroke.docx");

getOpacity/setOpacity

public double getOpacity() / public void setOpacity(double value)
Defines the amount of transparency of a stroke. Valid range is from 0 to 1.

The default value is 1.

Example:

Shows to create a variety of shapes.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// Below are four examples of shapes that we can insert into our documents.
// 1 -  Dotted, horizontal, half-transparent red line
// with an arrow on the left end and a diamond on the right end:
Shape arrow = new Shape(doc, ShapeType.LINE);
arrow.setWidth(200.0);
arrow.getStroke().setColor(Color.RED);
arrow.getStroke().setStartArrowType(ArrowType.ARROW);
arrow.getStroke().setStartArrowLength(ArrowLength.LONG);
arrow.getStroke().setStartArrowWidth(ArrowWidth.WIDE);
arrow.getStroke().setEndArrowType(ArrowType.DIAMOND);
arrow.getStroke().setEndArrowLength(ArrowLength.LONG);
arrow.getStroke().setEndArrowWidth(ArrowWidth.WIDE);
arrow.getStroke().setDashStyle(DashStyle.DASH);
arrow.getStroke().setOpacity(0.5);

Assert.assertEquals(arrow.getStroke().getJoinStyle(), JoinStyle.MITER);

builder.insertNode(arrow);

// 2 -  Thick black diagonal line with rounded ends:
Shape line = new Shape(doc, ShapeType.LINE);
line.setTop(40.0);
line.setWidth(200.0);
line.setHeight(20.0);
line.setStrokeWeight(5.0);
line.getStroke().setEndCap(EndCap.ROUND);

builder.insertNode(line);

// 3 -  Arrow with a green fill:
Shape filledInArrow = new Shape(doc, ShapeType.ARROW);
filledInArrow.setWidth(200.0);
filledInArrow.setHeight(40.0);
filledInArrow.setTop(100.0);
filledInArrow.getFill().setForeColor(Color.GREEN);
filledInArrow.getFill().setVisible(true);

builder.insertNode(filledInArrow);

// 4 -  Arrow with a flipped orientation filled in with the Aspose logo:
Shape filledInArrowImg = new Shape(doc, ShapeType.ARROW);
filledInArrowImg.setWidth(200.0);
filledInArrowImg.setHeight(40.0);
filledInArrowImg.setTop(160.0);
filledInArrowImg.setFlipOrientation(FlipOrientation.BOTH);

BufferedImage image = ImageIO.read(getAsposelogoUri().toURL().openStream());
Graphics2D graphics2D = image.createGraphics();

// When we flip the orientation of our arrow, we also flip the image that the arrow contains.
// Flip the image the other way to cancel this out before getting the shape to display it.
AffineTransform at = new AffineTransform();
at.concatenate(AffineTransform.getScaleInstance(1, -1));
at.concatenate(AffineTransform.getTranslateInstance(0, -image.getHeight()));
graphics2D.transform(at);
graphics2D.drawImage(image, 0, 0, null);
graphics2D.dispose();

filledInArrowImg.getImageData().setImage(image);
builder.insertNode(filledInArrowImg);

doc.save(getArtifactsDir() + "Drawing.VariousShapes.docx");

getStartArrowLength/setStartArrowLength

public int getStartArrowLength() / public void setStartArrowLength(int value)
Defines the arrowhead length for the start of a stroke. The value of the property is ArrowLength integer constant.

The default value is ArrowLength.MEDIUM.

Example:

Shows to create a variety of shapes.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// Below are four examples of shapes that we can insert into our documents.
// 1 -  Dotted, horizontal, half-transparent red line
// with an arrow on the left end and a diamond on the right end:
Shape arrow = new Shape(doc, ShapeType.LINE);
arrow.setWidth(200.0);
arrow.getStroke().setColor(Color.RED);
arrow.getStroke().setStartArrowType(ArrowType.ARROW);
arrow.getStroke().setStartArrowLength(ArrowLength.LONG);
arrow.getStroke().setStartArrowWidth(ArrowWidth.WIDE);
arrow.getStroke().setEndArrowType(ArrowType.DIAMOND);
arrow.getStroke().setEndArrowLength(ArrowLength.LONG);
arrow.getStroke().setEndArrowWidth(ArrowWidth.WIDE);
arrow.getStroke().setDashStyle(DashStyle.DASH);
arrow.getStroke().setOpacity(0.5);

Assert.assertEquals(arrow.getStroke().getJoinStyle(), JoinStyle.MITER);

builder.insertNode(arrow);

// 2 -  Thick black diagonal line with rounded ends:
Shape line = new Shape(doc, ShapeType.LINE);
line.setTop(40.0);
line.setWidth(200.0);
line.setHeight(20.0);
line.setStrokeWeight(5.0);
line.getStroke().setEndCap(EndCap.ROUND);

builder.insertNode(line);

// 3 -  Arrow with a green fill:
Shape filledInArrow = new Shape(doc, ShapeType.ARROW);
filledInArrow.setWidth(200.0);
filledInArrow.setHeight(40.0);
filledInArrow.setTop(100.0);
filledInArrow.getFill().setForeColor(Color.GREEN);
filledInArrow.getFill().setVisible(true);

builder.insertNode(filledInArrow);

// 4 -  Arrow with a flipped orientation filled in with the Aspose logo:
Shape filledInArrowImg = new Shape(doc, ShapeType.ARROW);
filledInArrowImg.setWidth(200.0);
filledInArrowImg.setHeight(40.0);
filledInArrowImg.setTop(160.0);
filledInArrowImg.setFlipOrientation(FlipOrientation.BOTH);

BufferedImage image = ImageIO.read(getAsposelogoUri().toURL().openStream());
Graphics2D graphics2D = image.createGraphics();

// When we flip the orientation of our arrow, we also flip the image that the arrow contains.
// Flip the image the other way to cancel this out before getting the shape to display it.
AffineTransform at = new AffineTransform();
at.concatenate(AffineTransform.getScaleInstance(1, -1));
at.concatenate(AffineTransform.getTranslateInstance(0, -image.getHeight()));
graphics2D.transform(at);
graphics2D.drawImage(image, 0, 0, null);
graphics2D.dispose();

filledInArrowImg.getImageData().setImage(image);
builder.insertNode(filledInArrowImg);

doc.save(getArtifactsDir() + "Drawing.VariousShapes.docx");

getStartArrowType/setStartArrowType

public int getStartArrowType() / public void setStartArrowType(int value)
Defines the arrowhead for the start of a stroke. The value of the property is ArrowType integer constant.

The default value is ArrowType.NONE.

Example:

Shows to create a variety of shapes.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// Below are four examples of shapes that we can insert into our documents.
// 1 -  Dotted, horizontal, half-transparent red line
// with an arrow on the left end and a diamond on the right end:
Shape arrow = new Shape(doc, ShapeType.LINE);
arrow.setWidth(200.0);
arrow.getStroke().setColor(Color.RED);
arrow.getStroke().setStartArrowType(ArrowType.ARROW);
arrow.getStroke().setStartArrowLength(ArrowLength.LONG);
arrow.getStroke().setStartArrowWidth(ArrowWidth.WIDE);
arrow.getStroke().setEndArrowType(ArrowType.DIAMOND);
arrow.getStroke().setEndArrowLength(ArrowLength.LONG);
arrow.getStroke().setEndArrowWidth(ArrowWidth.WIDE);
arrow.getStroke().setDashStyle(DashStyle.DASH);
arrow.getStroke().setOpacity(0.5);

Assert.assertEquals(arrow.getStroke().getJoinStyle(), JoinStyle.MITER);

builder.insertNode(arrow);

// 2 -  Thick black diagonal line with rounded ends:
Shape line = new Shape(doc, ShapeType.LINE);
line.setTop(40.0);
line.setWidth(200.0);
line.setHeight(20.0);
line.setStrokeWeight(5.0);
line.getStroke().setEndCap(EndCap.ROUND);

builder.insertNode(line);

// 3 -  Arrow with a green fill:
Shape filledInArrow = new Shape(doc, ShapeType.ARROW);
filledInArrow.setWidth(200.0);
filledInArrow.setHeight(40.0);
filledInArrow.setTop(100.0);
filledInArrow.getFill().setForeColor(Color.GREEN);
filledInArrow.getFill().setVisible(true);

builder.insertNode(filledInArrow);

// 4 -  Arrow with a flipped orientation filled in with the Aspose logo:
Shape filledInArrowImg = new Shape(doc, ShapeType.ARROW);
filledInArrowImg.setWidth(200.0);
filledInArrowImg.setHeight(40.0);
filledInArrowImg.setTop(160.0);
filledInArrowImg.setFlipOrientation(FlipOrientation.BOTH);

BufferedImage image = ImageIO.read(getAsposelogoUri().toURL().openStream());
Graphics2D graphics2D = image.createGraphics();

// When we flip the orientation of our arrow, we also flip the image that the arrow contains.
// Flip the image the other way to cancel this out before getting the shape to display it.
AffineTransform at = new AffineTransform();
at.concatenate(AffineTransform.getScaleInstance(1, -1));
at.concatenate(AffineTransform.getTranslateInstance(0, -image.getHeight()));
graphics2D.transform(at);
graphics2D.drawImage(image, 0, 0, null);
graphics2D.dispose();

filledInArrowImg.getImageData().setImage(image);
builder.insertNode(filledInArrowImg);

doc.save(getArtifactsDir() + "Drawing.VariousShapes.docx");

getStartArrowWidth/setStartArrowWidth

public int getStartArrowWidth() / public void setStartArrowWidth(int value)
Defines the arrowhead width for the start of a stroke. The value of the property is ArrowWidth integer constant.

The default value is ArrowWidth.MEDIUM.

Example:

Shows to create a variety of shapes.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// Below are four examples of shapes that we can insert into our documents.
// 1 -  Dotted, horizontal, half-transparent red line
// with an arrow on the left end and a diamond on the right end:
Shape arrow = new Shape(doc, ShapeType.LINE);
arrow.setWidth(200.0);
arrow.getStroke().setColor(Color.RED);
arrow.getStroke().setStartArrowType(ArrowType.ARROW);
arrow.getStroke().setStartArrowLength(ArrowLength.LONG);
arrow.getStroke().setStartArrowWidth(ArrowWidth.WIDE);
arrow.getStroke().setEndArrowType(ArrowType.DIAMOND);
arrow.getStroke().setEndArrowLength(ArrowLength.LONG);
arrow.getStroke().setEndArrowWidth(ArrowWidth.WIDE);
arrow.getStroke().setDashStyle(DashStyle.DASH);
arrow.getStroke().setOpacity(0.5);

Assert.assertEquals(arrow.getStroke().getJoinStyle(), JoinStyle.MITER);

builder.insertNode(arrow);

// 2 -  Thick black diagonal line with rounded ends:
Shape line = new Shape(doc, ShapeType.LINE);
line.setTop(40.0);
line.setWidth(200.0);
line.setHeight(20.0);
line.setStrokeWeight(5.0);
line.getStroke().setEndCap(EndCap.ROUND);

builder.insertNode(line);

// 3 -  Arrow with a green fill:
Shape filledInArrow = new Shape(doc, ShapeType.ARROW);
filledInArrow.setWidth(200.0);
filledInArrow.setHeight(40.0);
filledInArrow.setTop(100.0);
filledInArrow.getFill().setForeColor(Color.GREEN);
filledInArrow.getFill().setVisible(true);

builder.insertNode(filledInArrow);

// 4 -  Arrow with a flipped orientation filled in with the Aspose logo:
Shape filledInArrowImg = new Shape(doc, ShapeType.ARROW);
filledInArrowImg.setWidth(200.0);
filledInArrowImg.setHeight(40.0);
filledInArrowImg.setTop(160.0);
filledInArrowImg.setFlipOrientation(FlipOrientation.BOTH);

BufferedImage image = ImageIO.read(getAsposelogoUri().toURL().openStream());
Graphics2D graphics2D = image.createGraphics();

// When we flip the orientation of our arrow, we also flip the image that the arrow contains.
// Flip the image the other way to cancel this out before getting the shape to display it.
AffineTransform at = new AffineTransform();
at.concatenate(AffineTransform.getScaleInstance(1, -1));
at.concatenate(AffineTransform.getTranslateInstance(0, -image.getHeight()));
graphics2D.transform(at);
graphics2D.drawImage(image, 0, 0, null);
graphics2D.dispose();

filledInArrowImg.getImageData().setImage(image);
builder.insertNode(filledInArrowImg);

doc.save(getArtifactsDir() + "Drawing.VariousShapes.docx");

getTransparency/setTransparency

public double getTransparency() / public void setTransparency(double value)
Gets or sets a value between 0.0 (opaque) and 1.0 (clear) representing the degree of transparency of the stroke. The default value is 0.

Example:

Show how to set marker formatting.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

Shape shape = builder.insertChart(ChartType.SCATTER, 432.0, 252.0);
Chart chart = shape.getChart();

// Delete default generated series.
chart.getSeries().clear();
ChartSeries series = chart.getSeries().add("AW Series 1", new double[] { 0.7, 1.8, 2.6, 3.9 },
        new double[] { 2.7, 3.2, 0.8, 1.7 });

// Set marker formatting.
series.getMarker().setSize(40);
series.getMarker().setSymbol(MarkerSymbol.SQUARE);
ChartDataPointCollection dataPoints = series.getDataPoints();
dataPoints.get(0).getMarker().getFormat().getFill().presetTextured(PresetTexture.DENIM);
dataPoints.get(0).getMarker().getFormat().getStroke().setForeColor(Color.YELLOW);
dataPoints.get(0).getMarker().getFormat().getStroke().setBackColor(Color.RED);
dataPoints.get(1).getMarker().getFormat().getFill().presetTextured(PresetTexture.WATER_DROPLETS);
dataPoints.get(1).getMarker().getFormat().getStroke().setForeColor(Color.YELLOW);
dataPoints.get(1).getMarker().getFormat().getStroke().setVisible(false);
dataPoints.get(2).getMarker().getFormat().getFill().presetTextured(PresetTexture.GREEN_MARBLE);
dataPoints.get(2).getMarker().getFormat().getStroke().setForeColor(Color.YELLOW);
dataPoints.get(3).getMarker().getFormat().getFill().presetTextured(PresetTexture.OAK);
dataPoints.get(3).getMarker().getFormat().getStroke().setForeColor(Color.YELLOW);
dataPoints.get(3).getMarker().getFormat().getStroke().setTransparency(0.5);

doc.save(getArtifactsDir() + "Charts.MarkerFormatting.docx");

getVisible/setVisible

public boolean getVisible() / public void setVisible(boolean value)
Gets or sets a flag indicating whether the stroke is visible. The default value for a Shape is true.

Example:

Show how to set marker formatting.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

Shape shape = builder.insertChart(ChartType.SCATTER, 432.0, 252.0);
Chart chart = shape.getChart();

// Delete default generated series.
chart.getSeries().clear();
ChartSeries series = chart.getSeries().add("AW Series 1", new double[] { 0.7, 1.8, 2.6, 3.9 },
        new double[] { 2.7, 3.2, 0.8, 1.7 });

// Set marker formatting.
series.getMarker().setSize(40);
series.getMarker().setSymbol(MarkerSymbol.SQUARE);
ChartDataPointCollection dataPoints = series.getDataPoints();
dataPoints.get(0).getMarker().getFormat().getFill().presetTextured(PresetTexture.DENIM);
dataPoints.get(0).getMarker().getFormat().getStroke().setForeColor(Color.YELLOW);
dataPoints.get(0).getMarker().getFormat().getStroke().setBackColor(Color.RED);
dataPoints.get(1).getMarker().getFormat().getFill().presetTextured(PresetTexture.WATER_DROPLETS);
dataPoints.get(1).getMarker().getFormat().getStroke().setForeColor(Color.YELLOW);
dataPoints.get(1).getMarker().getFormat().getStroke().setVisible(false);
dataPoints.get(2).getMarker().getFormat().getFill().presetTextured(PresetTexture.GREEN_MARBLE);
dataPoints.get(2).getMarker().getFormat().getStroke().setForeColor(Color.YELLOW);
dataPoints.get(3).getMarker().getFormat().getFill().presetTextured(PresetTexture.OAK);
dataPoints.get(3).getMarker().getFormat().getStroke().setForeColor(Color.YELLOW);
dataPoints.get(3).getMarker().getFormat().getStroke().setTransparency(0.5);

doc.save(getArtifactsDir() + "Charts.MarkerFormatting.docx");

getWeight/setWeight

public double getWeight() / public void setWeight(double value)
Defines the brush thickness that strokes the path of a shape in points.

The default value for a Shape is 0.75.

Example:

Shows how change stroke properties.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

Shape shape = builder.insertShape(ShapeType.RECTANGLE, RelativeHorizontalPosition.LEFT_MARGIN, 100.0,
        RelativeVerticalPosition.TOP_MARGIN, 100.0, 200.0, 200.0, WrapType.NONE);

// Basic shapes, such as the rectangle, have two visible parts.
// 1 -  The fill, which applies to the area within the outline of the shape:
shape.getFill().setForeColor(Color.WHITE);

// 2 -  The stroke, which marks the outline of the shape:
// Modify various properties of this shape's stroke.
Stroke stroke = shape.getStroke();
stroke.setOn(true);
stroke.setWeight(5.0);
stroke.setColor(Color.RED);
stroke.setDashStyle(DashStyle.SHORT_DASH_DOT_DOT);
stroke.setJoinStyle(JoinStyle.MITER);
stroke.setEndCap(EndCap.SQUARE);
stroke.setLineStyle(ShapeLineStyle.TRIPLE);

doc.save(getArtifactsDir() + "Shape.Stroke.docx");

See Also:
          Aspose.Words Documentation - the home page for the Aspose.Words Product Documentation.
          Aspose.Words Support Forum - our preferred method of support.