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

Free Support Forum - aspose.com

Shape font color wrong after copying sheet

I have excel file (attached) which has “Sheet1” that contains single shape. My code creates copies of that sheet and changes the fill and text color of the shape on each sheet. Finally the workbook is saved with different name.


Problem: Shape that should be yellow with black text is actually yellow with white text.

This might have something to do with the copying of sheets because everything works if I don’t do that (unfortunately I have to create copies of those sheets). If you change my code to color the shapes in different order (e.g. first shape is black and last one is yellow) then you’ll get black shape with black text even though the text should be white.

Maybe I’m setting the shape text color wrong somehow?

I’m using the code below:

public static void ShapeTest()
{
var excelFile = @“c:\temp\shape_test.xlsx”;
var newFile = @“c:\temp\shape_test_new.xlsx”;

var workbook = new Workbook(excelFile);

CreateSheetAndChangeShape(workbook, Color.Yellow, Color.Black, “Yellow with Black text”);
CreateSheetAndChangeShape(workbook, Color.Black, Color.White, “Black with White text”);
CreateSheetAndChangeShape(workbook, Color.Red, Color.White, “Red with White text”);

CreateSheetAndChangeShape(workbook, Color.Yellow, Color.Black, “Yellow with Black text”);
CreateSheetAndChangeShape(workbook, Color.Black, Color.White, “Black with White text”);
CreateSheetAndChangeShape(workbook, Color.Red, Color.White, “Red with White text”);

workbook.Save(newFile);
}

public static void CreateSheetAndChangeShape(
Workbook workbook,
System.Drawing.Color fillColor,
System.Drawing.Color textColor,
string text)
{
var index = workbook.Worksheets.AddCopy(“Sheet1”);
var sheet = workbook.Worksheets[index];
ChangeShape(sheet, fillColor, textColor, text);
}

public static void ChangeShape(
Worksheet sheet,
System.Drawing.Color fillColor,
System.Drawing.Color textColor,
string text)
{
var shape = sheet.Shapes.FirstOrDefault(x => x.Name == “MyShape”);
shape.LineFormat.ForeColor = fillColor;
shape.Fill.SolidFill.CellsColor.Color = fillColor;
shape.Fill.SolidFill.Color = fillColor;
shape.Text = text;
shape.Font.Color = textColor;
}

Hi Toni,


Thank you for the samples.

We have evaluated the presented scenario while using the latest version of Aspose.Cells for .NET 8.6.1.2, and we have noticed that all colors are being set properly with an exception of Yellow with Black text. We will check it further to log an appropriate ticket for product team.

Hi!


Yes, the bug is also in the 8.1.6.2 version.

Hi,

Thanks for your posting and using Aspose.Cells.

We were able to replicate this issue using the latest version: Aspose.Cells
for .NET v8.6.1.2
by executing your sample code with
your source excel file and found the sheet2 and sheet5 in the resultant
output excel file are wrong. The font color of Yellow with Black text shape is wrong. The color should be black.

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

This issue has been logged as

  • CELLSNET-44060 - Shape font color wrong after copying sheet

Hi again,


This is to update you that we have fixed the problem logged earlier as CELLSNET-44060. We will shortly provide the fix here after insuring the quality of the build and incorporating other enhancements.

Hi,

Thanks for using Aspose.Cells.

Please download and try the latest fix: Aspose.Cells
for .NET v8.6.1.6
and let us know your feedback.

I can confirm that this works correctly with the latest version. Hopefully there will be a nuget package soon.

Hi,


Good to know that your issue is sorted out by the new fix. Feel free to contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.

Note: We only upload our official releases of the product to nuget repository once we publish them in the Downloads module. Our next official release (v8.6.2) is scheduled to be released within a week or so, you will get the latest version accordingly

Thank you.

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


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.