// Create the workbook with one worksheet called PageTitles
Infragistics.Documents.Excel.Workbook workbook = new Infragistics.Documents.Excel.Workbook();
Infragistics.Documents.Excel.Worksheet worksheet = workbook.Worksheets.Add("PageTitles");
// Set the repeating print title range of cells across the first row
RepeatTitleRange rtr = new RepeatTitleRange(0, 0);
// Assign our repeat title range to the RowsToRepeatAtTop property
worksheet.PrintOptions.RowsToRepeatAtTop = rtr;
try
{
// Save the created workbook
workbook.Save("output.xls");
// Open the workbook to display the results
System.Diagnostics.Process.Start("output.xls");
}
catch
{
MessageBox.Show("If the workbook is open, please close it before saving.", "Save Error",
MessageBoxButtons.OK, MessageBoxIcon.Stop);
}