I am upgrading Aspose.cell 18.104.22.168 to Aspose.Cells 22.214.171.124(for .Net) in my project. I am getting below errors in my previous code:
Warning as Error: ‘Aspose.Cells.Drawing.Shape.FillFormat’ is obsolete: '“Use Shape.Fill property instead.”'
Warning as Error: ‘Aspose.Cells.Drawing.Shape.LineFormat’ is obsolete: 'Use Shape.Line property instead.'
But, I am not getting “IsVisible” or “ForeColor” property in Aspose.Cells.Drawing.Shape.Fill.
Similarily, there is no “IsVisible”, “Style”, “ForeColor” or “BackColor” property in Aspose.Cells.Drawing.Shape.Line.
PFA for screenshot of my sample code where I am getting the errors:
Please suggest on this
- Please use Shape.IsFilled instead of Shape.FillFormat.IsVisible as the IsFilled property indicates if the fill format is visible or not. Similarly, use the Shape.HasLine property instead of Shape.LineFormat.IsVisible as the new HasLine property indicates if border of the shape is visible or not.
- The mechanism to set the fill color has been changed and there is no ForeColor property available for the FillFormat class. Instead, the API has exposed the ForegroundColor property for the PatternFill class and Color property for the SolidFill class. You need to set the FillFormat.FillType property the use the appropriate ForegroundColor or Color property accordingly. Same is the case with LineFormat.ForeColor. Please check the sample code at the bottom of this post for your reference.
Worksheet worksheet = workbook.Worksheets;
int textboxIndex = worksheet.TextBoxes.Add(2, 1, 160, 200);
Shape shape = worksheet.TextBoxes[textboxIndex];
shape.Fill.FillType = FillType.Solid;
shape.Fill.SolidFill.Color = Color.Red;
shape.Line.SolidFill.Color = Color.Yellow;
workbook.Save(dir + “output.xlsx”);
Hi I’m migrating to 17.5 and I cannot find the equivalent of this in Aspose.Cells.net
wordsShape.Stroke.Color2 = excelShape.LineFormat.BackColor;
Hi Walter Stypula,
Do I have to worry about PatternFill being null?