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

Free Support Forum - aspose.com

How to reset Cell Background Color in C++

Hi,

I’m trying to set the background color of an excel cell to default. I tried it with argb(255,255,255,255) for white but the problem is, the outlines disapear.

Is there a chance to set it to default?

@Janosh,

Could you please try to set foreground color (SetForegroundColor()) with empty color (Color::Empty) if it works for your needs?

Thanks for your help, but it didn’t really worked out for me. The cell ist now gray.
Screenshot 2022-04-06 155712.png (254 Bytes)

@Janosh,

Could you please share your sample code (runnable) and template Excel file(s) to show the issue. Did you also try setting the background color (SetBackgroundColor) to empty color if it makes any difference?

PS. please zip the files prior attaching here.

I found the problem, now it seems to kinda work. Now the cell color ist set to empty, but there are no outlinings for the cell, is there a way to get this working? I have attached another screenshot, cell 17 is set to empty. I tried SetForegroundColor and SetBackgroundColor both with and without BackgroundType::BackgroundType_Solid. I noticed when I click in Excel “no filling”, the outlinings appear, so I think there is a value who also needs to be set. It isn’t really possible to get this sample code, the code is already in an project. The project is connected with a whird party projekt wich is confidential.

Edit: I tried to set in Excel the format of the cell to “standard”, is there another way to get arround the format settings?

I hope this helps a little bit to find the problem.Screenshot 2022-04-07 093645.zip (1.6 KB)

@Janosh,

Thanks for the screenshot and details.
I think you do not need to set foreground or background color to empty color. Please try the following line of code only to set the pattern to none:
e.g.
Sample code:

.......
style->SetPattern(BackgroundType::BackgroundType_None);
.....

Hope, this helps a bit.

@Amjad_Sahi

Thanks a lot, now it seems to work. All of my tests suceeded .

Tank you for your help and quick and helpful answers.

@Janosh,

Good to know that your issue is sorted out by the suggested line of code. Feel free to write us back if you have further queries or issue, we will be happy to assist you soon.