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

Free Support Forum - aspose.com

Line.SolidFill.Color works inproperly on passing color from Argb or from known name

Anyone has a solution to this ?
I’m trying to draw a shape (Rounded Rectangle or Rectangle, case happens on both), and I give the shape fill color and border fill color, the Argb color is passed exactly to the fill, but always wrong on the border
in this code i’m passing them the same color, and they are not the same in the generated excel

                    workbook.Worksheets[item.Index].Shapes[lastIndex].Fill.SolidFill.Color = System.Drawing.Color.FromArgb(0, 0, 255);
                    workbook.Worksheets[item.Index].Shapes[lastIndex].Line.SolidFill.Color = System.Drawing.Color.FromArgb(0, 0, 255);
                    workbook.Worksheets[item.Index].Shapes[lastIndex].Line.SolidFill.Transparency = 0;
                    workbook.Worksheets[item.Index].Shapes[lastIndex].Line.Weight = 3;
                    workbook.Worksheets[item.Index].Shapes[lastIndex].Line.SolidFill.Color = System.Drawing.Color.FromArgb(0, 0, 255);
                    workbook.Worksheets[item.Index].Shapes[lastIndex].Line.FillType = Aspose.Cells.Drawing.FillType.Solid;

I dunno what Argb should i pass to get the color i want
I want (255, 0, 0) on the border (red) and i always get it a different degree, darker or lighter
any help ?

@mtaimoor,

Thanks for your query.

Please share your complete code (runnable solution), template file, program output file and expected output file created by Excel for our reference and comparison. We will observe the issue and provide assistance after analysis.

@mtaimoor,

I played upon the relevant APIs a bit. After an initial test, I am able to observe the issue as you mentioned by using the following sample code. I found that Line.SolidFill.Color works improperly on shapes (e.g Rectangle, Rounded Rectangle, etc.) when passing color from Argb value or from known name. When we give the shape’s fill color and border fill color exactly the same but we get wrong color (which is always a bit darker/lighter, etc.) on the border:
e.g
Sample code:

//Instantiate a new Workbook.
Workbook excelbook = new Workbook();
//Add a rectangle control.
Aspose.Cells.Drawing.RectangleShape rectangle  = excelbook.Worksheets[0].Shapes.AddRectangle(3, 0,2,0,70,130);
//Set the placement of the rectangle.
rectangle.Placement = PlacementType.FreeFloating; 
//Set the fill format.
rectangle.Fill.SolidFill.Color  = System.Drawing.Color.FromArgb(0, 0, 255);
//Set the line weight.
rectangle.LineFormat.Weight = 3;
//Set the fill transparency
rectangle.Fill.Transparency = 0;
//Set the color of the line.
rectangle.Line.SolidFill.Color = System.Drawing.Color.FromArgb(0, 0, 255);//The border color would be a bit darker instead of normal blue

//Set the dash style of the rectangle.
rectangle.Line.DashStyle  = MsoLineDashStyle.Solid;  

//Save the excel file.
excelbook.Save("e:\\test2\\out1.xlsx");

I have logged a ticket with an id “CELLSNET-46620” for your issue. We will look into it soon.

Once we have an update on it, we will let you know here.

@mtaimoor.

This is to inform you that we have fixed your issue now. We will soon provide you the fixed version after performing QA and incorporating other enhancements and fixes.

@mtaimoor,

Please try our latest version/fix: Aspose.Cells for .NET v19.2.5 (attached)

Your issue should be fixed in it.

Let us know your feedback.
Aspose.Cells19.2.5 For .Net2_AuthenticodeSigned.Zip (4.8 MB)
Aspose.Cells19.2.5 For .Net4.0.Zip (4.8 MB)

The issues you have found earlier (filed as CELLSNET-46620) have been fixed in Aspose.Cells for .NET v19.3. This message was posted using BugNotificationTool from Downloads module by Amjad_Sahi