Free Support Forum - aspose.com

Keep Formatting When Moving Data

I am currently evaluating Aspose.Cells and am copying columns from one worksheet to another. The worksheet I am copying to already has cell formatting and formulas already created. When I perform the copy and then save, my formatting and formulas are gone. Is there a way to copy the columns from one worksheet to another without losing formats or formulas? I have attached my demo project.

Thanks in advance!!

Hi,


I think you may confirm in MS Excel manually, when you copy columns from a CSV file to an Excel (XLSX) file sheet, the formatting would be gone. Aspose.Cells follows MS Excel’s standards.

I think about your needs, you may try to use Range objects and use Range.CopyDate() or other methods for your requirements.

E.g

Range r1 = destCells.CreateRange(“A1:C100”);
Range r2 = sourceCells.CreateRange(“A1:C100”);
r1.CopyData(r2);

See the document for your reference:
http://www.aspose.com/docs/display/cellsnet/Copy+Range+Data+Only

Thank you.

Before sending I did manually confirm that you can copy columns from one sheet and paste only the values, thus keeping the formatting and formulas. I am using Microsoft Office Professional Plus 2013. I will try using the range method, but I think copying and keeping the formats and formulas would be a pretty standard function.

Hi,

Thanks for your posting and using Aspose.Cells.

Please use Range object for your needs. It should solve your problem. If you still encounter this issue, please provide us your sample project replicating this issue with source input and output files. We will look into your issue and help you asap.