How to create freefrom custom line shape in Aspose.Cells

create a custom line shape with an updated point.

Custome Line sample.zip (53.2 KB)

@pixihi,

Thanks for the template Excel file containing the shape.

It seems Aspose.Cells for .NET may not support to insert “Freeform (Scribble)" shape directly. However, we will look into it thoroughly and may devise code segment to accomplish your task. We have already opened the following new ticket(s) in our internal issue tracking system and will devise code segment or deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): CELLSNET-57030

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

@pixihi
You can refer to the following code, hope it helps. This feature will be released with the official version v24.11, but you can also get it from the hotfix v24.10.1.

int w = 248, h = 65;
ShapePath shapePath = new ShapePath();
shapePath.MoveTo(0, 3);
shapePath.LineTo(44, 2);
shapePath.LineTo(100, 1f);
shapePath.CubicBezierTo(108.67f, 0.7885f,
            117.3333f, 0.3333f,
            126, 0f);
shapePath.CubicBezierTo(125f, 1f,
            123.6324f, 1.7351f,
            123, 3f);
shapePath.CubicBezierTo(122.4151f, 4.1697f,
            121.0237f, 14.83412f,
            121, 15f);
shapePath.CubicBezierTo(121.333f, 28.3333f,
            121.2011f, 41.6864f,
            122, 55f);
shapePath.CubicBezierTo(122.2036f, 58.3933f,
            122.349f, 62.028f,
            124, 65f);
shapePath.CubicBezierTo(124.5119f, 65.92147f,
            126.057f, 64.47139f,
            127, 64f);
shapePath.CubicBezierTo(128.075f, 63.4625f,
            128.807f, 62.149f,
            130, 62f);
shapePath.CubicBezierTo(136.9538f, 61.1308f,
            144f, 61.3333f,
            151, 61f);
shapePath.LineTo(248, 62f);
shapePath.CubicBezierTo(248.47139f, 62f,
            247.3333f, 61.3333f,
            247, 61f);

Workbook workbook = new Workbook();
Shape shape= workbook.Worksheets[0].Shapes.AddFreeform(1, 0, 1, 0, h, w, new ShapePath[] { shapePath });
shape.Line.EndArrowheadStyle = MsoArrowheadStyle.ArrowStealth;
workbook.Save("sample.xlsx", SaveFormat.Xlsx);

this code will not work in Aspose.cell v24.10.0

@pixihi,

Yes, it will work fine with the upcoming Aspose.Cells for .NET v24.11. Additionally, if you have purchased priority support, you can also use the hotfix v24.10.1, which will also work fine.

1 Like

The issues you have found earlier (filed as CELLSNET-57030) have been fixed in this update. This message was posted using Bugs notification tool by johnson.shi