Spire.XLS is a professional Excel API that enables developers to create, manage, manipulate, convert and print Excel worksheets. Get free and professional technical support for Spire.XLS for .NET, Java, Android, C++, Python.

Wed Feb 21, 2018 3:35 pm

Hello,

I want to create a multi-range. I have a list of range as string for example "A1:B2", "A5:B6", ...
and i want to create a ConditionalFormat on this multiRange but i don't know how.

CondFormat.PNG
CondFormat.PNG (37.33 KiB) Viewed 2472 times


I have try somethings but without success
Code: Select all
var range = ws.Range["A1;B2;C3"]; // : 'Character ; was not expected.'
range = ws.Range["A1"].AddCombinedRange(ws.Range["B2"]); // return A1


Do you have a solution ?

Thanks
Last edited by VincentB on Thu Feb 22, 2018 8:05 am, edited 1 time in total.

VincentB
 
Posts: 120
Joined: Thu Sep 15, 2016 9:44 am

Thu Feb 22, 2018 6:42 am

Hello,

Thanks for your feedback. Sorry that currently there is no any ways to achieve this, and I have logged it into our enhancement list, once it is achieved, we will let you know ASAP.

Sincerely,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Wed Apr 18, 2018 4:05 am

Hello,

Glad to inform your that the issue has been fixed. Please download Spire.XLS Pack(Hotfix) Version:8.4.6 and refer to the below code snippet to have a try.
Code: Select all
Workbook workBook = new Workbook();
workBook.LoadFromFile(inputFile);
Worksheet sheet = workBook.Worksheets[0];
XlsConditionalFormats xcfs = sheet.ConditionalFormats.Add();
xcfs.AddRange(sheet.Range["A1:A3"]);
xcfs.AddRange(sheet.Range["A5:A7"]);
xcfs.AddRange(sheet.Range["A9:A11"]);
IConditionalFormat cf = xcfs.AddAverageCondition(AverageType.Below);
cf.BackColor = Color.Red;
workBook.SaveToFile(outputFile, FileFormat.Version2010);


Sincerely,
Simon
E-iceblue support team
User avatar

Simon.yang
 
Posts: 620
Joined: Wed Jan 11, 2017 2:03 am

Thu Apr 19, 2018 8:47 am

Hello,

Greeting from E-iceblue.
Has the hotfix resolved your issue?
We will appreciate it if you could give us some feedback.

Best regards,
Simon
E-iceblue support team
User avatar

Simon.yang
 
Posts: 620
Joined: Wed Jan 11, 2017 2:03 am

Thu Apr 19, 2018 9:31 am

Hello,

It's work !

Thanks

VincentB
 
Posts: 120
Joined: Thu Sep 15, 2016 9:44 am

Thu Apr 19, 2018 9:43 am

Hi Vincent,

Thanks for your prompt reply. If there is any other question, welcome to write to us.

Best regards,
Simon
E-iceblue support team
User avatar

Simon.yang
 
Posts: 620
Joined: Wed Jan 11, 2017 2:03 am

Return to Spire.XLS

cron