range.CopyStyles(range1) working with unexpected results in table

Dear All,

I have wrong behavior of method of Range CopyStyles(Range range).

Original file (see attachmentsCopyStyleIssueAsposeExample.zip (8.5 KB)
) contains table, first row is with formatted text.
After i`m applying rangeToApplyStyles.CopyStyle(rangeToGetStyles), i expect that all the rows below first one will have the same style of text, but its behavior is unexpected.

I have the problem even with latest version (19.9.0)

also another problem is that if u will use the Copy(Range range) instead of Copy styles - styles are applying, but then ListObjects in worksheet are getting deleted in code

Code example:

Worksheet ws = ((Workbook) document).Worksheets[0];

var rangeToGetStyles = ws.Cells.CreateRange("G5:I5");
var rangeToApplyStyles = ws.Cells.CreateRange("G6:I11");

rangeToApplyStyles.CopyStyle(rangeToGetStyles);

((Workbook)document).Save("Test", SaveFormat.Xlsx);

Could you please help me on this topic?

Thank u in advance.
Best regards,

Olexandr

@tolexandr,
Regarding first issue where using CopyStyle() is copying style to one row only is expected behaviour
as it copies style to number of rows and columns in the source range. If you enlarge the source range to e.g. 3 rows and 3 columns, then CopyStyle() function will copy style to same number of rows and columns that is 3 rows and 3 columns in the destination range.

Regarding the second issue, I couldn’t observe it as after using Copy(), and then saving the output file, when ListObjects() is checked, it contains same data as before saving the file. Could you please explain the issue in details by providing snapshots etc. for our understanding.

@ahsaniqbalsidiqui,
If u will try in debug, after the Copy() method is executed the ListObjects of worksheet got empty

@ahsaniqbalsidiqui regarding first issue - i even tried to do the same but with each row one by one, the styling is not applying anyway

Please share images showing this list before and after calling the Copy function. I have reviewed it thoroughly but could not observe any difference before and after Copy function.

Please share your sample code with us. We will test it here and share our feedback after analysis.