We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

PasteSpecial Paste:=xlPasteFormats

Thread ID:

Created:

Updated:

Platform:

Replies:

53839 Dec 21,2006 03:33 AM Dec 22,2006 07:15 AM Windows Forms 3
loading
Tags: XlsIO
Jan-Erik Carlson
Asked On December 21, 2006 03:33 AM

Is there any fast way in XLSIO to copy the formats of all cells in a row to another row?

Compare to this Excel macro:
Rows("9:9").Select
Selection.Copy
Rows("10:10").Select
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False

Melba Winshia [Syncfusion]
Replied On December 21, 2006 05:50 AM

Hi Janne,

Use the following code snippets to copy the styles and formats of all cells in a row to another row.

[C#]

//Copying the range with styles.
sheet1.Range["A1"].EntireRow.CopyTo(sheet1.Range["C3"].EntireRow,ExcelCopyRangeOptions.CopyStyles);

Here is the sample for your reference:

Copying.zip


Please take a look at the sample above and let me know if you have any other questions.

Best Regards,
Melba


Jan-Erik Carlson
Replied On December 21, 2006 01:10 PM

Hi Melba,

Nice solution. Thanks for your answer.

I assume that your code snippet copy values, styles and formats.
How do I do if I don't want to copy the values, just the styles and formats? "(ExcelCopyRangeOptions.CopyStylesOnly)"

In Excel Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
copyies styles and formats including conditional formatting (Selection.FormatConditions). Is "FormatConditions" included when ExcelCopyRangeOptions.CopyStyles is specified?

Best Regards,
Janne

Melba Winshia [Syncfusion]
Replied On December 22, 2006 07:15 AM

Hi Janne,

Currently we do not provide support to copy the styles and formats alone. So I have created a feature request with the development team. You can track the status here.

http://www.syncfusion.com/support/features/xlsio/Default.aspx?ToDo=view&questId=1425

I will update you as soon as an estimate is available. Sorry for the inconvenience. Please let me know if you have any other questions.

Thanks,
Melba

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;