Cell.Copy does not copy format from one workbook to another

Hi,

I have a problem which didn´t occur in 16.10.0, but occurs in 16.11.0 and also in 16.11.6.

Cell.Copy does not copy cell style (font, background color) from one workbook to another.
It works, with just copiing the cell from one worksheet to another in the same workbook.

Following code is to reproduce the error. No exception is thrown.

private static void Test_CopyCell()
{
string srcFilePath = @“C:\temp\Test_Format_Copy_Base.xlsm”;
string tgtFilePath = @“C:\temp\Test_Format_Copy_Tgt.xlsx”;
<span style="color:#2b91af;">Workbook</span> wbSource = <span style="color:blue;">new</span> <span style="color:#2b91af;">Workbook</span>(srcFilePath);
<span style="color:#2b91af;">Workbook</span> wbTarget = <span style="color:blue;">new</span> <span style="color:#2b91af;">Workbook</span>(tgtFilePath);

<span style="color:#2b91af;">Worksheet</span> wsSource = wbSource.Worksheets[<span style="color:#a31515;">"Table1"</span>];
<span style="color:#2b91af;">Worksheet</span> wsTarget = wbTarget.Worksheets[<span style="color:#a31515;">"Table1"</span>];
<span style="color:#2b91af;">Worksheet</span> wsTarget_SameWb = wbSource.Worksheets[<span style="color:#a31515;">"Table2"</span>];

<span style="color:#2b91af;">Cell</span> sourceCell = wsSource.Cells[0 ,0];
<span style="color:#2b91af;">Cell</span> targetCell = wsTarget.Cells[0, 0];
<span style="color:#2b91af;">Cell</span> targetCell_SameWb = wsTarget_SameWb.Cells[0, 0];

targetCell.Copy(sourceCell);            <span style="color:green;">//<- Works </span>
targetCell_SameWb.Copy(sourceCell);     <span style="color:green;">//<- Does not work</span>

wbTarget.Save(wbTarget.FileName);
wbSource.Save(wbSource.FileName);

}

My system: Win7 64bit, .Net 4.0

I hope this is enough information for you.

Hi,


Thanks for providing us template files, sample code and details.

After an initial test, I was able to reproduce the issue as you mentioned by using your sample code with your template file(s). I found that Cell.Copy method does not copy cell styles (fonts, background/foreground color, etc.) from one workbook to another. It works just fine with copying the cell (with its formattings) from one worksheet to another in the same workbook though. Also, I noticed (as I tested) it works fine (Cell.Copy method does copy cell styles (fonts, background/foreground color, etc.) from one workbook to another) using v16.10.0 (previous version):
e.g
Sample code:

string srcFilePath = @“e:\test2\Test_Format_Copy_Base.xlsm”;
string tgtFilePath = @“e:\test2\Test_Format_Copy_Tgt.xlsx”;

Workbook wbSource = new Workbook(srcFilePath);
Workbook wbTarget = new Workbook(tgtFilePath);

Worksheet wsSource = wbSource.Worksheets[“Table1”];
Worksheet wsTarget = wbTarget.Worksheets[“Table1”];
Worksheet wsTarget_SameWb = wbSource.Worksheets[“Table2”];

Cell sourceCell = wsSource.Cells[0, 0];
Cell targetCell = wsTarget.Cells[0, 0];
Cell targetCell_SameWb = wsTarget_SameWb.Cells[0, 0];

targetCell.Copy(sourceCell); //<- Does not work
targetCell_SameWb.Copy(sourceCell); //<- Works

wbTarget.Save(“e:\test2\out1.xlsx”);
wbSource.Save(“e:\test2\out2.xlsm”);

I have logged a ticket with an id “CELLSNET-44953” for your issue. We will look into it soon.

Once we have an update on it, we will let you know here.

Thank you.

Hi again,


This is to update you that the ticket logged earlier as CELLSNET-44953 has been marked resolved. We will shortly share the fix here for your testing.
Hi,

Thanks for using Aspose.Cells.

Please download and try the latest fix: Aspose.Cells for .NET v16.11.8 and let us know your feedback.
If you need .NET 4.0 dll, then please download the latest Aspose.Cells for .NET v16.11.8 (.NET 4.0) version.

The issues you have found earlier (filed as CELLSNET-44953) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

Hi,

Sry for my late answer.
Did not receive a e-mail from you, because my account has been duplicated and the e-mail adress was wrong there.
I have one account -> sabrinaluedtke. But now sabrinaluedtke1, sabrinaluedtke5, sabrinaluedtke6 and sabrinaluedtke7 exists. I don´t know why.

Also my IT changed something so i could not access your site.


But i tested it and it worked fine. Thanks.

Hi,


Well, you originated this thread using account id “sabrinaluedtke5”, so notification was actually sent to the owner (at its registered email) of this thread only.

And, good to know that your issue is sorted out by the new version/fix. Feel free to write us back if you have further comments or questions, we will be happy to assist you soon.

Thank you.

Hi,

Is anyone looking at Aspose.Portal Threads?

Specially at:
Multiple user with one login

Hi,


I have intimated the respective team for your issue and you will be getting a reply in your thread there soon.

Thank you.