Print title must be contiguous

Attached is an xls file I created with the following print options:
m_WorkSheet.PageSetup.PrintArea = A1:F105;
m_WorkSheet.PageSetup.CenterHorizontally = true;
m_WorkSheet.PageSetup.CenterVertically = false;
m_WorkSheet.PageSetup.LeftMargin = 0.2362;
m_WorkSheet.PageSetup.RightMargin= 0.2362;
m_WorkSheet.PageSetup.TopMargin = 0.5118;
m_WorkSheet.PageSetup.BottomMargin = 0.5118;
m_WorkSheet.PageSetup.HeaderMargin = 0.4330;
m_WorkSheet.PageSetup.FooterMargin = 0.4330;

if (m_totalColWidth < C_MAX_COLUMNS_FIT_ONE_PAGE)
{
m_WorkSheet.PageSetup.FitToPagesWide = 2;
m_WorkSheet.PageSetup.FitToPagesWide = 1;
m_WorkSheet.PageSetup.PrintTitleRows = "$B$7:$F$7";
m_WorkSheet.PageSetup.PrintTitleColumns = "$B$7:$B$105";
}
else
{
m_WorkSheet.PageSetup.FitToPagesWide = 0;
m_WorkSheet.PageSetup.IsFitToPage = false;
}
m_WorkSheet.PageSetup.FitToPagesTall = 0;

When I select File: Print on the report I receive an excel error that the Print Titles must be contiguous. (try to print the attached file to see error).

So I posted and received some input and the Sample Printtitles project - it works fine.

So I added some code to the sample project to read and set print options on the xls file attached - same thing.
sheet.PageSetup.FitToPagesTall = 0;
sheet.PageSetup.IsFitToPage = false;
sheet.PageSetup.Orientation = ExcelPageOrientation.Portrait;
sheet.PageSetup.PrintTitleRows = "$B$7:$F$7";
sheet.PageSetup.PrintTitleColumns = "$B$7:$B$105";

Can you please provide some guidance to get this to work. I do not need to worry about printing column titles but definately column headers which is row 7 on the attached file.

Thanks!


sample103.zip

1 Reply

MW Melba Winshia Syncfusion Team February 6, 2007 10:48 AM UTC

Hi Rob,

If you want to repeat row 7 on each printed page please use the following code snippets.

//Set Print Title Rows. Repeat row 7
sheet.PageSetup.PrintTitleRows = "$A$7:$IV$7";

If you want to repeat column 2 on each printed page please use the following code snippets.

//Print Columns 2
sheet.PageSetup.PrintTitleColumns = "$B$1:B$65536";

Here is the modified sample:

printtitle.zip

Here is the output file generated:

Sample.xls

Please take a look at the sample above and let me know if you have any other questions.

Regards,
Melba

Loader.
Up arrow icon