PageSetup.PrintTitleRows fails when copying between workbooks


#1

The PageSetup.PrintTitleRows is not working correctly when copying worksheets between workbooks

This code fails to update the PageSetup


Workbook excelWorkbook0 = new Workbook();
Worksheet ws0 = excelWorkbook0.Worksheets[0];

for (int i = 0; i < 5; i++)
{
ws0.Cells[i, 0].PutValue(string.Format("Header Row {0}", i));
}

for (int i = 5; i < 1000; i++)
{
ws0.Cells[i, 0].PutValue(string.Format("Detail Row {0}", i));
}

Aspose.Cells.PageSetup pagesetup = ws0.PageSetup;
pagesetup.PrintTitleRows = "$1:$5";

Workbook excelWorkbook1 = new Workbook();
excelWorkbook1.Worksheets[0].Copy(excelWorkbook0.Worksheets[0]);
excelWorkbook1.Save(@"C:\Final.xls", FileFormatType.Default);


this code works fine

Workbook excelWorkbook0 = new Workbook();
Worksheet ws0 = excelWorkbook0.Worksheets[0];

for (int i = 0; i < 5; i++)
{
ws0.Cells[i, 0].PutValue(string.Format("Header Row {0}", i));
}

for (int i = 5; i < 1000; i++)
{
ws0.Cells[i, 0].PutValue(string.Format("Detail Row {0}", i));
}

Aspose.Cells.PageSetup pagesetup = ws0.PageSetup;
pagesetup.PrintTitleRows = "$1:$5";
excelWorkbook0.Save(@"C:\Final.xls", FileFormatType.Default);



#2

Please try this attached version.


#3

Thank you Laurence, this is now correct!

James