Enum CopyFormatType

CopyFormatType enumeration

Represents type of copying format when inserting rows.

public enum CopyFormatType

Values

NameValueDescription
SameAsAbove0Formats same as above row.
SameAsBelow1Formats same as below row.
Clear2Clears formatting.

Examples

namespace AsposeCellsExamples
{
    using Aspose.Cells;
    using System;

    public class CopyFormatTypeDemo
    {
        public static void CopyFormatTypeExample()
        {
            // Create a new workbook
            Workbook workbook = new Workbook();
            Worksheet worksheet = workbook.Worksheets[0];

            // Fill some data in the worksheet
            worksheet.Cells["A1"].PutValue("Header1");
            worksheet.Cells["A2"].PutValue("Data1");
            worksheet.Cells["A3"].PutValue("Data2");

            // Create InsertOptions and set CopyFormatType
            InsertOptions insertOptions = new InsertOptions();
            insertOptions.CopyFormatType = CopyFormatType.SameAsAbove;

            // Insert a row at the second position with the specified format type
            worksheet.Cells.InsertRows(1, 1, insertOptions);

            // Save the workbook
            workbook.Save("CopyFormatTypeExample.xlsx");
            workbook.Save("CopyFormatTypeExample.pdf");
            return;
        }
    }
}

See Also