Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

closedxm Iworksheet excel formulal


                var totalBuldPlanCell = worksheet.Cell(rowIndex, 4);
                var formulaString = new StringBuilder();
                var shiftBuildPlanColumnOffset = 5;
                for (var shiftCounter = 1; shiftCounter <= exportDataView.Shifts.Count; shiftCounter++)
                {
                    var cellAddress = $"{worksheet.Cell(rowIndex, shiftBuildPlanColumnOffset).Address.ColumnLetter}{worksheet.Cell(rowIndex, shiftBuildPlanColumnOffset).Address.RowNumber}";
                    formulaString.Append(cellAddress);

                    if (shiftCounter < exportDataView.Shifts.Count)
                    {
                        formulaString.Append("+");
                    }

                    shiftBuildPlanColumnOffset += 3;
                }

                totalBuldPlanCell.FormulaA1 = formulaString.ToString();
                totalBuldPlanCell.Style.Protection.SetLocked(true);
Source by material.angular.io #
 
PREVIOUS NEXT
Tagged: #closedxm #Iworksheet #excel #formulal
ADD COMMENT
Topic
Name
9+3 =