Free Support Forum - aspose.com

Style for a range of cells

Hello ,

I’ m trying to change the backgroundcolor of a range of cells. But if I create a new style, it also changes the font and formating. Is it possible to define that the style doesn’t affect font ( like in Excel) ? Another solution would be if I predefine a custom style in Excel, and use that style on the range. But I can’t get a reference to the predefined styles in de designerfile.
I know I can change the background for every cell in the range ( changing them one by one), but one of the above solutions would be much nicer.

Luc

Hi Luc,

Aspose.Excel object model has some diffrences with MS Excel. Range.Style is used to set same style to a whole range with same formatting(without caring the different settings). It's much faster.

In your case, you can set one by one. This approach retains previous settings but is slower.

Actually if I provide a range setting method as your wish, I also set them one by one.

Hello Laurence,

thanks for your fast reply. Not the best solution changing them one by one, but I get a workaround, so no big problem.
In the meantime I get 2 others questions : I noticed yesterday ( after posting this message) that the indent of cells get lost. And I mean cells with just text that aren’t changed by code. Strange 'cause everything else seems to be preserved perfect. Is it a big problem to solve this , because we use quite a lot of indents in our designer file ? ( not very urgent, would be enough if I know you’re working on it ).
And problem 2 : on opening in MS Excel a by code processed file, I always get the message 'Name conflict - name can not be the same as built-in name. Old name : print_area '. Which forces to input any name. I guess and hope it’s something from the evaluation version ?


If priorities don’t change again I really start implementing charts today (cfr. my question a few weeks ago. Quick test looked ok ). I hope I won’t come in problems, 'cause that’s really important to us. But so far Aspose Ecel seems to be the tool we’re looking for … Yes

Luc

Hi Luc,

Which version are you using? We have found and fixed these two problems in old versions. Please download the latest version at http://www.aspose.com/Products/Aspose.Excel/Downloads.html.

If the problem still occurs, please upload your sample code and template file here. I will check them ASAP.

Hi Laurence,

I am running into a problem by setup the format one by one. I just posted my thread. Is there any other way I can make the format working without a “TOO many different cell format”?

thank you

Which version are you using? We have already fixed this bug in the latest version. Please download it at http://www.aspose.com/Products/Aspose.Excel/Downloads.html.