SpreadsheetGear draw an arow

85 Views Asked by At

How can draw arrow in excel file with SpreadsheetGear component?

I create excel file with c# code and I have 2 Data table for show in my excel .

now I want to draw arrow and connect each row of 2 data tabelenter image description here

1

There are 1 best solutions below

0
Tim Andersen On

UPDATE

SpreadsheetGear 2023 / V9 is now available and supports specifying arrowheads on lines:

// Create a new workbook.
IWorkbook workbook = Factory.GetWorkbook();

// Add a line shape.
IShape shape = workbook.ActiveWorksheet.Shapes.AddLine(25, 25, 125, 55);

// Set the weight of the line if needed.
shape.Line.Weight = 2;

// Set line color if needed.
shape.Line.ForeColor.RGB = SpreadsheetGear.Colors.Crimson;

// Specify begin marker's style, width and length.
shape.Line.BeginArrowheadStyle = ArrowheadStyle.Oval;
shape.Line.BeginArrowheadWidth = ArrowheadWidth.Medium;
shape.Line.BeginArrowheadLength = ArrowheadLength.Medium;

// Do the same for the end marker.
shape.Line.EndArrowheadStyle = ArrowheadStyle.Triangle;
shape.Line.EndArrowheadWidth = ArrowheadWidth.Wide;
shape.Line.EndArrowheadLength = ArrowheadLength.Medium;

Results:

enter image description here

Please see the SpreadsheetGear API Samples > Shapes > Lines > Arrowheads sample for more examples of using this new API. See also the following documentation links:

ORIGINAL RESPONSE

The current version (SpreadsheetGear 2017 / V8) does not yet support markers (such as arrowheads or ovals) on the ends of Line shapes, so you won't be able to add these objects today, unfortunately.

That said, the next major release (V9) will add support for this feature. We are not yet ready to discuss a release date for V9, but hope to have news on this soon. I will make a reminder to update this Answer when V9 is released and show you how this can be done with the new version.