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