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.

Mon Mar 12, 2018 8:14 pm

Hi,

I'm evaluating Spire.XLS and downloaded the Free version for this.

I searched in this forum (and in Internet) and I did not find how to copy conditional formatting from one cell to another. To illustrate my problem, I created an Excel workbook "Test.xlsx" (attached in this post) with the follow content:

Image

The A2-A8 range has conditional formatting. I need to copy the same conditional formatting to the A9-A20 range. How can I do this?

Thanks in advance,

Marcelo Camarate
Attachments
Test.zip
Excel workbook example
(6.73 KiB) Downloaded 263 times

camarate
 
Posts: 3
Joined: Sun Jan 25, 2015 3:33 pm

Tue Mar 13, 2018 3:26 am

Hello,

Thanks for your inquiry.
Sorry our free version can't fulfill your requirement. Please upgrade to the commercial version (at present the latest version is Spire.XLS Pack(Hotfix) Version:8.3.0) and use below code to accomplish your task. If there is any question, welcome to get it back to us.
Code: Select all
Workbook workbook = new Workbook();
workbook.LoadFromFile("Test.xlsx");
Worksheet sheet = workbook.Worksheets[0];
//Copy data with style from source range to destination range
sheet.Copy(sheet.Range["A2:A8"], sheet.Range["A9:A15"],true);
workbook.SaveToFile("result.xlsx", ExcelVersion.Version2013);

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1187
Joined: Tue Sep 27, 2016 1:06 am

Fri Mar 16, 2018 9:48 am

Hello,

Greetings from E-iceblue.
Did we resolve your issue?
Thanks in advance for your valuable feedback and time.

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1187
Joined: Tue Sep 27, 2016 1:06 am

Return to Spire.XLS