Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
20
Infragistics Excel formula Query
posted

Hi,

We are using Infragistics Excel control, facing some issue how to copy First row formulas to all other rows with cell increment eg.

First Row formulas

K1=IF(D1="96","",A1)    L1=IF(D1="96","",B1) ,etc.,

same apply to 

K-L column copy for all rows having 1046 rows. formula should change all cell with row id eg K2 should have

K2=IF(D2="96","",A2)    L2=IF(D2="96","",B2) ,etc.,

Note: please share code sample with VB.net

Thanks,

Kumaran Krishnamurthi

  • 0
    Offline posted

    Hii everyone

    To solve the problem of Infragistics Excel controlwe need to use the to copy the formula from the first row to all other rows with cell increments:

    Get the formula from the first row.
    Repeat each next row.
    Update the formula in each cell to adjust cell references based on the row index.
    Apply the update formula to the corresponding cell in each row.
    Be sure to handle any edge cases or special conditions specific to your implementation.

  • 34830
    Offline posted

    Hello Kumaran,

    There does not exist a built-in way to copy a formula to each row of a Worksheet with a cell increment, but this behavior could be easily achieved using a loop. For example, the following code would achieve one of your “IF” formulas for the first 1046 cells:

            Dim workbook As Workbook = New Workbook(WorkbookFormat.Excel2007)
            Dim sheet As Worksheet = workbook.Sheets.Add("Sheet1", SheetType.Worksheet)
    
            For i As Integer = 1 To 1046 - 1
                Dim cell As WorksheetCell = sheet.GetCell("K" & i.ToString())
                Dim formulaString As String = "=IF(D" & i.ToString() & "=" & """96""" & "," & """""" & ",A" & i.ToString() & ")"
                cell.ApplyFormula(formulaString)
            Next

    I hope this helps you. Please let me know if you have any other questions or concerns on this matter.