Free Support Forum - aspose.com

[shape.FillFormat.SetOneColorGradient]this code dosen't work?

Hi

I want change shape’s color use this code, but this code dosen’t work.
code:
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
Shape rectShape = worksheet.Shapes.AddAutoShape(AutoShapeType.Rectangle, 10, 10, 10, 10, 50, 100);
// The gradient degree. Can be a value from 0.0 (dark) through 1.0 (light).
// but it dosen’t work
double degree = 0.8;
rectShape.FillFormat.SetOneColorGradient(Color.Red, degree, GradientStyleType.Horizontal, 4);
workbook.Save(@“d:\test.xls”);

Thank you.

Hi,

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

Please download and use the latest version:
Aspose.Cells
for .NET v7.3.3.4
. It works fine.

We have tested your code with the latest version and did not find any issue.

Please check the attached output xls and xlsx files generated by your code. Please also see the screenshot for your reference.

C#


Workbook workbook = new Workbook();

Worksheet worksheet = workbook.Worksheets[0];

Shape rectShape = worksheet.Shapes.AddAutoShape(AutoShapeType.Rectangle, 10, 10, 10, 10, 50, 100);

// The gradient degree. Can be a value from 0.0 (dark) through 1.0 (light).

double degree = 0.8;

rectShape.FillFormat.SetOneColorGradient(Color.Red, degree, GradientStyleType.Horizontal, 4);

workbook.Save(“out.xls”, SaveFormat.Excel97To2003);

workbook.Save(“out.xlsx”, SaveFormat.Xlsx);

Screenshot:

thanks!

but I want to get the attached output xls file.

C#


Workbook workbook = new Workbook();

Worksheet worksheet = workbook.Worksheets[0];

Shape rectShape = worksheet.Shapes.AddAutoShape(AutoShapeType.Rectangle, 10, 10, 10, 10, 50, 100);

// The gradient degree. Can be a value from 0.0 (dark) through 1.0 (light).

double degree = 0.8;

rectShape.FillFormat.SetOneColorGradient(Color.Red, degree, GradientStyleType.Horizontal, 4);

workbook.Save(“out.xls”, SaveFormat.Excel97To2003);

workbook.Save(“out.xlsx”, SaveFormat.Xlsx);
------------
i want to change gradient degree. but [double degree = 0.8;] it dosen’t work.

Hi,

Thanks for your further input.

We were able to replicate your issue using the following code. The degree does not have any effect on the gradient when the file is saved in Xls format. However, it does have effect in Xlsx format.

So, Xlsx format works fine but Xls format is failing. Please check the screenshot below.

We have logged this issue in our database. We will look into it and fix this issue. Once the issue is fixed or we have some other update for you, we will let you know asap.

This issue has been logged as CELLSNET-41211.

Below is a sample code for testing this issue.

C#


for (double degree = 0; degree <= 1.0; degree = degree + 0.1)

{

Workbook workbook = new Workbook();


Worksheet worksheet = workbook.Worksheets[0];


Shape rectShape = worksheet.Shapes.AddAutoShape(AutoShapeType.Rectangle, 10, 10, 10, 10, 50, 100);


rectShape.FillFormat.SetOneColorGradient(Color.Red, degree, GradientStyleType.Horizontal, 4);


workbook.Save(“out” + degree + “.xls”, SaveFormat.Excel97To2003);


workbook.Save(“out” + degree + “.xlsx”, SaveFormat.Xlsx);


}

Screenshot:

Hi,

We have fixed this issue.

Please download and try this fix: Aspose.Cells for .NET v7.3.4.1 and let us know your feedback.

Hi

I cann't built my project with Aspose.Cells for .NET v7.3.4.1.

--->Could not find the 'Workbook' The type or namespace.

Hi,

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

It seems you are using Client Profile .NET Framework. Mostly such issue occurs when you try to use Aspose.Cells dll belong to Normal .NET Framework on Client Profile NET Framework.

If that is true, then we will provide you dll that you can use on your Client Profile Framework and it should then resolve your issue.

Hi,

thanks for your answer.

I can set the gradient of the shape with Aspose.Cells for .NET v7.3.4.1

When this version is Published?

Hi,

Thanks for your feedback.

It seems, your issue is resolved now. We have closed this thread.

Let us know if you face any other issue, we will be glad to look into your issue and help you asap.

Hi

When this version is Published?

Hi,

Could you please confirm if your issue is resolved or you are still waiting for ClientProfile dll? Please also confirm if your version of .NET Framework is Normal or Client Profile.

This version is called minor release. You can use minor release for your production use. We will publish a major release (official release) in next month, somewhere in the middle of it.

Both minor and major releases are equally same except major release is published with release notes and both are meant for production use.

Please see the Sample Release Notes for Major Release at the following link. I have also posted a screenshot for your reference.

Release Notes - Aspose.Cells for .NET 7.3.4

Screenshot:

Hi

thanks.

The issues you have found earlier (filed as CELLSNET-41211) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.