We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Drawing Arcs

Hi,

using addShape(MsoDrawingType.ARC...) I would like to draw an arc which is other than a quarter of a circle (that seems to be the default). How I can I achieve that?

Thanks,
Manfred

Hi,


Please see the document/ article on how to create different drawing objects including Arc control for your reference:
http://www.aspose.com/docs/display/cellsjava/Working+with+Controls

Note: please see the description text and example under “Adding Arc Control to the Worksheet” sub-heading for your reference.

Thank you.

Thank you for the reply. However, the example you've mentioned shows only how to draw the default arc which is a quarter of a circle (90 degrees).

I need to draw an arc which spans a certain number of degrees (not necessarily those 90).

Regards,
Manfred

Hi,


Could you create an Excel file containing your desired Arc shape in Ms Excel manually, save the file to post us here, we will check it soon.

Thank you.

Sure, here it is ...

Thanks,
Manfred

Hi Manfred,

Thanks for your posting and using Aspose.Cells for Java.

It seems this feature is not supported and you cannot currently draw an arc which is other than the quarter of a circle. Therefore, we have logged a New Feature request for this issue.

We will investigate it and implement it. In case, the feature is already present, we will provide you a sample code. Please spare us some time. Once, there is fix or some other update for you, we will let you know asap.

This issue has been logged as

  • CELLSJAVA-41041 - Draw an Arc which is other than a quarter of a circle

However, as a workaround, you can import your shape from your source file into your destination file using the Shapes.addCopy() method. Please see the following code. It copies your arc shape into another workbook object. I have also attached the output Excel file generated by the code for your reference.

Java

String filePath = “F:\Shak-Data-RW\Downloads\ArcShape.xls”;


Workbook wk = new Workbook(filePath);


//Access the source shape

Shape sh = wk.getWorksheets().get(0).getShapes().get(0);


Workbook workbook = new Workbook();

Worksheet worksheet = workbook.getWorksheets().get(0);


//Add the copy of source shape

worksheet.getShapes().addCopy(sh, 2, 2, 2, 2);


workbook.save(“output.xls”);


Hi Shakeel,

thank you for logging that as a new feature request.

I have to create the spreadsheet from scratch, however, so I have to find another workaround.

Regards,
Manfred

Hi Manfred,

Thanks for your posting and using Aspose.Cells.

If you want to create Arc shape from scratch, then you will have to wait till we could implement this feature in our next versions. However, if you can create your Arc shape manually using Microsoft Excel, then you can import it programmatically inside your new workbook with the same approach as I shown in above post.

Hi,


This is to update you that the shape in your file is a freeform shape and we cannot simply provide API to add such a shape because the shape is constructed by points and path.

So, please copy such shape from other file as we cannot fix the issue now.

Thank you.