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.

How to use insert argument in template markers using XlsIO?

This article explains how to use insert argument in template markers using XlsIO.

 

What is insert argument?

 

The argument insert specified in template marker inserts new row or column, depending on the argument direction for each new cell. By default, the rows and columns will not be inserted.

 

Syntax

 

%<MarkerVariable>.<Property>;insert

 

The following arguments can be used in addition with insert argument to do specific operations.

 

  • copystyles – to copy current row/column style into the newly inserted row/column
  • copymerges – to copy merged cells into the newly inserted row/column
  • copystyles and copymerges – to copy both style and merged cells from current row/column into the newly inserted row/column

 

Steps to use insert argument

 

  1. Create a workbook template with markers in it. Here, Employee is the marker variable referred to a class object, followed by its properties separated by dot (.).

 

The below code snippet is used for inserting rows while copying the cell styles and merged area to the next row.

 

 

The below code snippet is used for inserting columns while copying the cell styles to the next column in the horizontal direction.

 

 

The below screenshot shows how the markers are applied for row/column insert in workbook template.

 

 

 

  1. Create template marker processor.

 

 

  1. Add a variable name that is equal to the class object specified in step 1.

 

 

  1. Apply markers.

 

 

Download Complete Sample

 

The following C#/VB.NET complete code snippet shows how to use template marker with insert argument in XlsIO.

 

 

 

 

The below screenshot shows the output document generated using template markers with insert argument.

 

 

Note:

 

 In the above output,

 

  • Cells A5 and B5 are merged and the font style for that cell is italic. These merged region and style were copied to the newly inserted row.

 

  • Cell B12 is filled with background color. This is copied to the next column inserted.

 

  • The data from “C4:D7” is moved to “E4:F7” because two more columns are inserted between column B and column E while importing the data for column insertion.

 

 

Article ID: Published Date: Last Revised Date: Platform: Control:
8501 02/28/2018 02/28/2018 Windows Forms XlsIO
Did you find this information helpful?
Add Comment
You must log in to leave a comment

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.