Click here to Skip to main content
15,889,992 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello all I am working on a excel template where I have data inserted into a excel sheet and the template the data is being inserted into spans across multiple rows.
Currently the data is inserted for a trip one way.
Well a Driver can have more then 1 trip on a particular day, so the rows that is being used needs to get copyed so it can duplicate itself to have data entered for other trips.

Currently I have data across 1 row working insert the fields in only 1 row and it will copy the row and duplicate itself so new data can be entered.
When I try for multiple rows I cant figure out how to select multiple rows
Here is the code to select 1 row, how a cell is created. And then another different cell

C#
IRow template_row = sheet.GetRow(start_row);

IRow hRow = sheet.CreateRow(row_index);
       hRow.Height = template_row.Height;
{
                    ICell hCell = hRow.CreateCell(colMemberName, CellType.STRING);
                    hCell.CellStyle = template_row.GetCell(colMemberName).CellStyle;
                    hCell.SetCellValue(!String.IsNullOrEmpty(record.CustomerName) ? record.CustomerName : String.Empty);
                }
 
            {
                    ICell hCell = hRow.CreateCell(colWaitTime, CellType.NUMERIC);
                    hCell.CellStyle = template_row.GetCell(colWaitTime).CellStyle;
                    hCell.SetCellValue(record.WaitTime);
                }
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900